Skip to content

Commit

Permalink
[TMP] detect held_interrupts violations
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanRoyer committed Sep 6, 2023
1 parent 3833cee commit ad54f48
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion applications/rq_access_eval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ edition = "2021"
app_io = { path = "../../kernel/app_io" }
cpu = { path = "../../kernel/cpu" }
getopts = "0.2"
irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }
runqueue = { path = "../../kernel/runqueue" }
time = { path = "../../kernel/time" }
2 changes: 1 addition & 1 deletion kernel/ap_start/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
log = "0.4.8"

irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }
sync_irq = { path = "../../libs/sync_irq" }
memory = { path = "../memory" }
stack = { path = "../stack" }
Expand Down
2 changes: 1 addition & 1 deletion kernel/captain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
log = "0.4.8"

irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }
dfqueue = { path = "../../libs/dfqueue", version = "0.1.0" }
interrupt_controller = { path = "../interrupt_controller" }
multicore_bringup = { path = "../multicore_bringup" }
Expand Down
2 changes: 1 addition & 1 deletion kernel/cls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
cls_macros = { path = "cls_macros" }
irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }
preemption = { path = "../preemption" }

[target.'cfg(target_arch = "x86_64")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion kernel/memory_initialization/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ kernel_config = { path = "../kernel_config" }
bootloader_modules = { path = "../bootloader_modules" }
heap = { path = "../heap" }

irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }
2 changes: 1 addition & 1 deletion kernel/nano_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ multiboot2 = { version = "0.14.0", optional = true }
libm = "0.2.1"
log = "0.4.8"

irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }

kernel_config = { path = "../kernel_config" }
state_store = { path = "../state_store" }
Expand Down
2 changes: 1 addition & 1 deletion kernel/spawn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ log = "0.4.8"
spin = "0.9.4"
lazy_static = { features = ["spin_no_std"], version = "1.4.0" }

irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }

debugit = { path = "../../libs/debugit" }

Expand Down
2 changes: 1 addition & 1 deletion kernel/task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spin = "0.9.4"
static_assertions = "1.1.0"
crossbeam-utils = { version = "0.8.2", default-features = false }

irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }

context_switch = { path = "../context_switch" }
cls = { path = "../cls" }
Expand Down
2 changes: 1 addition & 1 deletion kernel/task/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ fn task_switch_inner(
// on this CPU during the schedule/task_switch routines cannot observe inconsistencies
// in task runstates, e.g., when an interrupt handler accesses the current task context.
{
let _held_interrupts = hold_interrupts();
let _held_interrupts = hold_interrupts("task_switch_inner");
next.0.task.running_on_cpu().store(Some(cpu_id).into());
next.set_as_current_task();
drop(_held_interrupts);
Expand Down
2 changes: 1 addition & 1 deletion kernel/tlb_shootdown/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
log = "0.4.8"
irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }
memory = { path = "../memory" }
cpu = { path = "../cpu" }
sync_irq = { path = "../../libs/sync_irq" }
Expand Down
2 changes: 1 addition & 1 deletion kernel/tlb_shootdown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn broadcast_tlb_shootdown(pages_to_invalidate: PageRange) {

// interrupts must be disabled here, because this IPI sequence must be fully synchronous with other cores,
// and we wouldn't want this core to be interrupted while coordinating IPI responses across multiple cores.
let _held_ints = hold_interrupts();
let _held_ints = hold_interrupts("tlb_shootdown");

// acquire lock
// TODO: add timeout!!
Expand Down
2 changes: 1 addition & 1 deletion libs/sync_irq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ description = "Interrupt-request-disabling synchronisation primitives"
edition = "2021"

[dependencies]
irq_safety = { git = "https://github.com/theseus-os/irq_safety" }
irq_safety = { path = "../../../irq_safety" }
sync = { path = "../sync" }
4 changes: 2 additions & 2 deletions libs/sync_irq/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use irq_safety::{hold_interrupts, HeldInterrupts};
pub use irq_safety::{hold_interrupts, HeldInterrupts};

pub type Mutex<T> = sync::Mutex<T, DisableIrq>;
pub type MutexGuard<'a, T> = sync::MutexGuard<'a, T, DisableIrq>;
Expand All @@ -27,6 +27,6 @@ impl sync::DeadlockPrevention for DisableIrq {

#[inline]
fn enter() -> Self::Guard {
hold_interrupts()
hold_interrupts("DeadlockPrevention::enter")
}
}

0 comments on commit ad54f48

Please sign in to comment.