From: "Jan Beulich" Subject: Re: [PATCH v8a 1/6] xen/arm: move and rename is_vcpu_running function to sched.h Date: Thu, 03 Jul 2014 14:24:03 +0100 Message-ID: <53B575930200007800020406@mail.emea.novell.com> References: <1404376489-25165-1-git-send-email-vijay.kilari@gmail.com> <1404376489-25165-2-git-send-email-vijay.kilari@gmail.com> <53B55152.1070601@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53B55152.1070601@linaro.org> 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: Julien Grall Cc: keir@xen.org, Ian.Campbell@citrix.com, vijay.kilari@gmail.com, stefano.stabellini@eu.citrix.com, Prasun.Kapoor@caviumnetworks.com, vijaya.kumar@caviumnetworks.com, tim@xen.org, george.dunlap@citrix.com, xen-devel@lists.xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 03.07.14 at 14:49, wrote: > On 07/03/2014 09:34 AM, vijay.kilari@gmail.com wrote: >> @@ -444,7 +428,8 @@ static int vgic_to_sgi(struct vcpu *v, register_t sgir) >> case GICD_SGI_TARGET_OTHERS: >> for ( i = 0; i < d->max_vcpus; i++ ) >> { >> - if ( i != current->vcpu_id && is_vcpu_running(d, i) ) >> + if ( i != current->vcpu_id && d->vcpu != NULL && > > d->vcpu can't be NULL at this point. Otherwise you won't be able to run > VCPU0 of the domain :). > > Although, I may have miss something during the previous version, why > don't you check that the VCPU is NULL in is_vcpu_online? Functions like this generally assume to be called with valid arguments. Eventual future users may have done the validation already, and hence would then be (slightly) penalized by redundant checking. Jan