public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "Dong, Eddie" <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: guest PTE write emulation
Date: Tue, 29 May 2007 14:38:25 +0300	[thread overview]
Message-ID: <465C10B1.8090903@qumranet.com> (raw)
In-Reply-To: <10EA09EFD8728347A513008B6B0DA77A01840FBB-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>

Dong, Eddie wrote:
> BTW, in kvm_mmu_pte_write, I feel a little bit stranger for following
> code:
>
>
>   
>>                level = page->role.level;
>>                npte = 1;
>>                if (page->role.glevels == PT32_ROOT_LEVEL) {
>>                        page_offset <<= 1;      /* 32->64 */          
>> /* 
>>                         * A 32-bit pde maps 4MB while the shadow pdes
>> map 
>>                         * only 2MB.  So we need to double the offset
>> again 
>>                         * and zap two pdes instead of one.           
>>                        */ if (level == PT32_ROOT_LEVEL) {
>>                                page_offset &= ~7; /* kill rounding
>>                                error */ page_offset <<= 1;
>>                                npte = 2;
>>     
>
> 1st of all, do we have 2MB pde in shadow PT? I think we don't provide
> contiguous physical mfn for shadow PT.
>   

No, we don't.  The intent is that a shadow pde maps 2MB through a shadow 
page table, not through a a large host page.

> If page->role.level == PT32_ROOT_LEVEL, sequencial call of
> mmu_pte_write_new_pte will simply return w/o any real spte operation.
> Does this ever happen w/ a real spte write?
>   

Yes.  This is a missed optimization, but I don't think that it impacts 
performance.  pde updates are very rare.

> I tried a 32 bits FC5 with no found of this combination till Linux boot.
>
>   

Usually pde updates are before the page directory is shadowed, so the 
host doesn't see it.

>>                        }
>>                        quadrant = page_offset >> PAGE_SHIFT;
>>                        page_offset &= ~PAGE_MASK;
>>                        if (quadrant != page->role.quadrant)
>>                                continue;
>>                }
>>                spte = &page->spt[page_offset / sizeof(*spte)];
>>                while (npte--) {
>>                        mmu_pte_write_zap_pte(vcpu, page, spte);
>>                        mmu_pte_write_new_pte(vcpu, page,
>> spte, new, bytes);
>>     
>
> If above comments is correct, we need to provide an increased (gfn) gpte
> so that the next 2MB spte can have right gfn from gpte. Am I missing
> something?

On a pte update, npte will always be 1.  On a pde update, we won't do 
anything in mmu_pte_write_new_pte because it doesn't handle pdes.  If we 
extend it to handle pdes, then we need either to modify the new gpde or 
to have the update take the quadrant into account.

I don't think there's a real need to extend it though.  A pde write will 
usually be followed by lots of pte writes.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-05-29 11:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-29  7:59 guest PTE write emulation Dong, Eddie
     [not found] ` <10EA09EFD8728347A513008B6B0DA77A01840ED9-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-05-29  8:25   ` Avi Kivity
     [not found]     ` <465BE375.20000-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-29  9:52       ` Dong, Eddie
     [not found]         ` <10EA09EFD8728347A513008B6B0DA77A01840FBB-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-05-29 11:38           ` Avi Kivity [this message]
     [not found]             ` <465C10B1.8090903-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-30  2:33               ` SMP support of MMU Dong, Eddie
     [not found]                 ` <10EA09EFD8728347A513008B6B0DA77A0184129A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-05-30  4:53                   ` Avi Kivity
     [not found]                     ` <465D0359.7040908-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-30  5:38                       ` Dong, Eddie
2007-05-30 11:40               ` guest PTE write emulation Dong, Eddie
     [not found]                 ` <10EA09EFD8728347A513008B6B0DA77A01841631-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-05-30 12:25                   ` Avi Kivity
     [not found]                     ` <465D6D56.90307-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-30 12:48                       ` Dong, Eddie

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=465C10B1.8090903@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox