All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: vijay.kilari@gmail.com, Ian.Campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com,
	tim@xen.org, xen-devel@lists.xen.org
Cc: Prasun.Kapoor@caviumnetworks.com,
	vijaya.kumar@caviumnetworks.com, keir@xen.org,
	george.dunlap@citrix.com, jbeulich@suse.com
Subject: Re: [PATCH v8a 1/6] xen/arm: move and rename is_vcpu_running function to sched.h
Date: Thu, 03 Jul 2014 13:49:22 +0100	[thread overview]
Message-ID: <53B55152.1070601@linaro.org> (raw)
In-Reply-To: <1404376489-25165-2-git-send-email-vijay.kilari@gmail.com>

Hi Vijay,

On 07/03/2014 09:34 AM, vijay.kilari@gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
> 
> is_vcpu_running function in vgic driver is generic. So move
> this to sched.h and rename it as is_vcpu_online
> 
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
> CC: jbeulich@suse.com
> CC: keir@xen.org
> CC: george.dunlap@citrix.com
> ---
> v8a:is_vcpu_online() is modified to take only vcpu as
>     parameter and validity checks on vcpu is done in
>     caller
> 
> v7a:Changed vcpuid parameter from int to unsigned int
>     Removed check for test_bit. Return !test_bit()
> ---
>  xen/arch/arm/vgic.c     |   22 ++++------------------
>  xen/include/xen/sched.h |    5 +++++
>  2 files changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> index 96bd7c1..4abc682 100644
> --- a/xen/arch/arm/vgic.c
> +++ b/xen/arch/arm/vgic.c
> @@ -405,22 +405,6 @@ static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
>      }
>  }
>  
> -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;
> -}
> -
>  static int vgic_to_sgi(struct vcpu *v, register_t sgir)
>  {
>      struct domain *d = v->domain;
> @@ -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?

> +                     d->vcpu[i] != NULL && is_vcpu_online(d->vcpu[i]) )
>                      set_bit(i, &vcpu_mask);
>              }
>              break;
> @@ -459,7 +444,8 @@ static int vgic_to_sgi(struct vcpu *v, register_t sgir)
>  
>      for_each_set_bit( vcpuid, &vcpu_mask, d->max_vcpus )
>      {
> -        if ( !is_vcpu_running(d, vcpuid) )
> +        if ( d->vcpu != NULL && d->vcpu[vcpuid] != NULL &&

Same here.

> +             !is_vcpu_online(d->vcpu[vcpuid]) )
>          {
>              gdprintk(XENLOG_WARNING, "vGICD: GICD_SGIR write r=%"PRIregister" vcpu_mask=%lx, wrong CPUTargetList\n",
>                       sgir, vcpu_mask);

Regards,

-- 
Julien Grall

  parent reply	other threads:[~2014-07-03 12:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03  8:34 [PATCH v8a 0/6] GIC and VGIC code refactoring vijay.kilari
2014-07-03  8:34 ` [PATCH v8a 1/6] xen/arm: move and rename is_vcpu_running function to sched.h vijay.kilari
2014-07-03  9:12   ` Jan Beulich
2014-07-03  9:23     ` Ian Campbell
2014-07-03 12:49   ` Julien Grall [this message]
2014-07-03 13:24     ` Jan Beulich
2014-07-03  8:34 ` [PATCH v8a 2/6] xen/arm: move pending_irq structure to vgic header file vijay.kilari
2014-07-03  8:34 ` [PATCH v8a 3/6] xen/arm: calculate vgic irq rank based on register size vijay.kilari
2014-07-03  8:34 ` [PATCH v8a 4/6] xen/arm: Remove REG macro in vgic driver vijay.kilari
2014-07-03  8:34 ` [PATCH v8a 5/6] xen/arm: split vgic driver into generic and vgic-v2 driver vijay.kilari
2014-07-03 12:57   ` Julien Grall
2014-07-03 13:02     ` Ian Campbell
2014-07-03 13:25       ` Julien Grall
2014-07-03 14:02         ` Ian Campbell
2014-07-03 14:21           ` Julien Grall
2014-07-03 15:18             ` Ian Campbell
2014-07-04  7:01               ` Vijay Kilari
2014-07-04 10:20                 ` Julien Grall
2014-07-03  8:34 ` [PATCH v8a 6/6] xen/arm: Restrict saving of gic register for idle domain vijay.kilari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53B55152.1070601@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=vijay.kilari@gmail.com \
    --cc=vijaya.kumar@caviumnetworks.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.