Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1034713iob; Fri, 13 May 2022 20:28:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9lDBfsugZMyB3T3W3ixcULuIYHXNccpqUwHGsD2nEzaHS2ZPUcbQp3UgdnyrNAzzFmvHr X-Received: by 2002:a05:600c:b4e:b0:394:4551:113b with SMTP id k14-20020a05600c0b4e00b003944551113bmr7152615wmr.9.1652498888411; Fri, 13 May 2022 20:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652498888; cv=none; d=google.com; s=arc-20160816; b=BeRRt3hlTax2fc4KnLiHvgTf+PtH24le8kItmxuaVW0U3bi4bYy2oalNA+4PRFgotM xEn2Iy6JIPojf9M50O7rYv48RNa/sfYw1JST+7vrWHfXyn8cnVKbRBIKULHfHDWFMPSu CsJcj5C3dbRI88jSRjHLu2b1I98i5HI8chGUpHo1ccxGKYCjF98G3aJRuZMBv6Gtk6CM ysYX83rX6MgSheZcLrhL8oe7iIpJSTEgO8WBDgSbdoXIfdShC0k4utj37ae5ZvaKbXQb SoDaUa1N1owTFzAVQdS6Rafwb3MMGIHttYdofVwqDmKBqgcZl6KJpUHA/HobDrNB57SI vs2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=YBNXDnk8rVIbANvUeeczwxKi2DXFaY4PstVE/toZ+bY=; b=D44M9LsioWDSayuYggxKPJAhUHKUhCH/0LU/qp8RC/84FsqBO81hXv8RJ+rzcWnePt kHaALVV1vKwhmYdYuvXOVkOv9hVmdRVoq5H5nW31RUiRmRXMEOEDqOAgDKjwxVFh6TGZ 3S+7LrrHgfdjjii+Zu+4HYJxZ7/dTIFc8so3SB76cf+I3lOJ9IPoO5R2qCVmKwtDjQEP IzRczgWSC1oFrkZXGzfEZvPDxy3U278iAPj5I+rJzpSCcfAhiUD71FkT69mg5n4SfO8T 2Anm148JMK2HG9BAyVdG2gnc119K67jxxFjmVv8BQSte3mngP3amV0MLptrvlT1mS0F3 zrRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MugHpPrb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l15-20020a5d6d8f000000b0020ccc2dc48esi3939305wrs.575.2022.05.13.20.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:28:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MugHpPrb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F3C4419F6D; Fri, 13 May 2022 17:05:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242880AbiEMOOt (ORCPT + 99 others); Fri, 13 May 2022 10:14:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbiEMOOs (ORCPT ); Fri, 13 May 2022 10:14:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EAC6E0D4; Fri, 13 May 2022 07:14:47 -0700 (PDT) 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 BD75462112; Fri, 13 May 2022 14:14:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 159C2C34100; Fri, 13 May 2022 14:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652451286; bh=J0Cl4mXGgT8rgZPubGxu6kkMwNidiS6O+73+RhxIujQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=MugHpPrbZcsmTJOodu+YZohAOEPU44MayaczpjCJS8yged8f23jozV9dbnCI0PEDr bwpIXWsebvpUffFp4Wf8RSbWttwYtRSciZtWsbfCnprslqqfMpuarZ/CQ714SGmok/ Tm8aa5oPOwmGPFw6tCBrfEa2RoIbwUzcZ/cjjoGMY9d6gdJzl1HgawxP/wHRG+lI07 /dBKzV7eb/WYHE0d2TjISBAW7Ie29voV6EotVbPjidn3CSjIFnTbGVjjTofpqdnCby juZqS1lqlinP1YlO0nTqyxvdQDEE4ymPYGmcqJGfmX25qV4waD6fNvR5A66gMDeS0V HArZXlUaELCHw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AF8E95C0342; Fri, 13 May 2022 07:14:45 -0700 (PDT) Date: Fri, 13 May 2022 07:14:45 -0700 From: "Paul E. McKenney" To: "Zhang, Qiang1" Cc: "frederic@kernel.org" , "rcu@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] rcu: Direct boosting gp_tasks for strict grace periods Message-ID: <20220513141445.GF1790663@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220513004256.465233-1-qiang1.zhang@intel.com> <20220513010651.GD1790663@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no 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 On Fri, May 13, 2022 at 01:17:16PM +0000, Zhang, Qiang1 wrote: > > On Fri, May 13, 2022 at 08:42:55AM +0800, Zqiang wrote: > > If the CONFIG_RCU_STRICT_GRACE_PERIOD option is enabled, the normal > > grace period will be treated as expedited grace period, the gp_tasks > > that block current grace period needs to be boosted unconditionally, > > therefore this commit adds Kconfig check in rcu_initiate_boost(). > > > > Signed-off-by: Zqiang > > >Good eyes! I have queued this for further review and testing, thank you! > > > >What sorts of tests did you run on it? > > Hi Paul > > I didn't think of suitable test method, > Can you provide me with a test method to test it, I will be happy to test. Here is one possibility: tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 60 --configs "TREE01 TREE02 TREE03 TREE04 TREE05 TREE07 TREE09 TREE10" --kconfig "CONFIG_NR_CPUS=4 CONFIG_RCU_STRICT_GRACE_PERIOD=y" --trust-make On a 16-CPU system, this will do eight kernel builds and run about two hours of testing. Thanx, Paul > Thanks, > Zqiang > > > > >As usual, I could not resist the urge to wordsmith, so could you please check the version shown below? > > > > Thanx, Paul > > ------------------------------------------------------------------------ > > commit 079e0f894c5d887c678f94332c1fa7287abfd6bc > Author: Zqiang > Date: Fri May 13 08:42:55 2022 +0800 > > rcu: Immediately boost preempted readers for strict grace periods > > The intent of the CONFIG_RCU_STRICT_GRACE_PERIOD Konfig option is to > cause normal grace periods to complete quickly in order to better catch > errors resulting from improperly leaking pointers from RCU read-side > critical sections. However, kernels built with this option enabled still > wait for some hundreds of milliseconds before boosting RCU readers that > have been preempted within their current critical section. The value > of this delay is set by the CONFIG_RCU_BOOST_DELAY Kconfig option, > which defaults to 500 milliseconds. > > This commit therefore causes kernels build with strict grace periods > to ignore CONFIG_RCU_BOOST_DELAY. This causes rcu_initiate_boost() > to start boosting immediately after all CPUs on a given leaf rcu_node > structure have passed through their quiescent states. > > Signed-off-by: Zqiang > Signed-off-by: Paul E. McKenney > > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 99cde4c947699..b4ab952f04ea6 100644 > --- a/kernel/rcu/tree_plugin.h > +++ b/kernel/rcu/tree_plugin.h > @@ -1159,7 +1159,8 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags) > (rnp->gp_tasks != NULL && > rnp->boost_tasks == NULL && > rnp->qsmask == 0 && > - (!time_after(rnp->boost_time, jiffies) || rcu_state.cbovld))) { > + (!time_after(rnp->boost_time, jiffies) || rcu_state.cbovld || > + IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD)))) { > if (rnp->exp_tasks == NULL) > WRITE_ONCE(rnp->boost_tasks, rnp->gp_tasks); > raw_spin_unlock_irqrestore_rcu_node(rnp, flags);