From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH v5 12/21] xen/arm: move is_vcpu_running function to sched.h Date: Mon, 16 Jun 2014 09:34:46 +0100 Message-ID: <539EC846020000780001A829@mail.emea.novell.com> References: <1402580192-13937-1-git-send-email-vijay.kilari@gmail.com> <1402580192-13937-13-git-send-email-vijay.kilari@gmail.com> <539DC941.8010702@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <539DC941.8010702@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: vijay.kilari@gmail.com Cc: Keir Fraser , Ian.Campbell@citrix.com, Stefano Stabellini , Prasun Kapoor , tim@xen.org, Vijaya Kumar K , Julien Grall , "xen.org" , george.dunlap@citrix.com, xen-devel@lists.xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 15.06.14 at 18:26, wrote: >> --- a/xen/include/xen/sched.h >> +++ b/xen/include/xen/sched.h >> @@ -826,6 +826,22 @@ void watchdog_domain_destroy(struct domain *d); >> #define need_iommu(d) (0) >> #endif >> >> +static inline int is_vcpu_running(struct domain *d, int vcpuid) >> +{ >> + struct vcpu *v; >> + >> + if ( vcpuid >= d->max_vcpus ) >> + return 0; >> + >> + v = d->vcpu[vcpuid]; >> + if ( v == NULL ) >> + return 0; >> + if (test_bit(_VPF_down, &v->pause_flags) ) >> + return 0; >> + >> + return 1; >> +} If this function was to become common code, you'd have to not only justify it (as requested by Julien), but also - name it according to its function (VPF_down not set doesn't mean "running", it merely means "up") - make it properly check d->vcpu != NULL alongside the other checks - returning a boolean value it should have return type bool_t - "d" and "v" only ever used for read accesses both pointers should get const-qualified - fix the one coding style violation in the last if(). Jan