NetBSD Problem Report #55715

From gson@gson.org  Sun Oct 11 14:53:59 2020
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 5EE3E1A921F
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 11 Oct 2020 14:53:59 +0000 (UTC)
Message-Id: <20201011145343.BEC47253EDD@guava.gson.org>
Date: Sun, 11 Oct 2020 17:53:43 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"
X-Send-Pr-Version: 3.95

>Number:         55715
>Category:       port-pmax
>Synopsis:       pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    port-pmax-maintainer
>State:          analyzed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 11 14:55:00 +0000 2020
>Closed-Date:    
>Last-Modified:  Mon Jan 11 10:15:01 +0000 2021
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current
>Organization:
>Environment:
System: NetBSD
Architecture: mips
Machine: pmax
>Description:

The TNF NetBSD/pmax testbed consistently panics during the
sigbus_adraln test case of the lib/libc/gen/t_siginfo test:

  lib/libc/gen/t_siginfo (178/885): 8 test cases
      sigalarm: [1.164062s] Passed.
      sigbus_adraln: [ 5559.7773467] trap: pid 2983(t_siginfo): sig 10: cause=0x10 epc=0xd7b1010 va=0x7b6dc011
  [ 5559.7773467] registers:
  [ 5559.7773467] [ 0]=00000000 [ 1]=ffffffe0 [ 2]=7b6dc011 [ 3]=00003fce
  [ 5559.7773467] [ 4]=7b6846f8 [ 5]=00000001 [ 6]=00000001 [ 7]=7b3d0031
  [ 5559.7773467] [ 8]=00000002 [ 9]=00000002 [10]=fffffff6 [11]=0000000a
  [ 5559.7773467] [12]=00000001 [13]=7ff16360 [14]=7b6a6008 [15]=00000001
  [ 5559.7773467] [16]=0d7c3c34 [17]=0d7c3c88 [18]=7ff16c78 [19]=00000010
  [ 5559.7773467] [20]=7ff16c60 [21]=00000001 [22]=7b683004 [23]=7b6d0000
  [ 5559.7773467] [24]=7b6a63b0 [25]=7b620488 [26]=00000000 [27]=00000000
  [ 5559.7773467] [28]=0d7cbaf0 [29]=7ff16b98 [30]=7b6c0000 [31]=0d7b1008
  [ 5559.7929717] panic: kernel debugging assertion "asid == curcpu()->ci_pmap_asid_cur" failed: file "/tmp/bracket/build/2020.10.11.07.08.29-pmax/src/sys/uvm/pmap/pmap_tlb.c", line 1077 pmap_tlb_asid_check: asid (0) != current asid (0xd)
  [ 5559.7929717] cpu0: Begin traceback...
  kernel debugging assertion "asid == curcpu()->ci_pmap_asid_cur" failed:[ 5559.7929717] pid -2135851832 not found
  [ 5559.7929717] cpu0: End traceback...
  [ 5559.7929717] 0x80b17cb0: cpu_reboot+3c (80b16000,0,829d4400,8056ba80) ra 802f9d4c sz 24
  [ 5559.7929717] 0x80b17cc8: kern_reboot+7c (80b16000,0,829d4400,8056ba80) ra 80342890 sz 40
  [ 5559.7929717] 0x80b17cf0: vpanic+1b0 (80b16000,0,829d4400,8056ba80) ra 8047e8cc sz 48
  [ 5559.7929717] 0x80b17d20: kern_assert+3c (80b16000,804a8afc,804a8ad8,804a88c0) ra 80051268 sz 32
  [ 5559.7929717] 0x80b17d40: pmap_tlb_asid_check+84 (80b16000,804a8afc,804a8ad8,804a88c0) ra 80052f50 sz 40
  [ 5559.7929717] 0x80b17d68: trap+acc (80b16000,804a8afc,804a8ad8,7b620148) ra 80043fd4 sz 480
  [ 5559.7929717] 0x80b17f48: mips1_user_gen_exception+e4 (80b16000,804a8afc,804a8ad8,7b620148) ra 0 sz 0
  [ 5559.7929717] User-level: pid 2983.2983

  [ 5559.7929717] dump to dev 19,1 not possible
  [ 5559.7929717] rebooting...

The problem started some time between source dates 2020.07.23.12.13.25
and 2020.09.01.04.19.16.

Console log:

  http://releng.netbsd.org/b5reports/pmax/2020/2020.09.01.04.19.16/test.log

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->analyzed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Sun, 10 Jan 2021 20:35:07 +0000
State-Changed-Why:
The call to mips_cpu_exception in src/cpus/cpu_mips_instr_loadstore.cc
needs to pass vaddr_{asid,vpn2}


From: "Nick Hudson" <skrll@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55715 CVS commit: src/tests/lib/libc/gen
Date: Sun, 10 Jan 2021 20:46:14 +0000

 Module Name:	src
 Committed By:	skrll
 Date:		Sun Jan 10 20:46:14 UTC 2021

 Modified Files:
 	src/tests/lib/libc/gen: t_siginfo.c

 Log Message:
 PR/55715: pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"

 disable the sigbus_adraln test on qemu for now


 To generate a diff of this commit:
 cvs rdiff -u -r1.42 -r1.43 src/tests/lib/libc/gen/t_siginfo.c

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

From: "Nick Hudson" <skrll@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55715 CVS commit: src/tests/lib/libc/gen
Date: Mon, 11 Jan 2021 07:17:49 +0000

 Module Name:	src
 Committed By:	skrll
 Date:		Mon Jan 11 07:17:49 UTC 2021

 Modified Files:
 	src/tests/lib/libc/gen: t_siginfo.c

 Log Message:
 PR/55715: pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"

 It's GXemul that has the bug! Unfortunately, there's no way (currently) to
 detect if we're running under GXemul emulation, so disable for all mips
 for now.  Hopefully, GXemul will get fixed soon.


 To generate a diff of this commit:
 cvs rdiff -u -r1.43 -r1.44 src/tests/lib/libc/gen/t_siginfo.c

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

From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-pmax/55715: pmax testbed panics with "assertion "asid ==
 curcpu()->ci_pmap_asid_cur" failed"
Date: Mon, 11 Jan 2021 10:12:45 +0000

 This is a multi-part message in MIME format.
 --------------AD1B6B882B3079477D4474C8
 Content-Type: text/plain; charset=utf-8; format=flowed
 Content-Transfer-Encoding: 7bit

 This seems to work for pmax (untested on MMU{4,10)K

 Nick

 --------------AD1B6B882B3079477D4474C8
 Content-Type: text/x-patch; charset=UTF-8;
  name="cpu_mips_instr_loadstore.cc.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="cpu_mips_instr_loadstore.cc.diff"

 --- src/cpus/cpu_mips_instr_loadstore.cc.orig	2021-01-10 19:36:56.594877971 +0000
 +++ src/cpus/cpu_mips_instr_loadstore.cc	2021-01-11 10:08:47.671788344 +0000
 @@ -58,6 +58,31 @@
  	/*  Check alignment:  */
  	if (addr & (LS_SIZE - 1)) {
  #if 1
 +		uint64_t vaddr_vpn2=0, vaddr_asid=0;
 +
 +	        int exc_model = cpu->cd.mips.cpu_type.exc_model;
 +		struct mips_coproc *cp0 = cpu->cd.mips.coproc[0];
 +
 +		if (exc_model == EXC3K) {
 +			vaddr_asid = (cp0->reg[COP0_ENTRYHI] &
 +			    R2K3K_ENTRYHI_ASID_MASK) >>
 +			    R2K3K_ENTRYHI_ASID_SHIFT;
 +			vaddr_vpn2 = (addr & R2K3K_ENTRYHI_VPN_MASK) >>
 +			    R2K3K_ENTRYHI_VPN_SHIFT;
 +		} else {
 +			vaddr_asid = cp0->reg[COP0_ENTRYHI] & ENTRYHI_ASID;
 +
 +			if (cpu->cd.mips.cpu_type.mmu_model == MMU10K) {
 +				vaddr_vpn2 = (addr &
 +				    ENTRYHI_VPN2_MASK_R10K) >>
 +				    ENTRYHI_VPN2_SHIFT;
 +			} else {
 +				vaddr_vpn2 = (addr &
 +				    ENTRYHI_VPN2_MASK) >>
 +				    ENTRYHI_VPN2_SHIFT;
 +			}
 +		}
 +
  		/*  Cause an address alignment exception:  */
  		mips_cpu_exception(cpu,
  #ifdef LS_LOAD
 @@ -65,7 +90,7 @@
  #else
  		    EXCEPTION_ADES,
  #endif
 -		    0, addr, 0, 0, 0, 0);
 +		    0, addr, 0, vaddr_vpn2, vaddr_asid, 0);
  #else
  		fatal("{ mips dyntrans alignment exception, size = %i,"
  		    " addr = %016"PRIx64", pc = %016"PRIx64" }\n", LS_SIZE,

 --------------AD1B6B882B3079477D4474C8--

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.