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


Groups > linux.kernel > #1625353

RE: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper function

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper function
Date 2017-04-18 16:20 +0200
Message-ID <txC94-7aw-11@gated-at.bofh.it> (permalink)
References <tvV69-P8-5@gated-at.bofh.it> <tvVfQ-Tr-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Logan Gunthorpe
> Sent: 13 April 2017 23:05
> Straightforward conversion to the new helper, except due to
> the lack of error path, we have to warn if unmapable memory
> is ever present in the sgl.
> 
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> ---
>  drivers/block/xen-blkfront.c | 33 +++++++++++++++++++++++++++------
>  1 file changed, 27 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 5067a0a..7dcf41d 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -807,8 +807,19 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri
>  		BUG_ON(sg->offset + sg->length > PAGE_SIZE);
> 
>  		if (setup.need_copy) {
> -			setup.bvec_off = sg->offset;
> -			setup.bvec_data = kmap_atomic(sg_page(sg));
> +			setup.bvec_off = 0;
> +			setup.bvec_data = sg_map(sg, SG_KMAP_ATOMIC);
> +			if (IS_ERR(setup.bvec_data)) {
> +				/*
> +				 * This should really never happen unless
> +				 * the code is changed to use memory that is
> +				 * not mappable in the sg. Seeing there is a
> +				 * questionable error path out of here,
> +				 * we WARN.
> +				 */
> +				WARN(1, "Non-mappable memory used in sg!");
> +				return 1;
> +			}
...

Perhaps add a flag to mark failure as 'unexpected' and trace (and panic?)
inside sg_map().

	David

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


Thread

[PATCH 00/22] Introduce common scatterlist map function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 18/22] mmc: spi: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 06/22] crypto: hifn_795x: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 04/22] target: Make use of the new sg_map function at 16 call sites Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
    RE: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper  function David Laight <David.Laight@ACULAB.COM> - 2017-04-18 16:20 +0200
      Re: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper  function Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> - 2017-04-18 16:40 +0200
        Re: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper  function Logan Gunthorpe <logang@deltatee.com> - 2017-04-18 17:50 +0200
          Re: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper  function Logan Gunthorpe <logang@deltatee.com> - 2017-04-18 18:00 +0200
          Re: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper  function Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> - 2017-04-18 18:00 +0200
  [PATCH 10/22] staging: unisys: visorbus: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
    RE: [PATCH 10/22] staging: unisys: visorbus: Make use of the new  sg_map helper function "Kershner, David A" <David.Kershner@unisys.com> - 2017-04-14 18:10 +0200
      Re: [PATCH 10/22] staging: unisys: visorbus: Make use of the new  sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 18:20 +0200
  [PATCH 07/22] crypto: shash, caam: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 12/22] scsi: ipr, pmcraid, isci: Make use of the new sg_map helper in 4 call sites Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 15/22] scsi: libfc, csiostor: Change to sg_copy_buffer in two drivers Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 17/22] mmc: sdhci: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 22/22] memstick: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 19/22] mmc: tmio: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
  [PATCH 02/22] nvmet: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
    Re: [PATCH 02/22] nvmet: Make use of the new sg_map helper function Christoph Hellwig <hch@lst.de> - 2017-04-14 07:10 +0200
      Re: [PATCH 02/22] nvmet: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 07:10 +0200
        Re: [PATCH 02/22] nvmet: Make use of the new sg_map helper function Christoph Hellwig <hch@lst.de> - 2017-04-14 07:20 +0200
  [PATCH 05/22] drm/i915: Make use of the new sg_map helper function Logan Gunthorpe <logang@deltatee.com> - 2017-04-14 00:20 +0200
    Re: [PATCH 05/22] drm/i915: Make use of the new sg_map helper  function Daniel Vetter <daniel@ffwll.ch> - 2017-04-18 08:50 +0200
      Re: [PATCH 05/22] drm/i915: Make use of the new sg_map helper  function Logan Gunthorpe <logang@deltatee.com> - 2017-04-18 17:50 +0200

csiph-web