From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [V8 PATCH 7/8] pvh dom0: add check for pvh in vioapic_range Date: Mon, 7 Apr 2014 10:28:50 +0100 Message-ID: <53426FD2.2060806@eu.citrix.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> <533AF2BB0200007800004407@nat28.tlf.novell.com> <20140404180049.77637164@mantra.us.oracle.com> <5342690E0200007800005F82@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WX5rn-000528-1V for xen-devel@lists.xenproject.org; Mon, 07 Apr 2014 09:29:23 +0000 In-Reply-To: <5342690E0200007800005F82@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , 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 04/07/2014 07:59 AM, Jan Beulich wrote: >>>> On 05.04.14 at 03:00, wrote: >> On Tue, 01 Apr 2014 16:09:15 +0100 >> "Jan Beulich" wrote: >> >>>>>> 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) >> No, viopaic is NULL for PVH, hence the patch. So, can prob just check >> for the ptr like George suggests and remove the pvh check. > Sorry, no - I agree that d->arch.hvm_domain.vioapic is NULL for > PVH, but that doesn't mean the result of domain_vioapic(d) is too > (see the quoted #define above). I interpreted Mukesh saying "check for the ptr" as, "check d->arch_hvm.domain.vioapic", not "check domain_vioapic(d)". -George