mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
lockdep: Fix per-cpu static objects
Since commit383776fa75("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:383776fa75("locking/lockdep: Handle statically initialized PER_CPU locks properly") Reported-by: kernel test robot <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Borislav Petkov <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: [email protected] Cc: [email protected] Cc: kernel test robot <[email protected]> Cc: LKP <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
This commit is contained in:
parent
56222b212e
commit
8ce371f984
4 changed files with 27 additions and 2 deletions
|
|
@ -1293,8 +1293,11 @@ bool __is_kernel_percpu_address(unsigned long addr, unsigned long *can_addr)
|
|||
void *va = (void *)addr;
|
||||
|
||||
if (va >= start && va < start + static_size) {
|
||||
if (can_addr)
|
||||
if (can_addr) {
|
||||
*can_addr = (unsigned long) (va - start);
|
||||
*can_addr += (unsigned long)
|
||||
per_cpu_ptr(base, get_boot_cpu_id());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue