Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1562798iog; Tue, 14 Jun 2022 08:27:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnItwDvICHd/uor5Y3vcFg8S4RHfPXOTVMjX4WheHOtSsapnm6LChoTETuWRg9RlYDiGqr X-Received: by 2002:a63:2b87:0:b0:3fd:31d6:6a0e with SMTP id r129-20020a632b87000000b003fd31d66a0emr5033341pgr.488.1655220457781; Tue, 14 Jun 2022 08:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655220457; cv=none; d=google.com; s=arc-20160816; b=P5OaEwv1xBhEigatLH21KpZ1CHd3xvPp6oNEnAc5uQM2w8Ugixw++Lr/FPdA4Q7vyI 1/RxJVqXuP6Qco3XhME2zhFeGlZrRh1pYv7Cc9YYWQQ67wHdup67/DktFFJjRQE0TsSM GC+6H1Dca7cY1k0xn/WDQXCwKxsCEB/LDjs5AcwnQj0zyYBQeGB7TUxVcsLZp0o/Ofn3 e8yw3s3IGICsCL97NxKR/IIzdaCjRS9U4T1LBik6p8vH+mbk5NyR0ngqrv5YOUa2Lk55 WxX+2i4PpLCISzlkZSE/8V6VJ4jd7WqED77Syc5bkNK5bxYCjeRw/aR/PdlFIOrEccDu ccNQ== 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=0nMDlZXludiskWCOiMWtnzWVfpu4/zibgioslu+JbyY=; b=TCoIU/lbyJ+uERcBOB78f7qOCO/9pb81JhC+mlvrMA2qI6eFwNOlqaMgjQLqIgygzj 8CDGWnlb6/ZHcfyW2csHnWcutY23AZPcZ+W6n0T82YT2/tbTosnfLReH5Lwvg5AtUmRw 1sEi74PFqBTQ/2hqWDlvm+F8qJgYmllOGrzLveTP5hHLjvJGnBx9RbkMrl8/djXJnjjC salgoGLWc9YgUdEsMYVj3dHJV6QU9fM5I1Pg7Ti0vm3yT3U7WiLfamySlmV2MglQ+SkO fRkB6X4/zUQMGeTUhE2daAZYdV312hGcJyXeBorTkqacX4WcAfl2mtRw6OO7svIvBytm Q9bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=YNBwxdHz; 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 e17-20020a17090a4a1100b001e2d210b8ecsi12412670pjh.188.2022.06.14.08.27.25; Tue, 14 Jun 2022 08:27:37 -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=YNBwxdHz; 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 S1344013AbiFNO5W (ORCPT + 99 others); Tue, 14 Jun 2022 10:57:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343980AbiFNO5T (ORCPT ); Tue, 14 Jun 2022 10:57:19 -0400 Received: from out203-205-221-149.mail.qq.com (out203-205-221-149.mail.qq.com [203.205.221.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15E6D3E0E7; Tue, 14 Jun 2022 07:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1655218630; bh=0nMDlZXludiskWCOiMWtnzWVfpu4/zibgioslu+JbyY=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=YNBwxdHzuzdTX/OIUg4HV+18F9zmLPzXaDTfO1cjPeEhtvUz/wuMKMRtrZ2qFHGCR DfMYaQN9m+dVrn+YuYgceL1bqVfn+k4ZRLs8lUezEdMbVyMymD/6lt3ko1tYvzkeN3 BQAyhdUmq63yYGmaqBUY9oBuRY8BJ+7n0FqmeZYU= 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 E450B89D; Tue, 14 Jun 2022 22:57:05 +0800 X-QQ-mid: xmsmtpt1655218625tl6pwbbf4 Message-ID: X-QQ-XMAILINFO: OUMxvQDaATieMiUh2n1Avjefg+SQ93TNwb1l/F2hnTg4Ml5WECC3al920hN2AY 6lCMLqVBow5EJUY6IUb+bc6X00dQTkH/N4h9VJtup0lic3QrY9Al2BsezpW08U7MjNGm3sq90D4G FzoJ7c02+Q9qP59HNR8v3devgfoPCBKh7PmUnfl5aYugxR8bdZhpGWe5gS7eaKJiDFd/zD5l81p8 kyXmuJTyDJ1OALHi+pxiw9qzQeG3DH2D3DJDsDNHOzkLVyNrudebe3odKmb5yYKLywxx8hhaq6Sy A6vJDPKXbmv7EgBajLU5FGBWBEoWQdia+ISEEYWQ0GAZr0/P3XPZZjAQyK1W28cBHDJVt2MlFzgq 36tEyjJ3IgyIfQ3u3Tpmb1py/jNFSnrVwsJgwTw9BmK8YOep5ne7ld93R9jwi6JRX5vtK/tu1edL FV/yb+WhEDndnefb7SE3jQUqrjZRbW5zQLT8OEaPr+dbTkHhYoTlqtjMFgB9icjUFN4YeBeS8Qbh RggQTze26wmqfRhoShejpVmU1RP1ERZa+23Bfx3pKH9Cm2z8m6XB4cndw6WH2YsZlspoA1mYV1Ae +QrtHE7O2jqEnsQvrUQLBAbmUUcQg5+dqNRVTtjnbnBd3TkARE+kRZyfUdWIknJUpm9UQr3/AQLM ZnjelpOEBmN9rcfAv9dLmNhhF1/aUAjhmCO0Am7BP9X1cqj2mx2Hs7V3WVxLFBxWbT0znOzcwbLa Q27vBRWR+eQ/Xo2CcgxBGJHBDGrEm3Iq2yX9g0jEjulE1Ohs3l5z3WJwMXpeY6uNzGB4FV+mUT/V gbheBy61kBJw83FsvS9qTrSmJU6HCCz3dqwtpoteKA7IuXTGdDLKa+HTVWWZGOKNvB3ljBbBw2x6 f2JXU3cBGQEa0dWrjKBxWpy+shp9wEMWw97UVPHFhBRBEpPXwG4tyHD83FPSxxCypNFgO4d/P+rI g9NtCk3Vu7pIHoJjsim6COyE1ZWhpkQdA5//LP9DKzZNXkFQ1tHMhXMCMTBStlOiz7gpMPjRM= 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> <88780123-32a3-ab34-cd3d-01e4a3421f03@quicinc.com> From: "zhangfei.gao@foxmail.com" X-OQ-MSGID: Date: Tue, 14 Jun 2022 22:57:04 +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: <88780123-32a3-ab34-cd3d-01e4a3421f03@quicinc.com> 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 下午10:14, Neeraj Upadhyay wrote: > > > On 6/14/2022 7:33 PM, zhangfei.gao@foxmail.com wrote: >> >> >> 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 >> > 7. 5.19-rc1 + fix5: fix4 + Remove "if (!jbase)" block real 0m11.418s user 0m3.031s sys 0m1.067s 8. 5.19-rc1 + fix 6: fix4 + SRCU_MAX_NODELAY_PHASE 1000000 real 0m11.154s ~12s user 0m2.919s sys 0m1.064s Thanks > Thanks for this data. Can you please share below test combo also? > > 7. 5.19-rc1 + fix5: fix2 + Neeraj's change of srcu_gp_end > > > 8. 5.19-rc1 + fix6: fix3 + Neeraj's change of srcu_gp_end > > > Thanks > Neeraj > >> More test details: https://docs.qq.com/doc/DRXdKalFPTVlUbFN5 >> >> Thanks >>