NetBSD Problem Report #59212

From www@netbsd.org  Tue Mar 25 12:55:01 2025
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 19A611A9239
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 25 Mar 2025 12:55:01 +0000 (UTC)
Message-Id: <20250325125459.A12861A923D@mollari.NetBSD.org>
Date: Tue, 25 Mar 2025 12:54:59 +0000 (UTC)
From: netbsd@precedence.co.uk
Reply-To: netbsd@precedence.co.uk
To: gnats-bugs@NetBSD.org
Subject: XEN3_DOM0 panics as NR_PIRQS is too small
X-Send-Pr-Version: www-1.0

>Number:         59212
>Category:       port-xen
>Synopsis:       XEN3_DOM0 panics as NR_PIRQS is too small
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-xen-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 25 13:00:00 +0000 2025
>Last-Modified:  Fri Apr 11 15:15:01 +0000 2025
>Originator:     Stephen Borrill
>Release:        10.1_STABLE
>Organization:
>Environment:
NetBSD xen1 10.1_STABLE NetBSD 10.1_STABLE (XEN3_DOM0) #2: Mon Mar 24 14:12:59 GMT 2025  root@builder10:/usr/work/obj/10/amd64/sys/arch/amd64/compile/XEN3_DOM0 amd64

>Description:
I have an IBM x3550M4 server. 10.1_STABLE GENERIC boots fine. Booting XEN3_DOM0 panics during device attachment:

[   1.0000030] mfii0 at pci4 dev 0 function 0: "ServeRAID M5110", firmware 23.34.0-0023, 512MB cache
[   1.0000030] panic: pirq 4991 out of bound, increase NR_PIRQS
[   1.0000030] cpu0: Begin traceback...
[   1.0000030] vpanic() at netbsd:vpanic+0x177
[   1.0000030] panic() at netbsd:panic+0x3c
[   1.0000030] bind_pirq_to_evtch() at netbsd:bind_pirq_to_evtch+0x97

From sys/arch/xen/xen/evtchn.c:

#define NR_PIRQS        NR_EVENT_CHANNELS

This equates to 4096 and, indeed, 4991 is greater than 4096.

>How-To-Repeat:
Boot XEN3_DOM0 kernel on an IBM x3550M4 (likely other server-spec hardware too).
>Fix:
A workaround, not a fix, is to increase NR_PIRQS as follows:

--- sys/arch/xen/xen/evtchn.c   7 Sep 2022 00:40:19 -0000       1.100
+++ sys/arch/xen/xen/evtchn.c   24 Mar 2025 14:18:26 -0000
@@ -89,7 +89,7 @@
 #define NBSD_XEN_MAX_VCPUS HVM_MAX_VCPUS
 #endif

-#define        NR_PIRQS        NR_EVENT_CHANNELS
+#define        NR_PIRQS        (NR_EVENT_CHANNELS*2)

 /*
  * This lock protects updates to the following mapping and reference-count

>Audit-Trail:
From: Hauke Fath <h.fath@nt.tu-darmstadt.de>
To: gnats-bugs@netbsd.org, port-xen-maintainer@netbsd.org,
        gnats-admin@netbsd.org
Cc: Hauke Fath <hf@spg.tu-darmstadt.de>
Subject: Re: port-xen/59212: XEN3_DOM0 panics as NR_PIRQS is too small
Date: Wed, 9 Apr 2025 14:31:01 +0200

 On 25.03.2025 14:00, netbsd@precedence.co.uk wrote:
 > A workaround, not a fix, is to increase NR_PIRQS as follows:

 FTR, I found this change necessary for a netbsd-10 xen dom0 on a 
 Supermicro H12SSW-INL with a 16 core AMD 7313P, to avoid

 [...]
 [   1.0000030] xhci0 at pci2 dev 0 function 3: AMD product 148c (rev.0x00)
 [   1.0000030] panic: pirq 6655 out of bound, increase NR_PIRQS
 [   1.0000030] cpu0: Begin traceback...
 [   1.0000030] vpanic() at netbsd:vpanic+0x177
 [   1.0000030] panic() at netbsd:panic+0x3c
 [   1.0000030] bind_pirq_to_evtch() at netbsd:bind_pirq_to_evtch+0x97
 [   1.0000030] intr_establish_xname() at netbsd:intr_establish_xname+0xe2
 [   1.0000030] x86_pci_msix_establish() at 
 netbsd:x86_pci_msix_establish+0x6c
 [   1.0000030] xhci_pci_attach() at netbsd:xhci_pci_attach+0x215
 [   1.0000030] config_attach_internal() at netbsd:config_attach[-- break 
 #0(1) sent -- `\z' -- Wed Apr  9 13:29:38 2025]
 db{0}> reboot


 -- 
       The ASCII Ribbon Campaign                    Hauke Fath
 ()     No HTML/RTF in email	        Institut für Nachrichtentechnik
 /\     No Word docs in email                     TU Darmstadt
       Respect for open standards              Ruf +49-6151-16-21344

From: Hauke Fath <hf@spg.tu-darmstadt.de>
To: gnats-bugs@netbsd.org
Cc: port-xen-maintainer@netbsd.org, gnats-admin@netbsd.org,
        netbsd@precedence.co.uk, Hauke Fath <hf@spg.tu-darmstadt.de>
Subject: Re: port-xen/59212: XEN3_DOM0 panics as NR_PIRQS is too small
Date: Fri, 11 Apr 2025 16:36:58 +0200

 In addition, after the patch -current gives me

 [...]
 [   1.0000030] xhci0 at pci2 dev 0 function 3: AMD product 148c (rev. 0x00)
 [   1.0000030] panic: kernel diagnostic assertion "gsi < 
 NR_EVENT_CHANNELS" failed: file "/u/sources/netbsd-developer/
 [   1.0000030] cpu0: Begin traceback...
 [   1.0000030] vpanic() at netbsd:vpanic+0x161
 [   1.0000030] kern_assert() at netbsd:kern_assert+0x4b
 [   1.0000030] intr_establish_xname() at netbsd:intr_establish_xname+0x2db
 [   1.0000030] x86_pci_msix_establish() at 
 netbsd:x86_pci_msix_establish+0x7e
 [   1.0000030] xhci_pci_attach() at netbsd:xhci_pci_attach+0x21c
 [   1.0000030] config_attach_internal() at 
 netbsd:config_attach_internal+0x19f
 [   1.0000030] config_found_acquire() at netbsd:config_found_acquire+0x5d
 [   1.0000030] config_found() at netbsd:config_found+0x31
 [   1.0000030] pci_probe_device1() at netbsd:pci_probe_device1+0x6b6
 [   1.0000030] pci_enumerate_bus1() at netbsd:pci_enumerate_bus1+0x1af
 [   1.0000030] pcirescan() at netbsd:pcirescan+0x4a
 [   1.0000030] pciattach() at netbsd:pciattach+0x195
 [   1.0000030] config_attach_internal() at 
 netbsd:config_attach_internal+0x19f
 [   1.0000030] config_found_acquire() at netbsd:config_found_acquire+0x5d
 [   1.0000030] config_found() at netbsd:config_found+0x31
 [   1.0000030] ppbattach() at netbsd:ppbattach+0x227
 [   1.0000030] config_attach_internal() at 
 netbsd:config_attach_internal+0x19f
 [   1.0000030] config_found_acquire() at netbsd:config_found_acquire+0x5d
 [   1.0000030] config_found() at netbsd:config_found+0x31
 [   1.0000030] pci_probe_device1() at netbsd:pci_probe_device1+0x6b6
 [   1.0000030] pci_enumerate_bus1() at netbsd:pci_enumerate_bus1+0x1af
 [   1.0000030] pcirescan() at netbsd:pcirescan+0x4a
 [   1.0000030] pciattach() at netbsd:pciattach+0x195
 [   1.0000030] config_attach_internal() at 
 netbsd:config_attach_internal+0x19f
 [   1.0000030] config_found_acquire() at netbsd:config_found_acquire+0x5d
 [   1.0000030] config_found() at netbsd:config_found+0x31
 [   1.0000030] mp_pci_scan() at netbsd:mp_pci_scan+0xcb
 [   1.0000030] hypervisor_attach() at netbsd:hypervisor_attach+0x58b
 [   1.0000030] config_attach_internal() at 
 netbsd:config_attach_internal+0x19f
 [   1.0000030] config_found_acquire() at netbsd:config_found_acquire+0x5d
 [   1.0000030] config_found() at netbsd:config_found+0x31
 [   1.0000030] xen_mainbus_attach() at netbsd:xen_mainbus_attach+0x9e
 [   1.0000030] config_attach_internal() at 
 netbsd:config_attach_internal+0x19f
 [   1.0000030] config_attach() at netbsd:config_attach+0x53
 [   1.0000030] config_rootfound() at netbsd:config_rootfound+0x44
 [   1.0000030] cpu_configure() at netbsd:cpu_configure+0x25
 [   1.0000030] main() at netbsd:main+0x306
 [   1.0000030] cpu0: End traceback...
 [   1.0000030] fatal breakpoint trap in supervisor mode
 [   1.0000030] trap type 1 code 0 rip 0xff


 -- 
       The ASCII Ribbon Campaign                    Hauke Fath
 ()     No HTML/RTF in email	        Institut für Nachrichtentechnik
 /\     No Word docs in email                     TU Darmstadt
       Respect for open standards              Ruf +49-6151-16-21344

From: Hauke Fath <hf@spg.tu-darmstadt.de>
To: gnats-bugs@netbsd.org, port-xen-maintainer@netbsd.org,
        gnats-admin@netbsd.org, netbsd@precedence.co.uk
Cc: Hauke Fath <hf@spg.tu-darmstadt.de>
Subject: Re: port-xen/59212: XEN3_DOM0 panics as NR_PIRQS is too small
Date: Fri, 11 Apr 2025 17:05:55 +0200

 I don't know if this

 <https://lore.kernel.org/lkml/20221114181632.3279119-1-seanjc@google.com/T/>

 is relevant?

 -- 
       The ASCII Ribbon Campaign                    Hauke Fath
 ()     No HTML/RTF in email	        Institut für Nachrichtentechnik
 /\     No Word docs in email                     TU Darmstadt
       Respect for open standards              Ruf +49-6151-16-21344

From: Manuel Bouyer <bouyer@antioche.eu.org>
To: Hauke Fath <hf@spg.tu-darmstadt.de>
Cc: gnats-bugs@netbsd.org, port-xen-maintainer@netbsd.org,
        gnats-admin@netbsd.org, netbsd@precedence.co.uk
Subject: Re: port-xen/59212: XEN3_DOM0 panics as NR_PIRQS is too small
Date: Fri, 11 Apr 2025 17:10:59 +0200

 On Fri, Apr 11, 2025 at 05:05:55PM +0200, Hauke Fath wrote:
 > I don't know if this
 > 
 > <https://lore.kernel.org/lkml/20221114181632.3279119-1-seanjc@google.com/T/>
 > 
 > is relevant?

 AFAIK this just clarifies some defines but the result should be the
 same

 -- 
 Manuel Bouyer <bouyer@antioche.eu.org>
      NetBSD: 26 ans d'experience feront toujours la difference
 --

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-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.