Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1982862ybh; Fri, 13 Mar 2020 10:48:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtwr8taNEiBe4oxDPGm9ElfkykcZnc/bXAeD+gYrbgJzB3vo1PBPWEOgA7Y3fPXfoKc9bR7 X-Received: by 2002:a9d:3435:: with SMTP id v50mr10670164otb.19.1584121729811; Fri, 13 Mar 2020 10:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584121729; cv=none; d=google.com; s=arc-20160816; b=FHn5lNYcIE7c60qr4E28cuVd8v44UAOWIiUoShY6KEHcmluuo6K45Vv3KBAJKodPL2 uhNhzjt2T34mf+qXDtwffWo5kchD4azK1kYlfmllMhpprcW942VnA8zvtq2k7q1KiRpX pND6DMJ3DeGqTQfLb0+2fjfjniAVvUQsau8MzRtksglI0Umw2UzDb0i5iUKkCBw61/+X ZMZTHs1abFjr9CWh1914vL3ir12yfsJxApaEquxEzZb5LobSny8tKUXPN5EU5p9CDKnc ABa1aaEyZP1PIgfvWMKPuBmzBNWQtGEJNZkKf16/CbnYw9x4QSD8dRDcMe2CK4C+nyWv r0ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kcwtVeLS/97VbpwqU8/OapVZsg52Mb+Xpe+YpCR8pB4=; b=e4rxUsrrlgxtoHFKtpWgxMlFAlqgMIT/8WFtz/RceRosmvoG2dhFBrFHyi8mi5fBJ7 QnifroBw9x15a2bi3m88DSNGHAriIIXHwXaEuY6TfSmWNn8YgDDf8UvLT2KTggr+wmuv AupqqSGJRMA09aIlppvUY2+8syLQq5F0+pXFgTY6FXE+lL4+5ZVmm5nd0o1y34bYAg/X GBjeGoZFgWG9idYUTJrDePilnAhjwGOG/QPrtDe/QlMyaDotSlU5cWH9jaFxele9KZgX Bjv+FkX9QoxpDdWmkeEHdSmaivoxwF/0hoT8Jv7k150+z0XsjiVKNbO4Owy1xno5A69a OKSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si4440828oix.100.2020.03.13.10.48.37; Fri, 13 Mar 2020 10:48:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727280AbgCMRro (ORCPT + 99 others); Fri, 13 Mar 2020 13:47:44 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:47732 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726414AbgCMRrZ (ORCPT ); Fri, 13 Mar 2020 13:47:25 -0400 Received: from localhost ([127.0.0.1] helo=flow.W.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1jCoP3-00017r-WA; Fri, 13 Mar 2020 18:47:22 +0100 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , "Paul E . McKenney" , Joel Fernandes , Steven Rostedt , Linus Torvalds , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH 9/9] lockdep: Add posixtimer context tracing bits Date: Fri, 13 Mar 2020 18:47:01 +0100 Message-Id: <20200313174701.148376-10-bigeasy@linutronix.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200313174701.148376-1-bigeasy@linutronix.de> References: <20200313174701.148376-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Splitting run_posix_cpu_timers() into two parts is work in progress which is stuck on other entry code related problems. The heavy lifting which involves locking of sighand lock will be moved into task context so the necessary execution time is burdened on the task and not on interrupt context. Until this work completes lockdep with the spinlock nesting rules enabled would emit warnings for this known context. Prevent it by setting "->irq_config =3D 1" for the invocation of run_posix_cpu_timers() so lockdep does not complain when sighand lock is acquried. This will be removed once the split is completed. Signed-off-by: Sebastian Andrzej Siewior --- include/linux/irqflags.h | 12 ++++++++++++ kernel/time/posix-cpu-timers.c | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index f23f540e0ebba..a16adbb58f66a 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h @@ -69,6 +69,16 @@ do { \ current->irq_config =3D 0; \ } while (0) =20 +# define lockdep_posixtimer_enter() \ + do { \ + current->irq_config =3D 1; \ + } while (0) + +# define lockdep_posixtimer_exit() \ + do { \ + current->irq_config =3D 0; \ + } while (0) + # define lockdep_irq_work_enter(__work) \ do { \ if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\ @@ -94,6 +104,8 @@ do { \ # define lockdep_softirq_exit() do { } while (0) # define lockdep_hrtimer_enter(__hrtimer) do { } while (0) # define lockdep_hrtimer_exit(__hrtimer) do { } while (0) +# define lockdep_posixtimer_enter() do { } while (0) +# define lockdep_posixtimer_exit() do { } while (0) # define lockdep_irq_work_enter(__work) do { } while (0) # define lockdep_irq_work_exit(__work) do { } while (0) #endif diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index 8ff6da77a01fd..2c48a7233b196 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -1126,8 +1126,11 @@ void run_posix_cpu_timers(void) if (!fastpath_timer_check(tsk)) return; =20 - if (!lock_task_sighand(tsk, &flags)) + lockdep_posixtimer_enter(); + if (!lock_task_sighand(tsk, &flags)) { + lockdep_posixtimer_exit(); return; + } /* * Here we take off tsk->signal->cpu_timers[N] and * tsk->cpu_timers[N] all the timers that are firing, and @@ -1169,6 +1172,7 @@ void run_posix_cpu_timers(void) cpu_timer_fire(timer); spin_unlock(&timer->it_lock); } + lockdep_posixtimer_exit(); } =20 /* --=20 2.25.1