casaroli opened a new pull request, #21327:
URL: https://github.com/apache/nuttx/pull/21327

   ## Summary
   
   **Kconfig: Allow the scheduler errors and warnings with syslog time 
stamps.** `DEBUG_SCHED` depended on `!SYSLOG_TIMESTAMP` since commit 
feabe52fd8d (2023): then `clock_gettime()` called `sinfo()`, and the time stamp 
of each `syslog()` message calls `clock_gettime()`, so the two called each 
other. Commit d60dee4a650 (2023) removed the debug output from 
`clock_gettime()`, but the dependency stayed. So a configuration could not have 
the scheduler errors and warnings and time-stamped syslog messages together: 
`make olddefconfig` silently dropped `DEBUG_SCHED` (and 
`DEBUG_SCHED_ERROR`/`_WARN`) when `SYSLOG_TIMESTAMP` was on.
   
   `DEBUG_SCHED` no longer depends on `SYSLOG_TIMESTAMP`. The old limit stays 
for `DEBUG_SCHED_INFO` only (with a help text that says why): the informational 
output is the one that the 2023 loop used, and it is the most likely to come 
back into the clock code.
   
   Why the scheduler errors and warnings cannot loop (checked on master): the 
time stamp of `nx_vsyslog()` (`drivers/syslog/vsyslog.c`) calls 
`clock_gettime()` -> `nxclock_gettime()` -> `clock_systime_timespec()` -> 
`up_rtc_gettime()`, `up_timer_gettime()` or `clock_ticks2time()` (and 
`clock_timekeeping_get_wall_time()` for `CLOCK_REALTIME` with 
`CLOCK_TIMEKEEPING`). In `sched/clock/` only `clock_getres.c` (`serr()`, 
`sinfo()`) and `clock_initialize.c` (`sinfo()` in the RTC resynchronization) 
have debug output, and neither is on that path; no other `serr()` or `swarn()` 
of `sched/` is on it.
   
   ## Impact
   
   - Kconfig only. Configurations without `SYSLOG_TIMESTAMP`, or without 
`DEBUG_SCHED`, do not change. No defconfig sets both (79 defconfigs set 
`SYSLOG_TIMESTAMP`, none of them `DEBUG_SCHED`).
   - With both: the scheduler errors and warnings are now possible; 
`DEBUG_SCHED_INFO` stays off.
   - The same for all build modes and architectures.
   
   ## Testing
   
   Test program `schedts.c`: `clock_getres()` of a clock that does not exist 
(EINVAL) makes the scheduler log an error ("clock_getres: Returning ERROR"); 
the test reads the RAMLOG (`/dev/kmsg`) and checks that the line is there, that 
it starts with a time stamp, and that the time stamps of all lines do not go 
back.
   
   Base 5c441693fa8. qemu-armv8a:knsh (HVF) with `DEBUG_FEATURES`, 
`DEBUG_ERROR`, `DEBUG_WARN`, `DEBUG_SCHED`, `DEBUG_SCHED_ERROR`, 
`DEBUG_SCHED_WARN`, `SYSLOG_TIMESTAMP`, and the RAMLOG as a second syslog 
channel (`RAMLOG_SYSLOG`, `/dev/kmsg`):
   
   | | master | branch |
   |---|---|---|
   | `.config` after `olddefconfig` | `DEBUG_SCHED` dropped, 
`SYSLOG_TIMESTAMP=y` | `DEBUG_SCHED`, `_ERROR`, `_WARN`, `SYSLOG_TIMESTAMP` all 
kept (`DEBUG_SCHED_INFO` off) |
   | `schedts` | `getres` PASS; `logged`, `stamp`, `order` FAIL (empty log) | 4 
PASS: `[    0.050201] clock_getres: Returning ERROR` |
   | ostest (knsh) | 0 | 0 |
   | ostest (qemu-armv8a:nsh, same options) | 0 | 0 |
   
   Build check (each with `DEBUG_FEATURES`, `DEBUG_ERROR`, `DEBUG_WARN`, 
`DEBUG_SCHED`, `DEBUG_SCHED_ERROR`, `DEBUG_SCHED_WARN`, `SYSLOG_TIMESTAMP`; 
`olddefconfig` kept every option): qemu-armv8a:knsh, rv-virt:knsh64, 
qemu-intel64:knsh_romfs, qemu-armv7a:knsh, esp32s3-devkit:knsh, 
qemu-armv8a:nsh, sim:nsh, rv-virt:pnsh64 (protected), and qemu-armv8a:nsh with 
`SYSLOG_TIMESTAMP_REALTIME` and `SYSLOG_TIMESTAMP_FORMATTED`: OK. 
lm3s6965-ek:qemu-protected (arm-none-eabi-gcc 15.3): "region kflash overflowed 
by 1160 bytes"; the same board with the scheduler debug options and without 
`SYSLOG_TIMESTAMP` (allowed on master) overflows too (1056 bytes), while 
`SYSLOG_TIMESTAMP` alone builds: the scheduler debug output does not fit that 
board's kernel flash.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to