On Fri, Oct 24, 2014 at 07:03:57PM -0700, Nicolin Chen wrote:
Kernel dump (WARN_ON) ocurred during system boot-up inside regmap_write():
------------[ cut here ]------------ WARNING: CPU: 0 PID: 47 at kernel/locking/lockdep.c:2744 lockdep_trace_alloc+0xe8/0x108()
Applied, thanks. Please edit down or elide backtraces - they take up a lot of space in the changelog compared to the amount of information they contain.
By looking at 2744 line, we can get that it's because regcache_rbtree_write() would call kmalloc() with GFP flag if it couldn't find an existing block to insert nodes while this kmalloc() call is inside a spin_lock_irq_save pair, i.e. IRQs disabled.
Even though this may be a bug that should be fixed, I still try to send this patch as a quick fix (work around) since it does no harm to assign default values of every registers when using regcache.
It's not a bug, it's not reasonable to default allocations to atomic and we can't really tell what context we're in. Anything used inside a heavily locked path should either have a default provided or arrange for a prior write to set up the cache.