All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: use slowpath for cross page cached accesses
Date: Wed, 08 Apr 2015 14:23:06 +0200	[thread overview]
Message-ID: <55251DAA.7000507@redhat.com> (raw)
In-Reply-To: <20150408121648.GA3519@potion.brq.redhat.com>



On 08/04/2015 14:16, Radim Krčmář wrote:
> 2015-04-08 12:43+0200, Paolo Bonzini:
>> On 08/04/2015 11:26, Radim Krčmář wrote:
>>> Only cross-memslot writes have NULL memslot.
>>
>> The power of wrong comments...
>>
>> Considering how kvm_gfn_to_hva_cache_init is used (one 1-byte field, two
>> 4-byte fields, one 28-bytes struct that is 32-bytes aligned, one
>> 32-bytes field that is in practice cacheline-aligned), I wonder if we
>> should just use ghc->memslot = NULL for cross page writes.  This would
>> bypass the bug you are fixing here, and avoid worries about partial writes.
> 
> Good idea, and it could make those comments right :)
> (Though in general, I prefer less constraints on APIs ...)

It doesn't put constraints, it still handles cross page writes right
(just slower).  copy_to_user in some sense is the API that constrains us
to do this.

> Partial writes would be a pain;  copy_to_user API does not define which
> bytes were not written.  I think the write can't fail mid-page, which
> makes our implementation ok

No, writes can't fail mid-page (I guess in atomic context it's
theoretically possible, but we're equipped to handle the failure in that
case).

Patch applied, thanks!

Paolo

  reply	other threads:[~2015-04-08 12:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 20:34 [PATCH] KVM: dirty all pages in kvm_write_guest_cached() Radim Krčmář
2015-04-08  8:49 ` Paolo Bonzini
2015-04-08  9:26   ` Radim Krčmář
2015-04-08 10:43     ` Paolo Bonzini
2015-04-08 12:16       ` [PATCH] KVM: use slowpath for cross page cached accesses Radim Krčmář
2015-04-08 12:23         ` Paolo Bonzini [this message]
2015-04-09  0:18         ` Wanpeng Li
2015-05-02 12:23         ` Patch "KVM: use slowpath for cross page cached accesses" has been added to the 4.0-stable tree gregkh
2015-05-02 12:25         ` Patch "KVM: use slowpath for cross page cached accesses" has been added to the 3.19-stable tree gregkh
2015-05-02 12:28         ` Patch "KVM: use slowpath for cross page cached accesses" has been added to the 3.10-stable tree gregkh
2015-05-02 12:29         ` Patch "KVM: use slowpath for cross page cached accesses" has been added to the 3.14-stable tree gregkh

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=55251DAA.7000507@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@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 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.