Skip to content

Commit 1dfbd8d

Browse files
eddyz87Kernel Patches Daemon
authored andcommitted
bpf: rename nocsr -> bpf_fastcall in verifier
Attribute used by LLVM implementation of the feature had been changed from no_caller_saved_registers to bpf_fastcall (see [1]). This commit replaces references to nocsr by references to bpf_fastcall to keep LLVM and Kernel parts in sync. [1] llvm/llvm-project#105417 Acked-by: Yonghong Song <[email protected]> Signed-off-by: Eduard Zingerman <[email protected]>
1 parent 88af105 commit 1dfbd8d

File tree

4 files changed

+84
-85
lines changed

4 files changed

+84
-85
lines changed

include/linux/bpf.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,12 +808,12 @@ struct bpf_func_proto {
808808
bool gpl_only;
809809
bool pkt_access;
810810
bool might_sleep;
811-
/* set to true if helper follows contract for gcc/llvm
812-
* attribute no_caller_saved_registers:
811+
/* set to true if helper follows contract for llvm
812+
* attribute bpf_fastcall:
813813
* - void functions do not scratch r0
814814
* - functions taking N arguments scratch only registers r1-rN
815815
*/
816-
bool allow_nocsr;
816+
bool allow_fastcall;
817817
enum bpf_return_type ret_type;
818818
union {
819819
struct {

include/linux/bpf_verifier.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -577,13 +577,13 @@ struct bpf_insn_aux_data {
577577
bool call_with_percpu_alloc_ptr; /* {this,per}_cpu_ptr() with prog percpu alloc */
578578
u8 alu_state; /* used in combination with alu_limit */
579579
/* true if STX or LDX instruction is a part of a spill/fill
580-
* pattern for a no_caller_saved_registers call.
580+
* pattern for a bpf_fastcall call.
581581
*/
582-
u8 nocsr_pattern:1;
582+
u8 fastcall_pattern:1;
583583
/* for CALL instructions, a number of spill/fill pairs in the
584-
* no_caller_saved_registers pattern.
584+
* bpf_fastcall pattern.
585585
*/
586-
u8 nocsr_spills_num:3;
586+
u8 fastcall_spills_num:3;
587587

588588
/* below fields are initialized once */
589589
unsigned int orig_idx; /* original instruction index */
@@ -653,19 +653,19 @@ struct bpf_subprog_info {
653653
u32 linfo_idx; /* The idx to the main_prog->aux->linfo */
654654
u16 stack_depth; /* max. stack depth used by this function */
655655
u16 stack_extra;
656-
/* offsets in range [stack_depth .. nocsr_stack_off)
657-
* are used for no_caller_saved_registers spills and fills.
656+
/* offsets in range [stack_depth .. fastcall_stack_off)
657+
* are used for bpf_fastcall spills and fills.
658658
*/
659-
s16 nocsr_stack_off;
659+
s16 fastcall_stack_off;
660660
bool has_tail_call: 1;
661661
bool tail_call_reachable: 1;
662662
bool has_ld_abs: 1;
663663
bool is_cb: 1;
664664
bool is_async_cb: 1;
665665
bool is_exception_cb: 1;
666666
bool args_cached: 1;
667-
/* true if nocsr stack region is used by functions that can't be inlined */
668-
bool keep_nocsr_stack: 1;
667+
/* true if bpf_fastcall stack region is used by functions that can't be inlined */
668+
bool keep_fastcall_stack: 1;
669669

670670
u8 arg_cnt;
671671
struct bpf_subprog_arg_info args[MAX_BPF_FUNC_REG_ARGS];

kernel/bpf/helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const struct bpf_func_proto bpf_get_smp_processor_id_proto = {
158158
.func = bpf_get_smp_processor_id,
159159
.gpl_only = false,
160160
.ret_type = RET_INTEGER,
161-
.allow_nocsr = true,
161+
.allow_fastcall = true,
162162
};
163163

164164
BPF_CALL_0(bpf_get_numa_node_id)

0 commit comments

Comments
 (0)