Message ID | 20241010182427.1434605-48-seanjc@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD8F7D24442 for <linux-arm-kernel@archiver.kernel.org>; Thu, 10 Oct 2024 20:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l4aL9ye2ZxrCnqTpLqQlinT65BUul16gfmDzid4NN5Y=; b=hanppG4DX6sTAw XvCJUWWPDlP1xBw4xNL39LFtBVn4JbcnxDp7mR9iY/3AWGcYnQgSOxhNUHryGeI5AefyqychkCNlv N3UdhsMFRBtD+8qJefH/8M303x+erCEQh40qvb44zN+4UHOkAld75qB54gonUBpmhTby8KrLMjB3b TlkX8cKAxo7lSNMTjTzPf6Ar90GoHvZ48Ql4hszbVsja3svDpD6nu8RMajvF4Gyeus+hPHMiAuh7+ g7MNQmg1wJrmnRv08P3ZYjQQjgmQrOD4spq4IwtnYU1qTfcYx6ESrw0HrsrNPj5xeswSK+TElP58k K4jTomYXc2UtzwYt4ZcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syzZV-0000000EFNL-3cyP; Thu, 10 Oct 2024 20:15:41 +0000 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syxrs-0000000DquX-3stc for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 18:26:34 +0000 Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-71dff575924so1543448b3a.1 for <linux-arm-kernel@lists.infradead.org>; Thu, 10 Oct 2024 11:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728584792; x=1729189592; darn=lists.infradead.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:from:to:cc:subject:date :message-id:reply-to; bh=l4aL9ye2ZxrCnqTpLqQlinT65BUul16gfmDzid4NN5Y=; b=4NJxd+23djSQD5IrKrOM7+QBFAb+zUEzLAelhcpuCsN/jNgk8WGR2zJ21WF08csT9V yhMLGsZmfSz963iR9mrnBU4cwLKvwl5BPrO7GoCUIghqK86NVrPcw9z4snYKKkabblTO z/jBEzoAkqypTekJV+lLgO+n/EPna95q8QOQmqUodoUob08Ymw8w1UizJ3J5xwCC3ymz wTklvrSW+SKTZSOpfYN6lllfuRcZhijDV7ltjf7exYNEDFDq4/QVOcZQfFIaQqokMloc 9m29lmfaoY7ZsvkPtfUGCgdPTiTz7Ji2mxd/cOFOBuo50KHj5VvP2JR6hGeFnLweMZll 9c8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728584792; x=1729189592; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=l4aL9ye2ZxrCnqTpLqQlinT65BUul16gfmDzid4NN5Y=; b=jsThcBy2TDF+ZaxI3REM7ukrI76CH01Yqe4wLrt1E2TktGwC5N7oI9cAfdXOZsyqlm 3k1nbu1r3oSJ2Vdt0fUnkOGS8CN+tzeAYeUfznwZuBklMkOUUj83o6F/m7GBlMfUag6I rQrATVTd0fpZpm8AvJJfyhFM45S85ewA4tpeC96cyF8j3yL480wnikTdJy2d6U8bMvOI nyT+2Kuhqx0bmQ1WmE8u6Jr3HayH8+Uv//9rkPc10wKLhdprQuqWeBhdp8cU1Nv3n3d/ PhKQ5IC56ueyVhtBoAyIx/l0Di34i2SEyo6MyGSg28AO+eFTSrmza0Au7L9o8Z/H+oAN wDNw== X-Forwarded-Encrypted: i=1; AJvYcCWKefpZjrethw6tzbwjJENhVk1Htw/MA+ssdaVcDiI4OLMiCtlSkgiy9nXLLnxSdmYQdNtZinyLcmsK6jvYy+3T@lists.infradead.org X-Gm-Message-State: AOJu0YyJd5gngOOKZz41LLGpoJ1Nwqwc87z2iJhUExLehDMhBv+/Lzm9 Zp98zw9mIIbmxPL5r+NGSIcSVfDIU/SmJ5byzQtVhrspQkPYjyOi63jZW+FveIyp6fleDIBv02w +Ng== X-Google-Smtp-Source: AGHT+IFunsAHL0GYDEyxrwNnSExkBiXOv88aJkEgjVxw5ZDXOBsEr4Eha3ByEK4QIBQ4extfr7SnAz+Fl/s= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:aa7:9184:0:b0:71d:f7c9:8cb3 with SMTP id d2e1a72fcca58-71e1dbf1ab5mr7799b3a.5.1728584790633; Thu, 10 Oct 2024 11:26:30 -0700 (PDT) Date: Thu, 10 Oct 2024 11:23:49 -0700 In-Reply-To: <20241010182427.1434605-1-seanjc@google.com> Mime-Version: 1.0 References: <20241010182427.1434605-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241010182427.1434605-48-seanjc@google.com> Subject: [PATCH v13 47/85] KVM: x86/mmu: Put refcounted pages instead of blindly releasing pfns From: Sean Christopherson <seanjc@google.com> To: Paolo Bonzini <pbonzini@redhat.com>, Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, Tianrui Zhao <zhaotianrui@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Huacai Chen <chenhuacai@kernel.org>, Michael Ellerman <mpe@ellerman.id.au>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Christian Borntraeger <borntraeger@linux.ibm.com>, Janosch Frank <frankja@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Sean Christopherson <seanjc@google.com> Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, " =?utf-8?q?Alex_Benn=C3=A9e?= " <alex.bennee@linaro.org>, Yan Zhao <yan.y.zhao@intel.com>, David Matlack <dmatlack@google.com>, David Stevens <stevensd@chromium.org>, Andrew Jones <ajones@ventanamicro.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_112633_110419_1EAF8A4F X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Reply-To: Sean Christopherson <seanjc@google.com> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KVM: Stop grabbing references to PFNMAP'd pages
|
expand
|
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index a038cde74f0d..f9b7e3a7370f 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4373,6 +4373,9 @@ static void kvm_mmu_finish_page_fault(struct kvm_vcpu *vcpu, lockdep_assert_once(lockdep_is_held(&vcpu->kvm->mmu_lock) || r == RET_PF_RETRY); + if (!fault->refcounted_page) + return; + /* * If the page that KVM got from the *primary MMU* is writable, and KVM * installed or reused a SPTE, mark the page/folio dirty. Note, this @@ -4384,9 +4387,9 @@ static void kvm_mmu_finish_page_fault(struct kvm_vcpu *vcpu, * folio dirty if KVM could locklessly make the SPTE writable. */ if (!fault->map_writable || r == RET_PF_RETRY) - kvm_release_pfn_clean(fault->pfn); + kvm_release_page_clean(fault->refcounted_page); else - kvm_release_pfn_dirty(fault->pfn); + kvm_release_page_dirty(fault->refcounted_page); } static int kvm_mmu_faultin_pfn_private(struct kvm_vcpu *vcpu,