* [PATCH v2] drm/ttm: Should to return the evict error @ 2025-05-21 3:56 Emily Deng 2025-05-22 2:42 ` Deng, Emily 2025-06-02 10:05 ` Christian König 0 siblings, 2 replies; 10+ messages in thread From: Emily Deng @ 2025-05-21 3:56 UTC (permalink / raw) To: amd-gfx; +Cc: Emily Deng For the evict fail case, the evict error should be returned. v2: Consider ENOENT case. Signed-off-by: Emily Deng <Emily.Deng@amd.com> --- drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index 097716bd248a..abf104ae9d35 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, .force_alloc = true }; struct dma_fence *fence; - int ret; + int ret, evict_ret = 0; do { - ret = ttm_bo_evict_first(bdev, man, &ctx); + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); cond_resched(); - } while (!ret); + } while (!evict_ret); spin_lock(&man->move_lock); fence = dma_fence_get(man->move); @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, return ret; } - return 0; + return (evict_ret == -ENOENT) ? 0 : evict_ret; } EXPORT_SYMBOL(ttm_resource_manager_evict_all); -- 2.34.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-21 3:56 [PATCH v2] drm/ttm: Should to return the evict error Emily Deng @ 2025-05-22 2:42 ` Deng, Emily 2025-05-22 22:27 ` Chen, Xiaogang 2025-06-02 10:05 ` Christian König 1 sibling, 1 reply; 10+ messages in thread From: Deng, Emily @ 2025-05-22 2:42 UTC (permalink / raw) To: Deng, Emily, amd-gfx@lists.freedesktop.org [AMD Official Use Only - AMD Internal Distribution Only] Ping...... Emily Deng Best Wishes >-----Original Message----- >From: Emily Deng <Emily.Deng@amd.com> >Sent: Wednesday, May 21, 2025 11:57 AM >To: amd-gfx@lists.freedesktop.org >Cc: Deng, Emily <Emily.Deng@amd.com> >Subject: [PATCH v2] drm/ttm: Should to return the evict error > >For the evict fail case, the evict error should be returned. > >v2: Consider ENOENT case. > >Signed-off-by: Emily Deng <Emily.Deng@amd.com> >--- > drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c >index 097716bd248a..abf104ae9d35 100644 >--- a/drivers/gpu/drm/ttm/ttm_resource.c >+++ b/drivers/gpu/drm/ttm/ttm_resource.c >@@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device >*bdev, > .force_alloc = true > }; > struct dma_fence *fence; >- int ret; >+ int ret, evict_ret = 0; > > do { >- ret = ttm_bo_evict_first(bdev, man, &ctx); >+ evict_ret = ttm_bo_evict_first(bdev, man, &ctx); > cond_resched(); >- } while (!ret); >+ } while (!evict_ret); > > spin_lock(&man->move_lock); > fence = dma_fence_get(man->move); >@@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, > return ret; > } > >- return 0; >+ return (evict_ret == -ENOENT) ? 0 : evict_ret; > } > EXPORT_SYMBOL(ttm_resource_manager_evict_all); > >-- >2.34.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-22 2:42 ` Deng, Emily @ 2025-05-22 22:27 ` Chen, Xiaogang 2025-05-26 1:51 ` Deng, Emily 0 siblings, 1 reply; 10+ messages in thread From: Chen, Xiaogang @ 2025-05-22 22:27 UTC (permalink / raw) To: Deng, Emily, amd-gfx@lists.freedesktop.org [-- Attachment #1: Type: text/plain, Size: 1880 bytes --] On 5/21/2025 9:42 PM, Deng, Emily wrote: > [AMD Official Use Only - AMD Internal Distribution Only] > > [AMD Official Use Only - AMD Internal Distribution Only] > > Ping...... > > Emily Deng > Best Wishes > > > >> -----Original Message----- >> From: Emily Deng<Emily.Deng@amd.com> >> Sent: Wednesday, May 21, 2025 11:57 AM >> To:amd-gfx@lists.freedesktop.org >> Cc: Deng, Emily<Emily.Deng@amd.com> >> Subject: [PATCH v2] drm/ttm: Should to return the evict error >> >> For the evict fail case, the evict error should be returned. >> >> v2: Consider ENOENT case. >> >> Signed-off-by: Emily Deng<Emily.Deng@amd.com> >> --- >> drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c >> index 097716bd248a..abf104ae9d35 100644 >> --- a/drivers/gpu/drm/ttm/ttm_resource.c >> +++ b/drivers/gpu/drm/ttm/ttm_resource.c >> @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device >> *bdev, >> .force_alloc = true >> }; >> struct dma_fence *fence; >> - int ret; >> + int ret, evict_ret = 0; >> >> do { >> - ret = ttm_bo_evict_first(bdev, man, &ctx); >> + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); >> cond_resched(); >> - } while (!ret); >> + } while (!evict_ret); >> >> spin_lock(&man->move_lock); >> fence = dma_fence_get(man->move); >> @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, >> return ret; >> } >> >> - return 0; >> + return (evict_ret == -ENOENT) ? 0 : evict_ret; >> } Can you explain why you care ENOENT(No such file or directory) specifically? Regards Xiaogang >> EXPORT_SYMBOL(ttm_resource_manager_evict_all); >> >> -- >> 2.34.1 [-- Attachment #2: Type: text/html, Size: 2921 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-22 22:27 ` Chen, Xiaogang @ 2025-05-26 1:51 ` Deng, Emily 2025-05-28 6:19 ` Deng, Emily 0 siblings, 1 reply; 10+ messages in thread From: Deng, Emily @ 2025-05-26 1:51 UTC (permalink / raw) To: Chen, Xiaogang, amd-gfx@lists.freedesktop.org [-- Attachment #1: Type: text/plain, Size: 2525 bytes --] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com> Sent: Friday, May 23, 2025 6:27 AM To: Deng, Emily <Emily.Deng@amd.com>; amd-gfx@lists.freedesktop.org Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/21/2025 9:42 PM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] Ping...... Emily Deng Best Wishes -----Original Message----- From: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Sent: Wednesday, May 21, 2025 11:57 AM To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Cc: Deng, Emily <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Subject: [PATCH v2] drm/ttm: Should to return the evict error For the evict fail case, the evict error should be returned. v2: Consider ENOENT case. Signed-off-by: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> --- drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index 097716bd248a..abf104ae9d35 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, .force_alloc = true }; struct dma_fence *fence; - int ret; + int ret, evict_ret = 0; do { - ret = ttm_bo_evict_first(bdev, man, &ctx); + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); cond_resched(); - } while (!ret); + } while (!evict_ret); spin_lock(&man->move_lock); fence = dma_fence_get(man->move); @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, return ret; } - return 0; + return (evict_ret == -ENOENT) ? 0 : evict_ret; } Can you explain why you care ENOENT(No such file or directory) specifically? Regards Xiaogang For ENOENT, it simply means the resource or file doesn't exist—it doesn't indicate an error during eviction. We only need to focus on actual eviction-related errors. Emily Deng Best Wishes EXPORT_SYMBOL(ttm_resource_manager_evict_all); -- 2.34.1 [-- Attachment #2: Type: text/html, Size: 8621 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-26 1:51 ` Deng, Emily @ 2025-05-28 6:19 ` Deng, Emily 2025-05-28 21:14 ` Chen, Xiaogang 0 siblings, 1 reply; 10+ messages in thread From: Deng, Emily @ 2025-05-28 6:19 UTC (permalink / raw) To: Deng, Emily, Zhang, Owen(SRDC) Cc: Chen, Xiaogang, amd-gfx@lists.freedesktop.org [-- Attachment #1: Type: text/plain, Size: 3008 bytes --] [AMD Official Use Only - AMD Internal Distribution Only] From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Deng, Emily Sent: Monday, May 26, 2025 9:51 AM To: Chen, Xiaogang <Xiaogang.Chen@amd.com>; amd-gfx@lists.freedesktop.org Subject: RE: [PATCH v2] drm/ttm: Should to return the evict error [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com<mailto:Xiaogang.Chen@amd.com>> Sent: Friday, May 23, 2025 6:27 AM To: Deng, Emily <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/21/2025 9:42 PM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] Ping...... Emily Deng Best Wishes -----Original Message----- From: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Sent: Wednesday, May 21, 2025 11:57 AM To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Cc: Deng, Emily <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Subject: [PATCH v2] drm/ttm: Should to return the evict error For the evict fail case, the evict error should be returned. v2: Consider ENOENT case. Signed-off-by: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> --- drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index 097716bd248a..abf104ae9d35 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, .force_alloc = true }; struct dma_fence *fence; - int ret; + int ret, evict_ret = 0; do { - ret = ttm_bo_evict_first(bdev, man, &ctx); + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); cond_resched(); - } while (!ret); + } while (!evict_ret); spin_lock(&man->move_lock); fence = dma_fence_get(man->move); @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, return ret; } - return 0; + return (evict_ret == -ENOENT) ? 0 : evict_ret; } Can you explain why you care ENOENT(No such file or directory) specifically? Regards Xiaogang For ENOENT, it simply means the resource or file doesn't exist—it doesn't indicate an error during eviction. We only need to focus on actual eviction-related errors. Emily Deng Best Wishes EXPORT_SYMBOL(ttm_resource_manager_evict_all); -- 2.34.1 [-- Attachment #2: Type: text/html, Size: 10255 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-28 6:19 ` Deng, Emily @ 2025-05-28 21:14 ` Chen, Xiaogang 2025-05-29 3:36 ` Deng, Emily 0 siblings, 1 reply; 10+ messages in thread From: Chen, Xiaogang @ 2025-05-28 21:14 UTC (permalink / raw) To: Deng, Emily, Zhang, Owen(SRDC); +Cc: amd-gfx@lists.freedesktop.org [-- Attachment #1: Type: text/plain, Size: 3892 bytes --] On 5/28/2025 1:19 AM, Deng, Emily wrote: > > [AMD Official Use Only - AMD Internal Distribution Only] > > > *From:*amd-gfx <amd-gfx-bounces@lists.freedesktop.org> *On Behalf Of > *Deng, Emily > *Sent:* Monday, May 26, 2025 9:51 AM > *To:* Chen, Xiaogang <Xiaogang.Chen@amd.com>; > amd-gfx@lists.freedesktop.org > *Subject:* RE: [PATCH v2] drm/ttm: Should to return the evict error > > [AMD Official Use Only - AMD Internal Distribution Only] > > [AMD Official Use Only - AMD Internal Distribution Only] > > *From:*Chen, Xiaogang <Xiaogang.Chen@amd.com> > *Sent:* Friday, May 23, 2025 6:27 AM > *To:* Deng, Emily <Emily.Deng@amd.com>; amd-gfx@lists.freedesktop.org > *Subject:* Re: [PATCH v2] drm/ttm: Should to return the evict error > > On 5/21/2025 9:42 PM, Deng, Emily wrote: > > [AMD Official Use Only - AMD Internal Distribution Only] > > [AMD Official Use Only - AMD Internal Distribution Only] > > Ping...... > > Emily Deng > > Best Wishes > > -----Original Message----- > > From: Emily Deng<Emily.Deng@amd.com> <mailto:Emily.Deng@amd.com> > > Sent: Wednesday, May 21, 2025 11:57 AM > > To:amd-gfx@lists.freedesktop.org > > Cc: Deng, Emily<Emily.Deng@amd.com> <mailto:Emily.Deng@amd.com> > > Subject: [PATCH v2] drm/ttm: Should to return the evict error > > For the evict fail case, the evict error should be returned. > > v2: Consider ENOENT case. > > Signed-off-by: Emily Deng<Emily.Deng@amd.com> <mailto:Emily.Deng@amd.com> > > --- > > drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c > > index 097716bd248a..abf104ae9d35 100644 > > --- a/drivers/gpu/drm/ttm/ttm_resource.c > > +++ b/drivers/gpu/drm/ttm/ttm_resource.c > > @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device > > *bdev, > > .force_alloc = true > > }; > > struct dma_fence *fence; > > - int ret; > > + int ret, evict_ret = 0; > > do { > > - ret = ttm_bo_evict_first(bdev, man, &ctx); > > + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); > > cond_resched(); > > - } while (!ret); > > + } while (!evict_ret); > > spin_lock(&man->move_lock); > > fence = dma_fence_get(man->move); > > @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, > > return ret; > > } > > - return 0; > > + return (evict_ret == -ENOENT) ? 0 : evict_ret; > > } > > Can you explain why you care ENOENT(No such file or directory) > specifically? > > Regards > > Xiaogang > > For ENOENT, it simply means the resource or file doesn't exist—it > doesn't indicate an error during eviction. We only need to focus on > actual eviction-related errors. > I think I know what you mean. But I have a different view on that. ttm_resource_manager_evict_all release all resources associated with a ttm_resource_manager(man). It is part of memory manager cleanup sequence. Even it fail(no matter what reason is) I think the following memory manager cleanup should still continue going, then the returned error value should not be used to stop following clean up. I think @Christian König can give judgment on it. Regards Xiaogang > Emily Deng > > Best Wishes > > EXPORT_SYMBOL(ttm_resource_manager_evict_all); > > -- > > 2.34.1 > [-- Attachment #2: Type: text/html, Size: 14274 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-28 21:14 ` Chen, Xiaogang @ 2025-05-29 3:36 ` Deng, Emily 2025-05-30 1:40 ` Deng, Emily 0 siblings, 1 reply; 10+ messages in thread From: Deng, Emily @ 2025-05-29 3:36 UTC (permalink / raw) To: Chen, Xiaogang, Zhang, Owen(SRDC); +Cc: amd-gfx@lists.freedesktop.org [-- Attachment #1: Type: text/plain, Size: 4142 bytes --] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com> Sent: Thursday, May 29, 2025 5:15 AM To: Deng, Emily <Emily.Deng@amd.com>; Zhang, Owen(SRDC) <Owen.Zhang2@amd.com> Cc: amd-gfx@lists.freedesktop.org Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/28/2025 1:19 AM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org><mailto:amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Deng, Emily Sent: Monday, May 26, 2025 9:51 AM To: Chen, Xiaogang <Xiaogang.Chen@amd.com><mailto:Xiaogang.Chen@amd.com>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: RE: [PATCH v2] drm/ttm: Should to return the evict error [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com<mailto:Xiaogang.Chen@amd.com>> Sent: Friday, May 23, 2025 6:27 AM To: Deng, Emily <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/21/2025 9:42 PM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] Ping...... Emily Deng Best Wishes -----Original Message----- From: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Sent: Wednesday, May 21, 2025 11:57 AM To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Cc: Deng, Emily <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Subject: [PATCH v2] drm/ttm: Should to return the evict error For the evict fail case, the evict error should be returned. v2: Consider ENOENT case. Signed-off-by: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> --- drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index 097716bd248a..abf104ae9d35 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, .force_alloc = true }; struct dma_fence *fence; - int ret; + int ret, evict_ret = 0; do { - ret = ttm_bo_evict_first(bdev, man, &ctx); + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); cond_resched(); - } while (!ret); + } while (!evict_ret); spin_lock(&man->move_lock); fence = dma_fence_get(man->move); @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, return ret; } - return 0; + return (evict_ret == -ENOENT) ? 0 : evict_ret; } Can you explain why you care ENOENT(No such file or directory) specifically? Regards Xiaogang For ENOENT, it simply means the resource or file doesn't exist—it doesn't indicate an error during eviction. We only need to focus on actual eviction-related errors. I think I know what you mean. But I have a different view on that. ttm_resource_manager_evict_all release all resources associated with a ttm_resource_manager(man). It is part of memory manager cleanup sequence. Even it fail(no matter what reason is) I think the following memory manager cleanup should still continue going, then the returned error value should not be used to stop following clean up. I think @Christian König can give judgment on it. Whether needs to stop following steps depends on the detail use case. For example, for amdgpu_device_suspend, if the evict fail, then need to stop suspend. Regards Xiaogang Emily Deng Best Wishes EXPORT_SYMBOL(ttm_resource_manager_evict_all); -- 2.34.1 [-- Attachment #2: Type: text/html, Size: 12973 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-29 3:36 ` Deng, Emily @ 2025-05-30 1:40 ` Deng, Emily 2025-05-30 9:48 ` Zhang, Owen(SRDC) 0 siblings, 1 reply; 10+ messages in thread From: Deng, Emily @ 2025-05-30 1:40 UTC (permalink / raw) To: Deng, Emily, Chen, Xiaogang, Zhang, Owen(SRDC), Koenig, Christian Cc: amd-gfx@lists.freedesktop.org [-- Attachment #1: Type: text/plain, Size: 4810 bytes --] [AMD Official Use Only - AMD Internal Distribution Only] @Koenig, Christian<mailto:Christian.Koenig@amd.com> can give judgment on it? Thanks. Emily Deng Best Wishes From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Deng, Emily Sent: Thursday, May 29, 2025 11:37 AM To: Chen, Xiaogang <Xiaogang.Chen@amd.com>; Zhang, Owen(SRDC) <Owen.Zhang2@amd.com> Cc: amd-gfx@lists.freedesktop.org Subject: RE: [PATCH v2] drm/ttm: Should to return the evict error [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com<mailto:Xiaogang.Chen@amd.com>> Sent: Thursday, May 29, 2025 5:15 AM To: Deng, Emily <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>; Zhang, Owen(SRDC) <Owen.Zhang2@amd.com<mailto:Owen.Zhang2@amd.com>> Cc: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/28/2025 1:19 AM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org><mailto:amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Deng, Emily Sent: Monday, May 26, 2025 9:51 AM To: Chen, Xiaogang <Xiaogang.Chen@amd.com><mailto:Xiaogang.Chen@amd.com>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: RE: [PATCH v2] drm/ttm: Should to return the evict error [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com<mailto:Xiaogang.Chen@amd.com>> Sent: Friday, May 23, 2025 6:27 AM To: Deng, Emily <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/21/2025 9:42 PM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] Ping...... Emily Deng Best Wishes -----Original Message----- From: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Sent: Wednesday, May 21, 2025 11:57 AM To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Cc: Deng, Emily <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Subject: [PATCH v2] drm/ttm: Should to return the evict error For the evict fail case, the evict error should be returned. v2: Consider ENOENT case. Signed-off-by: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> --- drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index 097716bd248a..abf104ae9d35 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, .force_alloc = true }; struct dma_fence *fence; - int ret; + int ret, evict_ret = 0; do { - ret = ttm_bo_evict_first(bdev, man, &ctx); + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); cond_resched(); - } while (!ret); + } while (!evict_ret); spin_lock(&man->move_lock); fence = dma_fence_get(man->move); @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, return ret; } - return 0; + return (evict_ret == -ENOENT) ? 0 : evict_ret; } Can you explain why you care ENOENT(No such file or directory) specifically? Regards Xiaogang For ENOENT, it simply means the resource or file doesn't exist—it doesn't indicate an error during eviction. We only need to focus on actual eviction-related errors. I think I know what you mean. But I have a different view on that. ttm_resource_manager_evict_all release all resources associated with a ttm_resource_manager(man). It is part of memory manager cleanup sequence. Even it fail(no matter what reason is) I think the following memory manager cleanup should still continue going, then the returned error value should not be used to stop following clean up. I think @Christian König can give judgment on it. Whether needs to stop following steps depends on the detail use case. For example, for amdgpu_device_suspend, if the evict fail, then need to stop suspend. Regards Xiaogang Emily Deng Best Wishes EXPORT_SYMBOL(ttm_resource_manager_evict_all); -- 2.34.1 [-- Attachment #2: Type: text/html, Size: 15248 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-30 1:40 ` Deng, Emily @ 2025-05-30 9:48 ` Zhang, Owen(SRDC) 0 siblings, 0 replies; 10+ messages in thread From: Zhang, Owen(SRDC) @ 2025-05-30 9:48 UTC (permalink / raw) To: Deng, Emily, Chen, Xiaogang, Koenig, Christian Cc: amd-gfx@lists.freedesktop.org [-- Attachment #1: Type: text/plain, Size: 5488 bytes --] [AMD Official Use Only - AMD Internal Distribution Only] @Koenig, Christian<mailto:Christian.Koenig@amd.com>… can you pls provide your expertise? Thanks for support. Rgds/Owen From: Deng, Emily <Emily.Deng@amd.com> Sent: Friday, May 30, 2025 9:41 AM To: Deng, Emily <Emily.Deng@amd.com>; Chen, Xiaogang <Xiaogang.Chen@amd.com>; Zhang, Owen(SRDC) <Owen.Zhang2@amd.com>; Koenig, Christian <Christian.Koenig@amd.com> Cc: amd-gfx@lists.freedesktop.org Subject: RE: [PATCH v2] drm/ttm: Should to return the evict error [AMD Official Use Only - AMD Internal Distribution Only] @Koenig, Christian<mailto:Christian.Koenig@amd.com> can give judgment on it? Thanks. Emily Deng Best Wishes From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> On Behalf Of Deng, Emily Sent: Thursday, May 29, 2025 11:37 AM To: Chen, Xiaogang <Xiaogang.Chen@amd.com<mailto:Xiaogang.Chen@amd.com>>; Zhang, Owen(SRDC) <Owen.Zhang2@amd.com<mailto:Owen.Zhang2@amd.com>> Cc: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: RE: [PATCH v2] drm/ttm: Should to return the evict error [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com<mailto:Xiaogang.Chen@amd.com>> Sent: Thursday, May 29, 2025 5:15 AM To: Deng, Emily <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>; Zhang, Owen(SRDC) <Owen.Zhang2@amd.com<mailto:Owen.Zhang2@amd.com>> Cc: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/28/2025 1:19 AM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org><mailto:amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Deng, Emily Sent: Monday, May 26, 2025 9:51 AM To: Chen, Xiaogang <Xiaogang.Chen@amd.com><mailto:Xiaogang.Chen@amd.com>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: RE: [PATCH v2] drm/ttm: Should to return the evict error [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] From: Chen, Xiaogang <Xiaogang.Chen@amd.com<mailto:Xiaogang.Chen@amd.com>> Sent: Friday, May 23, 2025 6:27 AM To: Deng, Emily <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH v2] drm/ttm: Should to return the evict error On 5/21/2025 9:42 PM, Deng, Emily wrote: [AMD Official Use Only - AMD Internal Distribution Only] [AMD Official Use Only - AMD Internal Distribution Only] Ping...... Emily Deng Best Wishes -----Original Message----- From: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Sent: Wednesday, May 21, 2025 11:57 AM To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> Cc: Deng, Emily <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> Subject: [PATCH v2] drm/ttm: Should to return the evict error For the evict fail case, the evict error should be returned. v2: Consider ENOENT case. Signed-off-by: Emily Deng <Emily.Deng@amd.com><mailto:Emily.Deng@amd.com> --- drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index 097716bd248a..abf104ae9d35 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, .force_alloc = true }; struct dma_fence *fence; - int ret; + int ret, evict_ret = 0; do { - ret = ttm_bo_evict_first(bdev, man, &ctx); + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); cond_resched(); - } while (!ret); + } while (!evict_ret); spin_lock(&man->move_lock); fence = dma_fence_get(man->move); @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, return ret; } - return 0; + return (evict_ret == -ENOENT) ? 0 : evict_ret; } Can you explain why you care ENOENT(No such file or directory) specifically? Regards Xiaogang For ENOENT, it simply means the resource or file doesn't exist—it doesn't indicate an error during eviction. We only need to focus on actual eviction-related errors. I think I know what you mean. But I have a different view on that. ttm_resource_manager_evict_all release all resources associated with a ttm_resource_manager(man). It is part of memory manager cleanup sequence. Even it fail(no matter what reason is) I think the following memory manager cleanup should still continue going, then the returned error value should not be used to stop following clean up. I think @Christian König can give judgment on it. Whether needs to stop following steps depends on the detail use case. For example, for amdgpu_device_suspend, if the evict fail, then need to stop suspend. Regards Xiaogang Emily Deng Best Wishes EXPORT_SYMBOL(ttm_resource_manager_evict_all); -- 2.34.1 [-- Attachment #2: Type: text/html, Size: 17570 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] drm/ttm: Should to return the evict error 2025-05-21 3:56 [PATCH v2] drm/ttm: Should to return the evict error Emily Deng 2025-05-22 2:42 ` Deng, Emily @ 2025-06-02 10:05 ` Christian König 1 sibling, 0 replies; 10+ messages in thread From: Christian König @ 2025-06-02 10:05 UTC (permalink / raw) To: Emily Deng, amd-gfx On 5/21/25 05:56, Emily Deng wrote: > For the evict fail case, the evict error should be returned. > > v2: Consider ENOENT case. > > Signed-off-by: Emily Deng <Emily.Deng@amd.com> > --- > drivers/gpu/drm/ttm/ttm_resource.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c > index 097716bd248a..abf104ae9d35 100644 > --- a/drivers/gpu/drm/ttm/ttm_resource.c > +++ b/drivers/gpu/drm/ttm/ttm_resource.c > @@ -511,12 +511,12 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, > .force_alloc = true > }; > struct dma_fence *fence; > - int ret; > + int ret, evict_ret = 0; > > do { > - ret = ttm_bo_evict_first(bdev, man, &ctx); > + evict_ret = ttm_bo_evict_first(bdev, man, &ctx); > cond_resched(); > - } while (!ret); > + } while (!evict_ret); We should probably abort here directly when the eviction failed for some reason (except for -ENOENT) and not wait for the move to finish. Regards, Christian. > > spin_lock(&man->move_lock); > fence = dma_fence_get(man->move); > @@ -529,7 +529,7 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev, > return ret; > } > > - return 0; > + return (evict_ret == -ENOENT) ? 0 : evict_ret; > } > EXPORT_SYMBOL(ttm_resource_manager_evict_all); > ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-06-02 10:06 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-05-21 3:56 [PATCH v2] drm/ttm: Should to return the evict error Emily Deng 2025-05-22 2:42 ` Deng, Emily 2025-05-22 22:27 ` Chen, Xiaogang 2025-05-26 1:51 ` Deng, Emily 2025-05-28 6:19 ` Deng, Emily 2025-05-28 21:14 ` Chen, Xiaogang 2025-05-29 3:36 ` Deng, Emily 2025-05-30 1:40 ` Deng, Emily 2025-05-30 9:48 ` Zhang, Owen(SRDC) 2025-06-02 10:05 ` Christian König
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox