tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NET_MPSAFE support for ifmedia / mii



Hi.

On 2020/02/13 23:05, Jason Thorpe wrote:

On Feb 10, 2020, at 9:51 PM, Jason Thorpe <thorpej%me.com@localhost> wrote:

Updated patch.  I fixed some bugs, and have been using this under LOCKDEBUG with both NET_MPSAFE and without for a couple of days with no ill effects (using converted "wm" driver and unconverted "pcn" driver).  I also had to convert the "usbnet" code, because it can't use the "non-converted driver compatibility" mechanism I provided (it sleeps, frequently).  I did, however, make its locking protocol a lot simpler.  I need help testing the usbnet changes -- if you have a USB Ethernet dongle, ping me off-list.

<ifmedia-tweak-diff.txt>

I was informed that the patch was mangled, so I've posted it here:

	http://www.netbsd.org/~thorpej/ifmedia-mpsafe-diff.txt

Is it required to modify all Ethernet drivers at the same time when
the above change is committed or not?

I got the following panic with bnx(4):

[   1.0191049] bnx0 at pci11 dev 0 function 0: Broadcom NetXtreme II BCM5708 1000Base-T
[   1.0191049] bnx0: Ethernet address 00:10:18:15:c9:3a
[   1.0191049] bnx0: ASIC BCM5708 B1 (0x57081010)
[   1.0191049] bnx0: PCI-X 64bit 133MHz
[   1.0191049] bnx0: B/C (1.8.0); Bufs (RX:2;TX:2); Flags ()
[   1.0191049] bnx0: Coal (RX:6,6,18,18; TX:20,20,80,80)
[   1.0191049] brgphy1 at bnx0 phy 1: BCM5708C 1000BASE-T media interface, rev. 5
[   1.0191049] brgphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[   1.0191049] allocated pic ioapic0 type level pin 16 level 6 to cpu0 slot 3 idt entry 109
[   1.0191049] bnx0: interrupting at ioapic0 pin 16
[   1.0191049] panic: kernel diagnostic assertion "mii_locked(sc->mii_pdata)" failed: file "../../../../dev/mii/mii_physubr.c", line 405
[   1.0191049] cpu0: Begin traceback...
[   1.0191049] vpanic() at netbsd:vpanic+0x178
[   1.0191049] kern_assert() at netbsd:kern_assert+0x48
[   1.0191049] mii_phy_reset() at netbsd:mii_phy_reset+0x196
[   1.0191049] bnx_ifmedia_upd() at netbsd:bnx_ifmedia_upd+0x39
[   1.0191049] bnx_attach() at netbsd:bnx_attach+0x9c0
[   1.0191049] config_attach_loc() at netbsd:config_attach_loc+0x1a8
[   1.0191049] config_found_sm_loc() at netbsd:config_found_sm_loc+0x4d
[   1.0191049] pci_probe_device() at netbsd:pci_probe_device+0x587
[   1.0191049] pci_enumerate_bus() at netbsd:pci_enumerate_bus+0x1b7
[   1.0191049] pcirescan() at netbsd:pcirescan+0x4e
[   1.0191049] pciattach() at netbsd:pciattach+0x186
[   1.0191049] config_attach_loc() at netbsd:config_attach_loc+0x1a8
[   1.0191049] config_found_sm_loc() at netbsd:config_found_sm_loc+0x4d
[   1.0191049] ppbattach() at netbsd:ppbattach+0x1c5
[   1.0191049] config_attach_loc() at netbsd:config_attach_loc+0x1a8
[   1.0191049] config_found_sm_loc() at netbsd:config_found_sm_loc+0x4d
[   1.0191049] pci_probe_device() at netbsd:pci_probe_device+0x587
[   1.0191049] pci_enumerate_bus() at netbsd:pci_enumerate_bus+0x1b7
[   1.0191049] pcirescan() at netbsd:pcirescan+0x4e
[   1.0191049] pciattach() at netbsd:pciattach+0x186
[   1.0191049] config_attach_loc() at netbsd:config_attach_loc+0x1a8
[   1.0191049] config_found_sm_loc() at netbsd:config_found_sm_loc+0x4d
[   1.0191049] ppbattach() at netbsd:ppbattach+0x1c5
[   1.0191049] config_attach_loc() at netbsd:config_attach_loc+0x1a8
[   1.0191049] config_found_sm_loc() at netbsd:config_found_sm_loc+0x4d
[   1.0191049] pci_probe_device() at netbsd:pci_probe_device+0x587
[   1.0191049] pci_enumerate_bus() at netbsd:pci_enumerate_bus+0x1b7
[   1.0191049] pcirescan() at netbsd:pcirescan+0x4e
[   1.0191049] pciattach() at netbsd:pciattach+0x186
[   1.0191049] config_attach_loc() at netbsd:config_attach_loc+0x1a8
[   1.0191049] config_found_sm_loc() at netbsd:config_found_sm_loc+0x4d
[   1.0191049] mp_pci_scan() at netbsd:mp_pci_scan+0xa4
[   1.0191049] amd64_mainbus_attach() at netbsd:amd64_mainbus_attach+0x237
[   1.0191049] mainbus_attach() at netbsd:mainbus_attach+0x70
[   1.0191049] config_attach_loc() at netbsd:config_attach_loc+0x1a8
[   1.0191049] cpu_configure() at netbsd:cpu_configure+0x2b
[   1.0191049] main() at netbsd:main+0x308
[   1.0191049] cpu0: End traceback...
[   1.0191049] fatal breakpoint trap in supervisor mode
[   1.0191049] trap type 1 code 0 rip 0xffffffff8021f55d cs 0x8 rflags 0x202 cr2 0 ilevel 0x8 rsp 0xffffffff81d12fa0
[   1.0191049] curlwp 0xffffffff8185c7c0 pid 0.1 lowest kstack 0xffffffff81d0f2c0
Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x5:  leave

bnx_attach() calls bnx_mgmt_init() which calls bnx_ifmedia_upd(ifp).

MD5 (ifmedia-mpsafe-diff.txt) = 3181222d1be190914b2746d29ad5adb8

-- thorpej



--
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index