lkml.org 
[lkml]   [2023]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 9/9] iommu: Use fault cookie to store iopf_param
From
On 2023/7/11 14:26, Tian, Kevin wrote:
>> From: Lu Baolu <baolu.lu@linux.intel.com>
>> Sent: Tuesday, July 11, 2023 9:07 AM
>>
>> Remove the static iopf_param pointer from struct iommu_fault_param to
>> save memory.
>
> why is there memory saving? you replace a single pointer with a xarray now...

iopf_param is duplicate with the fault cookie. So replace it with the
fault cookie to remove duplication and save memory.

>
>> @@ -303,16 +303,27 @@ int iopf_queue_add_device(struct iopf_queue
>> *queue, struct device *dev)
>>
>> mutex_lock(&queue->lock);
>> mutex_lock(&param->lock);
>> - if (!param->iopf_param) {
>> - list_add(&iopf_param->queue_list, &queue->devices);
>> - param->iopf_param = iopf_param;
>> - ret = 0;
>> + curr = iommu_set_device_fault_cookie(dev, 0, iopf_param);
>> + if (IS_ERR(curr)) {
>> + ret = PTR_ERR(curr);
>> + goto err_free;
>> }
>
> So although the new xarray is called a per-pasid storage, here only
> slot#0 is used for sva which includes a list containing partial req's
> for many pasid's. It doesn't sound clean...

Just to make it generic so that IOMMUFD can also use it. IOMMUFD will
use it to store the per-{device, pasid} object id (and possibly other
data) so that it can be quickly retrieved in the critical fault
delivering patch.

Best regards,
baolu

\
 
 \ /
  Last update: 2023-07-12 05:11    [W:0.099 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site