From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tT9sQ6xbyzDvt6 for ; Wed, 30 Nov 2016 17:45:30 +1100 (AEDT) Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tT9sQ0VQdz9t2g for ; Wed, 30 Nov 2016 17:45:30 +1100 (AEDT) Received: by mail-pg0-x244.google.com with SMTP id e9so400061pgc.1 for ; Tue, 29 Nov 2016 22:45:29 -0800 (PST) To: Michael Ellerman Subject: [PATCH v2] Fix the message in facility unavailable exception Cc: linuxppc-dev From: Balbir Singh Message-ID: Date: Wed, 30 Nov 2016 17:45:09 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- Changelog v2: Redo conditional checks as suggested by Michael arch/powerpc/kernel/traps.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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)) -- 2.5.5