From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932076AbdDMCql (ORCPT ); Wed, 12 Apr 2017 22:46:41 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:34207 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755817AbdDMCqk (ORCPT ); Wed, 12 Apr 2017 22:46:40 -0400 Date: Thu, 13 Apr 2017 08:16:36 +0530 From: Viresh Kumar 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 Subject: Re: [patch 10/13] cpufreq/sh: Replace racy task affinity logic Message-ID: <20170413024636.GJ5910@vireshk-i7> References: <20170412200726.941336635@linutronix.de> <20170412201042.958216363@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170412201042.958216363@linutronix.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12-04-17, 22:07, Thomas Gleixner wrote: > 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: Thomas Gleixner > Cc: "Rafael J. Wysocki" > Cc: Viresh Kumar > Cc: linux-pm@vger.kernel.org > --- > drivers/cpufreq/sh-cpufreq.c | 45 +++++++++++++++++++++++++------------------ > 1 file changed, 27 insertions(+), 18 deletions(-) Acked-by: Viresh Kumar -- viresh