All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into
Date: Tue, 12 Aug 2008 08:04:20 +0000	[thread overview]
Message-ID: <48A14404.3090707@linux.vnet.ibm.com> (raw)
In-Reply-To: <c832dfc7a6b50ace3c37.1217012092@localhost.localdomain>

Liu Yu wrote:
>> -----Original Message-----
>> From: Christian Ehrhardt [mailto:ehrhardt@linux.vnet.ibm.com] 
>> Sent: Monday, August 11, 2008 7:48 PM
>> To: Liu Yu
>> Cc: Hollis Blanchard; kvm-ppc@vger.kernel.org
>> Subject: Re: [PATCH 4 of 5] kvm: ppc: Write only modified 
>> shadow entries into theTLB on exit
>>     
>>> When you set nearly all tlb entries modified in this loop, 
>>>       
>> you have to 
>>     
>>> write all of them back before entering the guest in 
>>>       
>> booke_interrupts.S.
>>     
>>> So, why not "_tlbia()" here outside this loop, and don't 
>>>       
>> set them modified.
>>     
>>> Then, you needn't write them back.
>>> In fact, the shadow tlb entries are still consistent with 
>>>       
>> the hardware, as all of them are invalidated.
>>     
>>> Am I overlooking something ?
>>>   
>>>       
>> As Hollis wrote in his patch comment usually just one tlb 
>> entry is modified which saves a lot of updates.
>> If we invalidate all we later on would have to satisfy the 
>> misses we cause by doing so.
>>     
>
> In this loop, aren't you invalidating them all?
>
>   
>> With some free time we could test _tlbia() here, but I expect 
>> it to be slower by causing the need for tlb re-population 
>> compared to what we save here.
>>
>>     
>
> I don't understand why it will be slower.
> I think _tlbia will take the same effect as what you do here.
> That is to say, it will always cause the need for tlb re-population.
> And what's more, _tlbia will save some time when it enter the guest.
>
>   
On 440 which this file 440x_tlb.c is for, the implementation of tlbia is 
more or less the same than Hollis code when reentering the guest (there 
is no tlbia instruction on 440) with the addition of a check of the 
shadow modified flag.

I agree with you that the code in the kvmppc_mmu_priv_switch effectively 
releases all tlbe's to the high water mark, marks them modified and 
later on pushes them (being invalid) when entering the guest.
That means that the part of revoking all tlbe's to the high water mark 
can be done with tlbia() instead of using the kvmppc_tlbe_set_modified 
call for all indexes here.

I also agree that this can save us memory accesses from 0 to 
tlb_44x_hwater for the setting of the shadow modified flag, but 
everything else will be the same. Don't get me wrong I usually embrace 
any performance improvement, but when you look in the patched source 
file the is a comment just above the patched section:
   /* Future optimization: clear only userspace mappings. */
Once we do that (or anything similar if we get other ideas here) keeping 
the guest kernel mapping we can't use _tlbia() anymore because it clears 
everyting. That as an example would save us a guest exit which should 
save more time than some memory accesses.

Alltogether thats just my opinion, maybe we both wait for Hollis come 
back from vacation next week and add a third opinion to this discussion 
making decisions easier.


P.S. as I stated above this code is from the 440 tlb implementation, so 
if e.g. there is hardware support for it on some platforms that might 
make that improvement more beneficial we need an abstraction here.

-- 

Grüsse / regards, 
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization


  parent reply	other threads:[~2008-08-12  8:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25 18:54 [PATCH 0 of 5] PowerPC patches for 2.6.27 Hollis Blanchard
2008-07-25 18:54 ` Hollis Blanchard
     [not found] ` <patchbomb.1217012088-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-07-25 18:54   ` [PATCH 1 of 5] kvm: ppc: guest breakpoint support Hollis Blanchard
2008-07-25 18:54     ` Hollis Blanchard
2008-07-25 18:54   ` [PATCH 2 of 5] kvm: ppc: fix invalidation of large guest pages Hollis Blanchard
2008-07-25 18:54     ` Hollis Blanchard
2008-07-25 18:54   ` [PATCH 3 of 5] kvm: ppc: Stop saving host TLB state Hollis Blanchard
2008-07-25 18:54     ` Hollis Blanchard
2008-07-25 18:54   ` [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into the Hollis Blanchard
2008-07-25 18:54     ` [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into the TLB on exit Hollis Blanchard
2008-08-07  8:40     ` [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into theTLB " Liu Yu
2008-08-11  8:33     ` [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into Christian Ehrhardt
2008-08-11  8:55     ` [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into theTLB on exit Liu Yu
2008-08-11 11:47     ` [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into Christian Ehrhardt
2008-08-12  2:00     ` [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into theTLB on exit Liu Yu
2008-08-12  8:04     ` Christian Ehrhardt [this message]
2008-08-12  8:49     ` Liu Yu
2008-07-25 18:54   ` [PATCH 5 of 5] kvm: powerpc: Map guest userspace with TID=0 mappings Hollis Blanchard
2008-07-25 18:54     ` Hollis Blanchard
     [not found]     ` <080b9c9515a5593babc8.1217012093-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-07-28 10:33       ` Liu Yu
2008-07-28 10:33         ` Liu Yu
2008-07-29  7:03         ` Christian Ehrhardt
2008-07-29  7:03           ` Christian Ehrhardt
2008-07-29  7:48           ` Liu Yu
2008-07-29  7:48             ` Liu Yu
2008-07-29 10:56             ` Liu Yu
2008-07-29 10:56               ` Liu Yu
2008-07-27  8:50   ` [PATCH 0 of 5] PowerPC patches for 2.6.27 Avi Kivity
2008-07-27  8:50     ` Avi Kivity
     [not found]     ` <488C36DE.70507-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-07-29  7:20       ` Christian Ehrhardt
2008-07-29  7:20         ` Christian Ehrhardt
2008-07-29 13:00         ` Avi Kivity
2008-07-29 13:00           ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48A14404.3090707@linux.vnet.ibm.com \
    --to=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.