Page MenuHomeFreeBSD

mpi3mr: Fix race condition in config read completion causing missed wakeups
AcceptedPublic

Authored by chandrakanth.patil_broadcom.com on Aug 22 2025, 8:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 3, 10:39 PM
Unknown Object (File)
May 23 2026, 8:12 AM
Unknown Object (File)
May 21 2026, 7:17 PM
Unknown Object (File)
May 18 2026, 4:56 AM
Unknown Object (File)
May 15 2026, 7:20 AM
Unknown Object (File)
May 10 2026, 5:33 AM
Unknown Object (File)
May 10 2026, 5:24 AM
Unknown Object (File)
Apr 28 2026, 9:03 AM
Subscribers
None

Details

Summary

A race condition exists between the config read submission thread and the
interrupt handler responsible for request completion. The issue occurs
when:

  1. A config read thread sets is_waiting = 1, submits the command, and waits for completion.
  2. Firmware responds, and the interrupt handler processes the command and calls complete().
  3. The waiting thread wakes up before the interrupt handler resets is_waiting = 0, and reuses the command slot for a new config read.
  4. The interrupt handler (still completing the previous command) clears the newly set is_waiting flag, mistaking it for the earlier command.
  5. When the firmware response for the new command arrives, the driver sees is_waiting = 0 and does not wake up the second thread.

This results in false timeouts, delayed config reads, and late drive
exposure during back-to-back config read operations.

Fix this by setting is_waiting = 0 before invoking complete(), ensuring
that no valid waiting thread is skipped.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This revision is now accepted and ready to land.Aug 25 2025, 6:54 PM