Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1125848ioo; Fri, 27 May 2022 01:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEV46s6fXjVCNMwg5Rjq+xUy2KOIOyCxlSfoB9J5TQuKTJEXBXx3VeX+K6hCDzbmeLeBLe X-Received: by 2002:a17:907:98f6:b0:6ff:1549:1a13 with SMTP id ke22-20020a17090798f600b006ff15491a13mr10313443ejc.668.1653641918333; Fri, 27 May 2022 01:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653641918; cv=none; d=google.com; s=arc-20160816; b=cbhQoEhjtvy7uQYG33Tuh41/76RNDb0lQqfGI0zmf7D1Uh1s1VkEM30v+l4GUxSPFR 1T22kvmVM+dbKYaMPFet74uN92eonD8/kQY9bto5is250o6R5djQp1PYQwbl1PjEvy5F /mKkg1rdjVOBbikFz5eUSwWORUKyVvP4wLB5rSKfipPYU0vZprjaXN7Hl7jHnflTyiOb j3UOwY5vm9UzJs6yFbnRrQHfMcClhZqYNTF6mfvdNJdPEknwn4hzrtyxarZsJsd7o+UU 5YbIDMwO23iCcjAHeK6TYG2Ng8VL2k80NzHVpbXb3ZsZN7x3XTWuGla1oK7kmPQJphmH 0JCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=h4yugi7MGC9HhqK+P+Qy2uOSAxdRIB0BRd6ZZtQsZsM=; b=Lljyuw+fxSoUc2x3M4bwNaooRagLThEabFctcr2KgDCGLVus5oZQx2Deghw2EHhsaQ +qHupRBs+AcWoTQaZ9uw61BkVkCuK+0V/o+fuNnEmMIIQWeeVNWbf0xeDNJSShPm6WQh EZLW9V2fKwqY8sGPhLOMb8X8XGOAJqhHq5CSiKYF2zVkv7lTHyjm1yTk+6z+MX4Ud4kp q8X8Sr/jNFBPIdW9TimsrUXZxSK061pJLJOC4zw4OcfZZG0weKQykBGMjsdfQYFMXB16 6VYOCH6epME7BPHSwn3B8+HyPgg1NDZ0X/M6mE/VpuwPhfTKJYd48sUnlR6HY8GAyeRO KDfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=G7vO3Ggr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt21-20020a170907729500b006fe954d9f4dsi1226552ejc.212.2022.05.27.01.58.12; Fri, 27 May 2022 01:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=G7vO3Ggr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347097AbiEZLFJ (ORCPT + 99 others); Thu, 26 May 2022 07:05:09 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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)