Message ID | 20241010182427.1434605-37-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 DBACFCFC5F8 for <linux-arm-kernel@archiver.kernel.org>; Thu, 10 Oct 2024 19:08:59 +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-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n3l8C52m2RjpLTXcY6dq+UIBo01A1fTC4GBMzDz1kHI=; b=awZur1qmaZ4CYJiZnRanf6DTg+ XQtbjif+Z9jwTIX6VJJGQwbvgEAs7Iz4fqXJhFGoUqd4JJeW0kgIet0HJ/UM5+1vrO/Ua/hR4yOMD HRlYohNAyHovYoGwK+uYK4cffvfSM9pcLuZVeFizuPEksHRfa8GzG1dHuPsybVzzjK9X0rZypPV2t 98r8eANxQyb37ZTWXqai/Ug2od7mwjSKe6t3XfYdUHfiB7h83bdbPsVqH4wjdFswFWclmvXafjuhY b3IlqW4u4oZxjWYml54py49dnmpEkGGEwi5UDRfyc+2Z/fd/UTvYllDOscRDrL2N7yQXG7lcgMPO3 ZkSPDCnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syyWl-0000000E382-2dGT; Thu, 10 Oct 2024 19:08:47 +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 1syxrU-0000000DqaO-1B1d for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 18:26:09 +0000 Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-71e04c42fecso1289999b3a.0 for <linux-arm-kernel@lists.infradead.org>; Thu, 10 Oct 2024 11:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728584767; x=1729189567; darn=lists.infradead.org; h=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=n3l8C52m2RjpLTXcY6dq+UIBo01A1fTC4GBMzDz1kHI=; b=hbUUm6huEsIpvBlGvvHRI3wy9VneLaobE+5HtYZY5ER96gyN7mdBt227GEUK5zzVMn 76vbGKJ41cFK+Ysmvcp7yzuv7ili+YPUjYOxE/ctNAbuu4Nnb7yjxtQS1drQiUhAjqUc Ip97sqxSr37TeirbDgYFFRiSaHoci9HOuvGFeZA6n046j+szLpL2tKQh7Ei2hE6WbqkS ntJU0pnF07qDfzHcM1/OBCL3m4W69iEVbt8ImxGUxYS+T3YNq0sWzfDSXc6BIWrgACxA cLY+/1MsX2oQAbg3Kc7OdW631minPkxe5BLmqpeshd1NcocBBwJNRd9/VTPro4cW+odU d97A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728584767; x=1729189567; h=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=n3l8C52m2RjpLTXcY6dq+UIBo01A1fTC4GBMzDz1kHI=; b=RLqwotAOjbB2+fX/uo9vKbbsptgbvTjzSDKOyt1N+7HopUYXmddFpNy3yFDXTAN5W7 7X5WWUssbilBFCaAMhG6ifHTAD4ylqehIVst0/mBWkh2G3jFCeJY+sDv06WOceNSmZyd Uj0zTtjj3sRM1CtTAc7+Bb/bRgCkq4QP5fB77WN4j+adtRwlfvA8/wxMYtj6NjsIKNUJ Kd2polTyax7mDhdQjbMZpwOLijx8v+BvHlOTBrhZBvs2EVKLAvjEMZ8dof1jfM1IZn24 coa2YQWshtAJ0wNH3o+dYzWFmIOCHL73P6Jofq7DJlmL4NQR7fi89NzHIa09hZRMFuoC SkiA== X-Forwarded-Encrypted: i=1; AJvYcCW1Qt6pMPVLbUElktdYzHx4aemmS4VFma7T3QA0hZ543n7kReEY/x9zZl8IV2iH8xDDtrXbE/9/jXNP7GLEwEOX@lists.infradead.org X-Gm-Message-State: AOJu0YwhuDYY0E3iaY9c4t4Ze+xmDCH8bGf10LW4qfJ2Tv/LmFyZcZYy DnezDX7clL9z9eF/28zzFjT0EThBY1X8x0KBbafTG1YvGQdcX+j18gkKEULA70q9P2O3V1fOyiK DPg== X-Google-Smtp-Source: AGHT+IH5y4h19aQ8D3UFZNHEjFs0l+IkJ/F+GwDOdY5CLNZ6WKY+eP+zfpO4DiXt2PfVXCIgSRJOtCb+AeE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:a05:6a00:6f44:b0:71e:268b:845e with SMTP id d2e1a72fcca58-71e26e53c16mr11733b3a.1.1728584766802; Thu, 10 Oct 2024 11:26:06 -0700 (PDT) Date: Thu, 10 Oct 2024 11:23:38 -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-37-seanjc@google.com> Subject: [PATCH v13 36/85] KVM: x86: Don't fault-in APIC access page during initial allocation 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" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_112608_380944_9B92B9D2 X-CRM114-Status: GOOD ( 11.72 ) 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/lapic.c b/arch/x86/kvm/lapic.c index 20526e4d6c62..65412640cfc7 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2647,7 +2647,6 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu) int kvm_alloc_apic_access_page(struct kvm *kvm) { - struct page *page; void __user *hva; int ret = 0; @@ -2663,17 +2662,6 @@ int kvm_alloc_apic_access_page(struct kvm *kvm) goto out; } - page = gfn_to_page(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); - if (!page) { - ret = -EFAULT; - goto out; - } - - /* - * Do not pin the page in memory, so that memory hot-unplug - * is able to migrate it. - */ - put_page(page); kvm->arch.apic_access_memslot_enabled = true; out: mutex_unlock(&kvm->slots_lock);
Drop the gfn_to_page() lookup when installing KVM's internal memslot for the APIC access page, as KVM doesn't need to immediately fault-in the page now that the page isn't pinned. In the extremely unlikely event the kernel can't allocate a 4KiB page, KVM can just as easily return -EFAULT on the future page fault. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sean Christopherson <seanjc@google.com> --- arch/x86/kvm/lapic.c | 12 ------------ 1 file changed, 12 deletions(-)