On Fri, Aug 04, 2023 at 01:04:57PM +0000, Liu, Yi L wrote:
Having the driver copy in a loop might be better
Can you elaborate?
I think Jason means the way in patch 09.
Yeah, you can't reuse the stack buffer for an array, so patch 9 copies each element uniquely.
This is more calls to copy_to_user, which has some cost
But we avoid a memory allocation
Patch 9 should not abuse the user_data, cast it to the inv_info and just put req on the stack:
struct iommu_hwpt_vtd_s1_invalidate *inv_info = user_data; struct iommu_hwpt_vtd_s1_invalidate_desc req;
But I'm not sure about this entry_size logic, what happens if the entry_size is larger than the kernel supports? I think it should fail..
Jason