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

Re: [Xen-devel] [patch] pagetable cleanups, next version

To: Chris Wright <chrisw@xxxxxxxx>
Subject: Re: [Xen-devel] [patch] pagetable cleanups, next version
From: Gerd Knorr <kraxel@xxxxxxxxxxx>
Date: Fri, 15 Apr 2005 18:46:54 +0200
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 15 Apr 2005 16:49:52 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20050415162338.GQ493@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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20050415125620.GA7531@bytesex> <20050415162338.GQ493@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
> > -    unsigned long *pt = map_domain_mem(pt_mfn << PAGE_SHIFT);
> > -    unsigned long match =
> > -        (readonly_gmfn << PAGE_SHIFT) | _PAGE_RW | _PAGE_PRESENT;
> > -    unsigned long mask = PAGE_MASK | _PAGE_RW | _PAGE_PRESENT;
> > +    l1_pgentry_t *pt = map_domain_mem(pt_mfn << PAGE_SHIFT);
> > +    l1_pgentry_t match;
> 
> I don't quite understand how this is equivalent.

Well, I admit it's a bit confusing because multiple things are changed
at the same time ...

> How does the match work now?

I quote a few more lines important lines from the patch:

> > +    unsigned long flags = _PAGE_RW | _PAGE_PRESENT;
> > +    match = l1e_create_pfn(readonly_gmfn, flags);

> > -#define MATCH_ENTRY(_i) (((pt[_i] ^ match) & mask) == 0)

> > -    if ( MATCH_ENTRY(readonly_gpfn & (L1_PAGETABLE_ENTRIES - 1)) &&
> > -         fix_entry(readonly_gpfn & (L1_PAGETABLE_ENTRIES - 1)) )
> > +    i = readonly_gpfn & (L1_PAGETABLE_ENTRIES - 1);
> > +    if ( !l1e_has_changed(&pt[i], &match, flags) && fix_entry(i) )

There is the new l?e_has_changed() function which can be used to compare
two page table entries.  It takes ptr's to two page table entries and a
bitmask with the page flags it should care about.  The function will
also deal with PAGE_MASK, so this is gone from the functions calling
into l?e_has_changed().

In that particular function I also ditched the MATCH_ENTRY() macro which
did something simliar to l?e_has_changed() in a less generic way.  That
makes the code look even more different, although it _should_ be the
same logic and it IMHO is also more readable.  I admit that I havn't
tested shadow mode though ...

CC'ing xen-devel again so others can have a look as well.

> Looks like create plus has changed is the new way?

Huh?  I lost you here ...

  Gerd

-- 
#define printk(args...) fprintf(stderr, ## args)

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

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