diff --git a/drivers/gpu/drm/asahi/g17/initdata.rs b/drivers/gpu/drm/asahi/g17/initdata.rs index 5a689c60e37f7..13e10fe69df00 100644 --- a/drivers/gpu/drm/asahi/g17/initdata.rs +++ b/drivers/gpu/drm/asahi/g17/initdata.rs @@ -1074,6 +1074,8 @@ impl InitData { // The word recovery_state() reads: the status block moves with the firmware build. recovery: self.object(self.cluster)?.word(self.recovery_state_offset())?, mailbox, + m5_credits: self.outer_credits.clone(), + m5_history: self.m5_history_view()?, }) } diff --git a/drivers/gpu/drm/asahi/g17/initdata/m5.rs b/drivers/gpu/drm/asahi/g17/initdata/m5.rs index a5ec8476745f5..7fc5443f44a7f 100644 --- a/drivers/gpu/drm/asahi/g17/initdata/m5.rs +++ b/drivers/gpu/drm/asahi/g17/initdata/m5.rs @@ -52,6 +52,32 @@ impl InitData { ring(0), ring(1), ring(2), ring(3), page(canonical.start)] } + /// Direct-port view of the M5 submission-history table (none off M5 or on common 26A428). + pub(super) fn m5_history_view(&self) -> Result> { + if !self.m5 || self.graph.is_common26() { + return Ok(None); + } + let private = self.object(self.cluster)?; + let base = self.graph.private.status_config; + let field = |offset| { + self.m5_status_config + .relocate(offset) + .map(|at| base + at) + .ok_or(EINVAL) + }; + let history = field(m::M5_STATUS_CONFIG_HISTORY)?; + Ok(Some(crate::g17::port::M5HistoryView { + generation: private.word(field(m::M5_STATUS_CONFIG_HISTORY_GENERATION)?)?, + config: [ + private.word(history)?, + private.word(history + 4)?, + private.word(history + 8)?, + private.word(history + 12)?, + ], + slots: private.pointer(field(m::M5_STATUS_CONFIG_HISTORY_SLOTS)?, 256)?, + })) + } + /// Selects the power-policy layout of the M5 firmware build `build_m5` encodes for. pub(in crate::g17) fn set_m5_policy_layouts( &mut self, diff --git a/drivers/gpu/drm/asahi/g17/initdata/outer_credit.rs b/drivers/gpu/drm/asahi/g17/initdata/outer_credit.rs index 08804ff1fc498..84901b7afdd92 100644 --- a/drivers/gpu/drm/asahi/g17/initdata/outer_credit.rs +++ b/drivers/gpu/drm/asahi/g17/initdata/outer_credit.rs @@ -9,7 +9,7 @@ use kernel::{prelude::*, sync::Arc}; const PRIORITIES: usize = 4; -pub(super) struct Credits { +pub(crate) struct Credits { reserved: [AtomicU32; PRIORITIES], published: [AtomicU64; PRIORITIES], consumers: [AtomicU64; PRIORITIES], @@ -53,15 +53,19 @@ impl Credits { pub(super) fn waiting(&self) -> bool { self.available.has_waiters() } - pub(super) fn capacity(&self, priority: u8, cursors: [u32; 3]) -> Result { + pub(crate) fn is_scoped(&self) -> bool { + self.scoped.load(Ordering::Acquire) + } + + pub(crate) fn capacity(&self, priority: u8, cursors: [u32; 3]) -> Result { let pending = self.reserved.get(usize::from(priority)).ok_or(EINVAL)? .load(Ordering::Acquire); Ok(free(cursors)?.saturating_sub(pending)) } - /// Reserve under the sole publisher mutex. Off-lock cancellation may only + /// Reserve under the outer-ring lock. Off-lock cancellation may only /// reduce reserved counts, so the sampled capacity is conservative. - pub(super) fn reserve(self: &Arc, priority: u8, count: u32, + pub(crate) fn reserve(self: &Arc, priority: u8, count: u32, cursors: [u32; 3]) -> Result { if count == 0 || count >= WORK_RING_SLOTS { return Err(EINVAL); } @@ -75,6 +79,20 @@ impl Credits { Ok(OuterClaim { domain: self.clone(), priority: index, remaining: count }) } + /// Consumes one reserved slot for a direct M5 compute publication without touching + /// `published[]`, so an enclosing device-mutex `OuterScope` never debits a direct slot. + pub(crate) fn consume_direct(&self, claim: &mut OuterClaim) -> Result { + if !core::ptr::eq(self, &*claim.domain) { + return Err(EINVAL); + } + if claim.remaining == 0 { + return Err(EIO); + } + claim.remaining -= 1; + self.reserved[claim.priority].fetch_sub(1, Ordering::AcqRel); + Ok(()) + } + pub(super) fn scope<'a>(self: &Arc, claim: &'a mut OuterClaim) -> Result> { if !Arc::ptr_eq(self, &claim.domain) { return Err(EINVAL); } if self.scoped.swap(true, Ordering::AcqRel) { return Err(EBUSY); } @@ -128,3 +146,104 @@ impl Drop for OuterClaim { } } } + +#[kernel::macros::kunit_tests(asahi_g17_outer_credit)] +mod tests { + use super::*; + + #[test] + fn direct_consumption_does_not_debit_outer_scope() { + let credits = Credits::new().unwrap(); + let cursors = [0, 0, 0]; + let full = free(cursors).unwrap(); + let mut scoped_claim = credits.reserve(1, 2, cursors).unwrap(); + let mut direct_claim = credits.reserve(1, 1, cursors).unwrap(); + assert_eq!(credits.capacity(1, cursors).unwrap(), full - 3); + + // Direct publish consumes only its own reserved slot and leaves published[] untouched. + assert!(!credits.is_scoped()); + credits.consume_direct(&mut direct_claim).unwrap(); + assert_eq!(direct_claim.remaining(), 0); + assert_eq!(credits.capacity(1, cursors).unwrap(), full - 2); + assert_eq!(credits.counter(1).unwrap().load(Ordering::Acquire), 0); + + // An OuterScope taken afterward keeps its full 2 credits when nothing published via it. + { + let _scope = credits.scope(&mut scoped_claim).unwrap(); + assert!(credits.is_scoped()); + assert!(credits.reserve(1, 1, cursors).is_err()); + } + assert!(!credits.is_scoped()); + assert_eq!(scoped_claim.remaining(), 2); + drop(direct_claim); + drop(scoped_claim); + assert_eq!(credits.capacity(1, cursors).unwrap(), full); + } + + #[test] + fn mixed_render_compute_wrap_and_generation_change_with_queued_claim() { + let credits = Credits::new().unwrap(); + let n = WORK_RING_SLOTS; + // Producer sits two slots before wrap while both consumers lag 4 slots behind + // (free = WORK_RING_SLOTS - 5). + let mut consumer_a = n - 6; + let mut consumer_b = n - 6; + let mut producer = n - 2; + let cursors = [consumer_a, consumer_b, producer]; + let initial_free = free(cursors).unwrap(); + assert_eq!(initial_free, n - 5); + + // Interleave a queued 2-slot render claim with 1-slot compute claims across ring wrap. + let mut queued_render = credits.reserve(2, 2, cursors).unwrap(); + let mut compute_a = credits.reserve(2, 1, cursors).unwrap(); + credits.consume_direct(&mut compute_a).unwrap(); + producer = (producer + 1) % n; // n - 1 + assert_eq!( + credits.capacity(2, [consumer_a, consumer_b, producer]).unwrap(), + initial_free - 3, + ); + + let mut compute_b = credits.reserve(2, 1, [consumer_a, consumer_b, producer]).unwrap(); + credits.consume_direct(&mut compute_b).unwrap(); + producer = (producer + 1) % n; // 0 (wrapped!) + assert_eq!(producer, 0); + + // Fill remaining capacity so exactly 1 free slot remains; 2-slot render must fail EBUSY + // while 1-slot compute still succeeds across the wrap boundary. + let rem = credits.capacity(2, [consumer_a, consumer_b, producer]).unwrap(); + let filler = credits.reserve(2, rem - 1, [consumer_a, consumer_b, producer]).unwrap(); + assert_eq!(credits.capacity(2, [consumer_a, consumer_b, producer]).unwrap(), 1); + assert_eq!(credits.reserve(2, 2, [consumer_a, consumer_b, producer]).err(), Some(EBUSY)); + let mut edge_compute = credits.reserve(2, 1, [consumer_a, consumer_b, producer]).unwrap(); + credits.consume_direct(&mut edge_compute).unwrap(); + producer = (producer + 1) % n; // 1 + assert_eq!(credits.capacity(2, [consumer_a, consumer_b, producer]).unwrap(), 0); + drop(filler); + + // Consumers advance across the wrap boundary and report progress. + consumer_a = 1; + consumer_b = 1; + let wrapped = [consumer_a, consumer_b, producer]; + assert!(credits.progressed(2, wrapped).unwrap()); + assert_eq!(credits.capacity(2, wrapped).unwrap(), (n - 1) - 2); + + // Simulate locked render / recovery entering OuterScope while a queued compute claim + // waits across a generation change: new reserves fail EBUSY and direct consumption never + // debits OuterScope's published counter; dropping the queued claim after the generation + // change releases its reserved credits cleanly. + let queued_compute = credits.reserve(2, 1, wrapped).unwrap(); + { + let _scope = credits.scope(&mut queued_render).unwrap(); + assert!(credits.is_scoped()); + assert_eq!(credits.reserve(2, 1, wrapped).err(), Some(EBUSY)); + credits.counter(2).unwrap().fetch_add(2, Ordering::AcqRel); + } + assert!(!credits.is_scoped()); + assert_eq!(queued_render.remaining(), 0); + // Generation changed before queued_compute published: dropping it returns its credit. + assert_eq!(queued_compute.remaining(), 1); + drop(queued_compute); + drop(queued_render); + assert_eq!(credits.capacity(2, wrapped).unwrap(), n - 1); + } +} diff --git a/drivers/gpu/drm/asahi/g17/port.rs b/drivers/gpu/drm/asahi/g17/port.rs index ebd1ba7071882..ddc289d497859 100644 --- a/drivers/gpu/drm/asahi/g17/port.rs +++ b/drivers/gpu/drm/asahi/g17/port.rs @@ -7,9 +7,9 @@ //! through a preparation lease ([`super::Shared::port`]): shutdown and device loss join every //! lease before they detach the session. Each piece below is atomic or has its own lock. //! -//! Lock order: device mutex -> compute queue cell -> the locks of this port. The render -//! publication lock comes first among the port's locks: device mutex -> render publication -//! lock -> admission pool, QoS, mailbox. Its holder never takes the device mutex. +//! Lock order: device mutex -> compute queue cell -> the locks of this port. Among the port's +//! locks: render publication lock -> M5 outer-ring lock -> admission pool, QoS, mailbox. None +//! of their holders ever takes the device mutex. use super::{ fw::{ @@ -73,6 +73,14 @@ impl RingView { } } +/// Raw pointers to the M5 submission-history table in firmware-shared memory. +#[derive(Clone, Copy)] +pub(super) struct M5HistoryView { + pub(super) generation: *const AtomicU32, + pub(super) config: [*const AtomicU32; 4], + pub(super) slots: *mut u8, +} + /// Raw views of the session's firmware-shared memory, fixed once the firmware is built. pub(super) struct Views { pub(super) compute: [RingView; PRIORITIES], @@ -83,6 +91,8 @@ pub(super) struct Views { pub(super) qos: *mut u8, pub(super) recovery: *const AtomicU32, pub(super) mailbox: *const super::Mailbox, + pub(super) m5_credits: Option>, + pub(super) m5_history: Option, } // SAFETY: The views only name memory and a mailbox owned by the firmware session, which outlives @@ -114,6 +124,10 @@ pub(super) struct Port { /// overlaps are ordered by publication order (see hazard.rs). #[pin] render: Mutex<()>, + /// Serializes M5 shared outer-ring writes, host-port gating transactions, and submission + /// history geometry/updates across direct compute publishers and device-mutex publishers. + #[pin] + m5_outer: Mutex>, /// The accepted recovery generation, mirrored for publishers without the device mutex. generation: AtomicU64, /// Device publication order shared by compute and render commands. @@ -183,6 +197,7 @@ impl Port { rx_applied <- new_spinlock!(None, "g17::Port::rx_applied"), rx_state: AtomicU8::new(RX_STATE_UNSET), render <- new_mutex!((), "g17::Port::render"), + m5_outer <- new_mutex!(None, "g17::Port::m5_outer"), generation: AtomicU64::new(0), publications: AtomicU64::new(0), effort_full: AtomicBool::new(false), @@ -313,6 +328,137 @@ impl Port { self.render.lock() } + /// Serializes M5 shared outer-ring and host-port updates with direct M5 compute publishers. + pub(super) fn m5_outer_lock(&self) -> MutexGuard<'_, Option<(u32, u64, u64)>> { + self.m5_outer.lock() + } + + /// Clears the cached M5 submission-history geometry after firmware recovery restarts. + pub(super) fn reset_m5_history(&self) { + *self.m5_outer.lock() = None; + } + + /// Reserves one slot on M5's shared outer ring for a direct compute publisher without + /// taking the device mutex. Returns EBUSY if a device-mutex OuterScope is active or full. + pub(super) fn reserve_m5_compute(&self, priority: u8) -> Result { + let views = self.views()?; + let credits = views.m5_credits.as_ref().ok_or(EINVAL)?; + let (_, ring) = self.ring(priority)?; + let _guard = self.m5_outer.lock(); + if credits.is_scoped() { + return Err(EBUSY); + } + let cursors = ring.cursors()?; + credits.reserve(priority, 1, cursors) + } + + /// Publishes one compute slot on M5's shared outer ring under the port's M5 outer lock + /// and consumes the caller's direct reservation. + pub(super) fn publish_m5_compute( + &self, + priority: u8, + claim: &mut super::initdata::OuterClaim, + record: &WorkSlot, + ) -> Result { + if record.data_master != DataMaster::Compute as u32 { + return Err(EINVAL); + } + let views = self.views()?; + let credits = views.m5_credits.as_ref().ok_or(EINVAL)?; + let (_, ring) = self.ring(priority)?; + let _guard = self.m5_outer.lock(); + let [first, second, producer] = ring.cursors()?; + let next = (producer + 1) % WORK_RING_SLOTS; + if next == first || next == second { + return Err(EIO); + } + // SAFETY: The ring view spans WORK_RING_SLOTS records, checked when the session built + // it; `producer` is in range. The reservation proves firmware does not own this slot and + // `m5_outer` excludes every other host writer on M5's shared outer ring. + unsafe { + core::ptr::copy_nonoverlapping( + core::ptr::from_ref(record).cast::(), + ring.slots + .add(producer as usize * core::mem::size_of::()), + core::mem::size_of::(), + ); + } + fence(Ordering::SeqCst); + // SAFETY: As for `RingView::cursors`. + unsafe { (*ring.producer).store(next, Ordering::Relaxed) }; + fence(Ordering::SeqCst); + credits.consume_direct(claim)?; + Ok(next) + } + + /// Issues an M5 host-port compute submission with gating held off, serialized by `m5_outer`. + pub(super) fn submit_m5_work_held( + &self, + submission: &super::fw::m5::queue::HardwareSubmission, + ) -> Result { + let regs = self.regs.as_ref().ok_or(ENODEV)?; + let _guard = self.m5_outer.lock(); + regs.submit_m5_work_held(submission) + } + + /// Counts `submissions` in the M5 submission-history table without taking the device mutex. + pub(super) fn note_m5_submission_history(&self, submissions: u8) -> Result { + let Some(history) = self.views()?.m5_history else { + return Ok(()); + }; + let mut geometry = self.m5_outer.lock(); + for _ in 0..64 { + // SAFETY: Pointers name retained, bounds-checked firmware-shared words. + let generation = unsafe { (*history.generation).load(Ordering::Acquire) }; + if generation & 1 != 0 { + core::hint::spin_loop(); + continue; + } + let (period, count) = match *geometry { + Some((seen, period, count)) if seen == generation => (period, count), + _ => { + // SAFETY: As above; seqlock generation recheck validates consistency. + let c = unsafe { + [ + (*history.config[0]).load(Ordering::Relaxed), + (*history.config[1]).load(Ordering::Relaxed), + (*history.config[2]).load(Ordering::Relaxed), + (*history.config[3]).load(Ordering::Relaxed), + ] + }; + fence(Ordering::Acquire); + // SAFETY: As above. + if generation != unsafe { (*history.generation).load(Ordering::Acquire) } { + core::hint::spin_loop(); + continue; + } + let period = u64::from(c[0]) | (u64::from(c[1]) << 32); + let count = u64::from(c[2]) | (u64::from(c[3]) << 32); + *geometry = Some((generation, period, count)); + (period, count) + } + }; + if period == 0 || count == 0 || count > 256 { + return Err(EINVAL); + } + let (counter, frequency) = qos::clock(); + let ticks = qos::time_from_host(counter, frequency)?; + let index = (ticks % period) / 25_000; + if index >= count { + return Err(ERANGE); + } + // SAFETY: `slots` spans 256 WC bytes and `index < count <= 256`. + unsafe { + let byte = history.slots.add(index as usize); + let value = core::ptr::read_volatile(byte).wrapping_add(submissions); + core::ptr::write_volatile(byte, value); + } + fence(Ordering::SeqCst); + return Ok(()); + } + Err(EBUSY) + } + fn render_rings(&self, priority: u8) -> Result<(RingView, RingView)> { let views = self.views()?; let index = usize::from(priority); diff --git a/drivers/gpu/drm/asahi/g17/runtime.rs b/drivers/gpu/drm/asahi/g17/runtime.rs index 208b4862ba20f..a0de407119ff5 100644 --- a/drivers/gpu/drm/asahi/g17/runtime.rs +++ b/drivers/gpu/drm/asahi/g17/runtime.rs @@ -1718,6 +1718,8 @@ impl compute::Host for ComputeHost<'_> { struct DirectHost<'a> { port: &'a super::port::Port, outer: Option>, + m5_outer: Option<&'a mut super::initdata::OuterClaim>, + m5: bool, generation: u64, } impl compute::Host for DirectHost<'_> { @@ -1748,18 +1750,29 @@ impl compute::Host for DirectHost<'_> { fn register_queue(&mut self, _queue: &super::fw::kick::KsmQueue) -> Result { Err(EAGAIN) } - fn publish_outer(&mut self, _priority: u8, slot: &super::fw::channels::WorkSlot) -> Result { + fn publish_outer(&mut self, priority: u8, slot: &super::fw::channels::WorkSlot) -> Result { + if self.m5 { + let claim = self.m5_outer.as_deref_mut().ok_or(EIO)?; + return self.port.publish_m5_compute(priority, claim, slot).map(|_| ()); + } self.port.publish_compute(self.outer.take().ok_or(EIO)?, slot).map(|_| ()) } fn notify(&mut self, message: u64) -> Result { + if self.m5 && message >> super::MSG_TYPE_SHIFT == 0x83 && message & 3 == 2 { + if let Err(error) = self.port.note_m5_submission_history(1) { + pr_warn!("asahi: M5 submission history skipped: {:?}\n", error); + } + } self.port.notify(message) } fn note_submission(&mut self) -> Result { Ok(()) } - fn submit_m5(&mut self, _submission: &super::fw::m5::queue::HardwareSubmission) -> Result { - // M5 never publishes without the device mutex (see compute_direct). - Err(EINVAL) + fn submit_m5(&mut self, submission: &super::fw::m5::queue::HardwareSubmission) -> Result { + if !self.m5 { + return Err(EINVAL); + } + self.port.submit_m5_work_held(submission) } } @@ -1851,21 +1864,6 @@ impl super::Firmware { if self.recovery.pending() { return Err(EAGAIN); } - // No descriptor, accounting or inner producer changes precede this - // reservation; dropping it unused returns the work-ring slot. M5 compute takes its - // slot on the work ring M5 render shares, under this mutex (InitData::publish_work_at): - // a full ring is refused here, before a queue install or kick changes any state. - let mut outer_cursors = None; - let outer = if self.init.is_m5() { - let priority = packet.context.policy().priority(); - let Some(cursors) = self.init.m5_compute_room(priority)? else { - return Err(EAGAIN); - }; - outer_cursors = Some((priority, cursors)); - None - } else { - Some(self.port.reserve_compute(packet.context.policy().priority())?) - }; let queues = &mut self.queues; let mut queue = queues .compute @@ -1883,6 +1881,22 @@ impl super::Firmware { { return Err(EAGAIN); } + // No descriptor, accounting or inner producer changes precede this + // reservation; dropping it unused returns the work-ring slot. M5 compute + // serializes the shared outer ring and host-port updates under `m5_outer` + // (after the compute cell lock, matching direct M5 publishers). + let _m5_outer = self.init.is_m5().then(|| self.port.m5_outer_lock()); + let mut outer_cursors = None; + let outer = if self.init.is_m5() { + let priority = packet.context.policy().priority(); + let Some(cursors) = self.init.m5_compute_room(priority)? else { + return Err(EAGAIN); + }; + outer_cursors = Some((priority, cursors)); + None + } else { + Some(self.port.reserve_compute(packet.context.policy().priority())?) + }; let mut host = ComputeHost { shared: &self.primary.state.shared, init: &self.init, @@ -2144,10 +2158,7 @@ impl Backend { required: super::freelist::ComputeCapacity, deferred: &mut DeferredBatch, ) -> Option { - // M5 compute is a shared-ring submission on the ring M5 render shares: it is published only - // under the device mutex, never through the classic compute ring producer. - if self.context.is_m5() - || packet.completion.sources().is_some() + if packet.completion.sources().is_some() || self.context.render_seen() || packet.cancel_requested() || packet.completion.status().get() != 0 @@ -2172,23 +2183,42 @@ impl Backend { Err(error) if error == EBUSY => return None, Err(error) => return Some(Err(error)), } - let mut queue = cell.lock()?; - if !queue.installed() - || queue.spared_pending() - || !queue.pool_fits(required) - || queue.pending_switch_from().is_some() - || !matches!(queue.matches(self.owner, queue.qid(), &self.context), Ok(true)) - || !lease.is_current() - { - return None; - } - let outer = port.reserve_compute(packet.context.policy().priority()).ok()?; - let mut host = DirectHost { - port, - outer: Some(outer), - generation: port.generation(), + let m5 = self.context.is_m5(); + let priority = packet.context.policy().priority(); + // Reserve M5 outer room before locking the compute cell so an unspent claim drops + // outside the cell lock (dropping an unspent claim can notify availability fences). + let mut m5_outer = if m5 { + Some(port.reserve_m5_compute(priority).ok()?) + } else { + None }; - match queue.publish(packet.clone(), &[], &mut host, &mut |event| deferred.push(event)) { + let result = { + let mut queue = cell.lock()?; + if !queue.installed() + || queue.spared_pending() + || !queue.pool_fits(required) + || queue.pending_switch_from().is_some() + || !matches!(queue.matches(self.owner, queue.qid(), &self.context), Ok(true)) + || !lease.is_current() + { + return None; + } + let outer = if m5 { + None + } else { + Some(port.reserve_compute(priority).ok()?) + }; + let mut host = DirectHost { + port, + outer, + m5_outer: m5_outer.as_mut(), + m5, + generation: port.generation(), + }; + queue.publish(packet.clone(), &[], &mut host, &mut |event| deferred.push(event)) + }; + drop(m5_outer); + match result { Err(error) if (error == EAGAIN || error == EBUSY) && !packet.is_published() => None, result => Some(result), } diff --git a/drivers/gpu/drm/asahi/g17/runtime/events.rs b/drivers/gpu/drm/asahi/g17/runtime/events.rs index 8619f16377c5b..accf96a0aa9ff 100644 --- a/drivers/gpu/drm/asahi/g17/runtime/events.rs +++ b/drivers/gpu/drm/asahi/g17/runtime/events.rs @@ -326,6 +326,8 @@ impl Firmware { /// Drains every role's trace ring, then their statistics rings. The event worker calls this /// after it has signalled the completions of its pass: the reports are not scheduling inputs. + /// While work stays in flight it does so at the housekeeping cadence, and a recovery pass + /// does so before the restart resets the report rings. fn drain_reports(&mut self) { let dev = &self.primary.state.shared.dev; for &role in self.roles() { @@ -435,6 +437,7 @@ impl Firmware { .firmware .port .set_generation(service.firmware.recovery.generation()); + service.firmware.port.reset_m5_history(); service.firmware.rings.invalidate_statistics(); let result = result?; // Counted once the restart is classified, so the restart that reaches the limit has @@ -485,26 +488,10 @@ impl crate::g17::Shared { self.stop_runtime(); return; } - let mut deferred = { - let mut state = self.state.lock(); - let Some(firmware) = (*state).as_deref_mut() else { - return; - }; - let Some(deferred) = firmware.queues.worker_deferred.take() else { - drop(state); - self.lose_device_quietly(); - return; - }; - deferred - }; crate::g17::trace::event(0); - let result = self.runtime_event_turn(&mut deferred); - deferred.finish(); + let result = self.runtime_event_turn(); crate::g17::trace::event(2); self.queue_feed(); - if let Some(firmware) = (*self.state.lock()).as_deref_mut() { - firmware.queues.worker_deferred = Some(deferred); - } if let Err(error) = result { dev_err!(self.dev.as_ref(), "GPU event service failed: {:?}\n", error); self.lose_device_quietly(); @@ -512,177 +499,221 @@ impl crate::g17::Shared { } } - fn runtime_event_turn(self: &Arc, deferred: &mut DeferredBatch) -> Result { + fn runtime_event_turn(self: &Arc) -> Result { // Taken before consuming records: a request made during this pass gets the next one. let requested = self .housekeeping .swap(false, core::sync::atomic::Ordering::AcqRel); - let (recover, masks) = { + let (deferred, recover, masks) = { let mut state = self.state.lock(); let Some(firmware) = (*state).as_deref_mut() else { return Ok(()); }; - let (pending, masks) = firmware.service_runtime_events(deferred)?; + let Some(mut deferred) = firmware.queues.worker_deferred.take() else { + drop(state); + self.lose_device_quietly(); + return Ok(()); + }; + let (pending, masks) = match firmware.service_runtime_events(&mut deferred) { + Ok(out) => out, + Err(error) => { + drop(state); + deferred.finish(); + if let Some(firmware) = (*self.state.lock()).as_deref_mut() { + firmware.queues.worker_deferred = Some(deferred); + } + return Err(error); + } + }; let recover = pending.recovery || firmware.recovery.pending(); if recover { // Epoch closure and event consumption are serialized with every // publisher. Joining builders must happen after unlocking. self.preparations.close(); } - (recover, masks) + (deferred, recover, masks) }; - deferred.finish(); - crate::g17::trace::event(1); - if recover { - self.preparations - .wait_drained_until(super::now_ns().saturating_add(super::WORK_RING_WAIT_NS))?; - } - let mut state = self.state.lock(); - let Some(firmware) = (*state).as_deref_mut() else { - return Ok(()); - }; - if self.crashed.load(core::sync::atomic::Ordering::Acquire) { - return Err(EIO); + let mut deferred = Some(deferred); + if let Some(batch) = deferred.as_mut() { + batch.finish(); } - // The completions above are signalled; the reports that arrived with them come after. - firmware.drain_reports(); - if recover { - firmware.service_runtime_recovery(deferred)?; - if !firmware.recovery.pending() - && !self.sleep_gate.load(core::sync::atomic::Ordering::Acquire) - { - if !self.preparations.reopen() { - return Ok(()); + crate::g17::trace::event(1); + let result = (|| -> Result { + let batch = deferred.as_mut().ok_or(EIO)?; + if recover { + self.preparations + .wait_drained_until(super::now_ns().saturating_add(super::WORK_RING_WAIT_NS))?; + } + let mut state = self.state.lock(); + let Some(firmware) = (*state).as_deref_mut() else { + return Ok(()); + }; + if self.crashed.load(core::sync::atomic::Ordering::Acquire) { + return Err(EIO); + } + // Capture pre-recovery trace/statistics reports before firmware restart resets the + // report rings, matching the non-throttled post-signal ordering. + let mut reports_drained = false; + if recover { + firmware.drain_reports(); + reports_drained = true; + firmware.service_runtime_recovery(batch)?; + if !firmware.recovery.pending() + && !self.sleep_gate.load(core::sync::atomic::Ordering::Acquire) + { + if !self.preparations.reopen() { + return Ok(()); + } + // Restart stopped consumption before its following record. + // Resume builders before observing pairs outside this lock. + self.queue_events(); } - // Restart stopped consumption before its following record. - // Resume builders before observing pairs outside this lock. - self.queue_events(); } - } - // Replay only at this outer boundary, after recovery has settled. - // Publication may service events but must never recurse into replay. - firmware.replay_compute(deferred)?; - firmware.replay_render(deferred)?; - drop(state); - self.observe_renders(masks, deferred)?; - let mut state = self.state.lock(); - let Some(firmware) = (*state).as_deref_mut() else { - return Ok(()); - }; - if self.crashed.load(core::sync::atomic::Ordering::Acquire) { - return Err(EIO); - } - let now = super::now_ns(); - let compute = firmware - .queues - .compute - .iter() - .flatten() - .filter_map(|entry| entry.queue.as_deref()) - .any(|queue| queue.in_flight()); - let in_flight = compute || firmware.queues.render_in_flight(); - let idle = firmware.idle_check(now, in_flight)?; - // Expiries, drained pairs, exits, pool and heap trimming and teardown give back what - // retirement freed; a completion needs none of them to retire or to signal. While work - // is in flight and nothing waits for capacity, a pass for firmware records alone skips - // them. Any requested pass, recovery, teardown, a waiter, the last retirement and, at - // the latest, the first pass after HOUSEKEEPING_NS run them all. - let housekeeping = requested - || recover - || !in_flight - || firmware.recovery.pending() - || !firmware.queues.teardown.is_empty() - || self.channels.has_waiters() - || self.progress.has_waiters() - || self.queues.has_waiters() - || self.renders.has_waiters() - || now.saturating_sub( + // Replay only at this outer boundary, after recovery has settled. + // Publication may service events but must never recurse into replay. + firmware.replay_compute(batch)?; + firmware.replay_render(batch)?; + // Pure compute completions have empty render masks: keep the same device-mutex + // hold instead of dropping and immediately re-acquiring around a no-op observe. + if masks != [0; 2] { + drop(state); + self.observe_renders(masks, batch)?; + state = self.state.lock(); + if self.crashed.load(core::sync::atomic::Ordering::Acquire) { + return Err(EIO); + } + } + let Some(firmware) = (*state).as_deref_mut() else { + return Ok(()); + }; + let now = super::now_ns(); + let compute = firmware + .queues + .compute + .iter() + .flatten() + .filter_map(|entry| entry.queue.as_deref()) + .any(|queue| queue.in_flight()); + let in_flight = compute || firmware.queues.render_in_flight(); + let idle = firmware.idle_check(now, in_flight)?; + // Expiries, drained pairs, exits, pool and heap trimming, teardown and report + // drains give back what retirement freed; a completion needs none of them to retire + // or to signal. While work is in flight and nothing waits for capacity, a pass for + // firmware records alone skips them. Any requested pass, recovery, teardown, a waiter, + // the last retirement and, at the latest, the first pass after HOUSEKEEPING_NS run + // them all. + let housekeeping = requested + || recover + || !in_flight + || firmware.recovery.pending() + || !firmware.queues.teardown.is_empty() + || self.channels.has_waiters() + || self.progress.has_waiters() + || self.queues.has_waiters() + || self.renders.has_waiters() + || now.saturating_sub( + self.housekeeping_ns + .load(core::sync::atomic::Ordering::Relaxed), + ) >= HOUSEKEEPING_NS; + let mut lingers = None; + let mut drains = None; + let mut kills = None; + let mut pools = None; + let mut shrinking = false; + if housekeeping { self.housekeeping_ns - .load(core::sync::atomic::Ordering::Relaxed), - ) >= HOUSEKEEPING_NS; - let mut lingers = None; - let mut drains = None; - let mut kills = None; - let mut pools = None; - let mut shrinking = false; - if housekeeping { - self.housekeeping_ns - .store(now, core::sync::atomic::Ordering::Relaxed); - if !firmware.recovery.pending() { - lingers = firmware.expire_render_lingers(now)?; + .store(now, core::sync::atomic::Ordering::Relaxed); + if !reports_drained { + // The completions above are signalled; reports are throttled to the + // housekeeping cadence while work stays in flight. + firmware.drain_reports(); + } + if !firmware.recovery.pending() { + lingers = firmware.expire_render_lingers(now)?; + } + drains = firmware.reclaim_drained_renders(batch)?; + firmware.service_compute_exit(batch)?; + kills = firmware.kill_retry_delay(); + pools = firmware.service_compute_pools(batch, now)?; + if !firmware.recovery.pending() { + firmware + .queues + .vacate_evicted_render_pools(&firmware.init, batch)?; + shrinking = firmware + .queues + .shrink_render_heaps(&firmware.init, now, batch); + } + let mut reclaim = self.reclaim.lock(); + firmware.service_teardown(&mut reclaim)?; + if !reclaim.is_empty() { + self.queue_reclaims(); + } } - drains = firmware.reclaim_drained_renders(deferred)?; - firmware.service_compute_exit(deferred)?; - kills = firmware.kill_retry_delay(); - pools = firmware.service_compute_pools(deferred, now)?; - if !firmware.recovery.pending() { - firmware - .queues - .vacate_evicted_render_pools(&firmware.init, deferred)?; - shrinking = firmware - .queues - .shrink_render_heaps(&firmware.init, now, deferred); + // The firmware may consume M5 work-ring slots without a completion interrupt: while + // a preparation waits for unclaimed room, every pass polls the consumers. + let outer = firmware.init.poll_outer_progress()?; + let polling = firmware.runtime_polling(now); + if polling { + self.queue_poll(); } - let mut reclaim = self.reclaim.lock(); - firmware.service_teardown(&mut reclaim)?; - if !reclaim.is_empty() { - self.queue_reclaims(); + // A heap with growth to give back is re-evaluated at least once per + // shrink period, also while the device is otherwise idle. + let idle = if shrinking { + Some(idle.map_or(SHRINK_WAKE_NS, |delay| delay.min(SHRINK_WAKE_NS))) + } else { + idle + }; + // A retained compute pool gives its backing back when it expires, and + // so does an idle render free-list registration. A drained render pair + // whose settlement failed is retried when its backoff ends, and a closed + // context's kill that waited for other work is looked at again. + let idle = [pools, lingers, drains, kills] + .into_iter() + .fold(idle, |idle, expiry| match (idle, expiry) { + (Some(delay), Some(expiry)) => Some(delay.min(expiry)), + (delay, expiry) => delay.or(expiry), + }); + if let Some(delay) = idle { + self.queue_idle(delay); + } + if firmware.recovery.pending() { + self.preparations.close(); + self.queue_events(); + } else if !recover + && !polling + && (channel::Events::pending(&firmware.init, Role::Primary)? + || (firmware.secondary.is_some() + && channel::Events::pending(&firmware.init, Role::Secondary)?)) + { + // A full bounded pass must not depend on a fresh notification for + // records that arrived while it was consuming the same ring. + self.queue_event_records(); + } + let grow_ready = firmware.render_grow_ready(); + if batch.pending() == 0 { + firmware.queues.worker_deferred = deferred.take(); + } + drop(state); + if grow_ready { + self.queue_grow(); + } + // Outside the device mutex: the notification can run DMA-fence callbacks. + if let Some(domain) = outer { + domain.notify(); + } + // Firmware ring room, consumed releases and teardown steps have no + // event of their own: recheck render publishers' conditions every pass. + if self.renders.has_waiters() { + self.renders.notify(); + } + Ok(()) + })(); + if let Some(mut batch) = deferred.take() { + batch.finish(); + if let Some(firmware) = (*self.state.lock()).as_deref_mut() { + firmware.queues.worker_deferred = Some(batch); } } - // The firmware may consume M5 work-ring slots without a completion interrupt: while - // a preparation waits for unclaimed room, every pass polls the consumers. - let outer = firmware.init.poll_outer_progress()?; - let polling = firmware.runtime_polling(now); - if polling { - self.queue_poll(); - } - // A heap with growth to give back is re-evaluated at least once per - // shrink period, also while the device is otherwise idle. - let idle = if shrinking { - Some(idle.map_or(SHRINK_WAKE_NS, |delay| delay.min(SHRINK_WAKE_NS))) - } else { - idle - }; - // A retained compute pool gives its backing back when it expires, and - // so does an idle render free-list registration. A drained render pair - // whose settlement failed is retried when its backoff ends, and a closed - // context's kill that waited for other work is looked at again. - let idle = [pools, lingers, drains, kills] - .into_iter() - .fold(idle, |idle, expiry| match (idle, expiry) { - (Some(delay), Some(expiry)) => Some(delay.min(expiry)), - (delay, expiry) => delay.or(expiry), - }); - if let Some(delay) = idle { - self.queue_idle(delay); - } - if firmware.recovery.pending() { - self.preparations.close(); - self.queue_events(); - } else if !recover - && !polling - && (channel::Events::pending(&firmware.init, Role::Primary)? - || (firmware.secondary.is_some() - && channel::Events::pending(&firmware.init, Role::Secondary)?)) - { - // A full bounded pass must not depend on a fresh notification for - // records that arrived while it was consuming the same ring. - self.queue_event_records(); - } - let grow_ready = firmware.render_grow_ready(); - drop(state); - if grow_ready { - self.queue_grow(); - } - // Outside the device mutex: the notification can run DMA-fence callbacks. - if let Some(domain) = outer { - domain.notify(); - } - // Firmware ring room, consumed releases and teardown steps have no - // event of their own: recheck render publishers' conditions every pass. - if self.renders.has_waiters() { - self.renders.notify(); - } - Ok(()) + result } } diff --git a/drivers/gpu/drm/asahi/g17/runtime/render/submit.rs b/drivers/gpu/drm/asahi/g17/runtime/render/submit.rs index dda6ebf5b9eb7..0954496803d9a 100644 --- a/drivers/gpu/drm/asahi/g17/runtime/render/submit.rs +++ b/drivers/gpu/drm/asahi/g17/runtime/render/submit.rs @@ -761,6 +761,7 @@ impl crate::g17::Firmware { // time and attachment overlaps are ordered by publication order. let port = self.port.clone(); let _render = port.render_lock(); + let _m5_outer = self.init.is_m5().then(|| port.m5_outer_lock()); // Both outer destinations must have room before pool accounting or // either inner queue becomes visible. On M5 both are the shared compute ring: one // check covers the pair, and the pair is written against its cursors (this hold diff --git a/tools/asahi/g17-m5-direct-compute-tests.py b/tools/asahi/g17-m5-direct-compute-tests.py new file mode 100755 index 0000000000000..1d5cff16b78c6 --- /dev/null +++ b/tools/asahi/g17-m5-direct-compute-tests.py @@ -0,0 +1,259 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only OR MIT +"""Host test for M5 direct compute outer-ring credits and post-signal report ordering. + +Compiles the real `Credits`, `OuterClaim`, `OuterScope`, and `free` implementation +from `drivers/gpu/drm/asahi/g17/initdata/outer_credit.rs` on the host and tests: +1. Mixed render (2-slot) and compute (1-slot) reservations/consumptions across + `WORK_RING_SLOTS` ring wrap and exact capacity boundaries. +2. Queued claims held across a generation change and `OuterScope` (locked render / + recovery), verifying waiters wake on drop and direct consumption never debits + `OuterScope`'s `published[]` counter. +3. Multi-threaded contention between concurrent direct compute reservations/consumptions + and periodic locked `OuterScope` transitions. +4. Structural verification of `runtime_event_turn()` in `runtime/events.rs`: + completions signal (`batch.finish()`) before report drains, recovery drains + reports before `service_runtime_recovery()` regardless of `HOUSEKEEPING_NS`, + and steady-state passes throttle report drains without double-draining on recovery. +""" +import argparse +import os +import re +import subprocess +import sys +import tempfile +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +G17 = ROOT / 'drivers/gpu/drm/asahi/g17' + + +def item(source, signature): + assert source.count(signature) == 1, signature + start = source.index(signature) + begin = source.index('{', start) + depth, end = 1, begin + 1 + while depth: + depth += (source[end] == '{') - (source[end] == '}') + end += 1 + return source[start:end] + + +def ordered_ok(source, *parts): + at = -1 + for part in parts: + if source.count(part) != 1: + return False + idx = source.index(part) + if idx <= at: + return False + at = idx + return True + + +def build_harness(mutation=None): + outer_src = (G17 / 'initdata/outer_credit.rs').read_text() + events_src = (G17 / 'runtime/events.rs').read_text() + + turn = item(events_src, 'fn runtime_event_turn(') + if mutation == 'no-pre-recovery-drain': + turn = turn.replace( + 'firmware.drain_reports();\n reports_drained = true;\n' + ' firmware.service_runtime_recovery(batch)?;', + 'firmware.service_runtime_recovery(batch)?;', + 1, + ) + + # Verify report-drain ordering contract in production runtime_event_turn(). + ordering_ok = ordered_ok( + turn, + 'if let Some(batch) = deferred.as_mut() {\n batch.finish();\n }', + 'let mut reports_drained = false;', + 'firmware.drain_reports();\n reports_drained = true;', + 'firmware.service_runtime_recovery(batch)?;', + 'if housekeeping {', + 'if !reports_drained {', + ) + + # Strip kernel imports, inner doc comments, and kunit module from outer_credit.rs for host compilation. + kunit_idx = outer_src.index('#[kernel::macros::kunit_tests(') + prod = outer_src[:kunit_idx] + prod = re.sub(r'^//!.*$', '', prod, flags=re.M) + prod = re.sub(r'^use crate::g17::.*$', '', prod, flags=re.M) + prod = re.sub(r'^use core::sync::atomic::.*$', '', prod, flags=re.M) + prod = re.sub(r'^use kernel::.*$', '', prod, flags=re.M) + prod = prod.replace('Arc::new(', 'HostArc::new(') + prod = prod.replace(', GFP_KERNEL)?', ')?') + prod = prod.replace('pub(crate)', 'pub') + prod = prod.replace('pub(super)', 'pub') + + if mutation == 'direct-debits-published': + prod = prod.replace( + 'self.reserved[claim.priority].fetch_sub(1, Ordering::AcqRel);', + 'self.reserved[claim.priority].fetch_sub(1, Ordering::AcqRel);\n' + ' self.published[claim.priority].fetch_add(1, Ordering::AcqRel);', + 1, + ) + elif mutation == 'scope-allows-reserve': + prod = prod.replace( + 'if self.scoped.load(Ordering::Acquire) { return Err(EBUSY); }', + '', + 1, + ) + + return f''' +use std::sync::{{Arc, atomic::{{AtomicBool, AtomicU32, AtomicU64, AtomicUsize, Ordering}}}}; + +const EINVAL: i32 = -22; +const EBUSY: i32 = -16; +const EIO: i32 = -5; +const WORK_RING_SLOTS: u32 = 128; +type Result = std::result::Result; + +struct HostArc; +impl HostArc {{ + fn new(v: T) -> Result> {{ Ok(Arc::new(v)) }} +}} + +pub struct Availability {{ + waiters: AtomicUsize, + notifications: AtomicUsize, +}} +impl Availability {{ + pub fn new() -> Result> {{ + Ok(Arc::new(Self {{ + waiters: AtomicUsize::new(0), + notifications: AtomicUsize::new(0), + }})) + }} + pub fn has_waiters(&self) -> bool {{ self.waiters.load(Ordering::Acquire) != 0 }} + pub fn notify(&self) {{ self.notifications.fetch_add(1, Ordering::AcqRel); }} + pub fn notifications(&self) -> usize {{ self.notifications.load(Ordering::Acquire) }} +}} + +{prod} + +fn test_mixed_wrap_and_generation_change() {{ + let credits = Credits::new().unwrap(); + let n = WORK_RING_SLOTS; + let mut ca = n - 6; + let mut cb = n - 6; + let mut prod_idx = n - 2; + + let mut render_claim = credits.reserve(2, 2, [ca, cb, prod_idx]).unwrap(); + let mut comp_a = credits.reserve(2, 1, [ca, cb, prod_idx]).unwrap(); + credits.consume_direct(&mut comp_a).unwrap(); + prod_idx = (prod_idx + 1) % n; + + let mut comp_b = credits.reserve(2, 1, [ca, cb, prod_idx]).unwrap(); + credits.consume_direct(&mut comp_b).unwrap(); + prod_idx = (prod_idx + 1) % n; + assert_eq!(prod_idx, 0); + + let rem = credits.capacity(2, [ca, cb, prod_idx]).unwrap(); + let filler = credits.reserve(2, rem - 1, [ca, cb, prod_idx]).unwrap(); + assert_eq!(credits.capacity(2, [ca, cb, prod_idx]).unwrap(), 1); + assert_eq!(credits.reserve(2, 2, [ca, cb, prod_idx]).err(), Some(EBUSY)); + let mut edge = credits.reserve(2, 1, [ca, cb, prod_idx]).unwrap(); + credits.consume_direct(&mut edge).unwrap(); + prod_idx = (prod_idx + 1) % n; + assert_eq!(credits.capacity(2, [ca, cb, prod_idx]).unwrap(), 0); + drop(filler); + + ca = 1; + cb = 1; + let wrapped = [ca, cb, prod_idx]; + assert!(credits.progressed(2, wrapped).unwrap()); + + // Hold a queued compute claim across OuterScope + generation change. + let queued_comp = credits.reserve(2, 1, wrapped).unwrap(); + let mut pre_direct = credits.reserve(2, 1, wrapped).unwrap(); + let notes_before = credits.available().notifications(); + {{ + let _scope = credits.scope(&mut render_claim).unwrap(); + assert!(credits.is_scoped()); + assert_eq!(credits.reserve(2, 1, wrapped).err(), Some(EBUSY)); + // A direct compute claim already reserved before OuterScope must not debit OuterScope. + credits.consume_direct(&mut pre_direct).unwrap(); + }} + assert!(!credits.is_scoped()); + assert_eq!(render_claim.remaining(), 2, "direct compute must not debit OuterScope"); + assert_eq!(credits.counter(2).unwrap().load(Ordering::Acquire), 0); + + // Generation changed: dropping the queued compute claim restores its credit and wakes waiters. + drop(queued_comp); + assert!(credits.available().notifications() > notes_before); + drop(render_claim); + assert_eq!(credits.capacity(2, wrapped).unwrap(), n - 1); +}} + +fn test_concurrent_direct_and_scoped() {{ + let credits = Credits::new().unwrap(); + let stop = Arc::new(AtomicBool::new(false)); + let mut threads = Vec::new(); + for _ in 0..4 {{ + let c = credits.clone(); + let s = stop.clone(); + threads.push(std::thread::spawn(move || {{ + let mut iters = 0u32; + while !s.load(Ordering::Acquire) && iters < 2000 {{ + if let Ok(mut claim) = c.reserve(1, 1, [0, 0, 0]) {{ + if iters % 5 == 0 {{ + drop(claim); + }} else {{ + c.consume_direct(&mut claim).unwrap(); + }} + }} + iters += 1; + }} + }})); + }} + for _ in 0..200 {{ + if let Ok(mut render_claim) = credits.reserve(1, 2, [0, 0, 0]) {{ + let mut scoped = false; + if let Ok(scope) = credits.scope(&mut render_claim) {{ + assert_eq!(credits.reserve(1, 1, [0, 0, 0]).err(), Some(EBUSY)); + credits.counter(1).unwrap().fetch_add(2, Ordering::AcqRel); + drop(scope); + scoped = true; + }} + if scoped {{ + assert_eq!(render_claim.remaining(), 0); + }} + }} + }} + stop.store(true, Ordering::Release); + for t in threads {{ + t.join().unwrap(); + }} + assert_eq!(credits.capacity(1, [0, 0, 0]).unwrap(), WORK_RING_SLOTS - 1); +}} + +fn main() {{ + assert!({str(ordering_ok).lower()}, "runtime_event_turn must drain reports post-signal and pre-recovery"); + test_mixed_wrap_and_generation_change(); + test_concurrent_direct_and_scoped(); + println!("PASS g17-m5-direct-compute-tests"); +}} +''' + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--mutation', choices=['no-pre-recovery-drain', + 'direct-debits-published', + 'scope-allows-reserve']) + args = parser.parse_args() + src = build_harness(args.mutation) + rustc = os.environ.get('HOSTRUSTC', 'rustc') + with tempfile.TemporaryDirectory(prefix='g17-m5-dc-') as td: + rs = Path(td) / 'test.rs' + exe = Path(td) / 'test' + rs.write_text(src) + subprocess.run([rustc, '-O', '-o', str(exe), str(rs)], check=True) + res = subprocess.run([str(exe)]) + sys.exit(res.returncode) + + +if __name__ == '__main__': + main() diff --git a/tools/asahi/run-host-tests.py b/tools/asahi/run-host-tests.py index 0d3fb7209e45c..1ef7df8f37943 100755 --- a/tools/asahi/run-host-tests.py +++ b/tools/asahi/run-host-tests.py @@ -273,6 +273,9 @@ def mutations(flag, names, base, expect=KILL): 'g17-kill-route-tests.py': [([], PASS)] + mutations('--mutation', ('no-executed-route', 'no-executed-input', 'kill-twice', 'executed-on-m5', 'unsafe-wait', 'owed-blocks-kill', 'open-owed-skipped'), []), + 'g17-m5-direct-compute-tests.py': [([], PASS)] + + mutations('--mutation', ('no-pre-recovery-drain', 'direct-debits-published', + 'scope-allows-reserve'), []), 'g17-m5-effort-tests.py': [([], PASS)] + mutations('--mutation', ('m5-ignores-bound',), []), 'g17-firmware-selection-tests.py': [([], PASS)],