Re: [PATCH OSSTEST 1/2] exanime: test for SMT and add a host flag

2020-04-15 Thread Ian Jackson
Roger Pau Monne writes ("Re: [PATCH OSSTEST 1/2] exanime: test for SMT and add 
a host flag"):
> 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.



Re: [PATCH OSSTEST 1/2] exanime: test for SMT and add a host flag

2020-04-15 Thread Roger Pau Monné
On Wed, Apr 15, 2020 at 02:04:35PM +0100, Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH OSSTEST 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.
> ...
> > +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.



Re: [PATCH OSSTEST 1/2] exanime: test for SMT and add a host flag

2020-04-15 Thread Ian Jackson
Roger Pau Monne writes ("[PATCH OSSTEST 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.
...
> +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.



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

2020-04-15 Thread Roger Pau Monne
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.

Signed-off-by: Roger Pau Monné 
---
 sg-run-job |  1 +
 ts-examine-cpu | 32 
 2 files changed, 33 insertions(+)
 create mode 100755 ts-examine-cpu

diff --git a/sg-run-job b/sg-run-job
index 97011843..aa7953ac 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -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
 }
diff --git a/ts-examine-cpu b/ts-examine-cpu
new file mode 100755
index ..98ffab59
--- /dev/null
+++ b/ts-examine-cpu
@@ -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 .
+
+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);
-- 
2.26.0