|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v2 8/8] xen/sysfs: Honor cached xen_features instead
Currently, /sys/hypervisor/properties/features queries the xen
features from the hypervisor even if it doesn't match what Linux
uses itself (i.e what were the features at the time of the boot).
For consistency when migrations are involved, report cached
xen_features instead, that also avoids making hypercalls to query
this information.
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
CC: Juergen Gross <jgross@xxxxxxxx>
CC: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
CC: x86@xxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
I'm not sure what /sys/hypervisor/features is expected to show between
what Linux considers (proposal) and what the hypervisor tells (current
behavior).
drivers/xen/sys-hypervisor.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index 91923242a5ae..7786bb40b966 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -4,6 +4,7 @@
* Authored by: Mike D. Day <ncmike@xxxxxxxxxx>
*/
+#include <linux/bitmap.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/init.h>
@@ -15,6 +16,7 @@
#include <xen/xen.h>
#include <xen/xenbus.h>
+#include <xen/features.h>
#include <xen/interface/xen.h>
#include <xen/interface/version.h>
#ifdef CONFIG_XEN_HAVE_VPMU
@@ -321,15 +323,9 @@ HYPERVISOR_ATTR_RO(pagesize);
static ssize_t xen_feature_show(int index, char *buffer)
{
- ssize_t ret;
- struct xen_feature_info info;
-
- info.submap_idx = index;
- ret = HYPERVISOR_xen_version(XENVER_get_features, &info);
- if (!ret)
- ret = sprintf(buffer, "%08x", info.submap);
+ unsigned long submap = bitmap_read(xen_features, index * 32, 32);
- return ret;
+ return sprintf(buffer, "%08x", (unsigned int)submap);
}
static ssize_t features_show(struct hyp_sysfs_attr *attr, char *buffer)
--
2.56.0
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |