diff mbox

[v2] Fix the message in facility unavailable exception

Message ID d7b1e63e-7b9f-1f0e-df57-5f2e08e0ca6e@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Balbir Singh Nov. 30, 2016, 6:45 a.m. UTC
I ran into this during some testing on qemu. The current
facility_strings[] are correct when the trap address is
0xf80 (hypervisor facility unavailable). When the trap
address is 0xf60, IC (Interruption Cause) a.k.a status
in the code is undefined for values 0 and 1. This patch
adds a check to prevent printing the wrong information
and helps better direct debugging effort.

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
 Changelog v2:
   Redo conditional checks as suggested by Michael

 arch/powerpc/kernel/traps.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Michael Ellerman Dec. 3, 2016, 11:28 a.m. UTC | #1
On Wed, 2016-11-30 at 06:45:09 UTC, Balbir Singh wrote:
> I ran into this during some testing on qemu. The current
> facility_strings[] are correct when the trap address is
> 0xf80 (hypervisor facility unavailable). When the trap
> address is 0xf60, IC (Interruption Cause) a.k.a status
> in the code is undefined for values 0 and 1. This patch
> adds a check to prevent printing the wrong information
> and helps better direct debugging effort.
> 
> Signed-off-by: Balbir Singh <bsingharora@gmail.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/93c2ec0f7019a155769d1ecfc08a7d

cheers
diff mbox

Patch

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 023a462..010b11d 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1519,9 +1519,13 @@  void facility_unavailable_exception(struct pt_regs *regs)
 		return;
 	}
 
-	if ((status < ARRAY_SIZE(facility_strings)) &&
-	    facility_strings[status])
-		facility = facility_strings[status];
+	if ((hv || status >= 2) &&
+		(status < ARRAY_SIZE(facility_strings)) &&
+		facility_strings[status])
+			facility = facility_strings[status];
+	else
+		pr_warn_ratelimited("Unexpected facility unavailable exception "
+			"interruption cause %d\n", status);
 
 	/* We restore the interrupt state now */
 	if (!arch_irq_disabled_regs(regs))