[haiku-bugs] Re: [Haiku] #16546: KDL, laptop no longer boots

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sun, 17 Jan 2021 18:17:16 -0000

#16546: KDL, laptop no longer boots
----------------------------+----------------------------
  Reporter:  luroh          |      Owner:  korli
      Type:  bug            |     Status:  assigned
  Priority:  high           |  Milestone:  R1/beta3
 Component:  System/Kernel  |    Version:  R1/Development
Resolution:                 |   Keywords:
Blocked By:                 |   Blocking:
  Platform:  All            |
----------------------------+----------------------------
Comment (by pulkomandy):

 So it's the idleTime being negative.

 It's computed this way:

 {{{
 bigtime_t start = system_time();
 // go in suspend mode and wait until we need to wakeup...
 bigtime_t delta = system_time() - start;

 idleTime = (idleTime + delta) / 2;
 }}}

 The only thing that I can imagine going wrong here is if system_time()
 somehow goes back in time?

 Its implementation is based on rdtsc multiplied with a conversion factor
 to get microseconds. We are sure that the two calls to it will be run on
 the same CPU here so that shouldn't be a problem with de-synchronized TSC
 between two CPU cores.

 The idle time value converted to hex: 0xc00bb0b000000001. Not sure what to
 make of that.

 We could ignore the delta values that we find to be negative, but is that
 the proper fix, or is there some deeper problem at play here? Could it be
 a problem with the conversion factor used by system_time? It's computed by
 matching the rdtsc changes with the PC programmable timer, and the code in
 the bootloader looks like it can fail silently if it doesn't manage to
 compute a stable value after 20 tries. It will still gives a "best guess",
 but it could be completely wrong, and in particular it could result in
 overflow of system_time computations?
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/16546#comment:11>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: