Message ID | 20241010182427.1434605-76-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 D34A6D24456 for <linux-arm-kernel@archiver.kernel.org>; Thu, 10 Oct 2024 22:16:41 +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=fZpnWf51XalE5JTpUzeqj9xBy85lPuBTlHLH/3crpzM=; b=J4DmC2fahQoKa6 8pu3FnFmEAM62xJXtFdkkv4LJAly8JiFl6sCZUzHTmNmdcdESdA0YdfU++kNz7jCYgjsUb/Os+9nC Pk/gPwRVnDBsaDDSk9XUaMP3ldJUqjAr5wwKw3+cf98TTTvWMv6/TXFjLYQ/WMcNIPTsUbGf0ApwR uRsNKqoFJJwWXyo6zZbia6Qh6cds5xIkOHi3JC0MyL95PmpfsFuykBJ71bJGyyCxJ9jw0HloxDL/X iBiLQE3ZEMs2rRmkIcDpG51o/T4X62oRYOoEEtPgQvJq+3HeATtpL40bd1PuQDtPaEu8ZZUoOtSP0 teuInsZ2TnLwPTUWYZow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz1SQ-0000000EVvO-48Ez; Thu, 10 Oct 2024 22:16:30 +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 1syxsr-0000000Dri9-0EWW for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 18:27:35 +0000 Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-71e123d3d22so1429801b3a.3 for <linux-arm-kernel@lists.infradead.org>; Thu, 10 Oct 2024 11:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728584852; x=1729189652; 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=fZpnWf51XalE5JTpUzeqj9xBy85lPuBTlHLH/3crpzM=; b=cLJk3d4tBFRZOiFs+6bQQUgL9+5XLv36ZxgTPI3j7N9jPbVYQn5UYEHXG30q5cZAtp iLoVd863iI6QslfhR4bSkprz1688JE5LF2FO2gSOhcM+IGJX0QpjdBnRDdMQ62ouC3oJ bplSy/qMe21l7Xy1xG1IlCZN2yro1FWFNRNmv6sS9NMfZSUFAnJgg0EuPch5URNPcMG1 EWbkSmQF0LU/UoEnI63VnExMYr/1qn9aDn18jIArJhfw+WuPYh6KtbBICRCY7K4lBcNN jSLMr/sBO077LKQZMCJI/BZ+oDjzP6wnkJ4048tQ5WDcVuMAxNcfuoW2taX/zjS5bjPT jaEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728584852; x=1729189652; 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=fZpnWf51XalE5JTpUzeqj9xBy85lPuBTlHLH/3crpzM=; b=PmpLXWdl0dgWJsLNmmqQqVy/o3gOJQVv36tyosg7a2CE6bmzqcSZppuUHaf42s7aUA 5kgrS87pKnUYHzfGyG65jjFOTFMehkkmRPJ2sgsyNYHNoK0WVOnfOtsxykqwWZpEP7mv tVPxlPk7oIy6I0bW9LLCzIh9dtJdfeIPz4kWt607NgWGmX0+vmG0d056jh0pticqZei8 pEmtKivW+7dX6PVxg2+pp2eXF5q+OspJSI+PrLAer2IqzndoNTcJNjBtOhaCJnFUUZRJ AoU5YSYBBxm3d99ZSpObxIMCLwNj8rcTXD4yB8CTnSOPB/TRHHhJnXRh81kZBLTdB+Yd E/Sw== X-Forwarded-Encrypted: i=1; AJvYcCXorcikM98aOmI5T9i/E1zI/XlUq6Ub7c8nJCeM4IbsRA8fcl69/PiVeHtWe8ZHcUlAzdYdKhAgliEdSHLMQ5sT@lists.infradead.org X-Gm-Message-State: AOJu0YxjpD9ZBykfyreJu4g7ENlbo8jsgwcPF//LkhQKwrn2QiSJICnO qe7lSgRdKoB3P56HmLtX3Q01V1Wk1cwu3mLqg0vsfuDZewrJfJJdoaxqcsLBCIAH8PQwM7wVayJ 64Q== X-Google-Smtp-Source: AGHT+IHVUYgAS8Gi1OfHaumBjOVs/68U//Xc3NGlK2wEye9l2w1SuCdDQ/WQfsMbBzqgGqsCESzcy3AUxv4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:aa7:93b4:0:b0:71d:f64d:712c with SMTP id d2e1a72fcca58-71e1db65a16mr7365b3a.1.1728584851459; Thu, 10 Oct 2024 11:27:31 -0700 (PDT) Date: Thu, 10 Oct 2024 11:24:17 -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-76-seanjc@google.com> Subject: [PATCH v13 75/85] KVM: Convert gfn_to_page() to use kvm_follow_pfn() 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_112733_259812_B03F50DB X-CRM114-Status: GOOD ( 10.00 ) 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/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 696d5e429b3e..1782242a4800 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3145,14 +3145,16 @@ EXPORT_SYMBOL_GPL(kvm_prefetch_pages); */ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) { - kvm_pfn_t pfn; + struct page *refcounted_page = NULL; + struct kvm_follow_pfn kfp = { + .slot = gfn_to_memslot(kvm, gfn), + .gfn = gfn, + .flags = FOLL_WRITE, + .refcounted_page = &refcounted_page, + }; - pfn = gfn_to_pfn(kvm, gfn); - - if (is_error_noslot_pfn(pfn)) - return NULL; - - return kvm_pfn_to_refcounted_page(pfn); + (void)kvm_follow_pfn(&kfp); + return refcounted_page; } EXPORT_SYMBOL_GPL(gfn_to_page);