!JQvnJacrwKgtkGHYHO:matrix.org

NixOS + Framework

238 Members
Discussing NixOS in the context of the Framework laptop54 Servers

Load older messages


SenderMessageTime
4 Apr 2025
@damccull:matrix.orgdamccullPackaging example is amdgpu which was helpful: https://nixos.wiki/wiki/Linux_kernel#Patching_a_single_In-tree_kernel_module18:36:49
@damccull:matrix.orgdamccullpatch example here: https://wiki.nixos.org/wiki/AMD_GPU#System_Hang_with_Vega_Graphics_(and_select_GPUs)18:38:26
@damccull:matrix.orgdamccull

Relevant part of my configuration.nix:


{
  config,
  inputs,
  lib,
  pkgs,
  ...
}:
let
  amdgpu-kernel-module = pkgs.callPackage ../../nixos_modules/patches/amdgpu-kernel-module.nix {
    # Make sure the module targets the same kernel as your system is using.
    kernel = config.boot.kernelPackages.kernel;
  };
  # linuxPackages_latest 6.13 (or linuxPackages_zen 6.13)
  # amdgpu-stability-patch = pkgs.fetchpatch {
  #   name = "amdgpu-stability-patch";
  #   url = "https://github.com/torvalds/linux/compare/ffd294d346d185b70e28b1a28abe367bbfe53c04...SeryogaBrigada:linux:4c55a12d64d769f925ef049dd6a92166f7841453.diff";
  #   hash = "sha256-q/gWUPmKHFBHp7V15BW4ixfUn1kaeJhgDs0okeOGG9c=";
  # };
in
{
  boot = {
    extraModulePackages = [
      (amdgpu-kernel-module.overrideAttrs (_: {
        patches = [
          ./0001-drm-amdgpu-mes11-optimize-MES-pipe-FW-version-fetchi.patch
          # amdgpu-stability-patch
        ];
      }))
    ];
  };
}
18:41:05
@damccull:matrix.orgdamccull

patch file itself, which can be found on the first AMD link:

From 2771f96336e3c469622f6e0e132f24ad1ba6a5c6 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Thu, 27 Mar 2025 17:33:49 -0400
Subject: [PATCH] drm/amdgpu/mes11: optimize MES pipe FW version fetching

Don't fetch it again if we already have it.  It seems the
don't reliably have the proper value at resume in some
cases.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4083
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
index 16f8bc36afa07..06b51867c9aac 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
@@ -895,6 +895,10 @@ static void mes_v11_0_get_fw_version(struct amdgpu_device *adev)
 {
 	int pipe;
 
+	/* return early if we have already fetched these */
+	if (adev->mes.sched_version && adev->mes.kiq_version)
+		return;
+
 	/* get MES scheduler/KIQ versions */
 	mutex_lock(&adev->srbm_mutex);
 
-- 
2.49.0
18:41:47
@damccull:matrix.orgdamccullThis solved my problem, for anyone else having it as well.18:42:04
@damccull:matrix.orgdamccullAnd it doesn't do a full kernel recompile, just the amdgpu module, which then overrides the kernel built-in version.18:42:23
@damccull:matrix.orgdamccull Matt H: I think kernels 6.13.7->6.14.0 might be affected though. That's what the bug report on the first link says, and I didn't have any luck with downgrading to pkgs.linuxPackages_6_13 in my configuration.nix. 18:43:33
@damccull:matrix.orgdamccull

forgot one other file needed. This one is amdgpu-kernel-module.nix, referenced in the configuration.nix as well. This is the part that packages the amdgpu module separately from the kernel:

{
  pkgs,
  lib,
  kernel ? pkgs.linuxPackages_latest.kernel,
}:

pkgs.stdenv.mkDerivation {
  pname = "amdgpu-kernel-module";
  inherit (kernel)
    src
    version
    postPatch
    nativeBuildInputs
    ;

  kernel_dev = kernel.dev;
  kernelVersion = kernel.modDirVersion;

  modulePath = "drivers/gpu/drm/amd/amdgpu";

  buildPhase = ''
    BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build

    cp $BUILT_KERNEL/Module.symvers .
    cp $BUILT_KERNEL/.config        .
    cp $kernel_dev/vmlinux          .

    make "-j$NIX_BUILD_CORES" modules_prepare
    make "-j$NIX_BUILD_CORES" M=$modulePath modules
  '';

  installPhase = ''
    make \
      INSTALL_MOD_PATH="$out" \
      XZ="xz -T$NIX_BUILD_CORES" \
      M="$modulePath" \
      modules_install
  '';

  meta = {
    description = "AMD GPU kernel module";
    license = lib.licenses.gpl3;
  };
}
18:45:11
@damccull:matrix.orgdamccullAll this is taken from nixos.wiki, wiki.nixos.org, and the amd bug tracker. GL everyone.18:45:48
@damccull:matrix.orgdamccull Oh, one last thing Matt H , this isn't just a nixos issue. Apparently the OP of the bug is on fedora, and on that tracker at the bottom there's a link to another, related issue, where hibernation is prevented from happening due to this bug. My own experience included hibernation not working. Everything's fine now with the patch. 18:54:24
7 Apr 2025
@cbobrobison:matrix.orgcbobrobison joined the room.02:02:37
8 Apr 2025
@ctsdownloads:fedora.imMatt H. - on PTO Thanks for the clarity damccull 🙏😀 00:17:06
@damccull:matrix.orgdamccullYou're quite welcome. I'm happy to help because the community for nix and framework both have been so helpful to me.05:15:51
9 Apr 2025
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️Same here21:07:12
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️ Matt H: look at #gaming:nixos.org 21:07:21
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️I had this problem21:07:24
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️Its a regression in 6.13 21:07:31
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️6.14 still has the same problem21:07:37
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️6.12 works21:07:40
@damccull:matrix.orgdamccullYeah, I'm getting weird graphical glitches on .13 and .14 too. About to switch back to 1221:08:14
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️Same here21:10:16
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️red band on the screen/screen flashing?21:10:21
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️Or something else21:10:23
@niko:nyanbinary.rsnyanbinary 🏳️‍⚧️Like I see a band/screen flickering on a part of the screen sometimes21:10:41
@damccull:matrix.orgdamcculljust random junk appearing at random. Sometimes it's red and gold colored. It's always inside a window and tends to move with the window. I think it's a problem between the new kernel code and wayland maybe21:16:18
10 Apr 2025
@ctsdownloads:fedora.imMatt H. - on PTO
In reply to @niko:nyanbinary.rs
6.12 works
Okay, thank you. Appreciate it
04:29:16
13 Apr 2025
@myned:bjork.techMyned joined the room.00:05:02
16 Apr 2025
@stunkymonkey:matrix.orgFelix Bühler joined the room.20:28:02
18 Apr 2025
@fabaff:matrix.orgfabaff joined the room.18:03:18
@stackdoubleflow:matrix.orgStackDoubleFlow joined the room.22:05:19

Show newer messages


Back to Room ListRoom Version: 10