• Thomas Gleixner's avatar
    cpufreq/sh: Replace racy task affinity logic · 205dcc1e
    Thomas Gleixner authored
    The target() callback must run on the affected cpu. This is achieved by
    temporarily setting the affinity of the calling thread to the requested CPU
    and reset it to the original affinity afterwards.
    
    That's racy vs. concurrent affinity settings for that thread resulting in
    code executing on the wrong CPU.
    
    Replace it by work_on_cpu(). All call pathes which invoke the callbacks are
    already protected against CPU hotplug.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Herbert Xu <herbert@gondor.apana.org.au>
    Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Sebastian Siewior <bigeasy@linutronix.de>
    Cc: linux-pm@vger.kernel.org
    Cc: Lai Jiangshan <jiangshanlai@gmail.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Len Brown <lenb@kernel.org>
    Link: http://lkml.kernel.org/r/20170412201042.958216363@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    205dcc1e
sh-cpufreq.c 4.69 KB