[PATCH AUTOSEL 6.16 38/85] ACPI: PRM: Reduce unnecessary printing to avoid user confusion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhu Qiyu <qiyuzhu2@xxxxxxx>

[ Upstream commit 3db5648c4d608b5483470efc1da9780b081242dd ]

Commit 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM
handler and context") introduced non-essential printing "Failed to find
VA for GUID: xxxx, PA: 0x0" which may confuse users to think that
something wrong is going on while it is not the case.

According to the PRM Spec Section 4.1.2 [1], both static data buffer
address and ACPI parameter buffer address may be NULL if they are not
needed, so there is no need to print out the "Failed to find VA ... "
in those cases.

Link: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf # [1]
Signed-off-by: Zhu Qiyu <qiyuzhu2@xxxxxxx>
Link: https://patch.msgid.link/20250704014104.82524-1-qiyuzhu2@xxxxxxx
[ rjw: Edits in new comments, subject and changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

LLM Generated explanations, may be completely bogus:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Bug Fix for User-Visible Issue
The commit fixes false warning messages that were confusing users. The
original commit 088984c8d54c (which was already backported to stable
with "Cc: All applicable <stable@xxxxxxxxxxxxxxx>") introduced an
unconditional warning in `efi_pa_va_lookup()`:

```c
pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
```

This warning was printed even when the physical address (PA) was
legitimately 0/NULL, which according to the PRM specification is valid
for both `static_data_buffer_address` and `acpi_param_buffer_address`
when they are not needed.

## Small and Contained Fix
The fix is minimal and surgical:
1. Removes the unconditional warning from `efi_pa_va_lookup()`
2. Adds conditional warnings only when addresses are non-zero but lookup
   fails:
   - For handler_addr: warns if lookup fails (this should never be zero)
   - For static_data_buffer_addr: only warns if
     `handler_info->static_data_buffer_address` is non-zero but lookup
     fails
   - For acpi_param_buffer_addr: only warns if
     `handler_info->acpi_param_buffer_address` is non-zero but lookup
     fails

## Regression Fix
Since the problematic commit 088984c8d54c has been backported to v6.12
stable kernels, this fix addresses a regression in stable trees where
users are seeing confusing warning messages for legitimate NULL
addresses.

## Low Risk
The change:
- Does not modify any functional behavior
- Only adjusts when warning messages are printed
- Has no architectural changes or side effects
- Is confined to the ACPI PRM subsystem

## Clear Benefit
The fix eliminates user confusion from false warnings while maintaining
proper warnings for actual error conditions (when a non-zero address
fails lookup).

Given that the original problematic commit is in stable kernels and this
is a targeted fix for that regression with minimal risk, it clearly
meets the stable backporting criteria.

 drivers/acpi/prmt.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
index e549914a636c..be033bbb126a 100644
--- a/drivers/acpi/prmt.c
+++ b/drivers/acpi/prmt.c
@@ -85,8 +85,6 @@ static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
 		}
 	}
 
-	pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
-
 	return 0;
 }
 
@@ -154,13 +152,37 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
 		guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
 		th->handler_addr =
 			(void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
+		/*
+		 * Print a warning message if handler_addr is zero which is not expected to
+		 * ever happen.
+		 */
+		if (unlikely(!th->handler_addr))
+			pr_warn("Failed to find VA of handler for GUID: %pUL, PA: 0x%llx",
+				&th->guid, handler_info->handler_address);
 
 		th->static_data_buffer_addr =
 			efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+		/*
+		 * According to the PRM specification, static_data_buffer_address can be zero,
+		 * so avoid printing a warning message in that case.  Otherwise, if the
+		 * return value of efi_pa_va_lookup() is zero, print the message.
+		 */
+		if (unlikely(!th->static_data_buffer_addr && handler_info->static_data_buffer_address))
+			pr_warn("Failed to find VA of static data buffer for GUID: %pUL, PA: 0x%llx",
+				&th->guid, handler_info->static_data_buffer_address);
 
 		th->acpi_param_buffer_addr =
 			efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
 
+		/*
+		 * According to the PRM specification, acpi_param_buffer_address can be zero,
+		 * so avoid printing a warning message in that case.  Otherwise, if the
+		 * return value of efi_pa_va_lookup() is zero, print the message.
+		 */
+		if (unlikely(!th->acpi_param_buffer_addr && handler_info->acpi_param_buffer_address))
+			pr_warn("Failed to find VA of acpi param buffer for GUID: %pUL, PA: 0x%llx",
+				&th->guid, handler_info->acpi_param_buffer_address);
+
 	} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
 
 	return 0;
-- 
2.39.5





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux