[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v2 13/15] drm/amdgpu: Use mmu_range_insert instead of hmm_mirror
- To: "Kuehling, Felix" <Felix.Kuehling@xxxxxxx>
- From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
- Date: Tue, 29 Oct 2019 23:09:46 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6M0IwHvQcuLxPhw+vcshMi9hO3AjNiTbBBJwe/ONCQk=; b=bxozRACKA6JsNnLBII2prhkuzV84mxBcMQL6f1EhfCPZ44DoIFwphqQzaKPLIaBB4RWsplCwZqLcqGaMdQQ12E0Cgypv2jJUejM+n/wwa5AY5Tu0AFruAIibxTjgaW6WKFPHKVKNls4A8x5Xu6oJVeCWXf8HCuNQMqzgGn7DWEEOLAVaM9rAh+nXOSHy7zaVFF3suzwhDAq1O6nY3GDN056vT7g1gNXL19I0fvxaPjBSB+XRKYcqt04ymMdM+KQ2WROcBm3GHoXC+a1RtoRnDV1MwsoENIaFljZ3mre569Zxwy9qsd7LyQpT8/Adyy+LdFpM9hvdS23FAF6G9Ty7Yw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hvnVdymBIx5Pxb8ZKLGPqZuF0soY45aDiiPWMkzqzpy3MDhbkC/NkLxCZmGIkJvaPUSv5vdtPg1xZ9OtoMQ3bwAnI4+RJC9iDUh0W5TBYZryJ8K+o1D7YiY4VL3b4PTTLfN3GL029qscJ5z/HtzgwRsu6VIN53w3IymV6p7Z72QkzENvA5PJP8v10tY3F+Ya7raYD37KbzcbsJAePsfAkOtixTMfWtSZ7PrlmBQQfDkzdNqIWi6sFteqmc93cXy00vRIIOuwVmowCjF8h1KahmDefp5VEsr4i1ga7OGljNDpH3edYJErIlH0wu8WrhbeBycTIGQNj+sfDGxlyXDejA==
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=jgg@xxxxxxxxxxxx;
- Cc: Juergen Gross <jgross@xxxxxxxx>, "Zhou, David\(ChunMing\)" <David1.Zhou@xxxxxxx>, Ralph Campbell <rcampbell@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, "linux-rdma@xxxxxxxxxxxxxxx" <linux-rdma@xxxxxxxxxxxxxxx>, John Hubbard <jhubbard@xxxxxxxxxx>, Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx>, Mike Marciniszyn <mike.marciniszyn@xxxxxxxxx>, "dri-devel@xxxxxxxxxxxxxxxxxxxxx" <dri-devel@xxxxxxxxxxxxxxxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>, "linux-mm@xxxxxxxxx" <linux-mm@xxxxxxxxx>, Jerome Glisse <jglisse@xxxxxxxxxx>, "amd-gfx@xxxxxxxxxxxxxxxxxxxxx" <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>, "nouveau@xxxxxxxxxxxxxxxxxxxxx" <nouveau@xxxxxxxxxxxxxxxxxxxxx>, "Deucher, Alexander" <Alexander.Deucher@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Petr Cvek <petrcvekcz@xxxxxxxxx>, "Koenig, Christian" <Christian.Koenig@xxxxxxx>, Ben Skeggs <bskeggs@xxxxxxxxxx>
- Delivery-date: Tue, 29 Oct 2019 23:10:01 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHVjc0/OrofSfizc0Ocze68uYhonqdyMNyAgAAPbQA=
- Thread-topic: [PATCH v2 13/15] drm/amdgpu: Use mmu_range_insert instead of hmm_mirror
On Tue, Oct 29, 2019 at 10:14:29PM +0000, Kuehling, Felix wrote:
> > +static const struct mmu_range_notifier_ops amdgpu_mn_hsa_ops = {
> > + .invalidate = amdgpu_mn_invalidate_hsa,
> > +};
> > +
> > +static int amdgpu_mn_sync_pagetables(struct hmm_mirror *mirror,
> > + const struct mmu_notifier_range *update)
> > {
> > struct amdgpu_mn *amn = container_of(mirror, struct amdgpu_mn, mirror);
> > - unsigned long start = update->start;
> > - unsigned long end = update->end;
> > - bool blockable = mmu_notifier_range_blockable(update);
> > - struct interval_tree_node *it;
> >
> > - /* notification is exclusive, but interval is inclusive */
> > - end -= 1;
> > -
> > - if (amdgpu_mn_read_lock(amn, blockable))
> > - return -EAGAIN;
> > -
> > - it = interval_tree_iter_first(&amn->objects, start, end);
> > - while (it) {
> > - struct amdgpu_mn_node *node;
> > - struct amdgpu_bo *bo;
> > -
> > - if (!blockable) {
> > - amdgpu_mn_read_unlock(amn);
> > - return -EAGAIN;
> > - }
> > -
> > - node = container_of(it, struct amdgpu_mn_node, it);
> > - it = interval_tree_iter_next(it, start, end);
> > -
> > - list_for_each_entry(bo, &node->bos, mn_list) {
> > - struct kgd_mem *mem = bo->kfd_bo;
> > -
> > - if (amdgpu_ttm_tt_affect_userptr(bo->tbo.ttm,
> > - start, end))
> > - amdgpu_amdkfd_evict_userptr(mem, amn->mm);
> > - }
> > - }
> > -
> > - amdgpu_mn_read_unlock(amn);
> > + if (!mmu_notifier_range_blockable(update))
> > + return false;
>
> This should return -EAGAIN. Not sure it matters much, because this whole
> function disappears in the next commit in the series. It seems to be
> only vestigial at this point.
Right, the only reason it is still here is that I couldn't really tell
if this:
> > + down_read(&amn->lock);
> > + up_read(&amn->lock);
> > return 0;
> > }
Was serving as the 'driver lock' in the hmm scheme... If not then the
whole thing should just be deleted at this point.
I fixed the EAGAIN though
Jason
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|