From patchwork Mon Jul 29 05:32:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11063185 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 CC12C746 for ; Mon, 29 Jul 2019 05:32:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF2A5285CD for ; Mon, 29 Jul 2019 05:32:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B36CE286BE; Mon, 29 Jul 2019 05:32: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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 5B449285CD for ; Mon, 29 Jul 2019 05:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbfG2Fc4 (ORCPT ); Mon, 29 Jul 2019 01:32:56 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41944 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbfG2Fc4 (ORCPT ); Mon, 29 Jul 2019 01:32:56 -0400 Received: by mail-pf1-f196.google.com with SMTP id m30so27400579pff.8 for ; Sun, 28 Jul 2019 22:32:55 -0700 (PDT) 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=VwrOmLwm9SuJeXt60JPzTNp8w0LAjI+Cz+erHXrmem0=; b=lnQ+8ibkZM1PfrbfBJ86mjGA+K9bLCyMkZFQ7JUfjeNFToHyM0PldKVj6NZEZ4JNS2 55M6O9PSLBrZSOGYMeqH/sy4VVmaG6GNfLBWiSUHFashufYUXkn/LK/tVD9OHkVvsHWp Y8nvIhR09FCKIEAxS3VzsGtpe3dwQ3idR3vRmNGs5qNYZuYX1sNGmszSLb9QrFqTD0IP 5z0Ucy83bkCsx1gKqlrxSGPwXSS+Eyd9AL+4tlqVpM+9i3Z/fadrju63qpFbSpO/hdfx n06IWCylKaAhOb3GFUxdC9yh5rqtm2FLUs1QBUbtdd66eaTHVbgWCrWEXnszFXB/4hDv lZFQ== X-Gm-Message-State: APjAAAUqDjaw6KOPWYMM6kaTkZxWmModQEmv7N44KcHKu8nJYHElIgPh 5bem7s/KxK1YYCE7tP10EvBe9J3pWUM= X-Google-Smtp-Source: APXvYqwcI+XYlYt2aA5fBoyf96ppdnlGHaWXjMmdyNnUtrO3wIxL6tNMl12ewyVs2uuMJfftW6BOGA== X-Received: by 2002:aa7:9254:: with SMTP id 20mr35878432pfp.212.1564378375157; Sun, 28 Jul 2019 22:32:55 -0700 (PDT) Received: from xz-x1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id o129sm30498550pfg.1.2019.07.28.22.32.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Jul 2019 22:32:54 -0700 (PDT) From: Peter Xu X-Google-Original-From: Peter Xu To: kvm@vger.kernel.org Cc: Paolo Bonzini , peterx@redhat.com Subject: [PATCH 1/3] KVM: X86: Trace vcpu_id for vmexit Date: Mon, 29 Jul 2019 13:32:41 +0800 Message-Id: <20190729053243.9224-2-peterx@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190729053243.9224-1-peterx@redhat.com> References: <20190729053243.9224-1-peterx@redhat.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 It helps to pair vmenters and vmexis with multi-core systems. Signed-off-by: Peter Xu Reviewed-by: Krish Sadhukhan --- arch/x86/kvm/trace.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 4d47a2631d1f..26423d2e45df 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -232,17 +232,20 @@ TRACE_EVENT(kvm_exit, __field( u32, isa ) __field( u64, info1 ) __field( u64, info2 ) + __field( int, vcpu_id ) ), TP_fast_assign( __entry->exit_reason = exit_reason; __entry->guest_rip = kvm_rip_read(vcpu); __entry->isa = isa; + __entry->vcpu_id = vcpu->vcpu_id; kvm_x86_ops->get_exit_info(vcpu, &__entry->info1, &__entry->info2); ), - TP_printk("reason %s rip 0x%lx info %llx %llx", + TP_printk("vcpu %d reason %s rip 0x%lx info %llx %llx", + __entry->vcpu_id, (__entry->isa == KVM_ISA_VMX) ? __print_symbolic(__entry->exit_reason, VMX_EXIT_REASONS) : __print_symbolic(__entry->exit_reason, SVM_EXIT_REASONS), From patchwork Mon Jul 29 05:32:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11063187 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 286D913AC for ; Mon, 29 Jul 2019 05:33:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C160285CD for ; Mon, 29 Jul 2019 05:33:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 102F5286BE; Mon, 29 Jul 2019 05:33:00 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 AD592285CD for ; Mon, 29 Jul 2019 05:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbfG2Fc6 (ORCPT ); Mon, 29 Jul 2019 01:32:58 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36201 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbfG2Fc6 (ORCPT ); Mon, 29 Jul 2019 01:32:58 -0400 Received: by mail-pg1-f195.google.com with SMTP id l21so27617601pgm.3 for ; Sun, 28 Jul 2019 22:32:58 -0700 (PDT) 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=HZJ4b8SL4lecIrcsiUN4G2OH6Ni8r+V1YrncMnTM190=; b=Cbk1k5So2+4rU/PQUq12C5L+/PpRdcocfOAUCKS6OiFfplGsg7FQRYqfMsXlgeptTM eBU/8sKNQmyYKyeovA6jflLjToWbUvGoCjAjHKMJdIlnJ0USOPG51YSCqULjlViQu1hI 0/r4dkzEGPykPnOy2r+rliXHPOClsUC8q6MsQVZoNCz7IzHavCdCTg/kfjyOM7m6nnmE cqnAjH3thgRun8F0EvoyiRKhCTjLDW+1pDv5lPbqYg3MPN62l74RawkMgQQj5X4f8kzB 5kbs3YY9nXV/45pjN8TzMhfOj0dOjUCeRZZiCwazSb3v2zxEE+QvXy9ayTTY7gK08n6+ 5cBw== X-Gm-Message-State: APjAAAWrVlTkhhiBHX0mvAhAI9G0TSTLwLuGKWxuVSgkzCKyxT5YtzYj R4mAJ6DZQaD4MkoHX34htIyGrwnkHzU= X-Google-Smtp-Source: APXvYqzIH4wdp7LI90CRJPdh2W8D/+AUxVpt9lstQt7lhNhVcvrLaPwH0fYPG1VykHGKS1tUwlHXHQ== X-Received: by 2002:a63:6c46:: with SMTP id h67mr94500479pgc.248.1564378377506; Sun, 28 Jul 2019 22:32:57 -0700 (PDT) Received: from xz-x1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id o129sm30498550pfg.1.2019.07.28.22.32.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Jul 2019 22:32:56 -0700 (PDT) From: Peter Xu X-Google-Original-From: Peter Xu To: kvm@vger.kernel.org Cc: Paolo Bonzini , peterx@redhat.com Subject: [PATCH 2/3] KVM: X86: Remove tailing newline for tracepoints Date: Mon, 29 Jul 2019 13:32:42 +0800 Message-Id: <20190729053243.9224-3-peterx@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190729053243.9224-1-peterx@redhat.com> References: <20190729053243.9224-1-peterx@redhat.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 It's done by TP_printk() already. Signed-off-by: Peter Xu Reviewed-by: Krish Sadhukhan --- arch/x86/kvm/trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 26423d2e45df..76a39bc25b95 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -1323,7 +1323,7 @@ TRACE_EVENT(kvm_avic_incomplete_ipi, __entry->index = index; ), - TP_printk("vcpu=%u, icrh:icrl=%#010x:%08x, id=%u, index=%u\n", + TP_printk("vcpu=%u, icrh:icrl=%#010x:%08x, id=%u, index=%u", __entry->vcpu, __entry->icrh, __entry->icrl, __entry->id, __entry->index) ); @@ -1348,7 +1348,7 @@ TRACE_EVENT(kvm_avic_unaccelerated_access, __entry->vec = vec; ), - TP_printk("vcpu=%u, offset=%#x(%s), %s, %s, vec=%#x\n", + TP_printk("vcpu=%u, offset=%#x(%s), %s, %s, vec=%#x", __entry->vcpu, __entry->offset, __print_symbolic(__entry->offset, kvm_trace_symbol_apic), @@ -1368,7 +1368,7 @@ TRACE_EVENT(kvm_hv_timer_state, __entry->vcpu_id = vcpu_id; __entry->hv_timer_in_use = hv_timer_in_use; ), - TP_printk("vcpu_id %x hv_timer %x\n", + TP_printk("vcpu_id %x hv_timer %x", __entry->vcpu_id, __entry->hv_timer_in_use) ); From patchwork Mon Jul 29 05:32:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11063189 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 B936B13AC for ; Mon, 29 Jul 2019 05:33:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD1B9285CD for ; Mon, 29 Jul 2019 05:33:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A162F286BE; Mon, 29 Jul 2019 05:33:02 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 3C5B3285CD for ; Mon, 29 Jul 2019 05:33:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726713AbfG2FdB (ORCPT ); Mon, 29 Jul 2019 01:33:01 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37405 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbfG2FdB (ORCPT ); Mon, 29 Jul 2019 01:33:01 -0400 Received: by mail-pl1-f196.google.com with SMTP id b3so27056275plr.4 for ; Sun, 28 Jul 2019 22:33:00 -0700 (PDT) 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=dl9/+u0b6L/IcklRFKklE/XMP6QZhufwp9r7/QOwquY=; b=ua+sProjCIRzLvxS4QT1MHBlqOpB7AhbFURjrRlWcv72ugbgZQhKB3ZUUtRRQSR3H+ KDJsVTx9hDjIXplU1fYOw2br2wyjfeMdohHhsG8mizCLQtdRynOWtGRR5X9u42I4AiG4 Y7NOTncks7wylIBGh4G5tys2iv/kizxd3Pg1WVYqbLB+ShO7KkZb/M4BJerftvBpLdy0 ThmShgR+MgZ6vtK0/gz2TYS9n8RwiYNBQZaZbuymnZCWWSXIl61EFtwV9h/uIJqFXqJN z4R++VdExX/uZ6rwklvxfQrD0TVSY6a32W+Y1WEYUJCsUbnfGCjNNahjEUNH55yMDlqy L0jQ== X-Gm-Message-State: APjAAAWdY7WDN6iZwbGtT4Sr81V9hHz0Ac96+AOQ5gqA2BthX68jhW9N 4xxVhBcZFuQ7cgrV5G97Gh3dvD3ZDlY= X-Google-Smtp-Source: APXvYqwJ75zOeV3IXYaS4xaDewF73/KCZ1eplBMwKI992xyAk5GCZmKqw8Ou8QQfAw1iWvlwpBI0DA== X-Received: by 2002:a17:902:e011:: with SMTP id ca17mr110382769plb.328.1564378379971; Sun, 28 Jul 2019 22:32:59 -0700 (PDT) Received: from xz-x1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id o129sm30498550pfg.1.2019.07.28.22.32.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Jul 2019 22:32:59 -0700 (PDT) From: Peter Xu X-Google-Original-From: Peter Xu To: kvm@vger.kernel.org Cc: Paolo Bonzini , peterx@redhat.com Subject: [PATCH 3/3] KVM: X86: Tune PLE Window tracepoint Date: Mon, 29 Jul 2019 13:32:43 +0800 Message-Id: <20190729053243.9224-4-peterx@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190729053243.9224-1-peterx@redhat.com> References: <20190729053243.9224-1-peterx@redhat.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 The PLE window tracepoint triggers easily and it can be a bit confusing too. One example line: kvm_ple_window: vcpu 0: ple_window 4096 (shrink 4096) It easily let people think of "the window now is 4096 which is shrinked", but the truth is the value actually didn't change (4096). Let's only dump this message if the value really changed, and we make the message even simpler like: kvm_ple_window: vcpu 4 (4096 -> 8192) Signed-off-by: Peter Xu --- arch/x86/kvm/svm.c | 8 ++++---- arch/x86/kvm/trace.h | 22 +++++++++------------- arch/x86/kvm/vmx/vmx.c | 4 ++-- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 48c865a4e5dd..0d365b621b5a 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1268,8 +1268,8 @@ static void grow_ple_window(struct kvm_vcpu *vcpu) if (control->pause_filter_count != old) mark_dirty(svm->vmcb, VMCB_INTERCEPTS); - trace_kvm_ple_window_grow(vcpu->vcpu_id, - control->pause_filter_count, old); + trace_kvm_ple_window_changed(vcpu->vcpu_id, + control->pause_filter_count, old); } static void shrink_ple_window(struct kvm_vcpu *vcpu) @@ -1286,8 +1286,8 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu) if (control->pause_filter_count != old) mark_dirty(svm->vmcb, VMCB_INTERCEPTS); - trace_kvm_ple_window_shrink(vcpu->vcpu_id, - control->pause_filter_count, old); + trace_kvm_ple_window_changed(vcpu->vcpu_id, + control->pause_filter_count, old); } static __init int svm_hardware_setup(void) diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 76a39bc25b95..91c91f358b23 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -891,34 +891,30 @@ TRACE_EVENT(kvm_pml_full, ); TRACE_EVENT(kvm_ple_window, - TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old), - TP_ARGS(grow, vcpu_id, new, old), + TP_PROTO(unsigned int vcpu_id, int new, int old), + TP_ARGS(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: ple_window %d (%s %d)", - __entry->vcpu_id, - __entry->new, - __entry->grow ? "grow" : "shrink", - __entry->old) + TP_printk("vcpu %u (%d -> %d)", + __entry->vcpu_id, __entry->old, __entry->new) ); -#define trace_kvm_ple_window_grow(vcpu_id, new, old) \ - trace_kvm_ple_window(true, vcpu_id, new, old) -#define trace_kvm_ple_window_shrink(vcpu_id, new, old) \ - trace_kvm_ple_window(false, vcpu_id, new, old) +#define trace_kvm_ple_window_changed(vcpu, new, old) \ + do { \ + if (old != new) \ + trace_kvm_ple_window(vcpu, new, old); \ + } while (0) TRACE_EVENT(kvm_pvclock_update, TP_PROTO(unsigned int vcpu_id, struct pvclock_vcpu_time_info *pvclock), diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index d98eac371c0a..cc1f98130e6a 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5214,7 +5214,7 @@ static void grow_ple_window(struct kvm_vcpu *vcpu) if (vmx->ple_window != old) vmx->ple_window_dirty = true; - trace_kvm_ple_window_grow(vcpu->vcpu_id, vmx->ple_window, old); + trace_kvm_ple_window_changed(vcpu->vcpu_id, vmx->ple_window, old); } static void shrink_ple_window(struct kvm_vcpu *vcpu) @@ -5229,7 +5229,7 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu) if (vmx->ple_window != old) vmx->ple_window_dirty = true; - trace_kvm_ple_window_shrink(vcpu->vcpu_id, vmx->ple_window, old); + trace_kvm_ple_window_changed(vcpu->vcpu_id, vmx->ple_window, old); } /*