Skip to contentSkip to conversation

PATH: start_pfn field in xen_domctl_getmemlist_t

PATCH Tristan Gingold 2 participants 3 messages Aug 29, 2006 – Aug 30, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

Because getmemlist needs to be restartable and read P2M, xen/ia64 has always passed start_pfn info trough the hypercall.

Until now it was combined with max_pfns into the max_pfns field. This was not very clean. Because the API has just been changed I think this is the right time to make this small change.

Tested on xen/ia64.

Tristan.

# HG changeset patch
# User gingold@virtu10
# Node ID 567c096d007013f3195037fcb69d8c79548c57dd # Parent 684fdcfb251a443fa885c142b427d253ec033212 Add a start_pfn field in xen_domctl_getmemlist. This is used by ia64 because it directly reads the P2M table.

tools/libxc/ia64/xc_ia64_stubs.c +5 -11
diff -r 684fdcfb251a -r 567c096d0070 tools/libxc/ia64/xc_ia64_stubs.c
@@ -36,7 +36,6 @@ xc_ia64_get_pfn_list(int xc_handle, uint
     struct xen_domctl domctl;
     int num_pfns,ret;
     unsigned int __start_page, __nr_pages;
-    unsigned long max_pfns;
     xen_pfn_t *__pfn_buf;
 
     __start_page = start_page;
@@ -44,27 +43,22 @@ xc_ia64_get_pfn_list(int xc_handle, uint
     __pfn_buf = pfn_buf;
   
     while (__nr_pages) {
-        max_pfns = ((unsigned long)__start_page << 32) | __nr_pages;
         domctl.cmd = XEN_DOMCTL_getmemlist;
-        domctl.domain   = (domid_t)domid;
-        domctl.u.getmemlist.max_pfns = max_pfns;
+        domctl.domain = (domid_t)domid;
+        domctl.u.getmemlist.max_pfns = __nr_pages;
+        domctl.u.getmemlist.start_pfn =__start_page;
         domctl.u.getmemlist.num_pfns = 0;
         set_xen_guest_handle(domctl.u.getmemlist.buffer, __pfn_buf);
 
-        if ((max_pfns != -1UL)
-            && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) {
+        if (mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) {
             PERROR("Could not lock pfn list buffer");
             return -1;
         }
 
         ret = do_domctl(xc_handle, &domctl);
 
-        if (max_pfns != -1UL)
-            (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
+        (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
 
-        if (max_pfns == -1UL)
-            return 0;
-        
         num_pfns = domctl.u.getmemlist.num_pfns;
         __start_page += num_pfns;
         __nr_pages -= num_pfns;
xen/arch/ia64/xen/dom0_ops.c +2 -2
diff -r 684fdcfb251a -r 567c096d0070 xen/arch/ia64/xen/dom0_ops.c
@@ -40,8 +40,8 @@ long arch_do_domctl(xen_domctl_t *op, XE
     {
         unsigned long i;
         struct domain *d = find_domain_by_id(op->domain);
-        unsigned long start_page = op->u.getmemlist.max_pfns >> 32;
-        unsigned long nr_pages = op->u.getmemlist.max_pfns & 0xffffffff;
+        unsigned long start_page = op->u.getmemlist.start_pfn;
+        unsigned long nr_pages = op->u.getmemlist.max_pfns;
         unsigned long mfn;
 
         if ( d == NULL ) {
xen/include/public/domctl.h +1 -0
diff -r 684fdcfb251a -r 567c096d0070 xen/include/public/domctl.h
@@ -73,6 +73,7 @@ struct xen_domctl_getmemlist {
 struct xen_domctl_getmemlist {
     /* IN variables. */
     uint64_t max_pfns;
+    uint64_t start_pfn;
     XEN_GUEST_HANDLE_64(ulong) buffer;
     /* OUT variables. */
     uint64_t num_pfns;

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

#1 lore raw
Quoted 3 lines · Tristan Gingold

Because getmemlist needs to be restartable and read P2M, xen/ia64 has always passed start_pfn info trough the hypercall.

By "restartable" you mean create a continuation? Why does getmemlist need to be restartable only on IA64? Also, where does the IA64 code create a continuation for it now?

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#2 lore raw
Quoted 5 lines · Hollis Blanchard
Quoted 2 lines · Tristan Gingold

Because getmemlist needs to be restartable and read P2M, xen/ia64 has always passed start_pfn info trough the hypercall.

By "restartable" you mean create a continuation?

No.
getmemlist may fail during copy to guest, because of missing TLB entries. We manually restart the call.

Quoted 3 lines

Why does getmemlist
need to be restartable only on IA64? Also, where does the IA64 code create a continuation for it now?

See xc_ia64_get_pfn_list in tools/libxc/ia64/xc_ia64_stubs.c

Tristan.