From patchwork Wed May 24 08:15:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 9745421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 87A6E6034C for ; Wed, 24 May 2017 08:34:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76A20288E2 for ; Wed, 24 May 2017 08:34:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BA412891F; Wed, 24 May 2017 08:34:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6CB9B288E2 for ; Wed, 24 May 2017 08:34:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From :Date:Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=PeMr/Wm7xfy0a+A6Ennb30Aieapf0r5UrxK2UB5mLeQ=; b=Ehdo6BERUrXn75 29EYjJMOv1SIsTeNhbO/f1uo4FLKYswigYLWsL7f6hdkbIhgWPtxxhihCiObFNe0Y72rNJYVcv4Wn fAD9S/C6W52kc/TEJK2xMYMEzi3Rv/E/auFcNcs7vpkSz2k8FV0uE7tBeiIPj6t8f8W392eyOp/Ws xtW5ORRXKFOQMInmgyZ+IVv3KMuyEC6L/vaSmVH2lnDT2mj6rER7k7+DBuICWJWC0VqOAAk1SuDWu +84jsnC7oxFFtz3H8r+VlEA/L6yGJjE4Q/99yuLGKEwM5llO7cIJM9meqwFeF6SW0VwsQvSPJUO7d 9snwjMMbY4EUN1fHy4Rw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dDRk3-0005HX-Fk; Wed, 24 May 2017 08:34:03 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDRjW-0004HO-HR for linux-arm-kernel@bombadil.infradead.org; Wed, 24 May 2017 08:33:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-Id:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PBRhvkeIVh+WZk/KuSRBV0hAIQzU1vxpvtTfi5XUxkw=; b=YVIU1ZQKzYlKUv8cirCSiK3cO7 h3KT253tHzv8YF3bdwwMl8lafRuqiW3IAB8rQ5XeqCYepo80uS3jNJN9T51Ktl9uhqiYvSnzYjydc I3yJWLm212kiHDM+iTB65+wNbr6Z3HKbCJnwdyqYJjrnNFSP6mxGiaLRvMtdSzoajzOoqITKvAUTN ul/sWLTDJ//z60uphLglFIKNWwVOj4ruGNq7ylgeHAgw2qlIryoIEln37KP0DxP3mLLbEYsCxhOX1 woGvJ70NKNvbHy0tG/wjKmNTsHFIpv8bsYO5YZAp5hMvNteSfpHkTlPU4NORT8CfUHg10GC3Fx+tB InXvRSLA==; Received: from galois.linutronix.de ([2a01:7a0:2:106d:700::1]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDRdC-00080a-Na for linux-arm-kernel@lists.infradead.org; Wed, 24 May 2017 08:27:00 +0000 Received: from localhost ([127.0.0.1] helo=[127.0.1.1]) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1dDRcQ-0008BN-Rt; Wed, 24 May 2017 10:26:10 +0200 Message-Id: <20170524081548.170940729@linutronix.de> User-Agent: quilt/0.63-1 Date: Wed, 24 May 2017 10:15:25 +0200 From: Thomas Gleixner To: LKML Subject: [patch V3 14/32] ARM/hw_breakpoint: Use cpuhp_setup_state_cpuslocked() References: <20170524081511.203800767@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline; filename=ARMhw_breakpoint_Use_cpuhp_setup_state_cpuslocked().patch X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170524_092658_813095_08F71FE9 X-CRM114-Status: GOOD ( 15.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Peter Zijlstra , Sebastian Siewior , Will Deacon , Russell King , Steven Rostedt , Paul McKenney , Ingo Molnar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sebastian Andrzej Siewior arch_hw_breakpoint_init() holds get_online_cpus() while registerring the hotplug callbacks. cpuhp_setup_state() invokes get_online_cpus() as well. This is correct, but prevents the conversion of the hotplug locking to a percpu rwsem. Use cpuhp_setup_state_cpuslocked() to avoid the nested call. Convert *_online_cpus() to the new interfaces while at it. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Acked-by: Mark Rutland Cc: Peter Zijlstra Cc: Will Deacon Cc: Steven Rostedt Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org --- arch/arm/kernel/hw_breakpoint.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -1090,7 +1090,7 @@ static int __init arch_hw_breakpoint_ini * driven low on this core and there isn't an architected way to * determine that. */ - get_online_cpus(); + cpus_read_lock(); register_undef_hook(&debug_reg_hook); /* @@ -1098,15 +1098,16 @@ static int __init arch_hw_breakpoint_ini * assume that a halting debugger will leave the world in a nice state * for us. */ - ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "arm/hw_breakpoint:online", - dbg_reset_online, NULL); + ret = cpuhp_setup_state_cpuslocked(CPUHP_AP_ONLINE_DYN, + "arm/hw_breakpoint:online", + dbg_reset_online, NULL); unregister_undef_hook(&debug_reg_hook); if (WARN_ON(ret < 0) || !cpumask_empty(&debug_err_mask)) { core_num_brps = 0; core_num_wrps = 0; if (ret > 0) cpuhp_remove_state_nocalls(ret); - put_online_cpus(); + cpus_read_unlock(); return 0; } @@ -1124,7 +1125,7 @@ static int __init arch_hw_breakpoint_ini TRAP_HWBKPT, "watchpoint debug exception"); hook_ifault_code(FAULT_CODE_DEBUG, hw_breakpoint_pending, SIGTRAP, TRAP_HWBKPT, "breakpoint debug exception"); - put_online_cpus(); + cpus_read_unlock(); /* Register PM notifiers. */ pm_init();