From: Frederic Weisbecker <frederic@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Tejun Heo <tj@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 07/14] x86: Use lockdep to assert IRQs are disabled/enabled
Date: Fri, 3 Nov 2017 15:25:07 +0100 [thread overview]
Message-ID: <CAFTL4hym0k2_zOmhA+CfLodVGfuVOinPC0cK5hjTT3e0K-rhGw@mail.gmail.com> (raw)
In-Reply-To: <20171022092025.GJ6524@worktop.programming.kicks-ass.net>
2017-10-22 11:20 UTC+02:00, Peter Zijlstra <peterz@infradead.org>:
> On Fri, Oct 20, 2017 at 02:56:04AM +0200, Frederic Weisbecker wrote:
>> diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
>> index 03505ff..b4f3a55 100644
>> --- a/arch/x86/entry/common.c
>> +++ b/arch/x86/entry/common.c
>> @@ -186,7 +186,7 @@ __visible inline void prepare_exit_to_usermode(struct
>> pt_regs *regs)
>>
>> addr_limit_user_check();
>>
>> - if (IS_ENABLED(CONFIG_PROVE_LOCKING) && WARN_ON(!irqs_disabled()))
>> + if (!lockdep_assert_irqs_disabled())
>> local_irq_disable();
>>
>> lockdep_sys_exit();
>
> So this is the only site that ever uses the return value; and for this
> you've chosen the wrong value for !CONFIG_PROVE_LOCKING (namely 1),
> resulting in an unconditional CLI here for !lockdep kernels.
Hmm, it should be the opposite. The assertion maps to 1 for
!CONFIG_PROVE_LOCKING
but we are testing with "!".
> How about we replace that whole thing with a simple:
>
> lockdep_assert_irqs_disabled();
>
> And leave it at that, allowing us to remove the return value thing
> entirely.
>
> The whole if !disabled, disable logic is uber paranoid programming, but
> I don't think we've ever seen that WARN trigger, and if it does (and
> then burns the kernel) we at least know wtf happend.
I certainly don't mind personally, as long as we get the warning. Now
I've seen different
opinions on matters such as this. Some prefer to have the
auto-correction, some don't.
I'll try as you say and see if anybody gets angry :)
next prev parent reply other threads:[~2017-11-03 14:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 0:55 [PATCH 00/14] lockdep: Add lightweight IRQs disabled/enabled check Frederic Weisbecker
2017-10-20 0:55 ` [PATCH 01/14] lockdep: Add IRQs disabled/enabled assertion Frederic Weisbecker
2017-10-20 0:55 ` [PATCH 02/14] irq: Use lockdep to assert IRQs are disabled/enabled Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 03/14] workqueue: " Frederic Weisbecker
2017-10-21 15:39 ` Tejun Heo
2017-10-20 0:56 ` [PATCH 04/14] nohz: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 05/14] hrtimer: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 06/14] smp: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 07/14] x86: " Frederic Weisbecker
2017-10-22 9:20 ` Peter Zijlstra
2017-11-03 14:25 ` Frederic Weisbecker [this message]
2017-10-20 0:56 ` [PATCH 08/14] perf: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 09/14] irq/timings: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 10/14] irq_work: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 11/14] sched: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 12/14] posix-cpu-timers: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 13/14] netpoll: " Frederic Weisbecker
2017-10-20 0:56 ` [PATCH 14/14] rcu: " Frederic Weisbecker
2017-10-21 21:36 ` Paul E. McKenney
2017-11-06 15:01 [GIT PULL] lockdep: Add lightweight IRQs disabled/enabled check v2 Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 07/14] x86: Use lockdep to assert IRQs are disabled/enabled Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFTL4hym0k2_zOmhA+CfLodVGfuVOinPC0cK5hjTT3e0K-rhGw@mail.gmail.com \
--to=frederic@kernel.org \
--cc=davem@davemloft.net \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).