Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Devel

[help]: VPID tagged TLBs question.

 

 

Xen devel RSS feed   Index | Next | Previous | View Threaded


mukesh.rathor at oracle

Apr 25, 2012, 6:07 PM

Post #1 of 4 (118 views)
Permalink
[help]: VPID tagged TLBs question.

Hi,

(Assume VPID is available and enabled.)

I'm trying to figure the TLB stuff with VPIDs. I understand from the
poorly written chapter in the intel manual that if an HVM vcpu is running
then only the TLBs tagged with the vcpu.VPID will be used. If xen
or a PV guest is running, then VPID 0 TLBs are what will be used.

Now I understand the hvm_asid_flush_vcpu upon new guest cr3, will jsut
create a new asid/vpid, so the older vcpu.vpid tlb entries will just not
be used.

However, I don't understand the use of hvm_asid_flush_core which
it appears will cause all HVM vcpu's to get new vpid/asid, hence, discard
all previously used VPID tagged TLBs. In particular, consider a PV
guest:

write_ptbase -> write_cr3 -> hvm_flush_guest_tlbs -> hvm_asid_flush_core().

Since the PV guest is only using VPID 0 tagged TLBs, why do we need to
flush all TLBs for all HVM guests?

thanks
Mukesh



_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


keir.xen at gmail

Apr 26, 2012, 12:23 AM

Post #2 of 4 (110 views)
Permalink
Re: [help]: VPID tagged TLBs question. [In reply to]

On 26/04/2012 02:07, "Mukesh Rathor" <mukesh.rathor [at] oracle> wrote:

> However, I don't understand the use of hvm_asid_flush_core which
> it appears will cause all HVM vcpu's to get new vpid/asid, hence, discard
> all previously used VPID tagged TLBs. In particular, consider a PV
> guest:
>
> write_ptbase -> write_cr3 -> hvm_flush_guest_tlbs -> hvm_asid_flush_core().
>
> Since the PV guest is only using VPID 0 tagged TLBs, why do we need to
> flush all TLBs for all HVM guests?

It's just being conservative, as callers of write_cr3 may assume that the
TLB is entirely flushed, for all guests.

-- Keir



_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


mukesh.rathor at oracle

Apr 27, 2012, 6:25 PM

Post #3 of 4 (112 views)
Permalink
Re: [help]: VPID tagged TLBs question. [In reply to]

On Thu, 26 Apr 2012 08:23:29 +0100
Keir Fraser <keir.xen [at] gmail> wrote:

> On 26/04/2012 02:07, "Mukesh Rathor" <mukesh.rathor [at] oracle> wrote:
>
> > However, I don't understand the use of hvm_asid_flush_core which
> > it appears will cause all HVM vcpu's to get new vpid/asid, hence,
> > discard all previously used VPID tagged TLBs. In particular,
> > consider a PV guest:
> >
> > write_ptbase -> write_cr3 -> hvm_flush_guest_tlbs ->
> > hvm_asid_flush_core().
> >
> > Since the PV guest is only using VPID 0 tagged TLBs, why do we need
> > to flush all TLBs for all HVM guests?
>
> It's just being conservative, as callers of write_cr3 may assume that
> the TLB is entirely flushed, for all guests.

Well, for write_cr3 path at least, we just need to invalidate all TLBs
in the local pcpu. So it seems for this path we could just do
invvpid with type 2, ie, invalidate all vpids except 0. Prob also need
to do 'invept 2'. what do you think, worth it?

thanks,
Mukesh



_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


keir.xen at gmail

Apr 27, 2012, 10:45 PM

Post #4 of 4 (114 views)
Permalink
Re: [help]: VPID tagged TLBs question. [In reply to]

On 28/04/2012 02:25, "Mukesh Rathor" <mukesh.rathor [at] oracle> wrote:

> On Thu, 26 Apr 2012 08:23:29 +0100
> Keir Fraser <keir.xen [at] gmail> wrote:
>
>> On 26/04/2012 02:07, "Mukesh Rathor" <mukesh.rathor [at] oracle> wrote:
>>
>>> However, I don't understand the use of hvm_asid_flush_core which
>>> it appears will cause all HVM vcpu's to get new vpid/asid, hence,
>>> discard all previously used VPID tagged TLBs. In particular,
>>> consider a PV guest:
>>>
>>> write_ptbase -> write_cr3 -> hvm_flush_guest_tlbs ->
>>> hvm_asid_flush_core().
>>>
>>> Since the PV guest is only using VPID 0 tagged TLBs, why do we need
>>> to flush all TLBs for all HVM guests?
>>
>> It's just being conservative, as callers of write_cr3 may assume that
>> the TLB is entirely flushed, for all guests.
>
> Well, for write_cr3 path at least, we just need to invalidate all TLBs
> in the local pcpu. So it seems for this path we could just do
> invvpid with type 2, ie, invalidate all vpids except 0. Prob also need
> to do 'invept 2'. what do you think, worth it?

Try lashing it up and measure it. :-) My guess would be that it is not worth
it.

Our current algorithm minimises INVVPID instructions, just eats through the
VPID space instead. Depending on the cost of INVVPID, versus the cost of
having never-used-again stale tagged entries clogging up the TLB, our
algorithm may be a bit better or worse than one that more aggressively uses
INVVPID. My guess (which is only a guess!) is that the difference will be
totally insignificant and unmeasurable.

-- Keir

> thanks,
> Mukesh
>
>



_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel

Xen devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.