Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp81164pxv; Thu, 24 Jun 2021 03:20:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4xRowajkpVoyJmECLQ3HbwFqJyZmIxEvMuyzaKZSVNcH9f+s6A/JVHWiAWxEWZvD7xi/V X-Received: by 2002:a17:907:831d:: with SMTP id mq29mr4535340ejc.509.1624530029720; Thu, 24 Jun 2021 03:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624530029; cv=none; d=google.com; s=arc-20160816; b=bUMVbK1YnHt79NxonCGnYWlI2HySHl8s/jCzZKhU061bFhL8pGp55Y5rzx6ONyl3+m bBfcek7YTvpsNJRgdcqDbW/ZiP5DL+3hyEOBLubstD9haUTPsO5IG1djzX0AZJzwPPZa qIpLYmgHEq4S0U5g5xwvXFc81FkKxXXTQbO8BwIL4+Ajem1hCD0wP+CU6Y3o4QYbqXX5 Zu1w7If5B3PdkhuH6p4ln+T2jlyRrjPZtNruZDdsIuuUhylYvk8u7M6tMiqQ13NdxscR 2sZ/JRUdBORgbf3GFboSGutS3GkbS+3OauLRpVpJYlh8aZZd/Zv34O8TsfKHWq2tUqnf kcEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=ufPcep0sp8fFam4s8EQWkn+673yXecgGkFHNTHQONWw=; b=YfOiklUNJ/mFcasmvhsoUFy56bwLj2OnJQFCO/CV18B4JcW3Bbqd6WE4dC7FUwkbGA kmfcsho0Vxpj0DSDd6eQIRJTI0BpJpx/XbAjo7hVO5VxelqqtpQAQ1sKyMrsLSXmSeez g95m+ckNxboTJWji+DWInmqw6JNEdZXyArlOe74pS+k8c/Vv8uNtqKl69vCwyXGz34Yc WK+ejY7KkZojg+VuX5AtLftebAm7gZ9oLKFimy1NBdIteb/uf91DzVkzAvRrDEe2NBTU EUtCqKxvg3yGLiHCwiCCWedsA+MieLna72RwYCp+wrY3ha50oKAO5gjiDmKxtyASkT1q azKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sFF5ZYvJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si2497737eju.58.2021.06.24.03.20.06; Thu, 24 Jun 2021 03:20:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sFF5ZYvJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232208AbhFXKUI (ORCPT + 99 others); Thu, 24 Jun 2021 06:20:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232111AbhFXKUH (ORCPT ); Thu, 24 Jun 2021 06:20:07 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5891C061574; Thu, 24 Jun 2021 03:17:48 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id bb20so3183730pjb.3; Thu, 24 Jun 2021 03:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=ufPcep0sp8fFam4s8EQWkn+673yXecgGkFHNTHQONWw=; b=sFF5ZYvJivSW9geCDpAWHQIXJqy0TaWKJDeCWyf+SN8sC0zvAWOqxE0kDzVGrlqH0T tmnXDqy/vMEUI/QT1fg3tuAhH6y/WaFDv0bhKrmNY65hIUEPGulyXJKnytExJVEwigXZ EEgjb92CecGE/1ZNSefvvxGTeh5Bu3j4pd19HStH0J6gJv+4gmTPMVXvpU/FEf57f6Z1 yZZLHMoK9YK0EH+XiEgmNblrEYdl95qc0I5aDyKhqYAvytW6+/07zmQXw9lEc1D57uv2 sPH/vR/v0oM7LuQHI7hajV/RDoziumHUY8ZgFdgAAJLR7DiFovRTgo8M2LsLunQ7LnIe UNoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=ufPcep0sp8fFam4s8EQWkn+673yXecgGkFHNTHQONWw=; b=aS4wwhJvFaUFn1MsoE7emCf6T3BPewsDquwyDWjz/J+NRe5hMNKkj1Aljz2Ecau/6o NtcLlZNgPkgqdfbcHC6TVEajAYSfy/mjGHddIXWFPj7gF0JJtYu/ONbVbtSbYt0+w+yj G7rAdFNbHSgL66Og7y1N0Bwt7SIlAeUsOb/kZjcxJCCArcCvfdcw1jxqJAdbR3PD04F7 2mgPmVbmrjvIlaQfUFe2Ioau0LS2Ipyjl4wuguEZ+EunSb6xZYbjUW73hI5Zfc0F2N+s zy8XDR5lGlapmye5SxnTbZF4b850jgbtXcUs+eDhht7xH64xuiZqwXn5/721xM71I0kk 4yMA== X-Gm-Message-State: AOAM530byPkbedOQkTcbexzeHypJpzrl6qUbpXF6/nyvKyPIOaD2EVGw K7LiZoqxL3LZatqq77gNaq8= X-Received: by 2002:a17:90a:7401:: with SMTP id a1mr14554343pjg.57.1624529868549; Thu, 24 Jun 2021 03:17:48 -0700 (PDT) Received: from localhost (60-242-147-73.tpgi.com.au. [60.242.147.73]) by smtp.gmail.com with ESMTPSA id o20sm2094410pjq.57.2021.06.24.03.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 03:17:48 -0700 (PDT) Date: Thu, 24 Jun 2021 20:17:42 +1000 From: Nicholas Piggin Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn To: Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , Paolo Bonzini , David Stevens , Zhenyu Wang , Zhi Wang Cc: Alexandru Elisei , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, James Morse , Jim Mattson , Joerg Roedel , kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sean Christopherson , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Will Deacon References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-3-stevensd@google.com> <1624524331.zsin3qejl9.astroid@bobo.none> <201b68a7-10ea-d656-0c1e-5511b1f22674@redhat.com> <1624528342.s2ezcyp90x.astroid@bobo.none> In-Reply-To: <1624528342.s2ezcyp90x.astroid@bobo.none> MIME-Version: 1.0 Message-Id: <1624529635.75a1ann91v.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Nicholas Piggin's message of June 24, 2021 7:57 pm: > Excerpts from Paolo Bonzini's message of June 24, 2021 7:42 pm: >> On 24/06/21 10:52, Nicholas Piggin wrote: >>>> For now, wrap all calls to gfn_to_pfn functions in the new helper >>>> function. Callers which don't need the page struct will be updated in >>>> follow-up patches. >>> Hmm. You mean callers that do need the page will be updated? Normally >>> if there will be leftover users that don't need the struct page then >>> you would go the other way and keep the old call the same, and add a ne= w >>> one (gfn_to_pfn_page) just for those that need it. >>=20 >> Needing kvm_pfn_page_unwrap is a sign that something might be buggy, so=20 >> it's a good idea to move the short name to the common case and the ugly=20 >> kvm_pfn_page_unwrap(gfn_to_pfn(...)) for the weird one. In fact I'm not= =20 >> sure there should be any kvm_pfn_page_unwrap in the end. >=20 > If all callers were updated that is one thing, but from the changelog > it sounds like that would not happen and there would be some gfn_to_pfn > users left over. >=20 > But yes in the end you would either need to make gfn_to_pfn never return > a page found via follow_pte, or change all callers to the new way. If=20 > the plan is for the latter then I guess that's fine. Actually in that case anyway I don't see the need -- the existence of gfn_to_pfn is enough to know it might be buggy. It can just as easily be grepped for as kvm_pfn_page_unwrap. And are gfn_to_page cases also vulernable to the same issue? So I think it could be marked deprecated or something if not everything=20 will be converted in the one series, and don't need to touch all that=20 arch code with this patch. Thanks, Nick