Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3516591pxb; Mon, 4 Apr 2022 19:34:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZrqnjdeQuB99tJZ3EJ7GounhhcUTiekbAM//+gsOaIqYWVCtiUjyi/PhrpwZ/V1QQhsco X-Received: by 2002:a05:6a00:14c6:b0:4fb:3978:1020 with SMTP id w6-20020a056a0014c600b004fb39781020mr1147021pfu.36.1649126058053; Mon, 04 Apr 2022 19:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649126058; cv=none; d=google.com; s=arc-20160816; b=Ro1vtNzB2MOLdwjIaaV6qXMpWj+CFhMhqcoetXm3Af3Zf9zzfLu7qzZTf7AVt5ptk2 CygxF+CXzFvrspxZyMBa5TO13b/SzxRY3/X8E85XFK8+wy8gQhGyPIFO00SrzWLBn11o trU9T1CHps2RFB6BBG7fMwH9BG8nDCvgrsaDpzkR0cs0Zbh+EM6LH/vq22Nu/nwC8r+B cXD4dkcohTH9Jibe7yZwe2ZgO+a70fpJ4gHlswNQndgHA7bVHQsxS4aokRvaHq+FoF5k 68XAl6Yrxdm1sXRsp4ZLShDcxeoI1iT+cncqHJPRu4kchEslIgTBILENHwudObWCkW1G zi5w== 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=+gKmRh0WqYIfSxlv45ybNmn0Q0EpBdXFBvjPctZgwzM=; b=wt0Wdtrf9dG81RUkjjy7LkNjStA6/nBGSZKsBHQX1buSPNmQS4LFAgwpbWi+IDY43F 8dBP4VaW6snOEDX1uk+/xmH0rkdVcGTydkK6BGhdY5OI6ST1ZVXDqHlWwMtevTKFinDk wAcBsz4p+r1xNgrm/W/P7WrJrLnFmr4W/3Jhdf/4tfAXZquQxVeG0EPO6rAv6rAKcSUn HSoTqxpuGu3geNzqVCOO977oIfpD2Y8NnbCo7O1BV7+SkTKGBCirnYXS/5p9neQon14Y uVm9P/asRpwPOM94XRqQEJCLmMh0TMbpr5azaGT/nvvFhWV83T7lAHoSNQJKfe/BV8fr qEMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CS+s8AcA; 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 e17-20020a056a001a9100b004faac3a73f6si11265990pfv.79.2022.04.04.19.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:34:18 -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=CS+s8AcA; 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 93C333AB8A1; Mon, 4 Apr 2022 17:58:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348146AbiDCPsg (ORCPT + 99 others); Sun, 3 Apr 2022 11:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359367AbiDCPsY (ORCPT ); Sun, 3 Apr 2022 11:48:24 -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 E1D61326FA; Sun, 3 Apr 2022 08:46:29 -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 8B923B80D59; Sun, 3 Apr 2022 15:46:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05D6EC340ED; Sun, 3 Apr 2022 15:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649000787; bh=AjbUxfWQZJ9LYtaZniXFzkk6R9dJGhR3P9jE0QaU830=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=CS+s8AcA46FV07MxUpkF1gm4zEp8aFD09GumCLkzkZZbsCM7faRoRPXNulXM9F1dB rJSj62/xWhZbDVZ9RxK5UsSQrQUTQla7JRatMCJnJA+TTJSiaY8XxxtfJ6pSufhY1Q iNO1niut5f2NPYoEdhZF61FsMY0drUJwDz0ExNRGsr3g7E1bj44lpM0njvsSrczIPY /ogzxg9Gt7SycUxE5/jQoAIKpDOkkBz5gN6w+8gc7avNf8dHM74yWWgVj/8JpneTRb idC1OnfcNHyUONGAjbIWweQ0v0+NOnY7MKxiNanIyEtmhtQWezbGH7zXWS0TTrIraB hlyTsP6G8lzUg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 805B25C0555; Sun, 3 Apr 2022 08:46:26 -0700 (PDT) Date: Sun, 3 Apr 2022 08:46:26 -0700 From: "Paul E. McKenney" To: Zqiang Cc: frederic@kernel.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: Use IRQ_WORK_INIT_HARD() to initialize defer_qs_iw on PREEMPT_RT kernel Message-ID: <20220403154626.GO4285@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220403061440.2762522-1-qiang1.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220403061440.2762522-1-qiang1.zhang@intel.com> X-Spam-Status: No, score=-2.3 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 autolearn=unavailable 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 Sun, Apr 03, 2022 at 02:14:40PM +0800, Zqiang wrote: > On non-PREEMPT_RT kernel, the init_irq_work() make the defer_qs_iw irq-work > execute in interrupt context. however, on PREEMPT_RT kernel, the > init_irq_work() make defer_qs_iq irq-work execute in rt-fifo irq_work > kthreads. when system booting, and the CONFIG_RCU_STRICT_GRACE_PERIOD > is enabled, there are a lot of defer_qs_iw irq-work to be processed > in rt-fifo irq_work kthreads, it occupies boot CPU for long time and > cause other kthread cannot get the boot CPU, the boot process occurs > hang. use IRQ_WORK_INIT_HARD() to initialize defer_qs_iw irq-work, can > ensure the defer_qs_iw irq-work always execute in interrupt context, > whether PREEMPT_RT or non PREEMPT_RT kernel. This is a much better justification of the need for a change, thank you! But it looks like I need to clarify a sentence in my previous email. Please note that you were using the debugging RCU_STRICT_GRACE_PERIOD Kconfig option, so this is a potential problem as opposed to an immediate bug. Yes, we must fix bugs, but it is also very important to avoid harming other workloads, which are after all the vast majority of the uses of the Linux kernel. And a major purpose of things like RCU_STRICT_GRACE_PERIOD is to give us advanced warning of bugs so that we can fix them properly, without hurting other workloads. So, does this patch guarantee exactly the same performance and scalability as before for !PREEMPT_RT systems? If so, please add an explanation to the commit log. Otherwise, please adjust the code to provide this guarantee. Thanx, Paul > Signed-off-by: Zqiang > --- > kernel/rcu/tree_plugin.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h > index 3037c2536e1f..cf7bd28af8ef 100644 > --- a/kernel/rcu/tree_plugin.h > +++ b/kernel/rcu/tree_plugin.h > @@ -661,7 +661,7 @@ static void rcu_read_unlock_special(struct task_struct *t) > expboost && !rdp->defer_qs_iw_pending && cpu_online(rdp->cpu)) { > // Get scheduler to re-evaluate and call hooks. > // If !IRQ_WORK, FQS scan will eventually IPI. > - init_irq_work(&rdp->defer_qs_iw, rcu_preempt_deferred_qs_handler); > + rdp->defer_qs_iw = IRQ_WORK_INIT_HARD(rcu_preempt_deferred_qs_handler); > rdp->defer_qs_iw_pending = true; > irq_work_queue_on(&rdp->defer_qs_iw, rdp->cpu); > } > -- > 2.25.1 >