Re: [dm-devel] [PATCH v2 01/21] scatterlist: Introduce sg_map helper functions

2017-04-26 Thread Christoph Hellwig
On Wed, Apr 26, 2017 at 12:11:33PM -0600, Logan Gunthorpe wrote: > Ok, well for starters I think you are mistaken about kmap being able to > fail. I'm having a hard time finding many users of that function that > bother to check for an error when calling it. A quick audit of the arch code shows yo

Re: [dm-devel] [PATCH 13/13] dm, dm-mpath: Make it easier to detect unintended I/O request flushes

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > I/O errors triggered by multipathd incorrectly not enabling the > no-flush flag for DM_DEVICE_SUSPEND or DM_DEVICE_RESUME are hard to > debug. Add more logging to make it easier to debug this. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reineck

Re: [dm-devel] [PATCH 12/13] dm-mpath: Introduce assign_bit()

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > This patch does not change any functionality but makes the code > easier to read. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke > --- > drivers/md/dm-mpath.c | 37 - > 1 file changed, 16 insertions(+

Re: [dm-devel] [PATCH 11/13] dm-mpath: Micro-optimize the hot path

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > Instead of checking MPATHF_QUEUE_IF_NO_PATH, > MPATHF_SAVED_QUEUE_IF_NO_PATH and the no_flush flag to decide whether > or not to push back a request if there are no paths available, only > clear MPATHF_QUEUE_IF_NO_PATH in queue_if_no_path() if no_flu

Re: [dm-devel] small dm mpath cleanups

2017-04-26 Thread h...@lst.de
On Wed, Apr 26, 2017 at 06:41:27PM +, Bart Van Assche wrote: > On Wed, 2017-04-26 at 09:40 +0200, Christoph Hellwig wrote: > > this series has some prep patches for my work to have proper, type > > checked block errors codes. One fallout of that is that we need to > > get rid of how dm overloa

Re: [dm-devel] [PATCH 08/13] dm: Verify suspend_locking assumptions at runtime

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > Ensure that the assumptions about the caller holding suspend_lock > are checked at runtime if lockdep is enabled. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke > --- > drivers/md/dm-table.c | 4 > drivers/md/dm.c | 9 ---

Re: [dm-devel] [PATCH 10/13] dm: Introduce enum dm_queue_mode

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > Introduce an enumeration type for the queue mode. This patch does > not change any functionality but makes the dm code easier to read. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke > --- > drivers/md/dm-core.h | 2 +- > drive

Re: [dm-devel] [PATCH 09/13] dm-mpath: Verify locking assumptions at runtime

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > Verify at runtime that __pg_init_all_paths() is called with > multipath.lock held if lockdep is enabled. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke > --- > drivers/md/dm-mpath.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --

Re: [dm-devel] [PATCH 08/13] dm: Verify suspend_locking assumptions at runtime

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > Ensure that the assumptions about the caller holding suspend_lock > are checked at runtime if lockdep is enabled. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke > --- > drivers/md/dm-table.c | 4 > drivers/md/dm.c | 9 ---

Re: [dm-devel] [PATCH 06/13] dm-rq: Check blk_mq_register_dev() return value

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > blk_mq_register_dev() can fail. Hence check the return value of > that function. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke > Cc: Christoph Hellwig > --- > drivers/md/dm-rq.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletio

Re: [dm-devel] [PATCH 07/13] dm, persistence: Remove an unused argument from dm_block_manager_create()

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > The 'cache_size' argument of dm_block_manager_create() has never > been used. Hence remove it and also the definitions of the constants > passed as 'cache_size' argument. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke > --- > drivers/md

Re: [dm-devel] [PATCH 05/13] dm-mpath: Make it easier to analyze requeuing behavior

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > When debugging the dm-mpath driver it is important to know what > decisions have been taken with regard to requeuing. Hence this > patch that adds pr_debug() statements that report what decisions > have been taken. > > Signed-off-by: Bart Van Assche

Re: [dm-devel] [PATCH 04/13] dm-rq: Adjust requeuing delays

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > Reduce the requeue delay in dm_requeue_original_request() from 5s > to 0.5s to avoid that this delay slows down failover or failback. > Increase the requeue delay in dm_mq_queue_rq() from 0.1s to 0.5s > to reduce the system load if immediate requeuin

Re: [dm-devel] [PATCH 03/13] dm-mpath: Delay requeuing while path initialization is in progress

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > Requeuing a request immediately while path initialization is ongoing > causes high CPU usage, something that is undesired. Hence delay > requeuing while path initialization is in progress. > > Signed-off-by: Bart Van Assche > Cc: Hannes Reinecke >

Re: [dm-devel] [PATCH 02/13] dm-mpath: Avoid that path removal can trigger an infinite loop

2017-04-26 Thread Hannes Reinecke
On 04/26/2017 08:37 PM, Bart Van Assche wrote: > If blk_get_request() fails check whether the failure is due to > a path being removed. If that is the case fail the path by > triggering a call to fail_path(). This patch avoids that the > following scenario can be encountered while removing paths: >

Re: [dm-devel] [PATCH v2 07/21] crypto: shash, caam: Make use of the new sg_map helper function

2017-04-26 Thread Herbert Xu
On Tue, Apr 25, 2017 at 12:20:54PM -0600, Logan Gunthorpe wrote: > Very straightforward conversion to the new function in the caam driver > and shash library. > > Signed-off-by: Logan Gunthorpe > Cc: Herbert Xu > Cc: "David S. Miller" > --- > crypto/shash.c| 9 ++--- > driv

Re: [dm-devel] small dm mpath cleanups

2017-04-26 Thread Mike Snitzer
On Wed, Apr 26 2017 at 2:41pm -0400, Bart Van Assche wrote: > On Wed, 2017-04-26 at 09:40 +0200, Christoph Hellwig wrote: > > this series has some prep patches for my work to have proper, type > > checked block errors codes. One fallout of that is that we need to > > get rid of how dm overloads

Re: [dm-devel] small dm mpath cleanups

2017-04-26 Thread Bart Van Assche
On Wed, 2017-04-26 at 09:40 +0200, Christoph Hellwig wrote: > this series has some prep patches for my work to have proper, type > checked block errors codes. One fallout of that is that we need to > get rid of how dm overloads a few return values with either internal > positive error codes or neg

[dm-devel] [PATCH 10/13] dm: Introduce enum dm_queue_mode

2017-04-26 Thread Bart Van Assche
Introduce an enumeration type for the queue mode. This patch does not change any functionality but makes the dm code easier to read. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke --- drivers/md/dm-core.h | 2 +- drivers/md/dm-ioctl.c | 2 +- drivers/md/dm-mpath.c

[dm-devel] [PATCH 06/13] dm-rq: Check blk_mq_register_dev() return value

2017-04-26 Thread Bart Van Assche
blk_mq_register_dev() can fail. Hence check the return value of that function. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig --- drivers/md/dm-rq.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index

[dm-devel] [PATCH 05/13] dm-mpath: Make it easier to analyze requeuing behavior

2017-04-26 Thread Bart Van Assche
When debugging the dm-mpath driver it is important to know what decisions have been taken with regard to requeuing. Hence this patch that adds pr_debug() statements that report what decisions have been taken. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig --- drivers/

[dm-devel] [PATCH 13/13] dm, dm-mpath: Make it easier to detect unintended I/O request flushes

2017-04-26 Thread Bart Van Assche
I/O errors triggered by multipathd incorrectly not enabling the no-flush flag for DM_DEVICE_SUSPEND or DM_DEVICE_RESUME are hard to debug. Add more logging to make it easier to debug this. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke --- drivers/md/dm-mpath.c | 25 +---

[dm-devel] [PATCH 12/13] dm-mpath: Introduce assign_bit()

2017-04-26 Thread Bart Van Assche
This patch does not change any functionality but makes the code easier to read. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke --- drivers/md/dm-mpath.c | 37 - 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/md/dm-mpath.c b/driver

[dm-devel] [PATCH 00/13] Device mapper and dm-mpath patches

2017-04-26 Thread Bart Van Assche
Hello Mike, The patches in this series are: * A few fixes for bugs in the dm-mpath driver I ran into while testing this driver. * A resend of various dm / dm-mpath patches I had posted before but for which I'm still waiting for a review from you. Please consider at least the dm-mpath bug fixe

[dm-devel] [PATCH 03/13] dm-mpath: Delay requeuing while path initialization is in progress

2017-04-26 Thread Bart Van Assche
Requeuing a request immediately while path initialization is ongoing causes high CPU usage, something that is undesired. Hence delay requeuing while path initialization is in progress. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: --- drivers/md/dm-mpath.c | 12

[dm-devel] [PATCH 02/13] dm-mpath: Avoid that path removal can trigger an infinite loop

2017-04-26 Thread Bart Van Assche
If blk_get_request() fails check whether the failure is due to a path being removed. If that is the case fail the path by triggering a call to fail_path(). This patch avoids that the following scenario can be encountered while removing paths: * CPU usage of a kworker thread jumps to 100%. * Removin

[dm-devel] [PATCH 11/13] dm-mpath: Micro-optimize the hot path

2017-04-26 Thread Bart Van Assche
Instead of checking MPATHF_QUEUE_IF_NO_PATH, MPATHF_SAVED_QUEUE_IF_NO_PATH and the no_flush flag to decide whether or not to push back a request if there are no paths available, only clear MPATHF_QUEUE_IF_NO_PATH in queue_if_no_path() if no_flush has not been set. The result is that only a single b

[dm-devel] [PATCH 07/13] dm, persistence: Remove an unused argument from dm_block_manager_create()

2017-04-26 Thread Bart Van Assche
The 'cache_size' argument of dm_block_manager_create() has never been used. Hence remove it and also the definitions of the constants passed as 'cache_size' argument. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke --- drivers/md/dm-cache-metadata.c| 3 --- drivers/md/dm-era-

[dm-devel] [PATCH 01/13] dm-mpath: Split activate_path()

2017-04-26 Thread Bart Van Assche
This patch does not change any functionality but makes the next patch in this series easier to read. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: --- drivers/md/dm-mpath.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/driver

[dm-devel] [PATCH 04/13] dm-rq: Adjust requeuing delays

2017-04-26 Thread Bart Van Assche
Reduce the requeue delay in dm_requeue_original_request() from 5s to 0.5s to avoid that this delay slows down failover or failback. Increase the requeue delay in dm_mq_queue_rq() from 0.1s to 0.5s to reduce the system load if immediate requeuing has been requested by the dm driver. Signed-off-by:

[dm-devel] [PATCH 08/13] dm: Verify suspend_locking assumptions at runtime

2017-04-26 Thread Bart Van Assche
Ensure that the assumptions about the caller holding suspend_lock are checked at runtime if lockdep is enabled. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke --- drivers/md/dm-table.c | 4 drivers/md/dm.c | 9 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --gi

[dm-devel] [PATCH 09/13] dm-mpath: Verify locking assumptions at runtime

2017-04-26 Thread Bart Van Assche
Verify at runtime that __pg_init_all_paths() is called with multipath.lock held if lockdep is enabled. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke --- drivers/md/dm-mpath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index fb4b7228f

Re: [dm-devel] [PATCH v2 01/21] scatterlist: Introduce sg_map helper functions

2017-04-26 Thread Christian König
Am 25.04.2017 um 20:20 schrieb Logan Gunthorpe: This patch introduces functions which kmap the pages inside an sgl. These functions replace a common pattern of kmap(sg_page(sg)) that is used in more than 50 places within the kernel. The motivation for this work is to eventually safely support sg

Re: [dm-devel] [mdadm PATCH 4/4] Create: tell udev device is not ready when first created.

2017-04-26 Thread Peter Rajnoha
On 04/20/2017 11:35 PM, NeilBrown wrote: > On Thu, Apr 20 2017, Jes Sorensen wrote: ... >> Second, isn't this going to be racey if you have multiple arrays >> running? I am wondering if we cannot find a solution that relies on a >> permanently installed udev rule that we enable/disable with syste

Re: [dm-devel] [PATCH v2 15/21] xen-blkfront: Make use of the new sg_map helper function

2017-04-26 Thread Roger Pau Monné
On Tue, Apr 25, 2017 at 12:21:02PM -0600, Logan Gunthorpe wrote: > Straightforward conversion to the new helper, except due to the lack > of error path, we have to use SG_MAP_MUST_NOT_FAIL which may BUG_ON in > certain cases in the future. > > Signed-off-by: Logan Gunthorpe > Cc: Boris Ostrovsky

[dm-devel] [PATCH 1/4] dm mpath: merge do_end_io into multipath_end_io

2017-04-26 Thread Christoph Hellwig
This simplifies the I/O completion path a bit. Signed-off-by: Christoph Hellwig --- drivers/md/dm-mpath.c | 53 +-- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 2950b145443d..19

[dm-devel] [PATCH 4/4] dm: introduce a new DM_MAPIO_KILL return value

2017-04-26 Thread Christoph Hellwig
This untangles the DM_MAPIO_* values returned from ->clone_and_map_rq from the error codes used by the block layer. Signed-off-by: Christoph Hellwig --- drivers/md/dm-rq.c| 12 +--- drivers/md/dm-target.c| 2 +- include/linux/device-mapper.h | 1 + 3 files changed,

[dm-devel] [PATCH 2/4] dm rq: change ->rq_end_io calling conventions

2017-04-26 Thread Christoph Hellwig
Instead of returning either a DM_ENDIO_* constant or an error code, add a new DM_ENDIO_DONE value that means keep errno as is. This allows us to easily keep the existing error code in case where we can't push back, and it also preparares for the new block level status codes with strict type checki

[dm-devel] small dm mpath cleanups

2017-04-26 Thread Christoph Hellwig
Hi Mike, this series has some prep patches for my work to have proper, type checked block errors codes. One fallout of that is that we need to get rid of how dm overloads a few return values with either internal positive error codes or negative errno values. This patches does that, which happens

[dm-devel] [PATCH 3/4] dm mpath: simplify multipath_clone_and_map a little bit

2017-04-26 Thread Christoph Hellwig
Remove the r variable and just expand the value at the two places where it is used. Signed-off-by: Christoph Hellwig --- drivers/md/dm-mpath.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 9e971be254f4..33ecda737376 1

Re: [dm-devel] [PATCH v2 02/21] libiscsi: Add an internal error code

2017-04-26 Thread Christoph Hellwig
On Tue, Apr 25, 2017 at 12:20:49PM -0600, Logan Gunthorpe wrote: > This is a prep patch to add a new error code to libiscsi. We want to > rework some kmap calls to be able to fail. When we do, we'd like to > use this error code. The kmap case in iscsi_tcp_segment_map can already fail. Please add

Re: [dm-devel] [PATCH v2 01/21] scatterlist: Introduce sg_map helper functions

2017-04-26 Thread Christoph Hellwig
On Tue, Apr 25, 2017 at 12:20:48PM -0600, Logan Gunthorpe wrote: > This patch introduces functions which kmap the pages inside an sgl. > These functions replace a common pattern of kmap(sg_page(sg)) that is > used in more than 50 places within the kernel. > > The motivation for this work is to eve

Re: [dm-devel] [PATCH] dm ioctl: prevent stack leak in dm ioctl call

2017-04-26 Thread Adrian Salido
> On Tue, Apr 25, 2017 at 04:31:29PM -0700, Adrian Salido wrote: >> Struct dm_ioctl has some padding/data that is not explicitly cleared >> before copying to user. This can cause kernel stack contents to be >> leaked to user space. > > Please be more precise here, explaining which part of the buffe

[dm-devel] [PATCH v2 09/21] staging: unisys: visorbus: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Straightforward conversion to the new function. Signed-off-by: Logan Gunthorpe Acked-by: David Kershner --- drivers/staging/unisys/visorhba/visorhba_main.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers

[dm-devel] [PATCH v2 11/21] scsi: ipr, pmcraid, isci: Make use of the new sg_map helper

2017-04-26 Thread Logan Gunthorpe
Very straightforward conversion of three scsi drivers. Signed-off-by: Logan Gunthorpe Cc: Brian King Cc: Artur Paszkiewicz --- drivers/scsi/ipr.c | 27 ++- drivers/scsi/isci/request.c | 42 +- drivers/scsi/pmcraid.c

[dm-devel] [PATCH v2 07/21] crypto: shash, caam: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Very straightforward conversion to the new function in the caam driver and shash library. Signed-off-by: Logan Gunthorpe Cc: Herbert Xu Cc: "David S. Miller" --- crypto/shash.c| 9 ++--- drivers/crypto/caam/caamalg.c | 8 +++- 2 files changed, 9 insertions(+), 8 deletio

[dm-devel] [PATCH v2 10/21] RDS: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Straightforward conversion except there's no error path, so we make use of SG_MAP_MUST_NOT_FAIL which may BUG_ON in certain cases in the future. Signed-off-by: Logan Gunthorpe Cc: Santosh Shilimkar Cc: "David S. Miller" --- net/rds/ib_recv.c | 8 1 file changed, 4 insertions(+), 4 del

[dm-devel] [PATCH v2 04/21] target: Make use of the new sg_map function at 16 call sites

2017-04-26 Thread Logan Gunthorpe
Fairly straightforward conversions in all spots. In a couple of cases any error gets propogated up should sg_map fail. In other cases a warning is issued if the kmap fails seeing there's no clear error path. This should not be an issue until someone tries to use unmappable memory in the sgl with th

Re: [dm-devel] [kbuild-all] [PATCH v3] axon_ram: add dax_operations support

2017-04-26 Thread Ye Xiaolong
On 04/19, Dan Williams wrote: >On Wed, Apr 19, 2017 at 8:01 PM, kbuild test robot wrote: >> Hi Dan, >> >> [auto build test ERROR on powerpc/next] >> [also build test ERROR on v4.11-rc7 next-20170419] >> [if your patch is applied to the wrong git tree, please drop us a note to >> help improve the

[dm-devel] [PATCH v2 12/21] scsi: hisi_sas, mvsas, gdth: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Very straightforward conversion of three scsi drivers. Signed-off-by: Logan Gunthorpe Cc: Achim Leubner Cc: John Garry --- drivers/scsi/gdth.c| 9 +++-- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 14 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 13 +---

Re: [dm-devel] [PATCH] dm ioctl: prevent stack leak in dm ioctl call

2017-04-26 Thread Adrian Salido
the problem could be as simple as On Tue, Apr 25, 2017 at 5:42 PM, Alasdair G Kergon wrote: > On Tue, Apr 25, 2017 at 05:33:19PM -0700, Adrian Salido wrote: >> it's actually the data portion of the struct under a custom user ioctl >> where (param_kernel->data_size - minimum_data_size) < >> sizeof

[dm-devel] [PATCH v2 05/21] drm/i915: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
This is a single straightforward conversion from kmap to sg_map. We also create the i915_gem_object_unmap function to common up the unmap code. Signed-off-by: Logan Gunthorpe Acked-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_gem.c | 27 --- 1 file changed, 16 insert

[dm-devel] [PATCH v2 13/21] scsi: arcmsr, ips, megaraid: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Very straightforward conversion of three scsi drivers Signed-off-by: Logan Gunthorpe Cc: Adaptec OEM Raid Solutions Cc: Kashyap Desai Cc: Sumit Saxena Cc: Shivasharan S --- drivers/scsi/arcmsr/arcmsr_hba.c | 16 drivers/scsi/ips.c | 8 drivers/scsi/me

[dm-devel] [PATCH v2 00/21] Introduce common scatterlist map function

2017-04-26 Thread Logan Gunthorpe
Changes since v1: * Rebased onto next-20170424 * Removed the _offset version of these functions per Christoph's suggestion * Added an SG_MAP_MUST_NOT_FAIL flag which will BUG_ON in future cases that can't gracefully fail. This removes a bunch of the noise added in v1 to a couple of the drive

[dm-devel] [PATCH] dm ioctl: prevent stack leak in dm ioctl call

2017-04-26 Thread Adrian Salido
Struct dm_ioctl has some padding/data that is not explicitly cleared before copying to user. This can cause kernel stack contents to be leaked to user space. Cc: sta...@vger.kernel.org Signed-off-by: Adrian Salido --- drivers/md/dm-ioctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/driv

[dm-devel] [PATCH v2 01/21] scatterlist: Introduce sg_map helper functions

2017-04-26 Thread Logan Gunthorpe
This patch introduces functions which kmap the pages inside an sgl. These functions replace a common pattern of kmap(sg_page(sg)) that is used in more than 50 places within the kernel. The motivation for this work is to eventually safely support sgls that contain io memory. In order for that to wo

[dm-devel] [PATCH v2 15/21] xen-blkfront: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Straightforward conversion to the new helper, except due to the lack of error path, we have to use SG_MAP_MUST_NOT_FAIL which may BUG_ON in certain cases in the future. Signed-off-by: Logan Gunthorpe Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Konrad Rzeszutek Wilk Cc: "Roger Pau Monné" --- dr

[dm-devel] [PATCH v2 17/21] mmc: spi: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
We use the sg_map helper but it's slightly more complicated as we only check for the error when the mapping actually gets used. Such that if the mapping failed but wasn't needed then no error occurs. Signed-off-by: Logan Gunthorpe Cc: Ulf Hansson --- drivers/mmc/host/mmc_spi.c | 26

[dm-devel] [PATCH v2 08/21] dm-crypt: Make use of the new sg_map helper in 4 call sites

2017-04-26 Thread Logan Gunthorpe
Very straightforward conversion to the new function in all four spots. Signed-off-by: Logan Gunthorpe Cc: Alasdair Kergon Cc: Mike Snitzer --- drivers/md/dm-crypt.c | 39 ++- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/md/dm-crypt

[dm-devel] [PATCH v2 19/21] mmc: sdricoh_cs: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
This is a straightforward conversion to the new function. Signed-off-by: Logan Gunthorpe Cc: Sascha Sommer Cc: Ulf Hansson --- drivers/mmc/host/sdricoh_cs.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdric

[dm-devel] [PATCH v2 18/21] mmc: tmio: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Straightforward conversion to sg_map helper. Seeing there is no cleare error path, SG_MAP_MUST_NOT_FAIL which may BUG_ON in certain cases in the future. Signed-off-by: Logan Gunthorpe Cc: Wolfram Sang Cc: Ulf Hansson --- drivers/mmc/host/tmio_mmc.h | 7 +-- drivers/mmc/host/tmio_mmc_p

[dm-devel] [PATCH v2 21/21] memstick: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Straightforward conversion, but we have to make use of SG_MAP_MUST_NOT_FAIL which may BUG_ON in certain cases in the future. Signed-off-by: Logan Gunthorpe Cc: Alex Dubov --- drivers/memstick/host/jmb38x_ms.c | 11 ++- drivers/memstick/host/tifm_ms.c | 11 ++- 2 files changed,

[dm-devel] [PATCH v2 16/21] mmc: sdhci: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Straightforward conversion, except due to the lack of an error path we have to use SG_MAP_MUST_NOT_FAIL which may BUG_ON in certain cases in the future. Signed-off-by: Logan Gunthorpe Cc: Adrian Hunter Cc: Ulf Hansson --- drivers/mmc/host/sdhci.c | 14 +- 1 file changed, 9 insertio

[dm-devel] [PATCH v2 06/21] crypto: hifn_795x: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Conversion of a couple kmap_atomic instances to the sg_map helper function. However, it looks like there was a bug in the original code: the source scatter lists offset (t->offset) was passed to ablkcipher_get which added it to the destination address. This doesn't make a lot of sense, but t->offs

[dm-devel] [PATCH v2 03/21] libiscsi: Make use of new the sg_map helper function

2017-04-26 Thread Logan Gunthorpe
Convert the kmap and kmap_atomic uses to the sg_map function. We now store the flags for the kmap instead of a boolean to indicate atomicitiy. We use ISCSI_TCP_INTERNAL_ERR error type that was prepared earlier for this. Signed-off-by: Logan Gunthorpe Cc: Lee Duncan Cc: Chris Leech --- drivers/

[dm-devel] [PATCH v2 14/21] scsi: libfc, csiostor: Change to sg_copy_buffer in two drivers

2017-04-26 Thread Logan Gunthorpe
These two drivers appear to duplicate the functionality of sg_copy_buffer. So we clean them up to use the common code. This helps us remove a couple of instances that would otherwise be slightly tricky sg_map usages. Signed-off-by: Logan Gunthorpe Cc: Johannes Thumshirn --- drivers/scsi/csiost

[dm-devel] [PATCH v2 02/21] libiscsi: Add an internal error code

2017-04-26 Thread Logan Gunthorpe
This is a prep patch to add a new error code to libiscsi. We want to rework some kmap calls to be able to fail. When we do, we'd like to use this error code. This patch simply introduces ISCSI_TCP_INTERNAL_ERR and prints "Internal Error." when it gets hit. Signed-off-by: Logan Gunthorpe --- dri

[dm-devel] [PATCH v2 20/21] mmc: tifm_sd: Make use of the new sg_map helper function

2017-04-26 Thread Logan Gunthorpe
This conversion is a bit complicated. We modiy the read_fifo, write_fifo and copy_page functions to take a scatterlist instead of a page. Thus we can use sg_map instead of kmap_atomic. There's a bit of accounting that needed to be done for the offset for this to work. (Seeing sg_map takes care of t