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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 2F534C43467 for ; Fri, 9 Oct 2020 19:31:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2874E22282 for ; Fri, 9 Oct 2020 19:31:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="hXg/sBmJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2874E22282 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4CD7B6B005C; Fri, 9 Oct 2020 15:31:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 458496B005D; Fri, 9 Oct 2020 15:31:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 320CC6B0062; Fri, 9 Oct 2020 15:31:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id 008A56B005C for ; Fri, 9 Oct 2020 15:31:34 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 99E4B8249980 for ; Fri, 9 Oct 2020 19:31:34 +0000 (UTC) X-FDA: 77353381308.03.flag01_100e54e271e3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 70EA128A4E8 for ; Fri, 9 Oct 2020 19:31:34 +0000 (UTC) X-HE-Tag: flag01_100e54e271e3 X-Filterd-Recvd-Size: 5686 Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Fri, 9 Oct 2020 19:31:33 +0000 (UTC) Received: by mail-ot1-f66.google.com with SMTP id e20so9569665otj.11 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=VNb4MGwrjeiQPJbvAbOMyFjHr2MJBy0aZaahuydiCKa+a74WtmYXsHBDxayB7aGB0B a9KEFeBhnD3X+Twjnbfs+9fO+n9KR/y/92iggCVt3HTHHAO82f0w71zEE4kkxmJ+nVHG 6o1gSjLrVBKL/6mnmBOXIaB3rdeCGdBP7YGdSnP8akZChN9CYqgDz0FoPTEeZs/ugkfG 18AqD4g0lBXxLusZGIOKez/SzuFIxGRTGjde4/RaKsDQGbGuXVNvD7CsclBA6+pS7G7C 1sThULC9y3JRZ3iGA6tDypeOkcILDxFHUtzMG/hBokAkRD0NRnEOzLwcsfji4acC/dZV nlpw== X-Gm-Message-State: AOAM532y5v777BQZwrrk8Ocf0FYrp89ItxRxlyOuBWhvnpFKJYs+gKyo 2MRbaLamJ3w0EuPevabaAwqOUU/6MrIV5NWrcxImFg== X-Google-Smtp-Source: ABdhPJyt5F3KZ1qsKCAYucLfuox0J0LV3cC5oyQ21k96htMG1d9Z2x9WEkAwzZmqGd0OEOmrQ583B82fEkZeh8i2caA= 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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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