Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6730262pxv; Fri, 30 Jul 2021 00:31:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZOxoOWA+ThrozmditB0tmzkla+4JR0wU1ShacYTLd1GM2SJgjwl6aNgHArYThzKz5wQS+ X-Received: by 2002:a92:c24c:: with SMTP id k12mr989331ilo.28.1627630279540; Fri, 30 Jul 2021 00:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627630279; cv=none; d=google.com; s=arc-20160816; b=xQFn6uYmez48EMoxO/wvEoXa81Pm38Y54HXL7tmEcSQAx8L5NGbdOFAMLYrOVPUP+R XjlwQLTsuuOcUeDSTBKyoPf+SkMjS6rIzlyDJwsagbHUH0yKjmh64Q2mry2fbWplWfyW tKxP/U9v/sh70FMPEa+VfJqZqZIL61R9UBPYVRRJciKbPF0OopwLNIABItnqLVFbNX2c GNWVWdVGM8eImdYfPplttzVBziU7n2NRDSYTJrjbqso+YhoOLyKGtkodYoHiDiMl7Ujl ioJTVz0ACTNIrTy8nMefG16WDxF8x8Ka2LAZD4xweE2m75oPiaPDLaV/eJdPThTYhWZv 95ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:from:references :in-reply-to:subject:cc:to:dkim-signature; bh=dEzoO3e5Gf3/WxsXdgCVKNFItf3m4OWNnkjH5aZyCb8=; b=UWzOnLujge3+qjticKhqDn+6rizgjxAgEBytgZgfw3zpkjwKWcCte2JNxIEGChUxYk aW614C9KSa81cxgdeXyYWjsO13x/A5trCloWgs57u5nZwZ7QandyvBMdBf8MqPtv+d1b Z5ZBQqFo2z6VLXh4tULTN2Twk7L1HMANeHiM5XQXXdPNJnImRLjrKqn49QELInoDqWui HvZuOlKfoBGt2ADMHB45ZgD6Vi6TQMe5+tBmaA7nmM7QkCnHOIK1+/B6Wwy7o4qrTBlw xjwnKt8GZ33tunrmsLKKVquHfffrsA/bebFibewb1ovjE1MhTqcQTmDS1iVAdzms74Ph FQ0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TGFFDRvq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l2si807972jak.30.2021.07.30.00.31.08; Fri, 30 Jul 2021 00:31:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TGFFDRvq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237630AbhG3HaG (ORCPT + 99 others); Fri, 30 Jul 2021 03:30:06 -0400 Received: from wforward1-smtp.messagingengine.com ([64.147.123.30]:33407 "EHLO wforward1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbhG3HaF (ORCPT ); Fri, 30 Jul 2021 03:30:05 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailforward.west.internal (Postfix) with ESMTP id CB48D1AC0033; Fri, 30 Jul 2021 03:29:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 30 Jul 2021 03:29:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=dEzoO3 e5Gf3/WxsXdgCVKNFItf3m4OWNnkjH5aZyCb8=; b=TGFFDRvqsUHtG8TmZTiDri TRx628qViMWRHtLWzvUBrH6qQu7HAOVWfCv8bMiXj/U2KIPmBfclXIuBc3DvvGbs wY7zLPy0f34Q7IZ0DjLTVv4FTwSrl+KStZoKOzJZHjVwD1BHZc8AcaBs85jSXThc v5f0oniZOrFxBMcFYD9nbJdXoM14CPwo1CGKDbK0Fen63pPg5dpXnvhZJ++ezgcQ /NPgxegdbEUwD+XKL1U6AmPPaJcOo2esL5Tuyq/sPhvgk4t0R675fYcZvYyoFDWS IqMhVUSuqECyH48mDeOtlUgHdIHpk/oGTr4dFdwCe+Y8aPgz4JFkn9fmd6f65deg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrheeggddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepvffujghfhfffkfggtgesthdtredttddttdenucfhrhhomhepffgrvhhiugcu gfgumhhonhgushhonhcuoegumhgvsegumhgvrdhorhhgqeenucggtffrrghtthgvrhhnpe fhkeeguedtvdegffffteehjedvjeeitefgfefgffdugeffffegudehgeetgeelkeenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhgvsegumh gvrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 30 Jul 2021 03:29:54 -0400 (EDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 26d30f0b; Fri, 30 Jul 2021 07:29:53 +0000 (UTC) To: Sean Christopherson Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Joerg Roedel , Ingo Molnar , Jim Mattson , kvm@vger.kernel.org, Borislav Petkov , David Matlack , Paolo Bonzini , "H. Peter Anvin" , x86@kernel.org, Wanpeng Li , Vitaly Kuznetsov Subject: Re: [PATCH v3 1/3] KVM: x86: kvm_x86_ops.get_exit_info should include the exit reason In-Reply-To: References: <20210729133931.1129696-1-david.edmondson@oracle.com> <20210729133931.1129696-2-david.edmondson@oracle.com> From: David Edmondson Date: Fri, 30 Jul 2021 08:29:53 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, 2021-07-29 at 22:27:28 GMT, Sean Christopherson wrote: > Shortlog is a bit odd, "should" is subjective and makes this sound like a bug fix. > > KVM: x86: Get exit_reason as part of kvm_x86_ops.get_exit_info Okay. > On Thu, Jul 29, 2021, David Edmondson wrote: >> Extend the get_exit_info static call to provide the reason for the VM >> exit. Modify relevant trace points to use this rather than extracting >> the reason in the caller. >> >> Signed-off-by: David Edmondson >> --- >> -static void svm_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2, >> +static void svm_get_exit_info(struct kvm_vcpu *vcpu, u64 *reason, >> + u64 *info1, u64 *info2, >> u32 *intr_info, u32 *error_code) >> { >> struct vmcb_control_area *control = &to_svm(vcpu)->vmcb->control; >> >> + *reason = control->exit_code; >> *info1 = control->exit_info_1; >> *info2 = control->exit_info_2; >> *intr_info = control->exit_int_info; > > ... > >> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h >> index b484141ea15b..2228565beda2 100644 >> --- a/arch/x86/kvm/trace.h >> +++ b/arch/x86/kvm/trace.h >> @@ -273,11 +273,11 @@ TRACE_EVENT(kvm_apic, >> >> #define TRACE_EVENT_KVM_EXIT(name) \ >> TRACE_EVENT(name, \ >> - TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa), \ >> - TP_ARGS(exit_reason, vcpu, isa), \ >> + TP_PROTO(struct kvm_vcpu *vcpu, u32 isa), \ >> + TP_ARGS(vcpu, isa), \ >> \ >> TP_STRUCT__entry( \ >> - __field( unsigned int, exit_reason ) \ >> + __field( u64, exit_reason ) \ > > Converting to a u64 is unnecessary and misleading. vmcs.EXIT_REASON and > vmcb.EXIT_CODE are both u32s, a.k.a. unsigned ints. There is vmcb.EXIT_CODE_HI, > but that's not being included, and AFAICT isn't even sanity checked by KVM. Thanks for pointing this out, I can only blame brain fade. >> __field( unsigned long, guest_rip ) \ >> __field( u32, isa ) \ >> __field( u64, info1 ) \