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 D955FC433EF for ; Fri, 11 Feb 2022 16:39:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 397506B0078; Fri, 11 Feb 2022 11:39:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 345EC6B007B; Fri, 11 Feb 2022 11:39:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20D6A6B007D; Fri, 11 Feb 2022 11:39:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 0E2976B0078 for ; Fri, 11 Feb 2022 11:39:45 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BD2F3181AC9C6 for ; Fri, 11 Feb 2022 16:39:44 +0000 (UTC) X-FDA: 79131060288.06.E3CACB0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 292A8A0004 for ; Fri, 11 Feb 2022 16:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644597583; 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=52cEaDM7AWwIPaCJI/Mv+zVmcSm8DpO7Z0SPMFeXq1c=; b=bJLO6AY3o67F1huAqMfx4YN1y0Y5CKMTW+rD9APQ/veSsJQi6T7IGi6TwlgoQZ7ewhYpKG VMW/ZQ/l/j2DBGTW2BZlvu+avhijFWWMaYDriKi2jw+85UBZwgV14hOi0VgUTdT8l9ymsK 8qpCXyTRu6lHB5Zce8LEiZ+ywT89vfw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-2bk8wPiCNSWUy3XKt8LjQQ-1; Fri, 11 Feb 2022 11:39:42 -0500 X-MC-Unique: 2bk8wPiCNSWUy3XKt8LjQQ-1 Received: by mail-wr1-f71.google.com with SMTP id g11-20020adfa48b000000b001e57dfb3c38so317724wrb.2 for ; Fri, 11 Feb 2022 08:39:42 -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:subject :content-language:from:to:cc:references:organization:in-reply-to :content-transfer-encoding; bh=52cEaDM7AWwIPaCJI/Mv+zVmcSm8DpO7Z0SPMFeXq1c=; b=Rc9rFABe1dI57wgULudFroVmXqCtP4qxRNwOcONlkMvLR3Xd4wXhdZz9KwqKwyDfRO /BjvEwa0qkcYmw+sUSxgcb4FWh5GLe++TgkOYsmftAp/hhBUm/y4lE96dn4dFhX9RSU0 dTsmGPm3bM/+VAX2iiYej5sfYs3wpt4l20lLdLch0I1s1Imck3+x7n8mz69MnQeWbup9 rYxHFGOP7/+tFIgg73RW3h4LTzS/uRcZ4hrV7S2R7SwR5hMvHwEV+0yimWwEIKVHrLok WUtWk72++9dH1qS7h4v0nGRH1WmKBQ5vPQgFB1PLFDF4kdOl67eJJ2E3NIUkB/EteHOH hJYg== X-Gm-Message-State: AOAM531t+ERNr+PT6XKsG+nfuELaDSwGw1NpaARJYG+GLPinzhWwGEiE 5citxJDFxKkAn6cwJnswFNPWYGMqc2qGEJinjYVdIQZQwwnqSmFwrH1ZWyDiW1WSI0/ufX1UmOB SvoCoZvGPNlU= X-Received: by 2002:adf:fd8b:: with SMTP id d11mr1992003wrr.324.1644597581301; Fri, 11 Feb 2022 08:39:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxG2+Cbb0dTVk2FSPauT9Ob17meX25qZzZA8tNbFh+KAUELa84lwydmL31J4KRtYZ2wF45ROQ== X-Received: by 2002:adf:fd8b:: with SMTP id d11mr1991978wrr.324.1644597581081; Fri, 11 Feb 2022 08:39:41 -0800 (PST) Received: from ?IPV6:2003:cb:c70c:aa00:4cc6:d24a:90ae:8c1f? (p200300cbc70caa004cc6d24a90ae8c1f.dip0.t-ipconnect.de. [2003:cb:c70c:aa00:4cc6:d24a:90ae:8c1f]) by smtp.gmail.com with ESMTPSA id d18sm1232773wmq.18.2022.02.11.08.39.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Feb 2022 08:39:40 -0800 (PST) Message-ID: Date: Fri, 11 Feb 2022 17:39:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v6 01/10] mm: add zone device coherent type memory support From: David Hildenbrand To: 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 Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com, apopple@nvidia.com, willy@infradead.org References: <20220201154901.7921-1-alex.sierra@amd.com> <20220201154901.7921-2-alex.sierra@amd.com> Organization: Red Hat In-Reply-To: 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-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 292A8A0004 X-Stat-Signature: t8tt3np9pw5uc44td3pejbhbgp8g3tux Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bJLO6AY3; spf=none (imf25.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1644597583-193085 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:15, David Hildenbrand wrote: > On 01.02.22 16:48, Alex Sierra wrote: >> Device memory that is cache coherent from device and CPU point of view. >> This is used on platforms that have an advanced system bus (like CAPI >> or CXL). Any page of a process can be migrated to such memory. However, >> no one should be allowed to pin such memory so that it can always be >> evicted. >> >> Signed-off-by: Alex Sierra >> Acked-by: Felix Kuehling >> Reviewed-by: Alistair Popple > > So, I'm currently messing with PageAnon() pages and CoW semantics ... > all these PageAnon() ZONE_DEVICE variants don't necessarily make my life > easier but I'm not sure yet if they make my life harder. I hope you can > help me understand some of that stuff. > > 1) What are expected CoW semantics for DEVICE_COHERENT? > > I assume we'll share them just like other PageAnon() pages during fork() > readable, and the first sharer writing to them receives an "ordinary" > !ZONE_DEVICE copy. > > So this would be just like DEVICE_EXCLUSIVE CoW handling I assume, just > that we don't have to go through the loop of restoring a device > exclusive entry? > > 2) How are these pages freed to clear/invalidate PageAnon() ? > > I assume for PageAnon() ZONE_DEVICE pages we'll always for via > free_devmap_managed_page(), correct? > > > 3) FOLL_PIN > > While you write "no one should be allowed to pin such memory", patch #2 > only blocks FOLL_LONGTERM. So I assume we allow ordinary FOLL_PIN and > you might want to be a bit more precise? > > > ... I'm pretty sure we cannot FOLL_PIN DEVICE_PRIVATE pages, but can we > FILL_PIN DEVICE_EXCLUSIVE pages? I strongly assume so? > > > Thanks for any information. > (digging a bit more, I realized that device exclusive pages are not actually/necessarily ZONE_DEVICE pages -- so I assume DEVICE_COHERENT will be the actual first PageAnon() ZONE_DEVICE pages that can be present in a page table.) -- Thanks, David / dhildenb