From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764960AbdEXQXQ (ORCPT ); Wed, 24 May 2017 12:23:16 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36302 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764663AbdEXQXO (ORCPT ); Wed, 24 May 2017 12:23:14 -0400 Date: Wed, 24 May 2017 09:22:55 -0700 From: "Paul E. McKenney" To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Ingo Molnar , Steven Rostedt , Sebastian Siewior Subject: Re: [patch V3 00/32] cpu/hotplug: Convert get_online_cpus() to a percpu_rwsem Reply-To: paulmck@linux.vnet.ibm.com References: <20170524081511.203800767@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170524081511.203800767@linutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17052416-0036-0000-0000-0000021179BF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007111; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00865028; UDB=6.00429478; IPR=6.00644808; BA=6.00005372; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015566; XFM=3.00000015; UTC=2017-05-24 16:23:09 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052416-0037-0000-0000-000040759353 Message-Id: <20170524162255.GD3956@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-24_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705240078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 24, 2017 at 10:15:11AM +0200, Thomas Gleixner wrote: > get_online_cpus() is used in hot pathes in mainline and even more so in > RT. That can show up badly under certain conditions because every locker > contends on a global mutex. RT has it's own homebrewn mitigation which is > a (badly done) open coded implementation of percpu_rwsems with recursion > support. > > The proper replacement for that are percpu_rwsems, but that requires to > remove recursion support. > > The conversion unearthed real locking issues which were previously not > visible because the get_online_cpus() lockdep annotation was implemented > with recursion support which prevents lockdep from tracking full dependency > chains. These potential deadlocks are not related to recursive calls, they > trigger on the first invocation because lockdep now has the full dependency > chains available. > > The following patch series addresses this by > > - Cleaning up places which call get_online_cpus() nested > > - Replacing a few instances with cpu_hotplug_disable() to prevent circular > locking dependencies. > > The series is on top of 4.12-rc2. It's available in git from > > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.hotplug > > Changes since V2: > > - Reworked the approach vs. perf/ftrace/kprobes, which simplified the lot > > - Renamed get_online_cpus() to cpus_read_lock() to reflect the nature of > the interface > > - Link the lockchains between hotplug control task and per cpu hotplug > threads and fixed the fallout of that. Passed moderate rcutorture testing, so: Tested-by: Paul E. McKenney > Thanks, > > tglx > > --- > arch/arm/kernel/hw_breakpoint.c | 11 - > arch/arm/kernel/patch.c | 2 > arch/arm/probes/kprobes/core.c | 3 > arch/arm64/include/asm/insn.h | 1 > arch/arm64/kernel/insn.c | 5 > arch/mips/kernel/jump_label.c | 2 > arch/powerpc/kvm/book3s_hv.c | 14 - > arch/powerpc/platforms/powernv/subcore.c | 7 > arch/s390/kernel/jump_label.c | 2 > arch/s390/kernel/kprobes.c | 4 > arch/s390/kernel/time.c | 6 > arch/x86/events/core.c | 1 > arch/x86/events/intel/cqm.c | 16 - > arch/x86/kernel/cpu/mtrr/main.c | 2 > b/arch/sparc/kernel/jump_label.c | 2 > b/arch/tile/kernel/jump_label.c | 2 > b/arch/x86/events/intel/core.c | 11 - > b/arch/x86/kernel/jump_label.c | 2 > b/kernel/jump_label.c | 20 +- > drivers/acpi/processor_driver.c | 4 > drivers/acpi/processor_throttling.c | 16 - > drivers/cpufreq/cpufreq.c | 21 +- > drivers/hwtracing/coresight/coresight-etm3x.c | 20 +- > drivers/hwtracing/coresight/coresight-etm4x.c | 20 +- > drivers/pci/pci-driver.c | 47 +++-- > include/linux/cpu.h | 34 ++-- > include/linux/cpuhotplug.h | 38 ++++ > include/linux/padata.h | 3 > include/linux/pci.h | 1 > include/linux/perf_event.h | 2 > include/linux/sched.h | 10 + > include/linux/stop_machine.h | 26 ++- > kernel/cpu.c | 213 +++++++++++--------------- > kernel/events/core.c | 106 +++++++++--- > kernel/kprobes.c | 59 +++---- > kernel/padata.c | 43 ++--- > kernel/stop_machine.c | 11 - > 37 files changed, 444 insertions(+), 343 deletions(-) > > >