Comments (4)
The following diff fixed the problem:
plumgrid@yhs-plumgrid:~/iovisor/bcc/tests/jit$ git diff
diff --git a/tests/jit/bpfdev1.b b/tests/jit/bpfdev1.b
index c2ecddd..bc04002 100644
--- a/tests/jit/bpfdev1.b
+++ b/tests/jit/bpfdev1.b
@@ -110,49 +110,53 @@ u32 main(struct proto::skbuff *skb) {
u32 old_ip:32;
u64 src_mac:48;
u64 dst_mac:48;
+ u32 bpfdev_ip:32;
+ u32 slave_ip:32;
struct ConfigKey cfg_key = {.index = 0};
struct ConfigLeaf *cfg_leaf;
config_map.lookup(cfg_key, cfg_leaf) {};
on_valid(cfg_leaf) {
- struct MacaddrKey mac_key = {.ip = cfg_leaf->bpfdev_ip};
- struct MacaddrLeaf *mac_leaf;
-
- mac_key.ip = cfg_leaf->bpfdev_ip;
- macaddr_map.lookup(mac_key, mac_leaf) {};
- on_valid (mac_leaf) {
- src_mac = mac_leaf->mac;
- } else {
- goto EOP;
- }
-
- mac_key.ip = cfg_leaf->slave_ip;
- macaddr_map.lookup(mac_key, mac_leaf) {};
- on_valid (mac_leaf) {
- dst_mac = mac_leaf->mac;
- } else {
- goto EOP;
- }
-
- // rewrite ethernet header
- pkt.rewrite_field($ethernet.dst, dst_mac);
- pkt.rewrite_field($ethernet.src, src_mac);
-
- // ip & udp checksum
- incr_cksum(@ip.hchecksum, $ip.src, cfg_leaf->bpfdev_ip);
- incr_cksum(@ip.hchecksum, $ip.dst, cfg_leaf->slave_ip);
- incr_cksum(@udp.crc, $ip.src, cfg_leaf->bpfdev_ip, 1);
- incr_cksum(@udp.crc, $ip.dst, cfg_leaf->slave_ip, 1);
-
- // rewrite ip src/dst fields
- pkt.rewrite_field($ip.src, cfg_leaf->bpfdev_ip);
- pkt.rewrite_field($ip.dst, cfg_leaf->slave_ip);
+ bpfdev_ip = cfg_leaf->bpfdev_ip;
+ slave_ip = cfg_leaf->slave_ip;
+ } else {
+ goto EOP;
+ }
+ struct MacaddrKey mac_key = {.ip = bpfdev_ip};
+ struct MacaddrLeaf *mac_leaf;
+
+ mac_key.ip = bpfdev_ip;
+ macaddr_map.lookup(mac_key, mac_leaf) {};
+ on_valid (mac_leaf) {
+ src_mac = mac_leaf->mac;
+ } else {
goto EOP;
+ }
+ mac_key.ip = slave_ip;
+ macaddr_map.lookup(mac_key, mac_leaf) {};
+ on_valid (mac_leaf) {
+ dst_mac = mac_leaf->mac;
} else {
goto EOP;
}
+
+ // rewrite ethernet header
+ pkt.rewrite_field($ethernet.dst, dst_mac);
+ pkt.rewrite_field($ethernet.src, src_mac);
+
+ // ip & udp checksum
+ incr_cksum(@ip.hchecksum, $ip.src, bpfdev_ip);
+ incr_cksum(@ip.hchecksum, $ip.dst, slave_ip);
+ incr_cksum(@udp.crc, $ip.src, bpfdev_ip, 1);
+ incr_cksum(@udp.crc, $ip.dst, slave_ip, 1);
+
+ // rewrite ip src/dst fields
+ pkt.rewrite_field($ip.src, bpfdev_ip);
+ pkt.rewrite_field($ip.dst, slave_ip);
+
+ goto EOP;
}
}
plumgrid@yhs-plumgrid:~/iovisor/bcc/tests/jit$
Basically, the map result should have a short live range by copying to local variable.
from bcc.
the diff is mangled it seems. It seems it's a workaround by using inside knowledge of front-end gen ?
I think we should try to fix it in the backend. Clearly r2=r1 assignments are redundant.
I also don't 'remat' pass to be run. It's important. Otherwise constant values will be copied between registers instead of using 'mov Rx, imm' which is faster, less register pressure and easier on verifier.
from bcc.
I've updated the diff with proper github markdown syntax. Alexei, do you have any advice on how to fix it in the backend, or are you considering that your own AI?
from bcc.
I don't have a concrete plan. I suspect there is still something we missing
about pass_manager. Probably need to enable several more passes.
On Mon, May 11, 2015 at 6:34 AM, Brenden [email protected] wrote:
I've updated the diff with proper github markdown syntax. Alexei, do you
have any advice on how to fix it in the backend, or are you considering
that your own AI?—
Reply to this email directly or view it on GitHub
#10 (comment).
from bcc.
Related Issues (20)
- Failed to attach BPF program b'oncpu' to kprobe b'finish_task_switch' offcputime-bpfcc HOT 3
- bcc-tools: trace.py syscall trace not working for proccess in container(lxc) HOT 1
- question: `LLVM ERROR: ` error with no indication
- [question]: Run ebpf demo failed.
- zfsslower wrongly tries to attach to non-existant zpl_read (regression of #1248)
- memleak: the symbol of the function that calls `new` disappeared HOT 2
- some regex escape sequences broke after fixing SyntaxWarning HOT 1
- Just ran into this issue while building / testing on Debian 8 amd64.
- can't deny access to a specific file
- can't deny access to a specific file
- no matching member function for call to 'replace'
- fatal error: clang/Basic/FileManager.h: No such file or directory
- ImportError: cannot import name 'BPF' from 'bcc' (unknown location)
- python-bcc works only if clang-libs Installed, fails with only clang16-libs Installed
- libbpf javagc fails when no PID is provided
- bpflist doesn't show attached probes
- Build fail from source HOT 4
- Fail building from source HOT 1
- attach_raw_socket function does not work well on Qualcomm modem HOT 1
- Build bcc from source code failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bcc.