linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t
@ 2018-05-22 18:13 Souptick Joarder
  2018-06-01  5:41 ` Souptick Joarder
  2018-06-08  6:17 ` Tomi Valkeinen
  0 siblings, 2 replies; 6+ messages in thread
From: Souptick Joarder @ 2018-05-22 18:13 UTC (permalink / raw)
  To: tomi.valkeinen, airlied; +Cc: dri-devel, linux-kernel, willy

Use new return type vm_fault_t for fault handler. For
now, this is just documenting that the function returns
a VM_FAULT value rather than an errno. Once all instances
are converted, vm_fault_t will become a distinct type.

Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")

Previously vm_insert_mixed() returns err which driver
mapped into VM_FAULT_* type. Also return value of
vm_insert_mixed() not handled correctly and 0 was
returned inside fault_2d() as default. The new function
vmf_insert_mixed() will replace this inefficiency by
returning correct VM_FAULT_* type.

vmf_error() is the newly introduce inline function
in 4.17-rc6.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
---
v2: Fixed kbuild error by initialized ret
    in fault_2d().

 drivers/gpu/drm/omapdrm/omap_gem.c | 51 +++++++++++++++++---------------------
 drivers/gpu/drm/omapdrm/omap_gem.h |  3 ++-
 2 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 0faf042..99e4300 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -371,7 +371,7 @@ size_t omap_gem_mmap_size(struct drm_gem_object *obj)
  */
 
 /* Normal handling for the case of faulting in non-tiled buffers */
-static int fault_1d(struct drm_gem_object *obj,
+static vm_fault_t fault_1d(struct drm_gem_object *obj,
 		struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct omap_gem_object *omap_obj = to_omap_bo(obj);
@@ -392,11 +392,12 @@ static int fault_1d(struct drm_gem_object *obj,
 	VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
 			pfn, pfn << PAGE_SHIFT);
 
-	return vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
+	return vmf_insert_mixed(vma, vmf->address,
+			__pfn_to_pfn_t(pfn, PFN_DEV));
 }
 
 /* Special handling for the case of faulting in 2d tiled buffers */
-static int fault_2d(struct drm_gem_object *obj,
+static vm_fault_t fault_2d(struct drm_gem_object *obj,
 		struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct omap_gem_object *omap_obj = to_omap_bo(obj);
@@ -407,7 +408,8 @@ static int fault_2d(struct drm_gem_object *obj,
 	unsigned long pfn;
 	pgoff_t pgoff, base_pgoff;
 	unsigned long vaddr;
-	int i, ret, slots;
+	int i, err, slots;
+	vm_fault_t ret = VM_FAULT_NOPAGE;
 
 	/*
 	 * Note the height of the slot is also equal to the number of pages
@@ -473,9 +475,10 @@ static int fault_2d(struct drm_gem_object *obj,
 	memset(pages + slots, 0,
 			sizeof(struct page *) * (n - slots));
 
-	ret = tiler_pin(entry->block, pages, ARRAY_SIZE(pages), 0, true);
-	if (ret) {
-		dev_err(obj->dev->dev, "failed to pin: %d\n", ret);
+	err = tiler_pin(entry->block, pages, ARRAY_SIZE(pages), 0, true);
+	if (err) {
+		ret = vmf_error(err);
+		dev_err(obj->dev->dev, "failed to pin: %d\n", err);
 		return ret;
 	}
 
@@ -485,7 +488,10 @@ static int fault_2d(struct drm_gem_object *obj,
 			pfn, pfn << PAGE_SHIFT);
 
 	for (i = n; i > 0; i--) {
-		vm_insert_mixed(vma, vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
+		ret = vmf_insert_mixed(vma,
+			vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
+		if (ret & VM_FAULT_ERROR)
+			break;
 		pfn += priv->usergart[fmt].stride_pfn;
 		vaddr += PAGE_SIZE * m;
 	}
@@ -494,7 +500,7 @@ static int fault_2d(struct drm_gem_object *obj,
 	priv->usergart[fmt].last = (priv->usergart[fmt].last + 1)
 				 % NUM_USERGART_ENTRIES;
 
-	return 0;
+	return ret;
 }
 
 /**
@@ -509,14 +515,15 @@ static int fault_2d(struct drm_gem_object *obj,
  * vma->vm_private_data points to the GEM object that is backing this
  * mapping.
  */
-int omap_gem_fault(struct vm_fault *vmf)
+vm_fault_t omap_gem_fault(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	struct drm_gem_object *obj = vma->vm_private_data;
 	struct omap_gem_object *omap_obj = to_omap_bo(obj);
 	struct drm_device *dev = obj->dev;
 	struct page **pages;
-	int ret;
+	int err;
+	vm_fault_t ret;
 
 	/* Make sure we don't parallel update on a fault, nor move or remove
 	 * something from beneath our feet
@@ -524,9 +531,11 @@ int omap_gem_fault(struct vm_fault *vmf)
 	mutex_lock(&dev->struct_mutex);
 
 	/* if a shmem backed object, make sure we have pages attached now */
-	ret = get_pages(obj, &pages);
-	if (ret)
+	err = get_pages(obj, &pages);
+	if (err) {
+		ret = vmf_error(err);
 		goto fail;
+	}
 
 	/* where should we do corresponding put_pages().. we are mapping
 	 * the original page, rather than thru a GART, so we can't rely
@@ -542,21 +551,7 @@ int omap_gem_fault(struct vm_fault *vmf)
 
 fail:
 	mutex_unlock(&dev->struct_mutex);
-	switch (ret) {
-	case 0:
-	case -ERESTARTSYS:
-	case -EINTR:
-	case -EBUSY:
-		/*
-		 * EBUSY is ok: this just means that another thread
-		 * already did the job.
-		 */
-		return VM_FAULT_NOPAGE;
-	case -ENOMEM:
-		return VM_FAULT_OOM;
-	default:
-		return VM_FAULT_SIGBUS;
-	}
+	return ret;
 }
 
 /** We override mainly to fix up some of the vm mapping flags.. */
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.h b/drivers/gpu/drm/omapdrm/omap_gem.h
index a78bde0..c1c45fb 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.h
+++ b/drivers/gpu/drm/omapdrm/omap_gem.h
@@ -21,6 +21,7 @@
 #define __OMAPDRM_GEM_H__
 
 #include <linux/types.h>
+#include <linux/mm_types.h>
 
 enum dma_data_direction;
 
@@ -80,7 +81,7 @@ struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
 struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
 		struct dma_buf *buffer);
 
-int omap_gem_fault(struct vm_fault *vmf);
+vm_fault_t omap_gem_fault(struct vm_fault *vmf);
 int omap_gem_roll(struct drm_gem_object *obj, u32 roll);
 void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
 void omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t
  2018-05-22 18:13 [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t Souptick Joarder
@ 2018-06-01  5:41 ` Souptick Joarder
  2018-06-08  4:37   ` Souptick Joarder
  2018-06-08  6:17 ` Tomi Valkeinen
  1 sibling, 1 reply; 6+ messages in thread
From: Souptick Joarder @ 2018-06-01  5:41 UTC (permalink / raw)
  To: tomi.valkeinen, airlied; +Cc: dri-devel, linux-kernel, Matthew Wilcox

On Tue, May 22, 2018 at 11:43 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> Use new return type vm_fault_t for fault handler. For
> now, this is just documenting that the function returns
> a VM_FAULT value rather than an errno. Once all instances
> are converted, vm_fault_t will become a distinct type.
>
> Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>
> Previously vm_insert_mixed() returns err which driver
> mapped into VM_FAULT_* type. Also return value of
> vm_insert_mixed() not handled correctly and 0 was
> returned inside fault_2d() as default. The new function
> vmf_insert_mixed() will replace this inefficiency by
> returning correct VM_FAULT_* type.
>
> vmf_error() is the newly introduce inline function
> in 4.17-rc6.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
> ---
> v2: Fixed kbuild error by initialized ret
>     in fault_2d().
>
>  drivers/gpu/drm/omapdrm/omap_gem.c | 51 +++++++++++++++++---------------------
>  drivers/gpu/drm/omapdrm/omap_gem.h |  3 ++-
>  2 files changed, 25 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
> index 0faf042..99e4300 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> @@ -371,7 +371,7 @@ size_t omap_gem_mmap_size(struct drm_gem_object *obj)
>   */
>
>  /* Normal handling for the case of faulting in non-tiled buffers */
> -static int fault_1d(struct drm_gem_object *obj,
> +static vm_fault_t fault_1d(struct drm_gem_object *obj,
>                 struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
>         struct omap_gem_object *omap_obj = to_omap_bo(obj);
> @@ -392,11 +392,12 @@ static int fault_1d(struct drm_gem_object *obj,
>         VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
>                         pfn, pfn << PAGE_SHIFT);
>
> -       return vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
> +       return vmf_insert_mixed(vma, vmf->address,
> +                       __pfn_to_pfn_t(pfn, PFN_DEV));
>  }
>
>  /* Special handling for the case of faulting in 2d tiled buffers */
> -static int fault_2d(struct drm_gem_object *obj,
> +static vm_fault_t fault_2d(struct drm_gem_object *obj,
>                 struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
>         struct omap_gem_object *omap_obj = to_omap_bo(obj);
> @@ -407,7 +408,8 @@ static int fault_2d(struct drm_gem_object *obj,
>         unsigned long pfn;
>         pgoff_t pgoff, base_pgoff;
>         unsigned long vaddr;
> -       int i, ret, slots;
> +       int i, err, slots;
> +       vm_fault_t ret = VM_FAULT_NOPAGE;
>
>         /*
>          * Note the height of the slot is also equal to the number of pages
> @@ -473,9 +475,10 @@ static int fault_2d(struct drm_gem_object *obj,
>         memset(pages + slots, 0,
>                         sizeof(struct page *) * (n - slots));
>
> -       ret = tiler_pin(entry->block, pages, ARRAY_SIZE(pages), 0, true);
> -       if (ret) {
> -               dev_err(obj->dev->dev, "failed to pin: %d\n", ret);
> +       err = tiler_pin(entry->block, pages, ARRAY_SIZE(pages), 0, true);
> +       if (err) {
> +               ret = vmf_error(err);
> +               dev_err(obj->dev->dev, "failed to pin: %d\n", err);
>                 return ret;
>         }
>
> @@ -485,7 +488,10 @@ static int fault_2d(struct drm_gem_object *obj,
>                         pfn, pfn << PAGE_SHIFT);
>
>         for (i = n; i > 0; i--) {
> -               vm_insert_mixed(vma, vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
> +               ret = vmf_insert_mixed(vma,
> +                       vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
> +               if (ret & VM_FAULT_ERROR)
> +                       break;
>                 pfn += priv->usergart[fmt].stride_pfn;
>                 vaddr += PAGE_SIZE * m;
>         }
> @@ -494,7 +500,7 @@ static int fault_2d(struct drm_gem_object *obj,
>         priv->usergart[fmt].last = (priv->usergart[fmt].last + 1)
>                                  % NUM_USERGART_ENTRIES;
>
> -       return 0;
> +       return ret;
>  }
>
>  /**
> @@ -509,14 +515,15 @@ static int fault_2d(struct drm_gem_object *obj,
>   * vma->vm_private_data points to the GEM object that is backing this
>   * mapping.
>   */
> -int omap_gem_fault(struct vm_fault *vmf)
> +vm_fault_t omap_gem_fault(struct vm_fault *vmf)
>  {
>         struct vm_area_struct *vma = vmf->vma;
>         struct drm_gem_object *obj = vma->vm_private_data;
>         struct omap_gem_object *omap_obj = to_omap_bo(obj);
>         struct drm_device *dev = obj->dev;
>         struct page **pages;
> -       int ret;
> +       int err;
> +       vm_fault_t ret;
>
>         /* Make sure we don't parallel update on a fault, nor move or remove
>          * something from beneath our feet
> @@ -524,9 +531,11 @@ int omap_gem_fault(struct vm_fault *vmf)
>         mutex_lock(&dev->struct_mutex);
>
>         /* if a shmem backed object, make sure we have pages attached now */
> -       ret = get_pages(obj, &pages);
> -       if (ret)
> +       err = get_pages(obj, &pages);
> +       if (err) {
> +               ret = vmf_error(err);
>                 goto fail;
> +       }
>
>         /* where should we do corresponding put_pages().. we are mapping
>          * the original page, rather than thru a GART, so we can't rely
> @@ -542,21 +551,7 @@ int omap_gem_fault(struct vm_fault *vmf)
>
>  fail:
>         mutex_unlock(&dev->struct_mutex);
> -       switch (ret) {
> -       case 0:
> -       case -ERESTARTSYS:
> -       case -EINTR:
> -       case -EBUSY:
> -               /*
> -                * EBUSY is ok: this just means that another thread
> -                * already did the job.
> -                */
> -               return VM_FAULT_NOPAGE;
> -       case -ENOMEM:
> -               return VM_FAULT_OOM;
> -       default:
> -               return VM_FAULT_SIGBUS;
> -       }
> +       return ret;
>  }
>
>  /** We override mainly to fix up some of the vm mapping flags.. */
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.h b/drivers/gpu/drm/omapdrm/omap_gem.h
> index a78bde0..c1c45fb 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.h
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.h
> @@ -21,6 +21,7 @@
>  #define __OMAPDRM_GEM_H__
>
>  #include <linux/types.h>
> +#include <linux/mm_types.h>
>
>  enum dma_data_direction;
>
> @@ -80,7 +81,7 @@ struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
>  struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
>                 struct dma_buf *buffer);
>
> -int omap_gem_fault(struct vm_fault *vmf);
> +vm_fault_t omap_gem_fault(struct vm_fault *vmf);
>  int omap_gem_roll(struct drm_gem_object *obj, u32 roll);
>  void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
>  void omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
> --
> 1.9.1
>

Any comment for this patch ? We would like to get this patch
in queue for 4.18.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t
  2018-06-01  5:41 ` Souptick Joarder
@ 2018-06-08  4:37   ` Souptick Joarder
  0 siblings, 0 replies; 6+ messages in thread
From: Souptick Joarder @ 2018-06-08  4:37 UTC (permalink / raw)
  To: tomi.valkeinen, airlied; +Cc: dri-devel, linux-kernel, Matthew Wilcox

On Fri, Jun 1, 2018 at 11:11 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Tue, May 22, 2018 at 11:43 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> Use new return type vm_fault_t for fault handler. For
>> now, this is just documenting that the function returns
>> a VM_FAULT value rather than an errno. Once all instances
>> are converted, vm_fault_t will become a distinct type.
>>
>> Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>>
>> Previously vm_insert_mixed() returns err which driver
>> mapped into VM_FAULT_* type. Also return value of
>> vm_insert_mixed() not handled correctly and 0 was
>> returned inside fault_2d() as default. The new function
>> vmf_insert_mixed() will replace this inefficiency by
>> returning correct VM_FAULT_* type.
>>
>> vmf_error() is the newly introduce inline function
>> in 4.17-rc6.
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>> ---
>> v2: Fixed kbuild error by initialized ret
>>     in fault_2d().
>>
>>  drivers/gpu/drm/omapdrm/omap_gem.c | 51 +++++++++++++++++---------------------
>>  drivers/gpu/drm/omapdrm/omap_gem.h |  3 ++-
>>  2 files changed, 25 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
>> index 0faf042..99e4300 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
>> @@ -371,7 +371,7 @@ size_t omap_gem_mmap_size(struct drm_gem_object *obj)
>>   */
>>
>>  /* Normal handling for the case of faulting in non-tiled buffers */
>> -static int fault_1d(struct drm_gem_object *obj,
>> +static vm_fault_t fault_1d(struct drm_gem_object *obj,
>>                 struct vm_area_struct *vma, struct vm_fault *vmf)
>>  {
>>         struct omap_gem_object *omap_obj = to_omap_bo(obj);
>> @@ -392,11 +392,12 @@ static int fault_1d(struct drm_gem_object *obj,
>>         VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
>>                         pfn, pfn << PAGE_SHIFT);
>>
>> -       return vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
>> +       return vmf_insert_mixed(vma, vmf->address,
>> +                       __pfn_to_pfn_t(pfn, PFN_DEV));
>>  }
>>
>>  /* Special handling for the case of faulting in 2d tiled buffers */
>> -static int fault_2d(struct drm_gem_object *obj,
>> +static vm_fault_t fault_2d(struct drm_gem_object *obj,
>>                 struct vm_area_struct *vma, struct vm_fault *vmf)
>>  {
>>         struct omap_gem_object *omap_obj = to_omap_bo(obj);
>> @@ -407,7 +408,8 @@ static int fault_2d(struct drm_gem_object *obj,
>>         unsigned long pfn;
>>         pgoff_t pgoff, base_pgoff;
>>         unsigned long vaddr;
>> -       int i, ret, slots;
>> +       int i, err, slots;
>> +       vm_fault_t ret = VM_FAULT_NOPAGE;
>>
>>         /*
>>          * Note the height of the slot is also equal to the number of pages
>> @@ -473,9 +475,10 @@ static int fault_2d(struct drm_gem_object *obj,
>>         memset(pages + slots, 0,
>>                         sizeof(struct page *) * (n - slots));
>>
>> -       ret = tiler_pin(entry->block, pages, ARRAY_SIZE(pages), 0, true);
>> -       if (ret) {
>> -               dev_err(obj->dev->dev, "failed to pin: %d\n", ret);
>> +       err = tiler_pin(entry->block, pages, ARRAY_SIZE(pages), 0, true);
>> +       if (err) {
>> +               ret = vmf_error(err);
>> +               dev_err(obj->dev->dev, "failed to pin: %d\n", err);
>>                 return ret;
>>         }
>>
>> @@ -485,7 +488,10 @@ static int fault_2d(struct drm_gem_object *obj,
>>                         pfn, pfn << PAGE_SHIFT);
>>
>>         for (i = n; i > 0; i--) {
>> -               vm_insert_mixed(vma, vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
>> +               ret = vmf_insert_mixed(vma,
>> +                       vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
>> +               if (ret & VM_FAULT_ERROR)
>> +                       break;
>>                 pfn += priv->usergart[fmt].stride_pfn;
>>                 vaddr += PAGE_SIZE * m;
>>         }
>> @@ -494,7 +500,7 @@ static int fault_2d(struct drm_gem_object *obj,
>>         priv->usergart[fmt].last = (priv->usergart[fmt].last + 1)
>>                                  % NUM_USERGART_ENTRIES;
>>
>> -       return 0;
>> +       return ret;
>>  }
>>
>>  /**
>> @@ -509,14 +515,15 @@ static int fault_2d(struct drm_gem_object *obj,
>>   * vma->vm_private_data points to the GEM object that is backing this
>>   * mapping.
>>   */
>> -int omap_gem_fault(struct vm_fault *vmf)
>> +vm_fault_t omap_gem_fault(struct vm_fault *vmf)
>>  {
>>         struct vm_area_struct *vma = vmf->vma;
>>         struct drm_gem_object *obj = vma->vm_private_data;
>>         struct omap_gem_object *omap_obj = to_omap_bo(obj);
>>         struct drm_device *dev = obj->dev;
>>         struct page **pages;
>> -       int ret;
>> +       int err;
>> +       vm_fault_t ret;
>>
>>         /* Make sure we don't parallel update on a fault, nor move or remove
>>          * something from beneath our feet
>> @@ -524,9 +531,11 @@ int omap_gem_fault(struct vm_fault *vmf)
>>         mutex_lock(&dev->struct_mutex);
>>
>>         /* if a shmem backed object, make sure we have pages attached now */
>> -       ret = get_pages(obj, &pages);
>> -       if (ret)
>> +       err = get_pages(obj, &pages);
>> +       if (err) {
>> +               ret = vmf_error(err);
>>                 goto fail;
>> +       }
>>
>>         /* where should we do corresponding put_pages().. we are mapping
>>          * the original page, rather than thru a GART, so we can't rely
>> @@ -542,21 +551,7 @@ int omap_gem_fault(struct vm_fault *vmf)
>>
>>  fail:
>>         mutex_unlock(&dev->struct_mutex);
>> -       switch (ret) {
>> -       case 0:
>> -       case -ERESTARTSYS:
>> -       case -EINTR:
>> -       case -EBUSY:
>> -               /*
>> -                * EBUSY is ok: this just means that another thread
>> -                * already did the job.
>> -                */
>> -               return VM_FAULT_NOPAGE;
>> -       case -ENOMEM:
>> -               return VM_FAULT_OOM;
>> -       default:
>> -               return VM_FAULT_SIGBUS;
>> -       }
>> +       return ret;
>>  }
>>
>>  /** We override mainly to fix up some of the vm mapping flags.. */
>> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.h b/drivers/gpu/drm/omapdrm/omap_gem.h
>> index a78bde0..c1c45fb 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_gem.h
>> +++ b/drivers/gpu/drm/omapdrm/omap_gem.h
>> @@ -21,6 +21,7 @@
>>  #define __OMAPDRM_GEM_H__
>>
>>  #include <linux/types.h>
>> +#include <linux/mm_types.h>
>>
>>  enum dma_data_direction;
>>
>> @@ -80,7 +81,7 @@ struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
>>  struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
>>                 struct dma_buf *buffer);
>>
>> -int omap_gem_fault(struct vm_fault *vmf);
>> +vm_fault_t omap_gem_fault(struct vm_fault *vmf);
>>  int omap_gem_roll(struct drm_gem_object *obj, u32 roll);
>>  void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
>>  void omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
>> --
>> 1.9.1
>>
>
> Any comment for this patch ? We would like to get this patch
> in queue for 4.18.

If no comment, we would like to get this patch in 4.18.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t
  2018-05-22 18:13 [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t Souptick Joarder
  2018-06-01  5:41 ` Souptick Joarder
@ 2018-06-08  6:17 ` Tomi Valkeinen
  2018-06-08 10:47   ` Souptick Joarder
  1 sibling, 1 reply; 6+ messages in thread
From: Tomi Valkeinen @ 2018-06-08  6:17 UTC (permalink / raw)
  To: Souptick Joarder, airlied
  Cc: dri-devel, linux-kernel, willy, Laurent Pinchart

Hi,

On 22/05/18 21:13, Souptick Joarder wrote:
> Use new return type vm_fault_t for fault handler. For
> now, this is just documenting that the function returns
> a VM_FAULT value rather than an errno. Once all instances
> are converted, vm_fault_t will become a distinct type.
> 
> Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
> 
> Previously vm_insert_mixed() returns err which driver
> mapped into VM_FAULT_* type. Also return value of
> vm_insert_mixed() not handled correctly and 0 was
> returned inside fault_2d() as default. The new function
> vmf_insert_mixed() will replace this inefficiency by
> returning correct VM_FAULT_* type.
> 
> vmf_error() is the newly introduce inline function
> in 4.17-rc6.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
> ---
> v2: Fixed kbuild error by initialized ret
>     in fault_2d().
> 
>  drivers/gpu/drm/omapdrm/omap_gem.c | 51 +++++++++++++++++---------------------
>  drivers/gpu/drm/omapdrm/omap_gem.h |  3 ++-
>  2 files changed, 25 insertions(+), 29 deletions(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

It's too late to get this to 4.18 via my normal routes. If you have
other similar patches queued and Linus/maintainers are ok to merge this
late, feel free to queue this that way.

Otherwise I can pick this up for my 4.19 patches.

Laurent, this will conflict omap_gem cleanups you did, but I don't think
there's anything problematic there.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t
  2018-06-08  6:17 ` Tomi Valkeinen
@ 2018-06-08 10:47   ` Souptick Joarder
  2018-07-05  4:41     ` Souptick Joarder
  0 siblings, 1 reply; 6+ messages in thread
From: Souptick Joarder @ 2018-06-08 10:47 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: airlied, dri-devel, linux-kernel, Matthew Wilcox, Laurent Pinchart

On Fri, Jun 8, 2018 at 11:47 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> Hi,
>
> On 22/05/18 21:13, Souptick Joarder wrote:
>> Use new return type vm_fault_t for fault handler. For
>> now, this is just documenting that the function returns
>> a VM_FAULT value rather than an errno. Once all instances
>> are converted, vm_fault_t will become a distinct type.
>>
>> Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>>
>> Previously vm_insert_mixed() returns err which driver
>> mapped into VM_FAULT_* type. Also return value of
>> vm_insert_mixed() not handled correctly and 0 was
>> returned inside fault_2d() as default. The new function
>> vmf_insert_mixed() will replace this inefficiency by
>> returning correct VM_FAULT_* type.
>>
>> vmf_error() is the newly introduce inline function
>> in 4.17-rc6.
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>> ---
>> v2: Fixed kbuild error by initialized ret
>>     in fault_2d().
>>
>>  drivers/gpu/drm/omapdrm/omap_gem.c | 51 +++++++++++++++++---------------------
>>  drivers/gpu/drm/omapdrm/omap_gem.h |  3 ++-
>>  2 files changed, 25 insertions(+), 29 deletions(-)
>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>
> It's too late to get this to 4.18 via my normal routes. If you have
> other similar patches queued and Linus/maintainers are ok to merge this
> late, feel free to queue this that way.
>
> Otherwise I can pick this up for my 4.19 patches.
>

4.19 looks ok. In case, we have pushed this patch into 4.18-rc-x along
with few others, will notify you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t
  2018-06-08 10:47   ` Souptick Joarder
@ 2018-07-05  4:41     ` Souptick Joarder
  0 siblings, 0 replies; 6+ messages in thread
From: Souptick Joarder @ 2018-07-05  4:41 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: airlied, dri-devel, linux-kernel, Matthew Wilcox, Laurent Pinchart

On Fri, Jun 8, 2018 at 4:17 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Fri, Jun 8, 2018 at 11:47 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>> Hi,
>>
>> On 22/05/18 21:13, Souptick Joarder wrote:
>>> Use new return type vm_fault_t for fault handler. For
>>> now, this is just documenting that the function returns
>>> a VM_FAULT value rather than an errno. Once all instances
>>> are converted, vm_fault_t will become a distinct type.
>>>
>>> Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>>>
>>> Previously vm_insert_mixed() returns err which driver
>>> mapped into VM_FAULT_* type. Also return value of
>>> vm_insert_mixed() not handled correctly and 0 was
>>> returned inside fault_2d() as default. The new function
>>> vmf_insert_mixed() will replace this inefficiency by
>>> returning correct VM_FAULT_* type.
>>>
>>> vmf_error() is the newly introduce inline function
>>> in 4.17-rc6.
>>>
>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>>> ---
>>> v2: Fixed kbuild error by initialized ret
>>>     in fault_2d().
>>>
>>>  drivers/gpu/drm/omapdrm/omap_gem.c | 51 +++++++++++++++++---------------------
>>>  drivers/gpu/drm/omapdrm/omap_gem.h |  3 ++-
>>>  2 files changed, 25 insertions(+), 29 deletions(-)
>>
>> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>
>> It's too late to get this to 4.18 via my normal routes. If you have
>> other similar patches queued and Linus/maintainers are ok to merge this
>> late, feel free to queue this that way.
>>
>> Otherwise I can pick this up for my 4.19 patches.
>>
>
> 4.19 looks ok. In case, we have pushed this patch into 4.18-rc-x along
> with few others, will notify you.

Tomi, this patch can be merged in 4.19.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-05  4:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22 18:13 [PATCH v2] gpu: drm: omapdrm: Adding new typedef vm_fault_t Souptick Joarder
2018-06-01  5:41 ` Souptick Joarder
2018-06-08  4:37   ` Souptick Joarder
2018-06-08  6:17 ` Tomi Valkeinen
2018-06-08 10:47   ` Souptick Joarder
2018-07-05  4:41     ` Souptick Joarder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).