Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-30 Thread Peter Zijlstra
On Tue, Jun 30, 2020 at 07:59:39AM +0200, Ahmed S. Darwish wrote: > Peter Zijlstra wrote: > > ... > > > -#define lockdep_assert_irqs_disabled() do {\ > > - WARN_ONCE(debug_locks && !current->lockdep_recursion && \ > > -

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-30 Thread Ahmed S. Darwish
Peter Zijlstra wrote: ... > -#define lockdep_assert_irqs_disabled() do {\ > - WARN_ONCE(debug_locks && !current->lockdep_recursion && \ > - current->hardirqs_enabled,\ > - "IRQs not disabled as

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-24 Thread Peter Zijlstra
On Wed, Jun 24, 2020 at 01:32:46PM +0200, Marco Elver wrote: > From: Marco Elver > Date: Wed, 24 Jun 2020 11:23:22 +0200 > Subject: [PATCH] kcsan: Make KCSAN compatible with new IRQ state tracking > > The new IRQ state tracking code does not honor lockdep_off(), and as > such we should again

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-24 Thread Peter Zijlstra
On Tue, Jun 23, 2020 at 10:24:04PM +0200, Peter Zijlstra wrote: > On Tue, Jun 23, 2020 at 08:12:32PM +0200, Peter Zijlstra wrote: > > Fair enough; I'll rip it all up and boot a KCSAN kernel, see what if > > anything happens. > > OK, so the below patch doesn't seem to have any nasty recursion

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Ahmed S. Darwish
On Tue, Jun 23, 2020 at 05:24:50PM +0200, Peter Zijlstra wrote: > On Tue, Jun 23, 2020 at 05:00:31PM +0200, Ahmed S. Darwish wrote: > > On Tue, Jun 23, 2020 at 10:36:52AM +0200, Peter Zijlstra wrote: > > ... > > > -#define lockdep_assert_irqs_disabled() do { > > > \ >

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Ahmed S. Darwish
On Tue, Jun 23, 2020 at 10:36:52AM +0200, Peter Zijlstra wrote: ... > -#define lockdep_assert_irqs_disabled() do { > \ > - WARN_ONCE(debug_locks && !current->lockdep_recursion && \ > - current->hardirqs_enabled,

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Peter Zijlstra
On Tue, Jun 23, 2020 at 10:24:04PM +0200, Peter Zijlstra wrote: > On Tue, Jun 23, 2020 at 08:12:32PM +0200, Peter Zijlstra wrote: > > Fair enough; I'll rip it all up and boot a KCSAN kernel, see what if > > anything happens. > > OK, so the below patch doesn't seem to have any nasty recursion

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Peter Zijlstra
On Tue, Jun 23, 2020 at 08:12:32PM +0200, Peter Zijlstra wrote: > Fair enough; I'll rip it all up and boot a KCSAN kernel, see what if > anything happens. OK, so the below patch doesn't seem to have any nasty recursion issues here. The only 'problem' is that lockdep now sees report_lock can cause

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Peter Zijlstra
On Tue, Jun 23, 2020 at 09:13:35PM +0200, Marco Elver wrote: > I see the below report when I boot with your branch + KCSAN and > PROVE_LOCKING. config attached. Trying to make sense of what's > happening. Ah, I was still playing with tip/master + PROVE_LOCKING + KCSAN and slowly removing parts of

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Peter Zijlstra
On Tue, Jun 23, 2020 at 07:59:57PM +0200, Marco Elver wrote: > On Tue, Jun 23, 2020 at 06:37PM +0200, Peter Zijlstra wrote: > > On Tue, Jun 23, 2020 at 06:13:21PM +0200, Ahmed S. Darwish wrote: > > > Well, freshly merged code is using it. For example, KCSAN: > > > > > > => f1bc96210c6a

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Peter Zijlstra
On Tue, Jun 23, 2020 at 06:13:21PM +0200, Ahmed S. Darwish wrote: > Well, freshly merged code is using it. For example, KCSAN: > > => f1bc96210c6a ("kcsan: Make KCSAN compatible with lockdep") > => kernel/kcsan/report.c: > > void kcsan_report(...) > { > ... > /* >

Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables

2020-06-23 Thread Peter Zijlstra
On Tue, Jun 23, 2020 at 05:00:31PM +0200, Ahmed S. Darwish wrote: > On Tue, Jun 23, 2020 at 10:36:52AM +0200, Peter Zijlstra wrote: > ... > > -#define lockdep_assert_irqs_disabled() do { > > \ > > - WARN_ONCE(debug_locks && !current->lockdep_recursion && \

[PATCH v4 7/8] lockdep: Change hardirq{s_enabled, _context} to per-cpu variables

2020-06-23 Thread Peter Zijlstra
Currently all IRQ-tracking state is in task_struct, this means that task_struct needs to be defined before we use it. Especially for lockdep_assert_irq*() this can lead to header-hell. Move the hardirq state into per-cpu variables to avoid the task_struct dependency. Signed-off-by: Peter