From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id B275FC4332F for ; Thu, 30 Dec 2021 19:26:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 27AF549EBF; Thu, 30 Dec 2021 14:26:58 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 41u1sXAd3-Xz; Thu, 30 Dec 2021 14:26:57 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0F5CA49E48; Thu, 30 Dec 2021 14:26:57 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5F86E40D26 for ; Thu, 30 Dec 2021 14:26:55 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sVEgJL15i1Ct for ; Thu, 30 Dec 2021 14:26:54 -0500 (EST) Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 60E7240D0B for ; Thu, 30 Dec 2021 14:26:54 -0500 (EST) Received: by mail-pj1-f45.google.com with SMTP id jw3so21872920pjb.4 for ; Thu, 30 Dec 2021 11:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TZUph+1LIEWHwkUrkggqde2R87m4Flj/r9dmdwLX5Gk=; b=YjPirROoPg13DarDjbdzx+b6JXQsjXJAroXjMUwNDC76kjIF6C1cS8keBNKHMwtVRz ISz7aWmvSYfhUT0/mv+fQimuFcM7IpQYiGSj5GneQoSRXJf27E+/a7kX/zz7OILY+ohR KvvILQ1tJEBcxhfEfb4Sze3gNLGOdNBvx2AM7nRMVaOKJ6zXjhHHSmfR5Ea/RkSYkONc Vv5TuUD92KHd0ioNQnac3ovtQjfZUOUlYaj5MyVEagQy5v7ICbkHPQwcB/friSppUclP moI5YE9d9gjNvOeLdaVxqsBZYX+6aAerSR+/sdxPKQZlefucqnMpLtkqSkdgP7uOLynp C4Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TZUph+1LIEWHwkUrkggqde2R87m4Flj/r9dmdwLX5Gk=; b=0PKhiQqHcXyQhNF7eordUpDpPwPFv+z2mCsvsVQ+jPJSIz5+wtQAT6rHnnvac2lE6b DdC6Mc71Es4Zcm0EjCSUTxeJeaMlnL/2yNByNSwWPxoULiwxXJknrQ5BKoLecIm59YTI wVak+geYiPJnUp76k8akgfAPtjJ1btBZ6F0qpO48cT2NazEHqiUn2O6t5lTuH4vCzAP/ eRurXQ6IPG+1/vBRPud+72tQi0gYZ0aSZMz5+t7CaKFPpI/rvayyLqZGkEOvdidSlDFF zGzxz7bRrt0X3BChiD/UwAYo0hIh4MiWJ3tX4OXzbtOLiOmpxiLAwkHrIyn1T7bWK0SZ Q6+A== X-Gm-Message-State: AOAM530LOxyxr6gFzKPdClNEz9Dp2dcCdme1jb3qVeKU4O2S2wSVVBw9 wj2rZrTzNy/f1lfraRvVSFdHzg== X-Google-Smtp-Source: ABdhPJy75H5vqTjoxkUn2lk86SVP6fu7EF2sx90j7RLzIByICIqLM9zp/fNPB/CyaOJtZQ2wXQ2z2A== X-Received: by 2002:a17:902:ab53:b0:149:7902:bc8f with SMTP id ij19-20020a170902ab5300b001497902bc8fmr22576921plb.85.1640892413370; Thu, 30 Dec 2021 11:26:53 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id u71sm23209813pgd.68.2021.12.30.11.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 11:26:52 -0800 (PST) Date: Thu, 30 Dec 2021 19:26:49 +0000 From: Sean Christopherson To: David Stevens Subject: Re: [PATCH v5 1/4] KVM: mmu: introduce new gfn_to_pfn_page functions Message-ID: References: <20211129034317.2964790-1-stevensd@google.com> <20211129034317.2964790-2-stevensd@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211129034317.2964790-2-stevensd@google.com> Cc: Wanpeng Li , kvm@vger.kernel.org, Marc Zyngier , Joerg Roedel , linux-kernel@vger.kernel.org, Paolo Bonzini , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Mon, Nov 29, 2021, David Stevens wrote: > +static kvm_pfn_t ensure_pfn_ref(struct page *page, kvm_pfn_t pfn) "ensure" is rather misleading as that implies this is _just_ an assertion, but that's not true since it elevates the refcount. Maybe kvm_try_get_page_ref()? > +{ > + if (page || is_error_pfn(pfn)) A comment above here would be very helpful. It's easy to overlook the "page" check and think that KVM is double-counting pages. E.g. /* If @page is valid, KVM already has a reference to the pfn/page. */ That would tie in nicely with the kvm_try_get_page_ref() name too. > + return pfn; > + > + /* > + * If we're here, a pfn resolved by hva_to_pfn_remapped is > + * going to be returned to something that ultimately calls > + * kvm_release_pfn_clean, so the refcount needs to be bumped if > + * the pfn isn't a reserved pfn. > + * > + * Whoever called remap_pfn_range is also going to call e.g. > + * unmap_mapping_range before the underlying pages are freed, > + * causing a call to our MMU notifier. > + * > + * Certain IO or PFNMAP mappings can be backed with valid > + * struct pages, but be allocated without refcounting e.g., > + * tail pages of non-compound higher order allocations, which > + * would then underflow the refcount when the caller does the > + * required put_page. Don't allow those pages here. > + */ > + if (kvm_is_reserved_pfn(pfn) || > + get_page_unless_zero(pfn_to_page(pfn))) > + return pfn; > + > + return KVM_PFN_ERR_FAULT; > +} _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 2F12CC433F5 for ; Thu, 30 Dec 2021 19:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Gto5DbvC4nCY7pEQEmeLXeislkB/VOzcAsEOfkMz/H8=; b=nqrSF54Gd5mSh3 U29pNHb4KGZc+N90mPfwHR9/XMbf/Z5LAlMvhg2sY8LJ/CXKO6D1iP6dvYfFD1UXb44h0WAUFyu+P /zee4CNj06Vntq4q1VeBzkc7NWHdytpi/t160sivhJYxnZ9LxHCMkTADMgMYS96yiiXK/OBxGo8ZB HVOsYEelTm/jDBWBfy1NCcdJcHi9UknJlkzpHQjgGfMJHaOCtsBPHKbwFWBZwovDr5TwZLQgRGlWq 3iX7Opo2ORMQ9iST1cWDOQANaGCbCzbsCUS4InanJ5TLuu0oqXxxhmb90Dy14+1a2qerXrAsF6O2b Bn1i3ULvg7XFXdbGZfTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n31LA-0057vt-IK; Thu, 30 Dec 2021 19:43:56 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n314g-00503T-DL for linux-arm-kernel@lists.infradead.org; Thu, 30 Dec 2021 19:26:55 +0000 Received: by mail-pj1-x102a.google.com with SMTP id iy13so21890275pjb.5 for ; Thu, 30 Dec 2021 11:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TZUph+1LIEWHwkUrkggqde2R87m4Flj/r9dmdwLX5Gk=; b=YjPirROoPg13DarDjbdzx+b6JXQsjXJAroXjMUwNDC76kjIF6C1cS8keBNKHMwtVRz ISz7aWmvSYfhUT0/mv+fQimuFcM7IpQYiGSj5GneQoSRXJf27E+/a7kX/zz7OILY+ohR KvvILQ1tJEBcxhfEfb4Sze3gNLGOdNBvx2AM7nRMVaOKJ6zXjhHHSmfR5Ea/RkSYkONc Vv5TuUD92KHd0ioNQnac3ovtQjfZUOUlYaj5MyVEagQy5v7ICbkHPQwcB/friSppUclP moI5YE9d9gjNvOeLdaVxqsBZYX+6aAerSR+/sdxPKQZlefucqnMpLtkqSkdgP7uOLynp C4Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TZUph+1LIEWHwkUrkggqde2R87m4Flj/r9dmdwLX5Gk=; b=Jx6mfuvTezGCJctmgWi4eVr20IcthDT+Wfzk5DIIcAeZQphf94uvVlaewGUduYmVGk lJf5ksrfXurcH+ckcOPyKEAgAyXg7hudyhg9MK3ItBCzaa1Xije7XFPvRPvu8mEwwmx0 dTjyYbxgjSEd4INb1l5IeZ+lSEsdPM3Pkr9NXEQruYJUw22Nhx7JiEiUdkHFiTt1LLRr 7WKdOWLMnEXRGeKwQeL7Q51L/qXg/+NXK2v5uKLZ2fCE3fnxIwT/ZLyxTPb+FIqQzcHv qZDkHFsIN3rf0gu6p+Pc60uHePxK6Tv5wMjdkN2ia9SDp6Ywki5u/HBkGSl3dCZE5oC6 gztA== X-Gm-Message-State: AOAM533ZWadoq5ivrbjeaYW1lYRZdSpiXE/DXhPzfc2IUMcLDMqWHIWi 41BpN0VOlN0bSJLLwanK6+1ltg== X-Google-Smtp-Source: ABdhPJy75H5vqTjoxkUn2lk86SVP6fu7EF2sx90j7RLzIByICIqLM9zp/fNPB/CyaOJtZQ2wXQ2z2A== X-Received: by 2002:a17:902:ab53:b0:149:7902:bc8f with SMTP id ij19-20020a170902ab5300b001497902bc8fmr22576921plb.85.1640892413370; Thu, 30 Dec 2021 11:26:53 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id u71sm23209813pgd.68.2021.12.30.11.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 11:26:52 -0800 (PST) Date: Thu, 30 Dec 2021 19:26:49 +0000 From: Sean Christopherson To: David Stevens Cc: Marc Zyngier , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Will Deacon , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v5 1/4] KVM: mmu: introduce new gfn_to_pfn_page functions Message-ID: References: <20211129034317.2964790-1-stevensd@google.com> <20211129034317.2964790-2-stevensd@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211129034317.2964790-2-stevensd@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211230_112654_504913_6AD46B02 X-CRM114-Status: GOOD ( 17.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 29, 2021, David Stevens wrote: > +static kvm_pfn_t ensure_pfn_ref(struct page *page, kvm_pfn_t pfn) "ensure" is rather misleading as that implies this is _just_ an assertion, but that's not true since it elevates the refcount. Maybe kvm_try_get_page_ref()? > +{ > + if (page || is_error_pfn(pfn)) A comment above here would be very helpful. It's easy to overlook the "page" check and think that KVM is double-counting pages. E.g. /* If @page is valid, KVM already has a reference to the pfn/page. */ That would tie in nicely with the kvm_try_get_page_ref() name too. > + return pfn; > + > + /* > + * If we're here, a pfn resolved by hva_to_pfn_remapped is > + * going to be returned to something that ultimately calls > + * kvm_release_pfn_clean, so the refcount needs to be bumped if > + * the pfn isn't a reserved pfn. > + * > + * Whoever called remap_pfn_range is also going to call e.g. > + * unmap_mapping_range before the underlying pages are freed, > + * causing a call to our MMU notifier. > + * > + * Certain IO or PFNMAP mappings can be backed with valid > + * struct pages, but be allocated without refcounting e.g., > + * tail pages of non-compound higher order allocations, which > + * would then underflow the refcount when the caller does the > + * required put_page. Don't allow those pages here. > + */ > + if (kvm_is_reserved_pfn(pfn) || > + get_page_unless_zero(pfn_to_page(pfn))) > + return pfn; > + > + return KVM_PFN_ERR_FAULT; > +} _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5ADEC433F5 for ; Thu, 30 Dec 2021 19:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240325AbhL3T04 (ORCPT ); Thu, 30 Dec 2021 14:26:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233875AbhL3T0y (ORCPT ); Thu, 30 Dec 2021 14:26:54 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5576EC06173E for ; Thu, 30 Dec 2021 11:26:54 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id o63-20020a17090a0a4500b001b1c2db8145so28768377pjo.5 for ; Thu, 30 Dec 2021 11:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TZUph+1LIEWHwkUrkggqde2R87m4Flj/r9dmdwLX5Gk=; b=YjPirROoPg13DarDjbdzx+b6JXQsjXJAroXjMUwNDC76kjIF6C1cS8keBNKHMwtVRz ISz7aWmvSYfhUT0/mv+fQimuFcM7IpQYiGSj5GneQoSRXJf27E+/a7kX/zz7OILY+ohR KvvILQ1tJEBcxhfEfb4Sze3gNLGOdNBvx2AM7nRMVaOKJ6zXjhHHSmfR5Ea/RkSYkONc Vv5TuUD92KHd0ioNQnac3ovtQjfZUOUlYaj5MyVEagQy5v7ICbkHPQwcB/friSppUclP moI5YE9d9gjNvOeLdaVxqsBZYX+6aAerSR+/sdxPKQZlefucqnMpLtkqSkdgP7uOLynp C4Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TZUph+1LIEWHwkUrkggqde2R87m4Flj/r9dmdwLX5Gk=; b=opraKhi1efJc1dXzHjIWLWrQmELQtMggKCx9jQuJPtksMN+UXK6E/PXsfkiOYbGunH jVw6pzhZZq8O5DiTxDPboJxzQxIXWHlhjTEy++wQzUVgpeEXlPL8bWcNhnZHsr1eREOQ 6jkjaRySwhlSGvzNMj8ETx6iGJhjk+rIxdR6BxPQc6J1Rit+Eek8dseZJ9HK0XzSX1w4 kzrfeg65ME/kUe099j5bTvuk5jNBVVePPX61be/3L2p+92PCWyt+8jPyLipFGk+Axdgb +QlJbedroY0o7D/um9OInXN6glQ1TlaMkqVyN/PXQ1u05ypR4ZHomWSUDkctMpKdFoDU NE6A== X-Gm-Message-State: AOAM530RTjt+ZR0KEaUnDIFuXa6j3Iew9MESqWaJyCmc+cug6VhFiK6T Klz/JxZPCKJfEnZxVknzS1VQoA== X-Google-Smtp-Source: ABdhPJy75H5vqTjoxkUn2lk86SVP6fu7EF2sx90j7RLzIByICIqLM9zp/fNPB/CyaOJtZQ2wXQ2z2A== X-Received: by 2002:a17:902:ab53:b0:149:7902:bc8f with SMTP id ij19-20020a170902ab5300b001497902bc8fmr22576921plb.85.1640892413370; Thu, 30 Dec 2021 11:26:53 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id u71sm23209813pgd.68.2021.12.30.11.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 11:26:52 -0800 (PST) Date: Thu, 30 Dec 2021 19:26:49 +0000 From: Sean Christopherson To: David Stevens Cc: Marc Zyngier , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Will Deacon , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v5 1/4] KVM: mmu: introduce new gfn_to_pfn_page functions Message-ID: References: <20211129034317.2964790-1-stevensd@google.com> <20211129034317.2964790-2-stevensd@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211129034317.2964790-2-stevensd@google.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, Nov 29, 2021, David Stevens wrote: > +static kvm_pfn_t ensure_pfn_ref(struct page *page, kvm_pfn_t pfn) "ensure" is rather misleading as that implies this is _just_ an assertion, but that's not true since it elevates the refcount. Maybe kvm_try_get_page_ref()? > +{ > + if (page || is_error_pfn(pfn)) A comment above here would be very helpful. It's easy to overlook the "page" check and think that KVM is double-counting pages. E.g. /* If @page is valid, KVM already has a reference to the pfn/page. */ That would tie in nicely with the kvm_try_get_page_ref() name too. > + return pfn; > + > + /* > + * If we're here, a pfn resolved by hva_to_pfn_remapped is > + * going to be returned to something that ultimately calls > + * kvm_release_pfn_clean, so the refcount needs to be bumped if > + * the pfn isn't a reserved pfn. > + * > + * Whoever called remap_pfn_range is also going to call e.g. > + * unmap_mapping_range before the underlying pages are freed, > + * causing a call to our MMU notifier. > + * > + * Certain IO or PFNMAP mappings can be backed with valid > + * struct pages, but be allocated without refcounting e.g., > + * tail pages of non-compound higher order allocations, which > + * would then underflow the refcount when the caller does the > + * required put_page. Don't allow those pages here. > + */ > + if (kvm_is_reserved_pfn(pfn) || > + get_page_unless_zero(pfn_to_page(pfn))) > + return pfn; > + > + return KVM_PFN_ERR_FAULT; > +}