Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Oct 2019 16:00:48 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Antoine Brodin <antoine@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer <gerald@freebsd.org>
Subject:   Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern
Message-ID:  <20191026130048.GL73312@kib.kiev.ua>
In-Reply-To: <CAALwa8kb=JRX=%2BnJsC%2BUL%2BvQMsBHxtbH6GpmNJ2f4DCP9MuESQ@mail.gmail.com>
References:  <201910252009.x9PK9gIV092660@repo.freebsd.org> <CAALwa8n9WK8FGn%2BmB=FoNuf=%2B8JmOtpg00m=KB3Z_O4Y38PMAw@mail.gmail.com> <20191026082655.GJ73312@kib.kiev.ua> <CAALwa8kb=JRX=%2BnJsC%2BUL%2BvQMsBHxtbH6GpmNJ2f4DCP9MuESQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Oct 26, 2019 at 02:16:19PM +0200, Antoine Brodin wrote:
> On Sat, Oct 26, 2019 at 10:27 AM Konstantin Belousov
> <kostikbel@gmail.com> wrote:
> > On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote:
> > > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov <kib@freebsd.org> wrote:
> > > >
> > > > Author: kib
> > > > Date: Fri Oct 25 20:09:42 2019
> > > > New Revision: 354095
> > > > URL: https://svnweb.freebsd.org/changeset/base/354095
> > > >
> > > > Log:
> > > >   amd64: move pcb out of kstack to struct thread.
> > > >
> > > >   This saves 320 bytes of the precious stack space.
> > > >
> > > >   The only negative aspect of the change I can think of is that the
> > > >   struct thread increased by 320 bytes obviously, and that 320 bytes are
> > > >   not swapped out anymore. I believe the freed stack space is much more
> > > >   important than that.  Also, current struct thread size is 1392 bytes
> > > >   on amd64, so UMA will allocate two thread structures per (4KB) slab,
> > > >   which leaves a space for pcb without increasing zone memory use.
> > > >
> > > >   Reviewed by:  alc, markj
> > > >   Tested by:    pho
> > > >   Sponsored by: The FreeBSD Foundation
> > > >   MFC after:    2 weeks
> > > >   Differential revision:        https://reviews.freebsd.org/D22138
> > >
> > > Hi,
> > >
> > > It seems that this breaks at least some versions of gcc:
> > >
> > > In file included from /usr/include/sys/proc.h:75,
> > >                  from /usr/include/sys/user.h:51,
> > >                  from ./md-unwind-support.h:34,
> > >                  from
> > > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412:
> > > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type
> > >    76 |  struct pcb md_pcb;
> > >       |             ^~~~~~
> > >
> >
> > It is very strange.  Are gcc 9 or 8 affected ?
> 
> gcc 8 and 9 are affected too.
Then this is a completely different cause then I guessed below, and I think
I know why.  All of 8/9/10 gcc ports have support for multiarch, and the
error must happen for gcc or xgcc invocation with -m32, am I right ?

If yes, please try the patch at the end of the message instead.

> 
> > As a blind guess, please try this patch.
> >
> > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h
> > index 44e34fa5c83..9758e684da2 100644
> > --- a/sys/amd64/include/pcb.h
> > +++ b/sys/amd64/include/pcb.h
> > @@ -45,7 +45,7 @@
> >  #include <machine/fpu.h>
> >  #include <machine/segments.h>
> >
> > -#ifdef __amd64__
> > +#if defined(__amd64__) || defined(__x86_64__)
> >  /*
> >   * NB: The fields marked with (*) are used by kernel debuggers.  Their
> >   * ABI should be preserved.
> 
> I will test this.

Please use this instead

diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h
index 44e34fa5c83..8800b355c9a 100644
--- a/sys/amd64/include/pcb.h
+++ b/sys/amd64/include/pcb.h
@@ -116,6 +116,10 @@ struct susppcb {
 	/* fpu context for suspend/resume */
 	void		*sp_fpususpend;
 };
+#else	/* 32bit */
+struct pcb {
+	uint64_t pcb_dummy[40];
+};
 #endif
 
 #ifdef _KERNEL



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