From: Halil Pasic <pasic@linux.ibm.com>
To: Tony Krowiak <akrowiak@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, borntraeger@de.ibm.com, cohuck@redhat.com,
alex.williamson@redhat.com, kwankhede@nvidia.com,
david@redhat.com
Subject: Re: [PATCH] s390/vfio-ap: Clean up vfio_ap resources when KVM pointer invalidated
Date: Mon, 14 Dec 2020 00:13:10 +0100 [thread overview]
Message-ID: <20201214001310.2cb6f1ff.pasic@linux.ibm.com> (raw)
In-Reply-To: <ff21dd8e-9ac7-8625-5c77-4705e1344477@linux.ibm.com>
On Fri, 11 Dec 2020 16:08:53 -0500
Tony Krowiak <akrowiak@linux.ibm.com> wrote:
> >>> +static void vfio_ap_mdev_put_kvm(struct ap_matrix_mdev *matrix_mdev)
> >>> +{
> >>> + if (matrix_mdev->kvm) {
> >>> + kvm_arch_crypto_clear_masks(matrix_mdev->kvm);
> >>> + matrix_mdev->kvm->arch.crypto.pqap_hook = NULL;
> >>> + vfio_ap_mdev_reset_queues(matrix_mdev->mdev);
> >> This reset probably does not belong here since there is no
> >> reason to reset the queues in the group notifier (see below).
> > What about kvm_s390_gisc_unregister()? That needs a valid kvm
> > pointer, or? Or is it OK to not pair a kvm_s390_gisc_register()
> > with an kvm_s390_gisc_unregister()?
>
> I probably should have been more specific about what I meant.
> I was thinking that the reset should not be dependent upon
> whether there is a KVM pointer or not since this function is
> also called from the release callback. On the other hand,
> the vfio_ap_mdev_reset_queues function calls the
> vfio_ap_irq_disable (AQIC) function after each queue is reset.
> The vfio_ap_irq_disable function also cleans up the AQIC
> resources which requires that the KVM point is valid, so if
> the vfio_ap_reset_queues function is not called with a
> valid KVM pointer, that could result in an exception.
>
> The thing is, it is unnecessary to disable interrupts after
> resetting a queue because the reset disables interrupts,
> so I think I should include a patch for this fix that does the
> following:
>
> 1. Removes the disabling of interrupts subsequent to resetting
> a queue.
> 2. Includes the cleanup of AQIC resources when a queue is
> reset if a KVM pointer is present.
Sounds like a plan. I see, in your v2 vfio_ap_mdev_unset_kvm()
does call vfio_ap_mdev_reset_queues() even when called from the
group notifier. I also like that the cleanup of AQIC resources is
a part of queue_reset. In fact I asked a while ago (Message-ID:
<20201027074846.30ee0ddc.pasic@linux.ibm.com> in October) to make
vfio_ap_mdev_reset_queue() call vfio_ap_free_aqic_resources(q).
Regards,
Halil
prev parent reply other threads:[~2020-12-13 23:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-02 23:41 [PATCH] s390/vfio-ap: Clean up vfio_ap resources when KVM pointer invalidated Tony Krowiak
2020-12-03 10:19 ` Cornelia Huck
2020-12-03 17:01 ` Halil Pasic
2020-12-03 19:14 ` Tony Krowiak
2020-12-03 17:55 ` Halil Pasic
2020-12-04 14:43 ` Tony Krowiak
2020-12-04 19:05 ` Halil Pasic
2020-12-04 19:46 ` Tony Krowiak
2020-12-04 21:54 ` Halil Pasic
2020-12-07 18:50 ` Tony Krowiak
2020-12-08 0:01 ` Halil Pasic
[not found] ` <e196b743-74d8-398b-4b3e-4a64002d9bfc@linux.ibm.com>
2020-12-13 22:57 ` Halil Pasic
2020-12-04 16:48 ` Tony Krowiak
2020-12-04 16:57 ` Cornelia Huck
2020-12-04 19:47 ` Tony Krowiak
2020-12-07 15:24 ` Halil Pasic
2020-12-07 15:42 ` Christian Borntraeger
2020-12-07 19:05 ` Tony Krowiak
2020-12-08 0:40 ` Halil Pasic
2020-12-11 21:08 ` Tony Krowiak
2020-12-13 23:13 ` Halil Pasic [this message]
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=20201214001310.2cb6f1ff.pasic@linux.ibm.com \
--to=pasic@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).