Re: [PATCH v7 09/11] iommu/vt-d: Add bind guest PASID support

From: Lu Baolu
Date: Tue Oct 29 2019 - 01:07:22 EST


Hi,

On 10/29/19 12:11 PM, Jacob Pan wrote:
On Tue, 29 Oct 2019 10:54:48 +0800
Lu Baolu<baolu.lu@xxxxxxxxxxxxxxx> wrote:

Hi,

On 10/29/19 6:29 AM, Jacob Pan wrote:
Hi Baolu,

Appreciate the thorough review, comments inline.
You are welcome.

On Sat, 26 Oct 2019 10:01:19 +0800
Lu Baolu<baolu.lu@xxxxxxxxxxxxxxx> wrote:
Hi,
[...]

+ * allow multiple bind calls with the
same PASID and pdev.
+ */
+ sdev->users++;
+ goto out;
+ }
I remember I ever pointed this out before. But I forgot how we
addressed it. So forgive me if this has been addressed.

What if we have a valid bound svm but @dev doesn't belong to it
(a.k.a. @dev not in svm->devs list)?
If we are binding a new device to an existing/active PASID, the code
will allocate a new sdev and add that to the svm->devs list.
But allocating a new sdev and adding device is in below else branch,
so it will never reach there, right?

No, allocating sdev is outside else branch.

Oh, yes! Please ignore it.

Best regards,
baolu