From: Thomas Hellstrom <thellstrom@vmware.com>
To: "hdanton@sina.com" <hdanton@sina.com>,
"thomas_os@shipmail.org" <thomas_os@shipmail.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"willy@infradead.org" <willy@infradead.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"christian.koenig@amd.com" <christian.koenig@amd.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
Pv-drivers <Pv-drivers@vmware.com>,
"rcampbell@nvidia.com" <rcampbell@nvidia.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"jglisse@redhat.com" <jglisse@redhat.com>,
Linux-graphics-maintainer <Linux-graphics-maintainer@vmware.com>,
Roland Scheidegger <sroland@vmware.com>
Subject: Re: [PATCH v4 5/9] drm/ttm, drm/vmwgfx: Support huge TTM pagefaults
Date: Sun, 1 Mar 2020 14:03:44 +0000 [thread overview]
Message-ID: <39b3614c5bc472981bd12419492af9f7764bf980.camel@vmware.com> (raw)
In-Reply-To: <20200301134928.16128-1-hdanton@sina.com>
On Sun, 2020-03-01 at 21:49 +0800, Hillf Danton wrote:
> On Thu, 20 Feb 2020 13:27:15 +0100 Thomas Hellstrom wrote:
> > +
> > +static vm_fault_t ttm_bo_vm_huge_fault(struct vm_fault *vmf,
> > + enum page_entry_size pe_size)
> > +{
> > + struct vm_area_struct *vma = vmf->vma;
> > + pgprot_t prot;
> > + struct ttm_buffer_object *bo = vma->vm_private_data;
> > + vm_fault_t ret;
> > + pgoff_t fault_page_size = 0;
> > + bool write = vmf->flags & FAULT_FLAG_WRITE;
> > +
> > + switch (pe_size) {
> > + case PE_SIZE_PMD:
> > + fault_page_size = HPAGE_PMD_SIZE >> PAGE_SHIFT;
> > + break;
> > +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
> > + case PE_SIZE_PUD:
> > + fault_page_size = HPAGE_PUD_SIZE >> PAGE_SHIFT;
> > + break;
> > +#endif
> > + default:
> > + WARN_ON_ONCE(1);
> > + return VM_FAULT_FALLBACK;
> > + }
> > +
> > + /* Fallback on write dirty-tracking or COW */
> > + if (write && ttm_pgprot_is_wrprotecting(vma->vm_page_prot))
> > + return VM_FAULT_FALLBACK;
> > +
> > + ret = ttm_bo_vm_reserve(bo, vmf);
> > + if (ret)
> > + return ret;
> > +
> > + prot = vm_get_page_prot(vma->vm_flags);
> > + ret = ttm_bo_vm_fault_reserved(vmf, prot, 1, fault_page_size);
> > + if (ret == VM_FAULT_RETRY && !(vmf->flags &
> > FAULT_FLAG_RETRY_NOWAIT))
> > + return ret;
>
> Seems it does not make much sense to check VM_FAULT_RETRY and return
> as
> at least resv lock is left behind without care.
With this particular flag combination, both the mm_sem and the dma_resv
lock have already been released by TTM.
It's a special case allowing for drivers to release the mmap_sem when
waiting for IO.
That should probably be documented better in TTM.
/Thomas
prev parent reply other threads:[~2020-03-01 14:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 12:27 [PATCH v4 0/9] Huge page-table entries for TTM Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 1/9] fs: Constify vma argument to vma_is_dax Thomas Hellström (VMware)
2020-03-26 4:36 ` Dan Williams
2020-02-20 12:27 ` [PATCH v4 2/9] mm: Introduce vma_is_special_huge Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 3/9] mm: Split huge pages on write-notify or COW Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 4/9] mm: Add vmf_insert_pfn_xxx_prot() for huge page-table entries Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 5/9] drm/ttm, drm/vmwgfx: Support huge TTM pagefaults Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 6/9] drm/vmwgfx: Support huge page faults Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 7/9] drm: Add a drm_get_unmapped_area() helper Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 8/9] drm/vmwgfx: Introduce a huge page aligning TTM range manager Thomas Hellström (VMware)
2020-02-20 12:27 ` [PATCH v4 9/9] drm/vmwgfx: Hook up the helpers to align buffer objects Thomas Hellström (VMware)
2020-02-28 13:08 ` [PATCH v4 0/9] Huge page-table entries for TTM Thomas Hellström (VMware)
2020-03-01 4:04 ` Andrew Morton
2020-03-03 10:23 ` Thomas Hellström (VMware)
2020-03-03 9:18 ` Michal Hocko
2020-03-01 13:49 ` [PATCH v4 5/9] drm/ttm, drm/vmwgfx: Support huge TTM pagefaults Hillf Danton
2020-03-01 14:03 ` 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=39b3614c5bc472981bd12419492af9f7764bf980.camel@vmware.com \
--to=thellstrom@vmware.com \
--cc=Linux-graphics-maintainer@vmware.com \
--cc=Pv-drivers@vmware.com \
--cc=akpm@linux-foundation.org \
--cc=christian.koenig@amd.com \
--cc=dan.j.williams@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdanton@sina.com \
--cc=jglisse@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rcampbell@nvidia.com \
--cc=sroland@vmware.com \
--cc=thomas_os@shipmail.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 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).