Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2297126pxu; Fri, 9 Oct 2020 12:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrz68FTQ+d9nCVr2HAcoG85160LpALSh3Nvt13xhirMJlLecO8LlW86+LbbEGDUx2KgT1M X-Received: by 2002:a17:906:8295:: with SMTP id h21mr7864545ejx.278.1602273588341; Fri, 09 Oct 2020 12:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602273588; cv=none; d=google.com; s=arc-20160816; b=DMRSkn6BeWgz/8mLMQL+6NZS4JxnCxQjkP3k2YdGix0Re0Bhd1FCBakquTHCUBk6E/ Kt4UFdP1D3DqP+tSJU4bptfZ2DagJRyLES6X6OChgH4EYH8OQ7yOLcSQ68kG0Pb8cSD3 0GlQ5Uh1c0qtlfw0sPlaeIPkFudtJjxwu55V6S0/hmi9Apeygk8uqHJhqvOq7iQu3y8m 9zV9RbSYHcU8Rsl23B8ZcOWUapHMGcumWtjocB0vsXoMC+EVrSkwymUuUDtFUrzqKbLu EaZbr9wLjVMjw2Gn3gcIksbjaFfslpzRwU7rAvL7D07XlLp3cZPg8KY9edp1QIwdwsGR k1bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ySYcyJJ3sOG5YMU4GVRG3lJgkS40H3Co9lykIQ/+sFM=; b=omSTG/l9RiLzEM8/utVna/zHujayHfw2bAo3NEcwkZcysdzjb93v1SypOnCZM1Hmeq 4WfBcd6U4WszGDwazEnio0izICejTkpRDo+nEvEGHJOeqLeyHtnVBe4fWSehvc89NU7P tJv+9wDNbADRzeLlOhyrFGKFfRYh24itdJxknRCEAyMuOFfaZdFpPiI0CFGF2LJDsRaW T2QZzKQThSUH45nWWZx4WdRoaxZ5TX60BzsSP5QiEqyVzAGgaJpPHE8Cw2949G5vsoXN aR6l8p+IwMD7nRfV1hWJG/w8V9gz3uf5DOB0e6DcOihIV2dugt+VF0kjoqzpFulKhH2H X3yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="hXg/sBmJ"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si6954546edw.38.2020.10.09.12.59.25; Fri, 09 Oct 2020 12:59:48 -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=@ffwll.ch header.s=google header.b="hXg/sBmJ"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388770AbgJITbe (ORCPT + 99 others); Fri, 9 Oct 2020 15:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388676AbgJITbd (ORCPT ); Fri, 9 Oct 2020 15:31:33 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C0BCC0613D7 for ; Fri, 9 Oct 2020 12:31:33 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id f10so10018467otb.6 for ; Fri, 09 Oct 2020 12:31:33 -0700 (PDT) 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=ySYcyJJ3sOG5YMU4GVRG3lJgkS40H3Co9lykIQ/+sFM=; b=hXg/sBmJSAZ0qahG3krkGP++08QEfAEMObPCQZW5DNP0jHoKuyBCogfErWstdU2/EU 4l6+qOuyilHrRv6mQOMt0oKIaOKSkC6+0fry3akULqNmxrd1f0WP5RaWhgCgr3v3riEu U91Cvo/twFXWkhQ9v9MjLxy+AB8Sb+wfsvumA= 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=ySYcyJJ3sOG5YMU4GVRG3lJgkS40H3Co9lykIQ/+sFM=; b=eqZWqSE1N0kTL5clwhUC/mQq9qUl+bX9qq+6h30aGjiiiQVESwqN4n0fbqkA0E6iZ6 ivIaAwVAQ6ornFGOvvHv2D1EM0LQ+zEhPXaRVMc+G3+HVXvBHNe2Wlm6N0MEZzJuMLso LhnEC07g0Xcuiipak/dSwwjBSsrjtO8EZmxDjttsKtt6V0nx3UZ/bZB8Mc7r8lWMJcEd kOYkhDKA8PxyPIosK8n7/ni59UrDYc4ZTBard5hXwKv1E3E+N2Tw23C6IJHzzR6awugf iQzN0njermAU7Ul1meRxIGrpHakCTxzkxb2CdlMp5GCAuDAocZ40ilIc/rcKrR6MW49Z QSDA== X-Gm-Message-State: AOAM5329wm+/wgGd00dhWvVN1+u77jplRujtEHsDK41c0Re/9mbs+lbM gICSYM3kgRzT8Xt/9ROJw83xJx0ivMw6brkp3OKZzg== X-Received: by 2002:a05:6830:1647:: with SMTP id h7mr10464001otr.281.1602271892694; Fri, 09 Oct 2020 12:31:32 -0700 (PDT) MIME-Version: 1.0 References: <20201009075934.3509076-1-daniel.vetter@ffwll.ch> <20201009075934.3509076-10-daniel.vetter@ffwll.ch> <20201009123421.67a80d72@coco.lan> <20201009122111.GN5177@ziepe.ca> <20201009143723.45609bfb@coco.lan> <20201009124850.GP5177@ziepe.ca> <20201009180145.GB5177@ziepe.ca> In-Reply-To: <20201009180145.GB5177@ziepe.ca> From: Daniel Vetter Date: Fri, 9 Oct 2020 21:31:21 +0200 Message-ID: Subject: Re: [PATCH v2 09/17] mm: Add unsafe_follow_pfn To: Jason Gunthorpe Cc: Mauro Carvalho Chehab , DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , linux-s390 , Daniel Vetter , Kees Cook , Dan Williams , Andrew Morton , John Hubbard , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Linus Torvalds Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 9, 2020 at 8:01 PM Jason Gunthorpe wrote: > > On Fri, Oct 09, 2020 at 07:52:05PM +0200, Daniel Vetter wrote: > > > > > If this is the case, the proper fix seems to have a GFP_NOT_MOVABLE > > > > flag that it would be denying the core mm code to set __GFP_MOVABLE. > > > > > > We can't tell from the VMA these kinds of details.. > > > > > > It has to go the other direction, evey mmap that might be used as a > > > userptr here has to be found and the VMA specially created to allow > > > its use. At least that is a kernel only change, but will need people > > > with the HW to do this work. > > > > I think the only reasonable way to keep this working is: > > - add a struct dma_buf *vma_tryget_dma_buf(struct vm_area_struct *vma); > > - add dma-buf export support to fbdev and v4l > > - roll this out everywhere we still need it. > > It seems to me there is a technical way forward to restore user > compat, so it is really no different than RDMA/DRM pain we both > suffered before. > > Thus no justification to NAK it. If media wants things to keep working > they have to do the technical path like you outline above. > > > Realistically this just isn't going to happen. > > If your series goes ahead it will get solved. Someone will take on the > huge project to either add DMA buf to the drivers people still care > about, or do the work above to transparently handle in kernel. > > If we allow things to keep working without consequence then nobody > will do it. > > The only reason we did the 4 years of work in RDMA was because Linus > went in and broke the uABI for a security fix. It was hundreds of > patches to fix it, so I don't have much sympathy for "it is too hard" > here. Oh fully agreeing with you here, I just wanted to lay out that a) there is a solid plan to fix it and b) it's way too much work for me to just type it as a part of a "learn me some core mm semantics" project :-) I was hoping that we could get away with a special marker for problematic vma, and filter those out. But after all the digging I've noticed that on anything remotely modern, there's just nothing left. Device memory management has become massively more dynamic in the past 10 years. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch