public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Ruediger Meier <sweet_f_a@gmx.de>
To: Alexander Graf <agraf@suse.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Karel Zak <kzak@redhat.com>, Paul Mackerras <paulus@au1.ibm.com>,
	util-linux@vger.kernel.org, Stanislav Brabec <sbrabec@suse.cz>,
	Petr Uzel <petr.uzel@suse.cz>,
	Ben Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
Date: Wed, 28 May 2014 23:54:21 +0200	[thread overview]
Message-ID: <201405282354.22353.sweet_f_a@gmx.de> (raw)
In-Reply-To: <537DC3A1.6000401@suse.de>

Thank you all for your comments!

Patch set updated here:
https://github.com/karelzak/util-linux/pull/87


On Thursday 22 May 2014, Alexander Graf wrote:
> >>>> +	if (path_exist("/proc/iSeries")) {
> >>>> +		desc->hyper = HYPER_OS400;
> >>>> +		desc->virtype = VIRT_FULL;
> >>> ... shouldn't this be VIRT_PARA? Somebody who knows this may correct this.
> 
> iSeries is PV, yes. Among others it's also dead :). But I'll let Ben 
> comment.

We set VIRT_PARA now for iSeries and (real) pSeries. 
 
> >>>
> >>>> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
> >>>> +		FILE *fd;
> >>>> +		desc->hyper = HYPER_PHYP;
> >>>> +		desc->virtype = VIRT_FULL;
> >>> Maybe more obvious here for pSeries where p seems to stand for para
> >>> http://www.ibm.com/developerworks/aix/library/au-syspvirtualization/index.html?S_TACT=105AGX99&S_CMP=CP
> 
> This is slightly more complicated. The ibm,partition-name device tree 
> property is defined in sPAPR which is a specification that both pHyp and 
> QEMU implement. Right now QEMU does not expose the ibm,partition-name 
> property, but there's no reason it will stay that way.
> 
> There are a few ways we could try to distinguish QEMU's implementation 
> of the pSeries machine and pHyp's implementation of it.
> 
>    /proc/device-tree/hmc-managed?
> 
> I don't think QEMU will ever implement this property, but at least my 
> pHyp reference VM does. If it's there we can use it as a definite marker 
> that we are in fact running on pHyp.
> 
>    /proc/device-tree/chosen/qemu,graphic-width

OK, we do it like this for now
  if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")
      && path_exist(_PATH_PROC_DEVICETREE "/hmc-managed?")
      && !path_exist(_PATH_PROC_DEVICETREE "/chosen/qemu,graphic-width")) {
  desc->hyper = HYPER_PHYP;
  desc->virtype = VIRT_PARA;
  ....  

Haven't yet done something about the "pSeries on QEMU/KVM" detection
according to the comments below. Could be that our existing KVM detection
would catch it already.

IMO we should add a script to easily make correct (and complete) /sys, /proc
dumps. So users who own exotic machines could send us test data.

> Only QEMU puts qemu, properties in the chosen directory. At least the 
> current code always sets the graphic-* properties, so if we find one we 
> can safely assume we're running on QEMU. We do not know whether we're 
> running on KVM yet.
> 
> Checking on KVM is slightly more tricky. I think we have 2 options:
> 
>    1) Check if /proc/device-tree/cpus/*@0/timebase-frequency is 1000000000.
> 
>       If it is, we're emulated (no KVM). If it's not, we're running with 
> a native CPU (KVM).
> 
>    2) Check whether /proc/device-tree/hypervisor/compatible == "linux,kvm"
> 
>      I have a patch in my queue to make the sPAPR compliant pSeries 
> machine type in QEMU also ePAPR compliant and expose a /hypervisor node. 
> Current versions of QEMU don't do this though, so this would not catch 
> QEMU versions < 2.1.
> 
>      The nice thing about the ePAPR compliant check is that we'd catch 
> non-pSeries machine types as well. We expose this node on all emulated 
> Mac machines and on FSL e500 style machines.
> 
> 
> Alex
> 
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2014-05-28 21:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
2014-05-20 15:42 ` [PATCH 1/5] lscpu: minor cleanup and " Ruediger Meier
2014-05-20 15:42 ` [PATCH 2/5] tests: add vbox lscpu dump Ruediger Meier
2014-05-20 15:42 ` [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors Ruediger Meier
2014-05-21  7:37   ` Karel Zak
2014-05-21  9:43     ` Ruediger Meier
2014-05-21 12:41       ` Karel Zak
2014-05-21 23:03   ` Ruediger Meier
2014-05-22  8:48     ` Karel Zak
2014-05-22  9:08       ` Heiko Carstens
2014-05-22  9:30         ` Alexander Graf
2014-05-28 21:54           ` Ruediger Meier [this message]
2014-05-28 22:29             ` Alexander Graf
2014-05-20 15:42 ` [PATCH 4/5] lscpu: improve vmware detection Ruediger Meier
2014-05-20 18:40   ` Ruediger Meier
2014-05-20 15:42 ` [PATCH 5/5] lscpu: avoid compiler warnings Ruediger Meier
2014-05-21  8:10   ` Karel Zak
2014-05-20 16:34 ` [PATCH 0/5] lscpu: improve hypervisor detection Stanislav Brabec
2014-05-20 18:13   ` Ruediger Meier
2014-05-21  8:24   ` Karel Zak
2014-05-21 22:29 ` Ruediger Meier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201405282354.22353.sweet_f_a@gmx.de \
    --to=sweet_f_a@gmx.de \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kzak@redhat.com \
    --cc=paulus@au1.ibm.com \
    --cc=petr.uzel@suse.cz \
    --cc=sbrabec@suse.cz \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox