The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Subject: Re: [PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io == true
Date: Fri, 11 Sep 2015 09:16:47 -0700	[thread overview]
Message-ID: <20150911161647.GB10328@codeaurora.org> (raw)
In-Reply-To: <20150911102858.GE12027@sirena.org.uk>

On 09/11, Mark Brown wrote:
> On Thu, Sep 10, 2015 at 12:27:01PM -0700, Stephen Boyd wrote:
> > If a regmap is using fast_io, allocate buffers in the write APIs
> > with GFP_ATOMIC instead of GFP_KERNEL. Otherwise we may schedule
> > while atomic.
> 
> Why is this needed?  If something needs fast I/O it probably doesn't
> want to be going down any of the code paths that result in us doing
> allocations.  I'd expect either no cache, a flat cache or setting up
> defaults at initialisation time.

We tripped over this with regmap_bulk_write() users on the SPMI
bus. How about going down the same paths as !map->can_multi_write
and map->use_single_rw if fast_io == true? Something like this
untested patch.

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 29128c6af445..4f2d75527c7f 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -573,8 +573,8 @@ struct regmap *regmap_init(struct device *dev,
 		map->reg_stride = config->reg_stride;
 	else
 		map->reg_stride = 1;
-	map->use_single_rw = config->use_single_rw;
-	map->can_multi_write = config->can_multi_write;
+	map->use_single_rw = config->use_single_rw || config->fast_io;
+	map->can_multi_write = config->can_multi_write && !config->fast_io;
 	map->dev = dev;
 	map->bus = bus;
 	map->bus_context = bus_context;

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-09-11 16:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 19:27 [PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io == true Stephen Boyd
2015-09-11 10:28 ` Mark Brown
2015-09-11 16:16   ` Stephen Boyd [this message]
2015-09-11 17:24     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150911161647.GB10328@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=adharmap@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox