From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC] para virt interface of perf to support kvm guest os statistics collection in guest os Date: Wed, 09 Jun 2010 11:59:48 +0300 Message-ID: <4C0F5804.9080406@redhat.com> References: <1276054214.2096.383.camel@ymzhang.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: LKML , kvm@vger.kernel.org, Ingo Molnar , Fr??d??ric Weisbecker , Arnaldo Carvalho de Melo , Cyrill Gorcunov , Lin Ming , Sheng Yang , Marcelo Tosatti , oerg Roedel , Jes Sorensen , Gleb Natapov , Zachary Amsden , zhiteng.huang@intel.com, tim.c.chen@intel.com To: "Zhang, Yanmin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46272 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752994Ab0FIJAH (ORCPT ); Wed, 9 Jun 2010 05:00:07 -0400 In-Reply-To: <1276054214.2096.383.camel@ymzhang.sh.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/09/2010 06:30 AM, Zhang, Yanmin wrote: > From: Zhang, Yanmin > > Based on Ingo's idea, I implement a para virt interface for perf to support > statistics collection in guest os. That means we could run tool perf in guest > os directly. > > Great thanks to Peter Zijlstra. He is really the architect and gave me architecture > design suggestions. I also want to thank Yangsheng and LinMing for their generous > help. > > The design is: > > 1) Add a kvm_pmu whose callbacks mostly just calls hypercall to vmexit to host kernel; > 2) Create a host perf_event per guest perf_event; > 3) Host kernel syncs perf_event count/overflows data changes to guest perf_event > when processing perf_event overflows after NMI arrives. Host kernel inject NMI to guest > kernel if a guest event overflows. > 4) Guest kernel goes through all enabled event on current cpu and output data when they > overflows. > 5) No change in user space. > Other issues: - save/restore support for live migration - some way to limit the number of open handles (comes automatically with the table approach I suggested earlier) -- error compiling committee.c: too many arguments to function