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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 42B76C433E0 for ; Sat, 16 May 2020 13:53:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 239D420756 for ; Sat, 16 May 2020 13:53:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ki+IypXF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbgEPNxW (ORCPT ); Sat, 16 May 2020 09:53:22 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55743 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726703AbgEPNxV (ORCPT ); Sat, 16 May 2020 09:53:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589637200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=FF/ooaDDfU4o/ecS6s5UdO9199Vv4g2oaCID5N2AiVg=; b=Ki+IypXF87U7BqPQAlFL5peVQzMZIQ+7mPISUJW1Yq8iFtOlJhbxc46ROZtHiH0m3qVLCw KBQWc8wC+UxbKHReGc6fNazZ4QYHIIeEIyq+6zK3JCzm/01dNBdcTeQhcrduJWETRZgpaH 7Py4C2Cb/umamUQpEImTbXdppUVwjww= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-MBor5CpnOA-WkrEwIEn2Rg-1; Sat, 16 May 2020 09:53:16 -0400 X-MC-Unique: MBor5CpnOA-WkrEwIEn2Rg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE81E80183C; Sat, 16 May 2020 13:53:15 +0000 (UTC) Received: from virtlab511.virt.lab.eng.bos.redhat.com (virtlab511.virt.lab.eng.bos.redhat.com [10.19.152.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FFEB5D9D3; Sat, 16 May 2020 13:53:15 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: peterx@redhat.com Subject: [PATCH 1/4] KVM: nSVM: fix condition for filtering async PF Date: Sat, 16 May 2020 09:53:08 -0400 Message-Id: <20200516135311.704878-2-pbonzini@redhat.com> In-Reply-To: <20200516135311.704878-1-pbonzini@redhat.com> References: <20200516135311.704878-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Async page faults have to be trapped in the host (L1 in this case), since the APC reason was passed from L0 to L1 and stored in the L1 APF data page. This was completely reversed, as the page faults were passed to the guest (a L2 hypervisor). Signed-off-by: Paolo Bonzini --- arch/x86/kvm/svm/nested.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 44b09ae419cf..e98ce5f6d562 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -889,8 +889,8 @@ int nested_svm_exit_special(struct vcpu_svm *svm) return NESTED_EXIT_HOST; break; case SVM_EXIT_EXCP_BASE + PF_VECTOR: - /* When we're shadowing, trap PFs, but not async PF */ - if (!npt_enabled && svm->vcpu.arch.apf.host_apf_reason == 0) + /* Trap async PF even if not shadowing */ + if (!npt_enabled || svm->vcpu.arch.apf.host_apf_reason) return NESTED_EXIT_HOST; break; default: -- 2.18.2