From: Steven Rostedt <rostedt@goodmis.org>
To: Dhaval Giani <dhaval.giani@gmail.com>
Cc: Avi Kivity <avi@redhat.com>,
kvm@vger.kernel.org, joro@8bytes.org, agraf@suse.de,
linux-kernel@vger.kernel.org,
Fabio Checconi <fchecconi@gmail.com>,
Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
Subject: Re: [PATCH] kvm: log directly from the guest to the host kvm buffer
Date: Tue, 17 May 2011 11:50:34 -0400 [thread overview]
Message-ID: <1305647434.5456.738.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <BANLkTi=BnRCJ4S32S=+zNNOSTxmZsR6Jrg@mail.gmail.com>
On Thu, 2011-05-12 at 17:39 +0200, Dhaval Giani wrote:
> >>
> >> +int kvm_pv_ftrace(struct kvm_vcpu *vcpu, unsigned long ip, gpa_t addr)
> >> +{
> >> + int ret;
> >> + char *fmt = (char *) kzalloc(PAGE_SIZE, GFP_KERNEL);
> >> +
> >> + ret = kvm_read_guest(vcpu->kvm, addr, fmt, PAGE_SIZE);
> >> +
> >> + trace_printk("KVM instance %p: VCPU %d, IP %lu: %s",
> >> + vcpu->kvm, vcpu->vcpu_id, ip, fmt);
> >> +
> >> + kfree(fmt);
> >> +
> >> + return 0;
> >> +}
> >
> > A kmalloc and printf seem expensive here. I'd prefer to log the arguments
> > and format descriptor instead. Similarly the guest should pass unformatted
> > parameters.+int kvm_ftrace_printk(unsigned long ip, const char *fmt, ...)
> >>
>
> the trace_printk is actually quite cheap (IIRC), but I guess Steve is
> the best person to let us know about that. We can avoid the kzalloc
> overhead though.
You could replace the kzalloc with a static page. Perhaps, one page per
CPU. Then you just need to disable interrupts (unless this is never
called by an interrupt) to get the information into the page, without
any allocation.
trace_printk() does basically the same thing, but uses a single page
with locks. I've thought about replacing that with per cpu pages too,
but haven't gotten around to it.
I also agree that you should just write to some buffer and when it
overflows, flush it.
-- Steve
prev parent reply other threads:[~2011-05-17 15:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-12 13:36 Dhaval Giani
2011-05-12 15:13 ` Avi Kivity
2011-05-12 15:39 ` Dhaval Giani
2011-05-12 15:42 ` Avi Kivity
2011-05-12 23:59 ` Eric Northup
2011-05-17 15:50 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1305647434.5456.738.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=dhaval.giani@gmail.com \
--cc=fchecconi@gmail.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tommaso.cucinotta@sssup.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®