> Date: Tue, 30 Dec 2025 19:05:03 +0100
> From: Alexander Bluhm <[email protected]>
> 
> On Sun, Nov 23, 2025 at 04:14:31PM +0000, Miod Vallat wrote:
> > > All cores attached, i.e. octeon's hw_cpu_hatch() should've run
> > > and bumped `ncpus' four times.
> > 
> > Except that this only happens after cpu_boot_secondary_processors()
> > completes, which is way later than softnet_percpu().
> 
> octeon sets ncpus late, but ncpusfound is set early.  Other subsystems
> also use that variable.  My mistake using the wrong one.

No, you used the right one.  

* ncpusfound: the number of CPUs the hardware provides

* ncpus: the number of CPUs OpenBSD is using

So when running a GENERIC kernel on a machine with 32 CPUs, ncpusfound
will be 32 but ncpus will be 1.

Even when running a GENERIC.MP kernel, ncpusfound may be larger than
ncpus.  This could happen if the hardware has more than MAXCPUS CPUs.

We probably should change octeon to bump ncpus when it attaches CPUs
instead of when it spins them up.

> root@ot8:.../~# ps axk | grep softnet
>  8091 ??  DK       0:10.83 (softnet2)
> 83269 ??  DK       0:11.41 (softnet3)
>  9620 ??  DK       0:20.40 (softnet4)
>  1191 ??  DK       0:00.00 (softnet5)
> 47517 ??  DK       0:07.52 (softnet6)
> 28614 ??  DK       0:14.31 (softnet7)
> 77775 ??  DK       0:10.76 (softnet1)
> 97587 ??  DK       0:10.74 (softnet0)
> 
> ok?
> 
> bluhm
> 
> Index: net/if.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v
> diff -u -p -r1.760 if.c
> --- net/if.c  11 Dec 2025 07:09:20 -0000      1.760
> +++ net/if.c  30 Dec 2025 17:06:37 -0000
> @@ -3799,7 +3799,7 @@ softnet_count(void)
>       static unsigned int nsoftnets;
>  
>       if (nsoftnets == 0)
> -             nsoftnets = min(NET_TASKQ, ncpus);
> +             nsoftnets = min(NET_TASKQ, ncpusfound);
>  
>       return (nsoftnets);
>  }
> 
> 

Reply via email to