Rusty Russell wrote: > If the guest can invoke a printk(), it can potentially flood the logs, > causing a host DoS. We should also indicate *which* guest we're > talking about. > > This patch adds pr_guest (analogous to pr_debug) which ratelimits. > Not all printk's were replaced: some are only printed once and others > should probably be replaced by BUG(). I removed the kvm_printf in > init_rmode_tss: it says nothing that the return value doesn't say. > > Coders should be aware that printing in the logs is not particularly > useful except to give feedback to developers. ie. "should not be used > for chit-chat". > > int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module); > void kvm_exit_arch(void); > diff -r 3f158ee9df43 drivers/kvm/kvm_main.c > --- a/drivers/kvm/kvm_main.c Tue Jul 24 16:22:39 2007 +1000 > +++ b/drivers/kvm/kvm_main.c Tue Jul 24 16:28:33 2007 +1000 > @@ -425,8 +425,8 @@ inject_gp(struct kvm_vcpu *vcpu, const c > va_list args; > > va_start(args, why_fmt); > - printk(KERN_DEBUG "kvm: #GP "); > - vprintk(why_fmt, args); > + if (pr_guest(vcpu, "#GP ")) > + vprintk(why_fmt, args); > va_end(args); > kvm_arch_ops->inject_gp(vcpu, 0); > } >
Why go through this optimization? If it happens frequently, we can just remove the printk(). The printk()s are mostly on not-expected-to-happen exceptions, and should just be removed if guests do exercise them. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel