WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] 32-on-64 support in xen-unstable?

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] 32-on-64 support in xen-unstable?
From: Chris Lalancette <clalance@xxxxxxxxxx>
Date: Mon, 06 Jul 2009 16:18:25 +0200
Delivery-date: Mon, 06 Jul 2009 07:18:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Hello,
     I've been browsing through the preemptible pagetable stuff, and ran across
a piece of code that I don't understand or is buggy.  Looking at
arch/x86/mm.c:new_guest_cr3(), we have this code for 32-on-64 support:

    if ( is_pv_32on64_domain(d) )
    {
        okay = paging_mode_refcounts(d)
            ? 0 /* Old code was broken, but what should it be? */
            : mod_l4_entry(
                    __va(pagetable_get_paddr(curr->arch.guest_table)),
                    l4e_from_pfn(
                        mfn,
                        (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
                    pagetable_get_pfn(curr->arch.guest_table), 0, 0, curr) == 0;
        if ( unlikely(!okay) )
        {
            MEM_LOG("Error while installing new compat baseptr %lx", mfn);
            return 0;
        }

However, looking at arch/x86/mm.c:mod_l4_entry(), it returns 0 on success and <
0 on error.  It seems to me that booting a 32-bit PV guest is always going to
fall into the !okay check on success, when it really shouldn't.  Shouldn't this
be something like:

        okay = paging_mode_refcounts(d)
            ? 0 /* Old code was broken, but what should it be? */
            : !mod_l4_entry(
                    __va(pagetable_get_paddr(curr->arch.guest_table)),
                    l4e_from_pfn(
                        mfn,
                        (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
                    pagetable_get_pfn(curr->arch.guest_table), 0, 0, curr) == 0;

Or am I just missing something?  (NOTE: this still leaves open the possibility
for failure if mod_l4_entry() returns EINTR or EAGAIN, but maybe we don't have
to worry about that here?)

Thanks,
-- 
Chris Lalancette

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>