lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <11a2a48f-aad9-42b0-a9a1-29ea1c0f7f45@linux.intel.com>
Date: Mon, 19 Feb 2024 14:47:09 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Ethan Zhao <haifeng.zhao@...ux.intel.com>, Joerg Roedel
 <joro@...tes.org>, Will Deacon <will@...nel.org>,
 Robin Murphy <robin.murphy@....com>, Jason Gunthorpe <jgg@...pe.ca>,
 Kevin Tian <kevin.tian@...el.com>
Cc: baolu.lu@...ux.intel.com, Huang Jiaqing <jiaqing.huang@...el.com>,
 iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] iommu/vt-d: Use rbtree to track iommu probed devices

On 2024/2/19 13:33, Ethan Zhao wrote:
> On 2/19/2024 12:04 PM, Baolu Lu wrote:
>> On 2024/2/19 10:45, Ethan Zhao wrote:
>>>> @@ -4264,25 +4313,34 @@ static struct iommu_device 
>>>> *intel_iommu_probe_device(struct device *dev)
>>>>       }
>>>>       dev_iommu_priv_set(dev, info);
>>>> +    ret = device_rbtree_insert(iommu, info);
>>>> +    if (ret)
>>>> +        goto free;
>>>>       if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {
>>>>           ret = intel_pasid_alloc_table(dev);
>>>>           if (ret) {
>>>>               dev_err(dev, "PASID table allocation failed\n");
>>>> -            kfree(info);
>>>> -            return ERR_PTR(ret);
>>>> +            goto clear_rbtree;
>>>>           }
>>>>       }
>>>>       intel_iommu_debugfs_create_dev(info);
>>>>       return &iommu->iommu;
>>>> +clear_rbtree:
>>>> +    device_rbtree_remove(info);
>>>> +free:
>>>> +    kfree(info);
>>>> +
>>>> +    return ERR_PTR(ret);
>>>>   }
>>>>   static void intel_iommu_release_device(struct device *dev)
>>>>   {
>>>>       struct device_domain_info *info = dev_iommu_priv_get(dev);
>>>> +    device_rbtree_remove(info);
>>>
>>> Perhpas too early here to remove dev from the rbtree, if it is wanted in
>>> devTLB invalidation steps in intel_pasid_tear_down_entry().
>>
>> Perhaps the caller of device_rbtree_find() should not depend on the
> 
> I didn't catch up here. seems have to maintain the lifecycle as PCI 
> subsystem
> does, or there would be mutli instances for the same BDF(e.g. the device is
> removed then plugged, again and again.....in the same slot) in the rbtree ?

There should not be multiple instances for a same BDF. The lifecycle of
a device is managed by the device and driver core. The iommu subsystem
registers a notification to the core and take actions on device ADD and
REMOVE events.

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ