From owner-svn-src-all@freebsd.org Wed Sep 30 02:05:29 2020 Return-Path: Delivered-To: svn-src-all@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 61CC73F7ED8 for ; Wed, 30 Sep 2020 02:05:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1KN82YRLz4XkW for ; Wed, 30 Sep 2020 02:05:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x831.google.com with SMTP id o21so79245qtp.2 for ; Tue, 29 Sep 2020 19:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5db4OSbCUKytfVmr+H73CBWZDM58aKNoOSv7WN+XHHI=; b=M1rcxbA7M4q7WLAM+Wlh5rP6zusaQlUvRV6v4QQh2HaLuIWCvDYJ6j4IHeIHNJFAY0 +9mv8xQOQTKBr0GBue4910w+Xv5RzMCsXoZN8Y35X40ZyZvgrILkh9vZ9SqEnEsIfpFU dHgRfGLAOiI9ErmEF8K9STa9NT4fC3pL0v0GoCVRUK6yInGnA0GP0nvJRIRp49m5JOwT GZszakVTmROriWrUFJid+ZqEFnD+Gf6JTGZ1toWxLbcLe8yUP8gxPlleIjIQeAzi7wdc 7cbhS3suQYJVanYzTwRRdkd/4TIu8AbIbET/+0hQNXmGm/BHvQUY9QiCaaoE/iDh+b2z ONTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5db4OSbCUKytfVmr+H73CBWZDM58aKNoOSv7WN+XHHI=; b=JnWnc4oA3tmlvQWeoZE4W02H2ZcQc62q8lJCPWcoe+FAtcFcH5HYBz0kLs+74xpQQ7 Zrq7LGadGV/oDLoozW1nPkCGzQcu7E/6BVTJfOEN7lSk6bfGc+Tf/KugSS0gjHbZ1Q/d xD6VZGyLihH3tQNjjXqynV9/DAwYexEyOdn1eb++n4JP+fjq4HoyBvAxPKzoLxCWuROE uB7/4vw6aMXfeFD5zKhvnYIQ9f3OH1cMHmOlTpoqsq2bsRo70tugKaPTNAjlLgLATj0f iEM+roPnHE+mm3zgimhSVB4Oqy7RiI+RAhfoaSYsIwT3SDakF9bOYeVJ9AsCOwAS7NuN r5gA== X-Gm-Message-State: AOAM531gfBtn5JxekuRkrbV/9xjx/8VOpktwbPZyoXq6vxkHqUwnH5WU 4pfP/TyWCut+fz6YpEb7bqxGTrOqC4DBDZsmdeHNdg== X-Google-Smtp-Source: ABdhPJwZatgymdl0lrUKittp2t63uyl8pYwpgAkw7qknjHRWti/hN8FwWO5qJrOmUOVEhKmkQ8pacDvnCuC0x6VaVfE= X-Received: by 2002:ac8:2f42:: with SMTP id k2mr129737qta.32.1601431527229; Tue, 29 Sep 2020 19:05:27 -0700 (PDT) MIME-Version: 1.0 References: <202009291806.08TI62eE083160@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Tue, 29 Sep 2020 20:05:15 -0600 Message-ID: Subject: Re: svn commit: r366265 - head/sys/sys To: Hans Petter Selasky Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 4C1KN82YRLz4XkW X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=M1rcxbA7; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::831) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.94 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-0.90)[-0.903]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.94)[-0.943]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.09)[-0.094]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::831:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[svn-src-all]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2020 02:05:29 -0000 On Tue, Sep 29, 2020, 1:00 PM Hans Petter Selasky 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 >