linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 3/3] amdgpu: don't report an error if the process was killed
@ 2026-01-04 21:17 Mikulas Patocka
  2026-01-05  9:06 ` Christian König
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mikulas Patocka @ 2026-01-04 21:17 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Alex Deucher, Christian König, Andrew Morton,
	David Hildenbrand, amd-gfx, linux-mm, Liam R. Howlett,
	Vlastimil Babka, Jann Horn, Pedro Falcato

If the process was killed by a fatal signal, amdgpu_hmm_register could
return -EINTR (the -EINTR comes from mm_take_all_locks).

Don't log the error in this case, because no error happened.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
===================================================================
--- mm.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
+++ mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
@@ -1070,8 +1070,13 @@ static int init_user_pages(struct kgd_me
 
 	ret = amdgpu_hmm_register(bo, user_addr);
 	if (ret) {
-		pr_err("%s: Failed to register MMU notifier: %d\n",
-		       __func__, ret);
+		/*
+		 * If we got EINTR because the process was killed, don't report
+		 * it, because no error happened.
+		 */
+		if (!(fatal_signal_pending(current) && ret == -EINTR))
+			pr_err("%s: Failed to register MMU notifier: %d\n",
+			       __func__, ret);
 		goto out;
 	}
 



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

* Re: [PATCH v3 3/3] amdgpu: don't report an error if the process was killed
  2026-01-04 21:17 [PATCH v3 3/3] amdgpu: don't report an error if the process was killed Mikulas Patocka
@ 2026-01-05  9:06 ` Christian König
  2026-01-05 11:41 ` Lorenzo Stoakes
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2026-01-05  9:06 UTC (permalink / raw)
  To: Mikulas Patocka, Lorenzo Stoakes
  Cc: Alex Deucher, Andrew Morton, David Hildenbrand, amd-gfx,
	linux-mm, Liam R. Howlett, Vlastimil Babka, Jann Horn,
	Pedro Falcato

On 1/4/26 22:17, Mikulas Patocka wrote:
> If the process was killed by a fatal signal, amdgpu_hmm_register could
> return -EINTR (the -EINTR comes from mm_take_all_locks).
> 
> Don't log the error in this case, because no error happened.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> Index: mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> ===================================================================
> --- mm.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
> +++ mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
> @@ -1070,8 +1070,13 @@ static int init_user_pages(struct kgd_me
>  
>  	ret = amdgpu_hmm_register(bo, user_addr);
>  	if (ret) {
> -		pr_err("%s: Failed to register MMU notifier: %d\n",
> -		       __func__, ret);
> +		/*
> +		 * If we got EINTR because the process was killed, don't report
> +		 * it, because no error happened.
> +		 */
> +		if (!(fatal_signal_pending(current) && ret == -EINTR))

The usually approach is to check the return value only.

> +			pr_err("%s: Failed to register MMU notifier: %d\n",
> +			       __func__, ret);

But in this particular case just remove the pr_err(), it seems completely superfluous to me.

The only reasonable user error here is that we run out of memory and that is noted in syslog quite extensively anyway.

Regards,
Christian.

>  		goto out;
>  	}
>  
> 



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

* Re: [PATCH v3 3/3] amdgpu: don't report an error if the process was killed
  2026-01-04 21:17 [PATCH v3 3/3] amdgpu: don't report an error if the process was killed Mikulas Patocka
  2026-01-05  9:06 ` Christian König
@ 2026-01-05 11:41 ` Lorenzo Stoakes
  2026-01-05 12:13 ` Lorenzo Stoakes
  2026-01-05 18:20 ` Liam R. Howlett
  3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Stoakes @ 2026-01-05 11:41 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Alex Deucher, Christian König, Andrew Morton,
	David Hildenbrand, amd-gfx, linux-mm, Liam R. Howlett,
	Vlastimil Babka, Jann Horn, Pedro Falcato

Gentle nudge to ask you to please thread these series emails properly in
future.

Use something like:

git format-patch --cover-letter --thread ...

Or b4 or etc.

This is a nightmare to try to review without it.

Thanks!


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

* Re: [PATCH v3 3/3] amdgpu: don't report an error if the process was killed
  2026-01-04 21:17 [PATCH v3 3/3] amdgpu: don't report an error if the process was killed Mikulas Patocka
  2026-01-05  9:06 ` Christian König
  2026-01-05 11:41 ` Lorenzo Stoakes
@ 2026-01-05 12:13 ` Lorenzo Stoakes
  2026-01-05 18:20 ` Liam R. Howlett
  3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Stoakes @ 2026-01-05 12:13 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Alex Deucher, Christian König, Andrew Morton,
	David Hildenbrand, amd-gfx, linux-mm, Liam R. Howlett,
	Vlastimil Babka, Jann Horn, Pedro Falcato

On Sun, Jan 04, 2026 at 10:17:52PM +0100, Mikulas Patocka wrote:
> If the process was killed by a fatal signal, amdgpu_hmm_register could
> return -EINTR (the -EINTR comes from mm_take_all_locks).
>
> Don't log the error in this case, because no error happened.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> Index: mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> ===================================================================
> --- mm.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
> +++ mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
> @@ -1070,8 +1070,13 @@ static int init_user_pages(struct kgd_me
>
>  	ret = amdgpu_hmm_register(bo, user_addr);
>  	if (ret) {
> -		pr_err("%s: Failed to register MMU notifier: %d\n",
> -		       __func__, ret);
> +		/*
> +		 * If we got EINTR because the process was killed, don't report
> +		 * it, because no error happened.
> +		 */

I mean, an error did happen right? It seems reasonable to report that you
couldn't register it because a fatal signal arose, so not sure this adds much
value.

If we really do want to skip reporting it, I agree with Christian, the
fatal_signal_pending() seems superfluous.

So if you want to skip reporting a process killed by fatal signal I'd implement
it as:

	if (ret && ret != -EINTR) {
		...
	}

But I generally think this is fine as-is, a user can see the error was
-EINTR. So I'd drop this patch personally.

> +		if (!(fatal_signal_pending(current) && ret == -EINTR))
> +			pr_err("%s: Failed to register MMU notifier: %d\n",
> +			       __func__, ret);
>  		goto out;
>  	}
>
>
>


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

* Re: [PATCH v3 3/3] amdgpu: don't report an error if the process was killed
  2026-01-04 21:17 [PATCH v3 3/3] amdgpu: don't report an error if the process was killed Mikulas Patocka
                   ` (2 preceding siblings ...)
  2026-01-05 12:13 ` Lorenzo Stoakes
@ 2026-01-05 18:20 ` Liam R. Howlett
  3 siblings, 0 replies; 5+ messages in thread
From: Liam R. Howlett @ 2026-01-05 18:20 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Lorenzo Stoakes, Alex Deucher, Christian König,
	Andrew Morton, David Hildenbrand, amd-gfx, linux-mm,
	Vlastimil Babka, Jann Horn, Pedro Falcato

* Mikulas Patocka <mpatocka@redhat.com> [260104 16:18]:
> If the process was killed by a fatal signal, amdgpu_hmm_register could
> return -EINTR (the -EINTR comes from mm_take_all_locks).
> 
> Don't log the error in this case, because no error happened.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> Index: mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> ===================================================================
> --- mm.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
> +++ mm/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c	2026-01-04 21:19:14.000000000 +0100
> @@ -1070,8 +1070,13 @@ static int init_user_pages(struct kgd_me
>  
>  	ret = amdgpu_hmm_register(bo, user_addr);
>  	if (ret) {
> -		pr_err("%s: Failed to register MMU notifier: %d\n",
> -		       __func__, ret);
> +		/*
> +		 * If we got EINTR because the process was killed, don't report
> +		 * it, because no error happened.
> +		 */
> +		if (!(fatal_signal_pending(current) && ret == -EINTR))
> +			pr_err("%s: Failed to register MMU notifier: %d\n",
> +			       __func__, ret);

Masking off error messages will make the message less useful and harder
to debug.

You could also change the log level, which might be more desirable for a
whole lot of the messages in here?

Thanks,
Liam


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

end of thread, other threads:[~2026-01-05 18:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-04 21:17 [PATCH v3 3/3] amdgpu: don't report an error if the process was killed Mikulas Patocka
2026-01-05  9:06 ` Christian König
2026-01-05 11:41 ` Lorenzo Stoakes
2026-01-05 12:13 ` Lorenzo Stoakes
2026-01-05 18:20 ` Liam R. Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox