diff mbox series

[kvm-unit-tests,v5,13/29] powerpc: Make interrupt handler error more readable

Message ID 20231216134257.1743345-14-npiggin@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series powerpc: updates, P10, PNV support | expand

Commit Message

Nicholas Piggin Dec. 16, 2023, 1:42 p.m. UTC
Installing the same handler twice reports a shifted trap vector
address which is hard to decipher. Print the unshifed address.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 lib/powerpc/processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth Dec. 19, 2023, 11:53 a.m. UTC | #1
On 16/12/2023 14.42, Nicholas Piggin wrote:
> Installing the same handler twice reports a shifted trap vector
> address which is hard to decipher. Print the unshifed address.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   lib/powerpc/processor.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/powerpc/processor.c b/lib/powerpc/processor.c
> index aaf45b68..b4cd5b4c 100644
> --- a/lib/powerpc/processor.c
> +++ b/lib/powerpc/processor.c
> @@ -26,7 +26,7 @@ void handle_exception(int trap, void (*func)(struct pt_regs *, void *),
>   	trap >>= 8;

You only change this to >>= 5 in the next patch...

>   	if (func && handlers[trap].func) {
> -		printf("exception handler installed twice %#x\n", trap);
> +		printf("exception handler installed twice %#x\n", trap << 5);

... so I think you should move this patch here after the next one.

  Thomas


>   		abort();
>   	}
>   	handlers[trap].func = func;
Nicholas Piggin Dec. 22, 2023, 9:52 a.m. UTC | #2
On Tue Dec 19, 2023 at 9:53 PM AEST, Thomas Huth wrote:
> On 16/12/2023 14.42, Nicholas Piggin wrote:
> > Installing the same handler twice reports a shifted trap vector
> > address which is hard to decipher. Print the unshifed address.
> > 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >   lib/powerpc/processor.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/powerpc/processor.c b/lib/powerpc/processor.c
> > index aaf45b68..b4cd5b4c 100644
> > --- a/lib/powerpc/processor.c
> > +++ b/lib/powerpc/processor.c
> > @@ -26,7 +26,7 @@ void handle_exception(int trap, void (*func)(struct pt_regs *, void *),
> >   	trap >>= 8;
>
> You only change this to >>= 5 in the next patch...
>
> >   	if (func && handlers[trap].func) {
> > -		printf("exception handler installed twice %#x\n", trap);
> > +		printf("exception handler installed twice %#x\n", trap << 5);
>
> ... so I think you should move this patch here after the next one.

Paper bag for me.

Thanks,
Nick
diff mbox series

Patch

diff --git a/lib/powerpc/processor.c b/lib/powerpc/processor.c
index aaf45b68..b4cd5b4c 100644
--- a/lib/powerpc/processor.c
+++ b/lib/powerpc/processor.c
@@ -26,7 +26,7 @@  void handle_exception(int trap, void (*func)(struct pt_regs *, void *),
 	trap >>= 8;
 
 	if (func && handlers[trap].func) {
-		printf("exception handler installed twice %#x\n", trap);
+		printf("exception handler installed twice %#x\n", trap << 5);
 		abort();
 	}
 	handlers[trap].func = func;