NetBSD Problem Report #57386

From www@netbsd.org  Sun Apr 30 23:59:24 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CA26E1A9241
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 30 Apr 2023 23:59:24 +0000 (UTC)
Message-Id: <20230430235923.9EA7F1A9242@mollari.NetBSD.org>
Date: Sun, 30 Apr 2023 23:59:23 +0000 (UTC)
From: lloyd@must-have-coffee.gen.nz
Reply-To: lloyd@must-have-coffee.gen.nz
To: gnats-bugs@NetBSD.org
Subject: TS7200 panics in evcnt_attach_static
X-Send-Pr-Version: www-1.0

>Number:         57386
>Category:       kern
>Synopsis:       TS7200 panics in evcnt_attach_static
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 01 00:00:00 +0000 2023
>Closed-Date:    Sun May 07 06:29:43 +0000 2023
>Last-Modified:  Sun May 07 06:29:43 +0000 2023
>Originator:     Lloyd Parkes
>Release:        10.0_BETA
>Organization:
Must Have Coffee
>Environment:
N/A it won't boot
NetBSD 10.0_BETA evbarm-earmv4 with a TS7200 kernel
>Description:
When I attempted to boot 10.0_BETA on one of my TS7200s I got a diagnostic panic about init_done in evcnt_attach_static. I haven't looked closer.
>How-To-Repeat:
RedBoot> load -v -r -h 10.0.1.42 -b 0x00200000 netbsd-epe0.bin
Using default protocol (TFTP)
-
Raw file loaded 0x00200000-0x00615fd3, assumed entry at 0x00200000
RedBoot> go
[   1.0000000] panic: kernel diagnostic assertion "init_done" failed: file "/home/lloyd/NetBSD/src/sys/kern/subr_evcnt.c", line 153 evcnt_attach_static: evcnt non initialized: group=<vic1> name=<irq 0>
[   1.0000000] cpu0: Begin traceback...
[   1.0000000] 0xc0616f14: c02cf2d0
[   1.0000000] 0xc0616f34: c03fcb5c
[   1.0000000] 0xc0616f4c: c04c9870
[   1.0000000] 0xc0616f84: c03eb2b0
[   1.0000000] 0xc0616fbc: c020407c
[   1.0000000] 0xc0616ffc: c0200ab0
[   1.0000000] cpu0: End traceback...
Undefined instruction 0xe7ffffff in kernel at 0xc0209b80 (LR 0xc03fcb5c SP 0xc06
16f18)
Stopped in pid 0.0 (system) at  c0209b80:       und     0xe7ffffff
db> 
>Fix:
If possible, please assign this PR to me. 

I've been meaning to look at the interrupt handling on the TS7200 for years now and this is some motivation. 

I don't think I'll have time to look into it this week, and so I've filed this PR somewhat as a personal reminder. I'll have time to look into this next week and I won't complain if someones looks into it sooner.

>Release-Note:

>Audit-Trail:
From: Lloyd Parkes <lloyd@must-have-coffee.gen.nz>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57386: TS7200 panics in evcnt_attach_static
Date: Tue, 2 May 2023 15:07:52 +1200

 Well, this week's work has been a complete disaster, so I got on with 
 this instead.

 I can put it into a github gist or on my web server if the email system 
 mangles the diff. My TS7200 is now running multi-user with this patch 
 applied.

 Cheers,
 Lloyd

 diff -r 7893cdb2b634 sys/arch/arm/ep93xx/ep93xx_intr.c
 --- a/sys/arch/arm/ep93xx/ep93xx_intr.c	Tue Apr 25 16:17:59 2023 +0000
 +++ b/sys/arch/arm/ep93xx/ep93xx_intr.c	Tue May 02 15:04:12 2023 +1200
 @@ -257,9 +257,6 @@
   		TAILQ_INIT(&iq->iq_list);

   		snprintf(iq->iq_name, sizeof(iq->iq_name), "irq %d", i);
 -		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
 -				     NULL, (i < VIC_NIRQ ? "vic1" : "vic2"),
 -		                     iq->iq_name);
   	}
   	curcpu()->ci_intr_depth = 0;
   	set_curcpl(0);
 @@ -275,6 +272,20 @@
   	enable_interrupts(I32_bit);
   }

 +void
 +ep93xx_intr_evcnt_attach(void)
 +{
 +	struct intrq *iq;
 +	int i;
 +
 +	for (i = 0; i < NIRQ; i++) {
 +		iq = &intrq[i];
 +		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
 +				     NULL, (i < VIC_NIRQ ? "vic1" : "vic2"),
 +		                     iq->iq_name);
 +	}
 +}
 +
   void *
   ep93xx_intr_establish(int irq, int ipl, int (*ih_func)(void *), void *arg)
   {
 diff -r 7893cdb2b634 sys/arch/arm/ep93xx/ep93xxvar.h
 --- a/sys/arch/arm/ep93xx/ep93xxvar.h	Tue Apr 25 16:17:59 2023 +0000
 +++ b/sys/arch/arm/ep93xx/ep93xxvar.h	Tue May 02 15:04:12 2023 +1200
 @@ -69,6 +69,7 @@
   void	ep93xx_intr_init(void);
   void	*ep93xx_intr_establish(int irq, int ipl, int (*)(void *), void *);
   void	ep93xx_intr_disestablish(void *);
 +void    ep93xx_intr_evcnt_attach(void);
   /* Platform needs to provide this */
   bus_dma_tag_t ep93xx_bus_dma_init(struct arm32_bus_dma_tag *);
   void	ep93xx_reset(void);
 diff -r 7893cdb2b634 sys/arch/evbarm/tsarm/tsarm_machdep.c
 --- a/sys/arch/evbarm/tsarm/tsarm_machdep.c	Tue Apr 25 16:17:59 2023 +0000
 +++ b/sys/arch/evbarm/tsarm/tsarm_machdep.c	Tue May 02 15:04:12 2023 +1200
 @@ -857,3 +857,9 @@

   	return dmat;
   }
 +
 +void
 +cpu_startup_hook(void)
 +{
 +        ep93xx_intr_evcnt_attach();
 +}

From: "Jared D. McNeill" <jmcneill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57386 CVS commit: src/sys/arch
Date: Tue, 2 May 2023 09:49:33 +0000

 Module Name:	src
 Committed By:	jmcneill
 Date:		Tue May  2 09:49:33 UTC 2023

 Modified Files:
 	src/sys/arch/arm/ep93xx: ep93xx_intr.c ep93xxvar.h
 	src/sys/arch/evbarm/tsarm: tsarm_machdep.c

 Log Message:
 TS7200: Defer event counter registration until after evcnt is initialized

 Patch from Lloyd Parkes <lloyd@must-have-coffee.gen.nz> in PR# kern/57386


 To generate a diff of this commit:
 cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/ep93xx/ep93xx_intr.c
 cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ep93xx/ep93xxvar.h
 cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/tsarm/tsarm_machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Tue, 02 May 2023 09:51:06 +0000
State-Changed-Why:
Patch applied, thanks!


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Tue, 02 May 2023 10:27:23 +0000
State-Changed-Why:
pullup-10 #155


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57386 CVS commit: [netbsd-10] src/sys/arch
Date: Tue, 2 May 2023 17:52:39 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue May  2 17:52:39 UTC 2023

 Modified Files:
 	src/sys/arch/arm/ep93xx [netbsd-10]: ep93xx_intr.c ep93xxvar.h
 	src/sys/arch/evbarm/tsarm [netbsd-10]: tsarm_machdep.c

 Log Message:
 Pull up following revision(s) (requested by jmcneill in ticket #155):

 	sys/arch/arm/ep93xx/ep93xx_intr.c: revision 1.28
 	sys/arch/arm/ep93xx/ep93xxvar.h: revision 1.7
 	sys/arch/evbarm/tsarm/tsarm_machdep.c: revision 1.36

 TS7200: Defer event counter registration until after evcnt is initialized

 Patch from Lloyd Parkes in PR kern/57386


 To generate a diff of this commit:
 cvs rdiff -u -r1.27 -r1.27.4.1 src/sys/arch/arm/ep93xx/ep93xx_intr.c
 cvs rdiff -u -r1.6 -r1.6.68.1 src/sys/arch/arm/ep93xx/ep93xxvar.h
 cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/arch/evbarm/tsarm/tsarm_machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 07 May 2023 06:29:43 +0000
State-Changed-Why:
pulled up.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.