Page MenuHomeFreeBSD

acpi_hpet(4): Make sure we don't go into an infinite loop when fdiv is zero.
Needs ReviewPublic

Authored by hselasky on Sep 30 2022, 5:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 12:26 AM
Unknown Object (File)
Nov 2 2023, 1:24 PM
Unknown Object (File)
Oct 20 2023, 11:52 PM
Unknown Object (File)
May 25 2023, 3:08 AM
Unknown Object (File)
Apr 3 2023, 12:49 AM
Unknown Object (File)
Mar 1 2023, 5:06 PM
Unknown Object (File)
Feb 11 2023, 8:24 PM
Unknown Object (File)
Dec 15 2022, 8:03 PM
Subscribers

Details

Reviewers
mav
kib
Summary

MFC after: 1 week
Sponsored by: NVIDIA Networking

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

What is the purpose of the restart loop?
Did you observed fdiv overflow on real hardware?

The purpose of the loop is to make the timeout large enough that the timer will generate an interrupt from what I see. The problem is that fdiv may be initialized to zero.

The purpose of the loop is to make the timeout large enough that the timer will generate an interrupt from what I see.

You mean, the t->next value?
Perhaps add a comment (assuming the code reading is right).

The problem is that fdiv may be initialized to zero.

Then shouldn't the workaround applied to the initial computation of fdiv above the loop? Otherwise you just replace one infinite loop condition by another, AFAIS.

et_start() should guarantee that this code receive first and/or period big enough for meaningful fdiv. Do you expect this code to loop enough times for overflow the fdiv turning it zero?

If periodic == 0 and first == 0, which I see can happen, then fdiv is set to t->div which is zero. Do you see?

I wonder if then the loop can happen?

If periodic == 0 and first == 0, which I see can happen, then fdiv is set to t->div which is zero. Do you see?

It should not happen thanks to et_start(), unless eventtimer report zero et_min_period.