Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2026 20:01:04 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        A FreeBSD User <freebsd@walstatt-de.de>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 8cc1c0f35ec8 - main - amd64 trap.c: provide tag for the struct sfhandlers definition
Message-ID:  <acAuYEscAN_FAQ4M@kib.kiev.ua>
In-Reply-To: <20260322111330.6c1a3249@thor.sb211.local>
References:  <69bdcf15.27526.2b5005f0@gitrepo.freebsd.org> <20260321171438.680a77e3@hermann> <ab7qCc3Dx7TCnyAD@kib.kiev.ua> <20260321224023.002fcb9b@hermann> <ab8UjfCTLRBZpevm@kib.kiev.ua> <20260322111330.6c1a3249@thor.sb211.local>

index | next in thread | previous in thread | raw e-mail

On Sun, Mar 22, 2026 at 11:13:03AM +0100, A FreeBSD User wrote:
> Am Tage des Herren Sat, 21 Mar 2026 23:58:37 +0200
> Konstantin Belousov <kostikbel@gmail.com> schrieb:
> 
> > On Sat, Mar 21, 2026 at 10:40:23PM +0100, FreeBSD User wrote:
> > > On Sat, 21 Mar 2026 20:57:13 +0200
> > > Konstantin Belousov <kostikbel@gmail.com> wrote:
> > >   
> > > > On Sat, Mar 21, 2026 at 05:15:55PM +0100, FreeBSD User wrote:  
> > > > > On Fri, 20 Mar 2026 22:49:57 +0000
> > > > > Konstantin Belousov <kib@FreeBSD.org> wrote:
> > > > >     
> > > > > > The branch main has been updated by kib:
> > > > > > 
> > > > > > URL:
> > > > > > https://cgit.FreeBSD.org/src/commit/?id=8cc1c0f35ec8d5a3edb4ee1ede962a3c1f6baef0
> > > > > > 
> > > > > > commit 8cc1c0f35ec8d5a3edb4ee1ede962a3c1f6baef0
> > > > > > Author:     Konstantin Belousov <kib@FreeBSD.org>
> > > > > > AuthorDate: 2026-03-03 06:37:03 +0000
> > > > > > Commit:     Konstantin Belousov <kib@FreeBSD.org>
> > > > > > CommitDate: 2026-03-20 22:49:03 +0000
> > > > > > 
> > > > > >     amd64 trap.c: provide tag for the struct sfhandlers definition
> > > > > >     
> > > > > >     Sponsored by:   The FreeBSD Foundation
> > > > > >     MFC after:      1 week
> > > > > > ---
> > > > > >  sys/amd64/amd64/trap.c | 6 ++++--
> > > > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
> > > > > > index 8a1d1528e6da..359b3dfe3609 100644
> > > > > > --- a/sys/amd64/amd64/trap.c
> > > > > > +++ b/sys/amd64/amd64/trap.c
> > > > > > @@ -319,10 +319,12 @@ trap_check_intr_kernel(struct thread *td, struct
> > > > > > trapframe *frame) /*
> > > > > >   * Table of handlers for various segment load faults.
> > > > > >   */
> > > > > > -static const struct {
> > > > > > +struct sfhandler {
> > > > > >  	uintptr_t	faddr;
> > > > > >  	uintptr_t	fhandler;
> > > > > > -} sfhandlers[] = {
> > > > > > +};
> > > > > > +
> > > > > > +static const struct sfhandler sfhandlers[] = {
> > > > > >  	{
> > > > > >  		.faddr = (uintptr_t)ld_ds,
> > > > > >  		.fhandler = (uintptr_t)ds_load_fault,
> > > > > >     
> > > > > 
> > > > > Hello,
> > > > > 
> > > > > it seems that one of the commits in this vain results in a hard reset of
> > > > > some CURRENT machine - this taken from some reports on freebsd-current list.
> > > > > 
> > > > > In my case, two Zen5 based boxes, bott as usual, but when touch the system
> > > > > with "make buildworld buildkernel" or any single make build on the acting
> > > > > server box, the system reboots immediately - no trace of a log, coredump,
> > > > > simple nothing. Only hard reset. Same on another box acting as graphical
> > > > > workstation. As soon the system gets "touch" (login/starting windowmaker)
> > > > > the system goes nirwana.
> > > > > 
> > > > > No further information, my boxes do not dump anything useful.    
> > > > 
> > > > Try the following
> > > > 
> > > > commit 237044fd4d0659ef2799c259b1f1852c00b08b37
> > > > Author: Konstantin Belousov <kib@FreeBSD.org>
> > > > Date:   Sat Mar 21 20:45:48 2026 +0200
> > > > 
> > > >     amd64: use IDT trapframe size to calculate location of nmi_pcpu from the
> > > > IST stack pointer
> > > > 
> > > > diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
> > > > index babfbacf92ef..5bf9a12e1bf5 100644
> > > > --- a/sys/amd64/amd64/exception.S
> > > > +++ b/sys/amd64/amd64/exception.S
> > > > @@ -341,7 +341,7 @@ IDTVEC(dblfault)
> > > >  	pushfq
> > > >  	andq	$~(PSL_D | PSL_AC),(%rsp)
> > > >  	popfq
> > > > -	movq	TF_SIZE(%rsp),%rdx
> > > > +	movq	TF_SIZE_HW(%rsp),%rdx
> > > >  	movl	%edx,%eax
> > > >  	shrq	$32,%rdx
> > > >  	movl	$MSR_GSBASE,%ecx
> > > > @@ -661,7 +661,7 @@ IDTVEC(dbg)
> > > >  	shlq	$32,%rdx
> > > >  	orq	%rdx,%r12
> > > >  	/* Retrieve and load the canonical value for GS.base. */
> > > > -	movq	TF_SIZE(%rsp),%rdx
> > > > +	movq	TF_SIZE_HW(%rsp),%rdx
> > > >  	movl	%edx,%eax
> > > >  	shrq	$32,%rdx
> > > >  	wrmsr
> > > > @@ -798,7 +798,7 @@ IDTVEC(nmi)
> > > >  	shlq	$32,%rdx
> > > >  	orq	%rdx,%r12
> > > >  	/* Retrieve and load the canonical value for GS.base. */
> > > > -	movq	TF_SIZE(%rsp),%rdx
> > > > +	movq	TF_SIZE_HW(%rsp),%rdx
> > > >  	movl	%edx,%eax
> > > >  	shrq	$32,%rdx
> > > >  	wrmsr
> > > > @@ -1002,7 +1002,7 @@ IDTVEC(mchk)
> > > >  	shlq	$32,%rdx
> > > >  	orq	%rdx,%r12
> > > >  	/* Retrieve and load the canonical value for GS.base. */
> > > > -	movq	TF_SIZE(%rsp),%rdx
> > > > +	movq	TF_SIZE_HW(%rsp),%rdx
> > > >  	movl	%edx,%eax
> > > >  	shrq	$32,%rdx
> > > >  	wrmsr
> > > > diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
> > > > index 2716784ee871..762c850c1df1 100644
> > > > --- a/sys/amd64/amd64/genassym.c
> > > > +++ b/sys/amd64/amd64/genassym.c
> > > > @@ -185,6 +185,7 @@ ASSYM(TF_FS, offsetof(struct trapframe, tf_fs));
> > > >  ASSYM(TF_GS, offsetof(struct trapframe, tf_gs));
> > > >  ASSYM(TF_FLAGS, offsetof(struct trapframe, tf_flags));
> > > >  ASSYM(TF_SIZE, sizeof(struct trapframe));
> > > > +ASSYM(TF_SIZE_HW, sizeof(struct trapframe) - 2 * 8);
> > > >  ASSYM(TF_HASSEGS, TF_HASSEGS);
> > > >  
> > > >  ASSYM(PTI_RDX, offsetof(struct pti_frame, pti_rdx));
> > > >   
> > > 
> > > Just gave the patch of yours a chance before sleeping time on the GUI box of
> > > mine: after reboot, starting GUI (windowmaker) a total freeze of the system
> > > immediately.
> > > I'll check on the other machine without burden of GUI tomorrow morning.
> > > 
> > > Still it seems the box isn't dumping/reporting  anything, this time just frozen.  
> > 
> > Instead of the patch I posted above, try the following:
> > diff --git a/sys/x86/include/frame.h b/sys/x86/include/frame.h
> > index 7da1fff03aec..1560983addfa 100644
> > --- a/sys/x86/include/frame.h
> > +++ b/sys/x86/include/frame.h
> > @@ -153,8 +153,10 @@ struct trapframe {
> >  	uint16_t	tf_fred_evinfo1;
> >  	uint32_t	tf_fred_evinfo2;
> >  	/* two long words added by FRED */
> > +#if 0
> >  	uint64_t	tf_fred_evdata;
> >  	uint64_t	tf_fred_zero1;
> > +#endif
> >  };
> >  
> >  #define	TF_FRED_EVDATA_B0	0x0000000000000001ull	/* %dr6 B0 */
> > 
> > BTW, did you rebuild the drm kmod with any of the kernel updates?
> > 
> 
> Good things first: latest sources with your commit 1ba29614c4ce5e261ade0bd7def94079b7b9647a
> fixes my issues.
> 
>  Just for the record: applied the patch on the other box as, it freezes
> immediately when trying to login or, in single user, when confirming the shell at the
> beginning.
> 
Then there is some issue with the metodology of the testing.
What I committed is the equivalent of the patch above, and according to
your report, and other people mails, it fixed the issue, as I expected.

> And: yes, I try to build on every buildworld/buildkernel cycle ports essential to kernel
> dependencies (especially kernel modules like GPU driver) I'm aware of. 
> 
> 
> Thank you for taking your time and fixing the problem!
> 
> Best regards
> Oliver
> 
>  
> 
> 
> -- 
> 
> A FreeBSD user




home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?acAuYEscAN_FAQ4M>