Skip to content

Commit

Permalink
drm/amdkfd: use time_is_before_jiffies(a + b) to replace "jiffies - a…
Browse files Browse the repository at this point in the history
… > b"

time_is_before_jiffies deals with timer wrapping correctly.

Signed-off-by: Yu Zhe <[email protected]>
Signed-off-by: Felix Kuehling <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
  • Loading branch information
yuzhenfschina authored and alexdeucher committed Jul 29, 2022
1 parent 1ff186f commit dcfe584
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static void interrupt_wq(struct work_struct *work)
struct kfd_dev *dev = container_of(work, struct kfd_dev,
interrupt_work);
uint32_t ih_ring_entry[KFD_MAX_RING_ENTRY_SIZE];
long start_jiffies = jiffies;
unsigned long start_jiffies = jiffies;

if (dev->device_info.ih_ring_entry_size > sizeof(ih_ring_entry)) {
dev_err_once(dev->adev->dev, "Ring entry too small\n");
Expand All @@ -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
*/
Expand Down

0 comments on commit dcfe584

Please sign in to comment.