Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp62549pxk; Tue, 15 Sep 2020 17:53:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMpPCg4Ae9UGZjgfYSDnIBRojnYI65g8z6Q89U1XF3jLF+0aJsvF5PcJoyw1IjFvhcPNBM X-Received: by 2002:a17:906:1b11:: with SMTP id o17mr24235554ejg.67.1600217638799; Tue, 15 Sep 2020 17:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600217638; cv=none; d=google.com; s=arc-20160816; b=alLGN2sF/UK/wkZ8dY4RBReqycj/3zfpv5KMfp/qqd6gnRYc8i83D+BlxnOgmc3dIk KMu7jaIiGbhwUtKZ8MwFarIhZNfGSFiwqm0Y22B4v6rJVvlPbAh/+qUmu/+mMtAvlwzh wZ4T7wGQHSBVP8nKH2cJQFDOV7MXczOSNvE21cjfGXSlj3HtaN0uRdjR5r9lB+q+jl5l YORcRA74VNo1WH2zYUpw5eAzPAOiBtEMd+kMS0x+3DvaYrMisu5IgNJqTGrx24oGyQ+h 96YcQj4NvIc1bRovz6QWRxf0+oXVbMTBtmAXD00B03wwnICdZ4pINKgmmSnLDoRd2rYN HnCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=iZZZ3oSdKZd9z2ofzkCYRtX+OtJdA4mv0c01rJrSths=; b=uxNdYM8GCXrkQCWGbQh7tpjwU+tnPsYIxjLkaNbcQVJK81+1KlXYM4qwdsnQP0QmcH 74aYSAzwgLnlyb3JKgbEDYgxH2b8SbfEqbznU0w3jHMWHrgf8D3xcGA8MRk0xyu3hw+j af2Jklge6nadJUb1HmAO3nNi30YKt0nHXjSY4qideXIiudVtYUMZln5OAJypagirQzEk dmzoQfyfOt7cpded186fr2qDCg7JcdA2aeH6L2Omm0KqBJhSzmGTgP7nlFgOL1h+/Iuy fAFNLzi60JlkHSX8htU4stomJBvLlbJ73pGnJRwwjf3QI9A4F1WYlVkYoocRaov3QA6g LUkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jv8dD33s; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si10221390ejm.474.2020.09.15.17.53.35; Tue, 15 Sep 2020 17:53:58 -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=@gmail.com header.s=20161025 header.b=jv8dD33s; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbgIPAxB (ORCPT + 99 others); Tue, 15 Sep 2020 20:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726353AbgIOLdB (ORCPT ); Tue, 15 Sep 2020 07:33:01 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB110C0611C2; Tue, 15 Sep 2020 04:29:50 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id s65so1860651pgb.0; Tue, 15 Sep 2020 04:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=iZZZ3oSdKZd9z2ofzkCYRtX+OtJdA4mv0c01rJrSths=; b=jv8dD33sRnwy+w6PG//UZu01nl7dRKAtLflNirCAenTBNs0zJWHtuC0XeNZBTjcY9B B3pFVdc52HjZs14t8b3NV/mdEVzXjchN8eO9pNCieA9y6z9kKN/w0x36N743cpwPcY/E Jg4p7UlSe2LjP2wsDHRQX/k/L+LgzFvSjxiHLPb8WOUvmkDKJwhMrv4509UrYQo+92GM Yu27jbA7liZaDr3mCWDn/2NMb2EUxUKE861m1Ev4bHsXhlFsEy8tlJ4wv7MUiQlW3i11 l+YekVbPJ7duGiQ3jnZOdTifuMfzx/M0ptzDV2C+SJasUgs6scSBb9R7bhX8VY5jb1ck DT/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iZZZ3oSdKZd9z2ofzkCYRtX+OtJdA4mv0c01rJrSths=; b=Lg0X+xx2L//x6BfuhOVxYWk/BAIM24VPw5ROdPTcWsAZKzME6dlibIbSwvPO95si0V WAq650buTjlKsLnzwuNpeL90f03/Tje4Rsnvi5N58GjRf6fQN/k1iyc3OsjgGNgfwJ+6 PviROsfTrJICLq5axE9cLHheQnedl+ttjMpnGwaWd1HGcHIZWKYdNhPqHQMePDUfKWrW LoY72/Ix/oZPRvIVx38RSe4l8voWWqMgg1AeGT/pUhC7b+CRY3YSqv8u3ZNR00C/dXp1 EbCT1sQlscusXyUno0SA5J+/p+mYFP2r1vm3l01+Av0tLAaXpwj/4gamY3fx8TacMJUE K2CA== X-Gm-Message-State: AOAM531J6ijCCupFyoXEGjTsjpS3uSjybpQlnpABjYgZUbvvyVX1Z0xx zIWVwpfToTLCG95bi2YgpQ== X-Received: by 2002:a63:594a:: with SMTP id j10mr13332327pgm.402.1600169390285; Tue, 15 Sep 2020 04:29:50 -0700 (PDT) Received: from [127.0.0.1] ([103.7.29.7]) by smtp.gmail.com with ESMTPSA id q24sm13295090pfs.206.2020.09.15.04.29.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Sep 2020 04:29:49 -0700 (PDT) Subject: Re: [PATCH] KVM: SVM: Analyze is_guest_mode() in svm_vcpu_run() To: Krish Sadhukhan , Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel References: <1600066548-4343-1-git-send-email-wanpengli@tencent.com> From: Haiwei Li Message-ID: <425468c9-15f0-9486-d317-fd25c38a714a@gmail.com> Date: Tue, 15 Sep 2020 19:29:39 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/9/15 04:43, Krish Sadhukhan wrote: > > On 9/13/20 11:55 PM, Wanpeng Li wrote: >> From: Wanpeng Li >> >> Analyze is_guest_mode() in svm_vcpu_run() instead of >> svm_exit_handlers_fastpath() >> in conformity with VMX version. >> >> Suggested-by: Vitaly Kuznetsov >> Signed-off-by: Wanpeng Li >> --- >>   arch/x86/kvm/svm/svm.c | 7 +++++-- >>   1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c >> index 3da5b2f..009035a 100644 >> --- a/arch/x86/kvm/svm/svm.c >> +++ b/arch/x86/kvm/svm/svm.c >> @@ -3393,8 +3393,7 @@ static void svm_cancel_injection(struct kvm_vcpu >> *vcpu) >>   static fastpath_t svm_exit_handlers_fastpath(struct kvm_vcpu *vcpu) >>   { >> -    if (!is_guest_mode(vcpu) && >> -        to_svm(vcpu)->vmcb->control.exit_code == SVM_EXIT_MSR && >> +    if (to_svm(vcpu)->vmcb->control.exit_code == SVM_EXIT_MSR && >>           to_svm(vcpu)->vmcb->control.exit_info_1) >>           return handle_fastpath_set_msr_irqoff(vcpu); >> @@ -3580,6 +3579,10 @@ static __no_kcsan fastpath_t >> svm_vcpu_run(struct kvm_vcpu *vcpu) >>           svm_handle_mce(svm); >>       svm_complete_interrupts(svm); >> + >> +    if (is_guest_mode(vcpu)) >> +        return EXIT_FASTPATH_NONE; >> + >>       exit_fastpath = svm_exit_handlers_fastpath(vcpu); >>       return exit_fastpath; > > Not related to your changes, but should we get rid of the variable > 'exit_fastpath' and just do, > >         return svm_exit_handler_fastpath(vcpu); > > It seems the variable isn't used anywhere else and svm_vcpu_run() > doesn't return from anywhere else either. > > Also, svm_exit_handlers_fastpath() doesn't have any other caller. Should > we get rid of it as well ? I will do this soon, thanks.