Skip to contentSkip to conversation

PATCH: xen pagesize

PATCH Tristan Gingold 2 participants 3 messages Jun 22, 2006 – Jun 23, 2006 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

Hi

some architectures (eg ia64) don't have a canonical page size.
It is possible to build kernels (and Xen) with different page size. Such configurations are not yet working, but as a first step this patch makes the info available.
Ideally pagesize should be a field of platform_parameter but doing so would break binary compatibility.

Tested on xen/ia64.

Tristan.

# HG changeset patch
# User gingold@virtu10
# Node ID c9f7a679ededf41b2eb6a9debce7dc9270252a0e # Parent 6d79b27712c3aa9fe6618b77e1f9594dcf858191 Add XENVER_pagesize hypercall.
Make xen pagesize available through xm info and sysfs.

linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c +13 -0
diff -r 6d79b27712c3 -r c9f7a679eded linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c
@@ -225,6 +225,18 @@ static ssize_t virtual_start_show(struct
 
 HYPERVISOR_ATTR_RO(virtual_start);
 
+static ssize_t pagesize_show(struct hyp_sysfs_attr *attr, char *buffer)
+{
+	int ret;
+
+	ret = HYPERVISOR_xen_version(XENVER_pagesize, NULL);
+	if (ret > 0)
+		ret = sprintf(buffer, "%lx\n", ret);
+	return ret;
+}
+
+HYPERVISOR_ATTR_RO(pagesize);
+
 /* eventually there will be several more features to export */
 static ssize_t xen_feature_show(int index, char *buffer)
 {
@@ -254,6 +266,7 @@ static struct attribute *xen_properties_
 	&capabilities_attr.attr,
 	&changeset_attr.attr,
 	&virtual_start_attr.attr,
+	&pagesize_attr.attr,
 	&writable_pt_attr.attr,
 	NULL
 };
tools/python/xen/lowlevel/xc/xc.c +7 -1
diff -r 6d79b27712c3 -r c9f7a679eded tools/python/xen/lowlevel/xc/xc.c
@@ -637,6 +637,7 @@ static PyObject *pyxc_xeninfo(XcObject *
     xen_capabilities_info_t xen_caps;
     xen_platform_parameters_t p_parms;
     long xen_version;
+    long xen_pagesize;
     char str[128];
 
     xen_version = xc_version(self->xc_handle, XENVER_version, NULL);
@@ -658,11 +659,16 @@ static PyObject *pyxc_xeninfo(XcObject *
 
     sprintf(str, "virt_start=0x%lx", p_parms.virt_start);
 
-    return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s,s:s,s:s}",
+    xen_pagesize = xc_version(self->xc_handle, XENVER_pagesize, NULL);
+    if (xen_pagesize < 0 )
+        return PyErr_SetFromErrno(xc_error);
+
+    return Py_BuildValue("{s:i,s:i,s:s,s:s,s:i,s:s,s:s,s:s,s:s,s:s,s:s}",
                          "xen_major", xen_version >> 16,
                          "xen_minor", (xen_version & 0xffff),
                          "xen_extra", xen_extra,
                          "xen_caps",  xen_caps,
+                         "xen_pagesize", xen_pagesize,
                          "platform_params", str,
                          "xen_changeset", xen_chgset,
                          "cc_compiler", xen_cc.compiler,
tools/python/xen/xend/XendNode.py +1 -0
diff -r 6d79b27712c3 -r c9f7a679eded tools/python/xen/xend/XendNode.py
@@ -86,6 +86,7 @@ class XendNode:
                       'xen_minor',
                       'xen_extra',
                       'xen_caps',
+                      'xen_pagesize',
                       'platform_params',
                       'xen_changeset',
                       'cc_compiler',
tools/xm-test/tests/info/02_info_compiledata_pos.py +2 -1
diff -r 6d79b27712c3 -r c9f7a679eded tools/xm-test/tests/info/02_info_compiledata_pos.py
@@ -24,7 +24,8 @@ for line in lines:
         map[pieces[0]] = pieces[1]
 
 for field in ["cores_per_socket", "threads_per_core", "cpu_mhz",
-              "total_memory", "free_memory", "xen_major", "xen_minor"]:
+              "total_memory", "free_memory", "xen_major", "xen_minor",
+              "xen_pagesize"]:
     val = map[field]
     if not val.isdigit():
         FAIL("Numeric field %s not all-numbers: %s" % (field, val))
xen/common/kernel.c +5 -0
diff -r 6d79b27712c3 -r c9f7a679eded xen/common/kernel.c
@@ -211,6 +211,11 @@ long do_xen_version(int cmd, XEN_GUEST_H
         return 0;
     }
 
+    case XENVER_pagesize:
+    {
+        return PAGE_SIZE;
+    }
+
     }
 
     return -ENOSYS;
xen/include/public/version.h +2 -0
diff -r 6d79b27712c3 -r c9f7a679eded xen/include/public/version.h
@@ -51,6 +51,8 @@ struct xen_feature_info {
 };
 typedef struct xen_feature_info xen_feature_info_t;
 
+#define XENVER_pagesize 7
+
 /* Declares the features reported by XENVER_get_features. */
 #include "features.h"
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Tristan Gingold

some architectures (eg ia64) don't have a canonical page size.
It is possible to build kernels (and Xen) with different page size. Such configurations are not yet working, but as a first step this patch makes the info available.
Ideally pagesize should be a field of platform_parameter but doing so would break binary compatibility.

Why might you care about Xen's page size on such systems? Presumably the guest at this point is happily running on the page size of its choice?

-- Keir

#2 lore raw
Quoted 10 lines · Keir Fraser
Quoted 8 lines · Tristan Gingold

some architectures (eg ia64) don't have a canonical page size. It is possible to build kernels (and Xen) with different page size. Such configurations are not yet working, but as a first step this patch makes
the info available.
Ideally pagesize should be a field of platform_parameter but doing so would
break binary compatibility.

Quoted 3 lines

Why might you care about Xen's page size on such systems? Presumably the guest at this point is happily running on the page size of its choice?

Yes, dom0 might run with its own page size.

But as soon as page operations are involved (domain construction, xenstore, grant operations) xen page size has to be known. Xen and domains have to agree on what is a page.

Tristan.