Date: Fri, 23 Sep 2022 09:46:08 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Mark Johnston <markj@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: A panic a day Message-ID: <Yy3i0K9VuPSJtqsR@troutmask.apl.washington.edu> In-Reply-To: <Yyyw5bnWO1y6veYl@nuc> References: <YyyqDEPL3X3esFYl@troutmask.apl.washington.edu> <Yyyw5bnWO1y6veYl@nuc>
index | next in thread | previous in thread | raw e-mail
On Thu, Sep 22, 2022 at 03:00:53PM -0400, Mark Johnston wrote:
>
> I think this untested patch will address the panics. The bug was there
> for a long time but some recent restructuring added an assertion which
> caught it.
>
> diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
> index 9d48aa746f6d..484864b66c1c 100644
> --- a/sys/kern/sched_4bsd.c
> +++ b/sys/kern/sched_4bsd.c
> @@ -1282,9 +1282,10 @@ kick_other_cpu(int pri, int cpuid)
> }
> #endif /* defined(IPI_PREEMPTION) && defined(PREEMPTION) */
>
> - ast_sched_locked(pcpu->pc_curthread, TDA_SCHED);
> - ipi_cpu(cpuid, IPI_AST);
> - return;
> + if (pcpu->pc_curthread->td_lock == &sched_lock) {
> + ast_sched_locked(pcpu->pc_curthread, TDA_SCHED);
> + ipi_cpu(cpuid, IPI_AST);
> + }
> }
> #endif /* SMP */
>
> @@ -1397,7 +1398,7 @@ sched_add(struct thread *td, int flags)
>
> cpuid = PCPU_GET(cpuid);
> if (single_cpu && cpu != cpuid) {
> - kick_other_cpu(td->td_priority, cpu);
> + kick_other_cpu(td->td_priority, cpu);
> } else {
> if (!single_cpu) {
> tidlemsk = idle_cpus_mask;
Mark,
My system has been running a fairly heavy load with this
patch for the last 20 or so hours without any incidences.
In fact, the system feels snappier. Thanks for the quick
response with a patch.
--
Steve
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Yy3i0K9VuPSJtqsR>
