Skip to contentSkip to conversation

exanime: test for SMT and add a host flag

PATCH Superseded Roger Pau Monne 3 participants 13 messages Apr 15, 2020 – Apr 16, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 exanime: test for SMT and add a host flag

Check if hosts have SMT based on the number of threads per core. A value of threads per core different than 0 implies SMT support.

---
 sg-run-job     |  1 +
 ts-examine-cpu | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100755 ts-examine-cpu
sg-run-job +1 -0
index 97011843..aa7953ac 100755
@@ -679,6 +679,7 @@ proc examine-host-examine {install} {
     if {$ok} {
 	run-ts -.  =           ts-examine-serial-post + host
 	run-ts .   =           ts-examine-iommu       + host
+	run-ts .   =           ts-examine-cpu         + host
 	run-ts .   =           ts-examine-logs-save   + host
 	run-ts .   =           ts-examine-hostprops-save
     }
ts-examine-cpu new file +32 -0
new file mode 100755
index 00000000..98ffab59
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2020 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+BEGIN { unshift @INC, qw(.); }
+use Osstest;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+our $info = target_cmd_output_root($ho, 'xl info', 10);
+our $threads = $info =~ s/^threads_per_core\s*:.*\s//;
+
+logm("$ho->{Ident} threads per core: $threads");
+hostflag_putative_record($ho, "smt", !!$threads);
Signature · 1 line
2.26.0
#1 lore raw

PATCH 2/2 make-flight: add a core scheduling job

Run a simple core scheduling tests on a host that has SMT support. This is only enabled for Xen >= 4.13.

The runvar difference is:

+test-amd64-coresched-amd64-xl all_host_di_version 2020-02-10 +test-amd64-coresched-i386-xl all_host_di_version 2020-02-10

+test-amd64-coresched-amd64-xl all_host_suite      stretch
+test-amd64-coresched-i386-xl  all_host_suite      stretch
+test-amd64-coresched-amd64-xl all_hostflags       arch-amd64,arch-xen-amd64,suite-stretch,purpose-test,smt
+test-amd64-coresched-i386-xl  all_hostflags       arch-i386,arch-xen-amd64,suite-stretch,purpose-test,smt
+test-amd64-coresched-amd64-xl arch                amd64
+test-amd64-coresched-i386-xl  arch                i386
+test-amd64-coresched-amd64-xl buildjob            build-amd64
+test-amd64-coresched-i386-xl  buildjob            build-i386
+test-amd64-coresched-amd64-xl debian_arch         amd64
+test-amd64-coresched-i386-xl  debian_arch         i386
+test-amd64-coresched-amd64-xl debian_kernkind     pvops
+test-amd64-coresched-i386-xl  debian_kernkind     pvops
+test-amd64-coresched-amd64-xl debian_suite        stretch
+test-amd64-coresched-i386-xl  debian_suite        stretch
+test-amd64-coresched-amd64-xl kernbuildjob        build-amd64-pvops
+test-amd64-coresched-i386-xl  kernbuildjob        build-i386-pvops
+test-amd64-coresched-amd64-xl kernkind            pvops
+test-amd64-coresched-i386-xl  kernkind            pvops
+test-amd64-coresched-amd64-xl toolstack           xl
+test-amd64-coresched-i386-xl  toolstack           xl
+test-amd64-coresched-amd64-xl xen_boot_append     sched-gran=core
+test-amd64-coresched-i386-xl  xen_boot_append     sched-gran=core
+test-amd64-coresched-amd64-xl xenbuildjob         build-amd64
+test-amd64-coresched-i386-xl  xenbuildjob         build-amd64
---
 make-flight | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
make-flight +20 -0
index 2f445d95..e656125e 100755
@@ -763,6 +763,17 @@ test_matrix_do_one () {
   *)                test_dom0pvh=n ;;
   esac
 
+  # core scheduling tests for versions >= 4.13 only
+  case "$xenbranch" in
+  xen-3.*-testing)  test_coresched=n ;;
+  xen-4.?-testing)  test_coresched=n ;;
+  xen-4.10-testing) test_coresched=n ;;
+  xen-4.11-testing) test_coresched=n ;;
+  xen-4.12-testing) test_coresched=n ;;
+  *)                test_coresched=y ;;
+  esac
+
+
   # xend PV guest test on x86 only
   if [ x$test_xend = xy -a \( $dom0arch = "i386" -o $dom0arch = "amd64" \) ]; then
     job_create_test test-$xenarch$kern-$dom0arch-pv test-debian xend \
@@ -894,6 +905,15 @@ test_matrix_do_one () {
 
   fi
 
+  # Core-scheduling tests are x86 only
+  if [ x$test_coresched = xy -a $xenarch = amd64 ]; then
+    job_create_test test-$xenarch$kern-coresched-$dom0arch-xl \
+                    test-debian xl $xenarch $dom0arch $debian_runvars \
+                    all_hostflags=$most_hostflags,smt \
+                    xen_boot_append='sched-gran=core'
+
+  fi
+
   #do_passthrough_tests
 
   do_pygrub_tests
Signature · 1 line
2.26.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job

Roger Pau Monne writes ("[PATCH OSSTEST 2/2] make-flight: add a core scheduling job"):

Quoted 2 lines

Run a simple core scheduling tests on a host that has SMT support. This is only enabled for Xen >= 4.13.

...

make-flight test_matrix_do_one () { · line 915

Quoted 8 lines
make-flight +8 -0
+  # Core-scheduling tests are x86 only
+  if [ x$test_coresched = xy -a $xenarch = amd64 ]; then
+    job_create_test test-$xenarch$kern-coresched-$dom0arch-xl \
+                    test-debian xl $xenarch $dom0arch $debian_runvars \
+                    all_hostflags=$most_hostflags,smt \
+                    xen_boot_append='sched-gran=core'
+
+  fi

This seems fine as far as it goes, but all it does is check that things still work if sched-gran=core is passed. I'm not sure whether anything more sophisticated is needed, and in any case this is a step in the right direction, so:

(subject to my comment on 1/ about the flag name.)

Ian.

#3 lore raw

Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job

Quoted 15 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH OSSTEST 2/2] make-flight: add a core scheduling job"):

Quoted 2 lines

Run a simple core scheduling tests on a host that has SMT support. This is only enabled for Xen >= 4.13.

...

make-flight test_matrix_do_one () { · line 915

Quoted 9 lines
make-flight +4 -0
+  # Core-scheduling tests are x86 only
+  if [ x$test_coresched = xy -a $xenarch = amd64 ]; then
+    job_create_test test-$xenarch$kern-coresched-$dom0arch-xl \
+                    test-debian xl $xenarch $dom0arch

$debian_runvars \

make-flight +4 -0
+                    all_hostflags=$most_hostflags,smt \
+                    xen_boot_append='sched-gran=core'
+
+  fi
Quoted 3 lines

This seems fine as far as it goes, but all it does is check that things still work if sched-gran=core is passed.

Yep, and that's enough for enabling and starting using ore-scheduling. So, doing like this, core-scheduling should get the same amount and kind of testing that scheduling in general gets.

Quoted 4 lines

I'm not sure whether
anything more sophisticated is needed, and in any case this is a step in the right direction, so:

Indeed.

One question, as my OSSTest-fu is a bit rusty... does this create "sched-gran=core" tests for all the schedulers? Or just one of them for th default scheduler?

Thanks and Regards

Signature · 6 lines
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)
#4 lore raw

Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job

Quoted 16 lines · Dario Faggioli
Quoted 15 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH OSSTEST 2/2] make-flight: add a core scheduling job"):

Quoted 2 lines

Run a simple core scheduling tests on a host that has SMT support. This is only enabled for Xen >= 4.13.

...

Quoted 9 lines
make-flight +4 -0
+  # Core-scheduling tests are x86 only
+  if [ x$test_coresched = xy -a $xenarch = amd64 ]; then
+    job_create_test test-$xenarch$kern-coresched-$dom0arch-xl \
+                    test-debian xl $xenarch $dom0arch

$debian_runvars \

make-flight +4 -0
+                    all_hostflags=$most_hostflags,smt \
+                    xen_boot_append='sched-gran=core'
+
+  fi
Quoted 6 lines
Quoted 3 lines

This seems fine as far as it goes, but all it does is check that things still work if sched-gran=core is passed.

Yep, and that's enough for enabling and starting using ore-scheduling. So, doing like this, core-scheduling should get the same amount and kind of testing that scheduling in general gets.

Well, we run a lot more tests without 'sched-gran=core', but I don't think it's feasible to duplicate the matrix to run all tests with and without core-scheduling.

Quoted 9 lines
Quoted 4 lines

I'm not sure whether
anything more sophisticated is needed, and in any case this is a step in the right direction, so:

Indeed.

One question, as my OSSTest-fu is a bit rusty... does this create "sched-gran=core" tests for all the schedulers? Or just one of them for th default scheduler?

Just for the default scheduler ATM, we can expand this if required. The test also is very simple, as it just creates a Debian PV guest and does some basic life cycle operations, it's exactly like the job below but with 'sched-gran=core':

http://logs.test-lab.xenproject.org/osstest/logs/149667/test-amd64-amd64-xl/info.html

Roger.

#5 lore raw

Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job

Quoted 6 lines · Roger Pau Monné
Quoted 5 lines · Dario Faggioli
Quoted 4 lines · Ian Jackson

This seems fine as far as it goes, but all it does is check that things still work if sched-gran=core is passed.

Quoted 9 lines
Quoted 4 lines

Yep, and that's enough for enabling and starting using ore- scheduling.
So, doing like this, core-scheduling should get the same amount and kind of testing that scheduling in general gets.

Well, we run a lot more tests without 'sched-gran=core', but I don't think it's feasible to duplicate the matrix to run all tests with and without core-scheduling.

Sure, but again, that's the kind of scheduling testing that we do. E.g., right now that Credit2 is the default scheduler, we still test the other schedulers, exactly with "just" a job like this (AFAICR, at least).

It indeed would be good to have something more specific, not only for core-scheduling, but for scheduling in general. But it's not there right now... That was the point. :-)

Of course the default setup (which, currently, has "sched-gran=cpu") is stressed much more, because all the other jobs also use it, but indeed it does not appear sensible to replicate the matrix for each job that we have with a non-default configuration.

Quoted 7 lines
Quoted 4 lines

One question, as my OSSTest-fu is a bit rusty... does this create "sched-gran=core" tests for all the schedulers? Or just one of them for
th default scheduler?

Just for the default scheduler ATM, we can expand this if required.

Ok, sure. Maybe it would make sense to add just another one for Credit, sooner rather than later, as I guess there may be people wanting to continue use Credit, but they may want to try it with core-scheduling.

Of course, this can be done on top of this patch... I was just thinking out loud here. :-)

Thanks and Regards

Signature · 6 lines
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)
#6 lore raw

Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job

Dario Faggioli writes ("Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job"):

Quoted 3 lines

Ok, sure. Maybe it would make sense to add just another one for Credit, sooner rather than later, as I guess there may be people wanting to continue use Credit, but they may want to try it with core-scheduling.

Maybe in return we could delete the rtds test which has been marked nonblocking forever and which no-one seems to be fixing ? :-)

Patches welcome...

Ian.

#7 lore raw

Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job

In reply to Roger Pau Monné

Roger Pau Monne writes ("Re: [PATCH OSSTEST 2/2] make-flight: add a core scheduling job"):

Quoted 8 lines · Dario Faggioli
Quoted 3 lines

Yep, and that's enough for enabling and starting using ore-scheduling. So, doing like this, core-scheduling should get the same amount and kind of testing that scheduling in general gets.

Well, we run a lot more tests without 'sched-gran=core', but I don't think it's feasible to duplicate the matrix to run all tests with and without core-scheduling.

Yes, I agree with Roger.

Quoted 10 lines
Quoted 3 lines

One question, as my OSSTest-fu is a bit rusty... does this create "sched-gran=core" tests for all the schedulers? Or just one of them for th default scheduler?

Just for the default scheduler ATM, we can expand this if required. The test also is very simple, as it just creates a Debian PV guest and does some basic life cycle operations, it's exactly like the job below but with 'sched-gran=core':

http://logs.test-lab.xenproject.org/osstest/logs/149667/test-amd64-amd64-xl/info.html

Right.

Thanks,
Ian.

#8 lore raw

PATCH v2 1/2 exanime: test for SMT and add a host flag

In reply to Roger Pau Monne

Check if hosts have SMT based on the number of threads per core. A value of threads per core greater than 1 implies SMT support.

---
Changes since v1:
- Fix regex and set SMT if number of threads per core is > 1.

---
 sg-run-job     |  1 +
 ts-examine-cpu | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100755 ts-examine-cpu
sg-run-job +1 -0
index 97011843..aa7953ac 100755
@@ -679,6 +679,7 @@ proc examine-host-examine {install} {
     if {$ok} {
 	run-ts -.  =           ts-examine-serial-post + host
 	run-ts .   =           ts-examine-iommu       + host
+	run-ts .   =           ts-examine-cpu         + host
 	run-ts .   =           ts-examine-logs-save   + host
 	run-ts .   =           ts-examine-hostprops-save
     }
ts-examine-cpu new file +32 -0
new file mode 100755
index 00000000..c30311ab
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2020 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+BEGIN { unshift @INC, qw(.); }
+use Osstest;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+our $info = target_cmd_output_root($ho, 'xl info', 10);
+our $threads = $info =~ /^threads_per_core\s*:\s.*/m;
+
+logm("$ho->{Ident} threads per core: $threads");
+hostflag_putative_record($ho, "smt", $threads > 1);
Signature · 1 line
2.26.0
#9 lore raw

Roger Pau Monne writes ("[PATCH OSSTEST v2 1/2] exanime: test for SMT and add a host flag"):

Quoted 2 lines

Check if hosts have SMT based on the number of threads per core. A value of threads per core greater than 1 implies SMT support.

I spotted the "0" in v1 but since you had clearly stated the same thing in the commit message too I thought you knew what you were doing :-).

Thanks,
Ian.

#10 lore raw
In reply to Roger Pau Monne

Roger Pau Monne writes ("[PATCH OSSTEST 1/2] exanime: test for SMT and add a host flag"):

Quoted 2 lines

Check if hosts have SMT based on the number of threads per core. A value of threads per core different than 0 implies SMT support.

...

ts-examine-cpu line 32

Quoted 2 lines
ts-examine-cpu new file +2 -0
+logm("$ho->{Ident} threads per core: $threads");
+hostflag_putative_record($ho, "smt", !!$threads);

This code LGTM but I wonder if it would be a good idea to start namespacing these kind of hardware feature flags. cpu-*, hardware-*, feature-* maybe ? Would you care to make a suggestion ?

Ian.

#11 lore raw
Quoted 10 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH OSSTEST 1/2] exanime: test for SMT and add a host flag"):

Quoted 2 lines

Check if hosts have SMT based on the number of threads per core. A value of threads per core different than 0 implies SMT support.

...

ts-examine-cpu line 32

Quoted 2 lines
ts-examine-cpu new file +2 -0
+logm("$ho->{Ident} threads per core: $threads");
+hostflag_putative_record($ho, "smt", !!$threads);

This code LGTM but I wonder if it would be a good idea to start namespacing these kind of hardware feature flags. cpu-*, hardware-*, feature-* maybe ? Would you care to make a suggestion ?

cpu-smt seems fine if we plan to do similar namespacing with other hardware features, I could see cpu-{smt,vmx,svm} and devices-{iommu,sriov,ats} or some such for example.

If OTOH we don't want to be that fine grained I think hw-{smt,iommu,vmx,...} would also be fine.

Not sure whether this has helped much. I guess my vote would be for cpu-smt namespace.

Thanks, Roger.

#12 lore raw

Roger Pau Monne writes ("Re: [PATCH OSSTEST 1/2] exanime: test for SMT and add a host flag"):

Quoted 5 lines

If OTOH we don't want to be that fine grained I think hw-{smt,iommu,vmx,...} would also be fine.

Not sure whether this has helped much. I guess my vote would be for cpu-smt namespace.

Let's go with hw-*. That will avoid chopping logic over the precise nature of hardware features, especially ones which have elements in multiple components.

Thanks,
Ian.