[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231204201406.341074-1-khuey@kylehuey.com>
Date: Mon, 4 Dec 2023 12:14:04 -0800
From: Kyle Huey <me@...ehuey.com>
To: Kyle Huey <khuey@...ehuey.com>, linux-kernel@...r.kernel.org
Cc: Robert O'Callahan <robert@...llahan.org>, bpf@...r.kernel.org
Subject: [PATCH 0/2] Combine perf and bpf for fast eval of hw breakpoint conditions
rr, a userspace record and replay debugger[0], replays asynchronous events
such as signals and context switches by essentially[1] setting a breakpoint
at the address where the asynchronous event was delivered during recording
with a condition that the program state matches the state when the event
was delivered.
Currently, rr uses software breakpoints that trap (via ptrace) to the
supervisor, and evaluates the condition from the supervisor. If the
asynchronous event is delivered in a tight loop (thus requiring the
breakpoint condition to be repeatedly evaluated) the overhead can be
immense. A patch to rr that uses hardware breakpoints via perf events with
an attached bpf program to reject breakpoint hits where the condition is
not satisfied reduces rr's replay overhead by 94% on a pathological (but a
real customer-provided, not contrived) rr trace.
The only obstacle to this approach is that while the kernel allows a bpf
program to suppress sample output when a perf event overflows it does not
suppress signalling the perf event fd. This appears to be a simple
oversight in the code. This patch set fixes that oversight and adds a
selftest.
[0] https://rr-project.org/
[1] Various optimizations exist to skip as much as execution as possible
before setting a breakpoint, and to determine a set of program state that
is practical to check and verify.
Powered by blists - more mailing lists