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] Add new location of Linux direct-map to theplace

To: "Ian Pratt" <Ian.Pratt@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Add new location of Linux direct-map to theplaces to look for writable mappings
From: "George Dunlap" <dunlapg@xxxxxxxxx>
Date: Mon, 15 Sep 2008 11:56:14 +0100
Cc: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, xen-devel mailing list <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 15 Sep 2008 03:56:40 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=RUPk/N46iXlFJ4nFxUvQJU5dYzdDzXAhNMEpBQvdeZE=; b=Kh+uoIci6r9hH5hW8L4w668ixmsT+K39mRH/fGmHxfxBhL9iM0/Ab5uMBdUY6nD4vr DOlTns+IUAQ+qCAzwnZK+vnA2ZdZpXHcmZXMQFPf1XsVEaOiW5Oun9P0532pYvmEGmCu qo91v+getfrb2Q5AI8x//BUE21xPhCr8Ju/VM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=S1nfED669Sk0jSQ1USr0YdDiXe/PlvqFHryXiUEH58lDAfaWNt4VprHl+/MtbR6t3X Ez8XDc5OFOy0k4LDtJsLDnx6ItIem45F9rDCpml9l6MK7I2FDY0wTF3uzg8Aj1gq/sOA ljIuniLEHpzTssRhPSoDNcDaCMQgxNh4IhBh4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <DD74FBB8EE28D441903D56487861CD9D35C65107@xxxxxxxxxxxxxxxxxxxxxx>
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>
References: <de76405a0809120838kee79064s6e81254a6ad0ebce@xxxxxxxxxxxxxx> <46f44832-0241-48ff-a6d2-d278003d42a1@default> <DD74FBB8EE28D441903D56487861CD9D35C65107@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, Sep 12, 2008 at 8:19 PM, Ian Pratt <Ian.Pratt@xxxxxxxxxxxxx> wrote:
> There are three different mechanisms that different OSes use to update
> their pagetables: 1:1 direct map regions, linear recursive map regions,
> and kmap-style regions. It would be possible to come up with logic to
> automatically detect and identify these regions, but its non trivial.
> The test might be quite expensive, so you'd want to run it for a while
> and then make a decision on the type and location. If you started
> getting too many 'misses' you'd want to re-evaluate the decision as the
> guest kernel may have changed mode of operation (perhaps someone's done
> a kexec, or the boot time behaviour was different from runtime).

Even automatically detecting this is still fairly OS-specific: it
relies on the fact that Linux normally does direct-mapping, and
Windows normally does linear recursive maps.  If FooOS came out and
used the formula (LIMIT-gpfn) instead of (BASE+gpfn), for instance,
we'd be back to square one.

If it were less expensive (detection path on every set_l1e()
basically), or the exact addresses tended to move around a lot, that
might be a good option.  But as Ian said, it would add a significant
amount of code to a common path, and the addresses really don't change
all that often.

Thanks for bringing this up though, Dan -- It's good to revisit these
kinds of decisions every so often to make sure that they're still
valid.

 -George

>
> Anyhow, it's certainly possible to do this automatically, but given that
> the mechanism and location used by kernels typically doesn't change the
> hard-coded heuristic has served us pretty well to date. Feel free to
> send patches :-)
>
> What would also be interesting would be a shadow pagetable mode that
> stored 'back pointers' to enable one to easily find all the shadow PTEs
> that point to a page. This would be useful for some of the more fancy
> shadow pagetable modes that are interesting from a research POV, as well
> as coping with guests that use some other mechanism for updating PTEs
> (if such guests exist).
>
> Ian
>
>
>
>
>
>
>
>
>> > -----Original Message-----
>> > From: George Dunlap [mailto:George.Dunlap@xxxxxxxxxxxxx]
>> > Sent: Friday, September 12, 2008 9:39 AM
>> > To: xen-devel mailing list
>> > Subject: [Xen-devel] [PATCH] Add new location of Linux
>> > direct-map to the
>> > places to look for writable mappings
>> >
>> >
>> > Add new location of Linux direct-map to the places to look for
>> > writable mappings.
>> >
>> > Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
>> >
>> > diff -r dbac9ee4d761 xen/arch/x86/mm/shadow/common.c
>> > --- a/xen/arch/x86/mm/shadow/common.c       Mon Sep 08 16:02:13 2008
>> +0100
>> > +++ b/xen/arch/x86/mm/shadow/common.c       Fri Sep 12 16:42:32 2008
>> +0100
>> > @@ -2385,9 +2385,11 @@ int sh_remove_write_access(struct vcpu *
>> >                            + ((fault_addr & VADDR_MASK) >>
>> > 27), 3); break;
>> >              }
>> >
>> > -            /* 64bit Linux direct map at 0xffff810000000000;
>> > older kernels
>> > -             * had it at 0x0000010000000000UL */
>> > +            /* 64bit Linux direct map at 0xffff880000000000;
>> > older kernels
>> > +             * had it at 0xffff880000000000, and older
>> > kernels yet had it
>> > +             * at 0x0000010000000000UL */
>> >              gfn = mfn_to_gfn(v->domain, gmfn);
>> > +            GUESS(0xffff880000000000UL + (gfn << PAGE_SHIFT), 4);
>> >              GUESS(0xffff810000000000UL + (gfn << PAGE_SHIFT), 4);
>> >              GUESS(0x0000010000000000UL + (gfn << PAGE_SHIFT), 4);
>> >
>> > _______________________________________________
>> > Xen-devel mailing list
>> > Xen-devel@xxxxxxxxxxxxxxxxxxx
>> > http://lists.xensource.com/xen-devel
>> >
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-devel
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>

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