mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anthony Krowiak <akrowiak@linux.ibm.com>
To: Rorie Reyes <rreyes@linux.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org
Cc: hca@linux.ibm.com, borntraeger@de.ibm.com,
	agordeev@linux.ibm.com, gor@linux.ibm.com, pasic@linux.ibm.com,
	jjherne@linux.ibm.com, alex.williamson@redhat.com
Subject: Re: [RFC PATCH v1] fixup! s390/vfio-ap: Notify userspace that guest's AP config changed when mdev removed
Date: Tue, 4 Mar 2025 09:27:05 -0500	[thread overview]
Message-ID: <d5308330-23f3-4f55-836c-0c6e884587b0@linux.ibm.com> (raw)
In-Reply-To: <d8b34b34-1776-4bd9-bbde-8fe508166dfd@linux.ibm.com>




On 3/4/25 9:18 AM, Rorie Reyes wrote:
>
>
> On 3/4/25 8:36 AM, Anthony Krowiak wrote:
>>>     static void vfio_ap_mdev_update_guest_apcb(struct ap_matrix_mdev 
>>> *matrix_mdev)
>>> @@ -1870,7 +1870,6 @@ static void vfio_ap_mdev_unset_kvm(struct 
>>> ap_matrix_mdev *matrix_mdev)
>>>           get_update_locks_for_kvm(kvm);
>>>             kvm_arch_crypto_clear_masks(kvm);
>>> -        signal_guest_ap_cfg_changed(matrix_mdev);
>>>           vfio_ap_mdev_reset_queues(matrix_mdev);
>>>           kvm_put_kvm(kvm);
>>>           matrix_mdev->kvm = NULL;
>>> @@ -2057,6 +2056,14 @@ static void vfio_ap_mdev_request(struct 
>>> vfio_device *vdev, unsigned int count)
>>>         matrix_mdev = container_of(vdev, struct ap_matrix_mdev, vdev);
>>>   +    if (matrix_mdev->kvm) {
>>> +        get_update_locks_for_kvm(matrix_mdev->kvm);
>>
>> I know we talked about this prior to submission of this patch, but 
>> looking at this again I think
>> you should use the get_update_locks_for_mdev() function for two reasons:
>>
>> 1. It is safer because it will take the matrix_dev->guests_lock which 
>> will prevent the matrix_mdev->kvm
>>     field from changing before you check it
>>
> So I'll replace *get_update_locks_for_kvm(matrix_mdev->kvm)* with 
> *get_update_locks_for_mdev(&matrix_dev->guests_lock)*

See code below:get_update_locks_for_mdev(matrix_mdev)
That function will take the guests_lock

>> 2. I will eliminate the need for the else
>>
>> get_update_locks_for_mdev(matrix_mdev)
>> if (matrix_mdev->kvm) {
>>     clear the masks
>>     signal guest config changed
>> }
>> ...
>> release_update_locks_for_mdev(matrix_mdev); Sorry about not seeing 
>> this before you posted this patch.
>>> + kvm_arch_crypto_clear_masks(matrix_mdev->kvm);
>>> +        signal_guest_ap_cfg_changed(matrix_mdev);
>>> +    } else {
>>> +        mutex_lock(&matrix_dev->mdevs_lock);
>>> +    }
> So remove the else statement that contains the mutex function


  parent reply	other threads:[~2025-03-04 14:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 19:11 Rorie Reyes
2025-03-04 13:36 ` Anthony Krowiak
     [not found]   ` <d8b34b34-1776-4bd9-bbde-8fe508166dfd@linux.ibm.com>
2025-03-04 14:27     ` Anthony Krowiak [this message]
2025-03-04 14:29       ` Rorie Reyes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5308330-23f3-4f55-836c-0c6e884587b0@linux.ibm.com \
    --to=akrowiak@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pasic@linux.ibm.com \
    --cc=rreyes@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®