Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2167339pxb; Mon, 22 Feb 2021 23:26:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfqQzfunuIs4uAlPmZu/f7XGfYjphrjGYhteNxCJcz6CI4z8GNleIWuww6QgMD0ItZxHZw X-Received: by 2002:a17:906:d89:: with SMTP id m9mr25007434eji.509.1614065205403; Mon, 22 Feb 2021 23:26:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614065205; cv=none; d=google.com; s=arc-20160816; b=gGw5Fn2V6vYXCG8ypHTpbJyNlSkZeEAdzO9saB41my2u15Lr11x5//zTIGehXNX1Y6 2aynlFkXJlzLV3PTBtYmy9dv6BVZdYQSC/3QND37Z45HuJsZh2Vl57MdD9dR8QOhrvDX YwA1SH96tAqAFGAzXX35XivFEd1fxxSZhBFD0ZHMaXc0JbJimAOA67xsW4k+iqduXdZa Db5rtymsmAawDTWdKeaB+pjZFHZrvWW8W1uwRSXpbBvC4+8fvuxGGKZQaT6zTr2iPSCR U5RfV1Q0ONPqHmdgY2U7wxoUfAsvYfCVSD5kB6WSmOFsiXNM7K6nniQKBRgpIK24j3H/ SFqA== 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=DpaF+XrlRPqLNZ9QA+WPiUs8joOVV3LopnoOJY64BvY=; b=ja27axFKRuwcwBLM9TYejwjZkYjsyuU6eNDMKI8um6C3cjIDYq6XyH6Fn8z948gPAu waljT80zP4Fq5Cd1dSpw/kuPHL6TkRgJGY0seDiVsylQu0AcwL4uYNCKhgrj4ksJfiI0 FPM65Hy0K9jZXUMmDXEuyYpR5F5TOKAIuOrA2n1AmLkRqhxxq2waCz+dsMKTj+1LE8NU mlhOn1R83/TbC7fqSaAoOUSgdrdx/iKnctLX+XY9bAj6eKYiW6mGgkcj7R/LZaPMFVvx x0bb5oZWl2oVem4COwesYwm2smqQxDSOOMizV3Q6u/FJ8IMazLNp+tNT8uuN+Unn7uTG azZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=NNHrJmW2; 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 v7si3924870ejj.383.2021.02.22.23.26.22; Mon, 22 Feb 2021 23:26:45 -0800 (PST) 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=NNHrJmW2; 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 S231859AbhBWHXi (ORCPT + 99 others); Tue, 23 Feb 2021 02:23:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231837AbhBWHXQ (ORCPT ); Tue, 23 Feb 2021 02:23:16 -0500 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BA17C06174A for ; Mon, 22 Feb 2021 23:22:35 -0800 (PST) Received: by mail-ot1-x32d.google.com with SMTP id s6so14645007otk.4 for ; Mon, 22 Feb 2021 23:22:35 -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=DpaF+XrlRPqLNZ9QA+WPiUs8joOVV3LopnoOJY64BvY=; b=NNHrJmW2jS2V+5T5AnL3km3Re94L4xGJBmhxFBh2hds03thqQwHd7qJsFgwTZivSdQ NSO3FN0AG5yjRNFwS65SNpwo53eWoeYKuUazm8g91zmj8b91UhpkIFl/QsUA84rbArMP C7qosv5wai1B+yRpvR75pcLBJGTVy5QbiJJC4= 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=DpaF+XrlRPqLNZ9QA+WPiUs8joOVV3LopnoOJY64BvY=; b=hRRcPmBU5mgwfO1P07ppiHpvtFc65Y1RnLUgVd5ub7DxCforMsrkynkmHLsRbaOAk5 tblgIxNTvnBH2BIChaT5zDNoyKlA1C8GoAp5x5+5lrnAZoHQker29UOryiFVvMpC0IjN qeF4jh+SDkPo3/VpWrSLKzr1rzMIpiP9fPsV6K5waWtrew5NxkB/gPIG3x7cON+6rEIL 1unfyxxqKXfEgnUYm9g9H4sPsM897QuWuWdRKyPb4y9J7nBtcVr3Rgn6lV7hugHGRTC3 IKJ3FoiG3/evKdzvDfEqxETZpCqHUUs3k1vbfj7WXbRuNaojSkzX3fokw+UEP9sBgN0Z fs/A== X-Gm-Message-State: AOAM532z6dn443U1qOPk51n6JC7laGLbotqyfYy/O7IYCPMYs9EnGjMf v9b1EWPA1gR2DyN0Cq6neAG0gmEtYoPMvTfdfsg9lg== X-Received: by 2002:a9d:2265:: with SMTP id o92mr19488004ota.188.1614064954922; Mon, 22 Feb 2021 23:22:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Daniel Vetter Date: Tue, 23 Feb 2021 08:22:23 +0100 Message-ID: Subject: Re: [PULL] fixes around VM_PFNMAP and follow_pfn for 5.12 merge window To: Linus Torvalds Cc: Linux Kernel Mailing List , dri-devel , Linux MM , "open list:DMA BUFFER SHARING FRAMEWORK" , Linux PCI Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 2:42 AM Linus Torvalds wrote: > > On Mon, Feb 22, 2021 at 2:25 AM Daniel Vetter wrote: > > > > Cc all the mailing lists ... my usual script crashed and I had to > > hand-roll the email and screwed it up ofc :-/ > > Oh, and my reply thus also became just a reply to you personally. > > So repeating it here, in case somebody has comments about that > access_process_vm() issue. > > On Mon, Feb 22, 2021 at 2:23 AM Daniel Vetter wrote: > > > > I've stumbled over this for my own learning and then realized there's a > > bunch of races around VM_PFNMAP mappings vs follow pfn. > > > > If you're happy with this [..] > > Happy? No. But it seems an improvement. > > I did react to some of this: commit 0fb1b1ed7dd9 ("/dev/mem: Only set > filp->f_mapping") talks about _what_ it does, but not so much _why_ it > does it. It doesn't seem to actually matter, and seems almost > incidental (because you've looked at f_mapping and i_mapping just > didn't matter but was adjacent. Yeah it doesn't matter, it just confused me, so I wrote a patch to remove it and get experts to tell me it actually really doesn't matter. So that's really the entirety of that one. Like I said, I mostly stumbled into this rat hole because I had some questions, wanted to understand stuff better, and the code did not provide consistent answers :-) > And generic_access_phys() remains horrific. Does anything actually use > this outside of the odd magical access_remote_vm() code? > > I'm wondering if that code shouldn't just be removed entirely. It's > quite old, I'm not sure it's really relevant. See commit 28b2ee20c7cb > ("access_process_vm device memory infrastructure"). > > I guess you do debug the X server, but still.. Do you actually ever > look at device memory through the debugger? I'd hope that you'd use an > access function and make gdb call it in the context of the debuggee? tbh I had no idea this exists, but yeah I've fired up gdb on some of the register dumper tools we have that use the pci mmap files, and after fixing some thinko in the first version it was still working after the conversion. From a quick git grep almost nothing wires this up, so yeah no idea whether it's still used. Definitely not useful for X hackery anymore. It is wired up for uio framework, and I guess for debugging userspace drivers this comes handy. Although letting your debugger do reads/writes to device registers sounds scary. -Daniel > Whatever. I've pulled it, and I'm not _unhappy_ with it, but I'd also > not call myself overly giddy and over the moon happy about this code. > > Linus -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch