Commit 4ea63db
fix: avoid XADD-with-fetch atomic that aborts on older LLVM BPF backends
block_rq_issue used __sync_fetch_and_add's return value against a shared
BPF_ARRAY counter to assign req_id, which lowers to a BPF XADD with the
BPF_FETCH flag. Older/distro clang BPF backends can't legally emit that
and hard-abort the whole process with "LLVM ERROR: Invalid usage of the
XADD return value" (uncatchable as a Python exception, since BCC embeds
clang/LLVM in-process). Replace the shared atomic counter with a
BPF_PERCPU_ARRAY bumped via a plain per-CPU increment, folding the CPU id
into the high bits for cross-CPU uniqueness, removing the need for any
atomic fetch-and-add entirely.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 81033a0 commit 4ea63db
2 files changed
Lines changed: 50 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
683 | 690 | | |
684 | 691 | | |
685 | 692 | | |
| |||
2884 | 2891 | | |
2885 | 2892 | | |
2886 | 2893 | | |
2887 | | - | |
2888 | | - | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
2889 | 2898 | | |
2890 | 2899 | | |
2891 | 2900 | | |
| |||
0 commit comments