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-ia64-devel

Re: [Xen-ia64-devel] Protection key support for PV domains

To: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] Protection key support for PV domains
From: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Jul 2007 14:09:02 +0200
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 23 Jul 2007 05:06:35 -0700
Domainkey-signature: s=s768; d=fujitsu-siemens.com; c=nofws; q=dns; b=MBLxQImIkLCVHP8K6c6MVuE2cDRuZfMwW6og1ioHZXJsllQtIao14suehR8ICLdUjYBCL5vruGXdOSoxlSyfpKLSJ3u3RLTwXvBFr89UhVxH5H5EwWDCPLLdOzANT3ve;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070723024000.GA23978%yamahata@xxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <200707111552.15844.dietmar.hahn@xxxxxxxxxxxxxxxxxxx> <200707201521.57008.dietmar.hahn@xxxxxxxxxxxxxxxxxxx> <20070723024000.GA23978%yamahata@xxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6
Am Montag, 23. Juli 2007 schrieb Isaku Yamahata:
> On Fri, Jul 20, 2007 at 03:21:56PM +0200, Dietmar Hahn wrote:
> > Hi,
>
> Hi.
>
> > Can I replace pkrs[8];tmp[8]; with pkrs[16] to use this for protection
> > keys or should I expand pkrs and leave tmp[8] untouched. How about
> > changing the layout - is this possible here?
>
> Given that xen/ia64 haven't keep the ABI compatibility (Yes, we have
> changed the layout sometimes breaking the compatigbility), it would be
> acceptable to change the layout, I suppose.
>
> > In addition I would use a define for the number of pkrs. The only way to
> > get this is define it in arch-ia64.h for use from vmm and domU. Is this
> > OK or is there another solution possible?
>
> Probably it would be OK because I don't suppose that the number will
> be increased so frequently. Correct?
Yes. It would be something like that:
#define XEN_IA64_NPKRS          15      /* Number of pkr's in PV */
struct mapped_regs {
            ...
            unsigned long pkrs[XEN_IA64_NPKRS+1];
            ...
}

My problem is, that the constant is needed in fw_emul.c to set max_pkr in the 
PAL call emulation. And defining it twice doesn't make sense.

>
> > Btw. I'll use Isaku's suggestion and will add a new hypercall to let vmm
> > setup the cpu-pkrs with the values the domU changed.
>
> Please note that I only read your patch and I haven't even tested your
> patch. I'm not sure how you use pkrs.
> The design decision should depend on its usage model.

My problem is, I'am still unsure about the usage model.
With your suggestion (put pkrs in mapped_regs)  the domU can get the pkr's 
only with reading the memory, but I believe this isn't used often (In our 
ported OS we never do this). Therewith the win of performance is only 
marginal.
The write can be done by writing to pkrs[] and doing a hypercall with the 
register number.
The problem with the pkr is the order in which the cpu-prk's are written from 
the domU. The hypervisor must take care of the order. Within context_switch() 
the cpu-pkr's must be loaded from the pkrs[] vector. This must be done in the 
correct order, because writing a pkr-register leads to invalidating already 
written registers with the same key.
Imaginable for better performance would be that the domU writes multiple pkr's 
in memory, maybe invalidating multiple keys, and only one hypercall is used 
with a bitmask (one bit for every register). But in this case the order gets 
lost or we need a special interface, where the domU provides this 
information. But than the hypercall interface is a lot more complex.
The other way would be the hypervisor doesn't look at the order and the domU 
must ensure that no key is twice in pkrs[].
For our port we won't need the order handling in the hypervisor. But I think a 
correct implementation should be done.

1. pkrs[] in struct arch_vcpu:
   - hypervisor can simple take care about the order
   - no new hypercall
   - mov r=pkrs[], mov pkr[]=r and a hyperprivop
   - simple domU interfaces
2. pkrs[] in struct mapped regs:
   - not in the ABI.
   - fast read possible (maybe not really needed)
   - new hypercall for writing cpu-pkr
   - mov r=pkrs[], mov pkr[]=r, a hyperprivop and the new hypercall
   1. if only setting one pkr per hypercall than hypervisor can simple take
      care of order.
   2. if setting multiple prks[] per hypercall and handling the order in the
      hypervisor, than more support from domU needed.

So what says your long time experience?

Dietmar.

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