Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2801089pxy; Tue, 3 Aug 2021 15:56:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKTUJZkqUFCfV20YPASn/nCb/PeCbfjvwFyB8gIWKQ/GBaKJ7CuFQpr1tz/Ozq4u5j0Wf8 X-Received: by 2002:a05:6e02:2162:: with SMTP id s2mr200392ilv.99.1628031404835; Tue, 03 Aug 2021 15:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628031404; cv=none; d=google.com; s=arc-20160816; b=EE4cwiQVpqBGjeGwZMiO4YRwjLUtN2whRvhGmVpYj5SZSOKUD+u3Hx6oRV/aVAbhUc Jq/pA9DTWZ2YvdMBUhBzjuTCMyy+5Htfv7dTpkCtGF7f/fMHh6sViPNv6CvFux3I26D/ Gltm50x6oPJEp9q+Nv1FiqUHRBvFNnw8lpFMdBOp/fk8kohmw2UjOp2vmWvKIfQSZFRs 3o3auDZyjo+fYz2336Paehc991+SSFP6M2MPHWxP++oPAXghs3f9GCgrFo/CczTrOfFF uXUlrI8qSnCv2bbKENoclJNU7ZOXxYZdVpmV7Wajer3AVNFqN51DsTiqqSzM+rNNVwEx h7yA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fUrrBW1ATfyDZJueKfDF/xJa00xwLnlOKZgtLXuCYh4=; b=TfgkSnfwsWO5clpGATFslOpNcAT/IHc6+RNpHhPaXOAEZsTbcUJp12UuXN12m9Ntqq 97+dDYDx4WwgDGjb8K7RtgfSrzUk/qSWybk6EzmXG6sFgVwhAWwtCFJWosVq6eznGCn7 fBvJMF+lwhZoeueOrGgRSuc3M0c/LsiGdtK+wDWMak+R0UzYmYOmU0npNSCMRp7Pzo0q C9d5SbhH3dUFzO01L2PO0fB7mvfH6uHZjpIW5laOSlGkO2nIBJsd7JNedqcalAeQ2ApU fnHJ80u8wBYRbQfxBGzEM5hpv0kCMkVvIGQJDJdaBk1LyXZDPcAVgy2H1O0gwtsQZoNW qySw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x4si335491ilh.33.2021.08.03.15.56.32; Tue, 03 Aug 2021 15:56:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232174AbhHCWzG (ORCPT + 99 others); Tue, 3 Aug 2021 18:55:06 -0400 Received: from foss.arm.com ([217.140.110.172]:54960 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232088AbhHCWzG (ORCPT ); Tue, 3 Aug 2021 18:55:06 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43627143B; Tue, 3 Aug 2021 15:54:54 -0700 (PDT) Received: from e113632-lin.cambridge.arm.com (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 480743F66F; Tue, 3 Aug 2021 15:54:52 -0700 (PDT) From: Valentin Schneider To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-rt-users@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Steven Rostedt , Daniel Bristot de Oliveira , Frederic Weisbecker , "Paul E. McKenney" , Josh Triplett , Davidlohr Bueso , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes Subject: [PATCH 2/2] rcutorture: Nudge ksoftirqd priority for RCU boost testing Date: Tue, 3 Aug 2021 23:54:37 +0100 Message-Id: <20210803225437.3612591-3-valentin.schneider@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210803225437.3612591-1-valentin.schneider@arm.com> References: <20210803225437.3612591-1-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { + 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