Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v3 0/5] soundwire: Fix bandwidth leak in multi-link aggregation failure
@ 2026-11-12 14:19 Bard Liao
  2026-11-12 14:19 ` [PATCH v3 1/5] soundwire: move lane bandwidth into bus params Bard Liao
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Bard Liao @ 2026-11-12 14:19 UTC (permalink / raw)
  To: linux-sound, vkoul
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, peter.ujfalusi,
	bard.liao

The existing code only copies the params from the first link to the
bus params, but it doesn't copy the bandwidth from the other links.
This can lead to a bandwidth leak when multi-link aggregation fails.
Fix this by saving a snapshot of each bus's parameters before making
any modifications.

Changes in v3:
- Add Fixes and Cc stable tags to "Select the correct runtime for lane
  allocation".
- Fix bandwidth leak in multi-link aggregation failure:
  - Reset the lanes of the stream in the rollback path so they match
    the restored lane_used_bandwidth. This is skipped when the
    parameters were not updated.
  - Keep curr_bank and next_bank when restoring the snapshot, as the
    register bank may already have been switched when the failure
    happens.
  - Update the commit message accordingly.

Changes in v2:
- Fix lane and rate group handling in the generic bandwidth allocation
  that the rollback depends on:
  - Pass the prepare/deprepare context to compute_params().
  - Select the runtime of the stream being prepared for lane allocation
    instead of the first runtime on the bus, which could be an already
    running stream.
  - Include the current stream in the group and port computation when
    it is prepared again from the DEPREPARED state.
- Reset the lane of the stream being prepared to 0 when no multi-lane
  is selected, so the lane assignment matches the restored
  lane_used_bandwidth.

Bard Liao (4):
  soundwire: move lane bandwidth into bus params
  soundwire: Pass prepare context to parameter computation
  soundwire: Select the correct runtime for lane allocation
  soundwire: Include the current stream when preparing again

David Lin (1):
  soundwire: stream: Fix bandwidth leak in multi-link aggregation
    failure

 drivers/soundwire/amd_manager.c               |  3 +-
 drivers/soundwire/bus.h                       |  3 +
 .../soundwire/generic_bandwidth_allocation.c  | 81 ++++++++++++++-----
 drivers/soundwire/qcom.c                      |  3 +-
 drivers/soundwire/stream.c                    | 48 +++++++++--
 include/linux/soundwire/sdw.h                 | 13 +--
 6 files changed, 115 insertions(+), 36 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-12 14:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 14:19 [PATCH v3 0/5] soundwire: Fix bandwidth leak in multi-link aggregation failure Bard Liao
2026-11-12 14:19 ` [PATCH v3 1/5] soundwire: move lane bandwidth into bus params Bard Liao
2026-11-12 14:19 ` [PATCH v3 2/5] soundwire: Pass prepare context to parameter computation Bard Liao
2026-11-12 14:19 ` [PATCH v3 3/5] soundwire: Select the correct runtime for lane allocation Bard Liao
2026-11-12 14:19 ` [PATCH v3 4/5] soundwire: Include the current stream when preparing again Bard Liao
2026-11-12 14:42   ` sashiko-bot
2026-11-12 14:19 ` [PATCH v3 5/5] soundwire: stream: Fix bandwidth leak in multi-link aggregation failure Bard Liao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox