Skip to content

Conversation

@fslongjin
Copy link
Member

@fslongjin fslongjin commented Nov 27, 2025

  • Introduced a new module for managing kernel log levels, mimicking Linux behavior.
  • Added support for dynamic log level configuration via command line and procfs interface.
  • Created a new /proc/sys/kernel/printk file for reading and writing log level settings.
  • Updated existing logging mechanisms to utilize the new log level management system.
  • Enhanced the QEMU startup script to allow setting log levels through environment variables.

This implementation improves logging flexibility and aligns with expected Linux functionality.


Note

Introduce Linux-like kernel loglevel control (cmdline + /proc/sys/kernel/printk), integrate filtering into logger/kmsg, and add QEMU env-based loglevel.

  • Logging / klog:
    • Add debug/klog/loglevel with global KERNEL_LOG_LEVEL, LogLevel, and filtering (should_print, cmdline handler handle_loglevel_param).
    • Update libs/printk logger to filter by KERNEL_LOG_LEVEL, map log::Level to LogLevel, and push structured LogMessage to kmsg.
  • Procfs:
    • Introduce /proc/sys/kernel/printk with read/write via sys::sysctl::PrintkSysctl (returns four loglevel fields; writes set console level).
    • Add procfs/sys tree creation; wire read/write paths in IndexNode::read_at/write_at for ProcSysKernelPrintk.
    • Refactor klog.rs to define LogMessage using shared LogLevel; update kmsg to use it and clone on push.
  • Init / Cmdline:
    • Expose KernelCmdlineKV/EarlyKV fields and invoke handle_loglevel_param() during cmdline init.
  • Tools:
    • Enhance tools/run-qemu.sh to accept DRAGONOS_LOGLEVEL env var and pass loglevel=N to kernel cmdline.

Written by Cursor Bugbot for commit 62909c0. This will update automatically on new commits. Configure here.

- Introduced a new module for managing kernel log levels, mimicking Linux behavior.
- Added support for dynamic log level configuration via command line and procfs interface.
- Created a new `/proc/sys/kernel/printk` file for reading and writing log level settings.
- Updated existing logging mechanisms to utilize the new log level management system.
- Enhanced the QEMU startup script to allow setting log levels through environment variables.

This implementation improves logging flexibility and aligns with expected Linux functionality.

Signed-off-by: longjin <longjin@DragonOS.org>
@github-actions github-actions bot added ambiguous The title of PR/issue doesn't match the format enhancement New feature or request labels Nov 27, 2025
@fslongjin fslongjin changed the title 0feat(klog): Implement kernel log level management and procfs interface feat(klog): Implement kernel log level management and procfs interface Nov 27, 2025
@github-actions github-actions bot removed the ambiguous The title of PR/issue doesn't match the format label Nov 27, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 26

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@fslongjin fslongjin merged commit b0a7948 into DragonOS-Community:master Dec 1, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant