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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3656C433FF for ; Fri, 9 Aug 2019 18:37:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8CF22166E for ; Fri, 9 Aug 2019 18:37:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436927AbfHIShb (ORCPT ); Fri, 9 Aug 2019 14:37:31 -0400 Received: from mga04.intel.com ([192.55.52.120]:7513 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436899AbfHIShb (ORCPT ); Fri, 9 Aug 2019 14:37:31 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 11:37:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,366,1559545200"; d="scan'208";a="374571640" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by fmsmga005.fm.intel.com with ESMTP; 09 Aug 2019 11:37:30 -0700 Date: Fri, 9 Aug 2019 11:37:30 -0700 From: Sean Christopherson To: Vitaly Kuznetsov Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Joerg Roedel , Jim Mattson Subject: Re: [PATCH v3 5/7] x86: KVM: svm: remove hardcoded instruction length from intercepts Message-ID: <20190809183730.GE10541@linux.intel.com> References: <20190808173051.6359-1-vkuznets@redhat.com> <20190808173051.6359-6-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190808173051.6359-6-vkuznets@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, Aug 08, 2019 at 07:30:49PM +0200, Vitaly Kuznetsov wrote: > Various intercepts hard-code the respective instruction lengths to optimize > skip_emulated_instruction(): when next_rip is pre-set we skip > kvm_emulate_instruction(vcpu, EMULTYPE_SKIP). The optimization is, however, > incorrect: different (redundant) prefixes could be used to enlarge the > instruction. We can't really avoid decoding. > > svm->next_rip is not used when CPU supports 'nrips' (X86_FEATURE_NRIPS) > feature: next RIP is provided in VMCB. The feature is not really new > (Opteron G3s had it already) and the change should have zero affect. > > Remove manual svm->next_rip setting with hard-coded instruction lengths. > The only case where we now use svm->next_rip is EXIT_IOIO: the instruction > length is provided to us by hardware. > > Hardcoded RIP advancement remains in vmrun_interception(), this is going to > be taken care of separately. > > Reported-by: Jim Mattson > Signed-off-by: Vitaly Kuznetsov > --- Reviewed-by: Sean Christopherson