From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/3] Implement emulator_write_phys() Date: Mon, 27 Aug 2007 18:45:59 +0300 Message-ID: <46D2F1B7.70604@qumranet.com> References: <11882278064002-git-send-email-aliguori@us.ibm.com> <1188227808405-git-send-email-aliguori@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org To: Anthony Liguori Return-path: In-Reply-To: <1188227808405-git-send-email-aliguori@us.ibm.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Anthony Liguori wrote: > Since a hypercall may span two pages and is a gva, we need a function to write > to a gva that may span multiple pages. emulator_write_phys() seems like the > logical choice for this. > > @@ -962,8 +962,35 @@ static int emulator_write_std(unsigned long addr, > unsigned int bytes, > struct kvm_vcpu *vcpu I think that emulator_write_emulated(), except for being awkwardly named, should do the job. We have enough APIs. But! We may not overwrite the hypercall instruction while a vcpu may be executing, since there's no atomicity guarantee for code fetch. We have to to be out of guest mode while writing that insn. -- Any sufficiently difficult bug is indistinguishable from a feature.