From patchwork Tue Dec 16 14:08:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 5500791 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6E44ABEEA8 for ; Tue, 16 Dec 2014 14:10:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C94E20A22 for ; Tue, 16 Dec 2014 14:10:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63DE820A21 for ; Tue, 16 Dec 2014 14:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751136AbaLPOJz (ORCPT ); Tue, 16 Dec 2014 09:09:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44798 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbaLPOJu (ORCPT ); Tue, 16 Dec 2014 09:09:50 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBGE9niW007221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 16 Dec 2014 09:09:50 -0500 Received: from amt.cnet (vpn1-5-209.gru2.redhat.com [10.97.5.209]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBGE9m0E024081; Tue, 16 Dec 2014 09:09:49 -0500 Received: from amt.cnet (localhost [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 7CD7B1009B9; Tue, 16 Dec 2014 12:09:35 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.7/8.14.7/Submit) id sBGE9Z0N001804; Tue, 16 Dec 2014 12:09:35 -0200 Message-Id: <20141216140853.767043716@redhat.com> User-Agent: quilt/0.60-1 Date: Tue, 16 Dec 2014 09:08:16 -0500 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: Luiz Capitulino , Rik van Riel , Paolo Bonzini , Radim Krcmar , Marcelo Tosatti Subject: [patch 3/3] KVM: x86: add tracepoint to wait_lapic_expire References: <20141216140813.493421022@redhat.com> Content-Disposition: inline; filename=lapic-wait-tracepoint X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Add tracepoint to wait_lapic_expire. Signed-off-by: Marcelo Tosatti Reviewed-by: Radim Kr?má? --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: kvm/arch/x86/kvm/lapic.c =================================================================== --- kvm.orig/arch/x86/kvm/lapic.c +++ kvm/arch/x86/kvm/lapic.c @@ -1120,7 +1120,7 @@ static bool lapic_timer_int_injected(str void wait_lapic_expire(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; - u64 guest_tsc, tsc_deadline; + u64 orig_guest_tsc, guest_tsc, tsc_deadline; if (!kvm_vcpu_has_lapic(vcpu)) return; @@ -1133,7 +1133,7 @@ void wait_lapic_expire(struct kvm_vcpu * tsc_deadline = apic->lapic_timer.expired_tscdeadline; apic->lapic_timer.expired_tscdeadline = 0; - guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu, native_read_tsc()); + orig_guest_tsc = guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu, native_read_tsc()); while (guest_tsc < tsc_deadline) { int delay = min(tsc_deadline - guest_tsc, 1000ULL); @@ -1141,6 +1141,8 @@ void wait_lapic_expire(struct kvm_vcpu * __delay(delay); guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu, native_read_tsc()); } + + trace_kvm_wait_lapic_expire(vcpu->vcpu_id, orig_guest_tsc - tsc_deadline); } static void start_apic_timer(struct kvm_lapic *apic) Index: kvm/arch/x86/kvm/trace.h =================================================================== --- kvm.orig/arch/x86/kvm/trace.h +++ kvm/arch/x86/kvm/trace.h @@ -914,6 +914,25 @@ TRACE_EVENT(kvm_pvclock_update, __entry->flags) ); +TRACE_EVENT(kvm_wait_lapic_expire, + TP_PROTO(unsigned int vcpu_id, s64 delta), + TP_ARGS(vcpu_id, delta), + + TP_STRUCT__entry( + __field( unsigned int, vcpu_id ) + __field( s64, delta ) + ), + + TP_fast_assign( + __entry->vcpu_id = vcpu_id; + __entry->delta = delta; + ), + + TP_printk("vcpu %u: delta %lld", + __entry->vcpu_id, + __entry->delta) +); + #endif /* _TRACE_KVM_H */ #undef TRACE_INCLUDE_PATH