Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3697132pxb; Mon, 24 Jan 2022 15:39:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyz5LB6tmIpNmD3roIU72av0DNoHlc5O/Q8WHZx4Rkdw/X5qHbKuDri1aGg+ofuO4WccbST X-Received: by 2002:a05:6a00:cc2:b0:4c9:f07d:6abe with SMTP id b2-20020a056a000cc200b004c9f07d6abemr3976544pfv.17.1643067551641; Mon, 24 Jan 2022 15:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067551; cv=none; d=google.com; s=arc-20160816; b=QO59WHkBosXHNhLgqeutvyZVN5vbTnL4xO36rWCjTnMH2W04hcaXqqVbVV5ChvtDzf TbOJCbO2zVXK7a+5IDa0hljiTgwlrbJ6M3Gia0s7skg1gERin8zcFG13Mvc6abhcgPjT T4AJdljkvmgCwscKiUKyLvQUg0PL6R2CyHG0skmdgODcZtIBeElTwRDQJreUNYvwDWH/ GRGFUF/kAKIM2VwENNN7/95pY6z51uZHrpAlRG/k8nlVAkJq2CUk1o1J6nLe6v7frYeG rZz7qQ1CY+RXMEdLnGr8qKHa738wUSrvyYV4+G3b2uLY4IlUBWDUWEL3FlOIoNwtwvch hrww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7zmA7i+Bo4C7eX+mUeNo2thv9jGd8BDujIvW4YqRuJQ=; b=fS6lzTXiSweXZloDQ/uuLspdY1ETJXPLRpb7Ht3jhdgKejdlMvEM0TDBoYG7UkgVKa PGSl5EkAyETdVJgQz5SmY+4lpjvOlSL7kiiE6fPq7Rnsnyrn3koQ/dZCumeqP8C4cZ9U qViNnXvKHRNF5oyRgrBEiNif3pzagO57DdJ6UXr4zrLQoE6DkcEMry6oU/K6BPPE1Vj+ SkENrwdz1cZPEISteGB6SKvNhr9xUHL9BEWUk3KuUcH+i5cMlSbeaiywkVTDQCKBb2Z/ TkEz4uhOPMeQOpOHm73uESAtkaHfyJ6IOy4a2SPx5qttY+OaKZE0wTaCYMb+Pz+YTzvF HolQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zbLhdQmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si11710251pgq.207.2022.01.24.15.39.00; Mon, 24 Jan 2022 15:39:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zbLhdQmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359958AbiAXXfa (ORCPT + 99 others); Mon, 24 Jan 2022 18:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838031AbiAXWps (ORCPT ); Mon, 24 Jan 2022 17:45:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02417C0550E7; Mon, 24 Jan 2022 13:06:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9582561320; Mon, 24 Jan 2022 21:06:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 717B8C340E7; Mon, 24 Jan 2022 21:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058377; bh=sN1MrGINuCa0tfGr5vuPfsGYIsd6lo6Uw1MmiQI9n8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zbLhdQmf2voHYFudctaja4CgnvAKC2uGO1x1/01ueEFpuxlbIKZFMXoByHbnp5dZL YXh9kA6Ui7ijtCudQNJojXo6dXv5EW2dP7qKENXx4O9Ekhfr/AcLBcZXMJEVEn7HQB nbl1j5yNJHGSE87cLKaOEH4+lcqo4zyAL0iYjkMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neeraj Upadhyay , Frederic Weisbecker , Uladzislau Rezki , Boqun Feng , Josh Triplett , Joel Fernandes , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.16 0262/1039] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass Date: Mon, 24 Jan 2022 19:34:11 +0100 Message-Id: <20220124184134.113150459@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frederic Weisbecker [ Upstream commit 81f6d49cce2d2fe507e3fddcc4a6db021d9c2e7b ] Expedited RCU grace periods invoke sync_rcu_exp_select_node_cpus(), which takes two passes over the leaf rcu_node structure's CPUs. The first pass gathers up the current CPU and CPUs that are in dynticks idle mode. The workqueue will report a quiescent state on their behalf later. The second pass sends IPIs to the rest of the CPUs, but excludes the current CPU, incorrectly assuming it has been included in the first pass's list of CPUs. Unfortunately the current CPU may have changed between the first and second pass, due to the fact that the various rcu_node structures' ->lock fields have been dropped, thus momentarily enabling preemption. This means that if the second pass's CPU was not on the first pass's list, it will be ignored completely. There will be no IPI sent to it, and there will be no reporting of quiescent states on its behalf. Unfortunately, the expedited grace period will nevertheless be waiting for that CPU to report a quiescent state, but with that CPU having no reason to believe that such a report is needed. The result will be an expedited grace period stall. Fix this by no longer excluding the current CPU from consideration during the second pass. Fixes: b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()") Reviewed-by: Neeraj Upadhyay Signed-off-by: Frederic Weisbecker Cc: Uladzislau Rezki Cc: Neeraj Upadhyay Cc: Boqun Feng Cc: Josh Triplett Cc: Joel Fernandes Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tree_exp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index f3947c49eee71..9e58e77b992ed 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -387,6 +387,7 @@ retry_ipi: continue; } if (get_cpu() == cpu) { + mask_ofl_test |= mask; put_cpu(); continue; } -- 2.34.1