From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [V8 PATCH 7/8] pvh dom0: add check for pvh in vioapic_range Date: Mon, 7 Apr 2014 18:00:23 -0700 Message-ID: <20140407180023.14827470@mantra.us.oracle.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> <53426FD2.2060806@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WXKP1-0002zo-Ot for xen-devel@lists.xenproject.org; Tue, 08 Apr 2014 01:00:40 +0000 In-Reply-To: <53426FD2.2060806@eu.citrix.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: George Dunlap Cc: Jan Beulich , tim@xen.org, eddie.dong@intel.com, keir.xen@gmail.com, jun.nakajima@intel.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Mon, 7 Apr 2014 10:28:50 +0100 George Dunlap wrote: > 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)". Correct. Since, vioapic is NULL for PVH, domain_vioapic(d) will result in NULL ptr exception for PVH, so we can't call that macro for PVH. thanks Mukesh