RE: [PATCH v3 2/2] iommu: Make iopf_group_response() free groups

From: Tian, Kevin

Date: Mon Jul 20 2026 - 05:53:55 EST


> From: Peiyang He <peiyang_he@xxxxxxxxxxxxxxxx>
> Sent: Monday, July 20, 2026 4:50 PM
>
> Every normal iopf_group_response() caller frees the group immediately
> after sending the response. Make iopf_group_response() do both operations,
> so callers no longer have to free the group separately.
>
> Split the response operation into a helper that requires fault_param->lock,
> a helper that acquires the lock without freeing, and the exported helper
> that sends the response and frees the group.
>
> iommu_report_device_fault() retains its special stack-allocated abort_group
> handling. It uses the non-freeing helper, then keeps the existing choice
> between __iopf_free_group() and iopf_free_group().
> iopf_queue_remove_device() already holds the fault-parameter lock, so it
> uses the locked helper before freeing each pending group.
>
> Suggested-by: Kevin Tian <kevin.tian@xxxxxxxxx>
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Peiyang He <peiyang_he@xxxxxxxxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>