[Bug 277476] graphics/drm-515-kmod: amdgpu periodic hangs due to phys contig allocations

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 09 Sep 2025 07:58:43 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277476

--- Comment #37 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=637d9858e6a8b4a8a3ee4dd80743a58bde4cbd68

commit 637d9858e6a8b4a8a3ee4dd80743a58bde4cbd68
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-07-08 12:28:31 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-09 07:56:51 +0000

    vm_domainset: Refactor iterators, multiple fixes

    vm_domainset_iter_first() would not check if the initial domain selected
    by the policy was effectively valid (i.e., allowed by the domainset and
    not marked as ignored by vm_domainset_iter_ignore()).  It would just try
    to skip it if it had less pages than 'free_min', and would not take into
    account the possibility of no domains being valid.

    Factor out code that logically belongs to the iterator machinery and is
    not tied to how allocations (or impossibility thereof) are to be
    handled.  This allows to remove duplicated code between
    vm_domainset_iter_page() and vm_domainset_iter_policy(), and between
    vm_domainset_iter_page_init() and _vm_domainset_iter_policy_init().
    This also allows to remove the 'pages' parameter from
    vm_domainset_iter_page_init().

    This also makes the two-phase logic clearer, revealing an inconsistency
    between setting 'di_minskip' to true in vm_domainset_iter_init()
    (implying that, in the case of waiting allocations, further attempts
    after the first sleep should just allocate for the first domain,
    regardless of their situation with respect to their 'free_min') and
    trying to skip the first domain if it has too few pages in
    vm_domainset_iter_page_init() and _vm_domainset_iter_policy_init().  Fix
    this inconsistency by resetting 'di_minskip' to 'true' in
    vm_domainset_iter_first() instead so that, after each vm_wait_doms()
    (waiting allocations that could not be satisfied immediately), we again
    start with only the domains that have more than 'free_min' pages.

    While here, fix the minor quirk that the round-robin policy would start
    with the domain after the one pointed to by the initial value of
    'di_iter' (this just affects the case of resetting '*di_iter', and would
    not cause domain skips in other circumstances, i.e., for waiting
    allocations that actually wait or at each subsequent new iterator
    creation with same iteration index storage).

    PR:             277476
    Tested by:      Kenneth Raplee <kenrap_kennethraplee.com>
    Fixes:          7b11a4832691 ("Add files for r327895")
    Fixes:          e5818a53dbd2 ("Implement several enhancements to NUMA
policies.")
    Fixes:          23984ce5cd24 ("Avoid resource deadlocks when one domain has
exhausted its memory."...)
    MFC after:      10 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D51251

 sys/kern/kern_malloc.c |  11 ++-
 sys/vm/uma_core.c      |  10 ++-
 sys/vm/vm_domainset.c  | 238 +++++++++++++++++++++++++++++--------------------
 sys/vm/vm_domainset.h  |   9 +-
 sys/vm/vm_glue.c       |   2 +-
 sys/vm/vm_kern.c       |  12 ++-
 sys/vm/vm_page.c       |  21 +++--
 7 files changed, 181 insertions(+), 122 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.