From patchwork Fri Nov 13 14:02:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11903619 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF933921 for ; Fri, 13 Nov 2020 14:25:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B671422226 for ; Fri, 13 Nov 2020 14:25:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hWAB3oHV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kNX4csPH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726692AbgKMOZC (ORCPT ); Fri, 13 Nov 2020 09:25:02 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:52700 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726830AbgKMOYb (ORCPT ); Fri, 13 Nov 2020 09:24:31 -0500 Message-Id: <20201113141734.096224353@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1605277469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=7FMqhKuhnVJot7gugFY0sIHhr7C/a6J/+QfyYVD8emw=; b=hWAB3oHVAGiodkIZKWVA/wHw+8lM5Yf9xpgH9yZCucVDL3PA3DKYbCR3kxRj/aEeniifps SvXIhCS5yN18DxJrcFdOTteQ2XNq1ZARAhc5AarZf3NcZ0kofmD9ndFAw0sUyGz1vOgi3M oMVOOhtMW5aIGAqGQR59uudOHtzseVzzr9CoU+VBu4W8O1apSYzc8GzsrimvBjLt3Wohq1 i6D2Tz8z7RzK1Pc1+GcoMLAr9Hxps0/mCwXgE3NWa3ScwqRpsrCTHaSPntIYLa/typVLWO VfSUZ51CyDHAhDEau2h/yeF2NcU4eMjCmTAFJ/HouWZlfSRj9nF7INS1SDWjrw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1605277469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=7FMqhKuhnVJot7gugFY0sIHhr7C/a6J/+QfyYVD8emw=; b=kNX4csPHdXBz2VCKmQeCbwIwI3e4E8fGLYskNFO77kKPXf4ZoefJQdRB+pZU7ZYJcXn8Hq Dfon13Yv89lSSnDQ== Date: Fri, 13 Nov 2020 15:02:19 +0100 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Frederic Weisbecker , Paul McKenney , Sebastian Andrzej Siewior , Arnd Bergmann , "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org, Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um@lists.infradead.org, Russell King , Marc Zyngier , Valentin Schneider , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon Subject: [patch 12/19] softirq: Add RT specific softirq accounting References: <20201113140207.499353218@linutronix.de> MIME-Version: 1.0 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org RT requires the softirq to be preemptible and uses a per CPU local lock to protect BH disabled sections and softirq processing. Therefore RT cannot use the preempt counter to keep track of BH disabled/serving. Add a RT only counter to task struct and adjust the relevant macros in preempt.h. Signed-off-by: Thomas Gleixner --- include/linux/hardirq.h | 1 + include/linux/preempt.h | 6 +++++- include/linux/sched.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -79,7 +79,11 @@ #define nmi_count() (preempt_count() & NMI_MASK) #define hardirq_count() (preempt_count() & HARDIRQ_MASK) -#define softirq_count() (preempt_count() & SOFTIRQ_MASK) +#ifdef CONFIG_PREEMPT_RT +# define softirq_count() (current->softirq_disable_cnt & SOFTIRQ_MASK) +#else +# define softirq_count() (preempt_count() & SOFTIRQ_MASK) +#endif #define irq_count() (nmi_count() | hardirq_count() | softirq_count()) /* --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1004,6 +1004,9 @@ struct task_struct { int softirq_context; int irq_config; #endif +#ifdef CONFIG_PREEMPT_RT + int softirq_disable_cnt; +#endif #ifdef CONFIG_LOCKDEP # define MAX_LOCK_DEPTH 48UL