Steven Rostedt
2006-Oct-02 16:26 UTC
[Xen-devel] [PATCH][RFC] addition of loglevel for printf in Xen HV
In the current implementation, the logging in the Hypervisor is basically at two levels. The developer can print "always" or "verbose". The always print is when the developer uses "printk/printf" in the hypervisor. The "verbose" is when the developer uses DPRINTK, since the DPRINTK macro is only defined when the "verbose" flag is set. Now the problem we are having, is that when we send out a distribution, we want enough information to be printed if one of our customers has a problem. But we also don''t want to have so much printed that it affects the performance of the system. Or worst yet, if the system has a serial console attached, one of the DomU''s could in essence cause a DoS attack on the whole system by causing the DomU to do certain errors that causes a thousand prints to the serial console. These prints are done with interrupts disabled, so the system suffers large latencies for each print. Since it would be helpful to have prints for different environments, I''ve introduced with this patch a Linux like loglevel from 0-7. When the user sets the loglevel to 0, only emergency prints are preformed, and when 7 is selected, all prints are done. Here''s the list of levels that I have added: #define XEN_EMERG "<0>" #define XEN_ALERT "<1>" #define XEN_CRIT "<2>" #define XEN_ERR "<3>" #define XEN_WARNING "<4>" #define XEN_GUEST "<5>" #define XEN_INFO "<6>" #define XEN_DEBUG "<7>" Basically, these correspond to their Linux equivalents. The one difference, is that the KERN_NOTICE was replaced by XEN_GUEST. The XEN_GUEST is the level that a guest can "at will" cause this print. So a distribution can set the print log level to 4 (XEN_WARNING) and all prints that are of errors and can be used for debugging are now available, without the prints that allow a Guest to cause a DoS. I also added the keyhandlers ''0'' to ''7'' to allow the user to change the loglevel on a running system to the corresponding key. This is similar to the way Linux uses sysrq to change its log levels. Two things that are not implemented with this patch but should be, and thus the RFC in the subject. 1. How to default the log level on build. Should the verbose now be a number, and not a config? i.e. VERBOSE=4 2. How the user in Linux can change the log level (from dom0). Should we add a hypercall or some other method to allow the user to change the logging? Also, I made a pass though to assign all DPRINTK a log level. I may not have done this correctly. But a loglevel of 7 is now the same a VERBOSE=y and a loglevel of 0 is almost the same of a VERBOSE=n. There was a couple of places where XEN_EMERG was used. This patch really does need to go in. Whether in its current form, or modified greatly. The ability to give the developer a level of printing is a great asset. That is why Linux has this ability. -- Steve _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Steven Rostedt
2006-Oct-02 16:37 UTC
Re: [Xen-devel] [PATCH][RFC] addition of loglevel for printf in Xen HV
Forgot to add a sign off. -- Steve Signed-off-by: Steven Rostedt <srostedt@redhat.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel