From patchwork Tue Apr 25 17:28:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 9698847 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 CEEE06020A for ; Tue, 25 Apr 2017 17:29:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC5A62866A for ; Tue, 25 Apr 2017 17:29:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0EA428681; Tue, 25 Apr 2017 17:29:22 +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 422202866A for ; Tue, 25 Apr 2017 17:29:21 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/9sCbju+swoqVw6GciOPYBurwgIrHw+3d/N9o29Lbs8=; b=Aw269OktQxNRWo fm/hdJ4tKv+kNixHOPO7y71/bHQy1I9jw2emwK5OQtsf2xy4eB3JfLSfQX+iF1N7dXrwFeYZ5BMMV T2QJr9bea0lVSeHjZgh58ZINM9a3aaISN0IGWZoiu1CN0uWqx/ZWFsRRouRbPhuJsM8azBf1cU0PO F3LntfJUP6GQaPUrjTvvVxVsYT8TQ66wQKZrkQ7mh28Td3GGVlT/JKeL+9FdmQk7X9zQEI1laI4Jq g/+g/TbCXsaRulZzJlV/s0fscN8MJ15YbgMnjJZulREPmJ6/eflIwKpRsrSmWKc3kTXrn2zPngf7T vWRX4Tadyv56m0UzV4JA==; 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 1d34HA-0003ij-4t; Tue, 25 Apr 2017 17:29:20 +0000 Received: from galois.linutronix.de ([2a01:7a0:2:106d:700::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d34H3-0003bs-Cn for linux-arm-kernel@lists.infradead.org; Tue, 25 Apr 2017 17:29:18 +0000 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1d34GS-0003jM-5b; Tue, 25 Apr 2017 19:28:36 +0200 Date: Tue, 25 Apr 2017 19:28:38 +0200 From: Sebastian Siewior To: Mark Rutland , Peter Zijlstra Subject: Re: [patch V2 00/24] cpu/hotplug: Convert get_online_cpus() to a percpu_rwsem Message-ID: <20170425172838.mr3kyccsdteyjso5@linutronix.de> References: <20170418170442.665445272@linutronix.de> <20170425161037.GA27156@leverpostej> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170425161037.GA27156@leverpostej> User-Agent: NeoMutt/20170306 (1.8.0) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170425_102913_666091_45C75385 X-CRM114-Status: GOOD ( 16.33 ) 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: suzuki.poulose@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, LKML , Steven Rostedt , Thomas Gleixner , 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 On 2017-04-25 17:10:37 [+0100], Mark Rutland wrote: > Hi, Hi, > When we bring the secondary CPU online, we detect an erratum that wasn't > present on the boot CPU, and try to enable a static branch we use to > track the erratum. The call to static_branch_enable() blows up as above. this (cpus_set_cap()) seems only to be used used in CPU up part. > I see that we now have static_branch_disable_cpuslocked(), but we don't > have an equivalent for enable. I'm not sure what we should be doing > here. We should introduce static_branch_enable_cpuslocked(). Does this work for you (after s/static_branch_enable/static_branch_enable_cpuslocked/ in cpus_set_cap()) ?: From fe004351e4649da037d5165247e89ab976fe4a26 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 25 Apr 2017 18:43:00 +0200 Subject: [PATCH] jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked() Provide static_key_[enable|slow_inc]_cpuslocked() variant that don't take cpu_hotplug_lock(). Signed-off-by: Sebastian Andrzej Siewior --- include/linux/jump_label.h | 7 +++++++ kernel/jump_label.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index d7b17d1ab875..c80d8b1279b5 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -164,6 +164,7 @@ extern void static_key_slow_dec_cpuslocked(struct static_key *key); extern void jump_label_apply_nops(struct module *mod); extern int static_key_count(struct static_key *key); extern void static_key_enable(struct static_key *key); +extern void static_key_enable_cpuslocked(struct static_key *key); extern void static_key_disable(struct static_key *key); extern void static_key_disable_cpuslocked(struct static_key *key); @@ -252,6 +253,11 @@ static inline void static_key_enable(struct static_key *key) static_key_slow_inc(key); } +static inline void static_key_enable_cpuslocked(struct static_key *key) +{ + static_key_enable(key); +} + static inline void static_key_disable(struct static_key *key) { int count = static_key_count(key); @@ -429,6 +435,7 @@ extern bool ____wrong_branch_error(void); */ #define static_branch_enable(x) static_key_enable(&(x)->key) +#define static_branch_enable_cpuslocked(x) static_key_enable_cpuslocked(&(x)->key) #define static_branch_disable(x) static_key_disable(&(x)->key) #define static_branch_disable_cpuslocked(x) static_key_disable_cpuslocked(&(x)->key) diff --git a/kernel/jump_label.c b/kernel/jump_label.c index d71124ee3b14..6343f4c7e27f 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -90,6 +90,16 @@ void static_key_enable(struct static_key *key) } EXPORT_SYMBOL_GPL(static_key_enable); +void static_key_enable_cpuslocked(struct static_key *key) +{ + int count = static_key_count(key); + + WARN_ON_ONCE(count < 0 || count > 1); + + if (!count) + static_key_slow_inc_cpuslocked(key); +} + void static_key_disable(struct static_key *key) { int count = static_key_count(key);