NetBSD Problem Report #54205

From tsutsui@ceres.dti.ne.jp  Tue May 14 13:03:12 2019
Return-Path: <tsutsui@ceres.dti.ne.jp>
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 A7E967A182
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 14 May 2019 13:03:12 +0000 (UTC)
Message-Id: <201905141303.x4ED37Vn026292@ceres.dti.ne.jp>
Date: Tue, 14 May 2019 22:03:07 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: mvsata(4): buffer load failed: error=27
X-Send-Pr-Version: 3.95

>Number:         54205
>Category:       kern
>Synopsis:       mvsata(4): buffer load failed: error=27
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    tsutsui
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 14 13:05:00 +0000 2019
>Closed-Date:    Tue Oct 22 16:35:47 +0000 2019
>Last-Modified:  Tue Oct 22 16:35:47 +0000 2019
>Originator:     Izumi Tsutsui
>Release:        NetBSD 8.0
>Organization:
>Environment:
System: NetBSD 8.0 (HPT5325) #13: Tue Apr 30 13:24:19 JST 2019
        tsutsui@mirage:/s/src/sys/arch/evbarm/compile/HPT5325
Architecture: earm
Machine: evbarm
>Description:
When I tried to dump(8) a file system on an SATA drive to backup,
it failed with the following mvsata(4) error messages:

---
mvsata0:0:1: buffer load failed: error=27wd1a: DMA error reading fsbn 128 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
mvsata0:0:1: buffer load failed: error=27wd1a: DMA error reading fsbn 128 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
mvsata0:0:1: buffer load failed: error=27wd1a: DMA error reading fsbn 128 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
mvsata0:0:1: buffer load failed: error=27wd1a: DMA error reading fsbn 128 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
wd1a: DMA error reading fsbn 128 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
---

error=27 is EFBIG, maybe from sys/arch/arm/arm32/bus_dma.c
bus_dmamap_load_paddr().

>How-To-Repeat:
- newfs -b 16384 -f 4096 -i 8192 /dev/rwd1a
  on an sata drive on mvsata(4) on T5325 (or other Marvell SoC)
- extract NetBSD/evbarm 8.0 binary sets onto it
- dump 0f - /dev/rwd1a | (cd /mnt; restore xf -)

>Fix:
In mvsata.c maxsegsz passed to bus_dmamap_create(9) for data DMA transfers
is "MAXPHYS / PAGE_SIZE", but maybe it should be "MAXPHYS / PAGE_SIZE + 1"
for page unaligned transfers, as pciide_common.c etc. do.

---
Index: sys/dev/ic/mvsata.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/mvsata.c,v
retrieving revision 1.35
diff -u -p -d -r1.35 mvsata.c
--- sys/dev/ic/mvsata.c	2 May 2016 19:18:29 -0000	1.35
+++ sys/dev/ic/mvsata.c	14 May 2019 12:58:57 -0000
@@ -103,7 +103,8 @@ int	mvsata_debug = 2;
 					   sending a cmd */
 #define ATAPI_MODE_DELAY	1000	/* 1s, timeout for SET_FEATURE cmds */

-#define MVSATA_EPRD_MAX_SIZE	(sizeof(struct eprd) * (MAXPHYS / PAGE_SIZE))
+#define MVSATA_MAX_SEGS		(MAXPHYS / PAGE_SIZE + 1)
+#define MVSATA_EPRD_MAX_SIZE	(sizeof(struct eprd) * MVSATA_MAX_SEGS)


 static void mvsata_probe_drive(struct ata_channel *);
@@ -2918,7 +2919,7 @@ mvsata_port_init(struct mvsata_hc *mvhc,
 	}
 	for (i = 0; i < MVSATA_EDMAQ_LEN; i++) {
 		rv = bus_dmamap_create(mvport->port_dmat, MAXPHYS,
-		    MAXPHYS / PAGE_SIZE, MAXPHYS, 0, BUS_DMA_NOWAIT,
+		    MVSATA_MAX_SEGS, MAXPHYS, 0, BUS_DMA_NOWAIT,
 		    &mvport->port_reqtbl[i].data_dmamap);
 		if (rv != 0) {
 			aprint_error("%s:%d:%d:"

---
Izumi Tsutsui

>Release-Note:

>Audit-Trail:
From: =?UTF-8?B?SmFyb23DrXIgRG9sZcSNZWs=?= <jaromir.dolecek@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: kern/54205: mvsata(4): buffer load failed: error=27
Date: Tue, 14 May 2019 19:25:24 +0200

 Looks good, feel free to commit.

 Jaromir

 Le mar. 14 mai 2019 =C3=A0 15:05, Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> a=
  =C3=A9crit :
 >
 > >Number:         54205
 > >Category:       kern
 > >Synopsis:       mvsata(4): buffer load failed: error=3D27
 > >Confidential:   no
 > >Severity:       critical
 > >Priority:       medium
 > >Responsible:    kern-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Tue May 14 13:05:00 +0000 2019
 > >Originator:     Izumi Tsutsui
 > >Release:        NetBSD 8.0
 > >Organization:
 > >Environment:
 > System: NetBSD 8.0 (HPT5325) #13: Tue Apr 30 13:24:19 JST 2019
 >         tsutsui@mirage:/s/src/sys/arch/evbarm/compile/HPT5325
 > Architecture: earm
 > Machine: evbarm
 > >Description:
 > When I tried to dump(8) a file system on an SATA drive to backup,
 > it failed with the following mvsata(4) error messages:
 >
 > ---
 > mvsata0:0:1: buffer load failed: error=3D27wd1a: DMA error reading fsbn 1=
 28 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
 > mvsata0:0:1: buffer load failed: error=3D27wd1a: DMA error reading fsbn 1=
 28 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
 > mvsata0:0:1: buffer load failed: error=3D27wd1a: DMA error reading fsbn 1=
 28 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
 > mvsata0:0:1: buffer load failed: error=3D27wd1a: DMA error reading fsbn 1=
 28 of 128-255 (wd1 bn 1048704; cn 1040 tn 6 sn 6), retrying
 > wd1a: DMA error reading fsbn 128 of 128-255 (wd1 bn 1048704; cn 1040 tn 6=
  sn 6), retrying
 > ---
 >
 > error=3D27 is EFBIG, maybe from sys/arch/arm/arm32/bus_dma.c
 > bus_dmamap_load_paddr().
 >
 > >How-To-Repeat:
 > - newfs -b 16384 -f 4096 -i 8192 /dev/rwd1a
 >   on an sata drive on mvsata(4) on T5325 (or other Marvell SoC)
 > - extract NetBSD/evbarm 8.0 binary sets onto it
 > - dump 0f - /dev/rwd1a | (cd /mnt; restore xf -)
 >
 > >Fix:
 > In mvsata.c maxsegsz passed to bus_dmamap_create(9) for data DMA transfer=
 s
 > is "MAXPHYS / PAGE_SIZE", but maybe it should be "MAXPHYS / PAGE_SIZE + 1=
 "
 > for page unaligned transfers, as pciide_common.c etc. do.
 >
 > ---
 > Index: sys/dev/ic/mvsata.c
 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 > RCS file: /cvsroot/src/sys/dev/ic/mvsata.c,v
 > retrieving revision 1.35
 > diff -u -p -d -r1.35 mvsata.c
 > --- sys/dev/ic/mvsata.c 2 May 2016 19:18:29 -0000       1.35
 > +++ sys/dev/ic/mvsata.c 14 May 2019 12:58:57 -0000
 > @@ -103,7 +103,8 @@ int mvsata_debug =3D 2;
 >                                            sending a cmd */
 >  #define ATAPI_MODE_DELAY       1000    /* 1s, timeout for SET_FEATURE cm=
 ds */
 >
 > -#define MVSATA_EPRD_MAX_SIZE   (sizeof(struct eprd) * (MAXPHYS / PAGE_SI=
 ZE))
 > +#define MVSATA_MAX_SEGS                (MAXPHYS / PAGE_SIZE + 1)
 > +#define MVSATA_EPRD_MAX_SIZE   (sizeof(struct eprd) * MVSATA_MAX_SEGS)
 >
 >
 >  static void mvsata_probe_drive(struct ata_channel *);
 > @@ -2918,7 +2919,7 @@ mvsata_port_init(struct mvsata_hc *mvhc,
 >         }
 >         for (i =3D 0; i < MVSATA_EDMAQ_LEN; i++) {
 >                 rv =3D bus_dmamap_create(mvport->port_dmat, MAXPHYS,
 > -                   MAXPHYS / PAGE_SIZE, MAXPHYS, 0, BUS_DMA_NOWAIT,
 > +                   MVSATA_MAX_SEGS, MAXPHYS, 0, BUS_DMA_NOWAIT,
 >                     &mvport->port_reqtbl[i].data_dmamap);
 >                 if (rv !=3D 0) {
 >                         aprint_error("%s:%d:%d:"
 >
 > ---
 > Izumi Tsutsui
 >

From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54205 CVS commit: src/sys/dev/ic
Date: Sun, 23 Jun 2019 06:29:22 +0000

 Module Name:	src
 Committed By:	tsutsui
 Date:		Sun Jun 23 06:29:22 UTC 2019

 Modified Files:
 	src/sys/dev/ic: mvsata.c

 Log Message:
 Fix "mvsata:0:0:1: buffer load failed: error=27" failure.  PR/54205

 Ok'ed by jdolecek@.
 Should be pulled up to netbsd-8.


 To generate a diff of this commit:
 cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ic/mvsata.c

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

From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54205 CVS commit: src/sys/dev/ic
Date: Sun, 23 Jun 2019 06:33:17 +0000

 Module Name:	src
 Committed By:	tsutsui
 Date:		Sun Jun 23 06:33:17 UTC 2019

 Modified Files:
 	src/sys/dev/ic: mvsata.c

 Log Message:
 Add a missing newline in an error message.  Noticed in PR/54205


 To generate a diff of this commit:
 cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ic/mvsata.c

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

Responsible-Changed-From-To: kern-bug-people->tsutsui
Responsible-Changed-By: tsutsui@NetBSD.org
Responsible-Changed-When: Sat, 29 Jun 2019 03:38:13 +0000
Responsible-Changed-Why:
Committed.


State-Changed-From-To: open->pending-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sat, 29 Jun 2019 03:38:13 +0000
State-Changed-Why:
[pullup-8 #1283]


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54205 CVS commit: [netbsd-8] src/sys/dev/ic
Date: Sun, 30 Jun 2019 19:00:10 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Jun 30 19:00:10 UTC 2019

 Modified Files:
 	src/sys/dev/ic [netbsd-8]: mvsata.c

 Log Message:
 Pull up following revision(s) (requested by tsutsui in ticket #1283):

 	sys/dev/ic/mvsata.c: revision 1.47
 	sys/dev/ic/mvsata.c: revision 1.48

 Fix "mvsata:0:0:1: buffer load failed: error=27" failure.  PR/54205
 Ok'ed by jdolecek@.
 Should be pulled up to netbsd-8.

 Add a missing newline in an error message.  Noticed in PR/54205


 To generate a diff of this commit:
 cvs rdiff -u -r1.35 -r1.35.10.1 src/sys/dev/ic/mvsata.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: jdolecek@NetBSD.org
State-Changed-When: Tue, 22 Oct 2019 16:35:47 +0000
State-Changed-Why:
pullup to netbsd-8 done


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.