Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3795566iog; Tue, 28 Jun 2022 03:00:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v7Ln8WPdjCfg3FJjWhdkMirZ78Cc8OJxRFkQpche9EyI1ratNAaw6fanODw8DQDhiguRst X-Received: by 2002:a17:902:f114:b0:16a:133a:b1fe with SMTP id e20-20020a170902f11400b0016a133ab1femr2990036plb.66.1656410408559; Tue, 28 Jun 2022 03:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656410408; cv=none; d=google.com; s=arc-20160816; b=fyAtLe3sByuQLQQp6syj3dZ5oyi5oyafKzhQUAe+COmrU6vaBs6RwCs/iFTJjHqjNe 0opVEmn/MToJfdEmgPxMwrCPRUp9oJxbqA5viLCBQNvA9ytcyIxdLV1kEX9K3hufFmV9 V6+weFay/sJxaCdo2aw7w7i8mreYFedKHquXDhqD2+qNkoGeB9pQwr33prIpVG38stNm xvleQWpic5ceeZEPmijVddujM+POs1MLQKL0RjsYk7kPbEfwdct+H87LDAZdyz8wIsSe wcCSrDZnxV4tWTOztOjrAgkj8OcXU6F2U4jvL/4Fc5IaazEjnEd3lBma30Lr7NFCP20T ex5Q== 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:subject:cc:to:from:message-id :date:dkim-signature; bh=93kwjZ6VUAqC3HUype2huUHDkYgh8aDT1qLtRclZHNk=; b=ZnzePg3QjUkb8eTpzo41I/bfbdcGRvFtdaMUJe4K1Y3a/l94zpppG43X9TSyWbGC3z YSP32UFB/6c3JWoAqFE4P+gwa/5MlzfgMzvAMuq8HRNre2FcvLzuOoPkYiFC8VIID0ZN tUbBf5G6hu3ylwPJRO9U3FAy3QqOUmwMmox4JR0HPhIAJVrsPde2m7tVt3PvRo93iIOm Aid3nnd7Fmo2ryyRUHStFm3fGriMLTkWawKc8Nxfq0uR1EJs0EJwVYCDzQK1d2vLROwX dqeoJTlWtgU4zh90znHZ0OkDOd/0sGA3RICJL1/aQWfwUrF/5fvJgP6McSgLMEXJRC5w R+Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tmnbHMMp; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t71-20020a63814a000000b0040ddfdb2b4dsi8531797pgd.384.2022.06.28.02.59.56; Tue, 28 Jun 2022 03:00:08 -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=@kernel.org header.s=k20201202 header.b=tmnbHMMp; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242393AbiF1JcD (ORCPT + 99 others); Tue, 28 Jun 2022 05:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbiF1JcA (ORCPT ); Tue, 28 Jun 2022 05:32:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 953DC1EAC1 for ; Tue, 28 Jun 2022 02:31:59 -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 ams.source.kernel.org (Postfix) with ESMTPS id 58485B81D35 for ; Tue, 28 Jun 2022 09:31:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15567C3411D; Tue, 28 Jun 2022 09:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656408717; bh=vd7MwdbmIjU8f/cbr5SMG+Q8UGlRYGSlJ51RV5CWtCU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tmnbHMMplWuux8JNaKMiJifbjulg1W/UuZVxNHWVUXgWyV/YT7P/YF840BGwcESJI jN2F9mEK7yN+4GgbMWZmfQYndCuTWx2Tffb9BEyiFUvdWq7Q5kK4YyxfUBW9CIV7SA ui85gb4dhokWMszhivfLr9Cpd37ZNHx7pn9oumQcvuREgQXAPcVsgn2UTNgDGlvK4H NJZ9cLp1Zx1QfdUKaFwY2KRfhSrlznR31CwLNN9aWELABiWwV5Is4P75IgHauvz0m3 EW3ndCdyLjMvpTU8p7r3CYCLSACgW9UlIlW19+L4jMLGMecesYYxRMucJlyPQXG7bB PUJB8Afg8Pj9w== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o67Za-003j7c-OP; Tue, 28 Jun 2022 10:31:54 +0100 Date: Tue, 28 Jun 2022 10:31:54 +0100 Message-ID: <874k052kxh.wl-maz@kernel.org> From: Marc Zyngier To: Neeraj Upadhyay Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH] srcu: Reduce blocking agressiveness of expedited grace periods further In-Reply-To: References: <20220627123706.20187-1-quic_neeraju@quicinc.com> <875ykl2mb2.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: quic_neeraju@quicinc.com, paulmck@kernel.org, frederic@kernel.org, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org, linux-kernel@vger.kernel.org, zhangfei.gao@foxmail.com, boqun.feng@gmail.com, urezki@gmail.com, shameerali.kolothum.thodi@huawei.com, pbonzini@redhat.com, mtosatti@redhat.com, eric.auger@redhat.com, chenxiang66@hisilicon.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 On Tue, 28 Jun 2022 10:17:24 +0100, Neeraj Upadhyay wrote: >=20 >=20 >=20 > On 6/28/2022 2:32 PM, Marc Zyngier wrote: > > On Mon, 27 Jun 2022 13:37:06 +0100, > > Neeraj Upadhyay wrote: > >>=20 > >> Commit 640a7d37c3f4 ("srcu: Block less aggressively for expedited > >> grace periods") highlights a problem where aggressively blocking > >> SRCU expedited grace periods, as was introduced in commit > >> 282d8998e997 ("srcu: Prevent expedited GPs and blocking readers > >> from consuming CPU"), introduces ~2 minutes delay to the overall > >> ~3.5 minutes boot time, when starting VMs with "-bios QEMU_EFI.fd" > >> cmdline on qemu, which results in very high rate of memslots > >> add/remove, which causes > ~6000 synchronize_srcu() calls for > >> kvm->srcu SRCU instance. > >>=20 > >> Below table captures the experiments done by Zhangfei Gao, Shameer, > >> to measure the boottime impact with various values of non-sleeping > >> per phase counts, with HZ_250 and preemption enabled: > >>=20 > >> +=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80+=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80+ > >> | SRCU_MAX_NODELAY_PHASE | Boot time (s) | > >> +=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80+=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80+ > >> | 100 | 30.053 | > >> | 150 | 25.151 | > >> | 200 | 20.704 | > >> | 250 | 15.748 | > >> | 500 | 11.401 | > >> | 1000 | 11.443 | > >> | 10000 | 11.258 | > >> | 1000000 | 11.154 | > >> +=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80+=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80+ > >>=20 > >> Analysis on the experiment results showed improved boot time > >> with non blocking delays close to one jiffy duration. This > >> was also seen when number of per-phase iterations were scaled > >> to one jiffy. > >>=20 > >> So, this change scales per-grace-period phase number of non-sleeping > >> polls, soiuch that, non-sleeping polls are done for one jiffy. In addi= tion > >> to this, srcu_get_delay() call in srcu_gp_end(), which is used to calc= ulate > >> the delay used for scheduling callbacks, is replaced with the check for > >> expedited grace period. This is done, to schedule cbs for completed ex= pedited > >> grace periods immediately, which results in improved boot time seen in > >> experiments. > >>=20 > >> In addition to the changes to default per phase delays, this change > >> adds 3 new kernel parameters - srcutree.srcu_max_nodelay, > >> srcutree.srcu_max_nodelay_phase, srcutree.srcu_retry_check_delay. > >> This allows users to configure the srcu grace period scanning delays, > >> depending on their system configuration requirements. > >>=20 > >> Signed-off-by: Neeraj Upadhyay > >=20 > > I've given this a go on one of my test platforms (the one I noticed > > the issue on the first place), and found that the initial part of the > > EFI boot under KVM (pointlessly wiping the emulated flash) went down > > to 1m7s from 3m50s (HZ=3D250). > >=20 > > Clearly a massive improvement, but still a far cry from the original > > ~40s (yes, this box is utter crap -- which is why I use it). >=20 > Do you see any improvement by using "srcutree.srcu_max_nodelay=3D1000" > bootarg, on top of this patch? Yup, this brings it back to 43s on a quick test run, which is close enough to what I had before. How does a random user come up with such a value though? Thanks, M. --=20 Without deviation from the norm, progress is not possible.