From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: use slowpath for cross page cached accesses Date: Wed, 08 Apr 2015 14:23:06 +0200 Message-ID: <55251DAA.7000507@redhat.com> References: <1428438897-22206-1-git-send-email-rkrcmar@redhat.com> <5524EBB7.3080906@redhat.com> <20150408092611.GA2164@potion.brq.redhat.com> <55250643.3090402@redhat.com> <20150408121648.GA3519@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: In-Reply-To: <20150408121648.GA3519@potion.brq.redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 08/04/2015 14:16, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > 2015-04-08 12:43+0200, Paolo Bonzini: >> On 08/04/2015 11:26, Radim Kr=C4=8Dm=C3=A1=C5=99 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 w= e >> should just use ghc->memslot =3D NULL for cross page writes. This w= ould >> bypass the bug you are fixing here, and avoid worries about partial = writes. >=20 > 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 u= s to do this. > Partial writes would be a pain; copy_to_user API does not define whi= ch > 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 tha= t case). Patch applied, thanks! Paolo