HowTo: Controlling debug log verbosity with RmMsg #197
Replies: 3 comments
-
Thanks a lot for this very informative post. However, when I turn on confidential computing and start a confidential VM (launch script: I am changing Any idea what could be up here? |
Beta Was this translation helpful? Give feedback.
-
Here is a tiny tool that will let you change https://gist.github.com/mtijanic/32b077542b7e56dc603074115fcaea75 |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for the tool; it works great! As an addition: The latest LEVEL_XXX values can be found here: Using your tool, specifying
To clear the log configuration and revert to the default (disabling extra log prints):
|
Beta Was this translation helpful? Give feedback.
-
As you might have noticed in the codebase, we have a lot of
NV_PRINTF()
calls with various log levels, but very few of those make their way intodmesg
by default.When debugging issues it is often very helpful to up the log verbosity.
nvidia.ko
does this via theRmMsg
global variable. The simplest and most often used value for RmMsg is":"
which enables all prints unconditionally.The easiest way to set it is as a charp module param
NVreg_RmMsg
. For example:or, in an
/etc/modprobe.d/
configuration file:You can also change it at runtime using this tool.
The variable is parsed every time a print call is made, so any other way of modifying the memory (such as through a debugger) will also work. There is also a sequence of
ioctl()
calls that can modify it, but we'll cover that in a different post later.The formal definition for RmMsg rules format is:
Or, in other words, it's a comma-separated list of rules. Rules are parsed in order and in case of conflict the later ones override earlier ones.
!
- makes this rule an exclusion rule instead of an inclusion rulefile
- a string matching all or part of the filenamefunction
- a string matching all or part of a functionstartline
- a single line number or the start of a line range with endlineendline
- the end of an line rangelevel
- suppress messages < level. Level is the integer value for LEVEL_XXX constants.prefix
- Modify the default message prefix (NVRM: <function-name>:
)'*'
Enable all'n'
Enable NVRM (default)'c'
Enable filename'l'
Enable line number'f'
Enable function (default)'t'
Enable timestamp"^NF"
Few examples:
"gsp"
- Enable any GSP related printf by substring match"kernel_gsp.c"
- enable all printfs in kernel_gsp.c"_kgspProcessRpcEvent"
- enable all printfs in function _kgspProcessRpcEvent"!_kgspProcessRpcEvent"
- disable all printfs in function _kgspProcessRpcEvent"kernel_gsp.c:150"
- enable printf on line 150 of kernel_gsp.c"kernel_gsp.c:100-200"
- enable printf on lines 100-200 in kernel_gsp.c"kernel_gsp.c:100-200,!kernel_gsp.c:125"
- same but disable printf on line 125"gsp^*"
- enable verbose prefix for all gsp commands"rmapi^t"
- enable timestamps for all RM API prints.":"
- enable all printfs (very noisy)"!"
- disable all printfs (not recommended)"^*"
- enable verbose prefix for all printfsThe rule checks are implemented in nvDbgRmMsgCheck().
When submitting bug reports, generally having more prints is better, so
":"
is often the best option. But please be aware that the kernel message log buffer is limited and very spammy prints can fill it up and make it drop more useful earlier ones. If using":"
it might be a good idea to increase the buffer size.Beta Was this translation helpful? Give feedback.
All reactions