diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-30 17:16:47 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-06-02 20:23:05 -0400 |
commit | b50f6f89c7d46036064f1e3e6811025691c83460 (patch) | |
tree | 05be9875f08ebf319325fc42417b94aab7f00a40 /tools/perf/scripts/python/syscall-counts.py | |
parent | 0a3420049aaccccf0a51a01884bb89b49da900ff (diff) |
fs: sys_ringbuffer
Add new syscalls for generic ringbuffers that can be attached to
arbitrary (supporting) file descriptors.
A ringbuffer consists of:
- a single page for head/tail pointers, size/mask, and other ancilliary
metadata, described by 'struct ringbuffer_ptrs'
- a data buffer, consisting of one or more pages mapped at
'ringbuffer_ptrs.data_offset' above the address of 'ringbuffer_ptrs'
The data buffer is always a power of two size. Head and tail pointers
are u32 byte offsets, and they are stored unmasked (i.e., they use the
full 32 bit range) - they must be masked for reading.
- ringbuffer(int fd, int rw, u32 size, ulong *addr)
Create or get address of an existing ringbuffer for either reads or
writes, of at least size bytes, and attach it to the given file
descriptor; the address of the ringbuffer is returned via addr.
Since files can be shared between processes in different address spaces
a ringbuffer may be mapped into multiple address spaces via this
syscall.
- ringbuffer_wait(int fd, int rw)
Wait for space to be availaable (on a ringbuffer for writing), or data
to be available (on a ringbuffer for writing).
todo: add parameters for timeout, minimum amount of data/space to wait for
- ringbuffer_wakeup(int fd, int rw)
Required after writing to a previously empty ringbuffer, or reading from
a previously full ringbuffer to notify waiters on the other end
todo - investigate integrating with futexes?
todo - add extra fields to ringbuffer_ptrs for waiting on a minimum
amount of data/space, i.e. to signal when a wakeup is required
Kernel interfaces:
- To indicate that ringbuffers are supported on a file, set
FOP_RINGBUFFER_READ and/or FOP_RINGBUFFER_WRITE in your
file_operations.
- To read or write to a file's associated ringbuffers
(file->f_ringbuffer), use ringbuffer_read() or ringbuffer_write().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts.py')
0 files changed, 0 insertions, 0 deletions