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


Groups > linux.kernel > #1623387 > unrolled thread

[PATCH 00/22] Introduce common scatterlist map function

Started byLogan Gunthorpe <logang@deltatee.com>
First post2017-04-14 00:20 +0200
Last post2017-04-18 17:50 +0200
Articles 6 on this page of 26 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [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

Page 2 of 2 — ← Prev page 1 [2]


#1623508 — Re: [PATCH 02/22] nvmet: Make use of the new sg_map helper function

FromChristoph Hellwig <hch@lst.de>
Date2017-04-14 07:10 +0200
SubjectRe: [PATCH 02/22] nvmet: Make use of the new sg_map helper function
Message-ID<tw1EB-5pR-1@gated-at.bofh.it>
In reply to#1623399
On Thu, Apr 13, 2017 at 04:05:15PM -0600, Logan Gunthorpe wrote:
> This is a straight forward conversion in two places. Should kmap fail,
> the code will return an INVALD_DATA error in the completion.

It really should be using nvmet_copy_from_sgl to make things safer,
as we don't want to rely on any particular SG list layout.  In fact
I'm pretty sure I did the conversion at some point, but it must never
have made it upstream.

[toc] | [prev] | [next] | [standalone]


#1623509 — Re: [PATCH 02/22] nvmet: Make use of the new sg_map helper function

FromLogan Gunthorpe <logang@deltatee.com>
Date2017-04-14 07:10 +0200
SubjectRe: [PATCH 02/22] nvmet: Make use of the new sg_map helper function
Message-ID<tw1EC-5pR-3@gated-at.bofh.it>
In reply to#1623508

On 13/04/17 10:59 PM, Christoph Hellwig wrote:
> On Thu, Apr 13, 2017 at 04:05:15PM -0600, Logan Gunthorpe wrote:
>> This is a straight forward conversion in two places. Should kmap fail,
>> the code will return an INVALD_DATA error in the completion.
> 
> It really should be using nvmet_copy_from_sgl to make things safer,
> as we don't want to rely on any particular SG list layout.  In fact
> I'm pretty sure I did the conversion at some point, but it must never
> have made it upstream.

Ha, I did the conversion too a couple times for my RFC series. I can
change this patch to do that. Or maybe I'll just send a patch for that
separately seeing it doesn't depend on anything and is pretty simple. I
can do that next week.

Thanks,

Logan

[toc] | [prev] | [next] | [standalone]


#1623513 — Re: [PATCH 02/22] nvmet: Make use of the new sg_map helper function

FromChristoph Hellwig <hch@lst.de>
Date2017-04-14 07:20 +0200
SubjectRe: [PATCH 02/22] nvmet: Make use of the new sg_map helper function
Message-ID<tw1Oh-5tU-9@gated-at.bofh.it>
In reply to#1623509
On Thu, Apr 13, 2017 at 11:06:16PM -0600, Logan Gunthorpe wrote:
> Or maybe I'll just send a patch for that
> separately seeing it doesn't depend on anything and is pretty simple. I
> can do that next week.

Yes, please just send that patch linux-nvme, we should be able to get
it into 4.12.

[toc] | [prev] | [next] | [standalone]


#1623400 — [PATCH 05/22] drm/i915: Make use of the new sg_map helper function

FromLogan Gunthorpe <logang@deltatee.com>
Date2017-04-14 00:20 +0200
Subject[PATCH 05/22] drm/i915: Make use of the new sg_map helper function
Message-ID<tvVfR-Tr-41@gated-at.bofh.it>
In reply to#1623387
This is a single straightforward conversion from kmap to sg_map.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 67b1fc5..1b1b91a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2188,6 +2188,15 @@ static void __i915_gem_object_reset_page_iter(struct drm_i915_gem_object *obj)
 		radix_tree_delete(&obj->mm.get_page.radix, iter.index);
 }
 
+static void i915_gem_object_unmap(const struct drm_i915_gem_object *obj,
+				  void *ptr)
+{
+	if (is_vmalloc_addr(ptr))
+		vunmap(ptr);
+	else
+		sg_unmap(obj->mm.pages->sgl, ptr, SG_KMAP);
+}
+
 void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
 				 enum i915_mm_subclass subclass)
 {
@@ -2215,10 +2224,7 @@ void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
 		void *ptr;
 
 		ptr = ptr_mask_bits(obj->mm.mapping);
-		if (is_vmalloc_addr(ptr))
-			vunmap(ptr);
-		else
-			kunmap(kmap_to_page(ptr));
+		i915_gem_object_unmap(obj, ptr);
 
 		obj->mm.mapping = NULL;
 	}
@@ -2475,8 +2481,11 @@ static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,
 	void *addr;
 
 	/* A single page can always be kmapped */
-	if (n_pages == 1 && type == I915_MAP_WB)
-		return kmap(sg_page(sgt->sgl));
+	if (n_pages == 1 && type == I915_MAP_WB) {
+		addr = sg_map(sgt->sgl, SG_KMAP);
+		if (IS_ERR(addr))
+			return NULL;
+	}
 
 	if (n_pages > ARRAY_SIZE(stack_pages)) {
 		/* Too big for stack -- allocate temporary array instead */
@@ -2543,11 +2552,7 @@ void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
 			goto err_unpin;
 		}
 
-		if (is_vmalloc_addr(ptr))
-			vunmap(ptr);
-		else
-			kunmap(kmap_to_page(ptr));
-
+		i915_gem_object_unmap(obj, ptr);
 		ptr = obj->mm.mapping = NULL;
 	}
 
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1625074 — Re: [PATCH 05/22] drm/i915: Make use of the new sg_map helper function

FromDaniel Vetter <daniel@ffwll.ch>
Date2017-04-18 08:50 +0200
SubjectRe: [PATCH 05/22] drm/i915: Make use of the new sg_map helper function
Message-ID<txv7z-2Ti-5@gated-at.bofh.it>
In reply to#1623400
On Thu, Apr 13, 2017 at 04:05:18PM -0600, Logan Gunthorpe wrote:
> This is a single straightforward conversion from kmap to sg_map.
> 
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Probably makes sense to merge through some other tree, but please be aware
of the considerable churn rate in i915 (i.e. make sure your tree is in
linux-next before you send a pull request for this). Plane B would be to
get the prep patch in first and then merge the i915 conversion one kernel
release later.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 67b1fc5..1b1b91a 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2188,6 +2188,15 @@ static void __i915_gem_object_reset_page_iter(struct drm_i915_gem_object *obj)
>  		radix_tree_delete(&obj->mm.get_page.radix, iter.index);
>  }
>  
> +static void i915_gem_object_unmap(const struct drm_i915_gem_object *obj,
> +				  void *ptr)
> +{
> +	if (is_vmalloc_addr(ptr))
> +		vunmap(ptr);
> +	else
> +		sg_unmap(obj->mm.pages->sgl, ptr, SG_KMAP);
> +}
> +
>  void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
>  				 enum i915_mm_subclass subclass)
>  {
> @@ -2215,10 +2224,7 @@ void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
>  		void *ptr;
>  
>  		ptr = ptr_mask_bits(obj->mm.mapping);
> -		if (is_vmalloc_addr(ptr))
> -			vunmap(ptr);
> -		else
> -			kunmap(kmap_to_page(ptr));
> +		i915_gem_object_unmap(obj, ptr);
>  
>  		obj->mm.mapping = NULL;
>  	}
> @@ -2475,8 +2481,11 @@ static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,
>  	void *addr;
>  
>  	/* A single page can always be kmapped */
> -	if (n_pages == 1 && type == I915_MAP_WB)
> -		return kmap(sg_page(sgt->sgl));
> +	if (n_pages == 1 && type == I915_MAP_WB) {
> +		addr = sg_map(sgt->sgl, SG_KMAP);
> +		if (IS_ERR(addr))
> +			return NULL;
> +	}
>  
>  	if (n_pages > ARRAY_SIZE(stack_pages)) {
>  		/* Too big for stack -- allocate temporary array instead */
> @@ -2543,11 +2552,7 @@ void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
>  			goto err_unpin;
>  		}
>  
> -		if (is_vmalloc_addr(ptr))
> -			vunmap(ptr);
> -		else
> -			kunmap(kmap_to_page(ptr));
> -
> +		i915_gem_object_unmap(obj, ptr);
>  		ptr = obj->mm.mapping = NULL;
>  	}
>  
> -- 
> 2.1.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

[toc] | [prev] | [next] | [standalone]


#1625408 — Re: [PATCH 05/22] drm/i915: Make use of the new sg_map helper function

FromLogan Gunthorpe <logang@deltatee.com>
Date2017-04-18 17:50 +0200
SubjectRe: [PATCH 05/22] drm/i915: Make use of the new sg_map helper function
Message-ID<txDya-7Sz-7@gated-at.bofh.it>
In reply to#1625074

On 18/04/17 12:44 AM, Daniel Vetter wrote:
> On Thu, Apr 13, 2017 at 04:05:18PM -0600, Logan Gunthorpe wrote:
>> This is a single straightforward conversion from kmap to sg_map.
>>
>> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> 
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Probably makes sense to merge through some other tree, but please be aware
> of the considerable churn rate in i915 (i.e. make sure your tree is in
> linux-next before you send a pull request for this). Plane B would be to
> get the prep patch in first and then merge the i915 conversion one kernel
> release later.

Yes, as per what I said in my cover letter, I was leaning towards a
"Plan B" style approach.

Logan

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web