Re: [PATCH v5 07/15] locking/lockdep: Free lock classes that are no longer in use

From: Bart Van Assche
Date: Thu Jan 10 2019 - 14:31:18 EST


On Thu, 2019-01-10 at 16:28 +-0100, Peter Zijlstra wrote:
+AD4 On Mon, Dec 17, 2018 at 01:29:54PM -0800, Bart Van Assche wrote:
+AD4 +AD4 +-static bool inside+AF8-selftest(void)
+AD4 +AD4 +-+AHs
+AD4 +AD4 +- return current +AD0APQ lockdep+AF8-selftest+AF8-task+AF8-struct+ADs
+AD4 +AD4 +-+AH0
+AD4 +AD4 +-void lockdep+AF8-free+AF8-key+AF8-range(void +ACo-start, unsigned long size)
+AD4 +AD4 +-+AHs
+AD4 +AD4 +- init+AF8-data+AF8-structures+AF8-once()+ADs
+AD4 +AD4 +-
+AD4 +AD4 +- if (inside+AF8-selftest())
+AD4 +AD4 +- lockdep+AF8-free+AF8-key+AF8-range+AF8-imm(start, size)+ADs
+AD4 +AD4 +- else
+AD4 +AD4 +- lockdep+AF8-free+AF8-key+AF8-range+AF8-reg(start, size)+ADs
+AD4 +AD4 +AH0
+AD4
+AD4 That is .... unfortunate. The whole reason that whole immediate thing
+AD4 works at all is because there is no concurrency what so ever that early,
+AD4 right?
+AD4
+AD4 Should we maybe key off of: 'system+AF8-state +AD0APQ SYSTEM+AF8-BOOTING' instead?

Hi Peter,

I agree that it is unfortunate that the selftests require a different code
path. I have not been able to find any way to avoid this. Using the test
system+AF8-state +AD0APQ SYSTEM+AF8-BOOTING should work and will allow to remove the
lockdep+AF8-selftest+AF8-task+AF8-struct variable. Do you want me to make that change?

Bart.