Re: [PATCH v3 1/2] gpu: nova-core: add initial driver stub

2025-02-10 Thread Danilo Krummrich
On Mon, Feb 10, 2025 at 07:24:59AM +0100, Greg KH wrote: > On Sun, Feb 09, 2025 at 06:30:24PM +0100, Danilo Krummrich wrote: > > +config NOVA_CORE > > + tristate "Nova Core GPU driver" > > + depends on PCI > > + depends on RUST > > + depends on RUST_FW_LOADER_ABSTRACTIONS > > + default n

Re: [PATCH v3] drm/sched: Use struct for drm_sched_init() params

2025-02-10 Thread MaĆ­ra Canal
Hi Philipp, On 07/02/25 08:02, Philipp Stanner wrote: drm_sched_init() has a great many parameters and upcoming new functionality for the scheduler might add even more. Generally, the great number of parameters reduces readability and has already caused one missnaming in: commit 6f1cacf4eba7 ("

[PATCH v2 07/17] mm/page_vma_mapped: device-exclusive entries are not migration entries

2025-02-10 Thread David Hildenbrand
It's unclear why they would be considered migration entries; they are not. Likely we'll never really trigger that case in practice, because migration (including folio split) of a folio that has device-exclusive entries is never started, as we would detect "additional references": device-exclusive

[PATCH v2 03/17] mm/rmap: convert make_device_exclusive_range() to make_device_exclusive()

2025-02-10 Thread David Hildenbrand
The single "real" user in the tree of make_device_exclusive_range() always requests making only a single address exclusive. The current implementation is hard to fix for properly supporting anonymous THP / large folios and for avoiding messing with rmap walks in weird ways. So let's always process

[PATCH v2 04/17] mm/rmap: implement make_device_exclusive() using folio_walk instead of rmap walk

2025-02-10 Thread David Hildenbrand
We require a writable PTE and only support anonymous folio: we can only have exactly one PTE pointing at that page, which we can just lookup using a folio walk, avoiding the rmap walk and the anon VMA lock. So let's stop doing an rmap walk and perform a folio walk instead, so we can easily just mo

[PATCH v2 00/17] mm: fixes for device-exclusive entries (hmm)

2025-02-10 Thread David Hildenbrand
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 detail

[PATCH v2 01/17] mm/gup: reject FOLL_SPLIT_PMD with hugetlb VMAs

2025-02-10 Thread David Hildenbrand
We only have two FOLL_SPLIT_PMD users. While uprobe refuses hugetlb early, make_device_exclusive_range() can end up getting called on hugetlb VMAs. Right now, this means that with a PMD-sized hugetlb page, we can end up calling split_huge_pmd(), because pmd_trans_huge() also succeeds with hugetlb

[PATCH v2 02/17] mm/rmap: reject hugetlb folios in folio_make_device_exclusive()

2025-02-10 Thread David Hildenbrand
Even though FOLL_SPLIT_PMD on hugetlb now always fails with -EOPNOTSUPP, let's add a safety net in case FOLL_SPLIT_PMD usage would ever be reworked. In particular, before commit 9cb28da54643 ("mm/gup: handle hugetlb in the generic follow_page_mask code"), GUP(FOLL_SPLIT_PMD) would just have return

[PATCH v2 06/17] mm: use single SWP_DEVICE_EXCLUSIVE entry type

2025-02-10 Thread David Hildenbrand
There is no need for the distinction anymore; let's merge the readable and writable device-exclusive entries into a single device-exclusive entry type. Acked-by: Simona Vetter Reviewed-by: Alistair Popple Signed-off-by: David Hildenbrand --- include/linux/swap.h| 7 +++ include/linux/

[PATCH v2 05/17] mm/memory: detect writability in restore_exclusive_pte() through can_change_pte_writable()

2025-02-10 Thread David Hildenbrand
Let's do it just like mprotect write-upgrade or during NUMA-hinting faults on PROT_NONE PTEs: detect if the PTE can be writable by using can_change_pte_writable(). Set the PTE only dirty if the folio is dirty: we might not necessarily have a write access, and setting the PTE writable doesn't requi

[PATCH v2 10/17] mm/rmap: handle device-exclusive entries correctly in try_to_unmap_one()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). try_to_unmap_one() is not prepared for that, so teach it about these PFN swap PTEs. Note that device-private entries are so far not applicable on that path

[PATCH v2 14/17] mm/damon: handle device-exclusive entries correctly in damon_folio_young_one()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). damon_folio_young_one() is not prepared for that, so teach it about these PFN swap PTEs. Note that device-private entries are so far not applicable on that

[PATCH v2 12/17] mm/rmap: handle device-exclusive entries correctly in page_vma_mkclean_one()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). page_vma_mkclean_one() is not prepared for that, so teach it about these PFN swap PTEs. Note that device-private entries are so far not applicable on that

[PATCH v2 09/17] mm/ksm: handle device-exclusive entries correctly in write_protect_page()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). write_protect_page() is not prepared for that, so teach it about these PFN swap PTEs. Note that device-private entries are so far not applicable on that pa

[PATCH v2 13/17] mm/page_idle: handle device-exclusive entries correctly in page_idle_clear_pte_refs_one()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). page_idle_clear_pte_refs_one() is not prepared for that, so let's teach it what to do with these PFN swap PTEs. Note that device-private entries are so far

[PATCH v2 16/17] mm/rmap: keep mapcount untouched for device-exclusive entries

2025-02-10 Thread David Hildenbrand
Now that conversion to device-exclusive does no longer perform an rmap walk and all page_vma_mapped_walk() users were taught to properly handle device-exclusive entries, let's treat device-exclusive entries just as if they would be present, similar to how we handle device-private entries already.

[PATCH v2 11/17] mm/rmap: handle device-exclusive entries correctly in try_to_migrate_one()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). try_to_migrate_one() is not prepared for that, so teach it about these PFN swap PTEs. We already handle device-private entries by specializing on the folio

[PATCH v2 08/17] kernel/events/uprobes: handle device-exclusive entries correctly in __replace_page()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). __replace_page() is not prepared for that, so teach it about these PFN swap PTEs. Note that device-private entries are so far not applicable on that path,

[PATCH v2 17/17] mm/rmap: avoid -EBUSY from make_device_exclusive()

2025-02-10 Thread David Hildenbrand
Failing to obtain the folio lock, for example because the folio is concurrently getting migrated or swapped out, can easily make the callers fail: for example, the hmm selftest can sometimes be observed to fail because of this. Instead of forcing the caller to retry, let's simply retry in this to-b

[PATCH v2 15/17] mm/damon: handle device-exclusive entries correctly in damon_folio_mkold_one()

2025-02-10 Thread David Hildenbrand
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). damon_folio_mkold_one() is not prepared for that and calls damon_ptep_mkold() with PFN swap PTEs. Teach damon_ptep_mkold() to deal with these PFN swap PTEs

Re: [PATCH v2 03/17] mm/rmap: convert make_device_exclusive_range() to make_device_exclusive()

2025-02-10 Thread Andrew Morton
On Mon, 10 Feb 2025 20:37:45 +0100 David Hildenbrand wrote: > The single "real" user in the tree of make_device_exclusive_range() always > requests making only a single address exclusive. The current implementation > is hard to fix for properly supporting anonymous THP / large folios and > for av

Re: [PATCH v2 14/17] mm/damon: handle device-exclusive entries correctly in damon_folio_young_one()

2025-02-10 Thread SeongJae Park
On Mon, 10 Feb 2025 20:37:56 +0100 David Hildenbrand wrote: > Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") > we can return with a device-exclusive entry from page_vma_mapped_walk(). > > damon_folio_young_one() is not prepared for that, so teach it about these > PFN swap

Re: [PATCH v2 15/17] mm/damon: handle device-exclusive entries correctly in damon_folio_mkold_one()

2025-02-10 Thread SeongJae Park
On Mon, 10 Feb 2025 20:37:57 +0100 David Hildenbrand wrote: > Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") > we can return with a device-exclusive entry from page_vma_mapped_walk(). > > damon_folio_mkold_one() is not prepared for that and calls > damon_ptep_mkold() with

Re: [PATCH v2 00/17] mm: fixes for device-exclusive entries (hmm)

2025-02-10 Thread Andrew Morton
On Mon, 10 Feb 2025 20:37:42 +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 sel