From patchwork Tue Dec 5 10:37:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 13479931 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GYBDrTy+" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 179901BF4 for ; Tue, 5 Dec 2023 02:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701772681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gK4jXLoCS0bqGNjgQzNnw64KFoSSKVngg1q4fCtnDfA=; b=GYBDrTy+9aRpk28D9tNI/jr1ZfWEg3cqEcC98JL9Nkj2muRdyArJnKgZDMHsFTvHzPxXpK wGmLUZOQOhl9cEN+dxWDLTsHryeTIcXiFPt8RE+biDnNdVu8dcRC+hine3RdcxgjMy69xs lhzZwJafJsaysiW9k+NHuahn5PirP1I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-pUCADUVKOrqcI-bkOCOCOQ-1; Tue, 05 Dec 2023 05:37:58 -0500 X-MC-Unique: pUCADUVKOrqcI-bkOCOCOQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BA6E85A589; Tue, 5 Dec 2023 10:37:57 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.225.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2217EC15E6A; Tue, 5 Dec 2023 10:37:54 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Sean Christopherson , Dave Hansen , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Borislav Petkov , Thomas Gleixner , "H. Peter Anvin" , Maxim Levitsky Subject: [PATCH v4 3/4] KVM: x86: add information about pending requests to kvm_exit tracepoint Date: Tue, 5 Dec 2023 12:37:44 +0200 Message-Id: <20231205103745.506724-4-mlevitsk@redhat.com> In-Reply-To: <20231205103745.506724-1-mlevitsk@redhat.com> References: <20231205103745.506724-1-mlevitsk@redhat.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 This allows to gather information on how often kvm interrupts vCPUs due to specific requests. Reviewed-by: Paolo Bonzini Signed-off-by: Maxim Levitsky --- arch/x86/kvm/trace.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 28e8a63368cc021..e275a02a21e5233 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -316,12 +316,14 @@ TRACE_EVENT(name, \ __field( u32, intr_info ) \ __field( u32, error_code ) \ __field( unsigned int, vcpu_id ) \ + __field( u64, requests ) \ ), \ \ TP_fast_assign( \ __entry->guest_rip = kvm_rip_read(vcpu); \ __entry->isa = isa; \ __entry->vcpu_id = vcpu->vcpu_id; \ + __entry->requests = READ_ONCE(vcpu->requests); \ static_call(kvm_x86_get_exit_info)(vcpu, \ &__entry->exit_reason, \ &__entry->info1, \ @@ -331,11 +333,13 @@ TRACE_EVENT(name, \ ), \ \ TP_printk("vcpu %u reason %s%s%s rip 0x%lx info1 0x%016llx " \ - "info2 0x%016llx intr_info 0x%08x error_code 0x%08x", \ + "info2 0x%016llx intr_info 0x%08x error_code 0x%08x " \ + "requests 0x%016llx", \ __entry->vcpu_id, \ kvm_print_exit_reason(__entry->exit_reason, __entry->isa), \ __entry->guest_rip, __entry->info1, __entry->info2, \ - __entry->intr_info, __entry->error_code) \ + __entry->intr_info, __entry->error_code, \ + __entry->requests) \ ) /*