From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viresh Kumar Subject: Re: [patch 09/13] cpufreq/ia64: Replace racy task affinity logic Date: Thu, 13 Apr 2017 08:12:49 +0530 Message-ID: <20170413024249.GI5910@vireshk-i7> References: <20170412200726.941336635@linutronix.de> <20170412201042.865458445@linutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-pg0-f41.google.com ([74.125.83.41]:33486 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803AbdDMCmx (ORCPT ); Wed, 12 Apr 2017 22:42:53 -0400 Received: by mail-pg0-f41.google.com with SMTP id x125so23544528pgb.0 for ; Wed, 12 Apr 2017 19:42:53 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20170412201042.865458445@linutronix.de> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Ingo Molnar , Sebastian Siewior , Benjamin Herrenschmidt , "David S. Miller" , Fenghua Yu , Herbert Xu , Lai Jiangshan , Len Brown , Michael Ellerman , "Rafael J. Wysocki" , Tejun Heo , Tony Luck , linux-pm@vger.kernel.org On 12-04-17, 22:07, Thomas Gleixner wrote: > The get() and target() callbacks 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 and overwriting the new affinity setting. > > Replace it by work_on_cpu(). All call pathes which invoke the callbacks are > already protected against CPU hotplug. > > Signed-off-by: Thomas Gleixner > Cc: "Rafael J. Wysocki" > Cc: Viresh Kumar > Cc: Tony Luck > Cc: Fenghua Yu > Cc: linux-pm@vger.kernel.org > --- > drivers/cpufreq/ia64-acpi-cpufreq.c | 91 +++++++++++++++--------------------- > 1 file changed, 38 insertions(+), 53 deletions(-) Acked-by: Viresh Kumar -- viresh