From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH] KVM: Create debugfs statistics for each VM Date: Fri, 5 Feb 2016 11:14:43 +0100 Message-ID: <56B47613.4070309@de.ibm.com> References: <1453996159-19576-1-git-send-email-frankja@linux.vnet.ibm.com> <1453996159-19576-2-git-send-email-frankja@linux.vnet.ibm.com> <56B0B9AF.3010305@de.ibm.com> <56B34CA7.4040107@redhat.com> <56B34DA9.5040004@de.ibm.com> <56B4652C.1050302@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, dan.carpenter@oracle.com To: Janosch Frank , Paolo Bonzini Return-path: Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:59266 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751574AbcBEKOt (ORCPT ); Fri, 5 Feb 2016 05:14:49 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Feb 2016 10:14:48 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 697702190019 for ; Fri, 5 Feb 2016 10:14:31 +0000 (GMT) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u15AEirs22085664 for ; Fri, 5 Feb 2016 10:14:44 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u15AEi3o028360 for ; Fri, 5 Feb 2016 03:14:44 -0700 In-Reply-To: <56B4652C.1050302@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 02/05/2016 10:02 AM, Janosch Frank wrote: > On 02/04/2016 02:10 PM, Christian Borntraeger wrote: >> On 02/04/2016 02:05 PM, Paolo Bonzini wrote: >>> >>> >>> On 02/02/2016 15:14, Christian Borntraeger wrote: >>>> FWIW, the newly created subfolders, >>>> >>>> require QEMU commit 6590045e5dd2fb0b1d7cdc047ae0c52fd4bb5276 >>>> scripts/kvm/kvm_stat: Replaced os.listdir with os.walk >>>> >>>> Otherwise you might get errors like >>>> >>>> Traceback (most recent call last): >>>> File "scripts/kvm/kvm_stat", line 640, in >>>> curses.wrapper(tui, stats) >>>> File "/usr/lib64/python2.7/curses/wrapper.py", line 43, in wrapper >>>> return func(stdscr, *args, **kwds) >>>> File "scripts/kvm/kvm_stat", line 547, in tui >>>> refresh(sleeptime) >>>> File "scripts/kvm/kvm_stat", line 523, in refresh >>>> s = stats.get() >>>> File "scripts/kvm/kvm_stat", line 483, in get >>>> new = d.read() >>>> File "scripts/kvm/kvm_stat", line 37, in read >>>> return dict([(key, val(key)) for key in self._fields]) >>>> File "scripts/kvm/kvm_stat", line 36, in val >>>> return int(file(self.base + '/' + key).read()) >>>> IOError: [Errno 21] Is a directory: '/sys/kernel/debug/kvm/13123-31' >>>> >>>> when using the "-d" option. >>>> >>>> >>>> Paolo, I still think that this a valuable addon for debugging. Any guidance? >>> >>> Yeah, I agree... Do we want to add a module parameter for this, and/or >>> a kernel configuration that for now defaults to N? Hmm, a new Kconfig might also be a good idea. There is another problem that kvm_stat wants to have /sys/kernel/debug/tracing, which is only available with CONFIG_TRACING. CONFIG_TRACING cannot be selected by itself, so you have to enable some other tracer (like function tracing) that has nothing to do with KVM, which then selects GENERIC_TRACER which selects CONFIG_TRACING and then enables the kvm trace points. So maybe a config KVM_PER_GUEST_TRACING that selects GENERIC_TRACER and enables that feature? >>> >> >> >>> An alternative is to move kvm_stat from QEMU to tools/. >> >> Hmm, that is probably the best solution, given that it has no dependency >> on QEMU but heavily depends on the kernel module. > > So, what's the plan then? > > Give me some pointers and I'm happy to do the work, but I currently > don't have enough experience to know/guess what is wanted. > > I still have about 3 or 4 patches for kvm_stat in my queue that will add > the filtering support for debugfs AND tracefs. One of them also adds > documentation to the script, as well as to the man page and I might add > one that brings py3 support. > Most of them are ready, but before finishing the filtering support I > wanted to wait until the kernel patch was in next. > > Do you (Paolo) want to move this patch through kvm-next and the > corresponding python patches through qemu and later on move the script > to the kernel?