Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1494651iog; Tue, 14 Jun 2022 07:12:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/yKjftLjAT8VEsotfe7hMn1KkB0UPamzda5wFGekqNxwSBusaTjbl6yMSWc5o6ql1SekI X-Received: by 2002:a65:588b:0:b0:3fe:4237:2ee5 with SMTP id d11-20020a65588b000000b003fe42372ee5mr4772100pgu.442.1655215939282; Tue, 14 Jun 2022 07:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655215939; cv=none; d=google.com; s=arc-20160816; b=CkcsCoEoVTdF5qrYN07jK86cn+275agsf+AN4A8/Y0TQjTzGrZkZweWagQqmvrFAaB YIKoDKSeaCEvcrZzN/54/haVyJLXa/FU0TVxCYdqybfDFLCik3VozsiSjM81OpBCFPBL rHkB87ik2t2Z0pOO02vyBLFCRbU5cuP6HA9P5dXfcGrxUDmLwELwzr+GEXHGW6J9Gog9 zjoRXxADyINkNu/n9bV9BDesMgMoLSOtHmQLgRF/yRcs3R2fKwtdrbzSDKmenOk0+rUC tCyXbTi5TU8wzoGzw/A2ciL0j1JYS4+ngklY8OT0UKHj13/wNfbwwG6ubpxpSnmfWZwF vb/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:from:references:cc:to :subject:message-id:dkim-signature; bh=b+j3hfI52SuPbVR8+0Rma0F6k2hM1BhO8T4wYrdBWG4=; b=pcXGZidgWvkEXDwl/EfItXbKg7+CyxPJjXNOi9CDeYtAsIQTCy0aOYcFgnKhDFzWkh WJ69p21bTVoX8FSJimEcQ2A5dvqy0vnu4q6LV158rtVUz91GWM4JTfksrmJ18IjB8Fl3 nRJUgfdUk7ahV2X4gFLb5YAIxr+40JN1cqZIBL9aitvVfWliacCqWSrKoh970NV6GJGs CGi6qN4H92eMGE8qbb33beX8UjWPidt9MJP9zeD6yigIYt7mjXOpZIIcx2S6W8rrGdgc WaECdb1VIiLkYhe04tB07TsUlTHhMRzwTBf3OTh3S9jvzqp5+uI09gaf9xJgqqaZ4Dst KTWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b="lYLuGiA/"; 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=foxmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a63e155000000b003fc1bb74001si13443226pgk.54.2022.06.14.07.12.04; Tue, 14 Jun 2022 07:12:19 -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=@foxmail.com header.s=s201512 header.b="lYLuGiA/"; 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=foxmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235534AbiFNODw (ORCPT + 99 others); Tue, 14 Jun 2022 10:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbiFNODu (ORCPT ); Tue, 14 Jun 2022 10:03:50 -0400 Received: from out203-205-221-164.mail.qq.com (out203-205-221-164.mail.qq.com [203.205.221.164]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 803E73883; Tue, 14 Jun 2022 07:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1655215425; bh=b+j3hfI52SuPbVR8+0Rma0F6k2hM1BhO8T4wYrdBWG4=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=lYLuGiA/IGGLaucMp/fFwuc+HQhZKA4CDzpmNbwW1U+IQXVOrY4fc9W0YGzqq89hX 6AXqJWSUHK2qdP6fI34EKr65dlNG7NV5IqNuhpWN7ptNw/d4a+bzRn2Itie6Dm7Pjo qeaTxWl3HWprgxBWh9aOhVWCCsfFgNnDiFcy948U= Received: from [IPv6:240e:45a:409:26e3:89c6:2747:8c5d:8528] ([240e:45a:409:26e3:89c6:2747:8c5d:8528]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id E88A091; Tue, 14 Jun 2022 22:03:40 +0800 X-QQ-mid: xmsmtpt1655215420t2ny1izu9 Message-ID: X-QQ-XMAILINFO: M/NR0wiIuy702s701Wg5VwT1mROVrNO7zSBbQM60JMaejeyA4EMHVrtEyQiEhp hZ3rBlbgVlHcdZhKhw0sUoAKKkJ24It+CGPJjV+RHFSdXwJbMRAD53jS2y/loZGOpaqD+kmO9YZB 0Fz9pjlFGKg94ojqZnH0fcQGPLnyRpCUsH/4unfLDT/G7tC4fkw29JR39vx6Jyo6/rxQlYyGcm6K evyn/epSRAKDLd+0DPX6U31MTSblE3iffi8VetpwqZArZn0/POGUlQX56re3R7gejBVLOIPrrYhI FLi6ShBJQ6vCNllZKrP1XVNjGkcxcUz4hBAXfc389qOKnYryYgSw4ZjWFhmjjyQGr9bIEIW/FBIU ydn/mDSVT5Fw8y18rCWfGcYzERSVuGPrkOxMPYLVjlJMLpvvwFH1OWppJZ1wMx1gKtDjh0sXIz+i +XKRdNEItsfqs6FskkkZxYTKDxATaUoRE/S0hkFPeHctFFYfmhVsrK7AKZJJ6+CxpyEpEV+6ZwWu imObWSGnjIjulVj8drQc6gE/8DU4KJ2W69RIe0PGG5HflYKwV3jtzwEmlqivN5Gf1YXU1XhORBA+ 3MyJcWqeN8IiCdwrLU7kHCQMjezSPlTAOfJamiIZ4xfs4EcQS0egayXS4ANyPofDcrM1P0E8Ehnw 5xFeIM8PfDl7DIKKCr0Mt/smMt99EppSrVPriF8tcd6/+wOcpbBGlGMoTF9zG1obxNeFq71xfGxD vCGfKxgIIvaEp+3E496PkhwoBdNHzUSMKtOQqrFwYl9nsZvAkZ+sTuMiFP5m67pozNvlekhbslFo jn2ezjuUWKbQtwg9wpRxjJub2pSjxNUBOYmmWigYastaeoa/vGzeZTqxpgXU7R7uIG9j3GRny+hW shfHZwnCjDPoJ1lqeuDlAu7ojShPQ6MDEN3E5em3oRH71o5kVEHWoGSZ/2dSwtPQybK+smJz6LJi XvL3E8r8oONCL3Rp/FhKJXC8uBOGUq1WcAaSPwn1o= Subject: Re: Commit 282d8998e997 (srcu: Prevent expedited GPs and blocking readers from consuming CPU) cause qemu boot slow To: Neeraj Upadhyay , Shameerali Kolothum Thodi , "paulmck@kernel.org" Cc: Paolo Bonzini , Zhangfei Gao , "linux-kernel@vger.kernel.org" , "rcu@vger.kernel.org" , Lai Jiangshan , Josh Triplett , Mathieu Desnoyers , Matthew Wilcox , "mtosatti@redhat.com" , Auger Eric , "chenxiang (M)" References: <20220612162029.GR1790663@paulmck-ThinkPad-P17-Gen-1> <20220612164002.GA1242564@paulmck-ThinkPad-P17-Gen-1> <560f7d27-fe38-0db9-834a-50dda5fa6157@redhat.com> <20220612184944.GU1790663@paulmck-ThinkPad-P17-Gen-1> <20220613035711.GY1790663@paulmck-ThinkPad-P17-Gen-1> <20220613041652.GA3976000@paulmck-ThinkPad-P17-Gen-1> <20220613121831.GA1790663@paulmck-ThinkPad-P17-Gen-1> <20220613145900.GC1790663@paulmck-ThinkPad-P17-Gen-1> <7b6c983b21d44119b61716a66de397ed@huawei.com> From: "zhangfei.gao@foxmail.com" X-OQ-MSGID: Date: Tue, 14 Jun 2022 22:03:35 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_MUA_MOZILLA, FREEMAIL_FROM,HELO_DYNAMIC_IPADDR,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 2022/6/14 下午8:19, Neeraj Upadhyay wrote: > >> >> 5.18-rc4 based               ~8sec >> >> 5.19-rc1                     ~2m43sec >> >> 5.19-rc1+fix1                 ~19sec >> >> 5.19-rc1-fix2                 ~19sec >> > > If you try below diff on top of either 5.19-rc1+fix1 or 5.19-rc1-fix2 > ; does it show any difference in boot time? > > --- a/kernel/rcu/srcutree.c > +++ b/kernel/rcu/srcutree.c > @@ -706,7 +706,7 @@ static void srcu_schedule_cbs_snp(struct > srcu_struct *ssp, struct srcu_node *snp >   */ >  static void srcu_gp_end(struct srcu_struct *ssp) >  { > -       unsigned long cbdelay; > +       unsigned long cbdelay = 1; >         bool cbs; >         bool last_lvl; >         int cpu; > @@ -726,7 +726,9 @@ static void srcu_gp_end(struct srcu_struct *ssp) >         spin_lock_irq_rcu_node(ssp); >         idx = rcu_seq_state(ssp->srcu_gp_seq); >         WARN_ON_ONCE(idx != SRCU_STATE_SCAN2); > -       cbdelay = !!srcu_get_delay(ssp); > +       if (ULONG_CMP_LT(READ_ONCE(ssp->srcu_gp_seq), > READ_ONCE(ssp->srcu_gp_seq_needed_exp))) > +               cbdelay = 0; > + >         WRITE_ONCE(ssp->srcu_last_gp_end, ktime_get_mono_fast_ns()); > Test here: qemu: https://github.com/qemu/qemu/tree/stable-6.1 kernel: https://github.com/Linaro/linux-kernel-uadk/tree/uacce-devel-5.19-srcu-test (in case test patch not clear, push in git tree) Hardware: aarch64 1. 5.18-rc6 real    0m8.402s user    0m3.015s sys     0m1.102s 2. 5.19-rc1 real    2m41.433s user    0m3.097s sys     0m1.177s 3. 5.19-rc1 + fix1 from Paul real    2m43.404s user    0m2.880s sys     0m1.214s 4. 5.19-rc1 + fix2: fix1 + Remove "if (!jbase)" block real    0m15.262s user    0m3.003s sys     0m1.033s When build kernel in the meantime, load time become longer. 5. 5.19-rc1 + fix3: fix1 + SRCU_MAX_NODELAY_PHASE 1000000 real    0m15.215s user    0m2.942s sys    0m1.172s 6. 5.19-rc1 + fix4: fix1 + Neeraj's change of srcu_gp_end  real    1m23.936s user    0m2.969s sys    0m1.181s More test details: https://docs.qq.com/doc/DRXdKalFPTVlUbFN5 Thanks