From nobody Thu Jan 19 00:57:28 2023 X-Original-To: dev-commits-src-all@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 4Ny43Y0KdYz2sX7y; Thu, 19 Jan 2023 00:57:29 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) 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) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ny43X72sNz3HFD; Thu, 19 Jan 2023 00:57:28 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Authentication-Results: mx1.freebsd.org; none Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 89C453C0199; Thu, 19 Jan 2023 00:57:28 +0000 (UTC) Date: Thu, 19 Jan 2023 00:57:28 +0000 From: Brooks Davis To: Warner Losh Cc: Mitchell Horne , Brooks Davis , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b75062f23431 - main - riscv: Fix thread0.td_kstack_pages init Message-ID: References: <202301171638.30HGcP3C091184@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Rspamd-Queue-Id: 4Ny43X72sNz3HFD X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Wed, Jan 18, 2023 at 04:53:51PM -0700, Warner Losh wrote: > On Wed, Jan 18, 2023 at 3:07 PM Mitchell Horne wrote: >=20 > > > > > > On 1/17/23 12:38, Brooks Davis wrote: > > > The branch main has been updated by brooks: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3Db75062f23431fbabef1e7d665cae2= 70b144f71b1 > > > > > > commit b75062f23431fbabef1e7d665cae270b144f71b1 > > > Author: Brooks Davis > > > AuthorDate: 2023-01-17 16:36:15 +0000 > > > Commit: Brooks Davis > > > CommitDate: 2023-01-17 16:37:42 +0000 > > > > > > riscv: Fix thread0.td_kstack_pages init > > > > > > Commit 0ef3ca7ae37c70e9dc83475dc2e68e98e1c2a418 initialized > > > thread0.td_kstack_pages to KSTACK_PAGES. Due to the lack of an > > > include of opt_kstack_pages.h it used the fallback value of 4 fr= om > > > machine/param.h. > > > > Does this mean that we could/should include opt_kstack_pages.h within > > machine/param.h (under #ifdef _KERNEL)? This header is both a consumer > > and provider of the KSTACK_PAGES definition, by virtue of the #ifndef. I > > think the hidden dependency should be avoided, if possible. > > >=20 > No. Including opt_XXXX.h is never OK in our .h files. They are used in too > many places, some of which "cheat" and define _KERNEL becuse, well, they > need to get to the kernel bits.... That will break... We could potentially use the __has_include extension. I don't think we care about building the kernel with a compiler that isn't clang or gcc and the usage pattern defined by gcc is safe for compilers that don't define it. We could do something like: #ifdef _KERNEL #ifndef KSTACK_PAGES #ifdef __has_include #if __has_include("opt_kstack_pages.h") #include "opt_kstack_pages.h" #endif #endif #endif #endif >=20 > I do agree, however, that the current interface is less than ideal... >=20 >=20 > > Of course, the problem at hand has been fixed and we want to keep direct > > consumers of KSTACK_PAGES to a minimum, but I think the point still sta= nds. > > >=20 > I think it's a good point, but the current way is likely the least-bad way > to accomplish things. >=20 > It would be much better if we could remove it from machine/param.h and > opt_XXX.h always defines it, even the default value when it's not otherwi= se > specified. However, we don't (currently) have a way to set default values > in config(8). We could add it, since the efforts at config++ have thus far > fallen flat.... I think this is probably the better direction to move. There aren't any in-tree uses of KSTACK_PAGES so removing the definition should be fine. -- Brooks