[Skiboot] [RFC PATCH] core/lock: Add debug options to store backtrace of where lock was taken
Andrew Donnellan
andrew.donnellan at au1.ibm.com
Mon Feb 25 17:25:17 AEDT 2019
On 25/2/19 5:11 pm, Stewart Smith wrote:
>> +/* Enable printing of backtraces when locks not released */
>> +#define DEBUG_LOCKS_BACKTRACE 1
>
> this is behind a #if for DEBUG=1, right?
it is not, but I can fix that...
>
>> +
>> /* Enable lock dependency checker */
>> #define DEADLOCK_CHECKER 1
>>
>> diff --git a/include/lock.h b/include/lock.h
>> index b18757394dbb..b7d47be83ba9 100644
>> --- a/include/lock.h
>> +++ b/include/lock.h
>> @@ -23,6 +23,10 @@
>> #include <ccan/list/list.h>
>> #include <ccan/str/str.h>
>>
>> +#ifdef DEBUG_LOCKS_BACKTRACE
>> +#include <stack.h>
>> +#endif
>> +
>> struct lock {
>> /* Lock value has bit 63 as lock bit and the PIR of the owner
>> * in the top 32-bit
>> @@ -38,6 +42,14 @@ struct lock {
>> /* file/line of lock owner */
>> const char *owner;
>>
>> +#ifdef DEBUG_LOCKS_BACKTRACE
>> + struct bt_entry bt_buf[60];
>> + unsigned int bt_ents;
>> + unsigned long bt_token;
>> + unsigned long bt_r1_caller;
>> + unsigned long bt_pir;
>> +#endif
>
> almost feels like it should be a struct.
And if we made it a struct, that would make it easier to clean up the
API and make stuff like this easier in future... hmm...
>
>> +
>> /* linkage in per-cpu list of owned locks */
>> struct list_node list;
>> };
>> --
>> 2.11.0
>>
>> _______________________________________________
>> Skiboot mailing list
>> Skiboot at lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/skiboot
>>
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com IBM Australia Limited
More information about the Skiboot
mailing list