From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90580C433FE for ; Mon, 4 Apr 2022 12:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241139AbiDDMQS (ORCPT ); Mon, 4 Apr 2022 08:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239813AbiDDMQP (ORCPT ); Mon, 4 Apr 2022 08:16:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB1982AFD for ; Mon, 4 Apr 2022 05:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649074458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k11A/AZt+oc87Hz3W5TrMPkcAHCJtsmjAAnrVjuNJG4=; b=XwFEBGAs8dV/OzbD9nK4UQjRs+pdoHdPXIR6UJfvWBy9v2UH7RTzYBmW0fEZeDPOMgbD5B jZclvpFLLm95NmEuiKBkttxZRnWsvOAN/eejgFPf4lS+rAfaNXCZWvshr9/3waI6s9PDJx 9tIhTu4AGRws4Cmw2rKV3efs3tI6G5o= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-674-MSaBRzuKOOCwVdKK93OiZQ-1; Mon, 04 Apr 2022 08:14:17 -0400 X-MC-Unique: MSaBRzuKOOCwVdKK93OiZQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C8F538035A2; Mon, 4 Apr 2022 12:14:11 +0000 (UTC) Received: from starship (unknown [10.40.194.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCA07202F2F1; Mon, 4 Apr 2022 12:14:03 +0000 (UTC) Message-ID: Subject: Re: [PATCH 7/8] KVM: x86: Trace re-injected exceptions From: Maxim Levitsky To: Sean Christopherson , Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "Maciej S . Szmigiero" Date: Mon, 04 Apr 2022 15:14:01 +0300 In-Reply-To: <20220402010903.727604-8-seanjc@google.com> References: <20220402010903.727604-1-seanjc@google.com> <20220402010903.727604-8-seanjc@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2022-04-02 at 01:09 +0000, Sean Christopherson wrote: > Trace exceptions that are re-injected, not just those that KVM is > injecting for the first time. Debugging re-injection bugs is painful > enough as is, not having visibility into what KVM is doing only makes > things worse. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/x86.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 7a066cf92692..384091600bc2 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -9382,6 +9382,10 @@ int kvm_check_nested_events(struct kvm_vcpu *vcpu) > > static void kvm_inject_exception(struct kvm_vcpu *vcpu) > { > + trace_kvm_inj_exception(vcpu->arch.exception.nr, > + vcpu->arch.exception.has_error_code, > + vcpu->arch.exception.error_code); > + Can we use a {new tracepoint / new parameter for this tracepoint} for this to avoid confusion? Best regards, Maxim Levitsky > if (vcpu->arch.exception.error_code && !is_protmode(vcpu)) > vcpu->arch.exception.error_code = false; > static_call(kvm_x86_queue_exception)(vcpu); > @@ -9439,10 +9443,6 @@ static int inject_pending_event(struct kvm_vcpu *vcpu, bool *req_immediate_exit) > > /* try to inject new event if pending */ > if (vcpu->arch.exception.pending) { > - trace_kvm_inj_exception(vcpu->arch.exception.nr, > - vcpu->arch.exception.has_error_code, > - vcpu->arch.exception.error_code); > - > vcpu->arch.exception.pending = false; > vcpu->arch.exception.injected = true; >