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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 33536C63798 for ; Fri, 20 Nov 2020 15:45:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE5A322252 for ; Fri, 20 Nov 2020 15:45:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="dfRfRtqD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729932AbgKTPpO (ORCPT ); Fri, 20 Nov 2020 10:45:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729927AbgKTPpO (ORCPT ); Fri, 20 Nov 2020 10:45:14 -0500 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99DD5C0617A7 for ; Fri, 20 Nov 2020 07:45:11 -0800 (PST) Received: by mail-oi1-x241.google.com with SMTP id k26so10908936oiw.0 for ; Fri, 20 Nov 2020 07:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Id0PLSSDAy7IJx/4b1nt//hEs7fdMVA6YPiIkR5zClg=; b=dfRfRtqDF1RrZwS/1drnyGXFKRYG5zPQqdVzf4oNa4Km4m+WAgPk+uu7TX/an2oDZ2 vBVLU/Buv8L5yJxUzKzQqx57WMgV3BOEQu6XrPSxvCgoD7tiafoeKNJTaeHl6caT1Y4y wW2aFKG1iJ1Hj3bcVkn0J1Hf8qog45qEjZLYM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Id0PLSSDAy7IJx/4b1nt//hEs7fdMVA6YPiIkR5zClg=; b=THi7aFhDhLMbWys77E70QoKWcbWvBXavgTwSLTxawAogQwrcYyXEYOHFYWtVtQqcpc rUDFJXotR5rOxAQYMuRy2NMHr9fGfyoI1xwOIaYbA0nHM1s/JV176t3fpaLgWj8m5Wxe YJgctDsBewyDohHLnmk+HGxBPF9mwFrZz0x1czsgMzyq8i6+RXrxs5InGJfVmBRqRovU K/9phnqg277EuIZyHDyDr5PMsCvyKgbLhQz8WHca1Wk5lxLHtDfrcXkhYoxrkOU3i0vo ZiXYkvO3BosqlUrNZFXXm1+meFjrmTSifkHDmeVsE6GLQfkpkllMgccj5PdMd5zcsjP0 cWbw== X-Gm-Message-State: AOAM530mkYwTGRe8tag/+kcOkwhkbOCV+K70srOapyqZS1pZlXha2xhQ 1gEpX6zWCsw3GVaDEeQZMQ75eIToD64B7WzyPXVZ8w== X-Google-Smtp-Source: ABdhPJxZSOR3YzYlAKw2cDHpm+laMCMM24uLZLKA5lft7iigCepfxe2uQ21R2KlDjhY86FMJ7oZu/z5k8KghnWux0Yo= X-Received: by 2002:aca:4f14:: with SMTP id d20mr6827257oib.14.1605887111047; Fri, 20 Nov 2020 07:45:11 -0800 (PST) MIME-Version: 1.0 References: <20201119144146.1045202-1-daniel.vetter@ffwll.ch> <20201119144146.1045202-17-daniel.vetter@ffwll.ch> In-Reply-To: From: Daniel Vetter Date: Fri, 20 Nov 2020 16:44:59 +0100 Message-ID: Subject: Re: [PATCH v6 16/17] RFC: kvm: pass kvm argument to follow_pfn callsites To: Paolo Bonzini Cc: DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , Daniel Vetter , Christoph Hellwig , Jason Gunthorpe , Kees Cook , Dan Williams , Andrew Morton , John Hubbard , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, Nov 20, 2020 at 4:33 PM Paolo Bonzini wrote: > > On 19/11/20 15:41, Daniel Vetter wrote: > > Both Christoph Hellwig and Jason Gunthorpe suggested that usage of > > follow_pfn by modules should be locked down more. To do so callers > > need to be able to pass the mmu_notifier subscription corresponding > > to the mm_struct to follow_pfn(). > > > > This patch does the rote work of doing that in the kvm subsystem. In > > most places this is solved by passing struct kvm * down the call > > stacks as an additional parameter, since that contains the > > mmu_notifier. > > > > Compile tested on all affected arch. > > It's a bit of a pity, it's making an API more complex (the point of > gfn_to_pfn_memslot vs gfn_to_pfn is exactly that you don't need a > "struct kvm*" and it's clear that you've already done the lookup into > that struct kvm. Yeah I noticed that, I think pushing the lookups down should work, but that's a fairly large-scale change. I didn't want to do that for the RFC since it would distract from the actual change/goal. -Daniel > But it's not a big deal, and the rationale at least makes sense. So, > > Acked-by: Paolo Bonzini > > Paolo -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch