Ryan Harper
2006-Aug-14 16:57 UTC
[Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
This patch adds a test in the create bucket to exercise the parsing of the cpus parameter. This patch utilizes the new form of getVcpuInfo from [PATCH 1/3]. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com diffstat output: b/tools/xm-test/tests/create/17_create_cpusparm_pos.py | 57 +++++++++++++++++ tools/xm-test/tests/create/Makefile.am | 3 2 files changed, 59 insertions(+), 1 deletion(-) Signed-off-by: Ryan Harper <ryanh@us.ibm.com> --- diff -r 0296a77536dd tools/xm-test/tests/create/Makefile.am --- a/tools/xm-test/tests/create/Makefile.am Wed Aug 09 11:00:00 2006 -0500 +++ b/tools/xm-test/tests/create/Makefile.am Wed Aug 09 11:07:06 2006 -0500 @@ -14,7 +14,8 @@ TESTS = 01_create_basic_pos.test \ 13_create_multinic_pos.test \ 14_create_blockroot_pos.test \ 15_create_smallmem_pos.test \ - 16_create_smallmem_neg.test + 16_create_smallmem_neg.test \ + 17_create_cpusparm_pos.py EXTRA_DIST = $(TESTS) diff -r 0296a77536dd tools/xm-test/tests/create/17_create_cpusparm_pos.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/xm-test/tests/create/17_create_cpusparm_pos.py Wed Aug 09 11:08:59 2006 -0500 @@ -0,0 +1,57 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2006 +# Authors: Dan Smith <danms@us.ibm.com> +# : Ryan Harper <ryanh@us.ibm.com> +# +# This test will examine Xend''s cpu/cpus parameter parsing ability. The cpus +# parameter controls which physical cpus the domain''s vcpus run upon. We can +# set a single cpumask for all vcpus, or we can build up lists of cpumasks +# to be applied individually. The test covers the following cases: +# +# single vcpu tests +# multi-vcpu tests using same values +# multi-vcpu tests using differing values per-vcpu +# multi-vcpu tests as above, mix-notation (using [ ] and '' '' interspersed) +# +# format: (#vcpus, cpus= value, list of resulting affinity values) +cpu_strings=[ (1, ''0'', ["0"]), + (1, ''0-3'', ["0-3"]), + (1, ''1,3,5'', ["1,3,5"]), + (1, ''0-3,^2'', ["0-1,3"]), + (2, ''0'', ["0", "0"]), + (2, ''0-3'', ["0-3", "0-3"]), + (2, ''1,3,5'', ["1,3,5", "1,3,5"]), + (2, ''0-3,^2'', ["0-1,3", "0-1,3"]), + (2, ''0, 1'', ["0", "1"]), + (2, ''0-3, 4-7'', ["0-3", "4-7"]), + (2, ''1,3,5, 0,2,4'', ["1,3,5", "0,2,4"]), + (2, ''0-3,^2, 4-7,^6'', ["0-1,3", "4-5,7"]), + (2, "[0, ''1'']", ["0", "1"]), + (2, "[''0-3'', 4-7]", ["0-3", "4-7"]), + (2, "[''1,3,5'', 0,2,4]", ["1,3,5", "0,2,4"]), + (2, "[''0-3,^2'', 4-7,^6]", ["0-1,3", "4-5,7"]) ] + +from XmTestLib import * + +# for each test string, start up the domain and then examine vcpuinfo to +# determine whether the affinity value for a particular vcpu was correct. +for (x,y,z) in cpu_strings: + domain = XmTestDomain(extraConfig={"vcpus": x, "cpus": y}) + + # kick off domain + try: + console = domain.start() + except DomainError, e: + FAIL("Unable to start a domain with vcpus=%s cpus=%s"%(x, y)) + + # get vcpuinfo on the domain''s vcpus. + vcpuinfo = getVcpuInfo(domain.getName()) + + # for each vcpu, check the affinity value + for a in range(0,x): + if vcpuinfo[a][''affinity''] != z[a]: + FAIL("Failed to set VCPU affinity for cpus=%s ([%s] != [%s])"%( + y, vcpuinfo[a][''affinity''], z[a])) + + domain.destroy() _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Aug-14 17:34 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
On 14/8/06 5:57 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote:> This patch adds a test in the create bucket to exercise the parsing of > the cpus parameter. This patch utilizes the new form of getVcpuInfo > from [PATCH 1/3].Do these tests succeed even if, e.g. The test machine has only one CPU? Xen will clip the cpumasks when it receives them (also it will fail the set_affinity call if none of the specified CPUs are online) but this may not matter if the affinity data is cached within xend and getVcpuInfo obtains info from that cache. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2006-Aug-14 17:37 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
* Keir Fraser <Keir.Fraser@cl.cam.ac.uk> [2006-08-14 12:35]:> > > > On 14/8/06 5:57 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote: > > > This patch adds a test in the create bucket to exercise the parsing of > > the cpus parameter. This patch utilizes the new form of getVcpuInfo > > from [PATCH 1/3]. > > Do these tests succeed even if, e.g. The test machine has only one CPU? Xen > will clip the cpumasks when it receives them (also it will fail the > set_affinity call if none of the specified CPUs are online) but this may not > matter if the affinity data is cached within xend and getVcpuInfo obtains > info from that cache.Good question. I''ll check and resend this test with the smp level check so this test will be skipped if the host is not smp capable. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Aug-16 09:11 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
On 14/8/06 6:37 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote:>> Do these tests succeed even if, e.g. The test machine has only one CPU? Xen >> will clip the cpumasks when it receives them (also it will fail the >> set_affinity call if none of the specified CPUs are online) but this may not >> matter if the affinity data is cached within xend and getVcpuInfo obtains >> info from that cache. > > Good question. I''ll check and resend this test with the smp level check > so this test will be skipped if the host is not smp capable.Either this test will work on UP just fine, so no need for any extra checks, or it will need a more sophisticated check than SMP-vs-UP. What if you have a quad test box (you refer to cpus up to 7)? -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2006-Aug-16 14:27 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
* Keir Fraser <Keir.Fraser@cl.cam.ac.uk> [2006-08-16 04:13]:> > > > On 14/8/06 6:37 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote: > > >> Do these tests succeed even if, e.g. The test machine has only one CPU? Xen > >> will clip the cpumasks when it receives them (also it will fail the > >> set_affinity call if none of the specified CPUs are online) but this may not > >> matter if the affinity data is cached within xend and getVcpuInfo obtains > >> info from that cache. > > > > Good question. I''ll check and resend this test with the smp level check > > so this test will be skipped if the host is not smp capable. > > Either this test will work on UP just fine, so no need for any extra checks, > or it will need a more sophisticated check than SMP-vs-UP. What if you have > a quad test box (you refer to cpus up to 7)?As long as the first cpu in the mask is available then the affinity settings will succeed. In my current revision of the test I examined the number of vcpus in the test strings but I think instead I''ll examine all of the test strings and compare the first value of every set. The max of those values is the minimum number of cpus needed since xen will pin the vcpu to the first bit in the affinity mask. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Aug-16 14:43 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
On 16/8/06 3:27 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote:> As long as the first cpu in the mask is available then the affinity > settings will succeed.Really? Xen itself doesn''t have such a test (at least not any more) I believe. Xen ANDs the mask with cpu_online_map and then complains if the result is empty. -- Keir> In my current revision of the test I examined the > number of vcpus in the test strings but I think instead I''ll examine all > of the test strings and compare the first value of every set. The max > of those values is the minimum number of cpus needed since xen will pin > the vcpu to the first bit in the affinity mask._______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2006-Aug-16 14:49 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
* Keir Fraser <Keir.Fraser@cl.cam.ac.uk> [2006-08-16 09:44]:> > > > On 16/8/06 3:27 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote: > > > As long as the first cpu in the mask is available then the affinity > > settings will succeed. > > Really? Xen itself doesn''t have such a test (at least not any more) I > believe. Xen ANDs the mask with cpu_online_map and then complains if the > result is empty.Ah, ok. Then they''ve been working because of the size of the machine I''m on. I''ll change the test values such that I have a set for 2, 4, and 8 ensuring that each set doesn''t use values that won''t be available. I can then run largest set that can run on the host. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Aug-16 14:58 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
On 16/8/06 3:49 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote:>>> As long as the first cpu in the mask is available then the affinity >>> settings will succeed. >> >> Really? Xen itself doesn''t have such a test (at least not any more) I >> believe. Xen ANDs the mask with cpu_online_map and then complains if the >> result is empty. > > Ah, ok. Then they''ve been working because of the size of the machine > I''m on. I''ll change the test values such that I have a set for 2, 4, > and 8 ensuring that each set doesn''t use values that won''t be > available. I can then run largest set that can run on the host.Are you *sure* the tests don''t just work as they are? I raised the issue as a possible problem -- not because I''m certain it''s a problem. As I said, xend may hide from the user the details of what Xen does to the affinity mask. So, have you tried running your new tests on a machine booted with the nosmp parameter to Xen (not dom0 -- you want to boot with one physical cpu)? If that doesn''t work then, yes, it may need working around like you describe. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2006-Aug-16 15:07 UTC
Re: [Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket
* Keir Fraser <Keir.Fraser@cl.cam.ac.uk> [2006-08-16 10:00]:> On 16/8/06 3:49 pm, "Ryan Harper" <ryanh@us.ibm.com> wrote: > > >>> As long as the first cpu in the mask is available then the affinity > >>> settings will succeed. > >> > >> Really? Xen itself doesn''t have such a test (at least not any more) I > >> believe. Xen ANDs the mask with cpu_online_map and then complains if the > >> result is empty. > > > > Ah, ok. Then they''ve been working because of the size of the machine > > I''m on. I''ll change the test values such that I have a set for 2, 4, > > and 8 ensuring that each set doesn''t use values that won''t be > > available. I can then run largest set that can run on the host. > > Are you *sure* the tests don''t just work as they are? I raised the issue as > a possible problem -- not because I''m certain it''s a problem. As I said, > xend may hide from the user the details of what Xen does to the affinity > mask. So, have you tried running your new tests on a machine booted with the > nosmp parameter to Xen (not dom0 -- you want to boot with one physical cpu)?I tried with maxcpu=1, and that failed to produce the required output as with only one cpu which prompted me to add the smp check to ensure I had enough vcpus. I''ve not tried the nosmp, but I imagine that the results will be the same. Let me give the current test a run on a 2-way, and I''ll give nosmp a try as well. If they fail I''ll change the test values accordingly. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel