Re: [locking/lockdep] 383776fa75: INFO: trying to register non-static key.

From: Borislav Petkov
Date: Sat Mar 25 2017 - 14:14:52 EST


On Mon, Mar 20, 2017 at 12:41:08PM +0100, Peter Zijlstra wrote:
> Subject: lockdep: Fix per-cpu static objects
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Date: Mon Mar 20 12:26:55 CET 2017
>
> Since commit:
>
> 383776fa7527 ("locking/lockdep: Handle statically initialized PER_CPU locks properly")
>
> we try to collapse per-cpu locks into a single class by giving them
> all the same key. For this key we choose the canonical address of the
> per-cpu object, which would be the offset into the per-cpu area.
>
> This has two problems:
>
> - there is a case where we run !0 lock->key through static_obj() and
> expect this to pass; it doesn't for canonical pointers.
>
> - 0 is a valid canonical address.
>
> Cure both issues by redefining the canonical address as the address of
> the per-cpu variable on the boot CPU.
>
> Since I didn't want to rely on CPU0 being the boot-cpu, or even
> existing at all, track the boot CPU in a variable.
>
> Fixes: 383776fa7527 ("locking/lockdep: Handle statically initialized PER_CPU locks properly")
> Reported-by: kernel test robot <fengguang.wu@xxxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>

Tested-by: Borislav Petkov <bp@xxxxxxx>

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.