Message ID | 20240726235234.228822-5-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 9FB7BC3DA49 for <linux-arm-kernel@archiver.kernel.org>; Sat, 27 Jul 2024 00:12:21 +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=xiBZUTde5/yOu+VhqaXt4CYe/LeOwSdHW5ydN5gOuKQ=; b=AiOtqLr7twYR2AuctWPKbH8Hy5 tg0QaPzyDMmYCcW+QPybIyjNeQHj4Kwp7d6BAjYXmMC8/GUperE2NIFJTtKPVBsNG16fi5ydrgl1w 9JtKCqG4geXFdVr3J73jbl4nFSLUKgQQwc+ep5CTnUCVK/GRrseuNG/UTrZS2mfhWjRARhz2gD9k8 FHamGQTPbSClWx/XLTXdrylqh6t0rojMurvA7rUb1iqHJGK9zbEDvQ7GDkuJQ3dbOTonbUDmQVzVk d65E6SBft7+MPOvAQ1w6IJVyt3dALrJcY4agRd9gvNXr1MgdlfYQNlqsHTkJgnjY1pRJyT3/SBFLz V1FR/YCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXV2f-00000005aCf-3SB4; Sat, 27 Jul 2024 00:12:09 +0000 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXUjv-00000005PBr-11mM for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 23:52:48 +0000 Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-70d188c9cabso1355985b3a.0 for <linux-arm-kernel@lists.infradead.org>; Fri, 26 Jul 2024 16:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722037966; x=1722642766; 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=xiBZUTde5/yOu+VhqaXt4CYe/LeOwSdHW5ydN5gOuKQ=; b=C/UvVZLkZ4F6Rt5/HCv5SHiklzFOUg5x++bUB4Zx/yNmtMxOWXgkZ5pdeRwFJrmMS1 tfksl1URwEirZcfc2oR6J7aEnhWuXJr8O7Us9uVLZppwoJ2gAQ1OvEyg8UEJ+DVZ0b4w lUsup/LIqazSvP+Q7T8bWuABqPCGcxNIAN8QEgvk8iJmOdZW1CshL8zWsXUz7SZdXxRn XaaKkuO0yvCZjpGCc/7pgb30A8fF6Z4EhXLcabcYekP5E7s8FmSevht1N4v/LcPKWhij 0D7BkfCMt7YMNcJ4h1KJhG1ZGoUh2E4GbivtRiCZl7SFH3Fv9e4KmCXkKaEtqAzXYRTa 7e7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722037966; x=1722642766; 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=xiBZUTde5/yOu+VhqaXt4CYe/LeOwSdHW5ydN5gOuKQ=; b=SpyoHrAa/r88tXgpaXUYN9EWJgdSpanccWOQ2JE2RDumd121uZhfkcOEyixJaDqsg6 jUbXYP7Fk4EX/Dx2M2r+ZrUue6QQQOj6kzREpMwjUYc1mzf8ePAYbfV/CvZ5yoW/ZxDD peLYleOpD2ckLtLd5UaEURSNIMdxJ7y7/YRMBudxhB3hzoT3OYyK8pvo7+AelSYvpKCX mYO7/P+osev5CcvBtKPqh9M104QgbJa6sQMYs1BqhIWWr27sW0mEcb8zxi9ZpVQcvDlX b39vdJVk5UZ95Giee5JzqRrK5+rwjH0c6W4ZDYmWAOxvY1nP2Flrf6OivkqG/n731PoS yvcA== X-Forwarded-Encrypted: i=1; AJvYcCWvZ2+qwCu9aW9E3oepH5msJOzcIp835JO/IfmBcsDEOQUmnVfLUJJyTa3Os45OItz+qA9lkFn51guWeYN4cIIOU9xvG9I2m2YWefuUMSgZVPa9lcA= X-Gm-Message-State: AOJu0Yxx9mNPtCJ/hoPPPP1NO2RwcVmxLh144fN16una1uykMA+rlOZn RcCumtbslXCbUJ1MX8LLkP79Rig+M0LSJgk2k7C9/s4fO4R43ZIFTBdNKDQgMa/JSlSzpWDnFRq 3xA== X-Google-Smtp-Source: AGHT+IFeDzTSYc0yloJqv412y/9OHddQLGngXAZq8SjSSTQr+cl72qk3J3BVbl3XjHWFKDqTN/CvEh64V1I= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:8703:b0:70d:1285:bbcf with SMTP id d2e1a72fcca58-70ece93a09amr3050b3a.0.1722037965825; Fri, 26 Jul 2024 16:52:45 -0700 (PDT) Date: Fri, 26 Jul 2024 16:51:13 -0700 In-Reply-To: <20240726235234.228822-1-seanjc@google.com> Mime-Version: 1.0 References: <20240726235234.228822-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog Message-ID: <20240726235234.228822-5-seanjc@google.com> Subject: [PATCH v12 04/84] KVM: Allow calling kvm_release_page_{clean,dirty}() on a NULL page pointer 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, David Matlack <dmatlack@google.com>, David Stevens <stevensd@chromium.org> Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_165247_335095_B43B1B57 X-CRM114-Status: GOOD ( 11.88 ) 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
|
Sean Christopherson <seanjc@google.com> writes: > Allow passing a NULL @page to kvm_release_page_{clean,dirty}(), there's no > tangible benefit to forcing the callers to pre-check @page, and it ends up > generating a lot of duplicate boilerplate code. > > Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index fd8c212b8de7..656e931ac39e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3186,7 +3186,7 @@ static void kvm_set_page_accessed(struct page *page) void kvm_release_page_clean(struct page *page) { - if (WARN_ON(!page)) + if (!page) return; kvm_set_page_accessed(page); @@ -3211,7 +3211,7 @@ EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); void kvm_release_page_dirty(struct page *page) { - if (WARN_ON(!page)) + if (!page) return; kvm_set_page_dirty(page);
Allow passing a NULL @page to kvm_release_page_{clean,dirty}(), there's no tangible benefit to forcing the callers to pre-check @page, and it ends up generating a lot of duplicate boilerplate code. Signed-off-by: Sean Christopherson <seanjc@google.com> --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)