Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222940

Re: [PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io == true

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io == true
Date 2015-09-11 18:20 +0200
Message-ID <q7zdo-6M4-15@gated-at.bofh.it> (permalink)
References <q7fHI-2ta-3@gated-at.bofh.it> <q7tKG-7d0-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io == true Stephen Boyd <sboyd@codeaurora.org> - 2015-09-10 21:30 +0200
  Re: [PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io ==  true Mark Brown <broonie@kernel.org> - 2015-09-11 12:30 +0200
    Re: [PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io ==  true Stephen Boyd <sboyd@codeaurora.org> - 2015-09-11 18:20 +0200
      Re: [PATCH] regmap: Allocate buffers with GFP_ATOMIC when fast_io ==  true Mark Brown <broonie@kernel.org> - 2015-09-11 19:30 +0200

csiph-web