public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>, "David S. Ahern" <daahern@cisco.com>
Subject: Re: [patch 02/10] KVM: MMU: move local TLB flush to mmu_set_spte
Date: Mon, 22 Sep 2008 23:26:36 +0300	[thread overview]
Message-ID: <48D7FF7C.20808@redhat.com> (raw)
In-Reply-To: <20080921001046.GA8593@dmt.cnet>

Marcelo Tosatti wrote:

   

>> I think we had cases where the spte.pfn contents changed, for example  
>> when a large page was replaced by a normal page,
>>     
>
> True. And the TLB is not flushed now for large->normal replace, in case
> the pte thats faulting is read-only. The local (and remote) TLB's must
> be flushed on large->normal replace.
>
>   

Can you prepare a patch for that, for -stable?

>> and also:
>>
>>        } else if (pfn != spte_to_pfn(*shadow_pte)) {
>>     
>
> That one is likely to crash the guest anyway, so I don't see the need
> for a flush there:
>
>   
>>> Did you find out what's causing the errors in the first place (if
>>> zap is not used)?  It worries me greatly.
>>>       
>> Yes, the problem is that the rmap code does not handle the qemu
>> process
>> mappings from vanishing while there is a present rmap. If that
>> happens,
>> and there is a fault for a gfn whose qemu mapping has been removed, a
>> different physical zero page will be allocated:
>>
>>      rmap a -> gfn 0 -> physical host page 0
>>      mapping for gfn 0 gets removed
>>      guest faults in gfn 0 through the same pte "chain"
>>      rmap a -> gfn 0 -> physical host page 1
>>
>> When instantiating the shadow mapping for the second time, the
>> "is_rmap_pte" check succeeds, so we release the reference grabbed by
>> gfn_to_page() at mmu_set_spte(). We now have a shadow mapping
>> pointing
>> to a physical page without having an additional reference on that
>> page.
>>
>> The following makes the host not crash under such a condition, but
>> the condition itself is invalid leading to inconsistent state on the
>> guest.
>> So IMHO it shouldnt be allowed to happen in the first place.
>>     

And it isn't, with mmu notifiers.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2008-09-22 20:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-21  0:10 [patch 02/10] KVM: MMU: move local TLB flush to mmu_set_spte Marcelo Tosatti
2008-09-22 20:26 ` Avi Kivity [this message]
2008-09-22 21:56   ` Marcelo Tosatti
2008-09-22 20:28 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-09-18 21:27 [patch 00/10] out of sync shadow v2 Marcelo Tosatti
2008-09-18 21:27 ` [patch 02/10] KVM: MMU: move local TLB flush to mmu_set_spte Marcelo Tosatti
2008-09-20  0:21   ` 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=48D7FF7C.20808@redhat.com \
    --to=avi@redhat.com \
    --cc=daahern@cisco.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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