From: "Jan Beulich" Subject: Re: [PATCH RFC V4 1/5] xen: Emulate with no writes Date: Tue, 05 Aug 2014 16:43:37 +0100 Message-ID: <53E117C902000078000298CC@mail.emea.novell.com> References: <1407151825-3843-1-git-send-email-rcojocaru@bitdefender.com> <53DFB0440200007800029111@mail.emea.novell.com> <53E0F54A.6090801@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53E0F54A.6090801@bitdefender.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Razvan Cojocaru Cc: kevin.tian@intel.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, xen-devel@lists.xen.org, jun.nakajima@intel.com, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 05.08.14 at 17:16, wrote: > So if I understand this code correctly, hvmemul_rep_ins() performs a few > checks, and then calls hvmemul_do_pio(), which ends up calling > hvmemul_do_io(), which seems to discard the write rather unceremoniously > for weird-sized accesses. This would seem to roughly correspond to just > returning X86EMUL_UNHANDLEABLE from hvmemul_rep_ins() for that special > case (with no MMIO code executed). > > Did I misunderstand something? The main issue is that as long as these functions only act as a backend to the x86 instruction emulator, "weird size accesses" just can't happen. I.e. the respective check is just a guard against careless future code additions. And for such bad cases it is of course appropriate to drop the entire effect of the instruction - this is largely like a fault happing on it. And quite different from your case - you want the instruction to behave normally _except_ for the memory write as I understood so far (albeit it still escapes me how in the end correct behavior can result). Furthermore X86EMUL_UNHANDLEABLE generally results in a fault to be injected into the guest, i.e. such paths aren't suitable for your purposes iiuc. Jan