Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4018271imw; Mon, 18 Jul 2022 20:07:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLcY8k8NagAoCRkrPStLK/xCOT4J8O64p9yM4nMqhV3tXaabuLuX4pauq35D6cjzG0UWif X-Received: by 2002:a17:907:87b0:b0:72f:11fc:86c1 with SMTP id qv48-20020a17090787b000b0072f11fc86c1mr13529883ejc.449.1658200064827; Mon, 18 Jul 2022 20:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658200064; cv=none; d=google.com; s=arc-20160816; b=ml3ICL8iAH7vjjVEMvx7egTPIvEJIhn4YAzzNIqJ6xu/vatCfnXDt9xDLLSetz49Fy g2btVHH0shIlqDsqMXDQFmr/nsW5l7umIIEa7x4bqAyBD5HFjX5LT5tKO9eSSuLt2xpq tO7SZuQKCEPbG0mRxObOnsRboSiCWvA26ikmnhw5stutzVEGDlQnwx1XwneJL0gX/n6y 5aFfiQ6jrSjTbWTEYb6ISsFaGSWWmuRk2Nk5Ij2kYBWgm/DTMtNwKLRFnVXoMG0wK7jx Ypbe8ue4HnxuNw/QKPaCkHp81dQA7AFcIlGsQshE6UaYVYfeoXYRh+PpxmrTjYRcRIBw pTPQ== 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=N2Lv/JumebX4lTUgzv9qG/R/TdeSlXPCTD8pzey9zIo=; b=d8uNgZJ18UCtKIwybTsDTF/wz3kyG/+/paN3bU1HG0kwhbqJ3xHB1Q5pgf243qXCxr Rc+xiqZXNyByxAB3LAySvMTtlYjfLOBX85QnP/kaoGUiTxObVdaj98OBJyjRvkj+WUKh 4D3sIBpU+ST+PkGoQsOsSaYYetLCykZSMro/6cwdybYO8i28YAz/FbggwKbPiPeUs3so PtPtn/5gLNt+vA9X+JtotR9fMdJ8tTpGSV8A6of9kTpkrucksoUS8WZLA72zWpEiMqV7 bKTFQsnS7gLAQHL8WxT6FY9KlXZO/G2hm3oavTURhYavBPgE4tlLxBD+y/Sx1I/zbc+r HihA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Lm/wMDLE"; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds4-20020a170907724400b00718bf486a1csi4790194ejc.782.2022.07.18.20.07.20; Mon, 18 Jul 2022 20:07:44 -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=@intel.com header.s=Intel header.b="Lm/wMDLE"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236766AbiGSCKY (ORCPT + 99 others); Mon, 18 Jul 2022 22:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236622AbiGSCKX (ORCPT ); Mon, 18 Jul 2022 22:10:23 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF3CF2A97F; Mon, 18 Jul 2022 19:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658196622; x=1689732622; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HuWT1Qbmsp6FL1I6szP12YNCNY1tyhftj3GbBMYoxiE=; b=Lm/wMDLEXuYrBVUYPNIcTpk0SxRKKzKCOSTEJpnLhRctHlyd+n8/dzyI D4cNH0XM6aiQ6cyoKGApqoRXHu5Pffqlhw71MjwABs9BIjf8dmCFRH9uO 0J5zY6zf5RGIxD5L713tDqLo4oCtPJ322+PlPNQFYFibxF54Mb6OS6fMW QEjplEfwFu2iv/8Ii5MN95e+v2TeKzF08g1nNaiS3EEzuGbpmVZmKKkj3 qTZNVudKpljaNADXcqwIPBiNZp1OyAnLKAPOgKwSGNdA7bqLYvc2kiGT5 0dDQpZ+Bw0N7QNEET36lJ2Tk9Kza0sC1uiDHMDZt8jXd68/Ublls6J0FD w==; X-IronPort-AV: E=McAfee;i="6400,9594,10412"; a="266143902" X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="266143902" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 19:10:22 -0700 X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="655536034" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 19:10:20 -0700 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org, quic_neeraju@quicinc.com, joel@joelfernandes.org Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] rcu-tasks: Make RCU Tasks Trace checking for userspace execution Date: Tue, 19 Jul 2022 10:15:13 +0800 Message-Id: <20220719021513.432306-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=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE 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 For RCU tasks trace, the userspace execution is also a valid quiescent state, when scheduling-clock interrupt handler interrupts the task is in userspace. if the ->trc_reader_nesting is zero, and the ->trc_reader_special.b.need_qs is not set, set the tasks ->trc_reader_special.b.need_qs is TRC_NEED_QS_CHECKED, this cause grace-period kthread remove it from holdout list if it remains here. If the ->trc_reader_nesting is not zero(if one of the functions in the scheduling-clock interrupt handler were traced/instrumented), and starts a new RCU tasks trace grace period, when grace period kthread scan running tasks on each CPU, this running uasks will be inserted into hold list. This commit add rcu_tasks_trace_qs() to rcu_flavor_sched_clock_irq() when the kernel built with no PREEMPT_RCU. Signed-off-by: Zqiang --- v1->v2: Fix build error due to undeclared rcu_tasks_trace_qs(), note in no-PREEMPT_RCU kernel, the RCU Tasks is replaced by RCU, so rcu_note_voluntary_context_switch() only include rcu_tasks_trace_qs(). v2->v3: Modify commit information. 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 4152816dd29f..5fb0b2dd24fd 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -976,7 +976,7 @@ static void rcu_flavor_sched_clock_irq(int user) * neither access nor modify, at least not while the * corresponding CPU is online. */ - + rcu_note_voluntary_context_switch(current); rcu_qs(); } } -- 2.25.1