linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: remove unnecessary fault wrappers
@ 2017-01-30 19:20 Ross Zwisler
  2017-01-30 20:30 ` Sean Paul
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Zwisler @ 2017-01-30 19:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Daniel Vetter, David Airlie, Jani Nikula,
	Sean Paul, dri-devel

The fault wrappers drm_vm_fault(), drm_vm_shm_fault(), drm_vm_dma_fault()
and drm_vm_sg_fault() used to provide extra logic beyond what was in the
"drm_do_*" versions of these functions, but as of this commit:

commit ca0b07d9a969 ("drm: convert drm from nopage to fault.")

They are just unnecessary wrappers that do nothing.  Remove them.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 drivers/gpu/drm/drm_vm.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index bae6e26..e677b11 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -349,50 +349,30 @@ static int drm_do_vm_sg_fault(struct vm_fault *vmf)
 	return 0;
 }
 
-static int drm_vm_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_fault(vmf);
-}
-
-static int drm_vm_shm_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_shm_fault(vmf);
-}
-
-static int drm_vm_dma_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_dma_fault(vmf);
-}
-
-static int drm_vm_sg_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_sg_fault(vmf);
-}
-
 /** AGP virtual memory operations */
 static const struct vm_operations_struct drm_vm_ops = {
-	.fault = drm_vm_fault,
+	.fault = drm_do_vm_fault,
 	.open = drm_vm_open,
 	.close = drm_vm_close,
 };
 
 /** Shared virtual memory operations */
 static const struct vm_operations_struct drm_vm_shm_ops = {
-	.fault = drm_vm_shm_fault,
+	.fault = drm_do_vm_shm_fault,
 	.open = drm_vm_open,
 	.close = drm_vm_shm_close,
 };
 
 /** DMA virtual memory operations */
 static const struct vm_operations_struct drm_vm_dma_ops = {
-	.fault = drm_vm_dma_fault,
+	.fault = drm_do_vm_dma_fault,
 	.open = drm_vm_open,
 	.close = drm_vm_close,
 };
 
 /** Scatter-gather virtual memory operations */
 static const struct vm_operations_struct drm_vm_sg_ops = {
-	.fault = drm_vm_sg_fault,
+	.fault = drm_do_vm_sg_fault,
 	.open = drm_vm_open,
 	.close = drm_vm_close,
 };
-- 
2.7.4

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

* Re: [PATCH] drm: remove unnecessary fault wrappers
  2017-01-30 19:20 [PATCH] drm: remove unnecessary fault wrappers Ross Zwisler
@ 2017-01-30 20:30 ` Sean Paul
  2017-01-30 22:09   ` [PATCH v2] " Ross Zwisler
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Paul @ 2017-01-30 20:30 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Daniel Vetter, David Airlie, Jani Nikula, dri-devel

On Mon, Jan 30, 2017 at 12:20:02PM -0700, Ross Zwisler wrote:
> The fault wrappers drm_vm_fault(), drm_vm_shm_fault(), drm_vm_dma_fault()
> and drm_vm_sg_fault() used to provide extra logic beyond what was in the
> "drm_do_*" versions of these functions, but as of this commit:
> 
> commit ca0b07d9a969 ("drm: convert drm from nopage to fault.")
> 
> They are just unnecessary wrappers that do nothing.  Remove them.

Can we rename the drm_do_* functions to remove "do_" instead? I don't think it
adds anything and this seems like a good time to fix that.

Sean

> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_vm.c | 28 ++++------------------------
>  1 file changed, 4 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> index bae6e26..e677b11 100644
> --- a/drivers/gpu/drm/drm_vm.c
> +++ b/drivers/gpu/drm/drm_vm.c
> @@ -349,50 +349,30 @@ static int drm_do_vm_sg_fault(struct vm_fault *vmf)
>  	return 0;
>  }
>  
> -static int drm_vm_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_fault(vmf);
> -}
> -
> -static int drm_vm_shm_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_shm_fault(vmf);
> -}
> -
> -static int drm_vm_dma_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_dma_fault(vmf);
> -}
> -
> -static int drm_vm_sg_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_sg_fault(vmf);
> -}
> -
>  /** AGP virtual memory operations */
>  static const struct vm_operations_struct drm_vm_ops = {
> -	.fault = drm_vm_fault,
> +	.fault = drm_do_vm_fault,
>  	.open = drm_vm_open,
>  	.close = drm_vm_close,
>  };
>  
>  /** Shared virtual memory operations */
>  static const struct vm_operations_struct drm_vm_shm_ops = {
> -	.fault = drm_vm_shm_fault,
> +	.fault = drm_do_vm_shm_fault,
>  	.open = drm_vm_open,
>  	.close = drm_vm_shm_close,
>  };
>  
>  /** DMA virtual memory operations */
>  static const struct vm_operations_struct drm_vm_dma_ops = {
> -	.fault = drm_vm_dma_fault,
> +	.fault = drm_do_vm_dma_fault,
>  	.open = drm_vm_open,
>  	.close = drm_vm_close,
>  };
>  
>  /** Scatter-gather virtual memory operations */
>  static const struct vm_operations_struct drm_vm_sg_ops = {
> -	.fault = drm_vm_sg_fault,
> +	.fault = drm_do_vm_sg_fault,
>  	.open = drm_vm_open,
>  	.close = drm_vm_close,
>  };
> -- 
> 2.7.4

-- 
Sean Paul, Software Engineer, Google / Chromium OS

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

* [PATCH v2] drm: remove unnecessary fault wrappers
  2017-01-30 20:30 ` Sean Paul
@ 2017-01-30 22:09   ` Ross Zwisler
  2017-01-30 22:14     ` Ross Zwisler
  2017-01-31 14:43     ` Sean Paul
  0 siblings, 2 replies; 6+ messages in thread
From: Ross Zwisler @ 2017-01-30 22:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Daniel Vetter, David Airlie, Jani Nikula,
	Sean Paul, dri-devel

The fault wrappers drm_vm_fault(), drm_vm_shm_fault(), drm_vm_dma_fault()
and drm_vm_sg_fault() used to provide extra logic beyond what was in the
"drm_do_*" versions of these functions, but as of this commit:

commit ca0b07d9a969 ("drm: convert drm from nopage to fault.")

They are just unnecessary wrappers that do nothing.  Remove them, and
rename the the drm_do_* fault handlers to remove the "do_" since they no
longer have corresponding wrappers.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---

This patch applies cleanly to mmots/master, which is currently at
v4.10-rc5-mmots-2017-01-26-15-49.

---
 drivers/gpu/drm/drm_vm.c | 30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index 0cd993a..039a1e0 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -95,7 +95,7 @@ static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma)
  * map, get the page, increment the use count and return it.
  */
 #if IS_ENABLED(CONFIG_AGP)
-static int drm_do_vm_fault(struct vm_fault *vmf)
+static int drm_vm_fault(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	struct drm_file *priv = vma->vm_file->private_data;
@@ -168,7 +168,7 @@ static int drm_do_vm_fault(struct vm_fault *vmf)
 	return VM_FAULT_SIGBUS;	/* Disallow mremap */
 }
 #else
-static int drm_do_vm_fault(struct vm_fault *vmf)
+static int drm_vm_fault(struct vm_fault *vmf)
 {
 	return VM_FAULT_SIGBUS;
 }
@@ -183,7 +183,7 @@ static int drm_do_vm_fault(struct vm_fault *vmf)
  * Get the mapping, find the real physical page to map, get the page, and
  * return it.
  */
-static int drm_do_vm_shm_fault(struct vm_fault *vmf)
+static int drm_vm_shm_fault(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	struct drm_local_map *map = vma->vm_private_data;
@@ -285,7 +285,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
  *
  * Determine the page number from the page offset and get it from drm_device_dma::pagelist.
  */
-static int drm_do_vm_dma_fault(struct vm_fault *vmf)
+static int drm_vm_dma_fault(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	struct drm_file *priv = vma->vm_file->private_data;
@@ -320,7 +320,7 @@ static int drm_do_vm_dma_fault(struct vm_fault *vmf)
  *
  * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
  */
-static int drm_do_vm_sg_fault(struct vm_fault *vmf)
+static int drm_vm_sg_fault(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	struct drm_local_map *map = vma->vm_private_data;
@@ -347,26 +347,6 @@ static int drm_do_vm_sg_fault(struct vm_fault *vmf)
 	return 0;
 }
 
-static int drm_vm_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_fault(vmf);
-}
-
-static int drm_vm_shm_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_shm_fault(vmf);
-}
-
-static int drm_vm_dma_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_dma_fault(vmf);
-}
-
-static int drm_vm_sg_fault(struct vm_fault *vmf)
-{
-	return drm_do_vm_sg_fault(vmf);
-}
-
 /** AGP virtual memory operations */
 static const struct vm_operations_struct drm_vm_ops = {
 	.fault = drm_vm_fault,
-- 
2.7.4

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

* Re: [PATCH v2] drm: remove unnecessary fault wrappers
  2017-01-30 22:09   ` [PATCH v2] " Ross Zwisler
@ 2017-01-30 22:14     ` Ross Zwisler
  2017-01-31  8:40       ` Daniel Vetter
  2017-01-31 14:43     ` Sean Paul
  1 sibling, 1 reply; 6+ messages in thread
From: Ross Zwisler @ 2017-01-30 22:14 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Daniel Vetter, David Airlie, Jani Nikula,
	Sean Paul, dri-devel

On Mon, Jan 30, 2017 at 03:09:39PM -0700, Ross Zwisler wrote:

> This patch applies cleanly to mmots/master, which is currently at
> v4.10-rc5-mmots-2017-01-26-15-49.

Which may not be what you want...  The reason I was looking at this code was
because it was recently changed by Dave Jiang to remove the 'vma' argument
from all the fault handlers.

So, would you rather:

1) Take it through the -mm tree to avoid merge conflicts, in which case I'll
add akpm to the thread.

2) Take it through your tree & deal with merge conflicts later, in which case
I can rebase on your tree or on v4.10-rc6.

3) Just drop it and keep the extra 20 lines or whatever that the complier will
just optimize out.

I'm fine with any of the above.

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

* Re: [PATCH v2] drm: remove unnecessary fault wrappers
  2017-01-30 22:14     ` Ross Zwisler
@ 2017-01-31  8:40       ` Daniel Vetter
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2017-01-31  8:40 UTC (permalink / raw)
  To: Ross Zwisler; +Cc: linux-kernel, dri-devel, Daniel Vetter

On Mon, Jan 30, 2017 at 03:14:38PM -0700, Ross Zwisler wrote:
> On Mon, Jan 30, 2017 at 03:09:39PM -0700, Ross Zwisler wrote:
> 
> > This patch applies cleanly to mmots/master, which is currently at
> > v4.10-rc5-mmots-2017-01-26-15-49.
> 
> Which may not be what you want...  The reason I was looking at this code was
> because it was recently changed by Dave Jiang to remove the 'vma' argument
> from all the fault handlers.
> 
> So, would you rather:
> 
> 1) Take it through the -mm tree to avoid merge conflicts, in which case I'll
> add akpm to the thread.
> 
> 2) Take it through your tree & deal with merge conflicts later, in which case
> I can rebase on your tree or on v4.10-rc6.
> 
> 3) Just drop it and keep the extra 20 lines or whatever that the complier will
> just optimize out.
> 
> I'm fine with any of the above.

drm_vm.c is legacy horror shows, we're not going to touch in in the drm
tree (except for other trivial clenaups). So perfectly fine to merge it
all through -mm.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH v2] drm: remove unnecessary fault wrappers
  2017-01-30 22:09   ` [PATCH v2] " Ross Zwisler
  2017-01-30 22:14     ` Ross Zwisler
@ 2017-01-31 14:43     ` Sean Paul
  1 sibling, 0 replies; 6+ messages in thread
From: Sean Paul @ 2017-01-31 14:43 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Daniel Vetter, David Airlie, Jani Nikula, dri-devel

On Mon, Jan 30, 2017 at 03:09:39PM -0700, Ross Zwisler wrote:
> The fault wrappers drm_vm_fault(), drm_vm_shm_fault(), drm_vm_dma_fault()
> and drm_vm_sg_fault() used to provide extra logic beyond what was in the
> "drm_do_*" versions of these functions, but as of this commit:
> 
> commit ca0b07d9a969 ("drm: convert drm from nopage to fault.")
> 
> They are just unnecessary wrappers that do nothing.  Remove them, and
> rename the the drm_do_* fault handlers to remove the "do_" since they no
> longer have corresponding wrappers.
> 

Thanks for humoring my nit :-)

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
> 
> This patch applies cleanly to mmots/master, which is currently at
> v4.10-rc5-mmots-2017-01-26-15-49.
> 
> ---
>  drivers/gpu/drm/drm_vm.c | 30 +++++-------------------------
>  1 file changed, 5 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> index 0cd993a..039a1e0 100644
> --- a/drivers/gpu/drm/drm_vm.c
> +++ b/drivers/gpu/drm/drm_vm.c
> @@ -95,7 +95,7 @@ static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma)
>   * map, get the page, increment the use count and return it.
>   */
>  #if IS_ENABLED(CONFIG_AGP)
> -static int drm_do_vm_fault(struct vm_fault *vmf)
> +static int drm_vm_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct drm_file *priv = vma->vm_file->private_data;
> @@ -168,7 +168,7 @@ static int drm_do_vm_fault(struct vm_fault *vmf)
>  	return VM_FAULT_SIGBUS;	/* Disallow mremap */
>  }
>  #else
> -static int drm_do_vm_fault(struct vm_fault *vmf)
> +static int drm_vm_fault(struct vm_fault *vmf)
>  {
>  	return VM_FAULT_SIGBUS;
>  }
> @@ -183,7 +183,7 @@ static int drm_do_vm_fault(struct vm_fault *vmf)
>   * Get the mapping, find the real physical page to map, get the page, and
>   * return it.
>   */
> -static int drm_do_vm_shm_fault(struct vm_fault *vmf)
> +static int drm_vm_shm_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct drm_local_map *map = vma->vm_private_data;
> @@ -285,7 +285,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
>   *
>   * Determine the page number from the page offset and get it from drm_device_dma::pagelist.
>   */
> -static int drm_do_vm_dma_fault(struct vm_fault *vmf)
> +static int drm_vm_dma_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct drm_file *priv = vma->vm_file->private_data;
> @@ -320,7 +320,7 @@ static int drm_do_vm_dma_fault(struct vm_fault *vmf)
>   *
>   * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
>   */
> -static int drm_do_vm_sg_fault(struct vm_fault *vmf)
> +static int drm_vm_sg_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct drm_local_map *map = vma->vm_private_data;
> @@ -347,26 +347,6 @@ static int drm_do_vm_sg_fault(struct vm_fault *vmf)
>  	return 0;
>  }
>  
> -static int drm_vm_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_fault(vmf);
> -}
> -
> -static int drm_vm_shm_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_shm_fault(vmf);
> -}
> -
> -static int drm_vm_dma_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_dma_fault(vmf);
> -}
> -
> -static int drm_vm_sg_fault(struct vm_fault *vmf)
> -{
> -	return drm_do_vm_sg_fault(vmf);
> -}
> -
>  /** AGP virtual memory operations */
>  static const struct vm_operations_struct drm_vm_ops = {
>  	.fault = drm_vm_fault,
> -- 
> 2.7.4

-- 
Sean Paul, Software Engineer, Google / Chromium OS

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

end of thread, other threads:[~2017-01-31 14:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-30 19:20 [PATCH] drm: remove unnecessary fault wrappers Ross Zwisler
2017-01-30 20:30 ` Sean Paul
2017-01-30 22:09   ` [PATCH v2] " Ross Zwisler
2017-01-30 22:14     ` Ross Zwisler
2017-01-31  8:40       ` Daniel Vetter
2017-01-31 14:43     ` Sean Paul

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).