amdgpu: don't report an error if the process was killed
Subsystems (4)
PATCH v3 3/3 amdgpu: don't report an error if the process was killed
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +7 -2
@@ -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; }
Christian König
maintainerQuoted 16 lines · Mikulas Patocka
If the process was killed by a fatal signal,
amdgpu_hmm_registercould return-EINTR(the-EINTRcomes frommm_take_all_locks).Don't log the error in this case, because no error happened.
Signed-off-by Mikulas Patocka <[email protected]>--- 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
===================================================================
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c static int init_user_pages(struct kgd_me · line 1077
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5
-2@@ -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.
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c static int init_user_pages(struct kgd_me · line 1079
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2
-0+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.
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0
-0goto out; }
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!
Quoted 5 lines · Lorenzo Stoakes
Gentle nudge to ask you to please thread these series emails properly in future.
Use something like:
Quoted 7 lines
git format-patch --cover-letter --thread ...
Or b4 or etc.
This is a nightmare to try to review without it.
Thanks!
I don't use git for patch development. I use quilt. I find git quite awkward when I need to move between multiple patches and update them independently.
I'll try to send the next version of this patchset using the 'quilt mail' command.
Mikulas
Quoted 13 lines · Mikulas Patocka
Quoted 9 lines · Lorenzo Stoakes
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.
Quoted 7 lines
Quoted 3 lines
This is a nightmare to try to review without it.
Thanks!
I don't use git for patch development. I use quilt. I find git quite awkward when I need to move between multiple patches and update them independently.
You mean, multiple pages in the same tree? I hope you know about "git rebase -i" and "git commit --amend" :)
Signature · 3 lines
Cheers David
Quoted 16 lines · Mikulas Patocka
If the process was killed by a fatal signal,
amdgpu_hmm_registercould return-EINTR(the-EINTRcomes frommm_take_all_locks).Don't log the error in this case, because no error happened.
Signed-off-by Mikulas Patocka <[email protected]>--- 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
===================================================================
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c static int init_user_pages(struct kgd_me · line 1076
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4
-2@@ -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.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3
-0+if (!(fatal_signal_pending (current) && ret == -EINTR )) +pr_err ("%s: Failed to register MMU notifier: %d\n" , + __func__, ret); goto out; }
Quoted 18 lines · Mikulas Patocka
If the process was killed by a fatal signal,
amdgpu_hmm_registercould return-EINTR(the-EINTRcomes frommm_take_all_locks).Don't log the error in this case, because no error happened.
Signed-off-by Mikulas Patocka <[email protected]>--- 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
===================================================================drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0
-0@@ -1070,8 +1070,13 @@ static int init_user_pages(struct kgd_me ret =amdgpu_hmm_register (bo, user_addr);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c static int init_user_pages(struct kgd_me · line 1079
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +7
-2if (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
Christian König
maintainerQuoted 18 lines · Liam R. Howlett
Quoted 17 lines · Mikulas Patocka
If the process was killed by a fatal signal,
amdgpu_hmm_registercould return-EINTR(the-EINTRcomes frommm_take_all_locks).Don't log the error in this case, because no error happened.
Signed-off-by Mikulas Patocka <[email protected]>--- 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
===================================================================drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0
-0@@ -1070,8 +1070,13 @@ static int init_user_pages(struct kgd_me
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c static int init_user_pages(struct kgd_me · line 1079
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +7
-2ret =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.
Reporting errors on -EINTR and -ERESTARTSYS are usually considered a bug since that are perfectly normal conditions to occur.
Quoted 2 lines
You could also change the log level, which might be more desirable for a whole lot of the messages in here?
Well I agree that debug or info level is probably more suitable, but error messages like this here are just a symptom that people doesn't know how to properly use ftrace.
In other words when you have a message in syslog that userspace did something wrong, even if it's just a debug message, than that is in like 99% of all cases not appropriate.
What drivers should log is things like HW conditions changes, global SW condition changes because somebody requested feature X, performance changes because of I have to enable workaround Y...... but not system call is interrupted by signal, application is using to much memory or giving invalid values etc....
Regards,
Christian.
Quoted 3 lines
Thanks,
Liam