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 D00B3C021A4 for ; Fri, 14 Feb 2025 10:37:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF395280002; Fri, 14 Feb 2025 05:37:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DA3E1280001; Fri, 14 Feb 2025 05:37:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1C86280002; Fri, 14 Feb 2025 05:37:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A21F0280001 for ; Fri, 14 Feb 2025 05:37:53 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B7718A21CB for ; Fri, 14 Feb 2025 10:37:52 +0000 (UTC) X-FDA: 83118199584.19.7087473 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 44809100006 for ; Fri, 14 Feb 2025 10:37:50 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M0LpXaAZ; spf=pass (imf05.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739529470; h=from:from:sender: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:dkim-signature; bh=v1ELqJmSBEXwSdcynoIWjIw5bhWZWQeX4Q07dCSIZyk=; b=gkLiDlaXQgGM6ExAmQQVC2RadLT9TBzbPOWs+0P4RQg6mv6wA5vorbQQxSVFjN6F5A1P34 p+8PnTANg7UvPEKKtlnTuSg6KqorK19zA8n+WyvSsF86Ukjc8xguAEdHaYkGRuzmx1/Zty cEH7WC4cqLoqkBZoRjALuxDfzghbWpo= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M0LpXaAZ; spf=pass (imf05.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739529470; a=rsa-sha256; cv=none; b=NHYSz4Mk+pcQNCVUpaDyz2SUBLiEeQtMcz1y37iu8U0SYafQY9OUDEAfhFXphulQh/WUiU 4xziyj/IjvNZCYoIq+qPnRAQJ8rRdYQEyxQfvrqsJw79PHGhPTiauwEuSyQPt6PFwvNv4/ Fet/pWbkd+eXeEvoaVxkBXgyipFfl0A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739529469; 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:autocrypt:autocrypt; bh=v1ELqJmSBEXwSdcynoIWjIw5bhWZWQeX4Q07dCSIZyk=; b=M0LpXaAZuoSpRemWqexNxBbQkT1V7vxxUvCuigW7B3LUh2Lhb62vhZJjArZkkKtwHp9Co6 mJUzsJbOsOjHXZhKpO7g0Pe+/XWbBOiC//ZMYbdDI3tfXJFTClc41lOZNTAbk3QCZvErfx dN48UoV+6lsKdBZC9cpFo6/+pxJ9mog= 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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-294-e1RUsXEaM2CDG9DtfChZbQ-1; Fri, 14 Feb 2025 05:37:48 -0500 X-MC-Unique: e1RUsXEaM2CDG9DtfChZbQ-1 X-Mimecast-MFC-AGG-ID: e1RUsXEaM2CDG9DtfChZbQ_1739529467 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-38dd8d11139so1586555f8f.1 for ; Fri, 14 Feb 2025 02:37:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739529467; x=1740134267; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=v1ELqJmSBEXwSdcynoIWjIw5bhWZWQeX4Q07dCSIZyk=; b=MvmmMuaS1tP6tmj90aDyxdOVn0j4vI38N3pAcQ/JIqIsT/OPPzNAQ8oUnAVuY0kTlQ KVCWaIJ8bQXKKm8r1ucAtYs0aS67a27R2c2H/r3N+b/ky1lhNdigRk8iq+zXd31Eps7U udtiYxmCrybqDI9EAE8Axs5mUWvC9c0vrhcaI7bltU4aw3fjHoR+VO26FEMeJNWWP7Xd eewaNleqfNILZgjgV8WnxOxQs1udg/RPw3aE9kdxQlLjqWkKT1rI0t254B28bwKy6KDx O4cJSSv/imJZAZ0ucb6h9KtOGZIExJBKai8MwH2+Wn2tluNjqjRsAurcK0qUF38TAq7I PHEw== X-Forwarded-Encrypted: i=1; AJvYcCVJXXdf4swfui6yQuy3gq84s31rpi2eHGOpdi7NHWj8UupqbZwKISOXAbOid0jtknJS0QFLpIGx+Q==@kvack.org X-Gm-Message-State: AOJu0Yy7MX7VU/So97uwyQxJFGDRntCm9BfPVcHkI9Bkx+DFf2R7KWUD KlnkL0Hpqo1utd3OEmByFjHI8ZWtmdPg/GtJ5R4Pe2nHCH7gdlk2muIfk5VHFaVRgooxr6xh/6O dbx8ePPCy+PVCuqZ/fh5vtmpvOD5NkW0RZQnSEYpzkcswIKO+ X-Gm-Gg: ASbGnct/JbnbNB8ALVF8MqClGNI6+lhtnecJbFdMAjCahyZj++fQjaWAC9Z2DkY/3uT 8g3N8z/HwZAGEqXHvnIqopO3JookGY/khcvRqbcZ489xFgwjskuklfXf9ckSNrvrvNFIF5bsbVs breYHUwAJA/lCgW8r+aGAwio+5qxIXrR/S/ijQDYPdKitXwy1anQk+1HwKWKy/Lj0YBbKqOIfk4 bHXYHEZSXnL+appF0g8qYNwELrMo+YDcAFcbOPUKQ7vRvOVDytr11b2GkjJKcI1HmUh3bH/4ZHs PQbrf/CqY3NttYnXcVKg3YorIEnSNwPLgr2+o390HNlzL3EjVJlUlxPcF0rz6OXLOU3lZUUH9aT ZUpyMwVUSZAqUtFb90B52XXJDJ5YvMQ== X-Received: by 2002:a05:6000:18a8:b0:38f:2413:2622 with SMTP id ffacd0b85a97d-38f24132bb7mr9218068f8f.47.1739529466918; Fri, 14 Feb 2025 02:37:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4ObsXSu+uaHBcCGCpcGtfSdrcoS3HhFa3rCOolNFcAYKhUug8deHKDOqr2tqK+ZhCEHYNXw== X-Received: by 2002:a05:6000:18a8:b0:38f:2413:2622 with SMTP id ffacd0b85a97d-38f24132bb7mr9218011f8f.47.1739529466461; Fri, 14 Feb 2025 02:37:46 -0800 (PST) Received: from ?IPV6:2003:cb:c709:a00:7d7d:3665:5fe4:7127? (p200300cbc7090a007d7d36655fe47127.dip0.t-ipconnect.de. [2003:cb:c709:a00:7d7d:3665:5fe4:7127]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43961e07252sm39337615e9.14.2025.02.14.02.37.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Feb 2025 02:37:45 -0800 (PST) Message-ID: <1404d6a3-c27d-4d51-8e3a-e10dc040dc6e@redhat.com> Date: Fri, 14 Feb 2025 11:37:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 00/17] mm: fixes for device-exclusive entries (hmm) To: Alistair Popple Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, nouveau@lists.freedesktop.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, damon@lists.linux.dev, Andrew Morton , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jonathan Corbet , Alex Shi , Yanteng Si , Karol Herbst , Lyude Paul , Danilo Krummrich , David Airlie , Simona Vetter , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , SeongJae Park , "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Pasha Tatashin , Peter Xu , Jason Gunthorpe References: <20250210193801.781278-1-david@redhat.com> <6sejv2hauce3il5lq6sw53xmjjjglxkhz5copm62oryga6jioi@u66wl2nc3hoy> <039b2e48-1d7c-48dc-b832-24db12af216a@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6T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7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7p8uWs0CheEQvPZhWHLimQlfXZVtiLGklDGoLcpzut8_1739529467 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 44809100006 X-Stat-Signature: o5ix1xi87aoz6moi7rzsx7ga4mbdbwpa X-HE-Tag: 1739529470-954899 X-HE-Meta: U2FsdGVkX1/QdLtx5u7Tsc6HrQ8fXt+4l7cZU6clEtc+jg46uFanz+GuMzl40cUSWPB9uerzjIP5PxA2lzHwbO5oLJgAyFfZSt8Ion0AFBQ6zpW1+CHfdNZ+gTHBv/+XktCezdFfWbOx6yfU2qOeD/+py7s+QvwqP2HVpA8hCbANKh5r7pC3uatYj4MHuaufG5pETDVTBUtXPJp1Yk3wy+Vn7y6uhkpJhp/E+pdSFZLdpy9nRw2drkYfqELGEtxseguZ/d8M1eL05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mUwlqaoZnaiFZZWK3ZwjXQCH0EfTs4704ChiD9yGGMZCUwHcVSSifbW0HS5zAB45hFNkG6SCmS1sNS1c= 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: List-Subscribe: List-Unsubscribe: On 14.02.25 02:25, Alistair Popple wrote: > On Thu, Feb 13, 2025 at 12:15:58PM +0100, David Hildenbrand wrote: >> On 13.02.25 12:03, Alistair Popple wrote: >>> On Mon, Feb 10, 2025 at 08:37:42PM +0100, David Hildenbrand wrote: >>>> Against mm-hotfixes-stable for now. >>>> >>>> Discussing the PageTail() call in make_device_exclusive_range() with >>>> Willy, I recently discovered [1] that device-exclusive handling does >>>> not properly work with THP, making the hmm-tests selftests fail if THPs >>>> are enabled on the system. >>>> >>>> Looking into more details, I found that hugetlb is not properly fenced, >>>> and I realized that something that was bugging me for longer -- how >>>> device-exclusive entries interact with mapcounts -- completely breaks >>>> migration/swapout/split/hwpoison handling of these folios while they have >>>> device-exclusive PTEs. >>>> >>>> The program below can be used to allocate 1 GiB worth of pages and >>>> making them device-exclusive on a kernel with CONFIG_TEST_HMM. >>>> >>>> Once they are device-exclusive, these folios cannot get swapped out >>>> (proc$pid/smaps_rollup will always indicate 1 GiB RSS no matter how >>>> much one forces memory reclaim), and when having a memory block onlined >>>> to ZONE_MOVABLE, trying to offline it will loop forever and complain about >>>> failed migration of a page that should be movable. >>>> >>>> # echo offline > /sys/devices/system/memory/memory136/state >>>> # echo online_movable > /sys/devices/system/memory/memory136/state >>>> # ./hmm-swap & >>>> ... wait until everything is device-exclusive >>>> # echo offline > /sys/devices/system/memory/memory136/state >>>> [ 285.193431][T14882] page: refcount:2 mapcount:0 mapping:0000000000000000 >>>> index:0x7f20671f7 pfn:0x442b6a >>>> [ 285.196618][T14882] memcg:ffff888179298000 >>>> [ 285.198085][T14882] anon flags: 0x5fff0000002091c(referenced|uptodate| >>>> dirty|active|owner_2|swapbacked|node=1|zone=3|lastcpupid=0x7ff) >>>> [ 285.201734][T14882] raw: ... >>>> [ 285.204464][T14882] raw: ... >>>> [ 285.207196][T14882] page dumped because: migration failure >>>> [ 285.209072][T14882] page_owner tracks the page as allocated >>>> [ 285.210915][T14882] page last allocated via order 0, migratetype >>>> Movable, gfp_mask 0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_ZERO), >>>> id 14926, tgid 14926 (hmm-swap), ts 254506295376, free_ts 227402023774 >>>> [ 285.216765][T14882] post_alloc_hook+0x197/0x1b0 >>>> [ 285.218874][T14882] get_page_from_freelist+0x76e/0x3280 >>>> [ 285.220864][T14882] __alloc_frozen_pages_noprof+0x38e/0x2740 >>>> [ 285.223302][T14882] alloc_pages_mpol+0x1fc/0x540 >>>> [ 285.225130][T14882] folio_alloc_mpol_noprof+0x36/0x340 >>>> [ 285.227222][T14882] vma_alloc_folio_noprof+0xee/0x1a0 >>>> [ 285.229074][T14882] __handle_mm_fault+0x2b38/0x56a0 >>>> [ 285.230822][T14882] handle_mm_fault+0x368/0x9f0 >>>> ... >>>> >>>> This series fixes all issues I found so far. There is no easy way to fix >>>> without a bigger rework/cleanup. I have a bunch of cleanups on top (some >>>> previous sent, some the result of the discussion in v1) that I will send >>>> out separately once this landed and I get to it. >>>> I wish we could just use some special present PROT_NONE PTEs instead of > > Yeah, that was my initial instinct when I first investigated this. As you point > out a lack of spare PTE bits made it hard/impossible. Of course I'm about to > give you all one back, maybe I should keep it :) I'm only kidding though - I'm > sure there's more interesting things to spend it on. Yes. And I think it could actually be valuable to have the option for more fake-prot-none things. For example, right now we cannot really distinguish NUMA-hinting prot-none from ordinary prot-none without guessing based on some VMA flags. One could implement NUMA-hinting using a PFN swap entry in an arch-independent way I guess. So there are pros and cons to it. The biggest con is, that while RMAP can now handle it, other page table walkers mostly skip these entries. > >>> >>> First off David thanks for finding and fixing these issues. If you have further >>> clean-ups in mind that you need help with please let me know as I'd be happy >>> to help. >> >> Sure! I have some cleanups TBD as result of the previous discussion, but >> nothing bigger so far. >> >> (removing the folio lock could be considered bigger, if we want to go down >> that path) >> >>> >>>> these (non-present, non-none) fake-swap entries; but that just results in >>>> the same problem we keep having (lack of spare PTE bits), and staring at >>>> other similar fake-swap entries, that ship has sailed. >>>> >>>> With this series, make_device_exclusive() doesn't actually belong into >>>> mm/rmap.c anymore, but I'll leave moving that for another day. >>>> >>>> I only tested this series with the hmm-tests selftests due to lack of HW, >>>> so I'd appreciate some testing, especially if the interaction between >>>> two GPUs wanting a device-exclusive entry works as expected. >>> >>> I'm still reviewing the series but so far testing on my single GPU system >>> appears to be working as expected. I will try and fire up a dual GPU system >>> tomorrow and test it there as well. >> >> Great, thanks a bunch for testing! >> >> Out of interest: does the nvidia driver make use of this interface as well, >> and are you testing with that or with the nouveau driver? I saw some reports >> that nvidia at least checks for it [1] when building the module: > > Both. I have tested Nouveau with the Mesa OpenCL stack and a simple stress test > that just thrashes atomic accesses between CPU and GPU and a similar test for > the nvidia driver. > > In practice the nvidia driver probably doesn't use this that often as it > more aggressively migrates data but it does use this as a fallback. Also it's > possible for users to force residency on the CPU in which case this is used, > which is what the test does. Cool, thanks! (so even though nouveau is not enabled in RHEL, we'd effectively be using that functionality in RHEL kernels using the nvidia driver) > > Anyway I have just finished testing on a multi-GPU setup so please feel free to > add for the series: > > Tested-by: Alistair Popple Thanks a bunch! -- Cheers, David / dhildenb