dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: don't set page->mapping
@ 2020-11-04 16:50 Daniel Vetter
  2020-11-05  7:59 ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-04 16:50 UTC (permalink / raw)
  To: DRI Development
  Cc: Thomas Hellstrom, Daniel Vetter, Huang Rui, Brian Paul,
	Daniel Vetter, Christian Koenig

Random observation while trying to review Christian's patch series to
stop looking at struct page for dma-buf imports.

This was originally added in

commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Fri Jan 3 11:47:23 2014 +0100

    drm/ttm: Correctly set page mapping and -index members

    Needed for some vm operations; most notably unmap_mapping_range() with
    even_cows = 0.

    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

but we do not have a single caller of unmap_mapping_range with
even_cows == 0. And all the gem drivers don't do this, so another
small thing we could standardize between drm and ttm drivers.

Plus I don't really see a need for unamp_mapping_range where we don't
want to indiscriminately shoot down all ptes.

Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 8861a74ac335..438ea43fd8c1 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
 	return ret;
 }
 
-static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
-{
-	pgoff_t i;
-
-	if (ttm->page_flags & TTM_PAGE_FLAG_SG)
-		return;
-
-	for (i = 0; i < ttm->num_pages; ++i)
-		ttm->pages[i]->mapping = bdev->dev_mapping;
-}
-
 int ttm_tt_populate(struct ttm_bo_device *bdev,
 		    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 {
@@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
 	if (ret)
 		return ret;
 
-	ttm_tt_add_mapping(bdev, ttm);
 	ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
 	if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
 		ret = ttm_tt_swapin(ttm);
-- 
2.28.0

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-04 16:50 [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
@ 2020-11-05  7:59 ` Christian König
  2020-11-05  9:11   ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-11-05  7:59 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Daniel Vetter, Thomas Hellstrom, Huang Rui, Brian Paul

Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> Random observation while trying to review Christian's patch series to
> stop looking at struct page for dma-buf imports.
>
> This was originally added in
>
> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> Author: Thomas Hellstrom <thellstrom@vmware.com>
> Date:   Fri Jan 3 11:47:23 2014 +0100
>
>      drm/ttm: Correctly set page mapping and -index members
>
>      Needed for some vm operations; most notably unmap_mapping_range() with
>      even_cows = 0.
>
>      Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>      Reviewed-by: Brian Paul <brianp@vmware.com>
>
> but we do not have a single caller of unmap_mapping_range with
> even_cows == 0. And all the gem drivers don't do this, so another
> small thing we could standardize between drm and ttm drivers.
>
> Plus I don't really see a need for unamp_mapping_range where we don't
> want to indiscriminately shoot down all ptes.

NAK, we use this to determine if a pages belongs to the driver or not in 
amdgpu for example.

Mostly used for debugging, but I would really like to keep that.

Christian.

>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Brian Paul <brianp@vmware.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Christian Koenig <christian.koenig@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>   1 file changed, 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index 8861a74ac335..438ea43fd8c1 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>   	return ret;
>   }
>   
> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> -{
> -	pgoff_t i;
> -
> -	if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> -		return;
> -
> -	for (i = 0; i < ttm->num_pages; ++i)
> -		ttm->pages[i]->mapping = bdev->dev_mapping;
> -}
> -
>   int ttm_tt_populate(struct ttm_bo_device *bdev,
>   		    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>   {
> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>   	if (ret)
>   		return ret;
>   
> -	ttm_tt_add_mapping(bdev, ttm);
>   	ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>   	if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>   		ret = ttm_tt_swapin(ttm);

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05  7:59 ` Christian König
@ 2020-11-05  9:11   ` Daniel Vetter
  2020-11-05 12:29     ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-05  9:11 UTC (permalink / raw)
  To: Christian König
  Cc: Daniel Vetter, Thomas Hellstrom, Huang Rui, Brian Paul, DRI Development

On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
>
> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> > Random observation while trying to review Christian's patch series to
> > stop looking at struct page for dma-buf imports.
> >
> > This was originally added in
> >
> > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > Author: Thomas Hellstrom <thellstrom@vmware.com>
> > Date:   Fri Jan 3 11:47:23 2014 +0100
> >
> >      drm/ttm: Correctly set page mapping and -index members
> >
> >      Needed for some vm operations; most notably unmap_mapping_range() with
> >      even_cows = 0.
> >
> >      Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> >      Reviewed-by: Brian Paul <brianp@vmware.com>
> >
> > but we do not have a single caller of unmap_mapping_range with
> > even_cows == 0. And all the gem drivers don't do this, so another
> > small thing we could standardize between drm and ttm drivers.
> >
> > Plus I don't really see a need for unamp_mapping_range where we don't
> > want to indiscriminately shoot down all ptes.
>
> NAK, we use this to determine if a pages belongs to the driver or not in
> amdgpu for example.
>
> Mostly used for debugging, but I would really like to keep that.

Can you pls point me at that code? A quick grep hasn't really found much at all.
-Daniel

>
> Christian.
>
> >
> > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > Cc: Brian Paul <brianp@vmware.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Christian Koenig <christian.koenig@amd.com>
> > Cc: Huang Rui <ray.huang@amd.com>
> > ---
> >   drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> >   1 file changed, 12 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> > index 8861a74ac335..438ea43fd8c1 100644
> > --- a/drivers/gpu/drm/ttm/ttm_tt.c
> > +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> > @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> >       return ret;
> >   }
> >
> > -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > -{
> > -     pgoff_t i;
> > -
> > -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> > -             return;
> > -
> > -     for (i = 0; i < ttm->num_pages; ++i)
> > -             ttm->pages[i]->mapping = bdev->dev_mapping;
> > -}
> > -
> >   int ttm_tt_populate(struct ttm_bo_device *bdev,
> >                   struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> >   {
> > @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> >       if (ret)
> >               return ret;
> >
> > -     ttm_tt_add_mapping(bdev, ttm);
> >       ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> >       if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> >               ret = ttm_tt_swapin(ttm);
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05  9:11   ` Daniel Vetter
@ 2020-11-05 12:29     ` Christian König
  2020-11-05 12:50       ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-11-05 12:29 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Daniel Vetter, Thomas Hellstrom, Huang Rui, Brian Paul, DRI Development

Am 05.11.20 um 10:11 schrieb Daniel Vetter:
> On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
>> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
>>> Random observation while trying to review Christian's patch series to
>>> stop looking at struct page for dma-buf imports.
>>>
>>> This was originally added in
>>>
>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
>>> Date:   Fri Jan 3 11:47:23 2014 +0100
>>>
>>>       drm/ttm: Correctly set page mapping and -index members
>>>
>>>       Needed for some vm operations; most notably unmap_mapping_range() with
>>>       even_cows = 0.
>>>
>>>       Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>>       Reviewed-by: Brian Paul <brianp@vmware.com>
>>>
>>> but we do not have a single caller of unmap_mapping_range with
>>> even_cows == 0. And all the gem drivers don't do this, so another
>>> small thing we could standardize between drm and ttm drivers.
>>>
>>> Plus I don't really see a need for unamp_mapping_range where we don't
>>> want to indiscriminately shoot down all ptes.
>> NAK, we use this to determine if a pages belongs to the driver or not in
>> amdgpu for example.
>>
>> Mostly used for debugging, but I would really like to keep that.
> Can you pls point me at that code? A quick grep hasn't really found much at all.

See amdgpu_iomem_read() for an example:

>                 if (p->mapping != adev->mman.bdev.dev_mapping)
>                         return -EPERM;

Christian.

> -Daniel
>
>> Christian.
>>
>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
>>> Cc: Brian Paul <brianp@vmware.com>
>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>> Cc: Christian Koenig <christian.koenig@amd.com>
>>> Cc: Huang Rui <ray.huang@amd.com>
>>> ---
>>>    drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>>>    1 file changed, 12 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
>>> index 8861a74ac335..438ea43fd8c1 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
>>> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>        return ret;
>>>    }
>>>
>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>> -{
>>> -     pgoff_t i;
>>> -
>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
>>> -             return;
>>> -
>>> -     for (i = 0; i < ttm->num_pages; ++i)
>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
>>> -}
>>> -
>>>    int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>                    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>>>    {
>>> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>        if (ret)
>>>                return ret;
>>>
>>> -     ttm_tt_add_mapping(bdev, ttm);
>>>        ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>>>        if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>>>                ret = ttm_tt_swapin(ttm);
>

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 12:29     ` Christian König
@ 2020-11-05 12:50       ` Daniel Vetter
  2020-11-05 12:56         ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-05 12:50 UTC (permalink / raw)
  To: Christian König
  Cc: Thomas Hellstrom, Daniel Vetter, DRI Development, Huang Rui,
	Brian Paul, Daniel Vetter

On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
> > On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
> > > Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> > > > Random observation while trying to review Christian's patch series to
> > > > stop looking at struct page for dma-buf imports.
> > > > 
> > > > This was originally added in
> > > > 
> > > > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > > > Author: Thomas Hellstrom <thellstrom@vmware.com>
> > > > Date:   Fri Jan 3 11:47:23 2014 +0100
> > > > 
> > > >       drm/ttm: Correctly set page mapping and -index members
> > > > 
> > > >       Needed for some vm operations; most notably unmap_mapping_range() with
> > > >       even_cows = 0.
> > > > 
> > > >       Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > > >       Reviewed-by: Brian Paul <brianp@vmware.com>
> > > > 
> > > > but we do not have a single caller of unmap_mapping_range with
> > > > even_cows == 0. And all the gem drivers don't do this, so another
> > > > small thing we could standardize between drm and ttm drivers.
> > > > 
> > > > Plus I don't really see a need for unamp_mapping_range where we don't
> > > > want to indiscriminately shoot down all ptes.
> > > NAK, we use this to determine if a pages belongs to the driver or not in
> > > amdgpu for example.
> > > 
> > > Mostly used for debugging, but I would really like to keep that.
> > Can you pls point me at that code? A quick grep hasn't really found much at all.
> 
> See amdgpu_iomem_read() for an example:

Why do you reject this?

If this is to avoid issues with userptr, then I think there's a simple
trick:
- grab page reference
- recheck that the iova still points at the same address
- do read/write, safe in the knowledge that this page cannot be reused for
  anything else
- drop page reference

Of course this can still race against iova updates, but that seems to be a
fundamental part of your debug interface here.

Or am I missing something?

Just pondering this more since setting the page->mapping pointer for just
this seems somewhat wild abuse of ->mapping semantics :-)
-Daniel

> 
> >                 if (p->mapping != adev->mman.bdev.dev_mapping)
> >                         return -EPERM;
> 
> Christian.
> 
> > -Daniel
> > 
> > > Christian.
> > > 
> > > > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > > > Cc: Brian Paul <brianp@vmware.com>
> > > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > > > Cc: Christian Koenig <christian.koenig@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > ---
> > > >    drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> > > >    1 file changed, 12 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > index 8861a74ac335..438ea43fd8c1 100644
> > > > --- a/drivers/gpu/drm/ttm/ttm_tt.c
> > > > +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > >        return ret;
> > > >    }
> > > > 
> > > > -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > > -{
> > > > -     pgoff_t i;
> > > > -
> > > > -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> > > > -             return;
> > > > -
> > > > -     for (i = 0; i < ttm->num_pages; ++i)
> > > > -             ttm->pages[i]->mapping = bdev->dev_mapping;
> > > > -}
> > > > -
> > > >    int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > >                    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> > > >    {
> > > > @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > >        if (ret)
> > > >                return ret;
> > > > 
> > > > -     ttm_tt_add_mapping(bdev, ttm);
> > > >        ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> > > >        if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> > > >                ret = ttm_tt_swapin(ttm);
> > 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 12:50       ` Daniel Vetter
@ 2020-11-05 12:56         ` Christian König
  2020-11-05 13:20           ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-11-05 12:56 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Thomas Hellstrom, Daniel Vetter, DRI Development, Huang Rui,
	Brian Paul, Daniel Vetter

Am 05.11.20 um 13:50 schrieb Daniel Vetter:
> On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
>> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
>>> On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
>>>> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
>>>>> Random observation while trying to review Christian's patch series to
>>>>> stop looking at struct page for dma-buf imports.
>>>>>
>>>>> This was originally added in
>>>>>
>>>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
>>>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
>>>>> Date:   Fri Jan 3 11:47:23 2014 +0100
>>>>>
>>>>>        drm/ttm: Correctly set page mapping and -index members
>>>>>
>>>>>        Needed for some vm operations; most notably unmap_mapping_range() with
>>>>>        even_cows = 0.
>>>>>
>>>>>        Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>>>>        Reviewed-by: Brian Paul <brianp@vmware.com>
>>>>>
>>>>> but we do not have a single caller of unmap_mapping_range with
>>>>> even_cows == 0. And all the gem drivers don't do this, so another
>>>>> small thing we could standardize between drm and ttm drivers.
>>>>>
>>>>> Plus I don't really see a need for unamp_mapping_range where we don't
>>>>> want to indiscriminately shoot down all ptes.
>>>> NAK, we use this to determine if a pages belongs to the driver or not in
>>>> amdgpu for example.
>>>>
>>>> Mostly used for debugging, but I would really like to keep that.
>>> Can you pls point me at that code? A quick grep hasn't really found much at all.
>> See amdgpu_iomem_read() for an example:
> Why do you reject this?

When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give 
the same access as /dev/mem to system memory and that is forbidden. But 
as I noted this is just for the debugfs file.

When I tried a few years ago to not set the page->mapping I immediately 
ran into issues with our eviction test. So I think that this is used 
elsewhere as well.

Regards,
Christian.

>
> If this is to avoid issues with userptr, then I think there's a simple
> trick:
> - grab page reference
> - recheck that the iova still points at the same address
> - do read/write, safe in the knowledge that this page cannot be reused for
>    anything else
> - drop page reference
>
> Of course this can still race against iova updates, but that seems to be a
> fundamental part of your debug interface here.
>
> Or am I missing something?
>
> Just pondering this more since setting the page->mapping pointer for just
> this seems somewhat wild abuse of ->mapping semantics :-)
> -Daniel
>
>>>                  if (p->mapping != adev->mman.bdev.dev_mapping)
>>>                          return -EPERM;
>> Christian.
>>
>>> -Daniel
>>>
>>>> Christian.
>>>>
>>>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
>>>>> Cc: Brian Paul <brianp@vmware.com>
>>>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>>>> Cc: Christian Koenig <christian.koenig@amd.com>
>>>>> Cc: Huang Rui <ray.huang@amd.com>
>>>>> ---
>>>>>     drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>>>>>     1 file changed, 12 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
>>>>> index 8861a74ac335..438ea43fd8c1 100644
>>>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
>>>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
>>>>> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>>>         return ret;
>>>>>     }
>>>>>
>>>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>>> -{
>>>>> -     pgoff_t i;
>>>>> -
>>>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
>>>>> -             return;
>>>>> -
>>>>> -     for (i = 0; i < ttm->num_pages; ++i)
>>>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
>>>>> -}
>>>>> -
>>>>>     int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>>>                     struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>>>>>     {
>>>>> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>>>         if (ret)
>>>>>                 return ret;
>>>>>
>>>>> -     ttm_tt_add_mapping(bdev, ttm);
>>>>>         ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>>>>>         if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>>>>>                 ret = ttm_tt_swapin(ttm);

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 12:56         ` Christian König
@ 2020-11-05 13:20           ` Daniel Vetter
  2020-11-05 13:22             ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-05 13:20 UTC (permalink / raw)
  To: Christian König
  Cc: Thomas Hellstrom, Daniel Vetter, DRI Development, Huang Rui,
	Brian Paul, Daniel Vetter

On Thu, Nov 05, 2020 at 01:56:22PM +0100, Christian König wrote:
> Am 05.11.20 um 13:50 schrieb Daniel Vetter:
> > On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
> > > Am 05.11.20 um 10:11 schrieb Daniel Vetter:
> > > > On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
> > > > > Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> > > > > > Random observation while trying to review Christian's patch series to
> > > > > > stop looking at struct page for dma-buf imports.
> > > > > > 
> > > > > > This was originally added in
> > > > > > 
> > > > > > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > > > > > Author: Thomas Hellstrom <thellstrom@vmware.com>
> > > > > > Date:   Fri Jan 3 11:47:23 2014 +0100
> > > > > > 
> > > > > >        drm/ttm: Correctly set page mapping and -index members
> > > > > > 
> > > > > >        Needed for some vm operations; most notably unmap_mapping_range() with
> > > > > >        even_cows = 0.
> > > > > > 
> > > > > >        Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > > > > >        Reviewed-by: Brian Paul <brianp@vmware.com>
> > > > > > 
> > > > > > but we do not have a single caller of unmap_mapping_range with
> > > > > > even_cows == 0. And all the gem drivers don't do this, so another
> > > > > > small thing we could standardize between drm and ttm drivers.
> > > > > > 
> > > > > > Plus I don't really see a need for unamp_mapping_range where we don't
> > > > > > want to indiscriminately shoot down all ptes.
> > > > > NAK, we use this to determine if a pages belongs to the driver or not in
> > > > > amdgpu for example.
> > > > > 
> > > > > Mostly used for debugging, but I would really like to keep that.
> > > > Can you pls point me at that code? A quick grep hasn't really found much at all.
> > > See amdgpu_iomem_read() for an example:
> > Why do you reject this?
> 
> When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give the
> same access as /dev/mem to system memory and that is forbidden. But as I
> noted this is just for the debugfs file.

Ah, there's a config option for that. Plus it's debugfs, anything goes in
debugfs, but if you're worried about that hole we should just disable the
entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
top, that follow_pfn patch series I'm baking is all about this kind of
fun.

> When I tried a few years ago to not set the page->mapping I immediately ran
> into issues with our eviction test. So I think that this is used elsewhere
> as well.

That's the kind of interaction I'm worried about here tbh. If this does
some kind of shrinking of some sorts, I think a real shrinker should take
over.

An improved grep shows nothing else, so the only the above is the only
thing I can think of. What kind of eviction test goes boom if you clear
->mapping here? I'd be happy to type up the clever trick for the debugfs
files.
-Daniel

> 
> Regards,
> Christian.
> 
> > 
> > If this is to avoid issues with userptr, then I think there's a simple
> > trick:
> > - grab page reference
> > - recheck that the iova still points at the same address
> > - do read/write, safe in the knowledge that this page cannot be reused for
> >    anything else
> > - drop page reference
> > 
> > Of course this can still race against iova updates, but that seems to be a
> > fundamental part of your debug interface here.
> > 
> > Or am I missing something?
> > 
> > Just pondering this more since setting the page->mapping pointer for just
> > this seems somewhat wild abuse of ->mapping semantics :-)
> > -Daniel
> > 
> > > >                  if (p->mapping != adev->mman.bdev.dev_mapping)
> > > >                          return -EPERM;
> > > Christian.
> > > 
> > > > -Daniel
> > > > 
> > > > > Christian.
> > > > > 
> > > > > > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > > > > > Cc: Brian Paul <brianp@vmware.com>
> > > > > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > > > > > Cc: Christian Koenig <christian.koenig@amd.com>
> > > > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > > > ---
> > > > > >     drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> > > > > >     1 file changed, 12 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > > > index 8861a74ac335..438ea43fd8c1 100644
> > > > > > --- a/drivers/gpu/drm/ttm/ttm_tt.c
> > > > > > +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > > > @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > > > >         return ret;
> > > > > >     }
> > > > > > 
> > > > > > -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > > > > -{
> > > > > > -     pgoff_t i;
> > > > > > -
> > > > > > -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> > > > > > -             return;
> > > > > > -
> > > > > > -     for (i = 0; i < ttm->num_pages; ++i)
> > > > > > -             ttm->pages[i]->mapping = bdev->dev_mapping;
> > > > > > -}
> > > > > > -
> > > > > >     int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > > > >                     struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> > > > > >     {
> > > > > > @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > > > >         if (ret)
> > > > > >                 return ret;
> > > > > > 
> > > > > > -     ttm_tt_add_mapping(bdev, ttm);
> > > > > >         ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> > > > > >         if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> > > > > >                 ret = ttm_tt_swapin(ttm);
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 13:20           ` Daniel Vetter
@ 2020-11-05 13:22             ` Christian König
  2020-11-05 14:31               ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-11-05 13:22 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Thomas Hellstrom, Daniel Vetter, DRI Development, Huang Rui,
	Brian Paul, Daniel Vetter

Am 05.11.20 um 14:20 schrieb Daniel Vetter:
> On Thu, Nov 05, 2020 at 01:56:22PM +0100, Christian König wrote:
>> Am 05.11.20 um 13:50 schrieb Daniel Vetter:
>>> On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
>>>> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
>>>>> On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
>>>>>> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
>>>>>>> Random observation while trying to review Christian's patch series to
>>>>>>> stop looking at struct page for dma-buf imports.
>>>>>>>
>>>>>>> This was originally added in
>>>>>>>
>>>>>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
>>>>>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
>>>>>>> Date:   Fri Jan 3 11:47:23 2014 +0100
>>>>>>>
>>>>>>>         drm/ttm: Correctly set page mapping and -index members
>>>>>>>
>>>>>>>         Needed for some vm operations; most notably unmap_mapping_range() with
>>>>>>>         even_cows = 0.
>>>>>>>
>>>>>>>         Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>>>>>>         Reviewed-by: Brian Paul <brianp@vmware.com>
>>>>>>>
>>>>>>> but we do not have a single caller of unmap_mapping_range with
>>>>>>> even_cows == 0. And all the gem drivers don't do this, so another
>>>>>>> small thing we could standardize between drm and ttm drivers.
>>>>>>>
>>>>>>> Plus I don't really see a need for unamp_mapping_range where we don't
>>>>>>> want to indiscriminately shoot down all ptes.
>>>>>> NAK, we use this to determine if a pages belongs to the driver or not in
>>>>>> amdgpu for example.
>>>>>>
>>>>>> Mostly used for debugging, but I would really like to keep that.
>>>>> Can you pls point me at that code? A quick grep hasn't really found much at all.
>>>> See amdgpu_iomem_read() for an example:
>>> Why do you reject this?
>> When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give the
>> same access as /dev/mem to system memory and that is forbidden. But as I
>> noted this is just for the debugfs file.
> Ah, there's a config option for that. Plus it's debugfs, anything goes in
> debugfs, but if you're worried about that hole we should just disable the
> entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
> top, that follow_pfn patch series I'm baking is all about this kind of
> fun.

And exactly that would get a NAK from us.

We have specially created that debugfs file as an alternative when 
CONFIG_STRICT_DEVMEM is set.

Regards,
Christian.

>
>> When I tried a few years ago to not set the page->mapping I immediately ran
>> into issues with our eviction test. So I think that this is used elsewhere
>> as well.
> That's the kind of interaction I'm worried about here tbh. If this does
> some kind of shrinking of some sorts, I think a real shrinker should take
> over.
>
> An improved grep shows nothing else, so the only the above is the only
> thing I can think of. What kind of eviction test goes boom if you clear
> ->mapping here? I'd be happy to type up the clever trick for the debugfs
> files.
> -Daniel
>
>> Regards,
>> Christian.
>>
>>> If this is to avoid issues with userptr, then I think there's a simple
>>> trick:
>>> - grab page reference
>>> - recheck that the iova still points at the same address
>>> - do read/write, safe in the knowledge that this page cannot be reused for
>>>     anything else
>>> - drop page reference
>>>
>>> Of course this can still race against iova updates, but that seems to be a
>>> fundamental part of your debug interface here.
>>>
>>> Or am I missing something?
>>>
>>> Just pondering this more since setting the page->mapping pointer for just
>>> this seems somewhat wild abuse of ->mapping semantics :-)
>>> -Daniel
>>>
>>>>>                   if (p->mapping != adev->mman.bdev.dev_mapping)
>>>>>                           return -EPERM;
>>>> Christian.
>>>>
>>>>> -Daniel
>>>>>
>>>>>> Christian.
>>>>>>
>>>>>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
>>>>>>> Cc: Brian Paul <brianp@vmware.com>
>>>>>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>>>>>> Cc: Christian Koenig <christian.koenig@amd.com>
>>>>>>> Cc: Huang Rui <ray.huang@amd.com>
>>>>>>> ---
>>>>>>>      drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>>>>>>>      1 file changed, 12 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
>>>>>>> index 8861a74ac335..438ea43fd8c1 100644
>>>>>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
>>>>>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
>>>>>>> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>>>>>          return ret;
>>>>>>>      }
>>>>>>>
>>>>>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>>>>> -{
>>>>>>> -     pgoff_t i;
>>>>>>> -
>>>>>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
>>>>>>> -             return;
>>>>>>> -
>>>>>>> -     for (i = 0; i < ttm->num_pages; ++i)
>>>>>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
>>>>>>> -}
>>>>>>> -
>>>>>>>      int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>>>>>                      struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>>>>>>>      {
>>>>>>> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>>>>>          if (ret)
>>>>>>>                  return ret;
>>>>>>>
>>>>>>> -     ttm_tt_add_mapping(bdev, ttm);
>>>>>>>          ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>>>>>>>          if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>>>>>>>                  ret = ttm_tt_swapin(ttm);

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 13:22             ` Christian König
@ 2020-11-05 14:31               ` Daniel Vetter
  2020-11-05 14:38                 ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-05 14:31 UTC (permalink / raw)
  To: Christian König
  Cc: Daniel Vetter, Thomas Hellstrom, Huang Rui, Brian Paul, DRI Development

On Thu, Nov 5, 2020 at 2:22 PM Christian König <christian.koenig@amd.com> wrote:
>
> Am 05.11.20 um 14:20 schrieb Daniel Vetter:
> > On Thu, Nov 05, 2020 at 01:56:22PM +0100, Christian König wrote:
> >> Am 05.11.20 um 13:50 schrieb Daniel Vetter:
> >>> On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
> >>>> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
> >>>>> On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
> >>>>>> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> >>>>>>> Random observation while trying to review Christian's patch series to
> >>>>>>> stop looking at struct page for dma-buf imports.
> >>>>>>>
> >>>>>>> This was originally added in
> >>>>>>>
> >>>>>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> >>>>>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
> >>>>>>> Date:   Fri Jan 3 11:47:23 2014 +0100
> >>>>>>>
> >>>>>>>         drm/ttm: Correctly set page mapping and -index members
> >>>>>>>
> >>>>>>>         Needed for some vm operations; most notably unmap_mapping_range() with
> >>>>>>>         even_cows = 0.
> >>>>>>>
> >>>>>>>         Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> >>>>>>>         Reviewed-by: Brian Paul <brianp@vmware.com>
> >>>>>>>
> >>>>>>> but we do not have a single caller of unmap_mapping_range with
> >>>>>>> even_cows == 0. And all the gem drivers don't do this, so another
> >>>>>>> small thing we could standardize between drm and ttm drivers.
> >>>>>>>
> >>>>>>> Plus I don't really see a need for unamp_mapping_range where we don't
> >>>>>>> want to indiscriminately shoot down all ptes.
> >>>>>> NAK, we use this to determine if a pages belongs to the driver or not in
> >>>>>> amdgpu for example.
> >>>>>>
> >>>>>> Mostly used for debugging, but I would really like to keep that.
> >>>>> Can you pls point me at that code? A quick grep hasn't really found much at all.
> >>>> See amdgpu_iomem_read() for an example:
> >>> Why do you reject this?
> >> When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give the
> >> same access as /dev/mem to system memory and that is forbidden. But as I
> >> noted this is just for the debugfs file.
> > Ah, there's a config option for that. Plus it's debugfs, anything goes in
> > debugfs, but if you're worried about that hole we should just disable the
> > entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
> > top, that follow_pfn patch series I'm baking is all about this kind of
> > fun.
>
> And exactly that would get a NAK from us.
>
> We have specially created that debugfs file as an alternative when
> CONFIG_STRICT_DEVMEM is set.

Uh that doesn't work if you work around core restrictions with your
own debugfs paths. Maybe you can do fun like this in your dkms, but
not in upstream. Like if this was specifically created to work around
CONFIG_STRICT_DEVMEM (and it sounds like that) then I think this
should never have landed in upstream to begin with.
-Daniel

>
> Regards,
> Christian.
>
> >
> >> When I tried a few years ago to not set the page->mapping I immediately ran
> >> into issues with our eviction test. So I think that this is used elsewhere
> >> as well.
> > That's the kind of interaction I'm worried about here tbh. If this does
> > some kind of shrinking of some sorts, I think a real shrinker should take
> > over.
> >
> > An improved grep shows nothing else, so the only the above is the only
> > thing I can think of. What kind of eviction test goes boom if you clear
> > ->mapping here? I'd be happy to type up the clever trick for the debugfs
> > files.
> > -Daniel
> >
> >> Regards,
> >> Christian.
> >>
> >>> If this is to avoid issues with userptr, then I think there's a simple
> >>> trick:
> >>> - grab page reference
> >>> - recheck that the iova still points at the same address
> >>> - do read/write, safe in the knowledge that this page cannot be reused for
> >>>     anything else
> >>> - drop page reference
> >>>
> >>> Of course this can still race against iova updates, but that seems to be a
> >>> fundamental part of your debug interface here.
> >>>
> >>> Or am I missing something?
> >>>
> >>> Just pondering this more since setting the page->mapping pointer for just
> >>> this seems somewhat wild abuse of ->mapping semantics :-)
> >>> -Daniel
> >>>
> >>>>>                   if (p->mapping != adev->mman.bdev.dev_mapping)
> >>>>>                           return -EPERM;
> >>>> Christian.
> >>>>
> >>>>> -Daniel
> >>>>>
> >>>>>> Christian.
> >>>>>>
> >>>>>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> >>>>>>> Cc: Brian Paul <brianp@vmware.com>
> >>>>>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> >>>>>>> Cc: Christian Koenig <christian.koenig@amd.com>
> >>>>>>> Cc: Huang Rui <ray.huang@amd.com>
> >>>>>>> ---
> >>>>>>>      drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> >>>>>>>      1 file changed, 12 deletions(-)
> >>>>>>>
> >>>>>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> >>>>>>> index 8861a74ac335..438ea43fd8c1 100644
> >>>>>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> >>>>>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> >>>>>>> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> >>>>>>>          return ret;
> >>>>>>>      }
> >>>>>>>
> >>>>>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> >>>>>>> -{
> >>>>>>> -     pgoff_t i;
> >>>>>>> -
> >>>>>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> >>>>>>> -             return;
> >>>>>>> -
> >>>>>>> -     for (i = 0; i < ttm->num_pages; ++i)
> >>>>>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
> >>>>>>> -}
> >>>>>>> -
> >>>>>>>      int ttm_tt_populate(struct ttm_bo_device *bdev,
> >>>>>>>                      struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> >>>>>>>      {
> >>>>>>> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> >>>>>>>          if (ret)
> >>>>>>>                  return ret;
> >>>>>>>
> >>>>>>> -     ttm_tt_add_mapping(bdev, ttm);
> >>>>>>>          ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> >>>>>>>          if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> >>>>>>>                  ret = ttm_tt_swapin(ttm);
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 14:31               ` Daniel Vetter
@ 2020-11-05 14:38                 ` Daniel Vetter
  2020-11-05 15:15                   ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-05 14:38 UTC (permalink / raw)
  To: Christian König
  Cc: Daniel Vetter, Thomas Hellstrom, Huang Rui, Brian Paul, DRI Development

On Thu, Nov 5, 2020 at 3:31 PM Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Thu, Nov 5, 2020 at 2:22 PM Christian König <christian.koenig@amd.com> wrote:
> >
> > Am 05.11.20 um 14:20 schrieb Daniel Vetter:
> > > On Thu, Nov 05, 2020 at 01:56:22PM +0100, Christian König wrote:
> > >> Am 05.11.20 um 13:50 schrieb Daniel Vetter:
> > >>> On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
> > >>>> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
> > >>>>> On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
> > >>>>>> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> > >>>>>>> Random observation while trying to review Christian's patch series to
> > >>>>>>> stop looking at struct page for dma-buf imports.
> > >>>>>>>
> > >>>>>>> This was originally added in
> > >>>>>>>
> > >>>>>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > >>>>>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
> > >>>>>>> Date:   Fri Jan 3 11:47:23 2014 +0100
> > >>>>>>>
> > >>>>>>>         drm/ttm: Correctly set page mapping and -index members
> > >>>>>>>
> > >>>>>>>         Needed for some vm operations; most notably unmap_mapping_range() with
> > >>>>>>>         even_cows = 0.
> > >>>>>>>
> > >>>>>>>         Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > >>>>>>>         Reviewed-by: Brian Paul <brianp@vmware.com>
> > >>>>>>>
> > >>>>>>> but we do not have a single caller of unmap_mapping_range with
> > >>>>>>> even_cows == 0. And all the gem drivers don't do this, so another
> > >>>>>>> small thing we could standardize between drm and ttm drivers.
> > >>>>>>>
> > >>>>>>> Plus I don't really see a need for unamp_mapping_range where we don't
> > >>>>>>> want to indiscriminately shoot down all ptes.
> > >>>>>> NAK, we use this to determine if a pages belongs to the driver or not in
> > >>>>>> amdgpu for example.
> > >>>>>>
> > >>>>>> Mostly used for debugging, but I would really like to keep that.
> > >>>>> Can you pls point me at that code? A quick grep hasn't really found much at all.
> > >>>> See amdgpu_iomem_read() for an example:
> > >>> Why do you reject this?
> > >> When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give the
> > >> same access as /dev/mem to system memory and that is forbidden. But as I
> > >> noted this is just for the debugfs file.
> > > Ah, there's a config option for that. Plus it's debugfs, anything goes in
> > > debugfs, but if you're worried about that hole we should just disable the
> > > entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
> > > top, that follow_pfn patch series I'm baking is all about this kind of
> > > fun.
> >
> > And exactly that would get a NAK from us.
> >
> > We have specially created that debugfs file as an alternative when
> > CONFIG_STRICT_DEVMEM is set.
>
> Uh that doesn't work if you work around core restrictions with your
> own debugfs paths. Maybe you can do fun like this in your dkms, but
> not in upstream. Like if this was specifically created to work around
> CONFIG_STRICT_DEVMEM (and it sounds like that) then I think this
> should never have landed in upstream to begin with.

I'm also kinda confused that there's distros with CONFIG_STRICT_DEVMEM
which allow debugfs. debugfs is a pretty bad root hole all around, or
at least that's been the assumption all the time.
-Daniel

> > >> When I tried a few years ago to not set the page->mapping I immediately ran
> > >> into issues with our eviction test. So I think that this is used elsewhere
> > >> as well.
> > > That's the kind of interaction I'm worried about here tbh. If this does
> > > some kind of shrinking of some sorts, I think a real shrinker should take
> > > over.
> > >
> > > An improved grep shows nothing else, so the only the above is the only
> > > thing I can think of. What kind of eviction test goes boom if you clear
> > > ->mapping here? I'd be happy to type up the clever trick for the debugfs
> > > files.
> > > -Daniel
> > >
> > >> Regards,
> > >> Christian.
> > >>
> > >>> If this is to avoid issues with userptr, then I think there's a simple
> > >>> trick:
> > >>> - grab page reference
> > >>> - recheck that the iova still points at the same address
> > >>> - do read/write, safe in the knowledge that this page cannot be reused for
> > >>>     anything else
> > >>> - drop page reference
> > >>>
> > >>> Of course this can still race against iova updates, but that seems to be a
> > >>> fundamental part of your debug interface here.
> > >>>
> > >>> Or am I missing something?
> > >>>
> > >>> Just pondering this more since setting the page->mapping pointer for just
> > >>> this seems somewhat wild abuse of ->mapping semantics :-)
> > >>> -Daniel
> > >>>
> > >>>>>                   if (p->mapping != adev->mman.bdev.dev_mapping)
> > >>>>>                           return -EPERM;
> > >>>> Christian.
> > >>>>
> > >>>>> -Daniel
> > >>>>>
> > >>>>>> Christian.
> > >>>>>>
> > >>>>>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > >>>>>>> Cc: Brian Paul <brianp@vmware.com>
> > >>>>>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > >>>>>>> Cc: Christian Koenig <christian.koenig@amd.com>
> > >>>>>>> Cc: Huang Rui <ray.huang@amd.com>
> > >>>>>>> ---
> > >>>>>>>      drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> > >>>>>>>      1 file changed, 12 deletions(-)
> > >>>>>>>
> > >>>>>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> > >>>>>>> index 8861a74ac335..438ea43fd8c1 100644
> > >>>>>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> > >>>>>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> > >>>>>>> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > >>>>>>>          return ret;
> > >>>>>>>      }
> > >>>>>>>
> > >>>>>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > >>>>>>> -{
> > >>>>>>> -     pgoff_t i;
> > >>>>>>> -
> > >>>>>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> > >>>>>>> -             return;
> > >>>>>>> -
> > >>>>>>> -     for (i = 0; i < ttm->num_pages; ++i)
> > >>>>>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
> > >>>>>>> -}
> > >>>>>>> -
> > >>>>>>>      int ttm_tt_populate(struct ttm_bo_device *bdev,
> > >>>>>>>                      struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> > >>>>>>>      {
> > >>>>>>> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> > >>>>>>>          if (ret)
> > >>>>>>>                  return ret;
> > >>>>>>>
> > >>>>>>> -     ttm_tt_add_mapping(bdev, ttm);
> > >>>>>>>          ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> > >>>>>>>          if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> > >>>>>>>                  ret = ttm_tt_swapin(ttm);
> >
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch



-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 14:38                 ` Daniel Vetter
@ 2020-11-05 15:15                   ` Christian König
  2020-11-05 16:37                     ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-11-05 15:15 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, Huang Rui, Brian Paul, DRI Development

Am 05.11.20 um 15:38 schrieb Daniel Vetter:
> On Thu, Nov 5, 2020 at 3:31 PM Daniel Vetter <daniel@ffwll.ch> wrote:
>> On Thu, Nov 5, 2020 at 2:22 PM Christian König <christian.koenig@amd.com> wrote:
>>> Am 05.11.20 um 14:20 schrieb Daniel Vetter:
>>>> On Thu, Nov 05, 2020 at 01:56:22PM +0100, Christian König wrote:
>>>>> Am 05.11.20 um 13:50 schrieb Daniel Vetter:
>>>>>> On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
>>>>>>> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
>>>>>>>> On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
>>>>>>>>> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
>>>>>>>>>> Random observation while trying to review Christian's patch series to
>>>>>>>>>> stop looking at struct page for dma-buf imports.
>>>>>>>>>>
>>>>>>>>>> This was originally added in
>>>>>>>>>>
>>>>>>>>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
>>>>>>>>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
>>>>>>>>>> Date:   Fri Jan 3 11:47:23 2014 +0100
>>>>>>>>>>
>>>>>>>>>>          drm/ttm: Correctly set page mapping and -index members
>>>>>>>>>>
>>>>>>>>>>          Needed for some vm operations; most notably unmap_mapping_range() with
>>>>>>>>>>          even_cows = 0.
>>>>>>>>>>
>>>>>>>>>>          Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>>>>>>>>>          Reviewed-by: Brian Paul <brianp@vmware.com>
>>>>>>>>>>
>>>>>>>>>> but we do not have a single caller of unmap_mapping_range with
>>>>>>>>>> even_cows == 0. And all the gem drivers don't do this, so another
>>>>>>>>>> small thing we could standardize between drm and ttm drivers.
>>>>>>>>>>
>>>>>>>>>> Plus I don't really see a need for unamp_mapping_range where we don't
>>>>>>>>>> want to indiscriminately shoot down all ptes.
>>>>>>>>> NAK, we use this to determine if a pages belongs to the driver or not in
>>>>>>>>> amdgpu for example.
>>>>>>>>>
>>>>>>>>> Mostly used for debugging, but I would really like to keep that.
>>>>>>>> Can you pls point me at that code? A quick grep hasn't really found much at all.
>>>>>>> See amdgpu_iomem_read() for an example:
>>>>>> Why do you reject this?
>>>>> When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give the
>>>>> same access as /dev/mem to system memory and that is forbidden. But as I
>>>>> noted this is just for the debugfs file.
>>>> Ah, there's a config option for that. Plus it's debugfs, anything goes in
>>>> debugfs, but if you're worried about that hole we should just disable the
>>>> entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
>>>> top, that follow_pfn patch series I'm baking is all about this kind of
>>>> fun.
>>> And exactly that would get a NAK from us.
>>>
>>> We have specially created that debugfs file as an alternative when
>>> CONFIG_STRICT_DEVMEM is set.
>> Uh that doesn't work if you work around core restrictions with your
>> own debugfs paths.

That's why we have the restriction to check the mapping of the pages.

This way we only expose the memory which was allocated by our driver and 
don't allow any uncontrolled access to the whole system memory.

We have something similar for radeon as well, but there we have a global 
GART table which we can use for validating stuff.

>>   Maybe you can do fun like this in your dkms, but
>> not in upstream. Like if this was specifically created to work around
>> CONFIG_STRICT_DEVMEM (and it sounds like that) then I think this
>> should never have landed in upstream to begin with.
> I'm also kinda confused that there's distros with CONFIG_STRICT_DEVMEM
> which allow debugfs. debugfs is a pretty bad root hole all around, or
> at least that's been the assumption all the time.

Yeah, completely agree :) But that's not my problem.

Christian.

> -Daniel
>
>>>>> When I tried a few years ago to not set the page->mapping I immediately ran
>>>>> into issues with our eviction test. So I think that this is used elsewhere
>>>>> as well.
>>>> That's the kind of interaction I'm worried about here tbh. If this does
>>>> some kind of shrinking of some sorts, I think a real shrinker should take
>>>> over.
>>>>
>>>> An improved grep shows nothing else, so the only the above is the only
>>>> thing I can think of. What kind of eviction test goes boom if you clear
>>>> ->mapping here? I'd be happy to type up the clever trick for the debugfs
>>>> files.
>>>> -Daniel
>>>>
>>>>> Regards,
>>>>> Christian.
>>>>>
>>>>>> If this is to avoid issues with userptr, then I think there's a simple
>>>>>> trick:
>>>>>> - grab page reference
>>>>>> - recheck that the iova still points at the same address
>>>>>> - do read/write, safe in the knowledge that this page cannot be reused for
>>>>>>      anything else
>>>>>> - drop page reference
>>>>>>
>>>>>> Of course this can still race against iova updates, but that seems to be a
>>>>>> fundamental part of your debug interface here.
>>>>>>
>>>>>> Or am I missing something?
>>>>>>
>>>>>> Just pondering this more since setting the page->mapping pointer for just
>>>>>> this seems somewhat wild abuse of ->mapping semantics :-)
>>>>>> -Daniel
>>>>>>
>>>>>>>>                    if (p->mapping != adev->mman.bdev.dev_mapping)
>>>>>>>>                            return -EPERM;
>>>>>>> Christian.
>>>>>>>
>>>>>>>> -Daniel
>>>>>>>>
>>>>>>>>> Christian.
>>>>>>>>>
>>>>>>>>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
>>>>>>>>>> Cc: Brian Paul <brianp@vmware.com>
>>>>>>>>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>>>>>>>>> Cc: Christian Koenig <christian.koenig@amd.com>
>>>>>>>>>> Cc: Huang Rui <ray.huang@amd.com>
>>>>>>>>>> ---
>>>>>>>>>>       drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>>>>>>>>>>       1 file changed, 12 deletions(-)
>>>>>>>>>>
>>>>>>>>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
>>>>>>>>>> index 8861a74ac335..438ea43fd8c1 100644
>>>>>>>>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
>>>>>>>>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
>>>>>>>>>> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>>>>>>>>           return ret;
>>>>>>>>>>       }
>>>>>>>>>>
>>>>>>>>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>>>>>>>> -{
>>>>>>>>>> -     pgoff_t i;
>>>>>>>>>> -
>>>>>>>>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
>>>>>>>>>> -             return;
>>>>>>>>>> -
>>>>>>>>>> -     for (i = 0; i < ttm->num_pages; ++i)
>>>>>>>>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
>>>>>>>>>> -}
>>>>>>>>>> -
>>>>>>>>>>       int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>>>>>>>>                       struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>>>>>>>>>>       {
>>>>>>>>>> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>>>>>>>>           if (ret)
>>>>>>>>>>                   return ret;
>>>>>>>>>>
>>>>>>>>>> -     ttm_tt_add_mapping(bdev, ttm);
>>>>>>>>>>           ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>>>>>>>>>>           if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>>>>>>>>>>                   ret = ttm_tt_swapin(ttm);
>>
>> --
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&amp;data=04%7C01%7Cchristian.koenig%40amd.com%7C619e6a6113674691eb9708d8819874f4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637401839082694450%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Uo7UXS7y%2BU%2FHfnBenx2vQXuyyB%2FCuOULLOp1uL0eg4I%3D&amp;reserved=0
>
>

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 15:15                   ` Christian König
@ 2020-11-05 16:37                     ` Daniel Vetter
  2020-11-06  8:30                       ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-05 16:37 UTC (permalink / raw)
  To: Christian König
  Cc: Daniel Vetter, Huang Rui, Brian Paul, DRI Development

On Thu, Nov 5, 2020 at 4:15 PM Christian König <christian.koenig@amd.com> wrote:
>
> Am 05.11.20 um 15:38 schrieb Daniel Vetter:
> > On Thu, Nov 5, 2020 at 3:31 PM Daniel Vetter <daniel@ffwll.ch> wrote:
> >> On Thu, Nov 5, 2020 at 2:22 PM Christian König <christian.koenig@amd.com> wrote:
> >>> Am 05.11.20 um 14:20 schrieb Daniel Vetter:
> >>>> On Thu, Nov 05, 2020 at 01:56:22PM +0100, Christian König wrote:
> >>>>> Am 05.11.20 um 13:50 schrieb Daniel Vetter:
> >>>>>> On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
> >>>>>>> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
> >>>>>>>> On Thu, Nov 5, 2020 at 9:00 AM Christian König <christian.koenig@amd.com> wrote:
> >>>>>>>>> Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> >>>>>>>>>> Random observation while trying to review Christian's patch series to
> >>>>>>>>>> stop looking at struct page for dma-buf imports.
> >>>>>>>>>>
> >>>>>>>>>> This was originally added in
> >>>>>>>>>>
> >>>>>>>>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> >>>>>>>>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
> >>>>>>>>>> Date:   Fri Jan 3 11:47:23 2014 +0100
> >>>>>>>>>>
> >>>>>>>>>>          drm/ttm: Correctly set page mapping and -index members
> >>>>>>>>>>
> >>>>>>>>>>          Needed for some vm operations; most notably unmap_mapping_range() with
> >>>>>>>>>>          even_cows = 0.
> >>>>>>>>>>
> >>>>>>>>>>          Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> >>>>>>>>>>          Reviewed-by: Brian Paul <brianp@vmware.com>
> >>>>>>>>>>
> >>>>>>>>>> but we do not have a single caller of unmap_mapping_range with
> >>>>>>>>>> even_cows == 0. And all the gem drivers don't do this, so another
> >>>>>>>>>> small thing we could standardize between drm and ttm drivers.
> >>>>>>>>>>
> >>>>>>>>>> Plus I don't really see a need for unamp_mapping_range where we don't
> >>>>>>>>>> want to indiscriminately shoot down all ptes.
> >>>>>>>>> NAK, we use this to determine if a pages belongs to the driver or not in
> >>>>>>>>> amdgpu for example.
> >>>>>>>>>
> >>>>>>>>> Mostly used for debugging, but I would really like to keep that.
> >>>>>>>> Can you pls point me at that code? A quick grep hasn't really found much at all.
> >>>>>>> See amdgpu_iomem_read() for an example:
> >>>>>> Why do you reject this?
> >>>>> When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give the
> >>>>> same access as /dev/mem to system memory and that is forbidden. But as I
> >>>>> noted this is just for the debugfs file.
> >>>> Ah, there's a config option for that. Plus it's debugfs, anything goes in
> >>>> debugfs, but if you're worried about that hole we should just disable the
> >>>> entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
> >>>> top, that follow_pfn patch series I'm baking is all about this kind of
> >>>> fun.
> >>> And exactly that would get a NAK from us.
> >>>
> >>> We have specially created that debugfs file as an alternative when
> >>> CONFIG_STRICT_DEVMEM is set.
> >> Uh that doesn't work if you work around core restrictions with your
> >> own debugfs paths.
>
> That's why we have the restriction to check the mapping of the pages.
>
> This way we only expose the memory which was allocated by our driver and
> don't allow any uncontrolled access to the whole system memory.
>
> We have something similar for radeon as well, but there we have a global
> GART table which we can use for validating stuff.

The check doesn't take any locks over the check and copy*user, I don't
think it's protecting anything really against somewhat adverse
userspace.

I mean fundamentally locking down stuff like STRICT_DEVMEM or all the
others makes debugging harder, that's kinda the expected tradeoff.

> >>   Maybe you can do fun like this in your dkms, but
> >> not in upstream. Like if this was specifically created to work around
> >> CONFIG_STRICT_DEVMEM (and it sounds like that) then I think this
> >> should never have landed in upstream to begin with.
> > I'm also kinda confused that there's distros with CONFIG_STRICT_DEVMEM
> > which allow debugfs. debugfs is a pretty bad root hole all around, or
> > at least that's been the assumption all the time.
>
> Yeah, completely agree :) But that's not my problem.

I guess I'll do another rfc series and poke a pile of people ... seems
to be a habit I'm developing :-)
-Daniel

>
> Christian.
>
> > -Daniel
> >
> >>>>> When I tried a few years ago to not set the page->mapping I immediately ran
> >>>>> into issues with our eviction test. So I think that this is used elsewhere
> >>>>> as well.
> >>>> That's the kind of interaction I'm worried about here tbh. If this does
> >>>> some kind of shrinking of some sorts, I think a real shrinker should take
> >>>> over.
> >>>>
> >>>> An improved grep shows nothing else, so the only the above is the only
> >>>> thing I can think of. What kind of eviction test goes boom if you clear
> >>>> ->mapping here? I'd be happy to type up the clever trick for the debugfs
> >>>> files.
> >>>> -Daniel
> >>>>
> >>>>> Regards,
> >>>>> Christian.
> >>>>>
> >>>>>> If this is to avoid issues with userptr, then I think there's a simple
> >>>>>> trick:
> >>>>>> - grab page reference
> >>>>>> - recheck that the iova still points at the same address
> >>>>>> - do read/write, safe in the knowledge that this page cannot be reused for
> >>>>>>      anything else
> >>>>>> - drop page reference
> >>>>>>
> >>>>>> Of course this can still race against iova updates, but that seems to be a
> >>>>>> fundamental part of your debug interface here.
> >>>>>>
> >>>>>> Or am I missing something?
> >>>>>>
> >>>>>> Just pondering this more since setting the page->mapping pointer for just
> >>>>>> this seems somewhat wild abuse of ->mapping semantics :-)
> >>>>>> -Daniel
> >>>>>>
> >>>>>>>>                    if (p->mapping != adev->mman.bdev.dev_mapping)
> >>>>>>>>                            return -EPERM;
> >>>>>>> Christian.
> >>>>>>>
> >>>>>>>> -Daniel
> >>>>>>>>
> >>>>>>>>> Christian.
> >>>>>>>>>
> >>>>>>>>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> >>>>>>>>>> Cc: Brian Paul <brianp@vmware.com>
> >>>>>>>>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> >>>>>>>>>> Cc: Christian Koenig <christian.koenig@amd.com>
> >>>>>>>>>> Cc: Huang Rui <ray.huang@amd.com>
> >>>>>>>>>> ---
> >>>>>>>>>>       drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> >>>>>>>>>>       1 file changed, 12 deletions(-)
> >>>>>>>>>>
> >>>>>>>>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> >>>>>>>>>> index 8861a74ac335..438ea43fd8c1 100644
> >>>>>>>>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> >>>>>>>>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> >>>>>>>>>> @@ -291,17 +291,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> >>>>>>>>>>           return ret;
> >>>>>>>>>>       }
> >>>>>>>>>>
> >>>>>>>>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> >>>>>>>>>> -{
> >>>>>>>>>> -     pgoff_t i;
> >>>>>>>>>> -
> >>>>>>>>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> >>>>>>>>>> -             return;
> >>>>>>>>>> -
> >>>>>>>>>> -     for (i = 0; i < ttm->num_pages; ++i)
> >>>>>>>>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
> >>>>>>>>>> -}
> >>>>>>>>>> -
> >>>>>>>>>>       int ttm_tt_populate(struct ttm_bo_device *bdev,
> >>>>>>>>>>                       struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> >>>>>>>>>>       {
> >>>>>>>>>> @@ -320,7 +309,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> >>>>>>>>>>           if (ret)
> >>>>>>>>>>                   return ret;
> >>>>>>>>>>
> >>>>>>>>>> -     ttm_tt_add_mapping(bdev, ttm);
> >>>>>>>>>>           ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> >>>>>>>>>>           if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> >>>>>>>>>>                   ret = ttm_tt_swapin(ttm);
> >>
> >> --
> >> Daniel Vetter
> >> Software Engineer, Intel Corporation
> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&amp;data=04%7C01%7Cchristian.koenig%40amd.com%7C619e6a6113674691eb9708d8819874f4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637401839082694450%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Uo7UXS7y%2BU%2FHfnBenx2vQXuyyB%2FCuOULLOp1uL0eg4I%3D&amp;reserved=0
> >
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-05 16:37                     ` Daniel Vetter
@ 2020-11-06  8:30                       ` Christian König
  0 siblings, 0 replies; 23+ messages in thread
From: Christian König @ 2020-11-06  8:30 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, Huang Rui, Brian Paul, DRI Development

Am 05.11.20 um 17:37 schrieb Daniel Vetter:
> [SNIP]
>>>>>>>>>>> NAK, we use this to determine if a pages belongs to the driver or not in
>>>>>>>>>>> amdgpu for example.
>>>>>>>>>>>
>>>>>>>>>>> Mostly used for debugging, but I would really like to keep that.
>>>>>>>>>> Can you pls point me at that code? A quick grep hasn't really found much at all.
>>>>>>>>> See amdgpu_iomem_read() for an example:
>>>>>>>> Why do you reject this?
>>>>>>> When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise give the
>>>>>>> same access as /dev/mem to system memory and that is forbidden. But as I
>>>>>>> noted this is just for the debugfs file.
>>>>>> Ah, there's a config option for that. Plus it's debugfs, anything goes in
>>>>>> debugfs, but if you're worried about that hole we should just disable the
>>>>>> entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
>>>>>> top, that follow_pfn patch series I'm baking is all about this kind of
>>>>>> fun.
>>>>> And exactly that would get a NAK from us.
>>>>>
>>>>> We have specially created that debugfs file as an alternative when
>>>>> CONFIG_STRICT_DEVMEM is set.
>>>> Uh that doesn't work if you work around core restrictions with your
>>>> own debugfs paths.
>> That's why we have the restriction to check the mapping of the pages.
>>
>> This way we only expose the memory which was allocated by our driver and
>> don't allow any uncontrolled access to the whole system memory.
>>
>> We have something similar for radeon as well, but there we have a global
>> GART table which we can use for validating stuff.
> The check doesn't take any locks over the check and copy*user, I don't
> think it's protecting anything really against somewhat adverse
> userspace.

You mean that it's racing with freeing the pages? Yes that is an obvious 
problem, but we already had the same issue for radeon as well.

On the other hand we could easily prevent that with a lock.

> I mean fundamentally locking down stuff like STRICT_DEVMEM or all the
> others makes debugging harder, that's kinda the expected tradeoff.

Well we just wanted to have the same debugging functionality we had for 
radeon.

As you said debugfs is a rabbit hole regarding attack vectors anyway.

If you are root you can just go to /sys and start reprogramming the 
hardware to do what you want to do.

Regards,
Christian.

>
>>>>    Maybe you can do fun like this in your dkms, but
>>>> not in upstream. Like if this was specifically created to work around
>>>> CONFIG_STRICT_DEVMEM (and it sounds like that) then I think this
>>>> should never have landed in upstream to begin with.
>>> I'm also kinda confused that there's distros with CONFIG_STRICT_DEVMEM
>>> which allow debugfs. debugfs is a pretty bad root hole all around, or
>>> at least that's been the assumption all the time.
>> Yeah, completely agree :) But that's not my problem.
> I guess I'll do another rfc series and poke a pile of people ... seems
> to be a habit I'm developing :-)
> -Daniel
>

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
       [not found]       ` <20201125181129.GA1858@infradead.org>
@ 2020-11-25 23:57         ` Jason Gunthorpe
  0 siblings, 0 replies; 23+ messages in thread
From: Jason Gunthorpe @ 2020-11-25 23:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Thomas Hellstrom, Daniel Vetter, Intel Graphics Development,
	LKML, DRI Development, linux-xfs, Linux MM, Huang Rui,
	Brian Paul, linux-fsdevel, Daniel Vetter, Christian Koenig

On Wed, Nov 25, 2020 at 06:11:29PM +0000, Christoph Hellwig wrote:
> On Wed, Nov 25, 2020 at 02:06:06PM -0400, Jason Gunthorpe wrote:
> > It uses a empty 'cover-letter' commit and automatically transforms it
> > into exactly the right stuff. Keeps track of everything you send in
> > git, and there is a little tool to auto-run git range-diff to help
> > build change logs..
> > 
> > https://github.com/jgunthorpe/Kernel-Maintainer-Tools/blob/master/gj_tools/cmd_send_patches.py
> > 
> > I've been occasionaly wondering if I should suggest Konstantin add a
> > sending side to b4, maybe using some of those ideas..
> > 
> > (careful if you run it, it does autosend without prompting)
> 
> The looks pretty fancy.  Here is my trivial patchbomb.sh script
> 
> #!/bin/sh
> 
> COVERLETTER=$1
> PATCHES=$2
> 
> git send-email --annotate --to-cover --cc-cover $1 $2
> 
> still needs the git basecommit..endcommit notation, but it fires
> up the series for review.

annotate is OK, I used that for a long time..

My main gripe was it didn't setup the to/cc until after the annotate
editor closes.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-25 18:06     ` Jason Gunthorpe
@ 2020-11-25 18:16       ` Daniel Stone
       [not found]       ` <20201125181129.GA1858@infradead.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Daniel Stone @ 2020-11-25 18:16 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Thomas Hellstrom, Daniel Vetter, Intel Graphics Development,
	LKML, DRI Development, linux-xfs, Linux MM, Huang Rui,
	Brian Paul, linux-fsdevel, Daniel Vetter, Christian Koenig

Hi,

On Wed, 25 Nov 2020 at 18:06, Jason Gunthorpe <jgg@ziepe.ca> wrote:
> On Wed, Nov 25, 2020 at 05:28:32PM +0100, Daniel Vetter wrote:
> > Apologies again, this shouldn't have been included. But at least I
> > have an idea now why this patch somehow was included in the git
> > send-email. Lovely interface :-/
>
> I wrote a bit of a script around this because git send-email just too
> hard to use
>
> The key workflow change I made was to have it prepare all the emails
> to send and open them in an editor for review - exactly as they would
> be sent to the lists.
>
> It uses a empty 'cover-letter' commit and automatically transforms it
> into exactly the right stuff. Keeps track of everything you send in
> git, and there is a little tool to auto-run git range-diff to help
> build change logs..

This sounds a fair bit like patman, which does something similar and
also lets you annotate commit messages with changelogs.

But of course, suggesting different methods of carving patches into
stone tablets to someone who's written their own, is even more of a
windmill tilt than rDMA. ;)

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-25 16:28   ` Daniel Vetter
@ 2020-11-25 18:06     ` Jason Gunthorpe
  2020-11-25 18:16       ` Daniel Stone
       [not found]       ` <20201125181129.GA1858@infradead.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Jason Gunthorpe @ 2020-11-25 18:06 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Thomas Hellstrom, Intel Graphics Development, LKML,
	DRI Development, linux-xfs, Linux MM, Huang Rui, Brian Paul,
	linux-fsdevel, Daniel Vetter, Christian Koenig

On Wed, Nov 25, 2020 at 05:28:32PM +0100, Daniel Vetter wrote:
> On Wed, Nov 25, 2020 at 5:25 PM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> >
> > Random observation while trying to review Christian's patch series to
> > stop looking at struct page for dma-buf imports.
> >
> > This was originally added in
> >
> > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > Author: Thomas Hellstrom <thellstrom@vmware.com>
> > Date:   Fri Jan 3 11:47:23 2014 +0100
> >
> >     drm/ttm: Correctly set page mapping and -index members
> >
> >     Needed for some vm operations; most notably unmap_mapping_range() with
> >     even_cows = 0.
> >
> >     Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> >     Reviewed-by: Brian Paul <brianp@vmware.com>
> >
> > but we do not have a single caller of unmap_mapping_range with
> > even_cows == 0. And all the gem drivers don't do this, so another
> > small thing we could standardize between drm and ttm drivers.
> >
> > Plus I don't really see a need for unamp_mapping_range where we don't
> > want to indiscriminately shoot down all ptes.
> >
> > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > Cc: Brian Paul <brianp@vmware.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Christian Koenig <christian.koenig@amd.com>
> > Cc: Huang Rui <ray.huang@amd.com>
> 
> Apologies again, this shouldn't have been included. But at least I
> have an idea now why this patch somehow was included in the git
> send-email. Lovely interface :-/

I wrote a bit of a script around this because git send-email just too
hard to use

The key workflow change I made was to have it prepare all the emails
to send and open them in an editor for review - exactly as they would
be sent to the lists.

It uses a empty 'cover-letter' commit and automatically transforms it
into exactly the right stuff. Keeps track of everything you send in
git, and there is a little tool to auto-run git range-diff to help
build change logs..

https://github.com/jgunthorpe/Kernel-Maintainer-Tools/blob/master/gj_tools/cmd_send_patches.py

I've been occasionaly wondering if I should suggest Konstantin add a
sending side to b4, maybe using some of those ideas..

(careful if you run it, it does autosend without prompting)

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-25 16:25 ` [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
@ 2020-11-25 16:28   ` Daniel Vetter
  2020-11-25 18:06     ` Jason Gunthorpe
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-25 16:28 UTC (permalink / raw)
  To: DRI Development
  Cc: Thomas Hellstrom, Intel Graphics Development, LKML, linux-xfs,
	Linux MM, Huang Rui, Brian Paul, linux-fsdevel, Daniel Vetter,
	Christian Koenig

On Wed, Nov 25, 2020 at 5:25 PM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> Random observation while trying to review Christian's patch series to
> stop looking at struct page for dma-buf imports.
>
> This was originally added in
>
> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> Author: Thomas Hellstrom <thellstrom@vmware.com>
> Date:   Fri Jan 3 11:47:23 2014 +0100
>
>     drm/ttm: Correctly set page mapping and -index members
>
>     Needed for some vm operations; most notably unmap_mapping_range() with
>     even_cows = 0.
>
>     Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>     Reviewed-by: Brian Paul <brianp@vmware.com>
>
> but we do not have a single caller of unmap_mapping_range with
> even_cows == 0. And all the gem drivers don't do this, so another
> small thing we could standardize between drm and ttm drivers.
>
> Plus I don't really see a need for unamp_mapping_range where we don't
> want to indiscriminately shoot down all ptes.
>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Brian Paul <brianp@vmware.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Christian Koenig <christian.koenig@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>

Apologies again, this shouldn't have been included. But at least I
have an idea now why this patch somehow was included in the git
send-email. Lovely interface :-/
-Daniel

> ---
>  drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>  1 file changed, 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index da9eeffe0c6d..5b2eb6d58bb7 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>         return ret;
>  }
>
> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> -{
> -       pgoff_t i;
> -
> -       if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> -               return;
> -
> -       for (i = 0; i < ttm->num_pages; ++i)
> -               ttm->pages[i]->mapping = bdev->dev_mapping;
> -}
> -
>  int ttm_tt_populate(struct ttm_bo_device *bdev,
>                     struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>  {
> @@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>         if (ret)
>                 return ret;
>
> -       ttm_tt_add_mapping(bdev, ttm);
>         ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>         if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>                 ret = ttm_tt_swapin(ttm);
> --
> 2.29.2
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH] drm/ttm: don't set page->mapping
  2020-11-25 16:25 [PATCH v4 0/3] mmu_notifier vs fs_reclaim lockdep annotations Daniel Vetter
@ 2020-11-25 16:25 ` Daniel Vetter
  2020-11-25 16:28   ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-25 16:25 UTC (permalink / raw)
  To: DRI Development
  Cc: Thomas Hellstrom, Daniel Vetter, Intel Graphics Development,
	LKML, linux-xfs, linux-mm, Huang Rui, Brian Paul, linux-fsdevel,
	Daniel Vetter, Christian Koenig

Random observation while trying to review Christian's patch series to
stop looking at struct page for dma-buf imports.

This was originally added in

commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Fri Jan 3 11:47:23 2014 +0100

    drm/ttm: Correctly set page mapping and -index members

    Needed for some vm operations; most notably unmap_mapping_range() with
    even_cows = 0.

    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

but we do not have a single caller of unmap_mapping_range with
even_cows == 0. And all the gem drivers don't do this, so another
small thing we could standardize between drm and ttm drivers.

Plus I don't really see a need for unamp_mapping_range where we don't
want to indiscriminately shoot down all ptes.

Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index da9eeffe0c6d..5b2eb6d58bb7 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
 	return ret;
 }
 
-static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
-{
-	pgoff_t i;
-
-	if (ttm->page_flags & TTM_PAGE_FLAG_SG)
-		return;
-
-	for (i = 0; i < ttm->num_pages; ++i)
-		ttm->pages[i]->mapping = bdev->dev_mapping;
-}
-
 int ttm_tt_populate(struct ttm_bo_device *bdev,
 		    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 {
@@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
 	if (ret)
 		return ret;
 
-	ttm_tt_add_mapping(bdev, ttm);
 	ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
 	if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
 		ret = ttm_tt_swapin(ttm);
-- 
2.29.2

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-20 10:08       ` Christian König
@ 2020-11-20 15:01         ` Daniel Vetter
  0 siblings, 0 replies; 23+ messages in thread
From: Daniel Vetter @ 2020-11-20 15:01 UTC (permalink / raw)
  To: Christian König
  Cc: Thomas Hellstrom, Daniel Vetter, Intel Graphics Development,
	LKML, DRI Development, linux-xfs, Linux MM, Huang Rui,
	Brian Paul, linux-fsdevel, Daniel Vetter

On Fri, Nov 20, 2020 at 11:08:31AM +0100, Christian König wrote:
> Am 20.11.20 um 11:05 schrieb Daniel Vetter:
> > On Fri, Nov 20, 2020 at 11:04 AM Christian König
> > <christian.koenig@amd.com> wrote:
> > > Am 20.11.20 um 10:54 schrieb Daniel Vetter:
> > > > Random observation while trying to review Christian's patch series to
> > > > stop looking at struct page for dma-buf imports.
> > > > 
> > > > This was originally added in
> > > > 
> > > > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > > > Author: Thomas Hellstrom <thellstrom@vmware.com>
> > > > Date:   Fri Jan 3 11:47:23 2014 +0100
> > > > 
> > > >       drm/ttm: Correctly set page mapping and -index members
> > > > 
> > > >       Needed for some vm operations; most notably unmap_mapping_range() with
> > > >       even_cows = 0.
> > > > 
> > > >       Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > > >       Reviewed-by: Brian Paul <brianp@vmware.com>
> > > > 
> > > > but we do not have a single caller of unmap_mapping_range with
> > > > even_cows == 0. And all the gem drivers don't do this, so another
> > > > small thing we could standardize between drm and ttm drivers.
> > > > 
> > > > Plus I don't really see a need for unamp_mapping_range where we don't
> > > > want to indiscriminately shoot down all ptes.
> > > > 
> > > > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > > > Cc: Brian Paul <brianp@vmware.com>
> > > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > > > Cc: Christian Koenig <christian.koenig@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > This is still a NAK as long as we can't come up with a better way to
> > > track TTMs page allocations.
> > > 
> > > Additional to that page_mapping() is used quite extensively in the mm
> > > code and I'm not sure if that isn't needed for other stuff as well.
> > Apologies, I'm honestly not quite sure how this lone patch here ended
> > up in this submission. I didn't want to send it out.
> 
> No problem.
> 
> But looking a bit deeper into the mm code that other drm drivers don't set
> this correctly and still use unmap_mapping_range() sounds like quite a bug
> to me.
> 
> Going to track down what exactly that is used for.

Pagecache shootdown. unmap_mapping_range only shoots down from the virtual
side. Since that's all we care about, we don't need to set up the
address_space in the page.
-Daniel

> 
> Christian.
> 
> > -Daniel
> > 
> > > Regards,
> > > Christian.
> > > 
> > > > ---
> > > >    drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> > > >    1 file changed, 12 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > index da9eeffe0c6d..5b2eb6d58bb7 100644
> > > > --- a/drivers/gpu/drm/ttm/ttm_tt.c
> > > > +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > @@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > >        return ret;
> > > >    }
> > > > 
> > > > -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > > -{
> > > > -     pgoff_t i;
> > > > -
> > > > -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> > > > -             return;
> > > > -
> > > > -     for (i = 0; i < ttm->num_pages; ++i)
> > > > -             ttm->pages[i]->mapping = bdev->dev_mapping;
> > > > -}
> > > > -
> > > >    int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > >                    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> > > >    {
> > > > @@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > >        if (ret)
> > > >                return ret;
> > > > 
> > > > -     ttm_tt_add_mapping(bdev, ttm);
> > > >        ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> > > >        if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> > > >                ret = ttm_tt_swapin(ttm);
> > 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-20 10:05     ` Daniel Vetter
@ 2020-11-20 10:08       ` Christian König
  2020-11-20 15:01         ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-11-20 10:08 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Thomas Hellstrom, Intel Graphics Development, LKML,
	DRI Development, linux-xfs, Linux MM, Huang Rui, Brian Paul,
	linux-fsdevel, Daniel Vetter

Am 20.11.20 um 11:05 schrieb Daniel Vetter:
> On Fri, Nov 20, 2020 at 11:04 AM Christian König
> <christian.koenig@amd.com> wrote:
>> Am 20.11.20 um 10:54 schrieb Daniel Vetter:
>>> Random observation while trying to review Christian's patch series to
>>> stop looking at struct page for dma-buf imports.
>>>
>>> This was originally added in
>>>
>>> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
>>> Author: Thomas Hellstrom <thellstrom@vmware.com>
>>> Date:   Fri Jan 3 11:47:23 2014 +0100
>>>
>>>       drm/ttm: Correctly set page mapping and -index members
>>>
>>>       Needed for some vm operations; most notably unmap_mapping_range() with
>>>       even_cows = 0.
>>>
>>>       Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>>       Reviewed-by: Brian Paul <brianp@vmware.com>
>>>
>>> but we do not have a single caller of unmap_mapping_range with
>>> even_cows == 0. And all the gem drivers don't do this, so another
>>> small thing we could standardize between drm and ttm drivers.
>>>
>>> Plus I don't really see a need for unamp_mapping_range where we don't
>>> want to indiscriminately shoot down all ptes.
>>>
>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
>>> Cc: Brian Paul <brianp@vmware.com>
>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>> Cc: Christian Koenig <christian.koenig@amd.com>
>>> Cc: Huang Rui <ray.huang@amd.com>
>> This is still a NAK as long as we can't come up with a better way to
>> track TTMs page allocations.
>>
>> Additional to that page_mapping() is used quite extensively in the mm
>> code and I'm not sure if that isn't needed for other stuff as well.
> Apologies, I'm honestly not quite sure how this lone patch here ended
> up in this submission. I didn't want to send it out.

No problem.

But looking a bit deeper into the mm code that other drm drivers don't 
set this correctly and still use unmap_mapping_range() sounds like quite 
a bug to me.

Going to track down what exactly that is used for.

Christian.

> -Daniel
>
>> Regards,
>> Christian.
>>
>>> ---
>>>    drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>>>    1 file changed, 12 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
>>> index da9eeffe0c6d..5b2eb6d58bb7 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_tt.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
>>> @@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>>        return ret;
>>>    }
>>>
>>> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>>> -{
>>> -     pgoff_t i;
>>> -
>>> -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
>>> -             return;
>>> -
>>> -     for (i = 0; i < ttm->num_pages; ++i)
>>> -             ttm->pages[i]->mapping = bdev->dev_mapping;
>>> -}
>>> -
>>>    int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>                    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>>>    {
>>> @@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>>>        if (ret)
>>>                return ret;
>>>
>>> -     ttm_tt_add_mapping(bdev, ttm);
>>>        ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>>>        if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>>>                ret = ttm_tt_swapin(ttm);
>

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-20 10:04   ` Christian König
@ 2020-11-20 10:05     ` Daniel Vetter
  2020-11-20 10:08       ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-20 10:05 UTC (permalink / raw)
  To: Christian König
  Cc: Thomas Hellstrom, Intel Graphics Development, LKML,
	DRI Development, linux-xfs, Linux MM, Huang Rui, Brian Paul,
	linux-fsdevel, Daniel Vetter

On Fri, Nov 20, 2020 at 11:04 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 20.11.20 um 10:54 schrieb Daniel Vetter:
> > Random observation while trying to review Christian's patch series to
> > stop looking at struct page for dma-buf imports.
> >
> > This was originally added in
> >
> > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > Author: Thomas Hellstrom <thellstrom@vmware.com>
> > Date:   Fri Jan 3 11:47:23 2014 +0100
> >
> >      drm/ttm: Correctly set page mapping and -index members
> >
> >      Needed for some vm operations; most notably unmap_mapping_range() with
> >      even_cows = 0.
> >
> >      Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> >      Reviewed-by: Brian Paul <brianp@vmware.com>
> >
> > but we do not have a single caller of unmap_mapping_range with
> > even_cows == 0. And all the gem drivers don't do this, so another
> > small thing we could standardize between drm and ttm drivers.
> >
> > Plus I don't really see a need for unamp_mapping_range where we don't
> > want to indiscriminately shoot down all ptes.
> >
> > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > Cc: Brian Paul <brianp@vmware.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Christian Koenig <christian.koenig@amd.com>
> > Cc: Huang Rui <ray.huang@amd.com>
>
> This is still a NAK as long as we can't come up with a better way to
> track TTMs page allocations.
>
> Additional to that page_mapping() is used quite extensively in the mm
> code and I'm not sure if that isn't needed for other stuff as well.

Apologies, I'm honestly not quite sure how this lone patch here ended
up in this submission. I didn't want to send it out.
-Daniel

>
> Regards,
> Christian.
>
> > ---
> >   drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> >   1 file changed, 12 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> > index da9eeffe0c6d..5b2eb6d58bb7 100644
> > --- a/drivers/gpu/drm/ttm/ttm_tt.c
> > +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> > @@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> >       return ret;
> >   }
> >
> > -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > -{
> > -     pgoff_t i;
> > -
> > -     if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> > -             return;
> > -
> > -     for (i = 0; i < ttm->num_pages; ++i)
> > -             ttm->pages[i]->mapping = bdev->dev_mapping;
> > -}
> > -
> >   int ttm_tt_populate(struct ttm_bo_device *bdev,
> >                   struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> >   {
> > @@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> >       if (ret)
> >               return ret;
> >
> > -     ttm_tt_add_mapping(bdev, ttm);
> >       ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> >       if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> >               ret = ttm_tt_swapin(ttm);
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/ttm: don't set page->mapping
  2020-11-20  9:54 ` [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
@ 2020-11-20 10:04   ` Christian König
  2020-11-20 10:05     ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-11-20 10:04 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Thomas Hellstrom, Intel Graphics Development, LKML, linux-xfs,
	linux-mm, Huang Rui, Brian Paul, linux-fsdevel, Daniel Vetter

Am 20.11.20 um 10:54 schrieb Daniel Vetter:
> Random observation while trying to review Christian's patch series to
> stop looking at struct page for dma-buf imports.
>
> This was originally added in
>
> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> Author: Thomas Hellstrom <thellstrom@vmware.com>
> Date:   Fri Jan 3 11:47:23 2014 +0100
>
>      drm/ttm: Correctly set page mapping and -index members
>
>      Needed for some vm operations; most notably unmap_mapping_range() with
>      even_cows = 0.
>
>      Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>      Reviewed-by: Brian Paul <brianp@vmware.com>
>
> but we do not have a single caller of unmap_mapping_range with
> even_cows == 0. And all the gem drivers don't do this, so another
> small thing we could standardize between drm and ttm drivers.
>
> Plus I don't really see a need for unamp_mapping_range where we don't
> want to indiscriminately shoot down all ptes.
>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Brian Paul <brianp@vmware.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Christian Koenig <christian.koenig@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>

This is still a NAK as long as we can't come up with a better way to 
track TTMs page allocations.

Additional to that page_mapping() is used quite extensively in the mm 
code and I'm not sure if that isn't needed for other stuff as well.

Regards,
Christian.

> ---
>   drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
>   1 file changed, 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index da9eeffe0c6d..5b2eb6d58bb7 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
>   	return ret;
>   }
>   
> -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> -{
> -	pgoff_t i;
> -
> -	if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> -		return;
> -
> -	for (i = 0; i < ttm->num_pages; ++i)
> -		ttm->pages[i]->mapping = bdev->dev_mapping;
> -}
> -
>   int ttm_tt_populate(struct ttm_bo_device *bdev,
>   		    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>   {
> @@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
>   	if (ret)
>   		return ret;
>   
> -	ttm_tt_add_mapping(bdev, ttm);
>   	ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
>   	if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
>   		ret = ttm_tt_swapin(ttm);

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH] drm/ttm: don't set page->mapping
  2020-11-20  9:54 [PATCH 0/3] mmu_notifier fs fs_reclaim lockdep annotations Daniel Vetter
@ 2020-11-20  9:54 ` Daniel Vetter
  2020-11-20 10:04   ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-11-20  9:54 UTC (permalink / raw)
  To: DRI Development
  Cc: Thomas Hellstrom, Daniel Vetter, Intel Graphics Development,
	LKML, linux-xfs, linux-mm, Huang Rui, Brian Paul, linux-fsdevel,
	Daniel Vetter, Christian Koenig

Random observation while trying to review Christian's patch series to
stop looking at struct page for dma-buf imports.

This was originally added in

commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Fri Jan 3 11:47:23 2014 +0100

    drm/ttm: Correctly set page mapping and -index members

    Needed for some vm operations; most notably unmap_mapping_range() with
    even_cows = 0.

    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

but we do not have a single caller of unmap_mapping_range with
even_cows == 0. And all the gem drivers don't do this, so another
small thing we could standardize between drm and ttm drivers.

Plus I don't really see a need for unamp_mapping_range where we don't
want to indiscriminately shoot down all ptes.

Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index da9eeffe0c6d..5b2eb6d58bb7 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
 	return ret;
 }
 
-static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
-{
-	pgoff_t i;
-
-	if (ttm->page_flags & TTM_PAGE_FLAG_SG)
-		return;
-
-	for (i = 0; i < ttm->num_pages; ++i)
-		ttm->pages[i]->mapping = bdev->dev_mapping;
-}
-
 int ttm_tt_populate(struct ttm_bo_device *bdev,
 		    struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 {
@@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
 	if (ret)
 		return ret;
 
-	ttm_tt_add_mapping(bdev, ttm);
 	ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
 	if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
 		ret = ttm_tt_swapin(ttm);
-- 
2.29.2

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-11-26  8:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 16:50 [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
2020-11-05  7:59 ` Christian König
2020-11-05  9:11   ` Daniel Vetter
2020-11-05 12:29     ` Christian König
2020-11-05 12:50       ` Daniel Vetter
2020-11-05 12:56         ` Christian König
2020-11-05 13:20           ` Daniel Vetter
2020-11-05 13:22             ` Christian König
2020-11-05 14:31               ` Daniel Vetter
2020-11-05 14:38                 ` Daniel Vetter
2020-11-05 15:15                   ` Christian König
2020-11-05 16:37                     ` Daniel Vetter
2020-11-06  8:30                       ` Christian König
2020-11-20  9:54 [PATCH 0/3] mmu_notifier fs fs_reclaim lockdep annotations Daniel Vetter
2020-11-20  9:54 ` [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
2020-11-20 10:04   ` Christian König
2020-11-20 10:05     ` Daniel Vetter
2020-11-20 10:08       ` Christian König
2020-11-20 15:01         ` Daniel Vetter
2020-11-25 16:25 [PATCH v4 0/3] mmu_notifier vs fs_reclaim lockdep annotations Daniel Vetter
2020-11-25 16:25 ` [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
2020-11-25 16:28   ` Daniel Vetter
2020-11-25 18:06     ` Jason Gunthorpe
2020-11-25 18:16       ` Daniel Stone
     [not found]       ` <20201125181129.GA1858@infradead.org>
2020-11-25 23:57         ` Jason Gunthorpe

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).