From patchwork Fri Jul 12 02:54:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 11041335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABB731395 for ; Fri, 12 Jul 2019 02:54:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AA7128BBA for ; Fri, 12 Jul 2019 02:54:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DE3028BBF; Fri, 12 Jul 2019 02:54:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4520D28BBA for ; Fri, 12 Jul 2019 02:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729174AbfGLCyr (ORCPT ); Thu, 11 Jul 2019 22:54:47 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37510 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729051AbfGLCyq (ORCPT ); Thu, 11 Jul 2019 22:54:46 -0400 Received: by mail-pl1-f195.google.com with SMTP id b3so4035821plr.4; Thu, 11 Jul 2019 19:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=64j1duN8Q6Xd7kRV0ySvGXg0eZ22bwDTxpKrN9mAXSY=; b=AHe1Evh3+uUAWpOBVIXpYTAk/unMWsGn2D3MEAxP2tnBXX6PS4AqyxdsOm1CxGackm WsYGT4J7LyN+CgbltLSBBsW6rfAVbVlxjUt3xVay86baYmxOwtQ105Bs4I8hlyVn9t+g TIlPy9ajseDKUaNuAhdFg9zZ753Vz2K2/8BgzRCQcG0YfFNe6NjWMIbvh3SP1/yAyxVD dtQIlV6lleTl9NWXT2GryG/2bPhXPEKx+i4xCrB0NrXdM5w6Cn71i9bhmu6SII91upEz /YNvQ2aGc8yA+RooKxBhZtzNzzSAoGzzAwArDTJbRNkG3V6eTp6+/xdV2PEDMp7/A/Wi gQEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=64j1duN8Q6Xd7kRV0ySvGXg0eZ22bwDTxpKrN9mAXSY=; b=AucxCgqlGhMOCt3iaFdChUDmi073Vw3DrGGuuv1qvrk4y0Vop8y4nFF09QqPsRaQaZ p81D/naSu3FOF6wSOVgEyYl11riFPD/ZUl0BXQM49V1gvsE+a5+iSQ8cvuIbMeqEtqU7 q8c3duHK+ocFtfsvGrNscsbwLcwPMxFOt2jRchWYRrmfzKy64r1BTLkbqAIwt6zY28QC tSLlT1yfTEyXILwIKoZYmhERA4JmbSK0cJQcEGI4P58z4BLR0m3Vq7/6wDuOy0Lie3Qy qBC6AvXthiJrnxu0uVY8d0Vr6OCelS5Sl/QnJZfud6QRFeoGCxMhtY21iOJBeBaY1Asu SVKg== X-Gm-Message-State: APjAAAURNOl2qUCH42aGerzJGnxgp+4auTpWtFCTe9VJZvKEViPdoaDD oFCObuDDkYAKKc3Cg/Ookos6COKGrw8= X-Google-Smtp-Source: APXvYqxi8dhpdclONkq7oo/LRkDbRkz37L73HpER/lr6g5PmDj65DBKzvhdvjrat/RYt6oo+85/N7A== X-Received: by 2002:a17:902:b608:: with SMTP id b8mr8579220pls.303.1562900085859; Thu, 11 Jul 2019 19:54:45 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.123]) by smtp.googlemail.com with ESMTPSA id n26sm7786630pfa.83.2019.07.11.19.54.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Jul 2019 19:54:45 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Subject: [PATCH 1/2] KVM: LAPIC: Add pv ipi tracepoint Date: Fri, 12 Jul 2019 10:54:39 +0800 Message-Id: <1562900080-20798-1-git-send-email-wanpengli@tencent.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li Add pv ipi tracepoint. Cc: Paolo Bonzini Cc: Radim Krčmář Signed-off-by: Wanpeng Li --- arch/x86/kvm/lapic.c | 2 ++ arch/x86/kvm/trace.h | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 3201d91..72c2a1e 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -568,6 +568,8 @@ int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, int cluster_size = op_64_bit ? 64 : 32; int count = 0; + trace_kvm_pv_send_ipi(irq.vector, min, ipi_bitmap_low, ipi_bitmap_high); + irq.vector = icr & APIC_VECTOR_MASK; irq.delivery_mode = icr & APIC_MODE_MASK; irq.level = (icr & APIC_INT_ASSERT) != 0; diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index b5c831e..ce6ee34 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -1462,6 +1462,31 @@ TRACE_EVENT(kvm_hv_send_ipi_ex, __entry->vector, __entry->format, __entry->valid_bank_mask) ); + +/* + * Tracepoints for kvm_pv_send_ipi. + */ +TRACE_EVENT(kvm_pv_send_ipi, + TP_PROTO(u32 vector, u32 min, unsigned long ipi_bitmap_low, unsigned long ipi_bitmap_high), + TP_ARGS(vector, min, ipi_bitmap_low, ipi_bitmap_high), + + TP_STRUCT__entry( + __field(u32, vector) + __field(u32, min) + __field(unsigned long, ipi_bitmap_low) + __field(unsigned long, ipi_bitmap_high) + ), + + TP_fast_assign( + __entry->vector = vector; + __entry->min = min; + __entry->ipi_bitmap_low = ipi_bitmap_low; + __entry->ipi_bitmap_high = ipi_bitmap_high; + ), + + TP_printk("vector %d min 0x%x ipi_bitmap_low 0x%lx ipi_bitmap_high 0x%lx", + __entry->vector, __entry->min, __entry->ipi_bitmap_low, __entry->ipi_bitmap_high) +); #endif /* _TRACE_KVM_H */ #undef TRACE_INCLUDE_PATH From patchwork Fri Jul 12 02:54:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 11041337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4426912 for ; Fri, 12 Jul 2019 02:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D32E528BBB for ; Fri, 12 Jul 2019 02:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C776F28BBD; Fri, 12 Jul 2019 02:54:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 668A728BBB for ; Fri, 12 Jul 2019 02:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729251AbfGLCyu (ORCPT ); Thu, 11 Jul 2019 22:54:50 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39572 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729051AbfGLCys (ORCPT ); Thu, 11 Jul 2019 22:54:48 -0400 Received: by mail-pg1-f195.google.com with SMTP id u17so3844659pgi.6; Thu, 11 Jul 2019 19:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hlJ5SZ08CSnSSRFOp53QvEnZVvpxlaIqKCaeg2qBZWQ=; b=rs/u0q0zlimgMudRG30frHH2GJkMqmSWVIoqVgt5q7BczEbHlSVxE+Yi1Zn6yJQllx 2yBc3L//ezoyamlGIZVw5GkVy1qMBxDJ1UBf2mw/5bV+80FWddBBxBx5DpxrF2vUWhrn wz2EH3dz0knCpHKuNQBOUMkq/z0KdMQDl9rkSBvtM5FwO7kloj9XOMF/AYcU9OqbgU1M d5frBbF0G3ObdVF1PNasNKuKRjcU/HjJHdSVhGkBXHFY7/QlcwvrXwI3BvJcRBtH4a4m NCSo2GRD5WU1/JZ7+sV5RYs7kitKJ8QaFobRAqam3qN+Uh2EKNlijxEKBzqjEIW5jdMv +XtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hlJ5SZ08CSnSSRFOp53QvEnZVvpxlaIqKCaeg2qBZWQ=; b=pcjhw/UL8WD6tIRflnI8zQUlE7koToDkxanmK46n+vGc1e/6Mod4ZGQliWD1YVH6aP +rSTVuH7qBSFat9JlGqWWFpVFvaY/T4qm5gxCHzGDQWJl9bN8cdlKO5B5Nio+KOkyvP6 WumlmOe6tFaTcsgylZqSzU+J12dAQSyEjO29T7FQy90H0MvA3LQqgDckkrYwWkYHgyQf 9f+27CPmS5Ylja7Dn23TjXlfSNKu3HFGBpuntTZvfdlpW3wy9VOV/akhXKoJX19BOg2S 5YSs0botN3CT579Q54zwkGKx4u+/dKzFrfXFS4KlvDSdG6j0U5VVNefIHcReSBbKwokf THPQ== X-Gm-Message-State: APjAAAUu+TwRziKoqoY4kvWAvK4OhRmeHJEgtWfplOEA4Ruw50Hapnnf 0Gz45jareArXN3uarzwrHgERAdTTyEA= X-Google-Smtp-Source: APXvYqyo6HA6DzVTwivRsf7q25xhytE4Nxc0FBSMKzXSSas3ujuYC1848eLpvDnP/dr2hScB7yX8mA== X-Received: by 2002:a63:d30f:: with SMTP id b15mr7882555pgg.341.1562900087624; Thu, 11 Jul 2019 19:54:47 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.123]) by smtp.googlemail.com with ESMTPSA id n26sm7786630pfa.83.2019.07.11.19.54.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Jul 2019 19:54:47 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Subject: [PATCH 2/2] KVM: X86: Add pv tlb shootdown tracepoint Date: Fri, 12 Jul 2019 10:54:40 +0800 Message-Id: <1562900080-20798-2-git-send-email-wanpengli@tencent.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1562900080-20798-1-git-send-email-wanpengli@tencent.com> References: <1562900080-20798-1-git-send-email-wanpengli@tencent.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li Add pv tlb shootdown tracepoint. Cc: Paolo Bonzini Cc: Radim Krčmář Signed-off-by: Wanpeng Li --- arch/x86/kvm/trace.h | 19 +++++++++++++++++++ arch/x86/kvm/x86.c | 2 ++ 2 files changed, 21 insertions(+) diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index ce6ee34..84f32d3 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -1487,6 +1487,25 @@ TRACE_EVENT(kvm_pv_send_ipi, TP_printk("vector %d min 0x%x ipi_bitmap_low 0x%lx ipi_bitmap_high 0x%lx", __entry->vector, __entry->min, __entry->ipi_bitmap_low, __entry->ipi_bitmap_high) ); + +TRACE_EVENT(kvm_pv_tlb_flush, + TP_PROTO(unsigned int vcpu_id, bool need_flush_tlb), + TP_ARGS(vcpu_id, need_flush_tlb), + + TP_STRUCT__entry( + __field( unsigned int, vcpu_id ) + __field( bool, need_flush_tlb ) + ), + + TP_fast_assign( + __entry->vcpu_id = vcpu_id; + __entry->need_flush_tlb = need_flush_tlb; + ), + + TP_printk("vcpu %u need_flush_tlb %s", __entry->vcpu_id, + __entry->need_flush_tlb ? "true" : "false") +); + #endif /* _TRACE_KVM_H */ #undef TRACE_INCLUDE_PATH diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bc1688e..a7a0514 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2458,6 +2458,8 @@ static void record_steal_time(struct kvm_vcpu *vcpu) * Doing a TLB flush here, on the guest's behalf, can avoid * expensive IPIs. */ + trace_kvm_pv_tlb_flush(vcpu->vcpu_id, + vcpu->arch.st.steal.preempted & KVM_VCPU_FLUSH_TLB); if (xchg(&vcpu->arch.st.steal.preempted, 0) & KVM_VCPU_FLUSH_TLB) kvm_vcpu_flush_tlb(vcpu, false);