From nobody Mon Aug 24 09:50:18 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hT5kM4063z6p8x3; Mon, 24 Aug 2026 09:50:19 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hT5kM3RDHz463X; Mon, 24 Aug 2026 09:50:19 +0000 (UTC) (envelope-from brooks@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787565019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RAkzKy3sJXU4WrOc992fMk3s9gIycxO9D354s8xGBT8=; b=CNJfxk0gf5O3ReT5mPItLLw9WciTkQ8EVmr0ESXnbQJqzJ12X5KkW4bsE2owp0U9wKL4bt wFJ651YJSQQGeqrzsRC8WrF4k0Me9ja9xMPDXmziirUpG/6Ykm8nMe0It1H+eWe9J8dPpl 0oANhk0pZOEz33cN0BFEE7PSlzGK1WDthISgKO52D5doaiTYtLQmRSxjXGJB01Wnu8J0tb yLN6BYcDIZxHHshu4UVoyAISuTZSbQDlnMM7wiITL6+vjaQRhMga9LG5hJ0aIapd2HE7IM Oe7u9rKFs2RoRFeIQOgKUfyJYYvm9Iif8fPEmTI0pnZ0fnjgzAvOfL27khz+LQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787565019; a=rsa-sha256; cv=none; b=pZrEcMWhkeWZhZhf8FhXqDGUwcTA59M4nmbFCzMqQBy312A+GFhJAZkUJL3qVsAcugVQj4 vxw19Glcx7myz61A4hWzWSjWVDP58mUZMJseM2J2Z5SXFGtgUPxdXh0+kK3EPg/yCm63ML QzGcYQr2MWo14nRDSop3cRC/XKK6wMIdnxY9d0HyJHTiqYIXsIESCr7+6DqcqfUY53mV34 Qcg40Xj9xA9Utt7EfRFP7GjYlsfU3AY5Ua3FPK35KG5+FdLOJovtCPobxALMIl3gvd+YuW bgwbesMt30poc2IjhCiXC6veFagBpB+1DOd9FSP9rr87uhr9bk/0e1jR0tdcdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787565019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RAkzKy3sJXU4WrOc992fMk3s9gIycxO9D354s8xGBT8=; b=bje9IFQDVQRdMtTzl/Cxrle9SdKOk8iGUMtb67WP0Kwj/HGPq1mpkV6aT0+70r/qMVMGZY c6U7lGwAK2fbv2/MtHUT2jonJeimn8dqtqwd5FAXob6puU/Ef82GRNp7T/3Umv5sMQvzWZ lPz4AsU2XpgW7rFnxNms3o5gK0oXKchMXtXqc95TTKaujdrQN+QiDgcPCASbGzcN/U+1El UMx6JIWvUlk5TbW1H1e5y3vyuvG+KPKWZVECyLODzPUspo6dCHOq0fljltxfwGFHgdMQZX oS0mFmmV6+RVBxlFcKVeUESg2SE6WzMcxAIn7n/DwhzcNWITgUoytuWP2N4usA== Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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) (Authenticated sender: brooks/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4hT5kM1qYFz7w7; Mon, 24 Aug 2026 09:50:19 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 80B263C01A0; Mon, 24 Aug 2026 09:50:18 +0000 (UTC) Date: Mon, 24 Aug 2026 09:50:18 +0000 From: Brooks Davis To: Gleb Smirnoff Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 662497d5a741 - main - SYSINIT: add explicit SI_ORDER_LAST Message-ID: References: <6a7b347b.2762e.4e3404b4@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a7b347b.2762e.4e3404b4@gitrepo.freebsd.org> On Tue, Aug 11, 2026 at 02:40:59PM +0000, Gleb Smirnoff wrote: > The branch main has been updated by glebius: > > URL: https://cgit.FreeBSD.org/src/commit/?id=662497d5a7415f8779b7be03e39f66eb8419174d > > commit 662497d5a7415f8779b7be03e39f66eb8419174d > Author: Gleb Smirnoff > AuthorDate: 2026-08-11 14:39:30 +0000 > Commit: Gleb Smirnoff > CommitDate: 2026-08-11 14:39:30 +0000 > > SYSINIT: add explicit SI_ORDER_LAST > > Working on cleansing use of (SI_SUB_FOO + 1) construct through the kernel > I found a repeating pattern. Often a developer adds a module that depends > on certain subsystem to be fully instantiated and they want to put their > module SYSINIT right at the end of the SI_SUB_FOO. Such module usually > expects that nothing else within this subsystem shall depend on the > module. > > The problem with SI_ORDER_ANY which practically was "the last" until this > change is that it is used very widely and people treat it literally as > "any", well, because this is what the name says. This lead to many parts > that could have dependencies later to be added as SI_ORDER_ANY. > > So, our developer with the new subsystem that depends on SI_SUB_FOO has > three options: > > 1) Use SI_ORDER_ANY, but grep around ther kernel for other SI_SUB_FOO > entries to make sure that no dependencies are set to SI_ORDER_ANY. And in > case they are, shift them up and recheck if dependencies of those > dependencies are met. > > 2) Take next subsystem in sysinit list. However, the next one can be > SI_SUB_BAR, that is completely irrelevant from SI_SUB_FOO, and our > developer doesn't want to put his module's SYSINIT into SI_SUB_BAR, cause > it is ugly. > > 3) Use the (SI_SUB_FOO + 1) construct that violates -Werror=assign-enum. > > The SI_ORDER_LAST solves this hard choice. If you know that nothing is > going to depend on your module within SI_SUB_FOO, but you depend on > SI_SUB_FOO, just use SI_ORDER_LAST. Given that SI_ORDER_LAST isn't UINT_MAX, should we have an assert like the one below so LAST continues to be last? -- Brooks diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 8cbdd645a230..9825b71a746e 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -200,8 +200,10 @@ sysinit_mklist(struct sysinitlist *list, struct sysinit **set, TSENTER(); TSENTER2("listify"); STAILQ_INIT(list); - for (sipp = set; sipp < set_end; sipp++) + for (sipp = set; sipp < set_end; sipp++) { + MPASS((*sipp)->order <= SI_ORDER_LAST); STAILQ_INSERT_TAIL(list, *sipp, next); + } TSEXIT2("listify"); TSENTER2("mergesort"); STAILQ_MERGESORT(list, NULL, sysinit_compar, sysinit, next);