Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666095 > unrolled thread
| Started by | Juergen Gross <jgross@suse.com> |
|---|---|
| First post | 2017-06-14 19:30 +0200 |
| Last post | 2017-06-14 21:00 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v4 0/4] xen: add xen sysfs nodes Juergen Gross <jgross@suse.com> - 2017-06-14 19:30 +0200
[PATCH v4 2/4] xen: add sysfs node for guest type Juergen Gross <jgross@suse.com> - 2017-06-14 19:30 +0200
Re: [PATCH v4 2/4] xen: add sysfs node for guest type Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-06-14 19:50 +0200
Re: [PATCH v4 2/4] xen: add sysfs node for guest type Juergen Gross <jgross@suse.com> - 2017-06-14 21:00 +0200
Re: [PATCH v4 2/4] xen: add sysfs node for guest type Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-06-14 21:00 +0200
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-06-14 19:30 +0200 |
| Subject | [PATCH v4 0/4] xen: add xen sysfs nodes |
| Message-ID | <tSkhb-85J-5@gated-at.bofh.it> |
In order to be able to determine the Xen guest type from within the
guest as a user there is currently no stable interface available.
Add a sysfs node for that purpose as the guest type information is
available for the kernel.
While doing this document all the other Xen related sysfs nodes.
Add another node to show the Xen hypervisor buildid in order to make
hypervisor live patching easier.
Juergen Gross (4):
doc,xen: document hypervisor sysfs nodes for xen
xen: add sysfs node for guest type
xen: sync include/xen/interface/version.h
xen: add sysfs node for hypervisor build id
Documentation/ABI/stable/sysfs-hypervisor-xen | 119 +++++++++++++++++++++
.../{sysfs-hypervisor-pmu => sysfs-hypervisor-xen} | 24 ++++-
MAINTAINERS | 2 +
drivers/xen/sys-hypervisor.c | 59 ++++++++++
include/xen/interface/version.h | 15 +++
5 files changed, 217 insertions(+), 2 deletions(-)
create mode 100644 Documentation/ABI/stable/sysfs-hypervisor-xen
rename Documentation/ABI/testing/{sysfs-hypervisor-pmu => sysfs-hypervisor-xen} (54%)
--
2.12.3
[toc] | [next] | [standalone]
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-06-14 19:30 +0200 |
| Subject | [PATCH v4 2/4] xen: add sysfs node for guest type |
| Message-ID | <tSkhc-85J-33@gated-at.bofh.it> |
| In reply to | #1666095 |
Currently there is no reliable user interface inside a Xen guest to
determine its type (e.g. HVM, PV or PVH). Instead of letting user mode
try to determine this by various rather hacky mechanisms (parsing of
boot messages before they are gone, trying to make use of known subtle
differences in behavior of some instructions), add a sysfs node
/sys/hypervisor/guest_type to explicitly deliver this information as
it is known to the kernel.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V4:
- use xen_domain_type instead of introducing xen_guest_type
(Boris Ostrovsky)
V2:
- remove PVHVM guest type (Andrew Cooper)
- move description to Documentation/ABI/testing/sysfs-hypervisor-xen
(Boris Ostrovsky)
- make xen_guest_type const char * (Jan Beulich)
- modify standard ARM guest type to "Xen"
---
.../{sysfs-hypervisor-pmu => sysfs-hypervisor-xen} | 15 +++++++++--
MAINTAINERS | 2 +-
drivers/xen/sys-hypervisor.c | 31 ++++++++++++++++++++++
3 files changed, 45 insertions(+), 3 deletions(-)
rename Documentation/ABI/testing/{sysfs-hypervisor-pmu => sysfs-hypervisor-xen} (67%)
diff --git a/Documentation/ABI/testing/sysfs-hypervisor-pmu b/Documentation/ABI/testing/sysfs-hypervisor-xen
similarity index 67%
rename from Documentation/ABI/testing/sysfs-hypervisor-pmu
rename to Documentation/ABI/testing/sysfs-hypervisor-xen
index 224faa105e18..c0edb3fdd6eb 100644
--- a/Documentation/ABI/testing/sysfs-hypervisor-pmu
+++ b/Documentation/ABI/testing/sysfs-hypervisor-xen
@@ -1,8 +1,19 @@
+What: /sys/hypervisor/guest_type
+Date: May 2017
+KernelVersion: 4.13
+Contact: xen-devel@lists.xenproject.org
+Description: If running under Xen:
+ Type of guest:
+ "Xen": standard guest type on arm
+ "HVM": fully virtualized guest (x86)
+ "PV": paravirtualized guest (x86)
+ "PVH": fully virtualized guest without legacy emulation (x86)
+
What: /sys/hypervisor/pmu/pmu_mode
Date: August 2015
KernelVersion: 4.3
Contact: Boris Ostrovsky <boris.ostrovsky@oracle.com>
-Description:
+Description: If running under Xen:
Describes mode that Xen's performance-monitoring unit (PMU)
uses. Accepted values are
"off" -- PMU is disabled
@@ -17,7 +28,7 @@ What: /sys/hypervisor/pmu/pmu_features
Date: August 2015
KernelVersion: 4.3
Contact: Boris Ostrovsky <boris.ostrovsky@oracle.com>
-Description:
+Description: If running under Xen:
Describes Xen PMU features (as an integer). A set bit indicates
that the corresponding feature is enabled. See
include/xen/interface/xenpmu.h for available features
diff --git a/MAINTAINERS b/MAINTAINERS
index 68c31aebb79c..5630439429e6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13983,7 +13983,7 @@ F: arch/x86/include/asm/xen/
F: include/xen/
F: include/uapi/xen/
F: Documentation/ABI/stable/sysfs-hypervisor-xen
-F: Documentation/ABI/testing/sysfs-hypervisor-pmu
+F: Documentation/ABI/testing/sysfs-hypervisor-xen
XEN HYPERVISOR ARM
M: Stefano Stabellini <sstabellini@kernel.org>
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index 84106f9c456c..10400917e8e8 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -50,6 +50,32 @@ static int __init xen_sysfs_type_init(void)
return sysfs_create_file(hypervisor_kobj, &type_attr.attr);
}
+static ssize_t guest_type_show(struct hyp_sysfs_attr *attr, char *buffer)
+{
+ const char *type = "???";
+
+ switch (xen_domain_type) {
+ case XEN_NATIVE:
+ /* ARM only. */
+ type = "Xen";
+ break;
+ case XEN_PV_DOMAIN:
+ type = "PV";
+ break;
+ case XEN_HVM_DOMAIN:
+ type = xen_pvh_domain() ? "PVH" : "HVM";
+ break;
+ }
+ return sprintf(buffer, "%s\n", type);
+}
+
+HYPERVISOR_ATTR_RO(guest_type);
+
+static int __init xen_sysfs_guest_type_init(void)
+{
+ return sysfs_create_file(hypervisor_kobj, &guest_type_attr.attr);
+}
+
/* xen version attributes */
static ssize_t major_show(struct hyp_sysfs_attr *attr, char *buffer)
{
@@ -471,6 +497,9 @@ static int __init hyper_sysfs_init(void)
ret = xen_sysfs_type_init();
if (ret)
goto out;
+ ret = xen_sysfs_guest_type_init();
+ if (ret)
+ goto guest_type_out;
ret = xen_sysfs_version_init();
if (ret)
goto version_out;
@@ -502,6 +531,8 @@ static int __init hyper_sysfs_init(void)
comp_out:
sysfs_remove_group(hypervisor_kobj, &version_group);
version_out:
+ sysfs_remove_file(hypervisor_kobj, &guest_type_attr.attr);
+guest_type_out:
sysfs_remove_file(hypervisor_kobj, &type_attr.attr);
out:
return ret;
--
2.12.3
[toc] | [prev] | [next] | [standalone]
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| Date | 2017-06-14 19:50 +0200 |
| Subject | Re: [PATCH v4 2/4] xen: add sysfs node for guest type |
| Message-ID | <tSkAx-8cx-17@gated-at.bofh.it> |
| In reply to | #1666098 |
> --- a/Documentation/ABI/testing/sysfs-hypervisor-pmu
> +++ b/Documentation/ABI/testing/sysfs-hypervisor-xen
> @@ -1,8 +1,19 @@
> +What: /sys/hypervisor/guest_type
> +Date: May 2017
> +KernelVersion: 4.13
> +Contact: xen-devel@lists.xenproject.org
> +Description: If running under Xen:
> + Type of guest:
> + "Xen": standard guest type on arm
> + "HVM": fully virtualized guest (x86)
> + "PV": paravirtualized guest (x86)
> + "PVH": fully virtualized guest without legacy emulation (x86)
> +
>
>
> +static ssize_t guest_type_show(struct hyp_sysfs_attr *attr, char *buffer)
> +{
> + const char *type = "???";
> +
> + switch (xen_domain_type) {
> + case XEN_NATIVE:
> + /* ARM only. */
> + type = "Xen";
> + break;
> + case XEN_PV_DOMAIN:
> + type = "PV";
> + break;
> + case XEN_HVM_DOMAIN:
> + type = xen_pvh_domain() ? "PVH" : "HVM";
> + break;
> + }
I think we should return -EINVAL for unknown type. Or document "???" in
the ABI document.
-boris
> + return sprintf(buffer, "%s\n", type);
> +}
>
[toc] | [prev] | [next] | [standalone]
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-06-14 21:00 +0200 |
| Subject | Re: [PATCH v4 2/4] xen: add sysfs node for guest type |
| Message-ID | <tSlGh-od-1@gated-at.bofh.it> |
| In reply to | #1666114 |
[Multipart message — attachments visible in raw view] — view raw
On 14/06/17 19:43, Boris Ostrovsky wrote:
>
>> --- a/Documentation/ABI/testing/sysfs-hypervisor-pmu
>> +++ b/Documentation/ABI/testing/sysfs-hypervisor-xen
>> @@ -1,8 +1,19 @@
>> +What: /sys/hypervisor/guest_type
>> +Date: May 2017
>> +KernelVersion: 4.13
>> +Contact: xen-devel@lists.xenproject.org
>> +Description: If running under Xen:
>> + Type of guest:
>> + "Xen": standard guest type on arm
>> + "HVM": fully virtualized guest (x86)
>> + "PV": paravirtualized guest (x86)
>> + "PVH": fully virtualized guest without legacy emulation (x86)
>> +
>>
>
>
>
>>
>> +static ssize_t guest_type_show(struct hyp_sysfs_attr *attr, char *buffer)
>> +{
>> + const char *type = "???";
>> +
>> + switch (xen_domain_type) {
>> + case XEN_NATIVE:
>> + /* ARM only. */
>> + type = "Xen";
>> + break;
>> + case XEN_PV_DOMAIN:
>> + type = "PV";
>> + break;
>> + case XEN_HVM_DOMAIN:
>> + type = xen_pvh_domain() ? "PVH" : "HVM";
>> + break;
>> + }
>
> I think we should return -EINVAL for unknown type. Or document "???" in
> the ABI document.
Hmm, okay. Are you fine with the attached patch?
Juergen
[toc] | [prev] | [next] | [standalone]
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| Date | 2017-06-14 21:00 +0200 |
| Subject | Re: [PATCH v4 2/4] xen: add sysfs node for guest type |
| Message-ID | <tSlGh-od-7@gated-at.bofh.it> |
| In reply to | #1666147 |
> Hmm, okay. Are you fine with the attached patch? Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web