Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2837679pxy; Tue, 3 Aug 2021 17:09:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzewY8UO79UGRwKlbxo8qOekQcHNhXm50olN83OKpHiUtdWfrC/pfb4P6Nc7ZWk1DPpQrmZ X-Received: by 2002:a17:906:1ccf:: with SMTP id i15mr23335126ejh.120.1628035752921; Tue, 03 Aug 2021 17:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628035752; cv=none; d=google.com; s=arc-20160816; b=UWVL/XwEqlLEqL+tDBGMUPnXQWTKcAB0dC9XPGZJJndZjwf+GHcpKGDp+C/vu4v6Sk NE+gdnCgW0Al0q4Qt5sqtjnzQru3SxSQW1e8WBaFZAzE/0Q9qAr5aGzimoospzPSDuA7 jjVGtmfCtRJGFk288DszEt9uNNra9h9cBPKuqW1QNlS1rOCDu2Pdzmp0aOKDws1kJ/SS 9lGXEevlXKzJjuS0/Hv31m/hS+2rON3loGja+bNsvOqvqIfvJmbqCDc7ksxrsn6PvbuH vYs1784HpJY331pikdrBLD8/TFf7L0soE4mw3VfjM7YO6T5G1kExH+D680F86olV5qvM Mq2Q== 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=O0m47Ct2O5oW9DMyGZH3m1/z9d15WpVd8RQa9c+n8y4=; b=imDj5UeRSByn/MSDQKp3s1z+/73CZOe6avF7oVk60S89lxvKFjrnboJka3eR1PiHWz dDuptbYmhhGscGOpX8+sTUfSdJ0DNE038+i2DAehrhXDX36uP/ndTuHRGdfVClaXofX+ veheqaD+BPvto0KCCzt08ytFcoFg/944hiHV++iDxCXbzUHfizI6QsffVZ4g1u1NdkuK qhPeVipCEEcnrhQu1IVXIeulVIXI+8hdfItW3w7VEEPW1cNMNSRJ+VdZMZ1pIXwrzYFw lpkkFhAWOl7ZGbIeu9Ynos61sumamxH1rVcQGCzZoTNe1u/QFchxtMooGKFfi5Odkb9B SFXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="NOzG/WI3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si389282eji.44.2021.08.03.17.08.48; Tue, 03 Aug 2021 17:09:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="NOzG/WI3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233295AbhHCXmn (ORCPT + 99 others); Tue, 3 Aug 2021 19:42:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:42834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232296AbhHCXmm (ORCPT ); Tue, 3 Aug 2021 19:42:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B78B61037; Tue, 3 Aug 2021 23:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628034151; bh=Gyk5iVPK76bq7kpepchQcuoWh5YN1ChOAdrgEXiJG5E=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=NOzG/WI38BgVvSVx/LB+2aJ1wpdVTMLNoLu6SijXdHwEEU2VYRD7/Tvrm1TeZbLFN 8goBwBz0fsv14zYbsVDgD8gMOmGRnsacguEXc/EJpqbTtNORAMSKKHvtW+2JviEf6x gi/BQ3kBk9kmI0O2I9IuEWv0JfR/H6SR7xdLtKdLQm0+Lq654LsTJL3BQLO7ydV88E qwE2CRQpzYcWc0KBVlb6i7nQkc1Rl5sQSyHC0D/neGmZIPaH2sALgrAdesFuPUDHAs IAga1054P5Fwu9tWxhxccAavPUrhSPARo5qq1b42wQlI67y6W+sjZAz5gRzhsAEj0V aXw9Z0uZB8SLg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 12C0E5C04D4; Tue, 3 Aug 2021 16:42:31 -0700 (PDT) Date: Tue, 3 Aug 2021 16:42:31 -0700 From: "Paul E. McKenney" To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-rt-users@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Steven Rostedt , Daniel Bristot de Oliveira , Frederic Weisbecker , Josh Triplett , Davidlohr Bueso , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes Subject: Re: [PATCH 2/2] rcutorture: Nudge ksoftirqd priority for RCU boost testing Message-ID: <20210803234231.GW4397@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20210803225437.3612591-1-valentin.schneider@arm.com> <20210803225437.3612591-3-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210803225437.3612591-3-valentin.schneider@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 03, 2021 at 11:54:37PM +0100, Valentin Schneider wrote: > As pointed out by commit 5e59fba573e6 ("rcutorture: Fix testing of RCU > priority boosting"), timer expiry needs to run at a priority higher than > that of the rcu_torture_boost threads (FIFO1) for RCU boost testing to > function. If that's not the case, the rcu_torture_boost threads will > prevent the wakeup of the RCU grace-period kthread, which means no boosting > will be initiated. > > Instead of setting this up manually, check the priority of ksoftirqd before > starting the RCU boost test and nudge if required. > > Note that this does not attempt to save and restore the scheduler > parameters of ksoftirqd. > > Signed-off-by: Valentin Schneider > --- > kernel/rcu/rcutorture.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > index 680f66b65f14..3dd5fa75f469 100644 > --- a/kernel/rcu/rcutorture.c > +++ b/kernel/rcu/rcutorture.c > @@ -948,12 +948,26 @@ static int rcu_torture_boost(void *arg) > unsigned long endtime; > unsigned long oldstarttime; > struct rcu_boost_inflight rbi = { .inflight = 0 }; > + struct task_struct *ksoftirqd = this_cpu_ksoftirqd(); > > VERBOSE_TOROUT_STRING("rcu_torture_boost started"); > > /* Set real-time priority. */ > sched_set_fifo_low(current); > > + /* > + * Boost testing requires TIMER_SOFTIRQ to run at a higher priority > + * than the CPU-hogging torture kthreads, otherwise said threads > + * will never let timer expiry for the RCU GP kthread happen, which will > + * prevent any boosting. > + */ > + if (current->normal_prio < ksoftirqd->normal_prio) { Would it make sense to add IS_ENABLED(CONFIG_PREEMPT_RT) to the above condition? Thanx, Paul > + struct sched_param sp = { .sched_priority = 2 }; > + > + pr_alert("%s(): Adjusting %s priority\n", __func__, ksoftirqd->comm); > + sched_setscheduler_nocheck(ksoftirqd, SCHED_FIFO, &sp); > + } > + > init_rcu_head_on_stack(&rbi.rcu); > /* Each pass through the following loop does one boost-test cycle. */ > do { > -- > 2.25.1 >