From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: dirty all pages in kvm_write_guest_cached()
Date: Wed, 8 Apr 2015 11:26:12 +0200 [thread overview]
Message-ID: <20150408092611.GA2164@potion.brq.redhat.com> (raw)
In-Reply-To: <5524EBB7.3080906@redhat.com>
2015-04-08 10:49+0200, Paolo Bonzini:
> On 07/04/2015 22:34, Radim Krčmář wrote:
> > We dirtied only one page because writes originally couldn't span more.
> > Use improved syntax for '>> PAGE_SHIFT' while at it.
> >
> > Fixes: 8f964525a121 ("KVM: Allow cross page reads and writes from cached translations.")
> > Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
>
> Cross-page reads and writes should never get here; they have
> ghc->memslot set to NULL and go through the slow path in kvm_write_guest.
Only cross-memslot writes have NULL memslot.
> What am I missing?
kvm_gfn_to_hva_cache_init() queries how many pages are remaining in the
memslot and it compares it with the amount of needed pages.
If the write will fit in memslot, it will be done without
kvm_write_guest, regardless of the amount of written pages.
The relevant code path in kvm_gfn_to_hva_cache_init():
gfn_t nr_pages_needed = end_gfn - start_gfn + 1;
ghc->memslot = gfn_to_memslot(kvm, start_gfn);
ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail);
if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed)
ghc->hva += offset;
return 0;
next prev parent reply other threads:[~2015-04-08 9:26 UTC|newest]
Thread overview: 7+ 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ář [this message]
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
2015-04-09 0:18 ` Wanpeng Li
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=20150408092611.GA2164@potion.brq.redhat.com \
--to=rkrcmar@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@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