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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F38AC433EF for ; Tue, 15 Feb 2022 12:15:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B71C56B0078; Tue, 15 Feb 2022 07:15:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AFA1E6B007B; Tue, 15 Feb 2022 07:15:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99A0B6B007D; Tue, 15 Feb 2022 07:15:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 845966B0078 for ; Tue, 15 Feb 2022 07:15:45 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 424A691E4E for ; Tue, 15 Feb 2022 12:15:45 +0000 (UTC) X-FDA: 79144910250.29.C8B31EB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP id A942340003 for ; Tue, 15 Feb 2022 12:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644927344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=li59JkksonHEim8N19eLLyTcVUoQZhmnR79T7jisS84=; b=N0ndL/Cn1apaefDfSHrZwZ2y/ErqTpF5dQFg/JTMuuDjJ/uaY4s7boj386eVVG10LTOelr Fo/kIn2mSDeYLpZ6VOJ2Ueau3MKKrbpJDLxEx5Ewzw+gmEvmPeYACdAIYd7XHJ0oaRJ/As r3YA2PQpQXoZZRHW77or5x2WGv9Rmuc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-208-vNhu_dCYMqGMUC5vQleSkw-1; Tue, 15 Feb 2022 07:15:40 -0500 X-MC-Unique: vNhu_dCYMqGMUC5vQleSkw-1 Received: by mail-wm1-f72.google.com with SMTP id q63-20020a1c4342000000b0037c2f539dd0so1135875wma.0 for ; Tue, 15 Feb 2022 04:15:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=li59JkksonHEim8N19eLLyTcVUoQZhmnR79T7jisS84=; b=n3LIR+1I+BSh/uv55SSZ76abSb7jGCx28BuEX7mAd+GEgTNJeMkFxN1agOIFZQMtK6 8mgtSYNd1EI2YSdNDl/lP/FXk54Sq0h2mI/zQxfRjFHICfBmJmLD67EC1giZ7Zj3HXwv yDPh1ApT4EZLofBx7f90YELL3mt9D1oEKw49ur3GWsx+pRcZyKQpWxm3GchnxE1qKeYz Cagt6BjQnTCNawnfGrOJueLtpWtbkPMS6YkKbG92H6qB/1ZckX6ac8V7c3W1ZRJdadGt wOd7vuaUhDa+DPldlXgjAJsvbMFvyHF22KxSAI9ybw0/AKDN/yX81wNY3ufMVnLT3efN n3IA== X-Gm-Message-State: AOAM531Xup8vrmSVgNDr6VsLPEsBNWLTGLZPbB1DpjPgNhz9nSAxV/is fqH8TQb98w9z0CiMXyL42FLyA+JFn99BeQT1qsCph+aRP98U5y2vJvki9CAEHWhZM/LbET75lHj 9Bu1oOavA61M= X-Received: by 2002:a05:6000:2ac:: with SMTP id l12mr3048017wry.639.1644927339743; Tue, 15 Feb 2022 04:15:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkXiKIPDmUKc3peLAnxWMPOpVfO+YZVnwiubxG8ybWR9d1yWHVTQW3fpFRYPoIV1z4/FG1xQ== X-Received: by 2002:a05:6000:2ac:: with SMTP id l12mr3047997wry.639.1644927339488; Tue, 15 Feb 2022 04:15:39 -0800 (PST) Received: from ?IPV6:2003:cb:c70e:3700:9260:2fb2:742d:da3e? (p200300cbc70e370092602fb2742dda3e.dip0.t-ipconnect.de. [2003:cb:c70e:3700:9260:2fb2:742d:da3e]) by smtp.gmail.com with ESMTPSA id u3sm18392835wmm.0.2022.02.15.04.15.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Feb 2022 04:15:39 -0800 (PST) Message-ID: <7b830dc4-37bc-fb7b-c094-16595bd2a128@redhat.com> Date: Tue, 15 Feb 2022 13:15:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 To: Jason Gunthorpe Cc: Alex Sierra , akpm@linux-foundation.org, Felix.Kuehling@amd.com, 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, hch@lst.de, jglisse@redhat.com, apopple@nvidia.com, willy@infradead.org References: <20220201154901.7921-1-alex.sierra@amd.com> <20220201154901.7921-2-alex.sierra@amd.com> <20220211164537.GO4160@nvidia.com> <6a8df47e-96d0-ffaf-247a-acc504e2532b@redhat.com> <20220211165624.GP4160@nvidia.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v6 01/10] mm: add zone device coherent type memory support In-Reply-To: <20220211165624.GP4160@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: fghxo77smuug11x97gnm67797cibkib3 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A942340003 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="N0ndL/Cn"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf17.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspam-User: X-HE-Tag: 1644927344-271897 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 11.02.22 17:56, Jason Gunthorpe wrote: > On Fri, Feb 11, 2022 at 05:49:08PM +0100, David Hildenbrand wrote: >> On 11.02.22 17:45, Jason Gunthorpe wrote: >>> On Fri, Feb 11, 2022 at 05:15:25PM +0100, David Hildenbrand wrote: >>> >>>> ... I'm pretty sure we cannot FOLL_PIN DEVICE_PRIVATE pages >>> >>> Currently the only way to get a DEVICE_PRIVATE page out of the page >>> tables is via hmm_range_fault() and that doesn't manipulate any ref >>> counts. >> >> Thanks for clarifying Jason! ... and AFAIU, device exclusive entries are >> essentially just pointers at ordinary PageAnon() pages. So with DEVICE >> COHERENT we'll have the first PageAnon() ZONE_DEVICE pages mapped as >> present in the page tables where GUP could FOLL_PIN them. > > This is my understanding > > Though you probably understand what PageAnon means alot better than I > do.. I wonder if it really makes sense to talk about that together > with ZONE_DEVICE which has alot in common with filesystem originated > pages too. For me, PageAnon() means that modifications are visible only to the modifying process. On actual CoW, the underlying page will get replaced -- in the world of DEVICE_COHERENT that would mean that once you write to a DEVICE_COHERENT you could suddenly have a !DEVICE_COHERENT page. PageAnon() pages don't have a mapping, thus they can only be found in MAP_ANON VMAs or in MAP_SHARED VMAs with MAP_PRIVATE. They can only be found via a page table, and not looked up via the page cache (excluding the swap cache). So if we have PageAnon() pages on ZONE_DEVICE, they generally have the exact same semantics as !ZONE_DEVICE pages, but the way they "appear" in the page tables the allocation/freeing path differs -- I guess :) ... and as we want pinning semantics to be different we have to touch GUP. > > I'm not sure what AMDs plan is here, is there an expecation that a GPU > driver will somehow stuff these pages into an existing anonymous > memory VMA or do they always come from a driver originated VMA? My understanding is that a driver can just decide to replace "ordinary" PageAnon() pages e.g., in a MAP_ANON VMA by these pages. Hopefully AMD can clarify. -- Thanks, David / dhildenb