Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1030720pxb; Wed, 1 Sep 2021 15:46:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTnEIfqkAoweeLDgU4dmBWT1G2t+8cZyrVED7g3WySV4Sy+ymOMMiyos7vQ+7v4WFtGJwH X-Received: by 2002:a17:907:76e5:: with SMTP id kg5mr212808ejc.474.1630536397103; Wed, 01 Sep 2021 15:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630536397; cv=none; d=google.com; s=arc-20160816; b=Qg+Db7/Zmvh9wVybY6wubRYbFllL6te5dTOL7Q8zLhh8giJT6INTzg5y7uv4dsGnQy aub7uIuLKemId36zmRthu+aDfsvyjza6e5DgXQEF/TTkmYXx0G3xSuEi2Gm5xjxOrufB 7K7nhIJh9h+DK47P+K6px8GCSQ7rlqLuVJYmkncsN4kHZzFyLLzGHkWp18/XY+NSeVx1 G1zmRG7BJLI11rJlig0N2ApvNHNQks1sr0N8IeYm84R7ivduUzHKe5sFj4F4l2vSMglI jpWZubRZMK3R8C+f2e/xRrHlfgW1Yyl7erGWACLcpsQZ14JRBbLL+VcrP2kR+HiyW5ne mZpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=RxcxB4lK31NjGbII0ooze/CUvZYL+gy34v0DnD3PDZU=; b=dgrn/JtNhwAbAWsLMurxy40V24YdrN0Upu5+XOC38vi/xvg3Hlajj8NS2UIW/Dca4w w5ABONglnSWSHA+c03C88Xj0e8ANUPejXKBGoi5oVpPVGOORX6JAfRea1ms4YMfezHec DlopVX4iPlK19lcHV80aAkBzJeuKcJ3fEhaoqdiBc0tW7OYbRNgEOcH2QsCF7wEEPVtC 7/lGa62uPn/PknJgvzlOKlSVejLNqRT7wZVkn4F8wSzWsiQiuvcfE3JvGtqV/nDwVqEK tHhTg2wCtG1dVgJeDTJEjDKVe/ixxkOGDb6JkKYZU8xJDhHW2wnuojCT3WfVrBmRzzTZ qfrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 c19si1193817ejj.206.2021.09.01.15.46.05; Wed, 01 Sep 2021 15:46:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243451AbhIAWEQ (ORCPT + 99 others); Wed, 1 Sep 2021 18:04:16 -0400 Received: from mail110.syd.optusnet.com.au ([211.29.132.97]:60031 "EHLO mail110.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232075AbhIAWEM (ORCPT ); Wed, 1 Sep 2021 18:04:12 -0400 Received: from dread.disaster.area (pa49-195-182-146.pa.nsw.optusnet.com.au [49.195.182.146]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 19347110DA0; Thu, 2 Sep 2021 08:03:09 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1mLYK4-007bho-FA; Thu, 02 Sep 2021 08:03:08 +1000 Date: Thu, 2 Sep 2021 08:03:08 +1000 From: Dave Chinner To: Felix Kuehling Cc: Christoph Hellwig , "Sierra Guiza, Alejandro (Alex)" , akpm@linux-foundation.org, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, jgg@nvidia.com, jglisse@redhat.com Subject: Re: [PATCH v1 03/14] mm: add iomem vma selection for memory migration Message-ID: <20210901220308.GL2566745@dread.disaster.area> References: <20210825034828.12927-1-alex.sierra@amd.com> <20210825034828.12927-4-alex.sierra@amd.com> <20210825074602.GA29620@lst.de> <20210830082800.GA6836@lst.de> <20210901082925.GA21961@lst.de> <11d64457-9d61-f82d-6c98-d68762dce85d@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11d64457-9d61-f82d-6c98-d68762dce85d@amd.com> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=F8MpiZpN c=1 sm=1 tr=0 a=QpfB3wCSrn/dqEBSktpwZQ==:117 a=QpfB3wCSrn/dqEBSktpwZQ==:17 a=kj9zAlcOel0A:10 a=7QKq2e-ADPsA:10 a=7-415B0cAAAA:8 a=f3XvwggIp9kaoS7fsTAA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Sep 01, 2021 at 11:40:43AM -0400, Felix Kuehling wrote: > > Am 2021-09-01 um 4:29 a.m. schrieb Christoph Hellwig: > > On Mon, Aug 30, 2021 at 01:04:43PM -0400, Felix Kuehling wrote: > >>>> driver code is not really involved in updating the CPU mappings. Maybe > >>>> it's something we need to do in the migration helpers. > >>> It looks like I'm totally misunderstanding what you are adding here > >>> then. Why do we need any special treatment at all for memory that > >>> has normal struct pages and is part of the direct kernel map? > >> The pages are like normal memory for purposes of mapping them in CPU > >> page tables and for coherent access from the CPU. > > That's the user page tables. What about the kernel direct map? > > If there is a normal kernel struct page backing there really should > > be no need for the pgmap. > > I'm not sure. The physical address ranges are in the UEFI system address > map as special-purpose memory. Does Linux create the struct pages and > kernel direct map for that without a pgmap call? I didn't see that last > time I went digging through that code. > > > > > >> From an application > >> perspective, we want file-backed and anonymous mappings to be able to > >> use DEVICE_PUBLIC pages with coherent CPU access. The goal is to > >> optimize performance for GPU heavy workloads while minimizing the need > >> to migrate data back-and-forth between system memory and device memory. > > I don't really understand that part. file backed pages are always > > allocated by the file system using the pagecache helpers, that is > > using the page allocator. Anonymouns memory also always comes from > > the page allocator. > > I'm coming at this from my experience with DEVICE_PRIVATE. Both > anonymous and file-backed pages should be migrateable to DEVICE_PRIVATE > memory by the migrate_vma_* helpers for more efficient access by our > GPU. (*) It's part of the basic premise of HMM as I understand it. I > would expect the same thing to work for DEVICE_PUBLIC memory. > > (*) I believe migrating file-backed pages to DEVICE_PRIVATE doesn't > currently work, but that's something I'm hoping to fix at some point. FWIW, I'd love to see the architecture documents that define how filesystems are supposed to interact with this device private memory. This whole "hand filesystem controlled memory to other devices" is a minefield that is trivial to get wrong iand very difficult to fix - just look at the historical mess that RDMA to/from file backed and/or DAX pages has been. So, really, from my perspective as a filesystem engineer, I want to see an actual specification for how this new memory type is going to interact with filesystem and the page cache so everyone has some idea of how this is going to work and can point out how it doesn't work before code that simply doesn't work is pushed out into production systems and then merged.... Cheers, Dave. -- Dave Chinner david@fromorbit.com