On 25/08/2023 10:02, Vikram Garhwal wrote:
>
>
> Dynamic programming ops will modify the dt_host and there might be other
> functions which are browsing the dt_host at the same time. To avoid the race
> conditions, adding rwlock for browsing the dt_host during runtime. dt_host
> writer will be added in the follow-up patch for device tree overlay
> functionalities."
Please drop "
>
> Reason behind adding rwlock instead of spinlock:
> For now, dynamic programming is the sole modifier of dt_host in Xen during
> run time. All other access functions like iommu_release_dt_device() are
Indentation is incorrect. All this text block should be aligned to "For now"
above.
> just reading the dt_host during run-time. So, there is a need to
> protect
> others from browsing the dt_host while dynamic programming is modifying
> it. rwlock is better suitable for this task as spinlock won't be able
> to
> differentiate between read and write access.
>
> Signed-off-by: Vikram Garhwal <vikram.garh...@amd.com>
Apart from that, the patch itself looks good:
Reviewed-by: Michal Orzel <michal.or...@amd.com>
although I would recommend to follow Julien suggestion and to at least
add an assert in iommu_assign_dt_device() and iommu_add_dt_device() to check if
the lock
is taken (given the system state is >= active to exclude calls from boot state).
~Michal