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 X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86200C48BDF for ; Thu, 24 Jun 2021 10:21:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 532C661248 for ; Thu, 24 Jun 2021 10:21:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 532C661248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0763D6EB4E; Thu, 24 Jun 2021 10:21:09 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id C63ED6EB4E for ; Thu, 24 Jun 2021 10:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624530067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=OyOYIhkFlD72RXa4ApycBznJ8h/A4rxQkZYFz4zqo5MtkH1geetKyPWMfBX0ch0jh7q3Lg qnz7zGgvlyQUIzPbypEimxNaD0+gpIcj0/R+UxQuP9AGOacLVchr1yQsGXdxC66zyvRmgz DHDojJLPq7Dlhzp9U4RjDK0rp/NxRo4= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-qbwaf_2WPzKFQApb7QGdhA-1; Thu, 24 Jun 2021 06:21:05 -0400 X-MC-Unique: qbwaf_2WPzKFQApb7QGdhA-1 Received: by mail-ed1-f72.google.com with SMTP id q7-20020aa7cc070000b029038f59dab1c5so3092267edt.23 for ; Thu, 24 Jun 2021 03:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=jha8GNeiCVeq4JfCB4OZPBmFNeTMO5rUI/wp6xZUjLkUr+y79ck70T47doyC39LTMt D+rZ31fbhNZaZurCrFCbrDnbubrMKAr/td4aiXhqmF+MU2SNwBAwvqKCcFC7d+5Npt0N WFBUWNwzJLle8Zuuzzm/JYmDzqJ90TYDEoH0+MlW1UFufZi7MjORFm9OPb8apWjyft22 8muTkqlz2wawl4qlMvFV1eUvE8yxra+fR7/aG92AYUm8RD6dh4xtwRf1qGiP471dE2Sg wgPRGuRE2rJWqmkxbhyrnow5ec3Hs518dcosMfsB3YWM+BrZ0ZstV6g26ce5sEPwQ1Mu VCbQ== X-Gm-Message-State: AOAM530XtwnkUltYDBoLxMgBCHhJ+Sgm3wX9cOGGh7IYK7ZM4+eyvFAr B71CiX0vValfNrGPrWrepXdzBAIRHHvf9finDOnjVHSqsIhtm6tUWspjDguRk2mxvGINSsJzYjq Vf4+Mt9vLNoZYa62dExNKsMpSY1Ad X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001644edb.214.1624530064626; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs51nnE9ArY9tBUvtcT3K4P6rQ2AL9pfX67ccTlvEZ5+BaJldlaSdGdhR+tmPYnfTJgtakmA== X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001609edb.214.1624530064420; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id e7sm493571ejm.93.2021.06.24.03.21.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:21:03 -0700 (PDT) To: Nicholas Piggin , Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang 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> <1624529635.75a1ann91v.astroid@bobo.none> From: Paolo Bonzini Message-ID: Date: Thu, 24 Jun 2021 12:21:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1624529635.75a1ann91v.astroid@bobo.none> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , kvm@vger.kernel.org, Suzuki K Poulose , Alexandru Elisei , intel-gfx@lists.freedesktop.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kvmarm@lists.cs.columbia.edu, Will Deacon , James Morse , kvm-ppc@vger.kernel.org, Sean Christopherson , Vitaly Kuznetsov , linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Jim Mattson Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 24/06/21 12:17, Nicholas Piggin wrote: >> 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. >> >> 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 >> 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. Sure, but that would leave us with longer function names (gfn_to_pfn_page* instead of gfn_to_pfn*). So the "safe" use is the one that looks worse and the unsafe use is the one that looks safe. > And are gfn_to_page cases also > vulernable to the same issue? No, they're just broken for the VM_IO|VM_PFNMAP case. Paolo > So I think it could be marked deprecated or something if not everything > will be converted in the one series, and don't need to touch all that > arch code with this patch. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Date: Thu, 24 Jun 2021 10:21:01 +0000 Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn Message-Id: List-Id: 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> <1624529635.75a1ann91v.astroid@bobo.none> In-Reply-To: <1624529635.75a1ann91v.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nicholas Piggin , Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , 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 On 24/06/21 12:17, Nicholas Piggin wrote: >> 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. >> >> 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 >> 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. Sure, but that would leave us with longer function names (gfn_to_pfn_page* instead of gfn_to_pfn*). So the "safe" use is the one that looks worse and the unsafe use is the one that looks safe. > And are gfn_to_page cases also > vulernable to the same issue? No, they're just broken for the VM_IO|VM_PFNMAP case. Paolo > So I think it could be marked deprecated or something if not everything > will be converted in the one series, and don't need to touch all that > arch code with this patch. 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 X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2901FC49EAB for ; Thu, 24 Jun 2021 10:21:12 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 95C48613FE for ; Thu, 24 Jun 2021 10:21:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95C48613FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0ED224B26E; Thu, 24 Jun 2021 06:21:11 -0400 (EDT) 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=@redhat.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 GUsi68C-IdAP; Thu, 24 Jun 2021 06:21:09 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D89694B26D; Thu, 24 Jun 2021 06:21:09 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4A2814B26D for ; Thu, 24 Jun 2021 06:21:08 -0400 (EDT) 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 DAsOC6hlAsjG for ; Thu, 24 Jun 2021 06:21:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 433474B268 for ; Thu, 24 Jun 2021 06:21:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624530067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=OyOYIhkFlD72RXa4ApycBznJ8h/A4rxQkZYFz4zqo5MtkH1geetKyPWMfBX0ch0jh7q3Lg qnz7zGgvlyQUIzPbypEimxNaD0+gpIcj0/R+UxQuP9AGOacLVchr1yQsGXdxC66zyvRmgz DHDojJLPq7Dlhzp9U4RjDK0rp/NxRo4= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-wtO5CTofM5WUVNGRpdLbyg-1; Thu, 24 Jun 2021 06:21:05 -0400 X-MC-Unique: wtO5CTofM5WUVNGRpdLbyg-1 Received: by mail-ed1-f69.google.com with SMTP id t11-20020a056402524bb029038ffacf1cafso3091079edd.5 for ; Thu, 24 Jun 2021 03:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=t7De3nTSkjkM+eLrmgccqWuoLk1yqE/F4dTm4nZGupKmc9cPQg3vM7IJ0+Ir/iTcKZ 4ikjgYgoA6s0Dd4uodecfwZ+Hqy/wPicYOTLtYZ0Nw7awknKGpSYbC7voUcH/NIOTV2u XQoAQqmJprAOCPYKJmcPbKqlwDKAkoLosc8UvLx6UbIgnhRZSYa/Z5chjxTDN5LGxXtb JsKLRwF80De61aB0NXkKnKrLP/3cEbou6hgvR5vxqPeYlsrrWexgYt1Vav5CGsQoFXqU 6KzXesFxcXouQQRLU95n8QrckGLVgJd5nAjZxKI2rN76ZqK20eUDxc66/suqSX7IG7K3 GMKQ== X-Gm-Message-State: AOAM531cfHOGMg6WafN/wbpk9hGif3t7Ol7Kkp1gsrkIHvloBWq2o9bh 9er+nm/5sjarsYVz1jECXkwZyEvgOB6SqjCEVTuLM5hAXEenAxySrbsB4RSiU5RGcxFEt0IOghO 7hhIi6V9qABNjEJHbgwSlVLDN X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001647edb.214.1624530064632; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs51nnE9ArY9tBUvtcT3K4P6rQ2AL9pfX67ccTlvEZ5+BaJldlaSdGdhR+tmPYnfTJgtakmA== X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001609edb.214.1624530064420; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id e7sm493571ejm.93.2021.06.24.03.21.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:21:03 -0700 (PDT) Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn To: Nicholas Piggin , Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang 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> <1624529635.75a1ann91v.astroid@bobo.none> From: Paolo Bonzini Message-ID: Date: Thu, 24 Jun 2021 12:21:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1624529635.75a1ann91v.astroid@bobo.none> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: Wanpeng Li , kvm@vger.kernel.org, intel-gfx@lists.freedesktop.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kvmarm@lists.cs.columbia.edu, Will Deacon , kvm-ppc@vger.kernel.org, Sean Christopherson , Vitaly Kuznetsov , linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, Joerg Roedel , 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On 24/06/21 12:17, Nicholas Piggin wrote: >> 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. >> >> 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 >> 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. Sure, but that would leave us with longer function names (gfn_to_pfn_page* instead of gfn_to_pfn*). So the "safe" use is the one that looks worse and the unsafe use is the one that looks safe. > And are gfn_to_page cases also > vulernable to the same issue? No, they're just broken for the VM_IO|VM_PFNMAP case. Paolo > So I think it could be marked deprecated or something if not everything > will be converted in the one series, and don't need to touch all that > arch code with this patch. _______________________________________________ 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 X-Spam-Level: X-Spam-Status: No, score=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86234C49EA6 for ; Thu, 24 Jun 2021 10:21:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62765613FB for ; Thu, 24 Jun 2021 10:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232077AbhFXKX1 (ORCPT ); Thu, 24 Jun 2021 06:23:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52654 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbhFXKX0 (ORCPT ); Thu, 24 Jun 2021 06:23:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624530067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=OyOYIhkFlD72RXa4ApycBznJ8h/A4rxQkZYFz4zqo5MtkH1geetKyPWMfBX0ch0jh7q3Lg qnz7zGgvlyQUIzPbypEimxNaD0+gpIcj0/R+UxQuP9AGOacLVchr1yQsGXdxC66zyvRmgz DHDojJLPq7Dlhzp9U4RjDK0rp/NxRo4= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-Fjdr-hPEMzadFpTuMK8D_A-1; Thu, 24 Jun 2021 06:21:05 -0400 X-MC-Unique: Fjdr-hPEMzadFpTuMK8D_A-1 Received: by mail-ed1-f70.google.com with SMTP id m4-20020a0564024304b0290394d27742e4so3072666edc.10 for ; Thu, 24 Jun 2021 03:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=h36SwbMjj4LiGGp9Jd8Sd/acmBCy2SYfrEZhmTa5Ll3+R0hxrcrEKf5SaQNk+V7SnJ lFGT/smus44gjZ++k1WPU0UNSNwVk6kMCEo/1IMjRm+Yb46jMm2wrhEa31kOApmnc9HT ySrI/XBkAwLUZhQkNzh/ytOFKLxuFKcjE0p6q6Drx5uOpcU6TVzEqi3QJjGCl4i3wTwY qy2wbDrfLkH147ci4/A7ITXZqNZiG+QvdAnKRvS+vD2VG0xoTN2MWfV/mjTmYGuC3DjX ctwGjgiuKICXgc+En/RXqWn6Vw9/OXrFenqacml4ddvYhl8+CR+3FTat2DE5WUPelOp/ K6gQ== X-Gm-Message-State: AOAM5329bJWecBHGc0pEL3ZsXrq4heQH1CJNiZOkyLPRv1Uo479j50u5 /+FuoTJ4cArXWlXE7zcJ4Z68w/SxQl7yOmJZGHFgM4L0G2F4sa70Hz63phB57r3a8DVMetSqEPU uKWzTwd1yvmXuMyUvN1Va9Q== X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001628edb.214.1624530064584; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs51nnE9ArY9tBUvtcT3K4P6rQ2AL9pfX67ccTlvEZ5+BaJldlaSdGdhR+tmPYnfTJgtakmA== X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001609edb.214.1624530064420; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id e7sm493571ejm.93.2021.06.24.03.21.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:21:03 -0700 (PDT) Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn To: Nicholas Piggin , Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , 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> <1624529635.75a1ann91v.astroid@bobo.none> From: Paolo Bonzini Message-ID: Date: Thu, 24 Jun 2021 12:21:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1624529635.75a1ann91v.astroid@bobo.none> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On 24/06/21 12:17, Nicholas Piggin wrote: >> 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. >> >> 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 >> 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. Sure, but that would leave us with longer function names (gfn_to_pfn_page* instead of gfn_to_pfn*). So the "safe" use is the one that looks worse and the unsafe use is the one that looks safe. > And are gfn_to_page cases also > vulernable to the same issue? No, they're just broken for the VM_IO|VM_PFNMAP case. Paolo > So I think it could be marked deprecated or something if not everything > will be converted in the one series, and don't need to touch all that > arch code with this patch. 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 X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D48EC48BDF for ; Thu, 24 Jun 2021 10:21:40 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3AF2613FB for ; Thu, 24 Jun 2021 10:21:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3AF2613FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4G9blR2DXcz3bxk for ; Thu, 24 Jun 2021 20:21:39 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OyOYIhkF; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OyOYIhkF; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=216.205.24.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=pbonzini@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OyOYIhkF; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OyOYIhkF; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4G9bkv5vWqz2xv5 for ; Thu, 24 Jun 2021 20:21:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624530067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=OyOYIhkFlD72RXa4ApycBznJ8h/A4rxQkZYFz4zqo5MtkH1geetKyPWMfBX0ch0jh7q3Lg qnz7zGgvlyQUIzPbypEimxNaD0+gpIcj0/R+UxQuP9AGOacLVchr1yQsGXdxC66zyvRmgz DHDojJLPq7Dlhzp9U4RjDK0rp/NxRo4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624530067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=OyOYIhkFlD72RXa4ApycBznJ8h/A4rxQkZYFz4zqo5MtkH1geetKyPWMfBX0ch0jh7q3Lg qnz7zGgvlyQUIzPbypEimxNaD0+gpIcj0/R+UxQuP9AGOacLVchr1yQsGXdxC66zyvRmgz DHDojJLPq7Dlhzp9U4RjDK0rp/NxRo4= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-dutDw9YzOEWQskIZQ-BA5Q-1; Thu, 24 Jun 2021 06:21:05 -0400 X-MC-Unique: dutDw9YzOEWQskIZQ-BA5Q-1 Received: by mail-ej1-f70.google.com with SMTP id f1-20020a1709064941b02903f6b5ef17bfso1810913ejt.20 for ; Thu, 24 Jun 2021 03:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=UiUtWJA0M8EAaPylKUK5wws0+W4ammtXIoigXP1rTpJ/KlNBWQyZuuYmKXIAPXygwf /xLOwDzgXqlE2oD/WyyJFTW4NkKBACpzv2G6sWv4wb28LThQcgXQtsM1QvAPFgip1vsS PU4IKPWc6S9c6hLh6TRj7v8mb85dvGRDcVPwiuwohTwax/88LQnm1xcHxIf4s6VilU23 HDuJ2dUOTf2CKKPngWZIh6FCS00Ev1e/s2ruTbsEv9dmWIOE/SoaVUwO/75+sRPOoNHM pAsldUFLnWeUIf4eRuztHRgI6PiYHB1PImKFKA/MGFV4abAUa1Ei6bw1WFEUSrGhxwDn +tQQ== X-Gm-Message-State: AOAM533SeEshGn/d1oB8npP79uUszuxYSexPwhEvkikn9Zb5ZOKBlXpw fcUZANfRj2tbOLswoTJoIqE4HfErhwq1PUS8TTXSLNglGl9ek1sieMcUMDTp50dxrDoPwqnGm+e bHKak5enHBG2psZV26SEZGjoUbw== X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001624edb.214.1624530064584; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs51nnE9ArY9tBUvtcT3K4P6rQ2AL9pfX67ccTlvEZ5+BaJldlaSdGdhR+tmPYnfTJgtakmA== X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001609edb.214.1624530064420; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id e7sm493571ejm.93.2021.06.24.03.21.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:21:03 -0700 (PDT) Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn To: Nicholas Piggin , Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang 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> <1624529635.75a1ann91v.astroid@bobo.none> From: Paolo Bonzini Message-ID: Date: Thu, 24 Jun 2021 12:21:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1624529635.75a1ann91v.astroid@bobo.none> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , kvm@vger.kernel.org, Suzuki K Poulose , Alexandru Elisei , intel-gfx@lists.freedesktop.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kvmarm@lists.cs.columbia.edu, Will Deacon , James Morse , kvm-ppc@vger.kernel.org, Sean Christopherson , Vitaly Kuznetsov , linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Jim Mattson Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 24/06/21 12:17, Nicholas Piggin wrote: >> 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. >> >> 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 >> 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. Sure, but that would leave us with longer function names (gfn_to_pfn_page* instead of gfn_to_pfn*). So the "safe" use is the one that looks worse and the unsafe use is the one that looks safe. > And are gfn_to_page cases also > vulernable to the same issue? No, they're just broken for the VM_IO|VM_PFNMAP case. Paolo > So I think it could be marked deprecated or something if not everything > will be converted in the one series, and don't need to touch all that > arch code with this patch. 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 X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE3AAC48BDF for ; Thu, 24 Jun 2021 10:23:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 871D061248 for ; Thu, 24 Jun 2021 10:23:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 871D061248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2fCClTJHoxxzLiDbQIpDnNcS8E8GPWuZDidBZk9g4h8=; b=zVeac8b55RfvADLAGhAWWAE3W/ KFOd2uwIiswRZ4PiEpc80MzlsceDYiZ29QxzYnDy8rbziviSSvSuRqjT/8joN9jHYTe3AMX+01Rxj pdUt9J9WvzFlK0EhEgGjRxQ1l6MOS2huKQNGmnHwTvPvhkwLbOvvdkMLFOb/YdGlfbklKzTCJ/7Ot T/XUSh7MDPnSMqZ9TD30Bpqk3UbEvB9hKzN2CYQm4lrkiZnHZGJXpA06ChvPDciA3WaWTiz2jOU4y ihAEH1fQ4vLWLt1ODvOsGvy2Jbyvzr3CHZ5YfG3d9/MZ/Ar06u0VJ6bnfRdsri3xA96nDfQLRCxb2 NG1RlL9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwMU4-00E2YZ-S0; Thu, 24 Jun 2021 10:21:21 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwMTs-00E2UX-2g for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 10:21:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624530066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=E2Yz+PcJ0JHFCL70o4ZXv4iETVHGI8YjF47/i7s+TF1duJG0pGB9L6xt8HitT3BCON1jYd yXVZWomqUNypd+Sd6+2amG0I+2jqs/Bvt3ccSQqJTAXmbYuL48MXsLtH2tAy92YzQWfAbL rclv4Yco1CHyfL3SZWT89BuqbIEuPcs= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-jd3xTME0NPyFuf8t3cPOug-1; Thu, 24 Jun 2021 06:21:05 -0400 X-MC-Unique: jd3xTME0NPyFuf8t3cPOug-1 Received: by mail-ej1-f70.google.com with SMTP id o12-20020a17090611ccb02904876d1b5532so1833920eja.11 for ; Thu, 24 Jun 2021 03:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oKXkBJKG47HF5zZ+T34yALxUp2DCGSnnk7HiRaaGJBk=; b=mgxw1NtwvYO6oU0gbdWEBg3H8FgVsvr0lme2AQJO2TPxOypuSmQ3VlidvZ5uXkHD7p pcND7nUpzV8Ev9JnnMtP5o4dCqoxacrhzpWrP6OI3GmK8UJXTpisvBrd/l4ZFLBDnKo/ Rggcv6/pGLDiCgFlQTSSqqyJQ2FwCdyqJU0JzySSM/A1QBN1koJgL1qqcHqb4QOfX6rm P3vOz4B0hb39eEu4mH+mt34U5HScjGr76oRcQP7gCkwOiT1bntqrElu+tBLoAexNgLah 8tBM5KVjAV9jv9Pe0QQREGWGM3Iy3/kmEP7wi2sVlwMg70r/9TG4SYibeIZWdCdnZ5np sKYw== X-Gm-Message-State: AOAM531mpRBsGAI1OSWMmq8QMmy7FZkTrFKEJPc8X7UKwdxzOUKOw00e B2eZChUh7RdFRQf+t3SNXBeGTQ/QtiqFBGuq5wxjp5TAyQEGzKJss9yhDxu81PkVcjQoVcg+KKy bPL9uS0yVkwmgQz6ojNX95Q2KmBCsTb1WPuY= X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001639edb.214.1624530064585; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs51nnE9ArY9tBUvtcT3K4P6rQ2AL9pfX67ccTlvEZ5+BaJldlaSdGdhR+tmPYnfTJgtakmA== X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr6001609edb.214.1624530064420; Thu, 24 Jun 2021 03:21:04 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id e7sm493571ejm.93.2021.06.24.03.21.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:21:03 -0700 (PDT) Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn To: Nicholas Piggin , Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , 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> <1624529635.75a1ann91v.astroid@bobo.none> From: Paolo Bonzini Message-ID: Date: Thu, 24 Jun 2021 12:21:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1624529635.75a1ann91v.astroid@bobo.none> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_032108_365042_4CED38E2 X-CRM114-Status: GOOD ( 20.20 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 24/06/21 12:17, Nicholas Piggin wrote: >> 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. >> >> 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 >> 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. Sure, but that would leave us with longer function names (gfn_to_pfn_page* instead of gfn_to_pfn*). So the "safe" use is the one that looks worse and the unsafe use is the one that looks safe. > And are gfn_to_page cases also > vulernable to the same issue? No, they're just broken for the VM_IO|VM_PFNMAP case. Paolo > So I think it could be marked deprecated or something if not everything > will be converted in the one series, and don't need to touch all that > arch code with this patch. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel