Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support riscv jit to provide #3089

Closed
wants to merge 7 commits into from

Conversation

kernel-patches-bot
Copy link

Pull request for series with
subject: Support riscv jit to provide
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=645930

@kernel-patches-bot
Copy link
Author

Master branch: 7e062cd
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=645930
version: 3

Kernel Patches Daemon and others added 4 commits May 30, 2022 12:29
We found that 32-bit environment can not print bpf line info due
to data inconsistency between jited_ksyms[0] and jited_linfo[0].

For example:
jited_kyms[0] = 0xb800067c, jited_linfo[0] = 0xffffffffb800067c

We know that both of them store bpf func address, but due to the
different data extension operations when extended to u64, they may
not be the same. We need to unify the data extension operations of
them.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Add support for riscv jit to provide bpf_line_info. We need to
consider the prologue offset in ctx->offset, but unlike x86 and
arm64, ctx->offset of riscv does not provide an extra slot for
the prologue, so here we just calculate the len of prologue and
add it to ctx->offset at the end. Both RV64 and RV32 have been
tested.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
The insn_to_jit_off passed to bpf_prog_fill_jited_linfo should be
the first byte of the next instruction, or the byte off to the end
of the current instruction.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
@kernel-patches-bot
Copy link
Author

Master branch: 1626f57
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=645930
version: 3

Pu Lehui added 3 commits May 30, 2022 12:29
The members of bpf_prog_info, which are line_info, jited_line_info,
jited_ksyms and jited_func_lens, store u64 address pointed to the
corresponding memory regions. Memory addresses are conceptually
unsigned, (unsigned long) casting makes more sense, so let's make
a change for conceptual uniformity.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
The members of bpf_prog_info, which are line_info and jited_line_info
store u64 address pointed to the corresponding memory regions. Memory
addresses are conceptually unsigned, (unsigned long) casting makes
more sense, so let's make a change for conceptual uniformity.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
We have unified data extension operation of jited_ksyms and jited_linfo
into zero extension, so there's no need to cast u64 memory address to
long data type.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
@kernel-patches-bot
Copy link
Author

Master branch: 4b4b4f9
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=645930
version: 3

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/netdevbpf/list/?series=645930
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am -3
  stdout: 'Applying: bpf: Unify data extension operation of jited_ksyms and jited_linfo
Using index info to reconstruct a base tree...
M	kernel/bpf/syscall.c
Falling back to patching base and 3-way merge...
Auto-merging kernel/bpf/syscall.c
CONFLICT (content): Merge conflict in kernel/bpf/syscall.c
Patch failed at 0001 bpf: Unify data extension operation of jited_ksyms and jited_linfo
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch'

conflict:

diff --cc kernel/bpf/syscall.c
index aeb31137b2ed,2929a4aab82c..000000000000
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@@ -4090,15 -4095,15 +4090,24 @@@ static int bpf_prog_get_info_by_fd(stru
  		info.nr_jited_line_info = 0;
  	if (info.nr_jited_line_info && ulen) {
  		if (bpf_dump_raw_ok(file->f_cred)) {
++<<<<<<< HEAD
 +			unsigned long line_addr;
++=======
+ 			unsigned long ladd;
++>>>>>>> bpf: Unify data extension operation of jited_ksyms and jited_linfo
  			__u64 __user *user_linfo;
  			u32 i;
  
  			user_linfo = u64_to_user_ptr(info.jited_line_info);
  			ulen = min_t(u32, info.nr_jited_line_info, ulen);
  			for (i = 0; i < ulen; i++) {
++<<<<<<< HEAD
 +				line_addr = (unsigned long)prog->aux->jited_linfo[i];
 +				if (put_user((__u64)line_addr, &user_linfo[i]))
++=======
+ 				ladd = (unsigned long)prog->aux->jited_linfo[i];
+ 				if (put_user((__u64)ladd, &user_linfo[i]))
++>>>>>>> bpf: Unify data extension operation of jited_ksyms and jited_linfo
  					return -EFAULT;
  			}
  		} else {

@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=645930 irrelevant now. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/636779=>bpf-next branch May 30, 2022 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant