From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E629DC433F5 for ; Thu, 26 May 2022 11:05:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347112AbiEZLFK (ORCPT ); Thu, 26 May 2022 07:05:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347139AbiEZLDr (ORCPT ); Thu, 26 May 2022 07:03:47 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB77CEBBB for ; Thu, 26 May 2022 04:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=h4yugi7MGC9HhqK+P+Qy2uOSAxdRIB0BRd6ZZtQsZsM=; b=G7vO3GgrwlwPwOubwtwibc3V2t ZRQqn2BH+yop7kEiZ5Cl99V9gBI97QgugG+Bmlt2aq/3ZFe0xIENhd+RExxDCGArhSTA9jrY3Ggdi woODtkpLUrQC8FmaRGwz1VLP1+dzGxf+IAPPXB842qcfIYDVd/slUSP+rXhWGq2g87XNwKQN+jxgd Yq2OWtCIWSRFYd/zQWEjMPNzVGpHj7w4PKGJnF3VHCS9A8rd6oIUYsrHbp1EJdjOOXEWtbUO+riRX sOdmjbOO9cXkFfr6oYsV8/rWE9sqaWP5nkxU+9/F+/Gh79TBn0DU3uIwAZRp5H81vPB/j4FjrbB+N 5tm/uDQw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nuBGX-001sVl-NF; Thu, 26 May 2022 11:02:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8FC353004AD; Thu, 26 May 2022 13:02:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 7A4CA20221FA2; Thu, 26 May 2022 13:02:50 +0200 (CEST) Message-ID: <20220526105958.007232892@infradead.org> User-Agent: quilt/0.66 Date: Thu, 26 May 2022 12:52:57 +0200 From: Peter Zijlstra To: x86@kernel.org, jpoimboe@redhat.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, elver@google.com, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, mark.rutland@arm.com, kernel test robot Subject: [PATCH 5/7] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds References: <20220526105252.440440893@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building x86_64 with JUMP_LABEL=n it's possible for instrumentation to sneak into noinstr: vmlinux.o: warning: objtool: exit_to_user_mode+0x14: call to static_key_count.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_exit_to_user_mode+0x2d: call to static_key_count.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_exit_to_user_mode+0x1b: call to static_key_count.constprop.0() leaves .noinstr.text section Switch to arch_ prefixed atomic to avoid the explicit instrumentation. Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) --- include/linux/jump_label.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -256,9 +256,9 @@ extern void static_key_disable_cpuslocke #include #include -static inline int static_key_count(struct static_key *key) +static __always_inline int static_key_count(struct static_key *key) { - return atomic_read(&key->enabled); + return arch_atomic_read(&key->enabled); } static __always_inline void jump_label_init(void)