Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp294009pxt; Wed, 4 Aug 2021 23:15:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+9MPDw1KYMA32Tgz/hzTekhFqUx6RQ0pi+kJEdTCJXfVLLWio5Ym/zCmuBUXAT2kIxvlW X-Received: by 2002:aa7:de04:: with SMTP id h4mr4411286edv.183.1628144110008; Wed, 04 Aug 2021 23:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628144110; cv=none; d=google.com; s=arc-20160816; b=GgO3y5FSNq1VusiPD2AC9F5oFKsqPihMTLYfcMojX7cWQmgKl2UNkUND+pzZhrac0Y rr7lgyIDHS7GpJWPVbgsiLh4Hq50yLj0PRdnm7RcnvYTti3NK3u2RDKmwESWUcz8m9xw p9TIrU9EQg5ROPg8C0Rx2SIVgsoDW9WSMkR3CBJKBRf4Uo3LQEAN93ucv8Z/9qaEazY1 7ZyhJDGPzYHiVIYlQVFOvjxQx8fXoj3u7oCSZZOYtfBxrrw8aVko+5fArkhgeW4ZhO7y s7vni4AXDdHhGusWiRe82zheD9bK1mDelvuF79XnwbjVZOzMJQiLyoSk+vIe7azRZ3Nb LQrQ== 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=h4hQROdTL9ByS4Y83ZO4jIQl0LMrzAiZfFBGE35I6XU=; b=G4iIH3GMc37ASkM4qfT6e/G9EHu2k4Zs+jjDAGZGw4r2AAfPDGROxPhgtwNbT8Hfp1 +rYJMWjudwzuh/QDZ0nm6nblbQEpD6kpqhciOFmA0tz47JavEmJ8LKBJ0Ri+QD6wnAFa N5oMcG2wQr5+YeD9f9nrL8uwfWigaWOmY8rzkejkMFTKX/L2zqvsQhj8VrxWZhtiRuOy WwCsfzb3yzHuq6t3eC9ZSVX4iFzCXvwtOl0nJgzwFLJ6lgJcxXglQMrOedhSTr5PkvyK uKApw+ipB5GrF1baG10/flqnuAOfl2h3HMkA8uEgk0nVKlzWdYBl52VzRWiUPNhXyYtj T64Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aXE14yec; 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 e12si4386233ejk.703.2021.08.04.23.14.46; Wed, 04 Aug 2021 23:15:09 -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=aXE14yec; 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 S234583AbhHDWxr (ORCPT + 99 others); Wed, 4 Aug 2021 18:53:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbhHDWxp (ORCPT ); Wed, 4 Aug 2021 18:53:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85CF860C41; Wed, 4 Aug 2021 22:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628117612; bh=ev4UpvDYu8mIq8C3cYDsqXhIp/L+bKQKL2Gw0rAfHT4=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=aXE14yecsD+xHGwyDq5U01Db/6hJ60InuTSGgdOkfFA1JTHSydwLoeoIhy8AJJW30 dEmooEFSXDADjwkrSiCpDlYwCefhLxTJE5SAgAy2LUSzm1V9hyfD+qzNOA8V+K70kA nM37EW4iYBfxOI0SOR5uV1LOiuXRDyEy9bu23Nb86S6e5G8zWqW4LQe5kRjm5xs2r5 JEPEvbDol27Lt+jJt+DWZotzX0qARMdRtsgPjoEQ0FZu336tyZnIMlrmSrw8L/vZFF Gjqy63LGFcxaYuFcQ1SnviwEn9ZGFPJwKJhVSY5rLN54FS3Dak/+fKFR/oQ7duvyQq FJADt02L0rFIg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 55B745C22D9; Wed, 4 Aug 2021 15:53:32 -0700 (PDT) Date: Wed, 4 Aug 2021 15:53:32 -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: <20210804225332.GB4397@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> <20210803234231.GW4397@paulmck-ThinkPad-P17-Gen-1> <87tuk5a4yk.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tuk5a4yk.mognet@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 04, 2021 at 11:18:11AM +0100, Valentin Schneider wrote: > On 03/08/21 16:42, Paul E. McKenney wrote: > > On Tue, Aug 03, 2021 at 11:54:37PM +0100, Valentin Schneider wrote: > >> 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? > > > > Hm so v5.13-rt1 has this commit: > > 5e59fba573e6 ("rcutorture: Fix testing of RCU priority boosting") > > which gates RCU boost torture testing under CONFIG_PREEMPT_RT. Now, AFAICT > the TIMER_SOFTIRQ priority problem is there regardless of > CONFIG_PREEMPT_RT, so this patch would (should?) make sense even on > !CONFIG_PREEMPT_RT. What rcutorture scenario TREE03 does is to boot with tree.use_softirq=0 and threadirqs. I see your point about timers and softirq, but this does run reliably for me. Ah, I see why. Commit ea6d962e80b6 ("rcutorture: Judge RCU priority boosting on grace periods, not callbacks") includes boosting the priority of the ksoftirqd kthreads. But only when running rcutorture builtin, not as a module. Here is the code in rcu_torture_init(): // Testing RCU priority boosting requires rcutorture do // some serious abuse. Counter this by running ksoftirqd // at higher priority. if (IS_BUILTIN(CONFIG_RCU_TORTURE_TEST)) { for_each_online_cpu(cpu) { struct sched_param sp; struct task_struct *t; t = per_cpu(ksoftirqd, cpu); WARN_ON_ONCE(!t); sp.sched_priority = 2; sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); } } I take it that you were running rcutorture as a module? This describes how to run it built-in, if that works for you: https://paulmck.livejournal.com/61432.html More specifically: https://paulmck.livejournal.com/57769.html Alternatively, the "IS_BUILTIN(CONFIG_RCU_TORTURE_TEST)" check could be removed in the above code, and the ksoftirqd kthreads could have their original priority restored in rcu_torture_cleanup(). Thoughts? 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 > >>