Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1849338lqo; Sun, 12 May 2024 23:15:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAWweb7v8kmad3esjgMx45cruzzIcsngvg0oYynHSbc5qF/22bKfHSiqzc+UGZz/EJMBe6TvODz57CthThd8SZRjBdXXjTdFlny2fMWg== X-Google-Smtp-Source: AGHT+IHu1s5WGUJ61KZ/yQ1iDE0kcnhBsnHHFNY3UUc3L+CdZQsQLJ5w/72MML/3+2J9L/1PoBsu X-Received: by 2002:a50:d64a:0:b0:573:1ebd:d670 with SMTP id 4fb4d7f45d1cf-5734d5c204dmr8362115a12.3.1715580925959; Sun, 12 May 2024 23:15:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715580925; cv=pass; d=google.com; s=arc-20160816; b=RFCIMtWJR3P8HHe3Fy70Rwrm7vMa82bp/qokn3KLV4k+k3xpjePiUDoHymc98qj9wX 75qcpHqKIFWh/Fdyy6Oncdg/3U3b1+rAci93ahnZC9GrC1wKl4ZGXhBB8SuDqqV390Sq tFiARScCLNufM408qMme1NAQImMkaeA5s687fa4yyGJMQOFy+MPrp8KW1OdUHHz+Q1+d gyN8grY3TKK7fSsPrMFQ08znBLesoJXajYuES5oaXmC7L71oRZ6fIUmhL2iPlWLAr86O wMtxlmHQzeHHRXC4sGL9XIADOIBRlX411Dv072ExdEeDk/2Bb2FU6TWtY8lR16ielGDM qmHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=ZxJPts5OV7fy/12A6p02qAjAWg4l9Iq29/azj4N9MIU=; fh=KuyjcLwM7s56N7UJ3mzp+7oCUKBbw1pRdRameoWhvV8=; b=jK7kPIGF/q3LHYtKrYLtJdTXOtuz6dq/CwMg5pZmRMqbp/DUWK5XaaJ/2SxYlTdQ+b Y2YbfhtomZLOKVCNiC7BOIC5izTooxjoFO97cx+QEWdam8icB6ol6+n8XB259oIkFrIm y2E0717zEU7kgUilHwyV8tuj6kNvr36qk1VfKYQtS5e+dFgMpLd+72t8kuf28q0uzuhN j2Y8XKUhQq3QYRrP6g+99u859Zl4eJVr5g6cxw4uWoHRI9R5DrBeArBAc7CAPlGdsJrU Jyn/G/v8YL/p8AaiVJaDirBJb2haIg8iw5GZhvhe5RhJZJLMqj18BgA63TBufbWjzWEw LotQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JjSwS+fp; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-177189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177189-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57443d295b7si2420237a12.469.2024.05.12.23.15.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 23:15:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JjSwS+fp; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-177189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177189-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9FBFD1F21483 for ; Mon, 13 May 2024 06:15:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21D6A1465A8; Mon, 13 May 2024 06:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JjSwS+fp" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B880F4F8BB; Mon, 13 May 2024 06:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715580914; cv=none; b=gRUq67IMNEM6DOufuEfCJZA03skvL8ZaLjfCv8u7zpPLjx4+ojG5gVj67AICmrqm2c6YjgR8aFneH3R5u6hr4FuCKedmzzl97c7twtN9J9/FxDsIz5fhLuwgrEzSiUJgl4Q256Hc5cf3Ajnva0lK9P6CUDSsX8aoaczpf0zMQwc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715580914; c=relaxed/simple; bh=woyyRJfWwQY/0iUy76I+OrfK6KoO5Lu5JSyjFFCPgcc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BaNdz2vhxe9sQSHQt61v1bYyk9SFIIppMNH7UhOw113GlDHaXkDUft13aqLhPcx4wMFWYObxXBjmI5PpnZgKLaW2OYRhIBWGuiQJF0RSAsQYM9Ct0mNmjlX7NqW/3pGDUp+py5Zx/Nm+g7ZlVQfMP1Gn1rwB/QdjuiibqCiDvbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JjSwS+fp; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715580913; x=1747116913; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=woyyRJfWwQY/0iUy76I+OrfK6KoO5Lu5JSyjFFCPgcc=; b=JjSwS+fp82yCBHyns4wzN5Q+wtiLPmO1l6Mn9UapLkElUKFARG/GrgGt 9wi3XBzhGAmepgN655X3thJxpTgGkj2muzivRbTAxox47bm+SV9gbOBAM z4BIG59HwYQ/qe3LH7drHYcnH4dH4APNjOoIXRhlJpQbeFQKhavEbTtWg ATwegxlqL9g0HonsyYyBuSLGDUKt+tuW+XFwqdQ4of8PqtmZ3BvTiDspe K89SxM7ldx18voWv5cqTk9NtKSyqWt4oQJHIhWOL+qOUOYDulRfmGhdj4 qriz/z2ms9IcB1NU51E0h+aNpeJSr11zKIM9AwiluG4LgFFsBRZEzzhCO A==; X-CSE-ConnectionGUID: 9evSE74KQFyJpuoUHjKa5Q== X-CSE-MsgGUID: 6Qs2zrqvRDOT1gmZGWxKIQ== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="15308936" X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208";a="15308936" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 23:15:11 -0700 X-CSE-ConnectionGUID: yfZe7SxYTO6ZXljKDKTpMg== X-CSE-MsgGUID: UrTSZ0MMSA+mWEOgBSmzDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208";a="30794151" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.125.243.198]) ([10.125.243.198]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 23:15:09 -0700 Message-ID: <4ec14e43-5497-4ce1-aae0-6d81e4d16e65@intel.com> Date: Mon, 13 May 2024 14:15:07 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 09/17] KVM: x86/mmu: WARN and skip MMIO cache on private, reserved page faults To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson References: <20240507155817.3951344-1-pbonzini@redhat.com> <20240507155817.3951344-10-pbonzini@redhat.com> Content-Language: en-US From: Xiaoyao Li In-Reply-To: <20240507155817.3951344-10-pbonzini@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/7/2024 11:58 PM, Paolo Bonzini wrote: > From: Sean Christopherson > > WARN and skip the emulated MMIO fastpath if a private, reserved page fault > is encountered, as private+reserved should be an impossible combination > (KVM should never create an MMIO SPTE for a private access). > > Signed-off-by: Sean Christopherson > Message-ID: <20240228024147.41573-9-seanjc@google.com> > Signed-off-by: Paolo Bonzini Reviewed-by: Xiaoyao Li > --- > arch/x86/kvm/mmu/mmu.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index d52794663290..0d884d0b0f35 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -5819,6 +5819,9 @@ int noinline kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u64 err > > r = RET_PF_INVALID; > if (unlikely(error_code & PFERR_RSVD_MASK)) { > + if (WARN_ON_ONCE(error_code & PFERR_PRIVATE_ACCESS)) > + return -EFAULT; > + > r = handle_mmio_page_fault(vcpu, cr2_or_gpa, direct); > if (r == RET_PF_EMULATE) > goto emulate;