Received: by 10.213.65.68 with SMTP id h4csp389312imn; Tue, 27 Mar 2018 00:48:36 -0700 (PDT) X-Google-Smtp-Source: AG47ELtW/1qFtwZf7uvSOvBBwTyrW8hvcESOPKL4cfiUEE3WXE9dy095/iEJxKSOp3uHUmLrhLkN X-Received: by 2002:a17:902:2c83:: with SMTP id n3-v6mr32916840plb.140.1522136916776; Tue, 27 Mar 2018 00:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522136916; cv=none; d=google.com; s=arc-20160816; b=PagFJf+u7IIxpTbeIe4qf+oKxvf8tKOQfB64yj6GWaObyNnJ5dV3Ryxn4xdewFI9/j ERc8IUkRc5hc7p0p9nqzkBsvwDTnOWj2IVSMuaGuyy1/9yxloll2gcba2FgOf6/X7mW8 by0OxVe+x6hkVU6nS0OUTIksHSvYD7DyTl3RRfGMOYLYgXZr35baEga1yxSt0sdH+OY4 daBjFb4w0ltsXIvfdcNV/Lso0s2RfPFZv2lxpMbaU/T0Yz5P2XAvZhmgjcNUZ/GkjF+A sJP7gdkuuXW2x0KyW2zdv9N3+BWaoAJP5j6Jw5G4YVJ9u6NODN4Qh4OtoWO3VxUge1Mu 6lZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=adrcXFiBs6E/qG5tX2dbazj2e9wEDGS7kK9lBoVS7K0=; b=iu7AvNtcZG2nVvJ6mgmAdR0mKZtOr/Ce35B73WgtuwrO66Dgcx+S+OIDuMgTMe3Vg2 Nski2Wi2gKz2IVZFj5TS6nRB7jYm5C9WsfOjx7WO8umy2j7wryH7a7Pt7Qzmek1Cd6PA u+R4Cnl6to8pYcz3gTtScaJU9AapNn3G46e7XlOGb5jf+SzDAu+RgBO+Npwv2QniyRQ2 ytDnbpc1l+/HjQY0jYEFJtO6GYNlHfPf2hAyZqNituHGVyL61OZIoIcdJdNqPTCommUr frvD63ldXOBgwbqW0ZsYF8dYGqvdtw5FwI+FifuQ1XzrGEX/d/vKJ16Rzid7onoMXQ2w G3iQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c6si603745pfl.136.2018.03.27.00.48.22; Tue, 27 Mar 2018 00:48:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751686AbeC0Hr0 (ORCPT + 99 others); Tue, 27 Mar 2018 03:47:26 -0400 Received: from terminus.zytor.com ([198.137.202.136]:60415 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750873AbeC0HrY (ORCPT ); Tue, 27 Mar 2018 03:47:24 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2R7l1xp568720; Tue, 27 Mar 2018 00:47:01 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2R7l1F1568717; Tue, 27 Mar 2018 00:47:01 -0700 Date: Tue, 27 Mar 2018 00:47:01 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Davidlohr Bueso Message-ID: Cc: tglx@linutronix.de, dbueso@suse.de, hpa@zytor.com, mingo@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, peterz@infradead.org, dave@stgolabs.net Reply-To: mingo@kernel.org, torvalds@linux-foundation.org, hpa@zytor.com, peterz@infradead.org, dave@stgolabs.net, linux-kernel@vger.kernel.org, dbueso@suse.de, tglx@linutronix.de In-Reply-To: <20180326210929.5244-5-dave@stgolabs.net> References: <20180326210929.5244-5-dave@stgolabs.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86: Update rdpmc_always_available static key to the modern API Git-Commit-ID: 631fe154edb0a37308d0116a0f9b7bba9dca6218 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 631fe154edb0a37308d0116a0f9b7bba9dca6218 Gitweb: https://git.kernel.org/tip/631fe154edb0a37308d0116a0f9b7bba9dca6218 Author: Davidlohr Bueso AuthorDate: Mon, 26 Mar 2018 14:09:27 -0700 Committer: Ingo Molnar CommitDate: Tue, 27 Mar 2018 07:53:00 +0200 perf/x86: Update rdpmc_always_available static key to the modern API No changes in refcount semantics -- use DEFINE_STATIC_KEY_FALSE() for initialization and replace: static_key_slow_inc|dec() => static_branch_inc|dec() static_key_false() => static_branch_unlikely() Added a '_key' suffix to rdpmc_always_available, for better self-documentation. Signed-off-by: Davidlohr Bueso Cc: Davidlohr Bueso Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: akpm@linux-foundation.org Link: http://lkml.kernel.org/r/20180326210929.5244-5-dave@stgolabs.net Signed-off-by: Ingo Molnar --- arch/x86/events/core.c | 6 +++--- arch/x86/include/asm/mmu_context.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 4823695c459f..a6006e7bb729 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -48,7 +48,7 @@ DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; -struct static_key rdpmc_always_available = STATIC_KEY_INIT_FALSE; +DEFINE_STATIC_KEY_FALSE(rdpmc_always_available_key); u64 __read_mostly hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX] @@ -2206,9 +2206,9 @@ static ssize_t set_attr_rdpmc(struct device *cdev, * but only root can trigger it, so it's okay. */ if (val == 2) - static_key_slow_inc(&rdpmc_always_available); + static_branch_inc(&rdpmc_always_available_key); else - static_key_slow_dec(&rdpmc_always_available); + static_branch_dec(&rdpmc_always_available_key); on_each_cpu(refresh_pce, NULL, 1); } diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 1de72ce514cd..57e3785d0d26 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -24,11 +24,12 @@ static inline void paravirt_activate_mm(struct mm_struct *prev, #endif /* !CONFIG_PARAVIRT */ #ifdef CONFIG_PERF_EVENTS -extern struct static_key rdpmc_always_available; + +DECLARE_STATIC_KEY_FALSE(rdpmc_always_available_key); static inline void load_mm_cr4(struct mm_struct *mm) { - if (static_key_false(&rdpmc_always_available) || + if (static_branch_unlikely(&rdpmc_always_available_key) || atomic_read(&mm->context.perf_rdpmc_allowed)) cr4_set_bits(X86_CR4_PCE); else