From: Avi Kivity <avi@redhat.com>
To: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
Cc: Gleb Natapov <gleb@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
kvm@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Fr??d??ric Weisbecker <fweisbec@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Cyrill Gorcunov <gorcunov@gmail.com>,
Lin Ming <ming.m.lin@intel.com>,
Sheng Yang <sheng@linux.intel.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
oerg Roedel <joro@8bytes.org>,
Jes Sorensen <Jes.Sorensen@redhat.com>,
Zachary Amsden <zamsden@redhat.com>,
zhiteng.huang@intel.com, tim.c.chen@intel.com,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH V2 3/5] ara virt interface of perf to support kvm guest os statistics collection in guest os
Date: Tue, 22 Jun 2010 11:04:48 +0300 [thread overview]
Message-ID: <4C206EA0.3060101@redhat.com> (raw)
In-Reply-To: <1277185636.2096.675.camel@ymzhang.sh.intel.com>
On 06/22/2010 08:47 AM, Zhang, Yanmin wrote:
> On Mon, 2010-06-21 at 16:56 +0300, Gleb Natapov wrote:
>
>> On Mon, Jun 21, 2010 at 05:31:43PM +0800, Zhang, Yanmin wrote:
>>
>>> The 3rd patch is to implement para virt perf at host kernel.
>>>
>>> Signed-off-by: Zhang Yanmin<yanmin_zhang@linux.intel.com>
>>>
>>>
> <snip>
>
>
>>> +
>>> +static void kvm_copy_event_to_guest(struct kvm_vcpu *vcpu,
>>> + struct perf_event *host_event)
>>> +{
>>> + struct host_perf_shadow *shadow = host_event->host_perf_shadow;
>>> + struct guest_perf_event counter;
>>> + int ret;
>>> + s32 overflows;
>>> +
>>> + ret = kvm_read_guest(vcpu->kvm, shadow->guest_event_addr,
>>> + &counter, sizeof(counter));
>>> + if (ret< 0)
>>> + return;
>>> +
>>> +again:
>>> + overflows = atomic_read(&shadow->counter.overflows);
>>> + if (atomic_cmpxchg(&shadow->counter.overflows, overflows, 0) !=
>>> + overflows)
>>> + goto again;
>>> +
>>> + counter.count = shadow->counter.count;
>>> + atomic_add(overflows,&counter.overflows);
>>> +
>>> + kvm_write_guest(vcpu->kvm,
>>> + shadow->guest_event_addr,
>>> + &counter,
>>> + sizeof(counter));
>>>
>> Those kind of interfaces worry me since the can cause bugs that are
>> very hard to catch. What if guest enables some events and crashes into
>> kdump kernel (or kexec new kernel) without reseting HW. Now host may
>> write over guest memory without guest expecting it. Do you handle this
>> scenario in a guest side? I think you need to register reboot notify
>> and disable events from there.
>>
> Sorry for missing your comments.
>
> My patch could take care of dead guest os by cleaning up all events in function
> kvm_arch_destroy_vm, so all events are closed if host user kills the guest
> qemu process.
>
>
A reset does not involve destroying a vm; you have to clean up as part
of the rest process.
Note MSRs are automatically cleared, so that's something in favour of an
MSR interface.
> As for your scenario, I will register reboot notify and add a new pv perf
> hypercall interface to vmexit to host kernel to do cleanup.
>
You aren't guaranteed a reboot notifier will be called. On the other
hand, we need a kexec handler.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2010-06-22 8:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 9:31 [PATCH V2 3/5] ara virt interface of perf to support kvm guest os statistics collection in guest os Zhang, Yanmin
2010-06-21 12:33 ` Avi Kivity
2010-06-22 3:12 ` Zhang, Yanmin
2010-06-22 8:29 ` Avi Kivity
2010-06-23 3:12 ` Zhang, Yanmin
2010-06-23 5:51 ` Avi Kivity
2010-06-24 3:36 ` Zhang, Yanmin
2010-06-24 7:59 ` Avi Kivity
2010-06-21 13:56 ` Gleb Natapov
2010-06-22 5:47 ` Zhang, Yanmin
2010-06-22 8:04 ` Avi Kivity [this message]
2010-06-23 1:43 ` Zhang, Yanmin
2010-06-23 8:09 ` Avi Kivity
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=4C206EA0.3060101@redhat.com \
--to=avi@redhat.com \
--cc=Jes.Sorensen@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=gleb@redhat.com \
--cc=gorcunov@gmail.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=mtosatti@redhat.com \
--cc=sheng@linux.intel.com \
--cc=tim.c.chen@intel.com \
--cc=yanmin_zhang@linux.intel.com \
--cc=zamsden@redhat.com \
--cc=zhiteng.huang@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).