From: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Souptick Joarder <jrdr.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
linux-arm-msm
<linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Matthew Wilcox <willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
Jordan Crouse <jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
freedreno
<freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] gpu: drm: msm: Change return type to vm_fault_t
Date: Mon, 18 Jun 2018 17:43:50 -0400 [thread overview]
Message-ID: <CAF6AEGvEkC9WiEC79W-Wny0mVCnjDJq4xhgduEZSSx6WaiSjmw@mail.gmail.com> (raw)
In-Reply-To: <CAFqt6zaVbJWCvCf8AF5nKPCpqrSi1Aweog2=V9xzJFzWGbmd3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Sun, Jun 17, 2018 at 11:40 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Thu, May 31, 2018 at 11:29 PM, Jordan Crouse <jcrouse@codeaurora.org> wrote:
>> On Mon, May 28, 2018 at 12:38:41PM +0530, Souptick Joarder wrote:
>>> On Mon, May 21, 2018 at 10:59 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. The new function
>>> > vmf_insert_mixed() will replace this inefficiency by
>>> > returning 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>
>>> > ---
>>> > drivers/gpu/drm/msm/msm_drv.h | 3 ++-
>>> > drivers/gpu/drm/msm/msm_gem.c | 33 ++++++++++-----------------------
>>> > 2 files changed, 12 insertions(+), 24 deletions(-)
>>> >
>>> > diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
>>> > index 0a653dd..44b4ca7 100644
>>> > --- a/drivers/gpu/drm/msm/msm_drv.h
>>> > +++ b/drivers/gpu/drm/msm/msm_drv.h
>>> > @@ -33,6 +33,7 @@
>>> > #include <linux/of_graph.h>
>>> > #include <linux/of_device.h>
>>> > #include <asm/sizes.h>
>>> > +#include <linux/mm_types.h>
>>> >
>>> > #include <drm/drmP.h>
>>> > #include <drm/drm_atomic.h>
>>> > @@ -188,7 +189,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>>> > int msm_gem_mmap_obj(struct drm_gem_object *obj,
>>> > struct vm_area_struct *vma);
>>> > int msm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
>>> > -int msm_gem_fault(struct vm_fault *vmf);
>>> > +vm_fault_t msm_gem_fault(struct vm_fault *vmf);
>>> > uint64_t msm_gem_mmap_offset(struct drm_gem_object *obj);
>>> > int msm_gem_get_iova(struct drm_gem_object *obj,
>>> > struct msm_gem_address_space *aspace, uint64_t *iova);
>>> > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
>>> > index 07376de..27a5ab5 100644
>>> > --- a/drivers/gpu/drm/msm/msm_gem.c
>>> > +++ b/drivers/gpu/drm/msm/msm_gem.c
>>> > @@ -217,7 +217,7 @@ int msm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>>> > return msm_gem_mmap_obj(vma->vm_private_data, vma);
>>> > }
>>> >
>>> > -int msm_gem_fault(struct vm_fault *vmf)
>>> > +vm_fault_t msm_gem_fault(struct vm_fault *vmf)
>>> > {
>>> > struct vm_area_struct *vma = vmf->vma;
>>> > struct drm_gem_object *obj = vma->vm_private_data;
>>> > @@ -225,15 +225,18 @@ int msm_gem_fault(struct vm_fault *vmf)
>>> > struct page **pages;
>>> > unsigned long pfn;
>>> > pgoff_t pgoff;
>>> > - int ret;
>>> > + int err;
>>> > + vm_fault_t ret;
>>> >
>>> > /*
>>> > * vm_ops.open/drm_gem_mmap_obj and close get and put
>>> > * a reference on obj. So, we dont need to hold one here.
>>> > */
>>> > - ret = mutex_lock_interruptible(&msm_obj->lock);
>>> > - if (ret)
>>> > + err = mutex_lock_interruptible(&msm_obj->lock);
>>> > + if (err) {
>>> > + ret = VM_FAULT_NOPAGE;
>>> > goto out;
>>> > + }
>>> >
>>> > if (WARN_ON(msm_obj->madv != MSM_MADV_WILLNEED)) {
>>> > mutex_unlock(&msm_obj->lock);
>>> > @@ -243,7 +246,7 @@ int msm_gem_fault(struct vm_fault *vmf)
>>> > /* make sure we have pages attached now */
>>> > pages = get_pages(obj);
>>> > if (IS_ERR(pages)) {
>>> > - ret = PTR_ERR(pages);
>>> > + ret = vmf_error(PTR_ERR(pages));
>>> > goto out_unlock;
>>> > }
>>> >
>>> > @@ -255,27 +258,11 @@ int msm_gem_fault(struct vm_fault *vmf)
>>> > VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
>>> > pfn, pfn << PAGE_SHIFT);
>>> >
>>> > - ret = vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
>>> > -
>>> > + ret = vmf_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
>>> > out_unlock:
>>> > mutex_unlock(&msm_obj->lock);
>>> > out:
>>> > - switch (ret) {
>>> > - case -EAGAIN:
>>> > - 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;
>>> > }
>>> >
>>> > /** get mmap offset */
>>> > --
>>> > 1.9.1
>>> >
>>>
>>> Any comment for this patch ?
>>
>> Sorry for the delay, I wanted to get a chance to test it. It seems to pass the
>> usual regression tests. LGTM.
>>
>
> Jordan, This patch is not merged in 4.18-rc-1.
this was on my list to pull into msm-next for 4.19 as soon as I have a
chance to do my next round of pulling patches from patchwork, so it
should show up in linux-next shortly..
BR,
-R
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
prev parent reply other threads:[~2018-06-18 21:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-21 17:29 [PATCH] gpu: drm: msm: Change return type to vm_fault_t Souptick Joarder
2018-05-28 7:08 ` Souptick Joarder
[not found] ` <CAFqt6zY8VJ791_6C_pqrGgjG91T1kirEmUyA3JC+3JsN8QjFAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-31 17:59 ` Jordan Crouse
[not found] ` <20180531175902.GC11565-9PYrDHPZ2Orvke4nUoYGnHL1okKdlPRT@public.gmane.org>
2018-05-31 18:53 ` Souptick Joarder
2018-06-18 3:40 ` Souptick Joarder
[not found] ` <CAFqt6zaVbJWCvCf8AF5nKPCpqrSi1Aweog2=V9xzJFzWGbmd3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-18 21:43 ` Rob Clark [this message]
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=CAF6AEGvEkC9WiEC79W-Wny0mVCnjDJq4xhgduEZSSx6WaiSjmw@mail.gmail.com \
--to=robdclark-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=jrdr.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.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 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).