From patchwork Mon Aug 24 12:53:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 7064121 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 811C99F358 for ; Mon, 24 Aug 2015 12:54:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9ABE204A7 for ; Mon, 24 Aug 2015 12:54:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7B58206BC for ; Mon, 24 Aug 2015 12:54:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932903AbbHXMxw (ORCPT ); Mon, 24 Aug 2015 08:53:52 -0400 Received: from blu004-omc1s22.hotmail.com ([65.55.116.33]:53305 "EHLO BLU004-OMC1S22.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932718AbbHXMxv (ORCPT ); Mon, 24 Aug 2015 08:53:51 -0400 Received: from BLU436-SMTP102 ([65.55.116.9]) by BLU004-OMC1S22.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Mon, 24 Aug 2015 05:53:50 -0700 X-TMN: [tDo/VH0hnabjMvV3IbneQar+zA2u08bPd2PFuJSJqM4=] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: From: Wanpeng Li To: Paolo Bonzini CC: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH 3/3] KVM: trace kvm_halt_poll_ns grow/shrink Date: Mon, 24 Aug 2015 20:53:24 +0800 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440420804-15198-1-git-send-email-wanpeng.li@hotmail.com> References: <1440420804-15198-1-git-send-email-wanpeng.li@hotmail.com> X-OriginalArrivalTime: 24 Aug 2015 12:53:48.0718 (UTC) FILETIME=[EB78E4E0:01D0DE6B] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Tracepoint for dynamic halt_pool_ns, fired on every potential change. Signed-off-by: Wanpeng Li --- include/trace/events/kvm.h | 30 ++++++++++++++++++++++++++++++ virt/kvm/kvm_main.c | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h index a44062d..75ddf80 100644 --- a/include/trace/events/kvm.h +++ b/include/trace/events/kvm.h @@ -356,6 +356,36 @@ TRACE_EVENT( __entry->address) ); +TRACE_EVENT(kvm_halt_poll_ns, + TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old), + TP_ARGS(grow, vcpu_id, new, old), + + TP_STRUCT__entry( + __field(bool, grow) + __field(unsigned int, vcpu_id) + __field(int, new) + __field(int, old) + ), + + TP_fast_assign( + __entry->grow = grow; + __entry->vcpu_id = vcpu_id; + __entry->new = new; + __entry->old = old; + ), + + TP_printk("vcpu %u: halt_pool_ns %d (%s %d)", + __entry->vcpu_id, + __entry->new, + __entry->grow ? "grow" : "shrink", + __entry->old) +); + +#define trace_kvm_halt_poll_ns_grow(vcpu_id, new, old) \ + trace_kvm_halt_poll_ns(true, vcpu_id, new, old) +#define trace_kvm_halt_poll_ns_shrink(vcpu_id, new, old) \ + trace_kvm_halt_poll_ns(false, vcpu_id, new, old) + #endif #endif /* _TRACE_KVM_MAIN_H */ diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index bcfbd35..65e3631 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1959,13 +1959,21 @@ static unsigned int __shrink_halt_poll_ns(int val, int modifier, int minimum) static void grow_halt_poll_ns(struct kvm_vcpu *vcpu) { + int old = vcpu->halt_poll_ns; + vcpu->halt_poll_ns = __grow_halt_poll_ns(vcpu->halt_poll_ns); + + trace_kvm_halt_poll_ns_grow(vcpu->vcpu_id, vcpu->halt_poll_ns, old); } static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu) { + int old = vcpu->halt_poll_ns; + vcpu->halt_poll_ns = __shrink_halt_poll_ns(vcpu->halt_poll_ns, halt_poll_ns_shrink, halt_poll_ns); + + trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, vcpu->halt_poll_ns, old); } /*