From nobody Thu Jan 16 22:43:07 2025 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 4YYyZ41dRHz5l1Yp; Thu, 16 Jan 2025 22:43:08 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYyZ374hdz49Vy; Thu, 16 Jan 2025 22:43:07 +0000 (UTC) (envelope-from brooks@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737067388; 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=aMY/wnleGUiFshyaRA0mSCPajKzd5Uogozbhc4UxxsQ=; b=Dr2rn2PQ/GqRfwipcFBYdHybAok7avPpXNYdJo5OLPzSe1IQdBsuyfQEMew90p+y5MOY+c C1rbG9ZzVNCqkhbMyb1iS+sfmctaTS87Cgie6kc1iZ0ugOr00n8Ie4YQW0BVXNJLed+IAg krHL5JVIHr++Oy/SxeVYTRAUFb9ZjWzwaYJGN5KJKplwlomKnM9YC1R1G/nxYFLVedMIvx 274Utx3+mN9qNj7K7fs60zugyWI6zEpyJqvtV55BZBVW7Eyihv3jyIS7yhgkGQhpjz/294 JIJgpBhynKZn+JPr6h+xjlO1z3n5TH3Kn3tWytik2wwPvSGgZZZ5KygodmEklw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737067388; 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=aMY/wnleGUiFshyaRA0mSCPajKzd5Uogozbhc4UxxsQ=; b=QOdWsqJ8v3TMM1aifHfqqz/h7zZyXcFNg8/79vFHMculpOKsSu2oVVUGZmOEMGWW2nMxv4 /BetxNXpX2jfJMCxQLqbfWbUA9daXS6ShlmbhHFOkXRCctezlz9m3Tr7zdVbuzY6bj/QO5 HtccO9aIuBncH/4wRUBd6koIJgBhuYSOEcL2gDcgJHV1fy3sLktWLY3hB0CQpJt9bjhSNL 2VgrScnYJUbxoG/WemGrm5RbtRE1vDsGQ4JBF/QbHamhD6aHXVcuMrV+TbiI3DBgiwxxN8 WHIB/ssFQy2pZWvFXRujLKtJFZVyxdXi7KecsYo0JvOH4QbXvt+vcXb5b8jDhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737067388; a=rsa-sha256; cv=none; b=PeMqI75sTM28sep89Ve7YRdhF5tqaR9T5jFSt24pDX5OroNDQc0+ugMzO+cn/JKO7ZbM9+ DixmLoZ+iPurEyP39XjnxFOY3jvyW7iNuf2qcsjeJM7ZJMLJRrP+B/CyHKaWvkGoR5OuMj Rt7joHa/dIPDD6sfFOAzj1N6r6fLPKbxBtUH7p/EaksBzZp8wbjwiCn2uLQ1YsFuQHFNq4 W8c4kKP7eTKS9j7pFr2pGEimitYELHep/O+SaL1gsNPHLbd7JuWslx+6X+2YUYl9Q20TCF 2+Ls8AhGvqQ2/v80SXcTg5iu1m3YB/2jAnvz8YD22FkM84Afi2KLdp/KjfKXPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YYyZ363dtzywp; Thu, 16 Jan 2025 22:43:07 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 1466A3C01A0; Thu, 16 Jan 2025 22:43:07 +0000 (UTC) Date: Thu, 16 Jan 2025 22:43:07 +0000 From: Brooks Davis To: Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Warner Losh Subject: Re: git: 9ded074e875c - main - Refactor makesyscalls.lua into a library Message-ID: References: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> <25a28def-fbfd-49df-a2bf-dc4ef6609440@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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> On Thu, Jan 16, 2025 at 03:52:22PM -0600, Kyle Evans wrote: > On 10/30/24 16:08, Brooks Davis wrote: > > The branch main has been updated by brooks: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4 > > > > commit 9ded074e875c29cb92d5f643801990d7bb23cca4 > > Author: agge3 > > AuthorDate: 2024-10-21 21:42:13 +0000 > > Commit: Brooks Davis > > CommitDate: 2024-10-30 21:04:30 +0000 > > > > Refactor makesyscalls.lua into a library > > * main.lua replicates the functionality of makesyscalls.lua > > * Individual files are generated by their associated module > > * Modules can be called as standalone scripts to generate a specific > > file > > * Data and procedures are performed by objects instead of procedual code > > * Bitmasks are replaced by declarative types > > * Temporary files are no longer produced, writing is stored in memory > > * Comments provide explanation to functions and semantics > > Google Summer of Code 2024 Final Work Product > > Co-authored-by: Warner Losh > > Co-authored-by: Kyle Evans > > Co-authored-by: Brooks Davis > > Sponsored by: Google (GSoC 24) > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1362 > > Signed-off-by: agge3 > > --- > > sys/tools/syscalls/README.md | 49 +++ > > sys/tools/syscalls/config.lua | 312 +++++++++++++++++ > > sys/tools/syscalls/core/freebsd-syscall.lua | 147 ++++++++ > > sys/tools/syscalls/core/scarg.lua | 163 +++++++++ > > sys/tools/syscalls/core/scret.lua | 45 +++ > > sys/tools/syscalls/core/syscall.lua | 497 +++++++++++++++++++++++++++ > > sys/tools/syscalls/main.lua | 64 ++++ > > sys/tools/syscalls/scripts/init_sysent.lua | 193 +++++++++++ > > sys/tools/syscalls/scripts/libsys_h.lua | 111 ++++++ > > sys/tools/syscalls/scripts/syscall_h.lua | 97 ++++++ > > sys/tools/syscalls/scripts/syscall_mk.lua | 90 +++++ > > sys/tools/syscalls/scripts/syscalls.lua | 109 ++++++ > > sys/tools/syscalls/scripts/syscalls_map.lua | 74 ++++ > > sys/tools/syscalls/scripts/sysproto_h.lua | 242 +++++++++++++ > > sys/tools/syscalls/scripts/systrace_args.lua | 268 +++++++++++++++ > > sys/tools/syscalls/tools/generator.lua | 113 ++++++ > > sys/tools/syscalls/tools/util.lua | 194 +++++++++++ > > 17 files changed, 2768 insertions(+) > > > > [...] > > diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua > > new file mode 100644 > > index 000000000000..193b1e43563c > > --- /dev/null > > +++ b/sys/tools/syscalls/core/freebsd-syscall.lua > > @@ -0,0 +1,147 @@ > > [...] > > +function FreeBSDSyscall:parseSysfile() > > + local file = self.sysfile > > + local config = self.config > > + local commentExpr = "^%s*;.*" > > + > > + if file == nil then > > + return nil, "No file given" > > + end > > + > > + self.syscalls = {} > > + > > + local fh, msg = io.open(file) > > + if fh == nil then > > + return nil, msg > > + end > > + > > + local incs = "" > > + local defs = "" > > + local s > > + for line in fh:lines() do > > + line = line:gsub(commentExpr, "") -- Strip any comments. > > + -- NOTE: Can't use pure pattern matching here because of > > + -- the 's' test and this is shorter than a generic pattern > > + -- matching pattern. > > + if line == nil or line == "" then > > + goto skip -- Blank line, skip this line. > > + elseif s ~= nil then > > + -- If we have a partial system call object s, > > + -- then feed it one more line. > > + if s:add(line) then > > + -- Append to system call list. > > + for t in s:iter() do > > + if t:validate(t.num - 1) then > > + table.insert(self.syscalls, t) > > + else > > + util.abort(1, > > + "Skipped system call " .. > > + "at number " .. t.num) > > + end > > + end > > + s = nil > > + end > > + elseif line:match("^#%s*include") then > > + incs = incs .. line .. "\n" > > + elseif line:match("%%ABI_HEADERS%%") then > > + local h = self.config.abi_headers > > + if h ~= nil and h ~= "" then > > + incs = incs .. h .. "\n" > > + end > > + elseif line:match("^#%s*define") then > > + defs = defs .. line.. "\n" > > + elseif line:match("^#") then > > + util.abort(1, "Unsupported cpp op " .. line) > > This specifically is kind of a huge regression, and I don't really know how to > cope with it. We've guaranteed for years that we'll copy preprocessor > directives through to all output files. We don't use that upstream in > FreeBSD, but we work with downstreams/vendors that make extensive use of it in > their syscall definitions. > > I don't really know what the answer is to this, but we probably shouldn't have > dropped it without some discussion first. This is going to be a bit of a > headache... This response seems rather hyperbolic. This change was up for review for months and the feature is unused in tree so there was no way to know it was important. It would be helpful to work through some examples understand what people need here and if it really has to be a refactor to pass things through or if adding some new tags and config values could do the job. The quickest workaround would probably to revert these commits locally (I took care to isolate them for exactly this reason): 5212b9500116 sysent: GC sys/tools/makesyscalls.lua 204d065dac81 sysent: switch to refactored makesyscalls.lua You might also need to revert this commit or implement it in makesyscalls.lua: bbc0f33b1317 sysent: add a NOLIB modifer to prevent stub generation If we need be, I'd even be ok with temporarily restoring makesyscalls.lua and back porting easy features, but maintaining two is certainly not viable indefinitely. -- Brooks