From patchwork Fri Sep 13 08:14:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ghadi Elie Rahme X-Patchwork-Id: 1985043 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4nDH0rB4z1y2K for ; Fri, 13 Sep 2024 18:15:11 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sp1SJ-00025n-VH; Fri, 13 Sep 2024 08:15:04 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sp1SF-0001zJ-1a for kernel-team@lists.ubuntu.com; Fri, 13 Sep 2024 08:14:59 +0000 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C0C8E3F328 for ; Fri, 13 Sep 2024 08:14:58 +0000 (UTC) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cb0b0514bso14616945e9.1 for ; Fri, 13 Sep 2024 01:14:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726215298; x=1726820098; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k51KYTUrSLhV+FmaoVxAhupK3KqhPffglg76TAphGYo=; b=XyF6t9EL63u84w/1CYH5mVKxvLITHR8t4mf3OdDcI6uVcWn4SRSVmd5qgqECljHrC7 XckzLZ1kbDYB0ew72uxOnpXmx6giVvRIxGN70f6OwOL9OWtt8MmWqJ1oM/N9wApmjnHR PMhEUTlhTns0FXDYXuBBBRM6+DBOtRXYt4vfy3gzC0cjbuRXIMAHyo745S36UIthw4RD 2NEQYxgMYAvOsiIh4Nf3aKIAMHIIzxLwV365S2GAMWLpbML5hdGtz6whqlMPEL+el+pU ronst7UL79A2nyWIepW7TXQNvnWwtnoPxDbpgyb1WMjLgoSFVw90yVjlg5IFWwJNlfv9 +v7w== X-Gm-Message-State: AOJu0Yyoh8J3JrzL6gb9a8lZwOgR94LcMa50VJ9tFjebm2I4wKWNG6mE 2O6jDc5xkQckzap1XhDIPUOKUdW73eOpj9AuvaCdUBY/fyAibo4drv3AU4fLsntihks/aI5vTEm SWwPZTMp2FJIxepDFR8ZVm8R4fm4amGI/ZJtKSkglSk27SII3fKHOlV9sFLDQWOV84qQD3apD6H S1e6wCTA2FSQ== X-Received: by 2002:a5d:4ecf:0:b0:374:c1a9:b97b with SMTP id ffacd0b85a97d-378c2cfedcbmr2989116f8f.8.1726215297953; Fri, 13 Sep 2024 01:14:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErEr5lXF1dFOFf6weeWUoqShNXXsvKDC0R3VgzxSbeiImcdM1/1uFnJU3a/KmX5MGMC7r9Vw== X-Received: by 2002:a5d:4ecf:0:b0:374:c1a9:b97b with SMTP id ffacd0b85a97d-378c2cfedcbmr2989079f8f.8.1726215296768; Fri, 13 Sep 2024 01:14:56 -0700 (PDT) Received: from XPS-17-9720.han-hoki.ts.net ([213.204.117.111]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3789564aea0sm16082829f8f.20.2024.09.13.01.14.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 01:14:56 -0700 (PDT) From: Ghadi Elie Rahme To: kernel-team@lists.ubuntu.com Subject: [SRU][J][PATCH 0/2] amd/iommu: Fix warnings on AMD systems after booting into kdump kernel Date: Fri, 13 Sep 2024 11:14:29 +0300 Message-ID: <20240913081432.703550-1-ghadi.rahme@canonical.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2080378 [impact] On some AMD systems, loading into a kdump kernel will show a few warnings IOMMU warnings during early boot. These warnings have not been observed yet to cause any issues but there is a fix upstream for them. Currently only focal-HWE and jammy 5.15 are affected. Newer kernel releases already have the fix. The stack traces look like the following: [ 9.125703] WARNING: CPU: 0 PID: 1 at drivers/iommu/amd/init.c:829 iommu_init_irq+0x2f2/0x3c0 [ 9.134223] Modules linked in: [ 9.137283] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-107-generic #117~20.04.1-Ubuntu [ 9.145716] Hardware name: [ 9.153111] RIP: 0010:iommu_init_irq+0x2f2/0x3c0 [ 9.157729] Code: 90 ff 85 c0 0f 84 e8 fd ff ff be 01 00 00 00 44 89 ef 89 45 94 e8 2e dc 90 ff 4c 89 e7 e8 b6 cf 90 ff 8b 45 94 e9 6c fd ff ff <0f> 0b 31 c0 e9 63 fd ff ff 0f 0b 31 c0 e9 5a fd ff ff 31 c9 48 c7 [ 9.176475] RSP: 0018:ffffa005000fbd00 EFLAGS: 00010202 [ 9.181703] RAX: 0000000000000198 RBX: ffff9335af44a000 RCX: ffffa00500100000 [ 9.188838] RDX: ffffa00500100000 RSI: ffff9335c05b9140 RDI: ffff9335c05b95c8 [ 9.195970] RBP: ffffa005000fbd70 R08: ffffffffffffffff R09: 0000000000000000 [ 9.203101] R10: ffffffe000000000 R11: 0000000000000025 R12: ffff9335c0468cc0 [ 9.210231] R13: 000000000000001a R14: ffff9335b0151600 R15: 0000000000000006 [ 9.217362] FS: 0000000000000000(0000) GS:ffff9336aec00000(0000) knlGS:0000000000000000 [ 9.225446] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9.231185] CR2: 0000000000000000 CR3: 000002006c810000 CR4: 0000000000350ef0 [ 9.238318] Call Trace: [ 9.240763] [ 9.242869] ? show_regs.cold+0x1a/0x1f [ 9.246710] ? iommu_init_irq+0x2f2/0x3c0 [ 9.250722] ? __warn+0x8b/0xe0 [ 9.253868] ? iommu_init_irq+0x2f2/0x3c0 [ 9.257883] ? report_bug+0xd5/0x110 [ 9.261461] ? handle_bug+0x39/0x90 [ 9.264956] ? exc_invalid_op+0x19/0x70 [ 9.268794] ? asm_exc_invalid_op+0x1b/0x20 [ 9.272980] ? iommu_init_irq+0x2f2/0x3c0 [ 9.276993] ? e820__memblock_setup+0x89/0x89 [ 9.281353] state_next+0x3f5/0x6ba [ 9.284847] ? e820__memblock_setup+0x89/0x89 [ 9.289206] iommu_go_to_state+0x28/0x31 [ 9.293131] amd_iommu_init+0x15/0x4f [ 9.296797] ? e820__memblock_setup+0x89/0x89 [ 9.301150] pci_iommu_init+0x1a/0x48 [ 9.304817] do_one_initcall+0x48/0x1e0 [ 9.308655] kernel_init_freeable+0x284/0x2f1 [ 9.313016] ? rest_init+0x100/0x100 [ 9.316593] kernel_init+0x1b/0x150 [ 9.320078] ? rest_init+0x100/0x100 [ 9.323658] ret_from_fork+0x22/0x30 [ 9.327238] [ 9.329431] ---[ end trace 6113ebe8cb8ce54f ]--- The commit that fixes the issue is: * c5e1a1eb9279 ("iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement") However another commit was also created that fixed compiler warnings introduced by the above commit: * be280ea763f7 ("iommu/amd: Fix compile warning in init code") [Test Plan] 1- On a machine using an AMD CPU and running the focal-hwe or jammy 5.15 kernel, make sure kdump is configured following these steps: https://ubuntu.com/server/docs/kernel-crash-dump 2- Trigger a kernel panic. This can be done using the command: $ echo c > /proc/sysrq-trigger 3- When the machine reboots, you will notice IOMMU warnings during the early phases of the boot process in dmesg. 4- After applying the two commits and repeating step 2. No IOMMU warnings should show up anymore in dmesg. [Fix] Only the first commit of the below list is required to fix the bug, but the second one is good to have to avoid compilation warnings introduced by that commit: * c5e1a1eb9279 ("iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement") * be280ea763f7 ("iommu/amd: Fix compile warning in init code") [where problems could occur] * IOMMU can fail to initialize after applying these commits on AMD systems. * There is a chance these commits do not fix IOMMU warnings for all AMD system configurations Joerg Roedel (1): iommu/amd: Fix compile warning in init code Suravee Suthikulpanit (1): iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement drivers/iommu/amd/init.c | 95 +++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 36 deletions(-)