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

scx_rusty: Work around spurious task_ctx update failures #1

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

htejun
Copy link
Contributor

@htejun htejun commented Dec 4, 2023

As in scx_layered, bpf_map_delete_elem() can fail due to recursion protection triggering spuriously which can then lead to task_ctx creation failure after PIDs wrap. Work around by dropping BPF_NOEXIST.

As in scx_layered, bpf_map_delete_elem() can fail due to recursion
protection triggering spuriously which can then lead to task_ctx creation
failure after PIDs wrap. Work around by dropping BPF_NOEXIST.
@htejun htejun requested a review from Byte-Lab December 4, 2023 01:50
@Byte-Lab Byte-Lab merged commit d6b978d into main Dec 4, 2023
@htejun htejun deleted the fix-rusty-eexist branch December 6, 2023 00:52
@htejun htejun restored the fix-rusty-eexist branch January 31, 2024 19:56
@htejun htejun deleted the fix-rusty-eexist branch January 31, 2024 19:57
@htejun htejun restored the fix-rusty-eexist branch March 12, 2024 02:53
@htejun htejun deleted the fix-rusty-eexist branch March 12, 2024 02:53
@htejun htejun restored the fix-rusty-eexist branch March 29, 2024 22:16
@htejun htejun deleted the fix-rusty-eexist branch March 29, 2024 22:34
@htejun htejun restored the fix-rusty-eexist branch May 17, 2024 10:20
@htejun htejun deleted the fix-rusty-eexist branch May 17, 2024 10:23
@htejun htejun restored the fix-rusty-eexist branch June 16, 2024 06:25
@htejun htejun deleted the fix-rusty-eexist branch June 16, 2024 15:34
htejun added a commit that referenced this pull request Nov 24, 2024
Converting node_ctx or llc_ctx to bss array crashes the kernel.

[    3.998971] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[  217.533891] BUG: unable to handle page fault for address: ffffc900029c0000
[  217.534159] #PF: supervisor write access in kernel mode
[  217.534349] #PF: error_code(0x0002) - not-present page
[  217.534537] PGD 100000067 P4D 100000067 PUD 10024a067 PMD 10d753067 PTE 0
[  217.534781] Oops: Oops: 0002 [#1] PREEMPT SMP NOPTI
[  217.534943] CPU: 13 UID: 0 PID: 1857 Comm: scx_layered Not tainted 6.11.0-work-10477-ge3f5412bf764 #40
[  217.535248] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS unknown 02/02/2022
[  217.535526] RIP: 0010:memcpy+0x8/0x10
[  217.535702] Code: e9 db fe ff ff cc cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 66 90 48 89 f8 48 89 d1 <f3> a4 c3 cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
[  217.536338] RSP: 0018:ffffc900029bfb68 EFLAGS: 00010293
[  217.536519] RAX: ffffc900029bfff8 RBX: 0000000000000025 RCX: 0000000000000010
[  217.536775] RDX: 0000000000000018 RSI: ffffc900029bfc88 RDI: ffffc900029c0000
[  217.537021] RBP: 000000000000003f R08: 0000000008000000 R09: 0000000000000001
[  217.537269] R10: ffffc900029bfc98 R11: 000000001f000000 R12: 0000000000000018
[  217.537516] R13: 0000000000000024 R14: 0000000000000001 R15: ffffc900029bfc80
[  217.537785] FS:  00007f933e9cc8c0(0000) GS:ffff888237d40000(0000) knlGS:0000000000000000
[  217.538064] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  217.538265] CR2: ffffc900029c0000 CR3: 00000001093a2000 CR4: 0000000000750eb0
[  217.538516] PKRU: 55555554
[  217.538625] Call Trace:
[  217.538716]  <TASK>
[  217.538796]  ? __die_body+0x66/0xb0
[  217.538923]  ? page_fault_oops+0x2cc/0x350
[  217.539069]  ? do_kern_addr_fault+0x7a/0xa0
[  217.539217]  ? exc_page_fault+0x62/0x90
[  217.539354]  ? asm_exc_page_fault+0x22/0x30
[  217.539504]  ? memcpy+0x8/0x10
[  217.539623]  btf_repeat_fields+0xa2/0x110
[  217.539766]  btf_find_field_one+0x5b0/0x5c0
[  217.539918]  btf_parse_fields+0x1f6/0x900
[  217.540240]  </TASK>
[  217.540353] Modules linked in:
[  217.540488] CR2: ffffc900029c0000
[  217.540643] ---[ end trace 0000000000000000 ]---
[  217.540847] RIP: 0010:memcpy+0x8/0x10
[  217.541009] Code: e9 db fe ff ff cc cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 66 90 48 89 f8 48 89 d1 <f3> a4 c3 cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
[  217.541925] RSP: 0018:ffffc900029bfb68 EFLAGS: 00010293
[  217.542123] RAX: ffffc900029bfff8 RBX: 0000000000000025 RCX: 0000000000000010
[  217.542397] RDX: 0000000000000018 RSI: ffffc900029bfc88 RDI: ffffc900029c0000
[  217.542704] RBP: 000000000000003f R08: 0000000008000000 R09: 0000000000000001
[  217.543014] R10: ffffc900029bfc98 R11: 000000001f000000 R12: 0000000000000018
[  217.543326] R13: 0000000000000024 R14: 0000000000000001 R15: ffffc900029bfc80
[  217.543644] FS:  00007f933e9cc8c0(0000) GS:ffff888237d40000(0000) knlGS:0000000000000000
[  217.543947] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  217.544147] CR2: ffffc900029c0000 CR3: 00000001093a2000 CR4: 0000000000750eb0
[  217.544398] PKRU: 55555554
[  217.544497] note: scx_layered[1857] exited with irqs disabled
vnepogodin added a commit to CachyOS/scx that referenced this pull request Dec 12, 2024
Into trait was calling the Into<&SupportedSched> which was calling
Into<SupportedSched> and so on.

```
    #0 0x622450e96149 in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#1 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#2 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#3 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#4 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#5 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#6 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#7 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#8 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#9 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#10 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#11 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#12 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#13 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#14 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
```
etsal pushed a commit to etsal/scx that referenced this pull request Dec 16, 2024
Into trait was calling the Into<&SupportedSched> which was calling
Into<SupportedSched> and so on.

```
    #0 0x622450e96149 in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#1 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#2 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#3 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#4 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#5 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#6 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#7 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#8 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#9 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#10 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#11 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#12 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
    sched-ext#13 0x622450e91af3 in _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h9481856c4f80c765 /home/vl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:759:9
    sched-ext#14 0x622450e9614a in scx_loader::_$LT$impl$u20$core..convert..From$LT$scx_loader..SupportedSched$GT$$u20$for$u20$$RF$str$GT$::from::h13ba9d4271e33441 /tmp/scx/rust/scx_loader/src/lib.rs:60:9
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants