From: "Jan Beulich" Subject: Re: [PATCH RFC] xen/pvh: use a custom IO bitmap for PVH hardware domains Date: Tue, 14 Apr 2015 12:40:58 +0100 Message-ID: <552D18EA0200007800071DD6@mail.emea.novell.com> References: <1428497829-21845-1-git-send-email-roger.pau@citrix.com> <552CE55C.4040603@citrix.com> <552D089C0200007800071D59@mail.emea.novell.com> <552CEFBF.2070701@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YhzDC-0000CM-Qw for xen-devel@lists.xenproject.org; Tue, 14 Apr 2015 11:41:02 +0000 In-Reply-To: <552CEFBF.2070701@citrix.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: =?UTF-8?Q?Roger=20Pau=20Monn=C3=A9?= Cc: Kevin Tian , SuraveeSuthikulpanit , Andrew Cooper , Eddie Dong , Aravind Gopalakrishnan , Jun Nakajima , xen-devel@lists.xenproject.org, Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org >>> On 14.04.15 at 12:45, wrote: > Hello, > > El 14/04/15 a les 12.31, Jan Beulich ha escrit: >>>>> On 14.04.15 at 12:01, wrote: >>> I have one question about the current IO port handling for PVH guests >>> (DomU and Dom0). There's some code right now in vmx_vmexit_handler >>> (EXIT_REASON_IO_INSTRUCTION) that's kind PVH specific: >>> >>> if ( exit_qualification & 0x10 ) >>> { >>> /* INS, OUTS */ >>> if ( unlikely(is_pvh_vcpu(v)) /* PVH fixme */ || >>> !handle_mmio() ) >>> hvm_inject_hw_exception(TRAP_gp_fault, 0); >>> } >>> else >>> { >>> /* IN, OUT */ >>> uint16_t port = (exit_qualification >> 16) & 0xFFFF; >>> int bytes = (exit_qualification & 0x07) + 1; >>> int dir = (exit_qualification & 0x08) ? IOREQ_READ : IOREQ_WRITE; >>> >>> if ( handle_pio(port, bytes, dir) ) >>> update_guest_eip(); /* Safe: IN, OUT */ >>> } >>> >>> Is there any need for DomUs to access the IO ports? I know that FreeBSD >>> will poke at some of them during boot to scan for devices, but I'm not >>> sure if we could just make them noops in the PVH case and simply return >>> garbage. >> >> The PVH special case quoted above is there only to prevent >> reaching handle_mmio(). > > Injecting a GP seems like a little bit too much for trapped INS/OUTS, I > would rather just drop/ignore them if possible. Dropping them means (silent) data corruption, whereas #GP is a clear sign that something went wrong. In the end the case will need to be properly handled anyway, and learning about this becoming an immediate need will be better through a plainly crashed domain than through one that (perhaps quite a long period of time later) died in some obscure way. Jan