Received: by 10.223.176.46 with SMTP id f43csp2432966wra; Thu, 25 Jan 2018 09:45:56 -0800 (PST) X-Google-Smtp-Source: AH8x225OuM0D/a0w9QIxE9dYwmUedr1wIKxuPmWb3Po2UPp15Y45jUeO8BiQxXzM+4pTLgZ+ykY4 X-Received: by 2002:a17:902:c01:: with SMTP id 1-v6mr11499948pls.55.1516902356810; Thu, 25 Jan 2018 09:45:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516902356; cv=none; d=google.com; s=arc-20160816; b=N8pMX8ZOqRvKlS3CAb6podSKucWspsyhFIBfaoBjMLXOe5adhLwdjLjQiNAOPTGWtW WQaNpaJ8Vb1qMdQ1wwT/5LeU2xajnGvs1dayH86ip5QGSrtIqSapGHgiVFe1l/KlL4BO oPf+D3h1TORe+mF+ub5oplmM1Wj++Kipq+A02bVhTLyJPOKlG9hm3eCZxk1ZFarzI7gk cmXsy3mvGXdkVtavmtuzz9QPMTnAQWqRpNw8D/uBrzUXNpd/w4X/mW7t4m6o6o/R/GTX wNxRg6f8RiLrOR+1JOaLYcElQz4aE72i6FsVhRp905MiFLWs62kIH/KPM6VNED5cuxXO YOAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=vtaWdANH+N0eYAwDhkmjUtzVpPjZWYV+mEN2cBRIOBY=; b=zbeW+BfSda8CbE8UsASBzoBdwTQbcv9fxMlVrIZIAfC3kQreWv/aAR4n+gRICpf1Fl eZT5o05wGDuPkNlvwoAeIWgJNSyFW2piwYLzxDDttuGKQLucNKIsbujxYiIDF4dV8KA7 /6Nn9g8xtCYYY+mxdY9UMTdzBas4uYmpeG0e7qoQVN3QFN5S50toXi3A8G1bxICSS4da f4yKOCu4OjmhEEmjCU9z53zKhwCQpvaobrmh4mitedVzKmNtYCZS1smiQRXTk8P69cSF 0S5Cc/sO7S/kMI00W+RPnaOE7NSfUlgX963RnRRQvfQPrefEdQxtPUegLRTQGxat+OJs s49g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si1800656pgp.297.2018.01.25.09.45.42; Thu, 25 Jan 2018 09:45:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751256AbeAYRof (ORCPT + 99 others); Thu, 25 Jan 2018 12:44:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46524 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106AbeAYRoe (ORCPT ); Thu, 25 Jan 2018 12:44:34 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CDB2C01CB8A; Thu, 25 Jan 2018 17:44:34 +0000 (UTC) Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id 67DD0600D1; Thu, 25 Jan 2018 17:44:29 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Thu, 25 Jan 2018 18:44:22 +0100 Date: Thu, 25 Jan 2018 18:44:22 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: "Michael S. Tsirkin" Cc: Vitaly Kuznetsov , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Liran Alon , Jason Wang Subject: Re: [PATCH v2] x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested Message-ID: <20180125174421.GB23362@flask> References: <20180125153707.29981-1-vkuznets@redhat.com> <20180125191239-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180125191239-mutt-send-email-mst@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 25 Jan 2018 17:44:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-01-25 19:16+0200, Michael S. Tsirkin: > On Thu, Jan 25, 2018 at 04:37:07PM +0100, Vitaly Kuznetsov wrote: > > I was investigating an issue with seabios >= 1.10 which stopped working > > for nested KVM on Hyper-V. The problem appears to be in > > handle_ept_violation() function: when we do fast mmio we need to skip > > the instruction so we do kvm_skip_emulated_instruction(). This, however, > > depends on VM_EXIT_INSTRUCTION_LEN field being set correctly in VMCS. > > However, this is not the case. > > > > Intel's manual doesn't mandate VM_EXIT_INSTRUCTION_LEN to be set when > > EPT MISCONFIG occurs. While on real hardware it was observed to be set, > > some hypervisors follow the spec and don't set it; we end up advancing > > IP with some random value. > > > > I checked with Microsoft and they confirmed they don't fill > > VM_EXIT_INSTRUCTION_LEN on EPT MISCONFIG. > > > > Fix the issue by doing instruction skip through emulator when running > > nested. > > > > Fixes: 68c3b4d1676d870f0453c31d5a52e7e65c7448ae > > Suggested-by: Radim Krčmář > > Suggested-by: Paolo Bonzini > > Signed-off-by: Vitaly Kuznetsov > > I would maybe also disable this when this is a kvm host > running a nested *guest*, just in case. You mean to keep the fast path when running on KVM hypervisor? (We already skip the path for nested guests.) I'd prefer not to make this any uglier. > Acked-by: Michael S. Tsirkin > > > --- > > v1 -> v2: > > inlay X86_FEATURE_HYPERVISOR case with EMULTYPE_SKIP optimization > > [Paolo Bonzini, Radim Krčmář] Queued, thanks.