Files
linux/include/linux
Puranjay Mohan 2ddec2c80b riscv, bpf: inline bpf_get_smp_processor_id()
Inline the calls to bpf_get_smp_processor_id() in the riscv bpf jit.

RISCV saves the pointer to the CPU's task_struct in the TP (thread
pointer) register. This makes it trivial to get the CPU's processor id.
As thread_info is the first member of task_struct, we can read the
processor id from TP + offsetof(struct thread_info, cpu).

          RISCV64 JIT output for `call bpf_get_smp_processor_id`
	  ======================================================

                Before                           After
               --------                         -------

         auipc   t1,0x848c                  ld    a5,32(tp)
         jalr    604(t1)
         mv      a5,a0

Benchmark using [1] on Qemu.

./benchs/run_bench_trigger.sh glob-arr-inc arr-inc hash-inc

+---------------+------------------+------------------+--------------+
|      Name     |     Before       |       After      |   % change   |
|---------------+------------------+------------------+--------------|
| glob-arr-inc  | 1.077 ± 0.006M/s | 1.336 ± 0.010M/s |   + 24.04%   |
| arr-inc       | 1.078 ± 0.002M/s | 1.332 ± 0.015M/s |   + 23.56%   |
| hash-inc      | 0.494 ± 0.004M/s | 0.653 ± 0.001M/s |   + 32.18%   |
+---------------+------------------+------------------+--------------+

NOTE: This benchmark includes changes from this patch and the previous
      patch that implemented the per-cpu insn.

[1] https://github.com/anakryiko/linux/commit/8dec900975ef

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Björn Töpel <bjorn@kernel.org>
Link: https://lore.kernel.org/r/20240502151854.9810-3-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2024-05-12 16:54:34 -07:00
..
2024-03-07 21:52:03 +00:00
2023-10-24 13:08:14 -07:00
2024-01-18 15:21:00 -08:00
2024-04-24 11:06:26 -07:00
2023-12-20 19:26:32 -05:00
2023-10-11 08:46:01 -07:00
2024-03-11 15:37:23 -07:00
2024-04-29 16:28:07 -07:00
2023-12-02 22:24:36 +00:00
2023-12-15 16:25:55 -08:00
2024-03-07 20:37:04 +00:00
2024-02-20 14:22:55 -05:00
2024-02-20 14:22:51 -05:00
2024-03-12 23:08:29 -07:00
2024-02-25 12:05:08 +01:00
2023-12-03 10:28:17 -08:00
2024-01-08 09:36:55 +09:00
2024-03-07 09:36:08 +01:00
2024-02-28 19:36:39 -08:00
2024-03-10 14:38:04 -07:00
2024-02-15 23:43:48 -05:00
2024-02-14 11:14:40 +01:00
2023-12-20 19:26:31 -05:00
2023-12-20 19:26:31 -05:00
2023-10-11 10:11:54 -07:00
2024-02-17 16:20:41 +01:00
2023-10-18 14:43:21 -07:00
2023-10-04 10:41:57 -07:00
2023-12-20 19:26:30 -05:00
2023-10-16 12:44:06 -04:00
2023-10-16 12:44:06 -04:00
2023-10-18 10:01:33 +02:00
2024-03-13 18:38:13 -04:00
2024-03-06 13:04:18 -08:00
2023-11-15 22:41:27 -05:00
2024-03-01 08:44:54 +00:00
2024-03-09 09:14:51 -05:00
2024-03-09 09:14:50 -05:00
2023-12-20 19:26:30 -05:00
2024-03-26 11:07:20 -07:00
2023-11-15 10:15:40 +01:00
2023-12-20 19:26:31 -05:00
2024-03-13 12:53:53 -07:00
2024-03-13 12:53:53 -07:00
2023-12-20 19:26:31 -05:00
2023-12-20 19:26:31 -05:00
2024-01-09 15:00:09 +01:00
2023-12-20 19:26:30 -05:00
2023-12-27 11:49:56 -05:00
2023-10-06 11:01:23 +02:00
2023-12-20 19:26:32 -05:00
2024-04-02 18:03:32 -07:00
2023-12-27 11:49:56 -05:00
2023-12-20 19:26:31 -05:00
2024-03-08 12:05:10 +01:00
2024-04-03 09:59:38 +01:00
2023-12-20 19:26:32 -05:00
2023-12-20 19:26:32 -05:00
2023-12-20 19:26:32 -05:00
2024-02-15 12:17:28 -05:00
2024-03-03 15:06:58 -08:00
2023-12-20 19:26:31 -05:00
2023-10-18 14:43:21 -07:00
2024-02-20 13:36:34 +01:00
2024-04-08 11:49:02 +01:00
2024-03-04 17:25:09 +01:00
2023-12-20 19:26:31 -05:00
2023-12-08 12:02:37 +01:00
2024-02-18 18:59:59 +01:00
2023-12-20 19:26:30 -05:00
2024-03-06 10:52:12 +01:00
2024-02-09 12:07:48 +00:00