All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Wei Wang <wei.w.wang@intel.com>
Cc: andrew.cooper3@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v3 04/11] x86/intel_pstate: relocate the driver register function
Date: Thu, 18 Jun 2015 15:30:12 +0100	[thread overview]
Message-ID: <5582F2140200007800086ADF@mail.emea.novell.com> (raw)
In-Reply-To: <1434011230-17052-1-git-send-email-wei.w.wang@intel.com>

>>> On 11.06.15 at 10:27, <wei.w.wang@intel.com> wrote:
> Register the CPU hotplug notifier when the driver is
> registered, and move the driver register function to
> the cpufreq.c.

The first half of the sentence fails to say why. And I suppose if you
explained that (to yourself) you'd figure that the change is wrong (or
at least altering behavior in a way that needs more explanation to
be verifiably correct): The calls to cpufreq_register_driver() sit in
__initcall handlers, yet what you replace is a presmp_initcall. I.e. all
APs being brought up at boot time won't get the callback invoked for
them anymore.

I suppose you tested your series on a system where the new driver
will kick in. You of course also need to test the case where this isn't
the case - everything needs to continue to function there.

> --- a/xen/drivers/cpufreq/cpufreq.c
> +++ b/xen/drivers/cpufreq/cpufreq.c
> @@ -630,12 +630,21 @@ static struct notifier_block cpu_nfb = {
>      .notifier_call = cpu_callback
>  };
>  
> -static int __init cpufreq_presmp_init(void)
> +int cpufreq_register_driver(struct cpufreq_driver *driver_data)
>  {
>      void *cpu = (void *)(long)smp_processor_id();
>      cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
> +    if (!driver_data || !driver_data->init
> +        || !driver_data->verify || !driver_data->exit
> +        || (!driver_data->target == !driver_data->setpolicy))

Do you really want/need to enforce this policy (target set if and only
if setpolicy is not set) here? And if that's to uniformly hold, the two
could be put into a union...

Also - coding style.

> --- a/xen/include/acpi/cpufreq/cpufreq.h
> +++ b/xen/include/acpi/cpufreq/cpufreq.h
> @@ -171,32 +171,8 @@ struct cpufreq_driver {
>  
>  extern struct cpufreq_driver *cpufreq_driver;
>  
> -static __inline__ 
> -int cpufreq_register_driver(struct cpufreq_driver *driver_data)
> -{
> -    if (!driver_data         || 
> -        !driver_data->init   || 
> -        !driver_data->exit   || 
> -        !driver_data->verify || 
> -        !driver_data->target)
> -        return -EINVAL;
> -
> -    if (cpufreq_driver)
> -        return -EBUSY;
> -
> -    cpufreq_driver = driver_data;
> -    return 0;
> -}
> -
> -static __inline__ 
> -int cpufreq_unregister_driver(struct cpufreq_driver *driver)
> -{
> -    if (!cpufreq_driver || (driver != cpufreq_driver))
> -        return -EINVAL;
> -
> -    cpufreq_driver = NULL;
> -    return 0;
> -}
> +extern int cpufreq_register_driver(struct cpufreq_driver *driver_data);
> +extern int cpufreq_unregister_driver(struct cpufreq_driver *driver);

What's this declaration good for when there's no implementation?

Jan

  reply	other threads:[~2015-06-18 14:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11  8:27 [PATCH v3 04/11] x86/intel_pstate: relocate the driver register function Wei Wang
2015-06-18 14:30 ` Jan Beulich [this message]
2015-06-23  3:40   ` Wang, Wei W
2015-06-23  7:31     ` Jan Beulich
2015-06-23  8:01       ` Wang, Wei W
2015-06-23  8:11         ` Jan Beulich
2015-06-23  8:24           ` Wang, Wei W
2015-06-23  8:37             ` 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=5582F2140200007800086ADF@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=wei.w.wang@intel.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.