Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3428330pxb; Mon, 4 Apr 2022 16:41:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfQOBOUUHOM0E5FcsEkaaZXj0YgNuqBZ1hUDzFHXmsa/+4bLnL12zhr7eA+dj8YqJOMfIO X-Received: by 2002:a05:6a00:acf:b0:4e1:9222:1ef3 with SMTP id c15-20020a056a000acf00b004e192221ef3mr641707pfl.18.1649115700103; Mon, 04 Apr 2022 16:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649115700; cv=none; d=google.com; s=arc-20160816; b=Cz0PBSsffEVde8lvAkNN/2r+N1TniLGedHuHWsnd244tl+M3ME1Voc0Jkpz+4aIty8 rbMtOw2WiiouULI/iyD9X1pgo8XNXz9GnMi46APE41tGmcObBQkx/U5G8MtUhDsKrNKV I2h+yh0BygIaviRVWT5CsHfVwvwuu8iMoYZx5M7XyXfLTKodIsjkZHWN73//SitzTYdf SqOu2MqtfTYIb3G0ZQzkASKt/Poc0p/9M9bd4+72PvQVnrGiqD93DLS4Uuihv2RaPV+v vE1HjV9bJ1DiScYdJ/8ecG/0jL4FcKGhRuykI+gqkPn7WgT8DetZHv9PxIMzkLcpKvXF E9kA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=o7FNSbfjClh8VXsaCSOtZGe2y8j7SJv4HuEjkM8gQ0Y=; b=c7R25LCoNIwk+jp8xgKEX4IcuoY1AeWu8M1WsisS1dqZnQXxWD20vwH6yUzBmH+1rq 6gsnykkMoXSBC/NPSTu5Zl6Z8xR4A+iW29fKTtGmOHTS0qofRypN/gZCIpMxJ5TTH6GC yZ5FmuPV5RxomVpQVifMj4l/bZ+TPYx6TGiKLRMNL60Yp0jtbsrOHobwsO6C1KLQouSI YT67ZufjovxHOYi3+iDscQ9zR3pVAqOYYWIgzG5v2xheLXuyxsTtPlo2N/BhD0YG0LW7 VIsiLTqvlswFyqtL2YuS8ZX/1m+iy6Q3F3lBvwpIHOmlYFjRUBYqFgKqfIebDOiiDLyk wfRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ASnqxyaA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x6-20020a170902ec8600b00156b8b99c95si2699734plg.610.2022.04.04.16.41.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:41:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ASnqxyaA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9A56C54FBE; Mon, 4 Apr 2022 16:33:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356818AbiDDABC (ORCPT + 99 others); Sun, 3 Apr 2022 20:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233854AbiDDABA (ORCPT ); Sun, 3 Apr 2022 20:01:00 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B99449FC0; Sun, 3 Apr 2022 16:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649030345; x=1680566345; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Kac8s4R5kDi57PE6BTP55BKRS8viWkvdWgVR3Sffaco=; b=ASnqxyaAFherfoXPMV1lU4jf8Ox7ZolZNbGxvwM9Pw8pyqkHPkCRJ5b4 O+KsMOv/FB3HSuqheeBP1zpzMU6cvGyPhyJjpI/z1UwV5N+vEQrEUBRtB snkz0tSvfgFwnXDePjh+9FRJiIk/86sRhW8sWyR5JvyxT/c45Cyh9koy8 5U5QZjsoqmyoWKnpk3HSg2DbvrDQ3C2uOWUBVc9DfmeT964eW+N/a+8Un zNMxF0ebxfAG9XdwdjTy6h4PAYd3LTkOglH32FRmrLRlsM5uVNzb6x3W3 C9LOBnbh1439wz7v6skixARSNo95WvHCCJClGfpHfIanUXOrVQnuuu0n2 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10306"; a="257997173" X-IronPort-AV: E=Sophos;i="5.90,233,1643702400"; d="scan'208";a="257997173" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2022 16:59:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,233,1643702400"; d="scan'208";a="569106448" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2022 16:59:03 -0700 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] rcu: Make defer_qs_iw as hard irq-work under RT kernel with strict grace period configuration Date: Mon, 4 Apr 2022 07:59:32 +0800 Message-Id: <20220403235932.2864193-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 When the CONFIG_RCU_STRICT_GRACE_PERIOD is enabled, 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, 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 execute in interrupt context, under PREEMPT_RT kernel with the CONFIG_RCU_STRICT_GRACE_PERIOD is enabled. Signed-off-by: Zqiang --- v1->v2: Use IRQ_WORK_INIT_HARD initialize defer_qs_iw only under RT kernel with CONFIG_RCU_STRICT_GRACE_PERIOD is enabled. kernel/rcu/tree_plugin.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 3037c2536e1f..e6196a23793c 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -661,7 +661,13 @@ 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); + if (IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD) && + IS_ENABLED(CONFIG_PREEMPT_RT)) + rdp->defer_qs_iw = IRQ_WORK_INIT_HARD( + rcu_preempt_deferred_qs_handler); + else + init_irq_work(&rdp->defer_qs_iw, + rcu_preempt_deferred_qs_handler); rdp->defer_qs_iw_pending = true; irq_work_queue_on(&rdp->defer_qs_iw, rdp->cpu); } -- 2.25.1