Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap

2016-11-23 Thread Olivier Cochard-Labbé
​Hi,

since this commit, my system panic when using netmap pkt-gen with a Chelsio
T540-CR NIC (I didn't reproduce it with Intel NIC).

- Latest known working system: FreeBSD 12.0-CURRENT #2 r307393
- Crash since: FreeBSD 12.0-CURRENT #1 r307396

On a fresh (r309034) system, here is he behavior:

[root@SM]~# pkt-gen -i vcxl0 -f rx -w 4
133.571714 main [2546] interface is vcxl0
133.572025 main [2670] running on 1 cpus (have 8)
133.572377 extract_ip_range [462] range is 10.0.0.1:1234 to 10.0.0.1:1234
133.572393 extract_ip_range [462] range is 10.1.0.1:1234 to 10.1.0.1:1234

​Fatal trap 12: page fault while in kernel mode
cpuid = 7; apic id = 0e
fault virtual address   = 0x0
fault code  = supervisor write data, page not present
instruction pointer = 0x20:0x80d5480e
stack pointer   = 0x28:0xfe0466ba61e0
frame pointer   = 0x28:0xfe0466ba61e0
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 1900 (pkt-gen)
trap number = 12
panic: page fault
cpuid = 7
KDB: stack backtrace:
#0 0x80971167 at kdb_backtrace+0x67
#1 0x80929b72 at vpanic+0x182
#2 0x809299e3 at panic+0x43
#3 0x80d56e84 at trap_fatal+0x324
#4 0x80d57083 at trap_pfault+0x1e3
#5 0x80d56683 at trap+0x273
#6 0x80d39261 at calltrap+0x8
#7 0x8047c664 at cxgbe_netmap_reg+0x2f4
#8 0x8063d48c at netmap_hw_reg+0x2c
#9 0x8063a93b at netmap_do_regif+0x2ab
#10 0x8063b564 at netmap_ioctl+0xba4
#11 0x8063f14e at freebsd_netmap_ioctl+0x3e
#12 0x8085e47c at devfs_ioctl+0xac
#13 0x80eee78d at VOP_IOCTL_APV+0x8d
#14 0x80a08901 at vn_ioctl+0x131
#15 0x8085ecdf at devfs_ioctl_f+0x1f
#16 0x8098ed7b at kern_ioctl+0x29b
#17 0x8098ea71 at sys_ioctl+0x171
Uptime: 4m41s
Dumping 1112 out of 16325 MB:..2%..11%..21%..31%..41%..
51%..61%..71%..81%..91%
Dump complete

(kgdb) backtrace
#0  doadump (textdump=) at pcpu.h:222
#1  0x809295f9 in kern_reboot (howto=260) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/kern/kern_shutdown.c:366
#2  0x80929bab in vpanic (fmt=, ap=) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/kern/kern_shutdown.c:759
#3  0x809299e3 in panic (fmt=0x0) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/kern/kern_shutdown.c:690
#4  0x80d56e84 in trap_fatal (frame=0xfe0466ba6120, eva=0) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/amd64/amd64/trap.c:801
#5  0x80d57083 in trap_pfault (frame=0xfe0466ba6120,
usermode=0) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/amd64/amd64/trap.c:658
#6  0x80d56683 in trap (frame=0xfe0466ba6120) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/amd64/amd64/trap.c:421
#7  0x80d39261 in calltrap () at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/amd64/amd64/exception.S:236
#8  0x80d5480e in bzero () at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/amd64/amd64/support.S:53
#9  0x8047c664 in cxgbe_netmap_reg (na=,
on=) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/dev/cxgbe/t4_netmap.c:102
#10 0x8063d48c in netmap_hw_reg (na=0xf800055ba400, onoff=1) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/dev/netmap/netmap.c:2788
#11 0x8063a93b in netmap_do_regif (priv=,
na=, ringid=, flags=)
at /usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/dev/netmap/netmap.c:2050
#12 0x8063b564 in netmap_ioctl (priv=,
cmd=, data=0xfe0466ba69b0 "vcxl0",
td=0xf8001509a500)
at /usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/dev/netmap/netmap.c:2257
#13 0x8063f14e in freebsd_netmap_ioctl (dev=,
cmd=3225184658, data=0xfe0466ba69b0 "vcxl0", ffla=,
td=0xf8001509a500) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/dev/netmap/netmap_freebsd.c:1389
#14 0x8085e47c in devfs_ioctl (ap=) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/fs/devfs/devfs_vnops.c:831
#15 0x80eee78d in VOP_IOCTL_APV (vop=,
a=) at vnode_if.c:1067
#16 0x80a08901 in vn_ioctl (fp=0xf80015191f00, com=, data=0xfe0466ba69b0, active_cred=0xf8019928bd00,
td=0x1) at vnode_if.h:448
#17 0x8085ecdf in devfs_ioctl_f (fp=0x0, com=131072, data=0x0,
cred=0x4000, td=0xf8001509a500)
at /usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/fs/devfs/devfs_vnops.c:789
#18 0x8098ed7b in kern_ioctl (td=, fd=, com=3225184658, data=0xfe0466ba69b0 "vcxl0") at
file.h:327
#19 0x8098ea71 in sys_ioctl (td=0xf8001509a500,
uap=0xfe0466ba6b10) at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/kern/sys_generic.c:746
#20 0x80d57825 in amd64_syscall (td=,
traced=0) at subr_syscall.c:135
#21 0x80d3954b in Xfast_syscall () at
/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/amd64/amd64/exception.S:396
#22 0x00080100e5ca in ?? ()


​Regards,

Olivier​

Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap

2016-10-19 Thread Shawn Webb
On Wed, Oct 19, 2016 at 12:23:24PM -0400, Shawn Webb wrote:
> On Sun, Oct 16, 2016 at 02:13:32PM +, Luigi Rizzo wrote:
> > Author: luigi
> > Date: Sun Oct 16 14:13:32 2016
> > New Revision: 307394
> > URL: https://svnweb.freebsd.org/changeset/base/307394
> > 
> > Log:
> >   Import the current version of netmap, aligned with the one on github.
> >   
> >   This commit, long overdue, contains contributions in the last 2 years
> >   from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
> >   + fixes on monitor ports
> >   + the 'ptnet' virtual device driver, and ptnetmap backend, for
> > high speed virtual passthrough on VMs (bhyve fixes in an upcoming 
> > commit)
> >   + improved emulated netmap mode
> >   + more robust error handling
> >   + removal of stale code
> >   + various fixes to code and documentation (some mixup between RX and TX
> > parameters, and private and public variables)
> >   
> >   We also include an additional tool, nmreplay, which is functionally
> >   equivalent to tcpreplay but operating on netmap ports.
> > 
> > Added:
> >   head/tools/tools/netmap/ctrs.h   (contents, props changed)
> >   head/tools/tools/netmap/nmreplay.8   (contents, props changed)
> >   head/tools/tools/netmap/nmreplay.c   (contents, props changed)
> > Modified:
> >   head/share/man/man4/netmap.4
> >   head/sys/conf/files
> >   head/sys/dev/netmap/if_ixl_netmap.h
> >   head/sys/dev/netmap/if_lem_netmap.h
> >   head/sys/dev/netmap/ixgbe_netmap.h
> >   head/sys/dev/netmap/netmap.c
> >   head/sys/dev/netmap/netmap_freebsd.c
> >   head/sys/dev/netmap/netmap_generic.c
> >   head/sys/dev/netmap/netmap_kern.h
> >   head/sys/dev/netmap/netmap_mbq.c
> >   head/sys/dev/netmap/netmap_mbq.h
> >   head/sys/dev/netmap/netmap_mem2.c
> >   head/sys/dev/netmap/netmap_mem2.h
> >   head/sys/dev/netmap/netmap_monitor.c
> >   head/sys/dev/netmap/netmap_offloadings.c
> >   head/sys/dev/netmap/netmap_pipe.c
> >   head/sys/dev/netmap/netmap_vale.c
> >   head/sys/modules/netmap/Makefile
> >   head/sys/net/netmap.h
> >   head/sys/net/netmap_user.h
> >   head/tools/tools/netmap/Makefile
> >   head/tools/tools/netmap/bridge.c
> >   head/tools/tools/netmap/pkt-gen.c
> >   head/tools/tools/netmap/vale-ctl.c
> 
> Looks like this broke VIMAGE builds:
> 
> /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
> identifier 'rd'
> CURVNET_SET(TD_TO_VNET(rd));
>^
> /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
> identifier 'rd'
> /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
> identifier 'rd'
> /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
> identifier 'rd'
> 4 errors generated.
> --- netmap_freebsd.o ---
> *** [netmap_freebsd.o] Error code 1

The attached patch fixes the build. In case it doesn't make it to the
list, it's also posted here: http://ix.io/1xFU

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c
index 50e2d0f..a3ad322 100644
--- a/sys/dev/netmap/netmap_freebsd.c
+++ b/sys/dev/netmap/netmap_freebsd.c
@@ -48,6 +48,7 @@
 #include 
 
 
+#include 
 #include 
 #include  /* sockaddrs */
 #include 
@@ -1407,7 +1408,7 @@ freebsd_netmap_ioctl(struct cdev *dev __unused, u_long 
cmd, caddr_t data,
int error;
struct netmap_priv_d *priv;
 
-   CURVNET_SET(TD_TO_VNET(rd));
+   CURVNET_SET(TD_TO_VNET(td));
error = devfs_get_cdevpriv((void **));
if (error) {
/* XXX ENOENT should be impossible, since the priv


signature.asc
Description: PGP signature


Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap

2016-10-19 Thread Shawn Webb
On Sun, Oct 16, 2016 at 02:13:32PM +, Luigi Rizzo wrote:
> Author: luigi
> Date: Sun Oct 16 14:13:32 2016
> New Revision: 307394
> URL: https://svnweb.freebsd.org/changeset/base/307394
> 
> Log:
>   Import the current version of netmap, aligned with the one on github.
>   
>   This commit, long overdue, contains contributions in the last 2 years
>   from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
>   + fixes on monitor ports
>   + the 'ptnet' virtual device driver, and ptnetmap backend, for
> high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
>   + improved emulated netmap mode
>   + more robust error handling
>   + removal of stale code
>   + various fixes to code and documentation (some mixup between RX and TX
> parameters, and private and public variables)
>   
>   We also include an additional tool, nmreplay, which is functionally
>   equivalent to tcpreplay but operating on netmap ports.
> 
> Added:
>   head/tools/tools/netmap/ctrs.h   (contents, props changed)
>   head/tools/tools/netmap/nmreplay.8   (contents, props changed)
>   head/tools/tools/netmap/nmreplay.c   (contents, props changed)
> Modified:
>   head/share/man/man4/netmap.4
>   head/sys/conf/files
>   head/sys/dev/netmap/if_ixl_netmap.h
>   head/sys/dev/netmap/if_lem_netmap.h
>   head/sys/dev/netmap/ixgbe_netmap.h
>   head/sys/dev/netmap/netmap.c
>   head/sys/dev/netmap/netmap_freebsd.c
>   head/sys/dev/netmap/netmap_generic.c
>   head/sys/dev/netmap/netmap_kern.h
>   head/sys/dev/netmap/netmap_mbq.c
>   head/sys/dev/netmap/netmap_mbq.h
>   head/sys/dev/netmap/netmap_mem2.c
>   head/sys/dev/netmap/netmap_mem2.h
>   head/sys/dev/netmap/netmap_monitor.c
>   head/sys/dev/netmap/netmap_offloadings.c
>   head/sys/dev/netmap/netmap_pipe.c
>   head/sys/dev/netmap/netmap_vale.c
>   head/sys/modules/netmap/Makefile
>   head/sys/net/netmap.h
>   head/sys/net/netmap_user.h
>   head/tools/tools/netmap/Makefile
>   head/tools/tools/netmap/bridge.c
>   head/tools/tools/netmap/pkt-gen.c
>   head/tools/tools/netmap/vale-ctl.c

Looks like this broke VIMAGE builds:

/usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
identifier 'rd'
CURVNET_SET(TD_TO_VNET(rd));
   ^
/usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
identifier 'rd'
/usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
identifier 'rd'
/usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared 
identifier 'rd'
4 errors generated.
--- netmap_freebsd.o ---
*** [netmap_freebsd.o] Error code 1

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap

2016-10-17 Thread Ed Maste
On 16 October 2016 at 10:13, Luigi Rizzo  wrote:
> Author: luigi
> Date: Sun Oct 16 14:13:32 2016
> New Revision: 307394
> URL: https://svnweb.freebsd.org/changeset/base/307394
>
> Log:
>   Import the current version of netmap, aligned with the one on github.

my tinderbox build failed with this, in sparc64 LINT:

In file included from
/scratch/tmp/emaste/freebsd/sys/modules/em/../../dev/e1000/if_lem.c:343:
/scratch/tmp/emaste/freebsd/sys/dev/netmap/if_lem_netmap.h:42:
warning: redundant redeclaration of 'netmap_adaptive_io'
[-Wredundant-decls]
/scratch/tmp/emaste/freebsd/sys/dev/netmap/netmap_kern.h:1529:
warning: previous declaration of 'netmap_adaptive_io' was here
*** [if_lem.o] Error code 1
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap

2016-10-17 Thread John Baldwin
On Sunday, October 16, 2016 02:13:32 PM Luigi Rizzo wrote:
> Author: luigi
> Date: Sun Oct 16 14:13:32 2016
> New Revision: 307394
> URL: https://svnweb.freebsd.org/changeset/base/307394
> 
> Log:
>   Import the current version of netmap, aligned with the one on github.
>   
>   This commit, long overdue, contains contributions in the last 2 years
>   from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
>   + fixes on monitor ports
>   + the 'ptnet' virtual device driver, and ptnetmap backend, for
> high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
>   + improved emulated netmap mode
>   + more robust error handling
>   + removal of stale code
>   + various fixes to code and documentation (some mixup between RX and TX
> parameters, and private and public variables)
>   
>   We also include an additional tool, nmreplay, which is functionally
>   equivalent to tcpreplay but operating on netmap ports.

FYI, this broke the build of the following kernel configs from 'make tinderbox':

sparc64 LINT kernel failed, check _.sparc64.LINT for details
i386 LINT-NOINET kernel failed, check _.i386.LINT-NOINET for details
i386 LINT kernel failed, check _.i386.LINT for details
pc98 LINT kernel failed, check _.pc98.LINT for details
i386 LINT-NOINET6 kernel failed, check _.i386.LINT-NOINET6 for details
i386 LINT-NOIP kernel failed, check _.i386.LINT-NOIP for details
i386 LINT-VIMAGE kernel failed, check _.i386.LINT-VIMAGE for details
amd64 LINT kernel failed, check _.amd64.LINT for details
amd64 LINT-NOINET kernel failed, check _.amd64.LINT-NOINET for details
powerpc LINT kernel failed, check _.powerpc.LINT for details
powerpc LINT64 kernel failed, check _.powerpc.LINT64 for details
amd64 LINT-NOINET6 kernel failed, check _.amd64.LINT-NOINET6 for details
amd64 LINT-NOIP kernel failed, check _.amd64.LINT-NOIP for details
amd64 LINT-VIMAGE kernel failed, check _.amd64.LINT-VIMAGE for details
arm LINT kernel failed, check _.arm.LINT for details

Some of the errors:

(1)

In file included from /zoo/jhb/git/freebsd/sys/modules/em/../../dev/e1000/if_lem
.c:343:
/zoo/jhb/git/freebsd/sys/dev/netmap/if_lem_netmap.h:42: warning: redundant redec
laration of 'netmap_adaptive_io' [-Wredundant-decls]
/zoo/jhb/git/freebsd/sys/dev/netmap/netmap_kern.h:1529: warning: previous declar

(2)

/zoo/jhb/git/freebsd/sys/dev/netmap/if_ptnet.c:347:15: error: shift count >= wid
th of type [-Werror,-Wshift-count-overflow]
(paddr >> 32) & 0x);
   ^  ~~
/zoo/jhb/git/freebsd/sys/sys/bus.h:882:59: note: expanded from macro 
'bus_write_4'
bus_space_write_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
 ^

For this one I think 'paddr' should be 'uint64_t' instead of 'vm_paddr_t'
which should fix the build on 32-bit platforms.

(3)

/zoo/jhb/git/freebsd/sys/dev/netmap/netmap_pt.c:72:9: error: 'DEBUG' macro 
redefined [-Werror,-Wmacro-redefined]
#define DEBUG  /* Enables communication debugging. */
^
./opt_global.h:40:9: note: previous definition is here
#define DEBUG 1
^

(4)

/zoo/jhb/git/freebsd/sys/dev/netmap/netmap_freebsd.c:671:4: error: format specif
ies type 'unsigned long' but the argument has type 'vm_paddr_t' (aka 'unsigned i
nt') [-Werror,-Wformat]
*nm_paddr,
^
/zoo/jhb/git/freebsd/sys/dev/netmap/netmap_kern.h:249:29: note: expanded from ma
cro 'D'
__LINE__, __FUNCTION__, ##__VA_ARGS__); \
  ^~~
/zoo/jhb/git/freebsd/sys/dev/netmap/netmap_freebsd.c:672:4: error: format specif
ies type 'unsigned long' but the argument has type 'rman_res_t' (aka 'unsigned l
ong long') [-Werror,-Wformat]
rman_get_size(ptn_dev->pci_mem),
^~~
/zoo/jhb/git/freebsd/sys/dev/netmap/netmap_kern.h:249:29: note: expanded from ma
cro 'D'
__LINE__, __FUNCTION__, ##__VA_ARGS__); \
  ^~~

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"