Commit 5e1b8a1
committed
log: symbolic levels, H2K_LOG_NO_SPAM mode, and bitmask once_ht
Three improvements to the logging system:
1. Accept symbolic level names in LOGBUF syntax (err, warn, info, dbg) in
addition to numeric values (0, 1, 2, 3):
make LOGBUF=1[warn] whole kernel, WARN and above
make LOGBUF=sched[info] sched directory, INFO and above
make LOGBUF=futex[err],sched[dbg] mixed symbolic and numeric
2. Add H2K_LOG_NO_SPAM mode to strip spam-control macros (once/throttle) and
make them no-ops. Eliminates static state bloat:
make LOGBUF=1[warn] H2K_LOG_NO_SPAM=1
In this mode, H2K_log_once/throttle macros become empty (no-op), while
base H2K_log/err/warn/info/dbg macros still emit normally.
3. Optimize H2K_log_once_ht to use a single u32 bitmask instead of an array.
Each hardware thread's once-flag is now a single bit in a shared u32,
reducing per-callsite memory from MAX_HTHREADS*4 bytes to 4 bytes.
Uses H2K_atomic_setbit for race-free per-bit access. Works in both
H2K_LOGBUF and H2K_LOG_PRINTF modes.
Implemented via Makefile function for level mapping, conditional macro
redefinition in log.h, and bitmask logic in log.ref.c. Works in both kernel
(LOGBUF) and standalone test (LOG_PRINTF) builds.
Signed-off-by: Zeev Belinsky <zbelinsk@qti.qualcomm.com>1 parent dd64d3e commit 5e1b8a1
1 file changed
Lines changed: 86 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
0 commit comments