Date: Tue, 29 Sep 2020 20:05:15 -0600 From: Warner Losh <imp@bsdimp.com> To: Hans Petter Selasky <hps@selasky.org> Cc: Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366265 - head/sys/sys Message-ID: <CANCZdfoZKx5%2Btg0_F=zx%2ByEsDTtTqhEtfnU0cntZz6ArsBBhAg@mail.gmail.com> In-Reply-To: <cff8d9cd-ddb7-2589-2883-0e017100055e@selasky.org> References: <202009291806.08TI62eE083160@repo.freebsd.org> <cff8d9cd-ddb7-2589-2883-0e017100055e@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 29, 2020, 1:00 PM Hans Petter Selasky <hps@selasky.org> wrote: > On 2020-09-29 20:06, Warner Losh wrote: > > Author: imp > > Date: Tue Sep 29 18:06:02 2020 > > New Revision: 366265 > > URL: https://svnweb.freebsd.org/changeset/base/366265 > > > > Log: > > Standalone SX shims > > > > Create a do-nothing version of SX locks. OpenZFS needs them. However, > > since the boot loader is single threaded, they can be nops. > > > > Modified: > > head/sys/sys/sx.h > > > > Modified: head/sys/sys/sx.h > > > ============================================================================== > > --- head/sys/sys/sx.h Tue Sep 29 17:52:15 2020 (r366264) > > +++ head/sys/sys/sx.h Tue Sep 29 18:06:02 2020 (r366265) > > @@ -300,4 +300,26 @@ __sx_xunlock(struct sx *sx, struct thread *td, > const c > > > > #endif /* _KERNEL */ > > > > +#ifdef _STANDALONE > > +/* since we have no threads in the boot loader, trivially implement > no-op version */ > > +#define sx_xlock(s) (1) > > +#define sx_try_xlock(s) (1) > > +#define sx_xunlock(s) (1) > > +#define SX_DUPOK 0 > > +#define SX_NEW 0 > > +#define SX_NOWITNESS 0 > > + > > +static __inline void > > +sx_init_flags(struct sx *sx, const char *description, int opts) > > +{ > > + > > +} > > + > > +static __inline void > > +sx_destroy(struct sx *sx) > > +{ > > + > > +} > > +#endif /* _STANDALONE */ > > + > > #endif /* !_SYS_SX_H_ */ > > > > You may want to use: > > bsd_kernel.c:sx_init_flags(struct sx *sx, const char *name, int flags) > bsd_kernel.c: sx->owned = 0; > bsd_kernel.c:sx_destroy(struct sx *sx) > bsd_kernel.c:sx_xlock(struct sx *sx) > bsd_kernel.c: sx->owned++; > bsd_kernel.c:sx_xunlock(struct sx *sx) > bsd_kernel.c: sx->owned--; > bsd_kernel.c:sx_xlocked(struct sx *sx) > bsd_kernel.c: return (sx->owned != 0); > bsd_kernel.h:struct sx { > bsd_kernel.h:#define sx_assert(...) do { } while (0) > bsd_kernel.h:#define sx_init(...) sx_init_flags(__VA_ARGS__, 0) > bsd_kernel.h:void sx_init_flags(struct sx *, const char *, int); > bsd_kernel.h:void sx_destroy(struct sx *); > bsd_kernel.h:void sx_xlock(struct sx *); > bsd_kernel.h:void sx_xunlock(struct sx *); > bsd_kernel.h:int sx_xlocked(struct sx *); > > from "src/stand/kshim" > Yea. This, and other parts of the shims, need to be integrated into stand... Warner >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfoZKx5%2Btg0_F=zx%2ByEsDTtTqhEtfnU0cntZz6ArsBBhAg>