lkml.org 
[lkml]   [2020]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v8 02/16] s390/vfio-ap: use new AP bus interface to search for queue devices
From
Date


On 6/16/20 11:45 AM, Christian Borntraeger wrote:
>
> On 05.06.20 23:39, Tony Krowiak wrote:
>> This patch refactor's the vfio_ap device driver to use the AP bus's
>> ap_get_qdev() function to retrieve the vfio_ap_queue struct containing
>> information about a queue that is bound to the vfio_ap device driver.
>> The bus's ap_get_qdev() function retrieves the queue device from a
>> hashtable keyed by APQN. This is much more efficient than looping over
>> the list of devices attached to the AP bus by several orders of
>> magnitude.
>>
>> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
>> ---
>> drivers/s390/crypto/vfio_ap_drv.c | 27 ++-------
>> drivers/s390/crypto/vfio_ap_ops.c | 82 +++++++++++++++------------
>> drivers/s390/crypto/vfio_ap_private.h | 8 ++-
>> 3 files changed, 58 insertions(+), 59 deletions(-)
>>
>> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
>> index be2520cc010b..59233cf7419d 100644
>> --- a/drivers/s390/crypto/vfio_ap_drv.c
>> +++ b/drivers/s390/crypto/vfio_ap_drv.c
>> @@ -51,15 +51,9 @@ MODULE_DEVICE_TABLE(vfio_ap, ap_queue_ids);
>> */
>> static int vfio_ap_queue_dev_probe(struct ap_device *apdev)
>> {
>> - struct vfio_ap_queue *q;
>> -
>> - q = kzalloc(sizeof(*q), GFP_KERNEL);
>> - if (!q)
>> - return -ENOMEM;
>> - dev_set_drvdata(&apdev->device, q);
>> - q->apqn = to_ap_queue(&apdev->device)->qid;
>> - q->saved_isc = VFIO_AP_ISC_INVALID;
>> - return 0;
>> + struct ap_queue *queue = to_ap_queue(&apdev->device);
>> +
>> + return vfio_ap_mdev_probe_queue(queue);
>> }
> Here we did not hold a mutex in the old code
> [...]
>
>> +int vfio_ap_mdev_probe_queue(struct ap_queue *queue)
>> +{
>> + struct vfio_ap_queue *q;
>> +
>> + q = kzalloc(sizeof(*q), GFP_KERNEL);
>> + if (!q)
>> + return -ENOMEM;
>> +
>> + mutex_lock(&matrix_dev->lock);
>> + dev_set_drvdata(&queue->ap_dev.device, q);
>> + q->apqn = queue->qid;
>> + q->saved_isc = VFIO_AP_ISC_INVALID;
>> + mutex_unlock(&matrix_dev->lock);
>> +
> here we do. Why do we need the matrix_dev->lock here?

You are correct, we don't need it here; but, we will need it
in a subsequent patch where we introduce linking the
q to the matrix mdev to which it is assigned. Perhaps
the locking should be introduced in that patch.

>

\
 
 \ /
  Last update: 2020-06-17 14:04    [W:0.076 / U:4.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site