All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Dario Faggioli <dario.faggioli@citrix.com>, xen-devel@lists.xen.org
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Keir Fraser <keir@xen.org>, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH 2/3] xen: cpupool: assigning a CPU to a pool can fail
Date: Thu, 07 May 2015 06:52:14 +0200	[thread overview]
Message-ID: <554AEF7E.6060302@suse.com> (raw)
In-Reply-To: <20150506151033.9537.62100.stgit@Solace.station>

On 05/06/2015 05:10 PM, Dario Faggioli wrote:
> which means such an event must be handled at the call sites
> of cpupool_assign_cpu_locked(), and the error, if occurring,
> properly propagated.
>
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: George Dunlap <George.Dunlap@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: Keir Fraser <keir@xen.org>

Reviewed-by: Juergen Gross <jgross@suse.com>

> ---
>   xen/common/cpupool.c |   15 +++++++++++----
>   1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
> index a947c24..cabaccd 100644
> --- a/xen/common/cpupool.c
> +++ b/xen/common/cpupool.c
> @@ -458,8 +458,10 @@ void cpupool_rm_domain(struct domain *d)
>    * unless we are resuming from S3, in which case we put the cpu back
>    * in the cpupool it was in prior to suspend.
>    */
> -static void cpupool_cpu_add(unsigned int cpu)
> +static int cpupool_cpu_add(unsigned int cpu)
>   {
> +    int ret = -EINVAL;
> +
>       spin_lock(&cpupool_lock);
>       cpumask_clear_cpu(cpu, &cpupool_locked_cpus);
>       cpumask_set_cpu(cpu, &cpupool_free_cpus);
> @@ -472,15 +474,20 @@ static void cpupool_cpu_add(unsigned int cpu)
>           {
>               if ( cpumask_test_cpu(cpu, (*c)->cpu_suspended ) )
>               {
> -                cpupool_assign_cpu_locked(*c, cpu);
> +                ret = cpupool_assign_cpu_locked(*c, cpu);
> +                if ( ret )
> +                    goto out;
>                   cpumask_clear_cpu(cpu, (*c)->cpu_suspended);
>               }
>           }
>       }
>
>       if ( cpumask_test_cpu(cpu, &cpupool_free_cpus) )
> -        cpupool_assign_cpu_locked(cpupool0, cpu);
> +        ret = cpupool_assign_cpu_locked(cpupool0, cpu);
> + out:
>       spin_unlock(&cpupool_lock);
> +
> +    return ret;
>   }
>
>   /*
> @@ -715,7 +722,7 @@ static int cpu_callback(
>       {
>       case CPU_DOWN_FAILED:
>       case CPU_ONLINE:
> -        cpupool_cpu_add(cpu);
> +        rc = cpupool_cpu_add(cpu);
>           break;
>       case CPU_DOWN_PREPARE:
>           rc = cpupool_cpu_remove(cpu);
>
>

  reply	other threads:[~2015-05-07  4:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 15:10 [PATCH 0/3] xen: cpupools: avoid crashing when shutting down/suspending with free CPUs Dario Faggioli
2015-05-06 15:10 ` [PATCH 1/3] xen: always print offending CPU on bringup/teardown failure Dario Faggioli
2015-05-07 13:17   ` Jan Beulich
2015-05-06 15:10 ` [PATCH 2/3] xen: cpupool: assigning a CPU to a pool can fail Dario Faggioli
2015-05-07  4:52   ` Juergen Gross [this message]
2015-05-06 15:10 ` [PATCH 3/3] xen: cpupools: avoid crashing if shutting down with free CPUs Dario Faggioli
2015-05-08 10:20   ` Juergen Gross
2015-05-08 10:34     ` Jan Beulich
     [not found]     ` <554CAD480200007800078288@suse.com>
2015-05-08 10:47       ` Juergen Gross
2015-05-08 13:12         ` Dario Faggioli
2015-05-08 13:18           ` Juergen Gross
2015-05-08 13:32             ` Dario Faggioli
2015-05-08 13:57           ` Jan Beulich

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=554AEF7E.6060302@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --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.