Page MenuHomeFreeBSD

db show thread: avoid overlow in tick conversion
ClosedPublic

Authored by rlibby on May 16 2019, 5:04 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 3:42 PM
Unknown Object (File)
Sep 20 2024, 5:41 PM
Unknown Object (File)
Sep 8 2024, 10:02 AM
Unknown Object (File)
Sep 7 2024, 10:28 PM
Unknown Object (File)
Sep 7 2024, 5:40 AM
Unknown Object (File)
Aug 17 2024, 10:57 AM
Unknown Object (File)
Aug 17 2024, 4:57 AM
Unknown Object (File)
Jul 29 2024, 12:14 AM
Subscribers

Details

Summary

The previous calculations for displaying the time since last switch
easily overflowed, after less than 36 min for hz=1000. Now overflow
takes 2000 times longer (as long as ticks takes to overflow).

Test Plan
vali# cat - &  
[1] 810
vali# sysctl debug.kdb.enter=1
debug.kdb.enter:KDB: enter: sysctl debug.kdb.enter
[ thread pid 843 tid 100153 ]
Stopped at      kdb_sysctl_enter+0x98:  movq    $0,kdb_why
db> show proc 810
Process 810 (cat) at 0xfffff80004a29530:
 state: NORMAL
 uid: 0  gids: 0, 0, 5
 parent: pid 808 at 0xfffff80004c5ca60
 ABI: FreeBSD ELF64
 arguments: cat -
 repear: 0xfffff800033e4530 reapsubtree: 1
 sigparent: 20
 vmspace: 0xfffff80004e03000
   (map 0xfffff80004e03000)
   (map.pmap 0xfffff80004e030d0)
   (pmap 0xfffff80004e03130)
 threads: 1
100145                   s                                   cat
db> show thread 100145
Thread 100145 at 0xfffff80004a355a0:
 proc (pid 810): 0xfffff80004a29530
 name: cat
 pcb: 0xfffffe0050cfeb80
 stack: 0xfffffe0050cfb000-0xfffffe0050cfefff
 flags: 0x20844  pflags: 0
 state: INHIBITED: {SUSPENDED}
 priority: 125
 container lock: sched lock 3 (0xffffffff81eb3ac0)
 last voluntary switch: 588.880 s ago
 last involuntary switch: 588.880 s ago

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable