From nobody Thu Apr 18 10:00:12 2024 X-Original-To: arch@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 4VKtYz0nYxz5GWLs for ; Thu, 18 Apr 2024 10:00:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 4VKtYy4xQsz4mWs for ; Thu, 18 Apr 2024 10:00:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 43IA0DZc068367; Thu, 18 Apr 2024 13:00:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 43IA0DZc068367 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 43IA0Cs3068359; Thu, 18 Apr 2024 13:00:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 18 Apr 2024 13:00:12 +0300 From: Konstantin Belousov To: Warner Losh Cc: Colin Percival , Lexi Winter , arch@freebsd.org Subject: Re: enable INVARIANT_SUPPORT in GENERIC in release builds Message-ID: References: <0100018ee9e8a381-2e0a8845-5321-4841-bfaf-184376e88112-000000@email.amazonses.com> List-Id: Discussion related to FreeBSD architecture List-Archive: https://lists.freebsd.org/archives/freebsd-arch List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arch@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4VKtYy4xQsz4mWs On Wed, Apr 17, 2024 at 03:41:06PM -0600, Warner Losh wrote: > On Wed, Apr 17, 2024 at 4:16 AM Konstantin Belousov > wrote: > > > On Tue, Apr 16, 2024 at 09:53:06PM -0600, Warner Losh wrote: > > > On Tue, Apr 16, 2024 at 8:35 PM Colin Percival > > wrote: > > > > > > > On 4/16/24 14:00, Lexi Winter wrote: > > > > > currently release version of GENERIC (or GENERIC-NODEBUG in main) > > does > > > > > not have INVARIANT_SUPPORT enabled. > > > > > > > > > > unfortunately, the presence or absense of this option breaks the KABI > > > > > because, as i understand it, modules built with INVARIANTS won't > > load on > > > > > a kernel without INVARIANT_SUPPORT. > > > > > > > > > > is there a reason INVARIANT_SUPPORT can't just be enabled by default? > > > > > > > > I think while it had much lower overhead than INVARIANTS, there was > > still > > > > a significant overhead cost at least in the early days. Maybe that's > > no > > > > longer the case. > > > > > > > > > > I thought it had no overhead (despite the comments saying it does). It > > > only increases runtime from what I can see if INVARIANTS or WITNESS > > > are defined. > > > > > > > > > > > this would remove one roadblock to separating kernel modules from the > > > > > kernel config in both pkgbase and ports, because there would be no > > need > > > > > to build a KABI-incompatible kernel just to build a single module > > with > > > > > INVARIANTS. > > > > > > > > If the overhead cost of INVARIANT_SUPPORT is no longer relevant, I'd be > > > > fine with including it in stable/15. Of course we can't turn it on for > > > > stable/1[34] for the ABI reasons you just mentioned > > > > > > > > > > I think that it just exports more functions, so that's something that > > could > > > be exported. > > > > No, it does not. For instance, for buffer cache, INVARIANTS_SUPPORT > > makes buffer lock asserts into real calls into lockmgr. It might do > > something similar to the inpcb locks as well. > > > > Why not make those INVARIANTS then? All the ones for mutexes (which is the > bulk of the other uses) just provide the routines, but don't actually make > things slow unless one or both of INVARIANTS and WITNESS are included. > > But I see this in kern_lock.c, which I'm not sure about: > > #ifndef INVARIANTS > #define _lockmgr_assert(lk, what, file, line) > #endif > > which looks like it too requires INVARIANTS. What am I missing? Right, I mean that some parts of INVARIANTS_SUPPORT needs to be cleaned first ... > > > > Fixing such case and making INVARIANTS_SUPPORT indeed only export some > > functions would be a pre-requisite to enabling it for all users. > > > > But then, it raises a question, what are the KBI differences between > > no-SUPPORT and SUPPORT kernels are, except exported functions? > > > > I think it is only exported functions. I didn't see anything other than > adding calls or defining functions... > ... and then this option can be removed altogether, by providing the exported functions unconditionally.