Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755182AbbGTHEP (ORCPT ); Mon, 20 Jul 2015 03:04:15 -0400 Received: from webbox1416.server-home.net ([77.236.96.61]:35624 "EHLO webbox1416.server-home.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753524AbbGTHEN (ORCPT ); Mon, 20 Jul 2015 03:04:13 -0400 From: Alexander Stein To: Mark Brown Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] regmap: regcache-rbtree: Use GFP_ATOMIC when using spinlocks Date: Mon, 20 Jul 2015 09:04:05 +0200 Message-ID: <3879923.hy2mOjvtRz@ws-stein> User-Agent: KMail/4.14.8 (Linux/4.0.5-gentoo; KDE/4.14.8; x86_64; ; ) In-Reply-To: <20150716190657.GA11162@sirena.org.uk> References: <1437061732-21018-1-git-send-email-alexander.stein@systec-electronic.com> <20150716190657.GA11162@sirena.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2595 Lines: 59 On Thursday 16 July 2015 20:06:57, Mark Brown wrote: > On Thu, Jul 16, 2015 at 05:48:52PM +0200, Alexander Stein wrote: > > > When regmap locking is done using spinlocks (e.g. using > > devm_regmap_init_mmio_clk) access is protected using spin_lock_irqsave. > > So when calling regmap_write the first time and a node is about to be > > inserted kzalloc must not be called with GFP_KERNEL. At this point > > The expectation here is that we should either be using no or a flat > cache here or (if we're using rbtree) providing register defaults to > ensure that we never do allocations in the spinlock. The rbtree code is > written on the assumption that we only have to be faster than reading > from a serial bus so I'd be worried about it not behaving at all nicely > in a spinlock even ignoring this issue. AFAICS even a flat cache seems also only be usefull when providing defaults, no? (Or having volatile registers). So how to handle this properly? Bail out, if fast_io is available and cache_type != (REGCACHE_NONE || REGCACHE_FLAT)? > Why are you using a dynamically allocated rbtree for a device like this? On my way home, I came to the same question. In fact this is not a driver written by myself, but from here http://git.freescale.com/git/cgit.cgi/ppc/sdk/linux.git/tree/drivers/video/fsl-dcu-fb.c#n1024. I guess as this is a mmio device and things like regcache_cache_only() are used, REGCACHE_FLAT seems appropriate. > > interrupts are disabled. This fixes the following warning: > > [ 8.605433] WARNING: CPU: 0 PID: 130 at kernel/lockdep.c:2740 lockdep_trace_alloc+0x124/0x128() > > [ 8.614096] DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) > > Please don't paste entire backtraces into commit messages, they're > enormous and don't add any value. If you feel a backtrace is useful > edit down the relevant context. Thanks, noted. Best regards, Alexander -- Dipl.-Inf. Alexander Stein SYS TEC electronic GmbH alexander.stein@systec-electronic.com Legal and Commercial Address: Am Windrad 2 08468 Heinsdorfergrund Germany Office: +49 (0) 3765 38600-11xx Fax: +49 (0) 0) 3765 38600-41xx Managing Directors: Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt; Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp Commercial Registry: Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/