Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3572532pxb; Mon, 24 Jan 2022 12:31:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxufWlLwkNGbHYSE6Y6499IHaWZ2GdDoYPwhdO0gk9TAJfeO4yYmPielyiAAdJIUxtmjMJa X-Received: by 2002:a63:7050:: with SMTP id a16mr13012599pgn.282.1643056313833; Mon, 24 Jan 2022 12:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056313; cv=none; d=google.com; s=arc-20160816; b=ulJ+tFx7BI3PZbujaAkRs1AIhIb68xpRKzj7SgYRknTFrelFfSqC3uMP1FJuzRlfEX 7QBjNoIwh0Xj9n5cNVwZ/v2TLmuy3rex8Pyz1QCVJjWh/C9mlEhoL6it9HWGB7asJxDC mCR9fHPkdfsLGqvxrJXdWv+mKNPaqdAqksGhY2BD4jo1nG+akX9aW09T50i9RH+35bRW qDp71wk1kQ4iT7OwwQQfyJ+5rMDBLEZrGvOKJYdFEul54i1LKoNSmY80UePBIuYN5gdl Vf2jmaFK3BfnZZX/UQ1HW3FxQR4/4PxziPoKV3HBovNkz5p+FKd0w+VxIZp8OUDSOkmi zkuQ== 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=JAKjNy2kwqgBVdpTPCws55iFtuSNxVViWJ1kk0oMIRE=; b=yS+XXLT52csMV2HaE0wIiz5oij/pnFIQ+F2k0hsqebV+LzGBKBmMFvA4UeiHrpsIK9 a1jVAhcFk7BPs4tcjNNvTvPJ5YvWqGqCaDsRs3JqOvp0iC5volYOzTiYuDiCK8HUO7qm zINR0jdn6ooX/M1GqqV06KqS+0V52xzcKMU/0ibqPqN9z2s5i1gTLRH/BNqZpj/eBDTL 5w55vHWW/I8WdgbWjjpek6Y7qqceNdTya0kSQAV+rAJTmSAg9S8EsHVXsJWtPFgu5P1a 2u9B7Q3hjMYW9Ck43qCgXHfuGbWoTPtGVOrDdFBxmHbwHZXk/Z8wKVMGZCM4DHUxsjUz BMVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ndXtwCZU; 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 y13si14692641pgc.372.2022.01.24.12.31.36; Mon, 24 Jan 2022 12:31:53 -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=ndXtwCZU; 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 S1353935AbiAXTfg (ORCPT + 99 others); Mon, 24 Jan 2022 14:35:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49014 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348197AbiAXT2L (ORCPT ); Mon, 24 Jan 2022 14:28:11 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id 62A72B8121A; Mon, 24 Jan 2022 19:28:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90400C340E5; Mon, 24 Jan 2022 19:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052488; bh=8x76DRlB8IfR/34mTMkzRlPwJKUqVUcLK23r2U2ikrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndXtwCZU80x33cDBMe/2cFS9/OwN9DGSZIIaL9AVS32uuCcPEhr3flajYPSHN5ITB 2nSl2Y/z7r4Hjta+6gCK+ZT8zh6ymVSJFm2r3hTpMkbR8MpQK8rd+dK6ingvc8E/D8 kRkAOohrZ+nRvAtuw2Bs+JufSO5bEHtjnK++lnfA= 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.4 076/320] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass Date: Mon, 24 Jan 2022 19:41:00 +0100 Message-Id: <20220124183956.321184458@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 4c4d7683a4e5b..173e3ce607900 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -382,6 +382,7 @@ retry_ipi: continue; } if (get_cpu() == cpu) { + mask_ofl_test |= mask; put_cpu(); continue; } -- 2.34.1