dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: "hdanton@sina.com" <hdanton@sina.com>
Cc: Pv-drivers <Pv-drivers@vmware.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Linux-graphics-maintainer <Linux-graphics-maintainer@vmware.com>,
	"nadav.amit@gmail.com" <nadav.amit@gmail.com>,
	"christian.koenig@amd.com" <christian.koenig@amd.com>
Subject: Re: [PATCH v5 5/9] drm/ttm: TTM fault handler helpers
Date: Thu, 13 Jun 2019 11:49:54 +0000	[thread overview]
Message-ID: <28b5337b668808eff51e5af9c8ab7f0a4c5340fc.camel@vmware.com> (raw)
In-Reply-To: <20190613042526.12028-1-hdanton@sina.com>

Hi!

On Thu, 2019-06-13 at 12:25 +0800, Hillf Danton wrote:
> Hello Thomas
> 
> On Wed, 12 Jun 2019 08:42:39 +0200 Thomas Hellstrom wrote:
> > From: Thomas Hellstrom <thellstrom@vmware.com>
> > 
> > With the vmwgfx dirty tracking, the default TTM fault handler is
> > not
> > completely sufficient (vmwgfx need to modify the vma->vm_flags
> > member,
> > and also needs to restrict the number of prefaults).
> > 
> > We also want to replicate the new ttm_bo_vm_reserve() functionality
> > 
> > So start turning the TTM vm code into helpers:
> > ttm_bo_vm_fault_reserved()
> > and ttm_bo_vm_reserve(), and provide a default TTM fault handler
> > for other
> > drivers to use.
> > 
> > Cc: "Christian König" <christian.koenig@amd.com>
> > 
> > Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > Reviewed-by: "Christian König" <christian.koenig@amd.com> #v1
> > ---
> >  drivers/gpu/drm/ttm/ttm_bo_vm.c | 175 +++++++++++++++++++---------
> > ----
> >  include/drm/ttm/ttm_bo_api.h    |  10 ++
> >  2 files changed, 113 insertions(+), 72 deletions(-)
> > 
> > 

...


> > -	/*
> > -	 * Work around locking order reversal in fault / nopfn
> > -	 * between mmap_sem and bo_reserve: Perform a trylock operation
> > -	 * for reserve, and if it fails, retry the fault after waiting
> > -	 * for the buffer to become unreserved.
> > -	 */
> Is it likely to not cut the comment as the trylock is still there?

Yes, I'll re-add that. It was removed in an early version of the patch
when I actually removed the trylock as well, but I changed my mind on
that.

> 
> >  	if (unlikely(!reservation_object_trylock(bo->resv))) {
> >  		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
> >  			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
> > @@ -151,14 +148,55 @@ static vm_fault_t ttm_bo_vm_fault(struct
> > vm_fault *vmf)
> >  		return VM_FAULT_NOPAGE;
> >  	}
> >  
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL(ttm_bo_vm_reserve);

...


> > 
> > -	if (unlikely(err != 0)) {
> > -		ret = VM_FAULT_SIGBUS;
> > -		goto out_io_unlock;
> > -	}
> > +	if (unlikely(err != 0))
> > +		return VM_FAULT_SIGBUS;
> >  
> Is it likely a typo to skip the io_unlock?
> 
> --
> Hillf


Yes. Good catch. That io_unlock should definitely remain.

I'll respin and resend to dri-devel and lkml only.

Thanks,
Thomas

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

      reply	other threads:[~2019-06-13 11:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  6:42 [PATCH v5 0/9] Emulated coherent graphics memory Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 1/9] mm: Allow the [page|pfn]_mkwrite callbacks to drop the mmap_sem Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 2/9] mm: Add an apply_to_pfn_range interface Thomas Hellström (VMware)
2019-06-12 12:16   ` Christoph Hellwig
2019-06-12 12:26     ` Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 3/9] mm: Add write-protect and clean utilities for address space ranges Thomas Hellström (VMware)
2019-06-12 11:23   ` Christoph Hellwig
2019-06-12 12:13     ` Christoph Hellwig
2019-06-12 12:20     ` Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 4/9] drm/ttm: Allow the driver to provide the ttm struct vm_operations_struct Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 5/9] drm/ttm: TTM fault handler helpers Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 6/9] drm/vmwgfx: Implement an infrastructure for write-coherent resources Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 7/9] drm/vmwgfx: Use an RBtree instead of linked list for MOB resources Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 8/9] drm/vmwgfx: Implement an infrastructure for read-coherent resources Thomas Hellström (VMware)
2019-06-12  6:42 ` [PATCH v5 9/9] drm/vmwgfx: Add surface dirty-tracking callbacks Thomas Hellström (VMware)
2019-06-13  4:25 ` [PATCH v5 5/9] drm/ttm: TTM fault handler helpers Hillf Danton
2019-06-13 11:49   ` Thomas Hellstrom [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=28b5337b668808eff51e5af9c8ab7f0a4c5340fc.camel@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=Linux-graphics-maintainer@vmware.com \
    --cc=Pv-drivers@vmware.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    /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