From nobody Tue Apr 08 13:42:03 2025 X-Original-To: x11@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZX6gx21yJz5sQVX for ; Tue, 08 Apr 2025 13:42:05 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZX6gx0cqSz3G1t for ; Tue, 08 Apr 2025 13:42:05 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744119725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M2xelewYiQDXiAB6Q5vjAA4uXc1oxKYcv1nrtQY/w68=; b=crCvlc5tJFmAOw1wzKzp/lr+fLFQl6sLgpJqsiW0PDABRht10xGI/d95y5YtHcnO40QcS3 UYx5UE7vMGwSIHAjuaOfqDovOxkVq85SBtuH8oawWF94x3Skt8ta21ciP2Y52X3fHzJb9Z MBk8ZPXiOawOmfe+Y3QG62fgJEmspQL/5YbP4s/DZoAfPuWtTiVlbKTjrDKWp3FjX9LFHh 5+4tMQldANVesfL0eDCViRiFdgHeBdfNmYPNyxw9adBmaCkpI2v9aR+P3MVgEXtml5dyV+ 3fkolryfegw55VAjE4/GK8ZUmtbW/E6qDM1/14QwIdbI+2I/8WcGVeEM1XzunQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744119725; a=rsa-sha256; cv=none; b=YT9sfJ7hk8qflIFLZk5IZgQavJxKDediUpxgqwN58qLNtdCSIMvORaUUwSeuOon7mDRhUD U48Zo2lWlql2uGJfH5lvVSNcvlRaNJdpKuhbRxLV4GBplTTYSzhARscmiX6Jo4xzNstPyK omLAIk1m8fu2zJegYFuR5yU02ZLkxrz6MgazzcKr+NuQU9Eu5tiFrM4I0Fmudbhsif/dnc 3+cSogT3m5ifE3rwIAvJda1XhIo7IMgcZRaT9UIBRjkhCLIITR9/OEIomUttQXEOBgT162 FYpoVxkMPKBYolGjHhIIv79aIuEFbvxl2BL0WQ6c0tRzO4hJB6la5DqsxvtSAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744119725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M2xelewYiQDXiAB6Q5vjAA4uXc1oxKYcv1nrtQY/w68=; b=PPKQ3B7wnUeU7Gj+vc1en08c16EHKQZQbFY4u1SJDzRGgfYgRZliBCbSotBeh3hIqDyEca sxx7MXT3S+Ypz5X2WLlX6PBZDlUZ33LOMdVx4R9ZCnkdcJu2UHvoTvr+TD+Yr2ky8/Fffa SdXaN7J2r8PCb5GLbEwWfd2W6BHpiQXuzt2FWIXsTUoc6L9J6zYqXZDVIMe2fg8Pg27Yyn YB9aSmXfAShK4Jrhvyls+4g5KmkLOdDIouROHr+FYKIPEpB8hTaDDEJmpsvP6Px2uS5E7B jHP08jMgOheSAQ/bwBier6stuF+nRjNrn5lZZcXGBYNw60nSPuts3B/cftWx6g== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZX6gw6ckmzbM8 for ; Tue, 08 Apr 2025 13:42:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 538Dg4PR086017 for ; Tue, 8 Apr 2025 13:42:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 538Dg477086016 for x11@FreeBSD.org; Tue, 8 Apr 2025 13:42:04 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: x11@FreeBSD.org Subject: [Bug 277476] graphics/drm-515-kmod: amdgpu periodic hangs due to phys contig allocations Date: Tue, 08 Apr 2025 13:42:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: olce@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? mfc-stable14+ X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: X11 List-Archive: https://lists.freebsd.org/archives/freebsd-x11 List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-x11@freebsd.org Sender: owner-freebsd-x11@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277476 --- Comment #26 from commit-hook@FreeBSD.org --- A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D831e6fb0baf67c2421abb50b6a14da9e7= 1c183bb commit 831e6fb0baf67c2421abb50b6a14da9e71c183bb Author: Mathieu AuthorDate: 2024-11-14 00:24:02 +0000 Commit: Olivier Certner CommitDate: 2025-04-08 13:38:29 +0000 LinuxKPI: make linux_alloc_pages() honor __GFP_NORETRY This is to fix slowdowns with drm-kmod that get worse over time as physical memory become more fragmented (and probably also depending on other factors). Based on information posted in this bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277476 By default, linux_alloc_pages() retries failed allocations by calling vm_page_reclaim_contig() to attempt to free contiguous physical memory pages. vm_page_reclaim_contig() does not always succeed and calling it can be very slow even when it fails. When physical memory is very fragmented, vm_page_reclaim_contig() can end up being called (and failing) after every allocation attempt. This could cause very noticeable graphical desktop hangs (which could last seconds). The drm-kmod code in question attempts to allocate multiple contiguous pages at once but does not actually require them to be contiguous. It can fallback to doing multiple smaller allocations when larger allocations fail. It passes alloc_pages() the __GFP_NORETRY flag in this case. This patch makes linux_alloc_pages() fail early (without retrying) when this flag is passed. [olce: The problem this patch fixes is longer and longer GUI freezes as a machine's memory gets filled and becomes fragmented, when using amdgpu from DRM kmod 5.15 and DRM kmod 6.1 (DRM kmod 5.10 is unaffected; newer Linux kernel introduced an "optimization" by which a pool of pages is filled preferentially with contiguous pages, which triggered the problem for us). The original commit message above evokes freezes lasting seconds, but I occasionally witnessed some lasting tens of minutes, rendering a machine completely useless. The patch has been reviewed for its potential impacts to other LinuxKPI parts and our existing DRM kmods' code. In particular, there is no other user of __GFP_NORETRY/GFP_NORETRY with Linux's alloc_pages*() functions in our tree or DRM kmod ports. It has also been tested extensively, by me for months against 14-STABLE and sporadically on -CURRENT on a RX580, and by several others as reported below and as is visible in more details in the quoted bugzilla PR and in the initial drm-kmod issue at https://github.com/freebsd/drm-kmod/issues/302, on a variety of other AMD GPUs (several RX580, RX570, Radeon Pro WX5100, Green Sardine 5600G, Ryzen 9 4900H with embedded Renoir).] PR: 277476 Reported by: Josef 'Jeff' Sipek Reviewed by: olce Tested by: many (olce, Pierre Pronchery, Evgenii Khramtsov, chapli= na, rk) MFC after: 2 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation (review and part of testing) (cherry picked from commit 718d1928f8748fe4429c011296f94f194d63c695) sys/compat/linuxkpi/common/include/linux/gfp.h | 4 ++-- sys/compat/linuxkpi/common/src/linux_page.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) --=20 You are receiving this mail because: You are on the CC list for the bug.=