On Fri, Dec 22, 2023 at 04:01:50PM -0700, Vitaliy Makkoveev wrote:
> CVSROOT:      /cvs
> Module name:  src
> Changes by:   [email protected]    2023/12/22 16:01:50
>
> Modified files:
>       sys/net        : if.c if_aggr.c if_bpe.c if_etherip.c if_gif.c
>                        if_gre.c if_mpe.c if_mpip.c if_mpw.c if_pflow.c
>                        if_pfsync.c if_pppx.c if_sec.c if_tpmr.c
>                        if_trunk.c if_tun.c if_var.h if_veb.c if_vlan.c
>                        if_vxlan.c if_wg.c
>       sys/netinet    : ip_carp.c
>
> Log message:
> Always allocate per-CPU statistics counters for network interface
> descriptor.

It looks like this breaks interface attach.
It should be backed out.

bluhm

pci4 at ppb3 bus 4
em0 at pci4 dev 0 function 0 "Intel 82571EB" rev 0x06: apic 8 int 17uvm_fault(0
xffffffff824bf360, 0x8, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at      pool_get+0x6e:  movq    0x8(%rax),%r11
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*     0      0      0     0x10000      0x200    0K swapper
pool_get(ffffffff825aac78,1,a619daefe381a0c,ffff80000017a048,d,ffff80000017a7e8
) at pool_get+0x6e
counters_alloc(c,c,a1f03e534e639ae1,ffff80000017a048,ffff80000017a048,ffff80000
017a7e8) at counters_alloc+0x3f
if_attach_common(ffff80000017a048,ffff80000017a048,ce773033c5bc7a4c,ffff8000001
7a048,ffff80000017a048,e) at if_attach_common+0xa7
if_attach(ffff80000017a048,ffff80000017a048,ffff80000017a000,e,ffffffff81618525
,ffffffff8295be70) at if_attach+0x15
em_setup_interface(ffff80000017a000,ffff80000017a000,ffff80000017a578,ffff80000
017a000,ffff80000017a548,0) at em_setup_interface+0x1c8
em_attach(ffff800000177900,ffff80000017a000,ffffffff8295bfa8,ffff800000177900,b
d8850f5395a4cef,ffff800000177900) at em_attach+0x410
config_attach(ffff800000177900,ffffffff8245e5a8,ffffffff8295bfa8,ffffffff81b39c
50,e47e39a69ab854bf,80040000) at config_attach+0x1e2
pci_probe_device(ffff800000177900,80040000,0,0,e374438be72c4e6d,0) at pci_probe
_device+0x4c4
pci_enumerate_bus(ffff800000177900,0,0,ffff800000177900,f5afadb07e1609f4,ffff80
0000179000) at pci_enumerate_bus+0x183
config_attach(ffff800000179000,ffffffff8245d9d8,ffffffff8295c1d0,ffffffff82037f
00,e47e39a699089b75,ffffffff8295c348) at config_attach+0x1e2
ppbattach(ffff800000177700,ffff800000179000,ffffffff8295c348,ffff800000177700,f
7ff70c80a4ae9eb,ffff800000177700) at ppbattach+0x74e
config_attach(ffff800000177700,ffffffff8245e2d0,ffffffff8295c348,ffffffff81b39c
50,e47e39a69ab854bf,80020800) at config_attach+0x1e2
pci_probe_device(ffff800000177700,80020800,0,0,e374438be72c4e6d,0) at pci_probe
_device+0x4c4
pci_enumerate_bus(ffff800000177700,0,0,ffff800000177700,f5afadb07e1609f4,ffff80
0000178800) at pci_enumerate_bus+0x183
end trace frame: 0xffffffff8295c550, count: 0

> We have the mess in network interface statistics. Only pseudo drivers
> do per-CPU counters allocation, all other network devices use the old
> `if_data'. The network stack partially uses per-CPU counters and
> partially use `if_data', but the protection is inconsistent: some times
> counters accessed with exclusive netlock, some times with shared
> netlock, some times with kernel lock, but without netlock, some times
> with another locks.
>
> To make network interfaces statistics more consistent, always allocate
> per-CPU counters at interface attachment time and use it instead of
> `if_data'. At this step only move counters allocation to the if_attach()
> internals. The `if_data' removal will be performed with the following
> diffs to make review and tests easier.
>
> ok bluhm

Reply via email to