lkml.org 
[lkml]   [2022]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v18 12/18] s390/vfio-ap: reset queues after adapter/domain unassignment
From
snip ...

>
>>
>>
>>> + vfio_ap_unlink_mdev_fr_queue(q);
>>> +        hash_del(&q->mdev_qnode);
>>>       }
>>>   }
>> ...
>>> @@ -1273,9 +1320,9 @@ static void vfio_ap_mdev_unset_kvm(struct
>>> ap_matrix_mdev *matrix_mdev,
>>>           mutex_lock(&kvm->lock);
>>>           mutex_lock(&matrix_dev->mdevs_lock);
>>>   -        kvm_arch_crypto_clear_masks(kvm);
>>> -        vfio_ap_mdev_reset_queues(matrix_mdev);
>>> -        kvm_put_kvm(kvm);
>>> +        kvm_arch_crypto_clear_masks(matrix_mdev->kvm);
>>> + vfio_ap_mdev_reset_queues(&matrix_mdev->qtable);
>>> +        kvm_put_kvm(matrix_mdev->kvm);
>>>           matrix_mdev->kvm = NULL;
>>
>> I understand changing the call to vfio_ap_mdev_reset_queues, but why
>> are we changing the
>> kvm pointer on the surrounding lines?
>
> In reality, both pointers are one in the same given the two callers pass
> matrix_mdev->kvm into the function. I'm not sure why that is the case,
> it is probably a remnant from the commits that fixed the lockdep splat;
> however, there is no reason other than I've gotten used to retrieving the
> KVM pointer from the ap_matrix_mdev structure. In reality, there is no
> reason to pass a 'struct kvm *kvm' into this function, so I'm going to
> look into that and adjust accordingly.

The 'struct kvm *kvm' parameter was added to the signature of the
vfio_ap_mdev_unset_kvm function with the following commit:

86956e70761b (s390/vfio-ap: replace open coded locks for
VFIO_GROUP_NOTIFY_SET_KVM notification)

I also noticed the the kernel doc for the vfio_ap_mdev_set_kvm and
vfio_ap_mdev_unset_kvm functions still contained a comment that is no longer
valid by the following commit:

0cc00c8d4050 (s390/vfio-ap: fix circular lockdep when setting/clearing
crypto masks)

I pushed a patch to our devel branch that removes the invalid comment
from the two functions and removes the 'struct kvm *kvm' parameter
from the vfio_ap_mdev_unset_kvm function. That patch will prereq this
series.

>
>>
>>
>>> mutex_unlock(&matrix_dev->mdevs_lock);
>>> @@ -1328,14 +1375,17 @@ static int vfio_ap_mdev_reset_queue(struct
>>> vfio_ap_queue *q, unsigned int retry)
>>>         if (!q)
>>>           return 0;
>>> +    q->reset_rc = 0;

\
 
 \ /
  Last update: 2022-03-18 23:15    [W:1.504 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site