From patchwork Fri Jan 13 12:31:04 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: 43220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp242463wrt; Fri, 13 Jan 2023 04:33:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXtjN/JgHtuv5/GTiB6B8Swzb4rWEa0MOqR6GKS6KpBUHiKjWCmZ1fkIy2Z/7pLQvdHAfaxQ X-Received: by 2002:a05:6402:4150:b0:47e:1b4a:5491 with SMTP id x16-20020a056402415000b0047e1b4a5491mr69529068eda.20.1673613221391; Fri, 13 Jan 2023 04:33:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673613221; cv=none; d=google.com; s=arc-20160816; b=xj9a5fqWhni2MOOR2N/OlI7t+BlROqatnjPF32xYWHTEicAcmMUQrOn69Q21GJehgM Cwqc9ImT8ASeOjhI2WmPROu10SWK+QC6u41mXlDYDbr5l/x3/4XR47waZsQXpLav+0Zn +cnBN4kOtcWxliVbxWxNRhEXMFTx7LoqO7fzkMGUm5RPcVndAEf54hCIZNA1TJIQpSsR 583vrakPLdcbqaj7Ji8Is9FlusGrtyyEc9YVZfq4UZOU7lVDoZLQ0cVK+b1Htt68bWod Tv8I2oJ6Bp1FiLkQDRrH9xRzD5Ivt/CBkRZAQx+sYld2sUyE12E0UyfPmuVFAx4iMAjR BYOg== 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=TU+lfLaUryLanpvBA/nBYECxGdFkAGu9d/z6T7Z42Tw=; b=XkDXhYAqrOh7DQTuOu6nOo8L6JwG6Do60AnzDHpI6MUATqqG2Q7ra/AIZ19xO135lD lV2mfF0tHynAt0nJNGq/T1xo3pNTzGrdK3HdH/XZfeVFUyKIDvF+00tClphugIGtRZp4 XpGCC+05BHdv/NDed+JkdzS1M3XkYwd1NjAeEY+y01WV+xllQGgs1FzSE2E26j/xvxHD +ElxKcUeaRLu9L95KLnFiyqE+fHmIPB2/1lizemhEtDqH9sQLN+8VUfQZc1yJLFP9xdm ChVmvaPwPt8R1TOjoQwVNpFlZ5CDLKnHlIEHrFstHHKdySULrxKCMiNbVFg47fqzV2K7 x6Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lDaH6qPO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=OmkJuV4f; 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 d4-20020a50ea84000000b0049b64aee463si4065365edo.262.2023.01.13.04.33.17; Fri, 13 Jan 2023 04:33:41 -0800 (PST) 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=lDaH6qPO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=OmkJuV4f; 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 S233993AbjAMMcg (ORCPT + 99 others); Fri, 13 Jan 2023 07:32:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241200AbjAMMcH (ORCPT ); Fri, 13 Jan 2023 07:32:07 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA82C42E3C; Fri, 13 Jan 2023 04:31:06 -0800 (PST) Date: Fri, 13 Jan 2023 12:31:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673613065; 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=TU+lfLaUryLanpvBA/nBYECxGdFkAGu9d/z6T7Z42Tw=; b=lDaH6qPODMl6tw5BHp9hqq31tlpZK1zHNa2WmyGvmienE12oSCGyD7KZX4WSY6qdzDA07+ k91zu8Y1reJzVEdDGKldTmnAVJzyy5Vs7qzHX+U11CdVvOgq3YTl8+efP9NBTPQAWUtoeq LOP3OlvMo8ox34oVXVFpj86vWXZRQ9gQewU+e5mgV1JLSSRp2NlPleRsPkEd0S/NzFnou4 AYeoaMkSBQOot79sgXb/rxSLu9djTmoFe1qstJs+F8gVN6wUZNzb+8GlCqUKQxWU/8fD2U Oro98j1Q9TExw+QlNHBQobZLUKxkon1SChwFwtjFD6delZbEjTmCr7hB4TI3tw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673613065; 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=TU+lfLaUryLanpvBA/nBYECxGdFkAGu9d/z6T7Z42Tw=; b=OmkJuV4f3MBzhMQAoaQi4qPubS+OGIV7ybZPg9dSJsCx9uq5sunH21Q76174b5N3loW9CE zRo3qyMR/TSwUlAA== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] context_tracking: Fix noinstr vs KASAN Cc: "Peter Zijlstra (Intel)" , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230112195542.458034262@infradead.org> References: <20230112195542.458034262@infradead.org> MIME-Version: 1.0 Message-ID: <167361306437.4906.1206766567988276870.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?1754848957507929943?= X-GMAIL-MSGID: =?utf-8?q?1754910657747966246?= The following commit has been merged into the sched/core branch of tip: Commit-ID: 0e26e1de0032779e43929174339429c16307a299 Gitweb: https://git.kernel.org/tip/0e26e1de0032779e43929174339429c16307a299 Author: Peter Zijlstra AuthorDate: Thu, 12 Jan 2023 20:44:05 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 13 Jan 2023 11:48:18 +01:00 context_tracking: Fix noinstr vs KASAN Low level noinstr context-tracking code is calling out to instrumented code on KASAN: vmlinux.o: warning: objtool: __ct_user_enter+0x72: call to __kasan_check_write() leaves .noinstr.text section vmlinux.o: warning: objtool: __ct_user_exit+0x47: call to __kasan_check_write() leaves .noinstr.text section Use even lower level atomic methods to avoid the instrumentation. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20230112195542.458034262@infradead.org --- kernel/context_tracking.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 77978e3..a09f1c1 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c @@ -510,7 +510,7 @@ void noinstr __ct_user_enter(enum ctx_state state) * In this we case we don't care about any concurrency/ordering. */ if (!IS_ENABLED(CONFIG_CONTEXT_TRACKING_IDLE)) - atomic_set(&ct->state, state); + arch_atomic_set(&ct->state, state); } else { /* * Even if context tracking is disabled on this CPU, because it's outside @@ -527,7 +527,7 @@ void noinstr __ct_user_enter(enum ctx_state state) */ if (!IS_ENABLED(CONFIG_CONTEXT_TRACKING_IDLE)) { /* Tracking for vtime only, no concurrent RCU EQS accounting */ - atomic_set(&ct->state, state); + arch_atomic_set(&ct->state, state); } else { /* * Tracking for vtime and RCU EQS. Make sure we don't race @@ -535,7 +535,7 @@ void noinstr __ct_user_enter(enum ctx_state state) * RCU only requires RCU_DYNTICKS_IDX increments to be fully * ordered. */ - atomic_add(state, &ct->state); + arch_atomic_add(state, &ct->state); } } } @@ -630,12 +630,12 @@ void noinstr __ct_user_exit(enum ctx_state state) * In this we case we don't care about any concurrency/ordering. */ if (!IS_ENABLED(CONFIG_CONTEXT_TRACKING_IDLE)) - atomic_set(&ct->state, CONTEXT_KERNEL); + arch_atomic_set(&ct->state, CONTEXT_KERNEL); } else { if (!IS_ENABLED(CONFIG_CONTEXT_TRACKING_IDLE)) { /* Tracking for vtime only, no concurrent RCU EQS accounting */ - atomic_set(&ct->state, CONTEXT_KERNEL); + arch_atomic_set(&ct->state, CONTEXT_KERNEL); } else { /* * Tracking for vtime and RCU EQS. Make sure we don't race @@ -643,7 +643,7 @@ void noinstr __ct_user_exit(enum ctx_state state) * RCU only requires RCU_DYNTICKS_IDX increments to be fully * ordered. */ - atomic_sub(state, &ct->state); + arch_atomic_sub(state, &ct->state); } } }