Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1900604rwb; Thu, 17 Nov 2022 03:53:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf5aSKylq7mp7Pb2g+530qymcwBQbHiHok8wjPEZbZRK2ApVarZlgZRuG5I/MNx/hU7JzlJA X-Received: by 2002:a17:902:e952:b0:188:9542:515 with SMTP id b18-20020a170902e95200b0018895420515mr2469904pll.102.1668685989937; Thu, 17 Nov 2022 03:53:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668685989; cv=none; d=google.com; s=arc-20160816; b=Mu/P4sXD5wyZVhg/x3HXW4XWjZ7+T5/dufXf19zusDEldGmtCWzveex2egCbaPgJcB NwGcVnzSKtsqInG+aF7LgmxQf5k+/nyGswSKBbBK+uql0MJNhzQVLNovltusJCRnFECj 78ywzg9E4QN3CM2XKgb/YHwoc8AfIpTanpQBmNzjcaNT7A5N5M8TitMlNBPj2L2+m62p XM1eUn07128DC1aHy6ijhG970DJPzsRkeKWGdnElqEeA5ogMfn0NesJiZraw/ml1dLIt 40Yibrgp1oZVUkMQ52KMlitIsO2Aa/l/Pxb4KTupjB3tk6LU+gye9GwTPytitS2IIRGW ov4w== 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=tsryr/o1050Qgwa1/wCJRItrbPDe+qt77rbyNq/EvKM=; b=QP950tPwPkHAc1cERhMH6acrSCAzPMjRnnuahy67VlAINDZxU2rK51Vl1NsflxxYW4 s6gkDH73k5hFNXM3Nh7OYeHIS0XIV0xKKi2Hn6DlJ+SgzrV7zGkcTNAXls7kPyM1YP8Q y/oVdg3UzXwmA4DXFikqnfx0amwGrPdXO2WwmpiMRTKAIc9T2xg3CpoGVzd8vG1LjQSk x9KwUMSffItuhHdPg7PaqsNM/Y1XSwyWRdwvZvqk9R/9BpomNSBJ2Og2S8JRhEdt2O2m 8fR3DYxYOxn75hG+BwP+7+JkBIAaXJ2jZhg1PVljsCoRCH5YBxCUBI2UcwzIVbpHdIck pH1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TUlY7ARY; 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 q14-20020a056a00088e00b00572d6af280asi812746pfj.110.2022.11.17.03.52.58; Thu, 17 Nov 2022 03:53:09 -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=@intel.com header.s=Intel header.b=TUlY7ARY; 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 S234687AbiKQLPG (ORCPT + 92 others); Thu, 17 Nov 2022 06:15:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234729AbiKQLO5 (ORCPT ); Thu, 17 Nov 2022 06:14:57 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66832B02; Thu, 17 Nov 2022 03:14:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668683696; x=1700219696; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=v04Ag2ceXqVcD6vlEr0yMJgTmBUx6AYrMeEO/PVcnzE=; b=TUlY7ARYQLeZW0+40xt1ivtVwnWYr3VbUDzxkiWGdALGh9ZwXbISCaFP sc+AN1wDgLUy8Uu7wCaByiVXbTEvO+2i4YQKkg2R5+PJtVijQ0N6lvMpP h+MXqYjuDf0gPLaOPoclq5YTw+wvfLVChVDIPaK2C4/XBG5wexsX/OgOF DOVD/X5luuHlxzlN76GmDfOjsTEbPM50Yy19SyzZAIGzSs2itAe0ngRUm ryA3RbBji/ZeTL90vr6OAibRm9AhY4iZMdvXp9FUZMSxqwBqiW5/KPo4H 8d6InvXRru/+lkUPDaefS7PYp8TQpb7BNjb4oiU7Ne5ME1hWoSD9rHSJh A==; X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="311528571" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="311528571" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 03:14:56 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="814483089" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="814483089" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.129]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 03:14:53 -0800 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org, joel@joelfernandes.org Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] srcu: Add detection of boot CPU srcu_data structure's->srcu_cblist Date: Thu, 17 Nov 2022 19:20:50 +0800 Message-Id: <20221117112050.3942407-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=-4.4 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 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 Before SRCU_SIZE_WAIT_CALL srcu_size_state is reached, the srcu callback only insert to boot-CPU srcu_data structure's->srcu_cblist and other CPU srcu_data structure's->srcu_cblist is always empty. so before SRCU_SIZE_WAIT_CALL is reached, need to correctly check boot-CPU pend cbs in srcu_might_be_idle(). Signed-off-by: Zqiang --- kernel/rcu/srcutree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 6af031200580..6d9af9901765 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -1098,8 +1098,11 @@ static bool srcu_might_be_idle(struct srcu_struct *ssp) unsigned long tlast; check_init_srcu_struct(ssp); - /* If the local srcu_data structure has callbacks, not idle. */ - sdp = raw_cpu_ptr(ssp->sda); + /* If the boot CPU or local srcu_data structure has callbacks, not idle. */ + if (smp_load_acquire(&ssp->srcu_size_state) < SRCU_SIZE_WAIT_CALL) + sdp = per_cpu_ptr(ssp->sda, get_boot_cpu_id()); + else + sdp = raw_cpu_ptr(ssp->sda); spin_lock_irqsave_rcu_node(sdp, flags); if (rcu_segcblist_pend_cbs(&sdp->srcu_cblist)) { spin_unlock_irqrestore_rcu_node(sdp, flags); -- 2.25.1