Re: git: 96c76d930656 - main - exit1(): Revert sparc64 workaround

From: Marius Strobl <marius_at_freebsd.org>
Date: Sun, 06 Aug 2023 21:31:27 UTC
On Mon, Aug 07, 2023 at 12:14:06AM +0300, Konstantin Belousov wrote:
> On Sun, Aug 06, 2023 at 08:29:57PM +0000, Marius Strobl wrote:
> > The branch main has been updated by marius:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=96c76d930656f13d3c041dc8d8f2fc3dd1e5e05a
> > 
> > commit 96c76d930656f13d3c041dc8d8f2fc3dd1e5e05a
> > Author:     Marius Strobl <marius@FreeBSD.org>
> > AuthorDate: 2023-08-06 19:54:57 +0000
> > Commit:     Marius Strobl <marius@FreeBSD.org>
> > CommitDate: 2023-08-06 20:26:01 +0000
> > 
> >     exit1(): Revert sparc64 workaround
> >     
> >     If this still is a problem on other architectures, it should be fixed
> >     properly.
> >     
> >     This reverts commit 5486ffc898503a846ecaf3f5ef9f9269beb4540e.
> > ---
> >  sys/kern/kern_exit.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
> > index cb0939ded6e1..e3345c14df26 100644
> > --- a/sys/kern/kern_exit.c
> > +++ b/sys/kern/kern_exit.c
> > @@ -238,13 +238,7 @@ exit1(struct thread *td, int rval, int signo)
> >  	TSPROCEXIT(td->td_proc->p_pid);
> >  
> >  	p = td->td_proc;
> > -	/*
> > -	 * XXX in case we're rebooting we just let init die in order to
> > -	 * work around an unsolved stack overflow seen very late during
> > -	 * shutdown on sparc64 when the gmirror worker process exists.
> > -	 * XXX what to do now that sparc64 is gone... remove if?
> > -	 */
> > -	if (p == initproc && rebooting == 0) {
> > +	if (p == initproc) {
> >  		printf("init died (signal %d, exit %d)\n", signo, rval);
> >  		panic("Going nowhere without my init!");
> >  	}
> I believe this was a right thing to do, regardless of the sparc64 stack
> overflow. When rebooting NFS-booted machine, page-in over NFS stops
> working, perhaps due to interface going down, while userspace is still
> alive.  In this situation, pager returns KERN_FAILURE which translates
> to SIGSEGV to userspace.  If init(8) process gets the signal, we would
> panic instead of continuing the reboot.

Well, I used to reboot NFS-boot machines _a lot_ during development
and never saw the problem in that context (even with the workaround
in place, I would have seen init(8) die), only when rebooting hosts
booted from a gmirror(4)-backed file-system.
However, feel free to put the code back with an appropriate comment
if you think it's generally the right thing to to.

Marius