From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938243AbdD0KCO (ORCPT ); Thu, 27 Apr 2017 06:02:14 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:56718 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755295AbdD0KCG (ORCPT ); Thu, 27 Apr 2017 06:02:06 -0400 Date: Thu, 27 Apr 2017 12:01:57 +0200 (CEST) From: Thomas Gleixner To: Mark Rutland cc: Sebastian Siewior , Suzuki K Poulose , catalin.marinas@arm.com, will.deacon@arm.com, Peter Zijlstra , LKML , Ingo Molnar , Steven Rostedt , linux-arm-kernel@lists.infradead.org Subject: Re: [patch V2 00/24] cpu/hotplug: Convert get_online_cpus() to a percpu_rwsem In-Reply-To: <20170427095744.GB31337@leverpostej> Message-ID: References: <20170418170442.665445272@linutronix.de> <20170425161037.GA27156@leverpostej> <20170425172838.mr3kyccsdteyjso5@linutronix.de> <20170426085958.GC27156@leverpostej> <20170426103236.GI27156@leverpostej> <20170427082719.3wyru4bk67kdmflb@linutronix.de> <20170427095744.GB31337@leverpostej> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Apr 2017, Mark Rutland wrote: > On Thu, Apr 27, 2017 at 10:27:20AM +0200, Sebastian Siewior wrote: > > On 2017-04-26 11:32:36 [+0100], Mark Rutland wrote: > > > > So we could end up calling static_branch_enable_cpuslocked() > > > > without actually holding the lock. Should we do a cpu_hotplug_begin/done in > > > > setup_cpu_feature_capabilities ? I agree it doesn't look that nice. Thoughts ? > > > > > > I agree that's hideous, but it looks like the only choice given the > > > hotplug rwsem cahnges. :/ > > > > would work for you to provide a locked and unlocked version? > > Maybe. Today we have: > > // rwsem unlocked > start_kernel() > ->smp_prepare_boot_cpu() > -->update_cpu_errata_workarounds() > --->update_cpu_capabilities() > > // rwsem locked (by other CPU) > secondary_start_kernel() > ->check_local_cpu_capabilities() > -->update_cpu_errata_workarounds() > --->update_cpu_capabilities() > > With the common chain: > > update_cpu_capabilities() > ->cpus_set_cap() > -->static_branch_enable() > > ... so we could add a update_cpu_capabilities{,_cpuslocked}(), and say > that cpus_set_cap() expects the hotplug rswem to be locked, as per the > below diff. You just can take the rwsen in smp_prepare_boot_cpu(), so you don't need that conditional thingy at all. Hmm? Thanks, tglx