Re: [PATCH v5 02/29] iommufd: Introduce iommufd_object_alloc_ucmd helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 17, 2025 at 08:21:19PM -0700, Nicolin Chen wrote:
> An object allocator needs to call either iommufd_object_finalize() upon a
> success or iommufd_object_abort_and_destroy() upon an error code.
> 
> To reduce duplication, store a new_obj in the struct iommufd_ucmd and call
> iommufd_object_finalize/iommufd_object_abort_and_destroy() accordingly in
> the main function.
> 
> This will also ease a driver-allocated object so that a driver can simply
> return with an error code to trigger an iommufd_object_abort_and_destroy()
> instead of doing an abort itself.
> 
> Similar to iommufd_object_alloc() and __iommufd_object_alloc(), add a pair
> of helpers: __iommufd_object_alloc_ucmd() and iommufd_object_alloc_ucmd().
> 
> Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
> ---
>  drivers/iommu/iommufd/iommufd_private.h |  1 +
>  include/linux/iommufd.h                 | 23 +++++++++++++++++++++++
>  drivers/iommu/iommufd/driver.c          | 18 ++++++++++++++++++
>  drivers/iommu/iommufd/main.c            |  7 +++++++
>  4 files changed, 49 insertions(+)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux