From: Mark Kettenis Subject: Re: kernel: disable hardclock() on secondary CPUs To: Scott Cheloha Cc: tech@openbsd.org Date: Mon, 12 Feb 2024 20:47:27 +0100 > Date: Mon, 12 Feb 2024 11:35:20 -0600 > From: Scott Cheloha > > On Fri, Feb 09, 2024 at 11:57:00AM -0600, Scott Cheloha wrote: > > Now that the dt(4) probe entry points are out of the hardclock() we > > can disable it on secondary CPUs. There is no useful work left for > > them to do there. > > > > This can wait a few days, just in case we need to back out the dt(4) > > change. > > > > Thoughts? > > Ping. ok kettenis@ Does this mean that we'll start running less interrupts on secondary CPUs now? > Index: kern_clockintr.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_clockintr.c,v > diff -u -p -r1.66 kern_clockintr.c > --- kern_clockintr.c 9 Feb 2024 16:52:58 -0000 1.66 > +++ kern_clockintr.c 12 Feb 2024 17:35:03 -0000 > @@ -63,7 +63,7 @@ clockintr_cpu_init(const struct intrcloc > clockqueue_intrclock_install(cq, ic); > > /* TODO: Remove this from struct clockintr_queue. */ > - if (cq->cq_hardclock.cl_expiration == 0) { > + if (CPU_IS_PRIMARY(ci) && cq->cq_hardclock.cl_expiration == 0) { > clockintr_bind(&cq->cq_hardclock, ci, clockintr_hardclock, > NULL); > } > @@ -99,12 +99,6 @@ clockintr_cpu_init(const struct intrcloc > clockintr_schedule(&cq->cq_hardclock, 0); > else > clockintr_advance(&cq->cq_hardclock, hardclock_period); > - } else { > - if (cq->cq_hardclock.cl_expiration == 0) { > - clockintr_stagger(&cq->cq_hardclock, hardclock_period, > - multiplier, MAXCPUS); > - } > - clockintr_advance(&cq->cq_hardclock, hardclock_period); > } > > /* > Index: kern_clock.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_clock.c,v > diff -u -p -r1.122 kern_clock.c > --- kern_clock.c 9 Feb 2024 17:42:18 -0000 1.122 > +++ kern_clock.c 12 Feb 2024 17:35:03 -0000 > @@ -140,13 +140,6 @@ initclocks(void) > void > hardclock(struct clockframe *frame) > { > - /* > - * If we are not the primary CPU, we're not allowed to do > - * any more work. > - */ > - if (CPU_IS_PRIMARY(curcpu()) == 0) > - return; > - > tc_ticktock(); > ticks++; > jiffies++; > >