Skip to content

Commit e4db2a8

Browse files
Pu Lehuianakryiko
authored andcommitted
libbpf: Access first syscall argument with CO-RE direct read on s390
Currently PT_REGS_PARM1 SYSCALL(x) is consistent with PT_REGS_PARM1_CORE SYSCALL(x), which will introduce the overhead of BPF_CORE_READ(), taking into account the read pt_regs comes directly from the context, let's use CO-RE direct read to access the first system call argument. Suggested-by: Andrii Nakryiko <[email protected]> Signed-off-by: Pu Lehui <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent eff5b5f commit e4db2a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/lib/bpf/bpf_tracing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163

164164
struct pt_regs___s390 {
165165
unsigned long orig_gpr2;
166-
};
166+
} __attribute__((preserve_access_index));
167167

168168
/* s390 provides user_pt_regs instead of struct pt_regs to userspace */
169169
#define __PT_REGS_CAST(x) ((const user_pt_regs *)(x))
@@ -179,7 +179,7 @@ struct pt_regs___s390 {
179179
#define __PT_PARM4_SYSCALL_REG __PT_PARM4_REG
180180
#define __PT_PARM5_SYSCALL_REG __PT_PARM5_REG
181181
#define __PT_PARM6_SYSCALL_REG gprs[7]
182-
#define PT_REGS_PARM1_SYSCALL(x) PT_REGS_PARM1_CORE_SYSCALL(x)
182+
#define PT_REGS_PARM1_SYSCALL(x) (((const struct pt_regs___s390 *)(x))->__PT_PARM1_SYSCALL_REG)
183183
#define PT_REGS_PARM1_CORE_SYSCALL(x) \
184184
BPF_CORE_READ((const struct pt_regs___s390 *)(x), __PT_PARM1_SYSCALL_REG)
185185

0 commit comments

Comments
 (0)