Skip to content

lunatik: register a percpu script as a single object - #762

Merged
lneto merged 1 commit into
masterfrom
claude_percpu_object
Sep 4, 2026
Merged

lneto merged 1 commit into
masterfrom
claude_percpu_object

Conversation

@lneto

@lneto lneto commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

On top of #772, merged: the runner registers a percpu script as that object.

env.percpu and the <script>:<cpu> key convention are gone: one table, one key, one lookup. The runner loses the per-CPU loops and the two-phase shutdown that existed only because stopping a percpu script deleted N entries under an iteration that allows deleting only the entry it hands out; the eBPF kfuncs lose the per-packet scnprintf and second hash lookup. lunatik.runtime loses its cpu argument: the runner was its only caller, and a script claiming an instance id is the trust-based declaration the registration checks exist to replace.

spawn percpu stays refused; #686 was built on the per-instance registry this removes and is to be redone over the object, one bound thread per instance.

This subsumes the registry split of 9b900f5, which existed to separate two key shapes in one table; the object removes the second shape.

Tests: tests/runtime/percpu covers the runner path (one instance per CPU id, listed once, stop and rerun, spawn refused, rollback of a failing instance); the xdp and tc drop cases and the receiving-CPU case cover the dispatch.

Tested on 6.8.0-138 (aarch64), on this head over master: full suite 123/0/0, clean dmesg.

🤖 Generated with Claude Code

Comment thread lunatik_obj.c
Comment on lines +94 to +96
int lunatik_closeobject(lua_State *L)
{
lunatik_closeprivate(lunatik_checkobject(L, 1));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this indirection?

@lneto
lneto force-pushed the claude_percpu_object branch from cb5df6c to f7488b8 Compare September 2, 2026 23:42
@lneto
lneto changed the base branch from master to claude_ebpf_irqonly September 2, 2026 23:42
@lneto
lneto force-pushed the claude_ebpf_irqonly branch from b63b7ca to 7bdb355 Compare September 3, 2026 12:46
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from 7640cfe to 8518402 Compare September 3, 2026 14:23
@lneto
lneto force-pushed the claude_ebpf_irqonly branch 2 times, most recently from 6baf3d9 to 117fe8c Compare September 3, 2026 18:49
@lneto
lneto force-pushed the claude_percpu_object branch from 8518402 to a109265 Compare September 3, 2026 18:49
@lneto
lneto force-pushed the claude_ebpf_irqonly branch from 117fe8c to 837de41 Compare September 3, 2026 22:52
@lneto
lneto force-pushed the claude_percpu_object branch from a109265 to 6896eaa Compare September 3, 2026 22:52
@lneto
lneto force-pushed the claude_ebpf_irqonly branch from 837de41 to f8089b8 Compare September 3, 2026 23:01
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from b5df98b to 2a0c944 Compare September 3, 2026 23:08
@lneto
lneto force-pushed the claude_ebpf_irqonly branch from f8089b8 to 0e37660 Compare September 3, 2026 23:08
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from 6794ec3 to dfc0f76 Compare September 3, 2026 23:19
@lneto
lneto force-pushed the claude_ebpf_irqonly branch from ae4c1a3 to 38a25c3 Compare September 3, 2026 23:19
@lneto
lneto force-pushed the claude_percpu_object branch from dfc0f76 to b92abd1 Compare September 3, 2026 23:23
@lneto
lneto changed the base branch from claude_ebpf_irqonly to master September 3, 2026 23:23
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from 892e235 to 28e220a Compare September 3, 2026 23:35
@lneto lneto changed the title lunatik: percpu, one object owning one runtime per CPU id lunatik: register a percpu script as a single object Sep 3, 2026
@lneto
lneto changed the base branch from master to claude_percpu_class September 3, 2026 23:36
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from eac1088 to 9067033 Compare September 4, 2026 00:03
@lneto
lneto force-pushed the claude_percpu_class branch from 05c2795 to e80a774 Compare September 4, 2026 12:02
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from b31ed16 to 5ae0807 Compare September 4, 2026 12:04
@lneto
lneto force-pushed the claude_percpu_class branch 2 times, most recently from 7d3b277 to 8d7f920 Compare September 4, 2026 12:07
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from 7a59d67 to 694ea47 Compare September 4, 2026 12:37
@lneto
lneto force-pushed the claude_percpu_class branch from 8d7f920 to 430f61f Compare September 4, 2026 12:37
@lneto
lneto force-pushed the claude_percpu_object branch from 694ea47 to e197ddb Compare September 4, 2026 12:45
@lneto
lneto force-pushed the claude_percpu_class branch 2 times, most recently from 8a11104 to 92b4d42 Compare September 4, 2026 12:50
@lneto
lneto force-pushed the claude_percpu_object branch from e197ddb to 9316d27 Compare September 4, 2026 12:50
@lneto
lneto force-pushed the claude_percpu_class branch from 92b4d42 to 30c4d7a Compare September 4, 2026 13:18
@lneto
lneto force-pushed the claude_percpu_object branch from 9316d27 to 2154274 Compare September 4, 2026 13:18
@lneto
lneto force-pushed the claude_percpu_class branch from 30c4d7a to e86d49c Compare September 4, 2026 13:19
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from 221a8a8 to e5eb5f2 Compare September 4, 2026 13:20
@lneto
lneto force-pushed the claude_percpu_class branch from e86d49c to b107135 Compare September 4, 2026 13:20
@lneto
lneto changed the base branch from claude_percpu_class to master September 4, 2026 14:32
@lneto
lneto force-pushed the claude_percpu_object branch from e5eb5f2 to 5e477c2 Compare September 4, 2026 14:32
@lneto lneto changed the title lunatik: register a percpu script as a single object lunatik: register a percpu script as a single object, fold the eBPF lookup Sep 4, 2026
@lneto lneto changed the title lunatik: register a percpu script as a single object, fold the eBPF lookup lunatik: register a percpu script as a single object Sep 4, 2026
@lneto
lneto force-pushed the claude_percpu_object branch from 138bb43 to 5e477c2 Compare September 4, 2026 14:43
@lneto
lneto force-pushed the claude_percpu_object branch 2 times, most recently from d7c3441 to fa86fce Compare September 4, 2026 22:41
env.runtimes held plain script names while env.percpu held one
`<script>:<cpu>` key per instance, and every consumer had to know both:
the runner looped over CPU ids to run, stop and list, and the XDP kfunc
built a per-packet key to look the instance up. A percpu script now
registers as one object under its own name, so there is one table, one
key and one lookup, and the dispatch happens inside lunatik_run.

The runner loses the key convention along with the two-phase shutdown
that existed because stopping a percpu script deleted N entries under
an iteration that only allows deleting the entry it hands out.

lunatik.runtime loses its cpu argument: the runner was its only caller,
and a script creating a runtime that claims an instance id is the
trust-based declaration the registration checks exist to replace.

This subsumes the registry split of 9b900f5, which existed to separate
two key shapes in one table; the object removes the second shape.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@lneto
lneto force-pushed the claude_percpu_object branch from fa86fce to 41d4314 Compare September 4, 2026 22:42
@lneto
lneto merged commit a14e366 into master Sep 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant