Files
linux/include/linux
Kui-Feng Lee b671c2067a bpf: Retire the struct_ops map kvalue->refcnt.
We have replaced kvalue-refcnt with synchronize_rcu() to wait for an
RCU grace period.

Maintenance of kvalue->refcnt was a complicated task, as we had to
simultaneously keep track of two reference counts: one for the
reference count of bpf_map. When the kvalue->refcnt reaches zero, we
also have to reduce the reference count on bpf_map - yet these steps
are not performed in an atomic manner and require us to be vigilant
when managing them. By eliminating kvalue->refcnt, we can make our
maintenance more straightforward as the refcount of bpf_map is now
solely managed!

To prevent the trampoline image of a struct_ops from being released
while it is still in use, we wait for an RCU grace period. The
setsockopt(TCP_CONGESTION, "...") command allows you to change your
socket's congestion control algorithm and can result in releasing the
old struct_ops implementation. It is fine. However, this function is
exposed through bpf_setsockopt(), it may be accessed by BPF programs
as well. To ensure that the trampoline image belonging to struct_op
can be safely called while its method is in use, the trampoline
safeguarde the BPF program with rcu_read_lock(). Doing so prevents any
destruction of the associated images before returning from a
trampoline and requires us to wait for an RCU grace period.

Signed-off-by: Kui-Feng Lee <kuifeng@meta.com>
Link: https://lore.kernel.org/r/20230323032405.3735486-2-kuifeng@meta.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
2023-03-22 22:51:47 -07:00
..
2023-01-16 09:26:05 +01:00
2022-11-04 12:59:25 +02:00
2023-02-16 13:42:22 +01:00
2023-02-20 09:20:55 -05:00
2023-02-15 19:38:50 +01:00
2023-01-19 14:46:25 +01:00
2022-09-26 12:19:12 -07:00
2022-12-07 09:43:12 -07:00
2023-03-10 11:05:28 -08:00
2023-03-10 16:38:05 -08:00
2023-02-03 08:20:55 -07:00
2022-09-26 19:46:29 -07:00
2022-09-26 10:13:13 -07:00
2022-09-26 10:13:13 -07:00
2022-09-15 09:32:06 -07:00
2023-01-13 11:48:15 +01:00
2023-01-19 16:07:40 +01:00
2023-01-29 15:18:33 -07:00
2023-01-29 15:18:33 -07:00
2023-02-06 19:06:58 +01:00
2023-01-19 09:24:28 +01:00
2023-01-11 06:52:43 -05:00
2023-02-02 22:33:13 -08:00
2023-01-17 09:29:59 +01:00
2022-11-11 18:18:05 -08:00
2022-09-01 18:04:43 +02:00
2022-09-08 12:59:00 -06:00
2022-09-26 13:31:20 +02:00
2022-11-15 00:42:02 -08:00
2022-12-11 19:30:20 -08:00
2022-09-01 18:08:44 +02:00
2023-02-13 10:11:20 +02:00
2022-10-03 14:03:19 -07:00
2023-01-19 09:24:28 +01:00
2023-01-19 09:24:28 +01:00
2023-01-19 09:24:30 +01:00
2022-08-02 12:34:04 -04:00
2023-03-07 23:57:19 -08:00
2022-10-03 17:34:32 -07:00
2022-09-26 19:46:27 -07:00
2023-02-02 22:33:34 -08:00
2023-01-16 09:26:06 +01:00
2023-03-07 18:19:09 -08:00
2023-01-04 14:44:13 -07:00
2023-01-19 09:24:28 +01:00
2022-12-20 03:13:45 +01:00
2022-10-23 18:06:54 -04:00
2023-03-13 12:42:24 -07:00
2023-01-19 09:24:28 +01:00
2023-01-19 15:01:19 +01:00
2023-01-03 17:49:22 -08:00
2023-01-18 17:12:47 -08:00
2022-09-07 12:42:25 +01:00
2023-02-16 18:10:18 +01:00
2022-09-29 15:20:29 +02:00
2022-09-22 16:12:34 +02:00
2022-08-28 16:52:28 +01:00
2023-01-23 15:38:08 +01:00
2023-02-20 19:26:58 -05:00
2022-09-26 19:46:18 -07:00
2023-01-19 09:24:28 +01:00
2022-10-24 12:12:32 -07:00