From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: dirty all pages in kvm_write_guest_cached() Date: Wed, 08 Apr 2015 12:43:15 +0200 Message-ID: <55250643.3090402@redhat.com> References: <1428438897-22206-1-git-send-email-rkrcmar@redhat.com> <5524EBB7.3080906@redhat.com> <20150408092611.GA2164@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32830 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbbDHKnT (ORCPT ); Wed, 8 Apr 2015 06:43:19 -0400 In-Reply-To: <20150408092611.GA2164@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/04/2015 11:26, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > 2015-04-08 10:49+0200, Paolo Bonzini: >> On 07/04/2015 22:34, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >>> We dirtied only one page because writes originally couldn't span mo= re. >>> Use improved syntax for '>> PAGE_SHIFT' while at it. >>> >>> Fixes: 8f964525a121 ("KVM: Allow cross page reads and writes from c= ached translations.") >>> Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 >> >> 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_g= uest. >=20 > 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, tw= o 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 =3D NULL for cross page writes. This woul= d bypass the bug you are fixing here, and avoid worries about partial wri= tes. Paolo