WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] cpufreq: error path fixes

To: Jan Beulich <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] cpufreq: error path fixes
From: Keir Fraser <keir.xen@xxxxxxxxx>
Date: Fri, 14 Oct 2011 08:59:01 +0100
Cc:
Delivery-date: Fri, 14 Oct 2011 01:06:51 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=DXoRpiWbGiho8OaAffKSOzHhR+E1VhVhMTPYeXuCnAM=; b=qRH1eR9BaOvl8VSkJC7MOxn5ApNWJtmUain9jCMoqrv2Slyc0yHmIDgiPk69iwuXWm pxRLTrTctgk87P6+JmMOv+x5Yt+/nNrrKD80xhwfHO+Z4vUY9jAQO16tJNSG/PuF87Rj ZFBT90NfrA9iK5e9purofdaqciVLIRjUMdYng=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4E97FFE8020000780005B54C@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcyKRyJRSzmf4Iq0YUi0rbF82fH0lw==
Thread-topic: [Xen-devel] [PATCH] cpufreq: error path fixes
User-agent: Microsoft-Entourage/12.30.0.110427
On 14/10/2011 08:24, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> This fixes an actual bug (failure to exit from a function after an
> allocation failure), an inconsistency (not removing the cpufreq_dom
> list member upon failure), and a latent bug (not clearing the current
> governor upon governor initialization failure when there was no old
> one; latent because the only current code path leading to this
> situation frees the policy upon failure and hence the governor not
> getting cleared is benign).
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Keir Fraser <keir@xxxxxxx>

> --- a/xen/drivers/cpufreq/cpufreq.c
> +++ b/xen/drivers/cpufreq/cpufreq.c
> @@ -176,8 +176,10 @@ int cpufreq_add_cpu(unsigned int cpu)
>  
>      if (!domexist || hw_all) {
>          policy = xzalloc(struct cpufreq_policy);
> -        if (!policy)
> +        if (!policy) {
>              ret = -ENOMEM;
> +            goto err0;
> +        }
>  
>          policy->cpu = cpu;
>          per_cpu(cpufreq_cpu_policy, cpu) = policy;
> @@ -186,7 +188,7 @@ int cpufreq_add_cpu(unsigned int cpu)
>          if (ret) {
>              xfree(policy);
>              per_cpu(cpufreq_cpu_policy, cpu) = NULL;
> -            return ret;
> +            goto err0;
>          }
>          if (cpufreq_verbose)
>              printk("CPU %u initialization completed\n", cpu);
> @@ -243,7 +245,7 @@ err1:
>          cpufreq_driver->exit(policy);
>          xfree(policy);
>      }
> -
> +err0:
>      if (cpus_empty(cpufreq_dom->map)) {
>          list_del(&cpufreq_dom->node);
>          xfree(cpufreq_dom);
> --- a/xen/drivers/cpufreq/utility.c
> +++ b/xen/drivers/cpufreq/utility.c
> @@ -458,8 +458,8 @@ int __cpufreq_set_policy(struct cpufreq_
>                                   data->governor->name);
>  
>              /* new governor failed, so re-start old one */
> +            data->governor = old_gov;
>              if (old_gov) {
> -                data->governor = old_gov;
>                  __cpufreq_governor(data, CPUFREQ_GOV_START);
>                  printk(KERN_WARNING "Still stay at %s governor\n",
>                                       data->governor->name);
> 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>