Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2824474pxy; Tue, 3 Aug 2021 16:42:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrg9PY09kx/BDXO+YuEeWYoba9pNbxD++8r9kkYMNA25cv+Oa+DaCU1M6AHufcNvtaVzS+ X-Received: by 2002:a05:6402:42ce:: with SMTP id i14mr28733205edc.345.1628034162273; Tue, 03 Aug 2021 16:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628034162; cv=none; d=google.com; s=arc-20160816; b=th0gNv33rzVPUgie5iR6zry31RSw3e25o4NINCzy2uHgqHuAXFbLkK+rqA1M+NsAPB 1X/vtb6fa+zqXNYMe6IGvm/8vu/4Ckn728kBWHhvqEjr7mTby2gFRWEYKMmSZSaqzlZ2 /AKCcLV5GjJdutgV9Fjmrpi5Haq668sx2WRRFadmE7i5mce34lYHPJDGBEjpdb/lOwMG T0RDH0TR9b8MfFMbdT1SxHUS6mtLN/toVX3MxlZneIZcolGPlhyhIlb1B/Fu3toibmO8 Z1XfOvrPUNb4uLAhBkUo7DgKwvLc0Hn7xOOLMXOD/OdE/JYDLYYDvhMcthaTD7BMQVVm 2W1Q== 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=RCg1mpNVaPRPeHQMxw5Bcv51Fe//2N2+st7693tMo2Q=; b=fTIZ9dDJPMDLB7a3xEu8ezpHzLL8dMCsb5pavDXUjcvEdgzC+TFpETOmBK3xiwpxSO cg4PZBdBWKKGAyBo3JM6GuzsJjlqrfD9/CgMUqFOFLofCe39+UJL7Hg6LxuoMtAj1Myt 0K5Bx9JgSEUUFBhhZzfgStvhDtMk92CcOxxfRR/YMFRfQpWN/zZJnWg0ij3l9ljqTmIV PfNGWeov0mQLyiioKx894iWrbLjWhS2SGoEhND+VhJrRpe8y8ge17siZ2tcoc+FzjQvI yYCcye+NcDwCdaPc7OCkVgWHCTr2S03Vio5fmHLuBufBkbpks6z5ZUfYTyKrA+4EBhq4 w57g== 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 b10si416483edm.341.2021.08.03.16.42.16; Tue, 03 Aug 2021 16:42:42 -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 S231741AbhHCWzE (ORCPT + 99 others); Tue, 3 Aug 2021 18:55:04 -0400 Received: from foss.arm.com ([217.140.110.172]:54934 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbhHCWzD (ORCPT ); Tue, 3 Aug 2021 18:55:03 -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 1511413D5; Tue, 3 Aug 2021 15:54:52 -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 185853F66F; Tue, 3 Aug 2021 15:54:49 -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 1/2] rcutorture: Don't disable softirqs with preemption disabled when PREEMPT_RT Date: Tue, 3 Aug 2021 23:54:36 +0100 Message-Id: <20210803225437.3612591-2-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 Running RCU torture with CONFIG_PREEMPT_RT under v5.13-rt1 triggers: [ 10.821700] DEBUG_LOCKS_WARN_ON(this_cpu_read(softirq_ctrl.cnt)) [ 10.821716] WARNING: CPU: 5 PID: 137 at kernel/softirq.c:173 __local_bh_disable_ip (kernel/softirq.c:173 (discriminator 31)) [ 10.821739] Modules linked in: [ 10.821749] CPU: 5 PID: 137 Comm: rcu_torture_rea Not tainted 5.13.0-rt1-00005-g08bbda29766a #129 [ 10.821759] Hardware name: ARM Juno development board (r0) (DT) [ 10.821765] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--) [ 10.821938] Call trace: [ 10.821941] __local_bh_disable_ip (kernel/softirq.c:173 (discriminator 31)) [ 10.821950] rcutorture_one_extend (./include/linux/rcupdate.h:274 ./include/linux/rcupdate.h:737 kernel/rcu/rcutorture.c:1443) [ 10.821960] rcu_torture_one_read (kernel/rcu/rcutorture.c:1590 kernel/rcu/rcutorture.c:1638) [ 10.821968] rcu_torture_reader (kernel/rcu/rcutorture.c:1730) [ 10.821976] kthread (kernel/kthread.c:321) [ 10.821986] ret_from_fork (arch/arm64/kernel/entry.S:1005) [ 10.821997] irq event stamp: 478635 [ 10.822001] hardirqs last enabled at (478635): _raw_spin_unlock_irq (./arch/arm64/include/asm/irqflags.h:35 ./include/linux/spinlock_api_smp.h:168 kernel/locking/spinlock.c:202) [ 10.822016] hardirqs last disabled at (478634): __schedule (kernel/sched/core.c:5154 (discriminator 1)) [ 10.822029] softirqs last enabled at (478626): __local_bh_enable_ip (./arch/arm64/include/asm/irqflags.h:85 kernel/softirq.c:262) [ 10.822040] softirqs last disabled at (478622): rcutorture_one_extend (./include/linux/bottom_half.h:19 kernel/rcu/rcutorture.c:1441) Per this warning, softirqs cannot be disabled in a non-preemptible region under CONFIG_PREEMPT_RT. Adjust RCU torture accordingly. Signed-off-by: Valentin Schneider --- kernel/rcu/rcutorture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 6096a7d14342..680f66b65f14 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1537,6 +1537,8 @@ rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp) * them on non-RT. */ if (IS_ENABLED(CONFIG_PREEMPT_RT)) { + /* Can't disable bh in atomic context under PREEMPT_RT */ + mask &= ~(RCUTORTURE_RDR_ATOM_BH | RCUTORTURE_RDR_ATOM_RBH); /* * Can't release the outermost rcu lock in an irq disabled * section without preemption also being disabled, if irqs -- 2.25.1