mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: "Christian König" <christian.koenig@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>
Cc: Alan Liu <haoping.liu@amd.com>,
	amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] drm/amdgpu: Avoid unnecessary Call Traces in amdgpu_irq_put()
Date: Fri, 16 Jan 2026 09:20:00 +0800	[thread overview]
Message-ID: <0afdb83a-d2db-53d9-3b1b-253e466a5cc3@loongson.cn> (raw)
In-Reply-To: <6ac02ffa-5d62-4fc7-9882-6ccf7b44eaf4@amd.com>

On 2026/1/15 下午9:47, Christian König wrote:
> On 1/15/26 02:28, Tiezhu Yang wrote:
>> Currently, there are many Call Traces when booting kernel on LoongArch,
>> here are the trimmed kernel log messages:
>>
>>    amdgpu 0000:07:00.0: amdgpu: hw_init of IP block <gfx_v6_0> failed -110
>>    amdgpu 0000:07:00.0: amdgpu: amdgpu_device_ip_init failed
>>    amdgpu 0000:07:00.0: amdgpu: Fatal error during GPU init
>>    amdgpu 0000:07:00.0: amdgpu: amdgpu: finishing device.
>>    ------------[ cut here ]------------
>>    WARNING: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:639 at amdgpu_irq_put+0xb0/0x140 [amdgpu], CPU#0: kworker/0:0/9
>>    ...
>>    Call Trace:
>>    [<90000000047a8524>] show_stack+0x64/0x190
>>    [<90000000047a0614>] dump_stack_lvl+0x6c/0x9c
>>    [<90000000047cef34>] __warn+0xa4/0x1b0
>>    [<90000000060a4884>] __report_bug+0xa4/0x1d0
>>    [<90000000060a4a88>] report_bug+0x38/0xd0
>>    [<90000000060df330>] do_bp+0x260/0x410
>>    [<90000000047a6bc0>] handle_bp+0x120/0x1c0
>>    [<ffff8000028bff40>] amdgpu_irq_put+0xb0/0x140 [amdgpu]
>>    [<ffff8000027b1a8c>] amdgpu_fence_driver_hw_fini+0x12c/0x180 [amdgpu]
>>    [<ffff800002f2c04c>] amdgpu_device_fini_hw+0xf0/0x3fc [amdgpu]
>>    [<ffff80000279e2ac>] amdgpu_driver_load_kms+0x7c/0xa0 [amdgpu]
>>    [<ffff800002791128>] amdgpu_pci_probe+0x298/0x810 [amdgpu]
>>    [<90000000054d04a4>] local_pci_probe+0x44/0xc0
>>    [<90000000047f4ab0>] work_for_cpu_fn+0x20/0x40
>>    [<90000000047f93e0>] process_one_work+0x170/0x4e0
>>    [<90000000047fa14c>] worker_thread+0x3ac/0x4e0
>>    [<9000000004806824>] kthread+0x154/0x170
>>    [<90000000060df5b4>] ret_from_kernel_thread+0x24/0xd0
>>    [<90000000047a62a4>] ret_from_kernel_thread_asm+0xc/0x88
>>
>>    ---[ end trace 0000000000000000 ]---
>>    amdgpu 0000:07:00.0: probe with driver amdgpu failed with error -110
>>    amdgpu 0000:07:00.0: amdgpu: amdgpu: ttm finalized
>>
>> This is because amdgpu_irq_enabled() is false in amdgpu_irq_put(), then
>> the condition of WARN_ON() is true.
>>
>> In order to avoid the unnecessary Call Traces, it can remove the check of
>> amdgpu_irq_enabled() and only check atomic_read(&src->enabled_types[type]
>> for three reasons:
>>
>> (1) The aim is to prevent refcount from being less than 0, it was added in
>> commit 1fa8d710573f ("drm/amdgpu: Fix desktop freezed after gpu-reset").
>> (2) There are already many useful failed log before the Call Trace, there
>> is no need to WARN_ON().
> 
> Well completely disagree. The call trace here is absolutely intentional.

If so, since the call trace is same, is it enough to use WARN_ON_ONCE()
here?

> That you get a lot of other backtraces because the driver doesn't initialize at all isn't a good rational to remove this one here.
> 
> Regards,
> Christian.
> 
>> (3) The following checks in amdgpu_irq_put() are same with the checks in
>> amdgpu_irq_enabled(), there is no need to do the redundant operations.
>>
>> 	if (!adev->irq.installed)
>> 		return -ENOENT;
>>
>> 	if (type >= src->num_types)
>> 		return -EINVAL;
>>
>> 	if (!src->enabled_types || !src->funcs->set)
>> 		return -EINVAL;

Is this reasonable? Only check atomic_read(&src->enabled_types[type]?

That is to say, does it make sense to do the following change?

----->8-----
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 8112ffc85995..d10d6fcc525e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -636,7 +636,7 @@ int amdgpu_irq_put(struct amdgpu_device *adev, 
struct amdgpu_irq_src *src,
         if (!src->enabled_types || !src->funcs->set)
                 return -EINVAL;

-       if (WARN_ON(!amdgpu_irq_enabled(adev, src, type)))
+       if (WARN_ON_ONCE(!atomic_read(&src->enabled_types[type])))
                 return -EINVAL;

         if (atomic_dec_and_test(&src->enabled_types[type]))

Thanks,
Tiezhu


  reply	other threads:[~2026-01-16  1:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15  1:28 Tiezhu Yang
2026-01-15 13:47 ` Christian König
2026-01-16  1:20   ` Tiezhu Yang [this message]
2026-01-16 10:03     ` Christian König
2026-01-16 16:34       ` Alex Deucher
2026-01-19  8:53       ` Tiezhu Yang
2026-01-19 10:45         ` Christian König
2026-01-22  9:37           ` Tiezhu Yang
2026-01-22 12:53             ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0afdb83a-d2db-53d9-3b1b-253e466a5cc3@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=haoping.liu@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®