Message ID | 167940844480.5837.12194388325667368870.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1808557wrt; Tue, 21 Mar 2023 07:24:39 -0700 (PDT) X-Google-Smtp-Source: AK7set8w9p73xbKJRAC6PYf+OwG0m442KwQsXsZHVteFCMaDOpG77dxa2mTmHLlV9FjjzIHH93rg X-Received: by 2002:a17:902:d50b:b0:19b:64bb:d546 with SMTP id b11-20020a170902d50b00b0019b64bbd546mr3523209plg.18.1679408678984; Tue, 21 Mar 2023 07:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679408678; cv=none; d=google.com; s=arc-20160816; b=l4ZdY1F0vdxmgy4zvAk99cOUM1fK9M/pQRvd4eZYxTHXzKvJGKRs9RG0AXlIB4qkjE aMfukJXe4fJIrN3uiM7jGl0G31LzgQF/oyQugZfj2fgpZ8AXXZFdyt3+iEHtEndGej9W YUBF88xObQCVCNfbSyZWhz600NM8gio5WNTvMAFFtcoHZESFcYPihVU4d92lN/0I80N9 jYY0E6E/Ky+FJQed8iIOc5gmrM9+bKnqcI1C9509SiWev3RxQ2UDcUewPYoBi1pqrX4i qo3+11ViftJ5ct3mpLzuk26j6mYeMKrR3dwncXHKqKMLKtz9Rnm4wPISs/3ebdqmgd++ DjAQ== 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=/pBoFmguioMLSvMkftSbQsFCmP0noBrs9vtbgLjshAc=; b=0UiFsdInRHdpMYmTUtQkypyOcEbuFUy7rvjaFlrbirGzd/VG0PD35S3UGxFO9rkfDZ U63q/zFFNs/5KdSZ7xLbt0PmaInFNz1glfw+5lWKDxhGr+WKqnvY/JELwHNHpy07RjuW cQtj0+6ei/jIKz3dV55MmECcbdixpVIBsP/NIrQgl6bJLOwI9qerKM65mHHXrAuhkcNh hB4V5hSX+nx0uUG/Z/+lVgLukILTdUYmICsMpz0Qv9tjmRayJVJsNh6OCBrjY5uz2d5u uBvjkFlneznflh9xLvuoyCXaACHgIic8TWsJDHsnn6VM9uQqgfDdkoYuGdxZaRwAL32X vfpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="EP3O/vmq"; dkim=neutral (no key) header.i=@linutronix.de header.b=vYszxp0j; 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 d16-20020a170902ced000b001992ede12a5si15102183plg.27.2023.03.21.07.24.20; Tue, 21 Mar 2023 07:24: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=@linutronix.de header.s=2020 header.b="EP3O/vmq"; dkim=neutral (no key) header.i=@linutronix.de header.b=vYszxp0j; 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 S231401AbjCUOUu (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Tue, 21 Mar 2023 10:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230039AbjCUOUs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 21 Mar 2023 10:20:48 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A3620A1C; Tue, 21 Mar 2023 07:20:46 -0700 (PDT) Date: Tue, 21 Mar 2023 14:20:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679408445; 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=/pBoFmguioMLSvMkftSbQsFCmP0noBrs9vtbgLjshAc=; b=EP3O/vmqEGzpvO+v4uy3UK5mD6qeM4iyotV+LChHLXWFgtDv/Al0BOhbd7Lr2T/nXWOiOm kSGdFdEuTcezs4RXywDnt1fJZPm8COnq6Fyr1oT7DDNFqCyFCXK5jEFOn6HCCodiEqfbrC 55h+X7BZ5UMHSsOm0s1wgvR1fxilFb5Deok7pE1DH+M5dfV9pcjr48faUsnyg+Gv13yq8j HLqlfZyrzq4jzzukM/hLIYgh9oJRSUE5TNosrFYQI/93qN0C5j2WVeZ41h3B4UlJ0Lk0m+ mkKPPdu7m52ggB0iapsnMMayNXbU7QU14iWDCWHMlPI+p7bICX7j/CmsHtNjPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679408445; 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=/pBoFmguioMLSvMkftSbQsFCmP0noBrs9vtbgLjshAc=; b=vYszxp0jgFDPzW/LXpFoSgkUgMD01QQOUV0eslXVrhl1X9MDbBLUsUv1vGaf9BHz7UaKBu bM3jExA7eUhTB9CQ== From: "tip-bot2 for Frederic Weisbecker" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/urgent] entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up Cc: Frederic Weisbecker <frederic@kernel.org>, "Paul E. McKenney" <paulmck@kernel.org>, "Joel Fernandes (Google)" <joel@joelfernandes.org>, Thomas Gleixner <tglx@linutronix.de>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230315194349.10798-3-joel@joelfernandes.org> References: <20230315194349.10798-3-joel@joelfernandes.org> MIME-Version: 1.0 Message-ID: <167940844480.5837.12194388325667368870.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760464995167647711?= X-GMAIL-MSGID: =?utf-8?q?1760987635092561749?= |
Series |
[tip:,core/urgent] entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up
|
|
Commit Message
tip-bot2 for Thomas Gleixner
March 21, 2023, 2:20 p.m. UTC
The following commit has been merged into the core/urgent branch of tip: Commit-ID: b416514054810cf2d2cc348ae477cea619b64da7 Gitweb: https://git.kernel.org/tip/b416514054810cf2d2cc348ae477cea619b64da7 Author: Frederic Weisbecker <frederic@kernel.org> AuthorDate: Wed, 15 Mar 2023 19:43:43 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Tue, 21 Mar 2023 15:13:15 +01:00 entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up RCU sometimes needs to perform a delayed wake up for specific kthreads handling offloaded callbacks (RCU_NOCB). These wakeups are performed by timers and upon entry to idle (also to guest and to user on nohz_full). However the delayed wake-up on kernel exit is actually performed after the thread flags are fetched towards the fast path check for work to do on exit to user. As a result, and if there is no other pending work to do upon that kernel exit, the current task will resume to userspace with TIF_RESCHED set and the pending wake up ignored. Fix this with fetching the thread flags _after_ the delayed RCU-nocb kthread wake-up. Fixes: 47b8ff194c1f ("entry: Explicitly flush pending rcuog wakeup before last rescheduling point") Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230315194349.10798-3-joel@joelfernandes.org --- kernel/entry/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 1314894..be61332 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -192,13 +192,14 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs, static void exit_to_user_mode_prepare(struct pt_regs *regs) { - unsigned long ti_work = read_thread_flags(); + unsigned long ti_work; lockdep_assert_irqs_disabled(); /* Flush pending rcuog wakeup before the last need_resched() check */ tick_nohz_user_enter_prepare(); + ti_work = read_thread_flags(); if (unlikely(ti_work & EXIT_TO_USER_MODE_WORK)) ti_work = exit_to_user_mode_loop(regs, ti_work);