From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v5 12/21] xen/arm: move is_vcpu_running function to sched.h Date: Thu, 19 Jun 2014 12:03:21 +0100 Message-ID: <53A2C379.6060109@linaro.org> 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> <539EC846020000780001A829@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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 , Jan Beulich Cc: Keir Fraser , Ian Campbell , Stefano Stabellini , Prasun Kapoor , Tim Deegan , Vijaya Kumar K , "xen.org" , george.dunlap@citrix.com, "xen-devel@lists.xen.org" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On 06/19/2014 11:58 AM, Vijay Kilari wrote: > Hi Julien, Stefano, Jan, > > On Mon, Jun 16, 2014 at 2:04 PM, Jan Beulich wrote: >>>>> 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") > > IMO, is_vcpu_running() usage in vgic.c is just to check if vcpu is runnable > and not down. So checking apart from VPF_down is enough. > If so, we should change the name of this function You are wrong, the usage in vgic.c is to check that the VCPU is online. So we don't inject an IRQ to this VCPU. We don't care if the VCPU is block/runnable or whatever. What Jan was asking is to rename the function in is_vcpu_up (or smth similar). Regards, -- Julien Grall