linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <bsingharora@gmail.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev <linuxppc-dev@ozlabs.org>
Subject: [PATCH v2] Fix the message in facility unavailable exception
Date: Wed, 30 Nov 2016 17:45:09 +1100	[thread overview]
Message-ID: <d7b1e63e-7b9f-1f0e-df57-5f2e08e0ca6e@gmail.com> (raw)


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(-)

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

             reply	other threads:[~2016-11-30  6:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30  6:45 Balbir Singh [this message]
2016-12-03 11:28 ` [v2] Fix the message in facility unavailable exception Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7b1e63e-7b9f-1f0e-df57-5f2e08e0ca6e@gmail.com \
    --to=bsingharora@gmail.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).