Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754622AbdGXNCo (ORCPT ); Mon, 24 Jul 2017 09:02:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38342 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbdGXNCi (ORCPT ); Mon, 24 Jul 2017 09:02:38 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E668F4A6E3 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E668F4A6E3 Subject: Re: [PATCH] KVM: nVMX: Fix exception injection To: Jim Mattson , Wanpeng Li Cc: "linux-kernel@vger.kernel.org" , kvm , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li References: <1496460115-12654-1-git-send-email-wanpeng.li@hotmail.com> <2ba5e53d-14f4-14a1-0084-a8b521a3ec3e@redhat.com> From: Paolo Bonzini Message-ID: Date: Mon, 24 Jul 2017 15:02:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 24 Jul 2017 13:02:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 836 Lines: 21 On 23/07/2017 03:11, Jim Mattson wrote: >>> In the situation you describe, the #PF causes a synthesized VM-exit >>> from L2 to L1 directly, not indirectly. From the SDM: >>> >>> An exception causes a VM exit directly if the bit corresponding to >>> that exception is set in the exception bitmap. >>> >>> Hence, CR2 should not be set yet. >> >> Any idea how to synthesize exit qualification for page fault and debug >> exception? > > I think the ancillary data for #DB and #PF should be added to > kvm_queued_exception and plumbed through to where it's needed. Vector > number and error code are not sufficient to describe a #DB or #PF. It's more complicated than that, because you'd have to copy it out to userspace in KVM_GET_VCPU_EVENTS. But I agree it's the way to go: CR2 and DR6 should be only by inject_pending_event. Paolo