[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86, cpufreq: Change powernow's CPB status immediately



>>> On 13.06.12 at 00:02, Boris Ostrovsky <boris.ostrovsky@xxxxxxx> wrote:
> +static int powernow_cpufreq_update (int cpuid,
> +                                  struct cpufreq_policy *policy)
> +{
> +    cpumask_t cpumask;
> +
> +    if (!cpumask_test_cpu(cpuid, &cpu_online_map))
> +        return -EINVAL;
> +
> +    cpumask_clear(&cpumask);
> +    cpumask_set_cpu(cpuid, &cpumask);
> +
> +    on_selected_cpus(&cpumask, update_cpb, policy, 1);

Please of cpumask_of(cpuid) here, eliminating the need for a
cpumask_t local variable.

> +
> +    return 0;
>  }
>  
>  static int powernow_cpufreq_target(struct cpufreq_policy *policy,
> --- a/xen/drivers/cpufreq/utility.c   Thu Jun 07 19:46:57 2012 +0100
> +++ b/xen/drivers/cpufreq/utility.c   Tue Jun 12 23:56:10 2012 +0200
> @@ -390,22 +390,44 @@ int cpufreq_driver_getavg(unsigned int c
>      return policy->cur;
>  }
>  
> -void cpufreq_enable_turbo(int cpuid)
> +int cpufreq_enable_turbo(int cpuid)
>  {
>      struct cpufreq_policy *policy;
> +    int ret = 0;
>  
>      policy = per_cpu(cpufreq_cpu_policy, cpuid);
> -    if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
> +    if (policy && policy->turbo == CPUFREQ_TURBO_DISABLED)
> +    {
>          policy->turbo = CPUFREQ_TURBO_ENABLED;
> +        if (cpufreq_driver->update)
> +        {
> +            ret = cpufreq_driver->update(cpuid, policy);
> +            if (ret)
> +                policy->turbo = CPUFREQ_TURBO_DISABLED;
> +        }
> +    }
> +
> +    return ret;

If you introduce an error indicator here and below, shouldn't
CPUFREQ_TURBO_UNSUPPORTED also result in e.g. -EOPNOTSUPP
(and perhaps the policy == NULL case produce -EACCESS)?

Jan

>  }
>  
> -void cpufreq_disable_turbo(int cpuid)
> +int cpufreq_disable_turbo(int cpuid)
>  {
>      struct cpufreq_policy *policy;
> +    int ret = 0;
>  
>      policy = per_cpu(cpufreq_cpu_policy, cpuid);
> -    if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
> +    if (policy && policy->turbo == CPUFREQ_TURBO_ENABLED)
> +    {
>          policy->turbo = CPUFREQ_TURBO_DISABLED;
> +        if (cpufreq_driver->update)
> +        {
> +            ret = cpufreq_driver->update(cpuid, policy);
> +            if (ret)
> +                policy->turbo = CPUFREQ_TURBO_ENABLED;
> +        }
> +    }
> +
> +    return ret;
>  }
>  
>  int cpufreq_get_turbo_status(int cpuid)



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.