Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4674850iog; Wed, 22 Jun 2022 03:44:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s+oLo/644ik2MNJWKRaw3Ys/t5q9tAxfeFRXJF9Gw3liUboU3yUnq5p2IhA7H+Lv2R1tM4 X-Received: by 2002:a05:6a00:2986:b0:525:4214:c13b with SMTP id cj6-20020a056a00298600b005254214c13bmr4544672pfb.34.1655894670650; Wed, 22 Jun 2022 03:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655894670; cv=none; d=google.com; s=arc-20160816; b=ZgwizKMl9pLhaQQf/hBK0/LIm+q7sqOUH7182n1xuUVEkItyyhIXxao0hSwhp8oZps il+WqC8szVQh2OK1TOgec2vi2ZWOapGPKYw7m9yCIQGBcDJZtrZkYGsY5ieRcwijomWy 0prTRDXmwijDBpQwgCklHkqbZEClliqdfT8vlc0LVknI0k0yYmkw8g/9FiPgbZEChCNN ZDHVyEErVUixUODWWNytApcKo+V/6jNHfLTeqV2rujGFfuCwoKeoxi/wjgW6pfiur+LI HhQ9STI2Y6PNJX6v6XaDYokAZXYu/zDsX3OoNPDQyiAzqXvR+clfwdw+W2O7Fdyxb4YO GvuQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=gHsoiTGuM9YGYYm33zT11ckyeaVWxdr4fc2HR+O5t3g=; b=hmDei7A1YYzov39nKVj7KouAcaDxydIeczQX7SE9ZmTUsK2aDRLLMXtrp4y/awOyA3 DA0Pf2zLE2bsoMBeDCZ5bUQlS9Se5s5FW/l3MpHfPU62/JuE5sYU1FrM20kLo13+Y3Ib mRlGh13VsWOo35ozEyz/pABOgXKiLxMqS2vGidK8JH1IZmyHUrb0yOz3OmwK3aP44/E+ GIoRDLm1+ZL6xW3YCfngL+bE8+lttFJdzn3+aq91Jwn8nR45RyDHmswea79m1VoaiFYW E9OH31OgdnS3aUpDUc7gne+lk7ykEjIGhMWdUmNposTxNG6i47AIx/Mt19SAyggpvAwf ZsUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GcM9hHVz; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a170902760e00b001677fa2026asi20652332pll.609.2022.06.22.03.44.18; Wed, 22 Jun 2022 03:44:30 -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=@intel.com header.s=Intel header.b=GcM9hHVz; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354748AbiFVKgQ (ORCPT + 99 others); Wed, 22 Jun 2022 06:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346319AbiFVKgN (ORCPT ); Wed, 22 Jun 2022 06:36:13 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6A1B3B571; Wed, 22 Jun 2022 03:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894172; x=1687430172; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ab1KhP6RlfLDUpqQx5KxRjWRdxnAQ1ojvkbHJLNruCA=; b=GcM9hHVzjAthPztuxRujmN3z1Eqp2ZNzz2qZeUy3QsharapGACJV9cQT KgHs0F2EuW4JvIhDxmDod9WhWiH+AQ5KJRYS9J2ZHAEDgDCBrzdXGCrCu 98iEYj9gwqCh5xfeiloak5UaIqcvBiDFJi7cUJVKyAZLM9LwE3WeTLNVA LSJWSdXlYQrUw0lwwIZKa6Kb63AcVaSCpfVql0bz3hxCVF21/TCRgpMfk yZZ/I1xvh6N2zMDZGFsA5o7gWEpZ5/n82UqlMJceMVB9wryD1WdS4pJdT hgxMpkAe4AjCHklUWH5uk1V786ebMmTEpuLNwuYnJVtnlgORboK0H1/wW A==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="281456222" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="281456222" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:36:12 -0700 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="644131142" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:36:10 -0700 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rcu: Add exp QS check in rcu_exp_handler() for no-preemptible expedited RCU Date: Wed, 22 Jun 2022 18:35:49 +0800 Message-Id: <20220622103549.2840087-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 In CONFIG_PREEMPT=n and CONFIG_PREEMPT_COUNT=y kernel, after a exp grace period begins, if detected current CPU enters idle in rcu_exp_handler() IPI handler, will immediately report the exp QS of the current cpu, at this time, maybe not being in an RCU read-side critical section, but need wait until rcu-softirq or sched-clock irq or sched-switch occurs on current CPU to check and report exp QS. This commit add a exp QS check in rcu_exp_handler(), when not being in an RCU read-side critical section, report exp QS earlier. Signed-off-by: Zqiang --- kernel/rcu/tree_exp.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index be667583a554..34f08267410f 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -828,11 +828,14 @@ static void rcu_exp_handler(void *unused) { struct rcu_data *rdp = this_cpu_ptr(&rcu_data); struct rcu_node *rnp = rdp->mynode; + bool preempt_bh_disabled = + !!(preempt_count() & (PREEMPT_MASK | SOFTIRQ_MASK)); if (!(READ_ONCE(rnp->expmask) & rdp->grpmask) || __this_cpu_read(rcu_data.cpu_no_qs.b.exp)) return; - if (rcu_is_cpu_rrupt_from_idle()) { + if (rcu_is_cpu_rrupt_from_idle() || + (IS_ENABLED(CONFIG_PREEMPT_COUNT) && !preempt_bh_disabled)) { rcu_report_exp_rdp(this_cpu_ptr(&rcu_data)); return; } -- 2.25.1