All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: airlied@linux.ie, linux-kernel@vger.kernel.org,
	willy@infradead.org, jonathanh@nvidia.com,
	dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH] gpu: drm: tegra: Adding new typedef vm_fault_t
Date: Wed, 18 Apr 2018 10:24:39 +0200	[thread overview]
Message-ID: <20180418082439.GA4646@ulmo> (raw)
In-Reply-To: <20180417134755.GA30291@jordon-HP-15-Notebook-PC>


[-- Attachment #1.1: Type: text/plain, Size: 2147 bytes --]

On Tue, Apr 17, 2018 at 07:17:55PM +0530, 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.
> 
> Reference id -> 1c8f422059ae ("mm: change return type to
> vm_fault_t")
> 
> Previously vm_insert_page() returns err which driver
> mapped into VM_FAULT_* type. The new function 
> vmf_insert_page() will replace this inefficiency by
> returning VM_FAULT_* type.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
>  drivers/gpu/drm/tegra/gem.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index 49b9bf2..6121493 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -422,14 +422,13 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
>  	return 0;
>  }
> 
> -static int tegra_bo_fault(struct vm_fault *vmf)
> +static vm_fault_t tegra_bo_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct drm_gem_object *gem = vma->vm_private_data;
>  	struct tegra_bo *bo = to_tegra_bo(gem);
>  	struct page *page;
>  	pgoff_t offset;
> -	int err;
> 
>  	if (!bo->pages)
>  		return VM_FAULT_SIGBUS;
> @@ -437,20 +436,7 @@ static int tegra_bo_fault(struct vm_fault *vmf)
>  	offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
>  	page = bo->pages[offset];
> 
> -	err = vm_insert_page(vma, vmf->address, page);
> -	switch (err) {
> -	case -EAGAIN:
> -	case 0:
> -	case -ERESTARTSYS:
> -	case -EINTR:
> -	case -EBUSY:
> -		return VM_FAULT_NOPAGE;
> -
> -	case -ENOMEM:
> -		return VM_FAULT_OOM;
> -	}
> -
> -	return VM_FAULT_SIGBUS;
> +	return vmf_insert_page(vma, vmf->address, page);
>  }

This new function returns VM_FAULT_NOPAGE only for 0 and -EBUSY, whereas
we used to return VM_FAULT_NOPAGE for -EAGAIN, -ERESTARTSYS and -EINTR
as well. Was this previously wrong?

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: airlied@linux.ie, jonathanh@nvidia.com,
	dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, willy@infradead.org
Subject: Re: [PATCH] gpu: drm: tegra: Adding new typedef vm_fault_t
Date: Wed, 18 Apr 2018 10:24:39 +0200	[thread overview]
Message-ID: <20180418082439.GA4646@ulmo> (raw)
In-Reply-To: <20180417134755.GA30291@jordon-HP-15-Notebook-PC>

[-- Attachment #1: Type: text/plain, Size: 2147 bytes --]

On Tue, Apr 17, 2018 at 07:17:55PM +0530, 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.
> 
> Reference id -> 1c8f422059ae ("mm: change return type to
> vm_fault_t")
> 
> Previously vm_insert_page() returns err which driver
> mapped into VM_FAULT_* type. The new function 
> vmf_insert_page() will replace this inefficiency by
> returning VM_FAULT_* type.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
>  drivers/gpu/drm/tegra/gem.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index 49b9bf2..6121493 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -422,14 +422,13 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
>  	return 0;
>  }
> 
> -static int tegra_bo_fault(struct vm_fault *vmf)
> +static vm_fault_t tegra_bo_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct drm_gem_object *gem = vma->vm_private_data;
>  	struct tegra_bo *bo = to_tegra_bo(gem);
>  	struct page *page;
>  	pgoff_t offset;
> -	int err;
> 
>  	if (!bo->pages)
>  		return VM_FAULT_SIGBUS;
> @@ -437,20 +436,7 @@ static int tegra_bo_fault(struct vm_fault *vmf)
>  	offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
>  	page = bo->pages[offset];
> 
> -	err = vm_insert_page(vma, vmf->address, page);
> -	switch (err) {
> -	case -EAGAIN:
> -	case 0:
> -	case -ERESTARTSYS:
> -	case -EINTR:
> -	case -EBUSY:
> -		return VM_FAULT_NOPAGE;
> -
> -	case -ENOMEM:
> -		return VM_FAULT_OOM;
> -	}
> -
> -	return VM_FAULT_SIGBUS;
> +	return vmf_insert_page(vma, vmf->address, page);
>  }

This new function returns VM_FAULT_NOPAGE only for 0 and -EBUSY, whereas
we used to return VM_FAULT_NOPAGE for -EAGAIN, -ERESTARTSYS and -EINTR
as well. Was this previously wrong?

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-04-18  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 13:47 [PATCH] gpu: drm: tegra: Adding new typedef vm_fault_t Souptick Joarder
2018-04-18  8:24 ` Thierry Reding [this message]
2018-04-18  8:24   ` Thierry Reding
2018-04-18 11:09   ` Souptick Joarder
2018-04-23 10:54   ` Matthew Wilcox
2018-05-11 18:20     ` Souptick Joarder
2018-05-14 12:59 ` Thierry Reding
  -- strict thread matches above, loose matches on Subject: below --
2018-04-16 16:09 Souptick Joarder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180418082439.GA4646@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=jrdr.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.