Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4733195pxv; Tue, 6 Jul 2021 07:56:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoXiowedJAak+D845Ygap33v4eyfXdnFv7XPW0aum2sIP5xZV53RQSFY9ndvKWMSdkVi79 X-Received: by 2002:a6b:5b11:: with SMTP id v17mr16389488ioh.19.1625583395780; Tue, 06 Jul 2021 07:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625583395; cv=none; d=google.com; s=arc-20160816; b=wF9IijPNN2Ug0uBsxM3U/U8iXVZkA1aLOhxwYK3K7yr34/z2uTdH/kbi3P1T/KanRw m5r4/UAIXqhzPnybHaqvVvoumwJ+HdQvxYrqYtgz6t7dmHIr59D9zZrqqbZL/j8RjfCw q9G4p7Y1RkNRjXvvTfF8xU/BUVSpKZnFXCRGFhI0Fw2F1p6zcvn5tTofG2+1FGgBqSl1 lL+9DnaxwoEV3JypT3jxeHSC/BVgcZ4dZdrUXyS73fniFh6XyixJAR0/eajCAfV35Xti FRhNHltQSjYa/Jhu6uSroiWqwbn+aSeCBKbFA+A4SlK7vuWj67HNkrNctA4HHCB5JLOf zgwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=KuYfeHNoqBpl5N4HfNgkRzpz5JKHLkceTMnlQS9abyQ=; b=xH25PNsG5wNyXnjvfdK01M7rs+z4RS/D9U/jnjVEl8be2uRusWZi+3Ovb/Behzs4NQ vuK2G4ULKTeJepS7wapkCwdNHavLUfKiQPfzgTX+X9xg+tlj5pa+2arlonn2Zjuhgejf zMc/VZYlVcZv1XkNjSXBFZP+Or6mBsC7ecixjXNa2RwKsP2y6tRNJ/dTaIwATtchQBBQ VGpl9ZY85I93VznuxlRjnO5c1aea87cYdnj6ymwYzR6xORkFXymPAM+EEEz3j6EYK7U0 z+rs+h/Bq3iF2bWBkrv/bdcf3Eot7Hn9GCOuahr6NHp4KuZ83sCs2npXeKFrCGVUeeEE QBVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Fm/2iJmp"; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si18363962ilu.72.2021.07.06.07.56.23; Tue, 06 Jul 2021 07:56:35 -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=@redhat.com header.s=mimecast20190719 header.b="Fm/2iJmp"; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232428AbhGFO5k (ORCPT + 99 others); Tue, 6 Jul 2021 10:57:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37323 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231923AbhGFO5j (ORCPT ); Tue, 6 Jul 2021 10:57:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625583300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KuYfeHNoqBpl5N4HfNgkRzpz5JKHLkceTMnlQS9abyQ=; b=Fm/2iJmpU0guLpDmO0gxItAsZdf0QHu0UkGvb5BORtzv2+SdW2tVZvxn5dWGjdna0ucGcw f7d4WuA8Y+LEyKYV2zjy8YYX8vhH4ygXORooY/1qda1PM6ZFzU9Ula/zOb8pupo3SA3Pne MRmH55Hnq1POLzA6K1TMWonTYUL3yHY= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-1OEev25JOa2njeJsKyZsSA-1; Tue, 06 Jul 2021 10:54:59 -0400 X-MC-Unique: 1OEev25JOa2njeJsKyZsSA-1 Received: by mail-ej1-f70.google.com with SMTP id p5-20020a17090653c5b02903db1cfa514dso5915992ejo.13 for ; Tue, 06 Jul 2021 07:54:59 -0700 (PDT) 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=KuYfeHNoqBpl5N4HfNgkRzpz5JKHLkceTMnlQS9abyQ=; b=ZXDPWvSZdd2Dq9VArOqyFiAF+FnOYZPGtab2Qxq7bile69hP+nJYXiHN3xisqWWv9Y Lk1A7wp7KEHnk9mJTPQsAQipOZ0H+Iuwt4J6O46oJkFAtvZUKYzc409V43LMOPDyEE24 nuPFftFQuJE0+7YIpYSrWVtAHuoEiJJWLtTseKPnN0Cxm9ddrt1WmaoIlkMOe8tDlGjQ cCPZV7zqwK+DCV/UXAxEddjlaXPnkIckBCpWuDBvuwE0307Pot+LmvdoNPb3wfxTZ77o Ib+8q8T7ZgNeCZYXniTN+I/To+tl5d7vmL/FBFphAjIfKtKmLWpTRfL7gmy5nEDXmOSt wdiA== X-Gm-Message-State: AOAM531ti7NtmlwH4VRx15UvGC5udgY8sYGobo4JUD/g6BAQjbvzDj4U oT4q66SkHbvOxptyJa7JP9Cur86qEUQhhyDFRgfCys8ks+IxtzY22cmaQT+pDFIo6MuXFkuHR34 dDSyQQMJS/2YLTswA21hwYt66 X-Received: by 2002:a17:907:2d0e:: with SMTP id gs14mr19653261ejc.49.1625583298178; Tue, 06 Jul 2021 07:54:58 -0700 (PDT) X-Received: by 2002:a17:907:2d0e:: with SMTP id gs14mr19653246ejc.49.1625583298025; Tue, 06 Jul 2021 07:54:58 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id w13sm7240116edd.66.2021.07.06.07.54.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 07:54:57 -0700 (PDT) Subject: Re: [RFC PATCH v2 42/69] KVM: x86/mmu: Explicitly check for MMIO spte in fast page fault To: isaku.yamahata@intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@gmail.com, Sean Christopherson References: <26005d563a9303ecc6ca68a9baea77895a75e8e0.1625186503.git.isaku.yamahata@intel.com> From: Paolo Bonzini Message-ID: <534e7bb1-6e81-f1de-3d78-022449ac5a1e@redhat.com> Date: Tue, 6 Jul 2021 16:54:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <26005d563a9303ecc6ca68a9baea77895a75e8e0.1625186503.git.isaku.yamahata@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/21 00:04, isaku.yamahata@intel.com wrote: > From: Sean Christopherson > > Explicity check for an MMIO spte in the fast page fault flow. TDX will > use a not-present entry for MMIO sptes, which can be mistaken for an > access-tracked spte since both have SPTE_SPECIAL_MASK set. > > Signed-off-by: Sean Christopherson > Signed-off-by: Isaku Yamahata > --- > arch/x86/kvm/mmu/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index 990ee645b8a2..631b92e6e9ba 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -3060,7 +3060,7 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, > break; > > sp = sptep_to_sp(iterator.sptep); > - if (!is_last_spte(spte, sp->role.level)) > + if (!is_last_spte(spte, sp->role.level) || is_mmio_spte(spte)) > break; > > /* > Reviewed-by: Paolo Bonzini