Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Sep 2018 22:25:58 +0200
From:      Vincenzo Maffione <v.maffione@gmail.com>
To:        "freebsd-net@freebsd.org" <net@freebsd.org>, Luigi Rizzo <rizzo@iet.unipi.it>
Subject:   Re: vale and netmap module questions
Message-ID:  <CA%2B_eA9gH_uzxV_YLBH1XdM-ygPUxXzD_W9_b45jTmeY-t0bQKg@mail.gmail.com>
In-Reply-To: <20180901014953.GV45503@funkthat.com>
References:  <20180901014953.GV45503@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Il giorno sab 1 set 2018 alle ore 03:50 John-Mark Gurney <jmg@funkthat.com>
ha scritto:

> First, does vale work for anyone?  At least one of the documented
> commands in vale(4) does not work.
>
> After manually building the netmap module and loading it:
> # tcpdump -ni vale-a:1
> 313.748851 nm_open [947] invalid bridge name vale-a:1
> tcpdump: netmap open: cannot access vale-a:1: Invalid argument
>

That name is invalid. See netmap(4).


>
> If I run tcpdump with a more correct looking name of vale1:a, I get a
> null deref panic in ifunit_ref.  Full trace is at the end.
>

Yes, this is a known bug, already posted to this mailing list. Don't build
netmap as a module, but link it in the kernel image and it will work.
(Add "dev netmap" to the kernel config).


>
> Second, is there a good reason why the netmap module is still
> disconnected from being built as a module?  I guess not working
> would be one, but I figure the above might be an aarch64 specific
> problem, and not a general issue.
>

On x86_64 netmap is not built as a module, so everything works fine. I
don't see any reason why it should be a module in aarch64.

Cheers,
  Vincenzo


>
> FreeBSD generic 12.0-ALPHA3 FreeBSD 12.0-ALPHA3 #0 r338296M: Sat Aug 25
> 06:17:25 UTC 2018     freebsd@generic:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC
> arm64
>
> netmap: loaded module
> Fatal data abort:
>   x0: ffff00005894f900
>   x1: ffff000040351028
>   x2:                5
>   x3: ffff0000405e4090
>   x4:             4000
>   x5:                0
>   x6:                0
>   x7: ffff000040351cb0
>   x8:                0
>   x9: ffff000000a09960
>  x10: ffff00005894f908
>  x11:                0
>  x12:                1
>  x13: fffffcffc0000000
>  x14:                3
>  x15:            10000
>  x16: ffff00005cd35580
>  x17: ffff000000476de0
>  x18: ffff000040351010
>  x19: ffff000040351160
>  x20: fffffd000739798e
>  x21: ffff000000a02000
>  x22:                1
>  x23:                0
>  x24: fffffd0007397988
>  x25:                0
>  x26:                1
>  x27:                0
>  x28: fffffd0007397982
>  x29: ffff000040351050
>   sp: ffff000040351010
>   lr: ffff000000476e0c
>  elr: ffff000000476e1c
> spsr:         60000345
>  far:               28
>  esr:         96000007
> [ thread pid 802 tid 100096 ]
> Stopped at      ifunit_ref+0x3c:        ldr     x8, [x8, #40]
> db> bt
> Tracing pid 802 tid 100096 td 0xfffffd0007422000
> db_trace_self() at db_stack_trace+0xf0
>          pc = 0xffff00000069b81c  lr = 0xffff0000000d6b28
>          sp = 0xffff000040350920  fp = 0xffff000040350950
>
> db_stack_trace() at db_command+0x220
>          pc = 0xffff0000000d6b28  lr = 0xffff0000000d67ac
>          sp = 0xffff000040350960  fp = 0xffff000040350a40
>
> db_command() at db_command_loop+0x60
>          pc = 0xffff0000000d67ac  lr = 0xffff0000000d6570
>          sp = 0xffff000040350a50  fp = 0xffff000040350a70
>
> db_command_loop() at db_trap+0xf4
>          pc = 0xffff0000000d6570  lr = 0xffff0000000d9694
>          sp = 0xffff000040350a80  fp = 0xffff000040350ca0
>
> db_trap() at kdb_trap+0x1d8
>          pc = 0xffff0000000d9694  lr = 0xffff0000003cdf70
>          sp = 0xffff000040350cb0  fp = 0xffff000040350d60
>
> kdb_trap() at data_abort+0x1e0
>          pc = 0xffff0000003cdf70  lr = 0xffff0000006b5ca4
>          sp = 0xffff000040350d70  fp = 0xffff000040350e20
>
> data_abort() at do_el1h_sync+0x11c
>          pc = 0xffff0000006b5ca4  lr = 0xffff0000006b59c0
>          sp = 0xffff000040350e30  fp = 0xffff000040350e60
>
> do_el1h_sync() at handle_el1h_sync+0x74
>          pc = 0xffff0000006b59c0  lr = 0xffff00000069d874
>          sp = 0xffff000040350e70  fp = 0xffff000040350f80
>
> handle_el1h_sync() at ifunit_ref+0x28
>          pc = 0xffff00000069d874  lr = 0xffff000000476e08
>          sp = 0xffff000040350f90  fp = 0xffff000040351050
>
> ifunit_ref() at netmap_get_bdg_na+0x194
>          pc = 0xffff000000476e08  lr = 0xffff00005cd20b24
>          sp = 0xffff000040351060  fp = 0xffff0000403510c0
>
> netmap_get_bdg_na() at netmap_get_na+0x1b0
>          pc = 0xffff00005cd20b24  lr = 0xffff00005cd15994
>          sp = 0xffff0000403510d0  fp = 0xffff000040351120
>
> netmap_get_na() at netmap_ioctl+0xcd0
>          pc = 0xffff00005cd15994  lr = 0xffff00005cd18160
>          sp = 0xffff000040351130  fp = 0xffff0000403511f0
>
> netmap_ioctl() at netmap_ioctl_legacy+0x4b8
>          pc = 0xffff00005cd18160  lr = 0xffff00005cd2b188
>          sp = 0xffff000040351200  fp = 0xffff0000403515b0
>
> netmap_ioctl_legacy() at netmap_ioctl+0x15c
>          pc = 0xffff00005cd2b188  lr = 0xffff00005cd175ec
>          sp = 0xffff0000403515c0  fp = 0xffff000040351680
>
> netmap_ioctl() at freebsd_netmap_ioctl+0x4c
>          pc = 0xffff00005cd175ec  lr = 0xffff00005cd25f94
>          sp = 0xffff000040351690  fp = 0xffff0000403516b0
>
> freebsd_netmap_ioctl() at devfs_ioctl+0xc4
>          pc = 0xffff00005cd25f94  lr = 0xffff00000025f1ac
>          sp = 0xffff0000403516c0  fp = 0xffff000040351700
>
> devfs_ioctl() at VOP_IOCTL_APV+0xa8
>          pc = 0xffff00000025f1ac  lr = 0xffff0000006ef704
>          sp = 0xffff000040351710  fp = 0xffff000040351730
>
> VOP_IOCTL_APV() at vn_ioctl+0x110
>          pc = 0xffff0000006ef704  lr = 0xffff00000045c828
>          sp = 0xffff000040351740  fp = 0xffff000040351840
>
> vn_ioctl() at devfs_ioctl_f+0x24
>          pc = 0xffff00000045c828  lr = 0xffff00000025f818
>          sp = 0xffff000040351850  fp = 0xffff000040351860
>
> devfs_ioctl_f() at kern_ioctl+0x358
>          pc = 0xffff00000025f818  lr = 0xffff0000003f130c
>          sp = 0xffff000040351870  fp = 0xffff0000403518c0
>
> kern_ioctl() at sys_ioctl+0x15c
>          pc = 0xffff0000003f130c  lr = 0xffff0000003f0f64
>          sp = 0xffff0000403518d0  fp = 0xffff0000403519a0
>
> sys_ioctl() at do_el0_sync+0x4b8
>          pc = 0xffff0000003f0f64  lr = 0xffff0000006b61f8
>          sp = 0xffff0000403519b0  fp = 0xffff000040351a70
>
> do_el0_sync() at handle_el0_sync+0x84
>          pc = 0xffff0000006b61f8  lr = 0xffff00000069da00
>          sp = 0xffff000040351a80  fp = 0xffff000040351b90
>
> handle_el0_sync() at 0x401996f4
>          pc = 0xffff00000069da00  lr = 0x00000000401996f4
>          sp = 0xffff000040351ba0  fp = 0x0000ffffffffe2f0
>
> Line number maps:
> (kgdb) list *ifunit_ref+0x28
> 0xffff000000476e08 is in ifunit_ref (/usr/src/sys/net/if.c:2417).
> 2412    struct ifnet *
> 2413    ifunit_ref(const char *name)
> 2414    {
> 2415            struct ifnet *ifp;
> 2416
> 2417            IFNET_RLOCK_NOSLEEP();
> 2418            CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
> 2419                    if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0 &&
> 2420                        !(ifp->if_flags & IFF_DYING))
> 2421                            break;
>
> Following look to be correct, but modules don't build by default w/
> debug symbols, so I had to rebuild the module...
>
> Reading symbols from
> /usr/obj/usr/src/arm64.aarch64/sys/modules/netmap/netmap.kld...done.
> (kgdb) list *netmap_get_bdg_na+0x194
> 0xcb18 is in netmap_get_bdg_na (/usr/src/sys/dev/netmap/netmap_vale.c:931).
> 926             /*
> 927              * try see if there is a matching NIC with this name
> 928              * (after the bridge's name)
> 929              */
> 930             ifname = nr_name + b->bdg_namelen + 1;
> 931             ifp = ifunit_ref(ifname);
> 932             if (!ifp) {
> 933                     /* Create an ephemeral virtual port.
> 934                      * This block contains all the ephemeral-specific
> logic.
> 935                      */
> (kgdb) list *netmap_get_na+0x1b0
> 0x1994 is in netmap_get_na (/usr/src/sys/dev/netmap/netmap.c:1538).
> 1533            error = netmap_get_pipe_na(hdr, na, nmd, create);
> 1534            if (error || *na != NULL)
> 1535                    goto out;
> 1536
> 1537            /* try to see if this is a bridge port */
> 1538            error = netmap_get_bdg_na(hdr, na, nmd, create);
> 1539            if (error)
> 1540                    goto out;
> 1541
> 1542            if (*na != NULL) /* valid match in netmap_get_bdg_na() */
>
> Thanks.
>
> --
>   John-Mark Gurney                              Voice: +1 415 225 5579
>
>      "All that I will do, has been done, All that I have, has not."
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
>


-- 
Vincenzo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B_eA9gH_uzxV_YLBH1XdM-ygPUxXzD_W9_b45jTmeY-t0bQKg>