From: "Jan Beulich" Subject: Re: [V8 PATCH 7/8] pvh dom0: add check for pvh in vioapic_range Date: Tue, 01 Apr 2014 16:09:15 +0100 Message-ID: <533AF2BB0200007800004407@nat28.tlf.novell.com> References: <1395452357-1598-1-git-send-email-mukesh.rathor@oracle.com> <1395452357-1598-8-git-send-email-mukesh.rathor@oracle.com> <53300A4102000078000013D1@nat28.tlf.novell.com> <533ACFDD.8010504@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WV0JU-0005Wl-C3 for xen-devel@lists.xenproject.org; Tue, 01 Apr 2014 15:09:20 +0000 In-Reply-To: <533ACFDD.8010504@eu.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: George Dunlap , Mukesh Rathor Cc: xen-devel@lists.xenproject.org, keir.xen@gmail.com, eddie.dong@intel.com, jun.nakajima@intel.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org >>> On 01.04.14 at 16:40, wrote: > On 03/24/2014 09:34 AM, Jan Beulich wrote: >>>>> On 22.03.14 at 02:39, wrote: >>> --- a/xen/arch/x86/hvm/vioapic.c >>> +++ b/xen/arch/x86/hvm/vioapic.c >>> @@ -238,8 +238,13 @@ static int vioapic_write( >>> >>> static int vioapic_range(struct vcpu *v, unsigned long addr) >>> { >>> - struct hvm_hw_vioapic *vioapic = domain_vioapic(v->domain); >>> + struct hvm_hw_vioapic *vioapic; >>> + >>> + /* pvh uses event channel callback */ >>> + if ( is_pvh_vcpu(v) ) >>> + return 0; >>> >>> + vioapic = domain_vioapic(v->domain); >> >> I can see why the extra check is needed, but I can't see why you >> convert the initializer to an assignment: Afaict domain_vioapic() is >> safe even if d->arch.hvm_domain.vioapic == NULL. > > Or better yet, just make it something like: > > return vioapic && ((addr >= [...original range check])) > > That way we don't have to have a PVH-specific hook at all. If a domain > doesn't have a vioapic for any reason, return 0. No, vioapic isn't going to be NULL for PVH: #define domain_vioapic(d) (&(d)->arch.hvm_domain.vioapic->hvm_hw_vioapic) Jan