From owner-svn-src-head@freebsd.org Tue Sep 29 19:00:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3429A42D52D; Tue, 29 Sep 2020 19:00:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C17xd53f0z463n; Tue, 29 Sep 2020 19:00:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id A994426001C; Tue, 29 Sep 2020 21:00:17 +0200 (CEST) Subject: Re: svn commit: r366265 - head/sys/sys To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202009291806.08TI62eE083160@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Tue, 29 Sep 2020 20:59:42 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <202009291806.08TI62eE083160@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4C17xd53f0z463n X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2020 19:00:22 -0000 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" --HPS