All of lore.kernel.org
 help / color / mirror / Atom feed
* [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen.
@ 2014-10-21  6:10 Rita Sinha
  2014-10-21  9:13 ` Ian Campbell
  2014-10-21  9:21 ` Olaf Hering
  0 siblings, 2 replies; 7+ messages in thread
From: Rita Sinha @ 2014-10-21  6:10 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper

This patch is in response to
http://wiki.xenproject.org/wiki/Outreach_Program_Projects#CPU.2FRAM.2FPCI_diagram_tool
project for applying to OPW-Round9.It adds support for reading system
architecture information from BIOS and verifies it with Xen via xl toolstack.

---
 dmidecode.pl | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 dmidecode.pl

diff --git a/dmidecode.pl b/dmidecode.pl
new file mode 100644
index 0000000..8556cfd
--- /dev/null
+++ b/dmidecode.pl
@@ -0,0 +1,61 @@
+#!/usr/bin/perl
+
+# dmidecode.pl - a script to read the system architecture information
+# directly from the BIOS and verify with xen.  Only for Linux.
+#
+# Rita Sinha (rita.sinha89@gmail.com)
+# OPW Program-Round9
+# 21/10/14
+
+`id -u` == 0 || die "must be run as root";
+
+open(DmiFh, "/usr/sbin/dmidecode |") or
+  die "problem running dmidecode";
+$DmiNumProcs = 0;
+$DmiNumSockets = 0;
+while(<DmiFh>)
+  {
+    next unless /Central Processor/;
+    # We've found a processor (or at least a socket), keep going
+    while(<DmiFh>)
+	{
+	  # Keep walking the dmidecode output to find out if
+	  # the socket has a processor in it.
+	  last if /^Handle/;
+	  next unless /Status/;
+	  $DmiNumSockets += 1;
+	  /Populated/ and $DmiNumProcs += 1;
+	  last;
+	}
+  }
+close DmiFh;
+
+open(CpuInfoFh, "/proc/cpuinfo") || die "failed to open /proc/cpuinfo!";
+$CpuInfoNumProcs = 0;
+while(<CpuInfoFh>)
+  {
+    next unless /^processor.*:/;
+    ($CpuInfoNumProcs) += (/^processor.*: (\d+)/);
+  }
+close CpuInfoFh;
+
+my @command = `xl list`;
+my @xen_values = split(' ', $command[1]);
+
+
+if ( $DmiNumProcs != $CpuInfoNumProcs )
+  {
+    print "Warning: dmidecode reports $DmiNumProcs processors, kernel reports $CpuInfoNumProcs processors.\n";
+  }
+
+if ( $DmiNumProcs != $DmiNumSockets )
+  {
+    print "Info: dmidecode reports $DmiNumSockets cpu sockets, but only $DmiNumProcs processors.\n";
+  }
+
+if ( $DmiNumProcs != @xen_values[3] )
+  {
+    print "Warning: dmidecode reports $DmiNumProcs processors, xen reports $xenCpus processors\n";
+  }
+
+
-- 
1.8.3.1

The information contained in this electronic mail transmission 
may be privileged and confidential, and therefore, protected 
from disclosure. If you have received this communication in 
error, please notify us immediately by replying to this 
message and deleting it from your computer without copying 
or disclosing it.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen.
  2014-10-21  6:10 [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen Rita Sinha
@ 2014-10-21  9:13 ` Ian Campbell
  2014-10-21  9:53   ` Rita Sinha
  2014-10-21  9:21 ` Olaf Hering
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Campbell @ 2014-10-21  9:13 UTC (permalink / raw)
  To: Rita Sinha; +Cc: Andrew Cooper, xen-devel

On Tue, 2014-10-21 at 11:40 +0530, Rita Sinha wrote:
> This patch is in response to
> http://secure-web.cisco.com/1YB1awPInStO2hrLa12KgfqobN6IDb1NLSm9NDTo00PshSMkAjWOlHjGJGcermXIpIZUvx3-fqRwDbSnhthheWCKKPOn5XvXx826jIO9jEhbTjUrPXeSn7NTVUCES71yLs1nX_OAbMCmg1MPlywqp3SUGT6O973O-mDSzQty_mYU/http%3A%2F%2Fwiki.xenproject.org%2Fwiki%2FOutreach_Program_Projects#CPU.2FRAM.2FPCI_diagram_tool
> project for applying to OPW-Round9.It adds support for reading system
> architecture information from BIOS and verifies it with Xen via xl toolstack.
> 
> ---
>  dmidecode.pl | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Which git tree is this against? It certainly wouldn't be correct to dump
this into the toplevel of xen.git.

>  1 file changed, 61 insertions(+)
>  create mode 100644 dmidecode.pl
> 
> diff --git a/dmidecode.pl b/dmidecode.pl
> new file mode 100644
> index 0000000..8556cfd
> --- /dev/null
> +++ b/dmidecode.pl
> @@ -0,0 +1,61 @@
> +#!/usr/bin/perl
> +
> +# dmidecode.pl - a script to read the system architecture information
> +# directly from the BIOS and verify with xen.  Only for Linux.
> +#
> +# Rita Sinha (rita.sinha89@gmail.com)
> +# OPW Program-Round9
> +# 21/10/14
> +
> +`id -u` == 0 || die "must be run as root";
> +
> +open(DmiFh, "/usr/sbin/dmidecode |") or
> +  die "problem running dmidecode";
> +$DmiNumProcs = 0;
> +$DmiNumSockets = 0;
> +while(<DmiFh>)
> +  {
> +    next unless /Central Processor/;
> +    # We've found a processor (or at least a socket), keep going
> +    while(<DmiFh>)
> +	{
> +	  # Keep walking the dmidecode output to find out if
> +	  # the socket has a processor in it.
> +	  last if /^Handle/;
> +	  next unless /Status/;
> +	  $DmiNumSockets += 1;
> +	  /Populated/ and $DmiNumProcs += 1;
> +	  last;
> +	}
> +  }
> +close DmiFh;
> +
> +open(CpuInfoFh, "/proc/cpuinfo") || die "failed to open /proc/cpuinfo!";
> +$CpuInfoNumProcs = 0;
> +while(<CpuInfoFh>)
> +  {
> +    next unless /^processor.*:/;
> +    ($CpuInfoNumProcs) += (/^processor.*: (\d+)/);
> +  }
> +close CpuInfoFh;
> +
> +my @command = `xl list`;
> +my @xen_values = split(' ', $command[1]);
> +
> +
> +if ( $DmiNumProcs != $CpuInfoNumProcs )
> +  {
> +    print "Warning: dmidecode reports $DmiNumProcs processors, kernel reports $CpuInfoNumProcs processors.\n";
> +  }
> +
> +if ( $DmiNumProcs != $DmiNumSockets )
> +  {
> +    print "Info: dmidecode reports $DmiNumSockets cpu sockets, but only $DmiNumProcs processors.\n";
> +  }
> +
> +if ( $DmiNumProcs != @xen_values[3] )
> +  {
> +    print "Warning: dmidecode reports $DmiNumProcs processors, xen reports $xenCpus processors\n";
> +  }
> +
> +

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen.
  2014-10-21  6:10 [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen Rita Sinha
  2014-10-21  9:13 ` Ian Campbell
@ 2014-10-21  9:21 ` Olaf Hering
  2014-10-21 10:04   ` Rita Sinha
  1 sibling, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2014-10-21  9:21 UTC (permalink / raw)
  To: Rita Sinha; +Cc: Andrew Cooper, xen-devel

On Tue, Oct 21, Rita Sinha wrote:

> +my @command = `xl list`;
> +my @xen_values = split(' ', $command[1]);

> +if ( $DmiNumProcs != @xen_values[3] )
> +    print "Warning: dmidecode reports $DmiNumProcs processors, xen reports $xenCpus processors\n";

Is a warning expected if dom0 is booted with dom0_max_vcpus=N?

Olaf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen.
  2014-10-21  9:13 ` Ian Campbell
@ 2014-10-21  9:53   ` Rita Sinha
  2014-10-21 10:14     ` Ian Campbell
  0 siblings, 1 reply; 7+ messages in thread
From: Rita Sinha @ 2014-10-21  9:53 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Andrew Cooper, Xen-devel

Hi Ian,

This is against the
http://xenbits.xen.org/git-http/people/andrewcoop/hwloc.git tree not
xen.git.

Regards,
Rita Sinha

On Tue, Oct 21, 2014 at 2:43 PM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Tue, 2014-10-21 at 11:40 +0530, Rita Sinha wrote:
>> This patch is in response to
>> http://secure-web.cisco.com/1YB1awPInStO2hrLa12KgfqobN6IDb1NLSm9NDTo00PshSMkAjWOlHjGJGcermXIpIZUvx3-fqRwDbSnhthheWCKKPOn5XvXx826jIO9jEhbTjUrPXeSn7NTVUCES71yLs1nX_OAbMCmg1MPlywqp3SUGT6O973O-mDSzQty_mYU/http%3A%2F%2Fwiki.xenproject.org%2Fwiki%2FOutreach_Program_Projects#CPU.2FRAM.2FPCI_diagram_tool
>> project for applying to OPW-Round9.It adds support for reading system
>> architecture information from BIOS and verifies it with Xen via xl toolstack.
>>
>> ---
>>  dmidecode.pl | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Which git tree is this against? It certainly wouldn't be correct to dump
> this into the toplevel of xen.git.
>
>>  1 file changed, 61 insertions(+)
>>  create mode 100644 dmidecode.pl
>>
>> diff --git a/dmidecode.pl b/dmidecode.pl
>> new file mode 100644
>> index 0000000..8556cfd
>> --- /dev/null
>> +++ b/dmidecode.pl
>> @@ -0,0 +1,61 @@
>> +#!/usr/bin/perl
>> +
>> +# dmidecode.pl - a script to read the system architecture information
>> +# directly from the BIOS and verify with xen.  Only for Linux.
>> +#
>> +# Rita Sinha (rita.sinha89@gmail.com)
>> +# OPW Program-Round9
>> +# 21/10/14
>> +
>> +`id -u` == 0 || die "must be run as root";
>> +
>> +open(DmiFh, "/usr/sbin/dmidecode |") or
>> +  die "problem running dmidecode";
>> +$DmiNumProcs = 0;
>> +$DmiNumSockets = 0;
>> +while(<DmiFh>)
>> +  {
>> +    next unless /Central Processor/;
>> +    # We've found a processor (or at least a socket), keep going
>> +    while(<DmiFh>)
>> +     {
>> +       # Keep walking the dmidecode output to find out if
>> +       # the socket has a processor in it.
>> +       last if /^Handle/;
>> +       next unless /Status/;
>> +       $DmiNumSockets += 1;
>> +       /Populated/ and $DmiNumProcs += 1;
>> +       last;
>> +     }
>> +  }
>> +close DmiFh;
>> +
>> +open(CpuInfoFh, "/proc/cpuinfo") || die "failed to open /proc/cpuinfo!";
>> +$CpuInfoNumProcs = 0;
>> +while(<CpuInfoFh>)
>> +  {
>> +    next unless /^processor.*:/;
>> +    ($CpuInfoNumProcs) += (/^processor.*: (\d+)/);
>> +  }
>> +close CpuInfoFh;
>> +
>> +my @command = `xl list`;
>> +my @xen_values = split(' ', $command[1]);
>> +
>> +
>> +if ( $DmiNumProcs != $CpuInfoNumProcs )
>> +  {
>> +    print "Warning: dmidecode reports $DmiNumProcs processors, kernel reports $CpuInfoNumProcs processors.\n";
>> +  }
>> +
>> +if ( $DmiNumProcs != $DmiNumSockets )
>> +  {
>> +    print "Info: dmidecode reports $DmiNumSockets cpu sockets, but only $DmiNumProcs processors.\n";
>> +  }
>> +
>> +if ( $DmiNumProcs != @xen_values[3] )
>> +  {
>> +    print "Warning: dmidecode reports $DmiNumProcs processors, xen reports $xenCpus processors\n";
>> +  }
>> +
>> +
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen.
  2014-10-21  9:21 ` Olaf Hering
@ 2014-10-21 10:04   ` Rita Sinha
  2014-10-21 10:08     ` Olaf Hering
  0 siblings, 1 reply; 7+ messages in thread
From: Rita Sinha @ 2014-10-21 10:04 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Andrew Cooper, Xen-devel

Hi Olaf,

>
> Is a warning expected if dom0 is booted with dom0_max_vcpus=N?
>

My current script would not issue any warning even if dom0 is booted
with dom0_max_vcpus=N.

Do you thing this case needs to be handled?

I am generating a warning only if BIOS is lying about the number of
vpus or under the influence of virtualization, sysfs and proc
interfaces  information is no longer accurate, particularly any
information based around numbers of cpus.

Regards,
Rita Sinha

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen.
  2014-10-21 10:04   ` Rita Sinha
@ 2014-10-21 10:08     ` Olaf Hering
  0 siblings, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2014-10-21 10:08 UTC (permalink / raw)
  To: Rita Sinha; +Cc: Andrew Cooper, Xen-devel

On Tue, Oct 21, Rita Sinha wrote:

> > Is a warning expected if dom0 is booted with dom0_max_vcpus=N?
> My current script would not issue any warning even if dom0 is booted
> with dom0_max_vcpus=N.
> 
> Do you thing this case needs to be handled?

I have no idea what this script is all about. It just looked like "xl
list" will report something else for dom0 than dmidecode for the whole
host.

Olaf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen.
  2014-10-21  9:53   ` Rita Sinha
@ 2014-10-21 10:14     ` Ian Campbell
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2014-10-21 10:14 UTC (permalink / raw)
  To: Rita Sinha; +Cc: Andrew Cooper, Xen-devel

On Tue, 2014-10-21 at 15:23 +0530, Rita Sinha wrote:
> Hi Ian,
> 
> This is against the
> http://xenbits.xen.org/git-http/people/andrewcoop/hwloc.git tree not
> xen.git.

Ah, I see. In which case please could you prefix $subject with "hwloc:"
or something so I know whether or not I need to review.

Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-21 10:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21  6:10 [OPW][PATCH v2] Support added to read system information from BIOS and verify it with Xen Rita Sinha
2014-10-21  9:13 ` Ian Campbell
2014-10-21  9:53   ` Rita Sinha
2014-10-21 10:14     ` Ian Campbell
2014-10-21  9:21 ` Olaf Hering
2014-10-21 10:04   ` Rita Sinha
2014-10-21 10:08     ` Olaf Hering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.