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: 11903675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 870ECC388F7 for ; Fri, 13 Nov 2020 14:27:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A34622226 for ; Fri, 13 Nov 2020 14:27:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2BItCTjX"; dkim=fail reason="signature verification failed" (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" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A34622226 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=MQuAS9iUy5oC3SY8jxMi0499FMkMrYLyHswdjUHPi3A=; b=2BItCTjXQpdhe+pmBl3CiwrRB +LWT7oCp3ye3+Ya4t/1Do/sJxormm6Te6wry1Nl8BjB4p8cWDv9mHQcUIHyt83g+H7TRCcAJbH4Q/ cNJkFmNAkmYW+ATU5smCL4GUgxcrlUrvtjHlWypZQQJG7qQn6Lx93ESM8xWRPAlCdZdRM574AQ3qe WgDP+H2bhrvOGsHjxvoJ3zL2JTm8wh7+7q4SI6AJuOWeBQUO6vF3YDR2gznHBxnBqp1VNdvnBuDvh itxgyjumG7HaV9qXDJHazW9BVMFK1gc5v8fz42wcX0pcjYCbcU6pZwUeu5SvvlI+6g6YeBjaEui+r VoFZKDyBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kda20-00072M-LQ; Fri, 13 Nov 2020 14:26:28 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kda06-0006Kz-Dy; Fri, 13 Nov 2020 14:24:37 +0000 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 Subject: [patch 12/19] softirq: Add RT specific softirq accounting References: <20201113140207.499353218@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_092430_688032_FDB20961 X-CRM114-Status: GOOD ( 13.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Rich Felker , Catalin Marinas , Paul McKenney , Arnd Bergmann , linux-sh@vger.kernel.org, Peter Zijlstra , Richard Weinberger , Frederic Weisbecker , Valentin Schneider , Jeff Dike , Russell King , Yoshinori Sato , "James E.J. Bottomley" , linux-parisc@vger.kernel.org, Helge Deller , linux-um@lists.infradead.org, Will Deacon , Sebastian Andrzej Siewior , linux-arm-kernel@lists.infradead.org, Anton Ivanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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