From patchwork Mon Mar 20 10:59:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 72123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1150270wrt; Mon, 20 Mar 2023 04:10:08 -0700 (PDT) X-Google-Smtp-Source: AK7set+fTlmSdFUpVsJbfZNKUcCCReEURG/be2153N1nWd8OQ2jDtGL59m6G2IAWEir/FSv3wjeY X-Received: by 2002:a17:90a:53:b0:23f:48b9:266d with SMTP id 19-20020a17090a005300b0023f48b9266dmr13964590pjb.21.1679310607650; Mon, 20 Mar 2023 04:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679310607; cv=none; d=google.com; s=arc-20160816; b=PeH6XGmPDR59YLkQix4xsugyrL1SAZ+mMHugXQTur/RVAD+LwW1JUFfFVuot6EiOGR NZxT95nvxP4jT0WZ2+hQ0KY16R4q0/gol7EmykrVE63Ui8beOlKDTdG47XYBtND4WQEO 3wT/tCE++ut5wqiv6k+sc35gR8mslN8wb7CjSDWJ2yaAM0JL4NER6fgMeLE4CbcEIckI vuBuCk1Cu9szQKNgQuE4oLi3XmS8Q1cgei7B6rJO04cmi0mrdzm80eYFgcYS92Jryndt KxhCKirwyNRFUL4cDA9eUpjV2a+G1BnDEYTLyQsNin40u7y5yOf7noOH16k7bywCQz8f uaQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=ybEABlhk2UNVE0tOULvxZHsvT0U8OTx27j31C0m6rnw=; b=B6RgHwL9zXu6+5x3747Nl+M35SWH8OPVxWXmYb3uHqzouy0AV/vx8gRZvTc3IyAA2I ef0HdOhHzBpz76QOnyhQe0xCHM8LAh1ZBCrYAncl2hLTc79Z0yUZp1qeEt9jIyajAo/q eJLmp/kmmF5Hd3OMkSWByq6ljDDTwttgjTsCWVKwP5uWbAELoD0jMhMb+5kKwp/8arOk Tt/gRn9yxXaalgKuVCFpLI2yjznYTyhI2z/KmbkYeAssT+MwCgPVj35Tksui6LwWJN3s lJQctQrOmGwUloLz3Q8w1uh2lo7VxDb2Bw6tl0ppGKCnB2cPDZgs+CHItLR8RtfGURWt +7qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=axNXlj9E; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a17090a348500b0023c1f976f2dsi15760577pjb.85.2023.03.20.04.09.53; Mon, 20 Mar 2023 04:10:07 -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=@linutronix.de header.s=2020 header.b=axNXlj9E; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229592AbjCTLDv (ORCPT + 99 others); Mon, 20 Mar 2023 07:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbjCTLDf (ORCPT ); Mon, 20 Mar 2023 07:03:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7030D2D142; Mon, 20 Mar 2023 03:59:14 -0700 (PDT) Date: Mon, 20 Mar 2023 10:59:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679309948; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ybEABlhk2UNVE0tOULvxZHsvT0U8OTx27j31C0m6rnw=; b=axNXlj9EPuy4+fxTWTbEMpBrpv0LN5qrxeGR+zuqylVVMHxtpun24SEOk2rf6b891aIiod k/AQ8f1onuvs+pd8wna54Grkuw7OFPsuyyfjYa6A1Gvnltdgj6WVMcwKm7s3v3POWgISDu qJCyzD0izvevNkqFSqY/o6N0wfiioSQ9sPBvu2Gmomgx21krAqitDAxcsxrKrfjjQtYX+O t9WgFpyeGRw0+3TfPyuhUwYGNLZwrh4FfjSn2yPxWg2lH3xOpxekpcXyP4vyoj0pF/S6tx jWLjWw4NJAcJLFO5nsz4kae31AhqB19f4VfaKrcZn3guRT5kyWaC0gj+me4awA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679309948; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ybEABlhk2UNVE0tOULvxZHsvT0U8OTx27j31C0m6rnw=; b=riKIgSlXleXcx7kUXkrFn8pe801H48vcM9lPXjD2YMqENe4o1Mf4JExQaMZAXmn5j4NiB3 4y5Y1BWIryrICkCw== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/urgent] entry: Fix noinstr warning in __enter_from_user_mode() Cc: Josh Poimboeuf , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <167930994812.5837.18107013512395780738.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760884799877204472?= X-GMAIL-MSGID: =?utf-8?q?1760884799877204472?= The following commit has been merged into the core/urgent branch of tip: Commit-ID: 3e2619c4ebba2cab8414c55b131b7a28f628de3b Gitweb: https://git.kernel.org/tip/3e2619c4ebba2cab8414c55b131b7a28f628de3b Author: Josh Poimboeuf AuthorDate: Sat, 25 Feb 2023 16:01:36 -08:00 Committer: Thomas Gleixner CommitterDate: Mon, 20 Mar 2023 11:57:12 +01:00 entry: Fix noinstr warning in __enter_from_user_mode() __enter_from_user_mode() is triggering noinstr warnings with CONFIG_DEBUG_PREEMPT due to its call of preempt_count_add() via ct_state(). The preemption disable isn't needed as interrupts are already disabled. And the context_tracking_enabled() check in ct_state() also isn't needed as that's already being done by the CT_WARN_ON(). Just use __ct_state() instead. Fixes the following warnings: vmlinux.o: warning: objtool: enter_from_user_mode+0xba: call to preempt_count_add() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0xf9: call to preempt_count_add() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare+0xc7: call to preempt_count_add() leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_enter_from_user_mode+0xba: call to preempt_count_add() leaves .noinstr.text section Fixes: 171476775d32 ("context_tracking: Convert state to atomic_t") Signed-off-by: Josh Poimboeuf Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/d8955fa6d68dc955dda19baf13ae014ae27926f5.1677369694.git.jpoimboe@kernel.org --- include/linux/context_tracking.h | 1 + kernel/entry/common.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index d4afa85..3a7909e 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h @@ -96,6 +96,7 @@ static inline void user_exit_irqoff(void) { } static inline int exception_enter(void) { return 0; } static inline void exception_exit(enum ctx_state prev_ctx) { } static inline int ct_state(void) { return -1; } +static inline int __ct_state(void) { return -1; } static __always_inline bool context_tracking_guest_enter(void) { return false; } static inline void context_tracking_guest_exit(void) { } #define CT_WARN_ON(cond) do { } while (0) diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 846add8..1314894 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -21,7 +21,7 @@ static __always_inline void __enter_from_user_mode(struct pt_regs *regs) arch_enter_from_user_mode(regs); lockdep_hardirqs_off(CALLER_ADDR0); - CT_WARN_ON(ct_state() != CONTEXT_USER); + CT_WARN_ON(__ct_state() != CONTEXT_USER); user_exit_irqoff(); instrumentation_begin();