From: Felix Kuehling <felix.kuehling@amd.com>
To: Yu Zhe <yuzhe@nfschina.com>,
alexander.deucher@amd.com, christian.koenig@amd.com,
Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
liqiong@nfschina.com
Subject: Re: [PATCH] drm/amdkfd: use time_is_before_jiffies(a + b) to replace "jiffies - a > b"
Date: Wed, 27 Jul 2022 12:04:10 -0400 [thread overview]
Message-ID: <17e02cd8-eba1-91b8-2506-91a7893ac967@amd.com> (raw)
In-Reply-To: <20220727025917.22477-1-yuzhe@nfschina.com>
This patch introduces a build warning for me:
CC [M] drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_interrupt.o
In file included from /home/fkuehlin/compute/kernel/include/linux/spinlock.h:54,
from /home/fkuehlin/compute/kernel/include/linux/mmzone.h:8,
from /home/fkuehlin/compute/kernel/include/linux/gfp.h:6,
from /home/fkuehlin/compute/kernel/include/linux/slab.h:15,
from /home/fkuehlin/compute/kernel/drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_interrupt.c:44:
/home/fkuehlin/compute/kernel/drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_interrupt.c: In function ?interrupt_wq?:
/home/fkuehlin/compute/kernel/include/linux/typecheck.h:12:18: warning: comparison of distinct pointer types lacks a cast
12 | (void)(&__dummy == &__dummy2); \
| ^~
/home/fkuehlin/compute/kernel/include/linux/jiffies.h:106:3: note: in expansion of macro ?typecheck?
106 | typecheck(unsigned long, b) && \
| ^~~~~~~~~
/home/fkuehlin/compute/kernel/include/linux/jiffies.h:154:35: note: in expansion of macro ?time_after?
154 | #define time_is_before_jiffies(a) time_after(jiffies, a)
| ^~~~~~~~~~
/home/fkuehlin/compute/kernel/drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_interrupt.c:159:7: note: in expansion of macro ?time_is_before_jiffies?
159 | if (time_is_before_jiffies(start_jiffies + HZ)) {
| ^~~~~~~~~~~~~~~~~~~~~~
I think you need to change the the definition of start_jiffies to be
unsigned long. Do you want to submit a v2 of your patch?
That said, I think the existing code was fine, though the type-mismatch
highlighted by your patch is a bit iffy.
Regards,
Felix
Am 2022-07-26 um 22:59 schrieb Yu Zhe:
> time_is_before_jiffies deals with timer wrapping correctly.
>
> Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> index a9466d154395..6397926e059c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> @@ -156,7 +156,7 @@ static void interrupt_wq(struct work_struct *work)
> while (dequeue_ih_ring_entry(dev, ih_ring_entry)) {
> dev->device_info.event_interrupt_class->interrupt_wq(dev,
> ih_ring_entry);
> - if (jiffies - start_jiffies > HZ) {
> + if (time_is_before_jiffies(start_jiffies + HZ)) {
> /* If we spent more than a second processing signals,
> * reschedule the worker to avoid soft-lockup warnings
> */
next prev parent reply other threads:[~2022-07-27 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 2:59 Yu Zhe
2022-07-27 16:04 ` Felix Kuehling [this message]
2022-07-28 2:20 ` Yu Zhe
2022-07-28 3:30 ` [PATCH v2] " Yu Zhe
2022-07-28 22:05 ` Felix Kuehling
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=17e02cd8-eba1-91b8-2506-91a7893ac967@amd.com \
--to=felix.kuehling@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liqiong@nfschina.com \
--cc=yuzhe@nfschina.com \
/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®