All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2
@ 2021-05-28 13:00 Christian König
  2021-05-28 13:06 ` Thomas Hellström
  0 siblings, 1 reply; 6+ messages in thread
From: Christian König @ 2021-05-28 13:00 UTC (permalink / raw)
  To: dri-devel; +Cc: thomas.hellstrom, Xinhui.Pan

We need to grab the resv lock first before doing that check.

v2 (chk): simplify the change for -fixes

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c     | 5 ++++-
 drivers/gpu/drm/ttm/ttm_device.c | 8 +-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index cfd0b9292397..ebcffe794adb 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1172,7 +1172,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
 	if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL))
 		return -EBUSY;
 
-	if (!ttm_bo_get_unless_zero(bo)) {
+	if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
+	    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
+	    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
+	    !ttm_bo_get_unless_zero(bo)) {
 		if (locked)
 			dma_resv_unlock(bo->base.resv);
 		return -EBUSY;
diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
index a1dcf7d55c90..3d9c62b93e29 100644
--- a/drivers/gpu/drm/ttm/ttm_device.c
+++ b/drivers/gpu/drm/ttm/ttm_device.c
@@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
 
 		for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
 			list_for_each_entry(bo, &man->lru[j], lru) {
-				uint32_t num_pages;
+				uint32_t num_pages = PFN_UP(bo->base.size);
 
-				if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
-				    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
-				    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
-					continue;
-
-				num_pages = bo->ttm->num_pages;
 				ret = ttm_bo_swapout(bo, ctx, gfp_flags);
 				/* ttm_bo_swapout has dropped the lru_lock */
 				if (!ret)
-- 
2.25.1


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

* Re: [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2
  2021-05-28 13:00 [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2 Christian König
@ 2021-05-28 13:06 ` Thomas Hellström
  2021-06-07 12:52   ` Christian König
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Hellström @ 2021-05-28 13:06 UTC (permalink / raw)
  To: Christian König, dri-devel; +Cc: Xinhui.Pan


On 5/28/21 3:00 PM, Christian König wrote:
> We need to grab the resv lock first before doing that check.
>
> v2 (chk): simplify the change for -fixes
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

Hmm, OK, but this doesn't fix the swapped-bo-not-on-lru and unpopulating 
from swap_notify issues. Are you planning a follow up patch for those?

Thanks,

Thomas

> ---
>   drivers/gpu/drm/ttm/ttm_bo.c     | 5 ++++-
>   drivers/gpu/drm/ttm/ttm_device.c | 8 +-------
>   2 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index cfd0b9292397..ebcffe794adb 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1172,7 +1172,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
>   	if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL))
>   		return -EBUSY;
>   
> -	if (!ttm_bo_get_unless_zero(bo)) {
> +	if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
> +	    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
> +	    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
> +	    !ttm_bo_get_unless_zero(bo)) {
>   		if (locked)
>   			dma_resv_unlock(bo->base.resv);
>   		return -EBUSY;
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index a1dcf7d55c90..3d9c62b93e29 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
>   
>   		for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
>   			list_for_each_entry(bo, &man->lru[j], lru) {
> -				uint32_t num_pages;
> +				uint32_t num_pages = PFN_UP(bo->base.size);
>   
> -				if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
> -				    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
> -				    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
> -					continue;
> -
> -				num_pages = bo->ttm->num_pages;
>   				ret = ttm_bo_swapout(bo, ctx, gfp_flags);
>   				/* ttm_bo_swapout has dropped the lru_lock */
>   				if (!ret)

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

* Re: [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2
  2021-05-28 13:06 ` Thomas Hellström
@ 2021-06-07 12:52   ` Christian König
  2021-06-07 14:14     ` Pan, Xinhui
  2021-06-08 11:05     ` Huang, Ray
  0 siblings, 2 replies; 6+ messages in thread
From: Christian König @ 2021-06-07 12:52 UTC (permalink / raw)
  To: dri-devel, Xinhui.Pan, Nirmoy Das, Huang Rui; +Cc: Thomas Hellström



Am 28.05.21 um 15:06 schrieb Thomas Hellström:
>
> On 5/28/21 3:00 PM, Christian König wrote:
>> We need to grab the resv lock first before doing that check.
>>
>> v2 (chk): simplify the change for -fixes
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
> Hmm, OK, but this doesn't fix the swapped-bo-not-on-lru and 
> unpopulating from swap_notify issues. Are you planning a follow up 
> patch for those?

As discussed in a separate thread this needs to be applied as needed 
when the DG1 branch is merged.

Xinhui, Nirmoy, Rui can anybody give be an rb/ab so that I can push this?

Thanks,
Christian.

>
> Thanks,
>
> Thomas
>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo.c     | 5 ++++-
>>   drivers/gpu/drm/ttm/ttm_device.c | 8 +-------
>>   2 files changed, 5 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index cfd0b9292397..ebcffe794adb 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -1172,7 +1172,10 @@ int ttm_bo_swapout(struct ttm_buffer_object 
>> *bo, struct ttm_operation_ctx *ctx,
>>       if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL))
>>           return -EBUSY;
>>   -    if (!ttm_bo_get_unless_zero(bo)) {
>> +    if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
>> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
>> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
>> +        !ttm_bo_get_unless_zero(bo)) {
>>           if (locked)
>>               dma_resv_unlock(bo->base.resv);
>>           return -EBUSY;
>> diff --git a/drivers/gpu/drm/ttm/ttm_device.c 
>> b/drivers/gpu/drm/ttm/ttm_device.c
>> index a1dcf7d55c90..3d9c62b93e29 100644
>> --- a/drivers/gpu/drm/ttm/ttm_device.c
>> +++ b/drivers/gpu/drm/ttm/ttm_device.c
>> @@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev, 
>> struct ttm_operation_ctx *ctx,
>>             for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
>>               list_for_each_entry(bo, &man->lru[j], lru) {
>> -                uint32_t num_pages;
>> +                uint32_t num_pages = PFN_UP(bo->base.size);
>>   -                if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
>> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
>> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
>> -                    continue;
>> -
>> -                num_pages = bo->ttm->num_pages;
>>                   ret = ttm_bo_swapout(bo, ctx, gfp_flags);
>>                   /* ttm_bo_swapout has dropped the lru_lock */
>>                   if (!ret)


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

* Re: [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2
  2021-06-07 12:52   ` Christian König
@ 2021-06-07 14:14     ` Pan, Xinhui
  2021-06-07 14:15       ` Christian König
  2021-06-08 11:05     ` Huang, Ray
  1 sibling, 1 reply; 6+ messages in thread
From: Pan, Xinhui @ 2021-06-07 14:14 UTC (permalink / raw)
  To: dri-devel, Das,  Nirmoy, Huang, Ray, Christian König
  Cc: Thomas Hellström

[-- Attachment #1: Type: text/plain, Size: 3202 bytes --]

[AMD Official Use Only]

Looks good to me.
________________________________
From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Monday, June 7, 2021 8:52:21 PM
To: dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; Pan, Xinhui <Xinhui.Pan@amd.com>; Das, Nirmoy <Nirmoy.Das@amd.com>; Huang, Ray <Ray.Huang@amd.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2



Am 28.05.21 um 15:06 schrieb Thomas Hellström:
>
> On 5/28/21 3:00 PM, Christian König wrote:
>> We need to grab the resv lock first before doing that check.
>>
>> v2 (chk): simplify the change for -fixes
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
> Hmm, OK, but this doesn't fix the swapped-bo-not-on-lru and
> unpopulating from swap_notify issues. Are you planning a follow up
> patch for those?

As discussed in a separate thread this needs to be applied as needed
when the DG1 branch is merged.

Xinhui, Nirmoy, Rui can anybody give be an rb/ab so that I can push this?

Thanks,
Christian.

>
> Thanks,
>
> Thomas
>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo.c     | 5 ++++-
>>   drivers/gpu/drm/ttm/ttm_device.c | 8 +-------
>>   2 files changed, 5 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index cfd0b9292397..ebcffe794adb 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -1172,7 +1172,10 @@ int ttm_bo_swapout(struct ttm_buffer_object
>> *bo, struct ttm_operation_ctx *ctx,
>>       if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL))
>>           return -EBUSY;
>>   -    if (!ttm_bo_get_unless_zero(bo)) {
>> +    if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
>> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
>> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
>> +        !ttm_bo_get_unless_zero(bo)) {
>>           if (locked)
>>               dma_resv_unlock(bo->base.resv);
>>           return -EBUSY;
>> diff --git a/drivers/gpu/drm/ttm/ttm_device.c
>> b/drivers/gpu/drm/ttm/ttm_device.c
>> index a1dcf7d55c90..3d9c62b93e29 100644
>> --- a/drivers/gpu/drm/ttm/ttm_device.c
>> +++ b/drivers/gpu/drm/ttm/ttm_device.c
>> @@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev,
>> struct ttm_operation_ctx *ctx,
>>             for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
>>               list_for_each_entry(bo, &man->lru[j], lru) {
>> -                uint32_t num_pages;
>> +                uint32_t num_pages = PFN_UP(bo->base.size);
>>   -                if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
>> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
>> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
>> -                    continue;
>> -
>> -                num_pages = bo->ttm->num_pages;
>>                   ret = ttm_bo_swapout(bo, ctx, gfp_flags);
>>                   /* ttm_bo_swapout has dropped the lru_lock */
>>                   if (!ret)


[-- Attachment #2: Type: text/html, Size: 6025 bytes --]

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

* Re: [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2
  2021-06-07 14:14     ` Pan, Xinhui
@ 2021-06-07 14:15       ` Christian König
  0 siblings, 0 replies; 6+ messages in thread
From: Christian König @ 2021-06-07 14:15 UTC (permalink / raw)
  To: Pan, Xinhui, dri-devel, Das, Nirmoy, Huang, Ray; +Cc: Thomas Hellström

[-- Attachment #1: Type: text/plain, Size: 3421 bytes --]

I take that as an reviewed-by :)

Thanks,
Christian.

Am 07.06.21 um 16:14 schrieb Pan, Xinhui:
>
> [AMD Official Use Only]
>
>
> Looks good to me.
> ------------------------------------------------------------------------
> *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> *Sent:* Monday, June 7, 2021 8:52:21 PM
> *To:* dri-devel@lists.freedesktop.org 
> <dri-devel@lists.freedesktop.org>; Pan, Xinhui <Xinhui.Pan@amd.com>; 
> Das, Nirmoy <Nirmoy.Das@amd.com>; Huang, Ray <Ray.Huang@amd.com>
> *Cc:* Thomas Hellström <thomas.hellstrom@linux.intel.com>
> *Subject:* Re: [PATCH] drm/ttm: fix deref of bo->ttm without holding 
> the lock v2
>
>
> Am 28.05.21 um 15:06 schrieb Thomas Hellström:
> >
> > On 5/28/21 3:00 PM, Christian König wrote:
> >> We need to grab the resv lock first before doing that check.
> >>
> >> v2 (chk): simplify the change for -fixes
> >>
> >> Signed-off-by: Christian König <christian.koenig@amd.com>
> >> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> >
> > Hmm, OK, but this doesn't fix the swapped-bo-not-on-lru and
> > unpopulating from swap_notify issues. Are you planning a follow up
> > patch for those?
>
> As discussed in a separate thread this needs to be applied as needed
> when the DG1 branch is merged.
>
> Xinhui, Nirmoy, Rui can anybody give be an rb/ab so that I can push this?
>
> Thanks,
> Christian.
>
> >
> > Thanks,
> >
> > Thomas
> >
> >> ---
> >>   drivers/gpu/drm/ttm/ttm_bo.c     | 5 ++++-
> >>   drivers/gpu/drm/ttm/ttm_device.c | 8 +-------
> >>   2 files changed, 5 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c 
> b/drivers/gpu/drm/ttm/ttm_bo.c
> >> index cfd0b9292397..ebcffe794adb 100644
> >> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> >> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> >> @@ -1172,7 +1172,10 @@ int ttm_bo_swapout(struct ttm_buffer_object
> >> *bo, struct ttm_operation_ctx *ctx,
> >>       if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL))
> >>           return -EBUSY;
> >>   -    if (!ttm_bo_get_unless_zero(bo)) {
> >> +    if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
> >> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
> >> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
> >> +        !ttm_bo_get_unless_zero(bo)) {
> >>           if (locked)
> >> dma_resv_unlock(bo->base.resv);
> >>           return -EBUSY;
> >> diff --git a/drivers/gpu/drm/ttm/ttm_device.c
> >> b/drivers/gpu/drm/ttm/ttm_device.c
> >> index a1dcf7d55c90..3d9c62b93e29 100644
> >> --- a/drivers/gpu/drm/ttm/ttm_device.c
> >> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> >> @@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev,
> >> struct ttm_operation_ctx *ctx,
> >>             for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
> >>               list_for_each_entry(bo, &man->lru[j], lru) {
> >> -                uint32_t num_pages;
> >> +                uint32_t num_pages = PFN_UP(bo->base.size);
> >>   -                if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
> >> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
> >> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
> >> -                    continue;
> >> -
> >> -                num_pages = bo->ttm->num_pages;
> >>                   ret = ttm_bo_swapout(bo, ctx, gfp_flags);
> >>                   /* ttm_bo_swapout has dropped the lru_lock */
> >>                   if (!ret)
>


[-- Attachment #2: Type: text/html, Size: 7566 bytes --]

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

* RE: [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2
  2021-06-07 12:52   ` Christian König
  2021-06-07 14:14     ` Pan, Xinhui
@ 2021-06-08 11:05     ` Huang, Ray
  1 sibling, 0 replies; 6+ messages in thread
From: Huang, Ray @ 2021-06-08 11:05 UTC (permalink / raw)
  To: Christian König, dri-devel, Pan, Xinhui, Das, Nirmoy
  Cc: Thomas Hellström

Looks good for me.

Reviewed-by: Huang Rui <ray.huang@amd.com>

-----Original Message-----
From: Christian König <ckoenig.leichtzumerken@gmail.com> 
Sent: Monday, June 7, 2021 8:52 PM
To: dri-devel@lists.freedesktop.org; Pan, Xinhui <Xinhui.Pan@amd.com>; Das, Nirmoy <Nirmoy.Das@amd.com>; Huang, Ray <Ray.Huang@amd.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2



Am 28.05.21 um 15:06 schrieb Thomas Hellström:
>
> On 5/28/21 3:00 PM, Christian König wrote:
>> We need to grab the resv lock first before doing that check.
>>
>> v2 (chk): simplify the change for -fixes
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
> Hmm, OK, but this doesn't fix the swapped-bo-not-on-lru and 
> unpopulating from swap_notify issues. Are you planning a follow up 
> patch for those?

As discussed in a separate thread this needs to be applied as needed when the DG1 branch is merged.

Xinhui, Nirmoy, Rui can anybody give be an rb/ab so that I can push this?

Thanks,
Christian.

>
> Thanks,
>
> Thomas
>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo.c     | 5 ++++-
>>   drivers/gpu/drm/ttm/ttm_device.c | 8 +-------
>>   2 files changed, 5 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c 
>> b/drivers/gpu/drm/ttm/ttm_bo.c index cfd0b9292397..ebcffe794adb 
>> 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -1172,7 +1172,10 @@ int ttm_bo_swapout(struct ttm_buffer_object 
>> *bo, struct ttm_operation_ctx *ctx,
>>       if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL))
>>           return -EBUSY;
>>   -    if (!ttm_bo_get_unless_zero(bo)) {
>> +    if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
>> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
>> +        bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
>> +        !ttm_bo_get_unless_zero(bo)) {
>>           if (locked)
>>               dma_resv_unlock(bo->base.resv);
>>           return -EBUSY;
>> diff --git a/drivers/gpu/drm/ttm/ttm_device.c
>> b/drivers/gpu/drm/ttm/ttm_device.c
>> index a1dcf7d55c90..3d9c62b93e29 100644
>> --- a/drivers/gpu/drm/ttm/ttm_device.c
>> +++ b/drivers/gpu/drm/ttm/ttm_device.c
>> @@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev, 
>> struct ttm_operation_ctx *ctx,
>>             for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
>>               list_for_each_entry(bo, &man->lru[j], lru) {
>> -                uint32_t num_pages;
>> +                uint32_t num_pages = PFN_UP(bo->base.size);
>>   -                if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
>> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
>> -                    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
>> -                    continue;
>> -
>> -                num_pages = bo->ttm->num_pages;
>>                   ret = ttm_bo_swapout(bo, ctx, gfp_flags);
>>                   /* ttm_bo_swapout has dropped the lru_lock */
>>                   if (!ret)


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

end of thread, other threads:[~2021-06-08 11:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 13:00 [PATCH] drm/ttm: fix deref of bo->ttm without holding the lock v2 Christian König
2021-05-28 13:06 ` Thomas Hellström
2021-06-07 12:52   ` Christian König
2021-06-07 14:14     ` Pan, Xinhui
2021-06-07 14:15       ` Christian König
2021-06-08 11:05     ` Huang, Ray

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.