2014-01-08 19:23:02

by Sasha Levin

[permalink] [raw]
Subject: [PATCH] lockdep: increase static allocations

Fuzzing a recent kernel with a large configuration hits the static
allocation limits and disables lockdep.

This patch doubles the limits.

Signed-off-by: Sasha Levin <[email protected]>
---
kernel/locking/lockdep_internals.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
index 4f560cf..51c4b24 100644
--- a/kernel/locking/lockdep_internals.h
+++ b/kernel/locking/lockdep_internals.h
@@ -54,9 +54,9 @@ enum {
* table (if it's not there yet), and we check it for lock order
* conflicts and deadlocks.
*/
-#define MAX_LOCKDEP_ENTRIES 16384UL
+#define MAX_LOCKDEP_ENTRIES 32768UL

-#define MAX_LOCKDEP_CHAINS_BITS 15
+#define MAX_LOCKDEP_CHAINS_BITS 16
#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)

#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
@@ -65,7 +65,7 @@ enum {
* Stack-trace: tightly packed array of stack backtrace
* addresses. Protected by the hash_lock.
*/
-#define MAX_STACK_TRACE_ENTRIES 262144UL
+#define MAX_STACK_TRACE_ENTRIES 524288UL

extern struct list_head all_lock_classes;
extern struct lock_chain lock_chains[];
--
1.8.3.2


2014-01-08 19:51:54

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

Sasha Levin <[email protected]> writes:

> Fuzzing a recent kernel with a large configuration hits the static
> allocation limits and disables lockdep.

Doesn't that use a lot more memory? I thought lockdep preallocates.

Doubling may be too aggressive.

-Andi

--
[email protected] -- Speaking for myself only

2014-01-08 20:11:40

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

On 01/08/2014 02:51 PM, Andi Kleen wrote:
> Sasha Levin <[email protected]> writes:
>
>> Fuzzing a recent kernel with a large configuration hits the static
>> allocation limits and disables lockdep.
>
> Doesn't that use a lot more memory? I thought lockdep preallocates.
>
> Doubling may be too aggressive.

The patch adds about 4MB of memory usage, I didn't think it's too much for something
that is only enabled during debugging.

If this is an issue, can I suggest making these values configurable in the .config
and just let users pick whatever they want?


Thanks,
Sasha

2014-01-08 23:23:27

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

On Wed, Jan 08, 2014 at 03:10:55PM -0500, Sasha Levin wrote:
> On 01/08/2014 02:51 PM, Andi Kleen wrote:
> >Sasha Levin <[email protected]> writes:
> >
> >>Fuzzing a recent kernel with a large configuration hits the static
> >>allocation limits and disables lockdep.
> >
> >Doesn't that use a lot more memory? I thought lockdep preallocates.
> >
> >Doubling may be too aggressive.
>
> The patch adds about 4MB of memory usage, I didn't think it's too much for something
> that is only enabled during debugging.

Wasting 4MB is an issue.

Linus' first Linux system had less total memory than that.

>
> If this is an issue, can I suggest making these values configurable in the .config
> and just let users pick whatever they want?

Better allocate it at boot time, using a boot parameter or somesuch.

-Andi

2014-01-09 08:56:53

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

On Thu, Jan 09, 2014 at 12:23:22AM +0100, Andi Kleen wrote:
> On Wed, Jan 08, 2014 at 03:10:55PM -0500, Sasha Levin wrote:
> > On 01/08/2014 02:51 PM, Andi Kleen wrote:
> > >Sasha Levin <[email protected]> writes:
> > >
> > >>Fuzzing a recent kernel with a large configuration hits the static
> > >>allocation limits and disables lockdep.
> > >
> > >Doesn't that use a lot more memory? I thought lockdep preallocates.
> > >
> > >Doubling may be too aggressive.
> >
> > The patch adds about 4MB of memory usage, I didn't think it's too much for something
> > that is only enabled during debugging.
>
> Wasting 4MB is an issue.
>
> Linus' first Linux system had less total memory than that.

Meh.. if someone from the embedded people care we can add
CONFIG_BASE_SMALL option, until then I couldn't care less about 4m.

> >
> > If this is an issue, can I suggest making these values configurable in the .config
> > and just let users pick whatever they want?
>
> Better allocate it at boot time, using a boot parameter or somesuch.

wrongbot andi is at it again.. no that's far too late.

2014-02-28 19:33:00

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

On 01/08/2014 02:21 PM, Sasha Levin wrote:
> Fuzzing a recent kernel with a large configuration hits the static
> allocation limits and disables lockdep.
>
> This patch doubles the limits.
>
> Signed-off-by: Sasha Levin <[email protected]>
> ---
> kernel/locking/lockdep_internals.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
> index 4f560cf..51c4b24 100644
> --- a/kernel/locking/lockdep_internals.h
> +++ b/kernel/locking/lockdep_internals.h
> @@ -54,9 +54,9 @@ enum {
> * table (if it's not there yet), and we check it for lock order
> * conflicts and deadlocks.
> */
> -#define MAX_LOCKDEP_ENTRIES 16384UL
> +#define MAX_LOCKDEP_ENTRIES 32768UL
>
> -#define MAX_LOCKDEP_CHAINS_BITS 15
> +#define MAX_LOCKDEP_CHAINS_BITS 16
> #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
>
> #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
> @@ -65,7 +65,7 @@ enum {
> * Stack-trace: tightly packed array of stack backtrace
> * addresses. Protected by the hash_lock.
> */
> -#define MAX_STACK_TRACE_ENTRIES 262144UL
> +#define MAX_STACK_TRACE_ENTRIES 524288UL
>
> extern struct list_head all_lock_classes;
> extern struct lock_chain lock_chains[];
>


Can someone pick the patch up please? PeterZ even (seemed to) acked it.


Thanks,
Sasha

2014-03-01 04:34:38

by Mike Galbraith

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

On Fri, 2014-02-28 at 14:32 -0500, Sasha Levin wrote:
> On 01/08/2014 02:21 PM, Sasha Levin wrote:
> > Fuzzing a recent kernel with a large configuration hits the static
> > allocation limits and disables lockdep.
> >
> > This patch doubles the limits.
> >
> > Signed-off-by: Sasha Levin <[email protected]>
> > ---
> > kernel/locking/lockdep_internals.h | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
> > index 4f560cf..51c4b24 100644
> > --- a/kernel/locking/lockdep_internals.h
> > +++ b/kernel/locking/lockdep_internals.h
> > @@ -54,9 +54,9 @@ enum {
> > * table (if it's not there yet), and we check it for lock order
> > * conflicts and deadlocks.
> > */
> > -#define MAX_LOCKDEP_ENTRIES 16384UL
> > +#define MAX_LOCKDEP_ENTRIES 32768UL
> >
> > -#define MAX_LOCKDEP_CHAINS_BITS 15
> > +#define MAX_LOCKDEP_CHAINS_BITS 16
> > #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
> >
> > #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
> > @@ -65,7 +65,7 @@ enum {
> > * Stack-trace: tightly packed array of stack backtrace
> > * addresses. Protected by the hash_lock.
> > */
> > -#define MAX_STACK_TRACE_ENTRIES 262144UL
> > +#define MAX_STACK_TRACE_ENTRIES 524288UL
> >
> > extern struct list_head all_lock_classes;
> > extern struct lock_chain lock_chains[];
> >
>
>
> Can someone pick the patch up please? PeterZ even (seemed to) acked it.

I have to do the (exact) same to rt trees, else lockdep routinely gets
in a snit, takes it's cool toys and goes home.

-Mike

2014-04-07 21:54:07

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

On 02/28/2014 02:32 PM, Sasha Levin wrote:
> On 01/08/2014 02:21 PM, Sasha Levin wrote:
>> Fuzzing a recent kernel with a large configuration hits the static
>> allocation limits and disables lockdep.
>>
>> This patch doubles the limits.
>>
>> Signed-off-by: Sasha Levin <[email protected]>
>> ---
>> kernel/locking/lockdep_internals.h | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
>> index 4f560cf..51c4b24 100644
>> --- a/kernel/locking/lockdep_internals.h
>> +++ b/kernel/locking/lockdep_internals.h
>> @@ -54,9 +54,9 @@ enum {
>> * table (if it's not there yet), and we check it for lock order
>> * conflicts and deadlocks.
>> */
>> -#define MAX_LOCKDEP_ENTRIES 16384UL
>> +#define MAX_LOCKDEP_ENTRIES 32768UL
>>
>> -#define MAX_LOCKDEP_CHAINS_BITS 15
>> +#define MAX_LOCKDEP_CHAINS_BITS 16
>> #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
>>
>> #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
>> @@ -65,7 +65,7 @@ enum {
>> * Stack-trace: tightly packed array of stack backtrace
>> * addresses. Protected by the hash_lock.
>> */
>> -#define MAX_STACK_TRACE_ENTRIES 262144UL
>> +#define MAX_STACK_TRACE_ENTRIES 524288UL
>>
>> extern struct list_head all_lock_classes;
>> extern struct lock_chain lock_chains[];
>>
>
>
> Can someone pick the patch up please? PeterZ even (seemed to) acked it.

Pretty please? A few people reported that they do what the patch does
to get lockdep working right for them, and there were no objections to
the patch.


Thanks,
Sasha

2014-04-08 15:08:47

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] lockdep: increase static allocations

>
> Pretty please? A few people reported that they do what the patch does
> to get lockdep working right for them, and there were no objections to
> the patch.

Thanks for the reminder!, got it queued.

Subject: [tip:locking/core] lockdep: Increase static allocations

Commit-ID: 1413c03893332366e5b4d1e26f942ada25f3e82a
Gitweb: http://git.kernel.org/tip/1413c03893332366e5b4d1e26f942ada25f3e82a
Author: Sasha Levin <[email protected]>
AuthorDate: Wed, 8 Jan 2014 14:21:46 -0500
Committer: Ingo Molnar <[email protected]>
CommitDate: Fri, 18 Apr 2014 14:20:50 +0200

lockdep: Increase static allocations

Fuzzing a recent kernel with a large configuration hits the static
allocation limits and disables lockdep.

This patch doubles the limits.

Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
kernel/locking/lockdep_internals.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
index 4f560cf..51c4b24 100644
--- a/kernel/locking/lockdep_internals.h
+++ b/kernel/locking/lockdep_internals.h
@@ -54,9 +54,9 @@ enum {
* table (if it's not there yet), and we check it for lock order
* conflicts and deadlocks.
*/
-#define MAX_LOCKDEP_ENTRIES 16384UL
+#define MAX_LOCKDEP_ENTRIES 32768UL

-#define MAX_LOCKDEP_CHAINS_BITS 15
+#define MAX_LOCKDEP_CHAINS_BITS 16
#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)

#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
@@ -65,7 +65,7 @@ enum {
* Stack-trace: tightly packed array of stack backtrace
* addresses. Protected by the hash_lock.
*/
-#define MAX_STACK_TRACE_ENTRIES 262144UL
+#define MAX_STACK_TRACE_ENTRIES 524288UL

extern struct list_head all_lock_classes;
extern struct lock_chain lock_chains[];