Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3716685iog; Tue, 21 Jun 2022 04:38:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s7FWr9HzQlbsjLmSg39FLpEjzgYV11yfRMQ8Yml54Dzy7WJ9JSVHGih9s/31JyjTj9UBog X-Received: by 2002:a05:6a00:124a:b0:51c:26a5:1b05 with SMTP id u10-20020a056a00124a00b0051c26a51b05mr29521808pfi.14.1655811512642; Tue, 21 Jun 2022 04:38:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655811512; cv=pass; d=google.com; s=arc-20160816; b=rDyapOXqeCx+yY7/aVvfT17ubK2rfaH1V3gzUPErbzIMrzCMysq35M3lP1Dhs/Wn6T h50UY5SQXFDmpUVJHSLO5NT5OdzpvrglfJRWnQVFD0i89GSZt4E/7ZzuJvQgYsG9lZnT sAWCFVBg5Znhz2xA+GvNyT0YjTjWtAIYe13b7hUX8qp449TPZxzP885jDWt9/9dVVfyL sD4t1W2LliRoepJ6o63S0lyvhMaSdN6zEUcIbF0r5sLH8TB7mkAGvZUvDrhXvIft61fu /7eK7s7in/7FSN8cw8Zqt9Z6AwHoHPvMLNre1HErkhdgdSf2rE/QQNduIDJF6v7RFe8y WD4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=AAF3M5VgLn9W+D6+KqWJOr6y7X0Rp2dcfaCZ7KDiF7Y=; b=VR2SPgVY2W0ORF7ozASUjWDJk6zbsKr/ItWboorfPglMjbQ9cvWGvs/pm/fvdcxjug 4q/vVPt/+2Y60fLoQzACL+5CWShpFMAfWTC98IRqXOvU+6zGRszC6QJreZ6DWxXmFGgr TLWma2ZBbYNw6byftBSwFRKZ6Fg5eMvWzurByLxjb7PeIdMFHmd1iQ1upOYNlOW7fPIJ +9ivNmVXVPxgZHCshdpBIYJtZKgNfwKDpPGQmaU9wVNJoAdOtoiO2d9S7tq1FAF/8Zge jg7NgGhJjxJSIwjNXSnvG7/Qnw+uae6uWt55msp/Hm/1rA0Q8dV4F7xc3w/rsSGMr0NN 5ZGg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=WPPNV7ng; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf14-20020a17090b1d8e00b001ecd45dda01si571200pjb.88.2022.06.21.04.37.47; Tue, 21 Jun 2022 04:38:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=WPPNV7ng; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349239AbiFULZt (ORCPT + 99 others); Tue, 21 Jun 2022 07:25:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348993AbiFULZs (ORCPT ); Tue, 21 Jun 2022 07:25:48 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2041.outbound.protection.outlook.com [40.107.237.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4386B1008; Tue, 21 Jun 2022 04:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EoC8LvSgmYaexxOjb7Ukjms7EQvvY7iV7hFY8l2m0knXb4Ijy/RPAudiIMtUA1OC1uS3LuukO8Ep38U852h9uTe/A91AkGXsR0PuiRjF0EYCaMa+Qhn5qQlW1/mjF6aYKjQV6Az6ZsGHb9lcfmo0fJosr+0PcaWDGbqhcQm1sHp7r8rbLtpWkpqR+R8JGRHqcZONiBzyEHYd7sPZZSNUSKuIVYeNDgCbPTGFqNnFDL88QdZkeN0aiB1LWls1TDd9bra0lyWixkJKr59xK++PlB2rDtGBdoXo1skSuH2RGNxHBp/UgHbZMmAdsQO8Yk4W8lontQcoNLwS+S9KfFREww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AAF3M5VgLn9W+D6+KqWJOr6y7X0Rp2dcfaCZ7KDiF7Y=; b=Zw8Xl9ZcsYbVFEdbIdVEBY0rCeiPWAcq2ARk8Lv87SI0FpJVbn1IoD4KDGB6rxkRATC16TJBhrEY1NuFc5kmoGD4rYUVQ0lhK4QVxBifOjtp1ZL5mGoKXgrwDnRpilsfF3mx4UZJy06CUkIWeK1F8VGkQ3UpiN3QGrQqXevTv5ZT0lVZMWGS1qqzbqsj1C6jO9iAsbeZsFJzWKHxAgJ5lnhl+f+p4AaNcOFnuN40lg1zK31ZGQMJht+Lid8iJIRMx3n4lVTxP8rHDfMgtX3LqDn9CoPth4EmcfWzujtJ2TmbmkIdqZpnFZaQTscw21C80B6He0peVcJFbjFAbFGyig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AAF3M5VgLn9W+D6+KqWJOr6y7X0Rp2dcfaCZ7KDiF7Y=; b=WPPNV7ngbjgV8uhd+1mkksTe8ySa92jRjkxahQ91E1BiYlsznOd/ySTvFbZhHvvetRJHjv8hNT8wXrGlWDf03LmozxrxoL0BBxUInwj10RSBWEDZn+kF8PR89/v6PNofq/KBgS6vDx92h3d+l9LoTHPZF6K8tupyZsLzI0eps7E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN9PR12MB5115.namprd12.prod.outlook.com (2603:10b6:408:118::14) by CY4PR12MB1335.namprd12.prod.outlook.com (2603:10b6:903:37::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.17; Tue, 21 Jun 2022 11:25:44 +0000 Received: from BN9PR12MB5115.namprd12.prod.outlook.com ([fe80::1cf6:2a9d:41d6:e8c3]) by BN9PR12MB5115.namprd12.prod.outlook.com ([fe80::1cf6:2a9d:41d6:e8c3%4]) with mapi id 15.20.5353.022; Tue, 21 Jun 2022 11:25:44 +0000 Message-ID: <65987ab8-426d-e533-0295-069312b4f751@amd.com> Date: Tue, 21 Jun 2022 13:25:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v5 01/13] mm: add zone device coherent type memory support Content-Language: en-US To: David Hildenbrand , "Sierra Guiza, Alejandro (Alex)" , jgg@nvidia.com Cc: 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, akpm@linux-foundation.org References: <20220531200041.24904-1-alex.sierra@amd.com> <20220531200041.24904-2-alex.sierra@amd.com> <3ac89358-2ce0-7d0d-8b9c-8b0e5cc48945@redhat.com> <02ed2cb7-3ad3-8ffc-6032-04ae1853e234@amd.com> <7605beee-0a76-4ee9-e950-17419630f2cf@redhat.com> <6aef4b7f-0ced-08cd-1f0c-50c22996aa41@redhat.com> From: Felix Kuehling In-Reply-To: <6aef4b7f-0ced-08cd-1f0c-50c22996aa41@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AM6P192CA0013.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::26) To BN9PR12MB5115.namprd12.prod.outlook.com (2603:10b6:408:118::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7872c0d6-5159-491d-e3c5-08da5378c7fa X-MS-TrafficTypeDiagnostic: CY4PR12MB1335:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /7VcJ/99XD+RBxr3zAr0XTvDmuzrUHLe1ATG8WHK+ZCcPwTvB2wtQBMTTNMMf/65Vkw4ddLW5PhEMYiGAWoZJGxhGNgBLhiwsZsbdQ0paOnPxqrIC6RyNfTF/mMeMREI4tC/RAg319rktJ9iGsnJAf+CGbpyQS2FYuMZ4eByQcuWnyGCRvA3SRQP4d4pctFBg1AFS/TqKbzuC1dwSQdX+uzuwatZBRSnTs1m0z9AkFNamEiRWTyBQUvG6s409IVhehGeQVVRbsw2RO2P/fCjGbYGtas5z9l1fhTig6O5k7ABQk2wqCy5W4bQG6K1g6nJdf2QHRKC7vZaqMMQ831y8SSKIf4fmp1CxaHfkTibJLLUL5lHH62NqL7XAWWzkjulZiUqlYBPuFJWAsvup7xbgcxARtPjkDmNNzZdSz41BnmPCKRnJK/kh6u4evhMCae26dMc0H1YqvH7fRtT+00uJmuN8Ne/DpFgz3nR9dVUrou3zD7P8xkNaPtnROl2JFgYh1jfSCGGB5v/Vl6LaazBbbzzELTcBVq3l+PWEQo713h4svqy8Q0nRBeIIBpE4smLaUYK4BUkbOIpJxNGzXq3G4c68XEPo/2LVJwbRUGDiyTE9+eFjaeIGeFP4PY3Ois5MnvrVTOvaxRsewnUk+GlujgoBbM4R2jk1vwZZb1yacpgrQNlLQCZj43Y1llcFk/AUklnNAFtoEAfJrfwbig/lCf8cx/01yKME/gSfCdjEmA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR12MB5115.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(136003)(366004)(39860400002)(376002)(396003)(346002)(53546011)(316002)(2616005)(110136005)(36756003)(6486002)(6666004)(66556008)(26005)(83380400001)(6512007)(41300700001)(4326008)(66946007)(31686004)(44832011)(6506007)(8676002)(66476007)(186003)(478600001)(8936002)(86362001)(5660300002)(7416002)(31696002)(2906002)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ejB0Y1VRZTlQTUdtdE9xaFQxNThQeitJUEFWS3FQL01iMXRzL3AwaXZQQm42?= =?utf-8?B?endWS3hqeXRHRlgrSWJjTFcwc01CbjFpTjFLOThYM29kWVZra1BFQUtZZFRh?= =?utf-8?B?QXhMS0RQRGM5RXlFekw1ZzkvdVE5WlBiOHkvNlFKcVRXRXpHemJyZjEwbFM2?= =?utf-8?B?SkdHU1lFMXpFMUdkYlRNbGxqL0VvVjNrVXlhVnhYVkowcUd0RXE4aGhsU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q2ZWtHNithYnJwSk5hNjBHTE1wUXhT?= =?utf-8?B?NmlzTnNjUEIybmk2UTZUUmpja3JpbUQ2bzBjOHpPRkhSOXVabDlwNVIrZTlD?= =?utf-8?B?ZDB1c2tqbGJLMnk0L0hjbW1kcHdJM2R0TWN0eS9Wdm9sWTd6T2xKRkRZdkhH?= =?utf-8?B?WVZETjJvL08vSmFSQkMxV3Y4YlVtQTJuMUdEOWxPblBJV1B2cjZGbmIvSlN3?= =?utf-8?B?dVRaV3EzZkFFT1FxVlpHeERuZlFvMERLZzVNL01NUkZ5cS9zRlF6OVlGUlZo?= =?utf-8?B?K1EySCs1MTE4czJoaDZQaG5WZHh6T2Rxbk5Dd296SG5rYkhGbklJdz09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7872c0d6-5159-491d-e3c5-08da5378c7fa X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5115.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 11:25:44.6397 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: N+DrF77sI8NAqL5mpRtm6i8jSMOA29rDuvKgRUxFMqJ5DqbteUllI/M2ElYfmtgZ9tenleGeIGE9966nztcN2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1335 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Am 6/17/22 um 23:19 schrieb David Hildenbrand: > On 17.06.22 21:27, Sierra Guiza, Alejandro (Alex) wrote: >> On 6/17/2022 12:33 PM, David Hildenbrand wrote: >>> On 17.06.22 19:20, Sierra Guiza, Alejandro (Alex) wrote: >>>> On 6/17/2022 4:40 AM, David Hildenbrand wrote: >>>>> On 31.05.22 22:00, 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 >>>>>> [hch: rebased ontop of the refcount changes, >>>>>> removed is_dev_private_or_coherent_page] >>>>>> Signed-off-by: Christoph Hellwig >>>>>> --- >>>>>> include/linux/memremap.h | 19 +++++++++++++++++++ >>>>>> mm/memcontrol.c | 7 ++++--- >>>>>> mm/memory-failure.c | 8 ++++++-- >>>>>> mm/memremap.c | 10 ++++++++++ >>>>>> mm/migrate_device.c | 16 +++++++--------- >>>>>> mm/rmap.c | 5 +++-- >>>>>> 6 files changed, 49 insertions(+), 16 deletions(-) >>>>>> >>>>>> diff --git a/include/linux/memremap.h b/include/linux/memremap.h >>>>>> index 8af304f6b504..9f752ebed613 100644 >>>>>> --- a/include/linux/memremap.h >>>>>> +++ b/include/linux/memremap.h >>>>>> @@ -41,6 +41,13 @@ struct vmem_altmap { >>>>>> * A more complete discussion of unaddressable memory may be found in >>>>>> * include/linux/hmm.h and Documentation/vm/hmm.rst. >>>>>> * >>>>>> + * MEMORY_DEVICE_COHERENT: >>>>>> + * 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). A >>>>>> + * driver can hotplug the device memory using ZONE_DEVICE and with that memory >>>>>> + * type. Any page of a process can be migrated to such memory. However no one >>>>> Any page might not be right, I'm pretty sure. ... just thinking about special pages >>>>> like vdso, shared zeropage, ... pinned pages ... >>> Well, you cannot migrate long term pages, that's what I meant :) >>> >>>>>> + * should be allowed to pin such memory so that it can always be evicted. >>>>>> + * >>>>>> * MEMORY_DEVICE_FS_DAX: >>>>>> * Host memory that has similar access semantics as System RAM i.e. DMA >>>>>> * coherent and supports page pinning. In support of coordinating page >>>>>> @@ -61,6 +68,7 @@ struct vmem_altmap { >>>>>> enum memory_type { >>>>>> /* 0 is reserved to catch uninitialized type fields */ >>>>>> MEMORY_DEVICE_PRIVATE = 1, >>>>>> + MEMORY_DEVICE_COHERENT, >>>>>> MEMORY_DEVICE_FS_DAX, >>>>>> MEMORY_DEVICE_GENERIC, >>>>>> MEMORY_DEVICE_PCI_P2PDMA, >>>>>> @@ -143,6 +151,17 @@ static inline bool folio_is_device_private(const struct folio *folio) >>>>> In general, this LGTM, and it should be correct with PageAnonExclusive I think. >>>>> >>>>> >>>>> However, where exactly is pinning forbidden? >>>> Long-term pinning is forbidden since it would interfere with the device >>>> memory manager owning the >>>> device-coherent pages (e.g. evictions in TTM). However, normal pinning >>>> is allowed on this device type. >>> I don't see updates to folio_is_pinnable() in this patch. >> Device coherent type pages should return true here, as they are pinnable >> pages. > That function is only called for long-term pinnings in try_grab_folio(). > >>> So wouldn't try_grab_folio() simply pin these pages? What am I missing? >> As far as I understand this return NULL for long term pin pages. >> Otherwise they get refcount incremented. > I don't follow. > > You're saying > > a) folio_is_pinnable() returns true for device coherent pages > > and that > > b) device coherent pages don't get long-term pinned > > > Yet, the code says > > struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags) > { > if (flags & FOLL_GET) > return try_get_folio(page, refs); > else if (flags & FOLL_PIN) { > struct folio *folio; > > /* > * Can't do FOLL_LONGTERM + FOLL_PIN gup fast path if not in a > * right zone, so fail and let the caller fall back to the slow > * path. > */ > if (unlikely((flags & FOLL_LONGTERM) && > !is_pinnable_page(page))) > return NULL; > ... > return folio; > } > } > > > What prevents these pages from getting long-term pinned as stated in this patch? Long-term pinning is handled by __gup_longterm_locked, which migrates pages returned by __get_user_pages_locked that cannot be long-term pinned. try_grab_folio is OK to grab the pages. Anything that can't be long-term pinned will be migrated afterwards, and __get_user_pages_locked will be retried. The migration of DEVICE_COHERENT pages was implemented by Alistair in patch 5/13 ("mm/gup: migrate device coherent pages when pinning instead of failing"). Regards,   Felix > > I am probably missing something important. > P.S.: I'm on vacation and looking at a tiny screen. Hope I didn't miss anything myself.