From: "Jason J. Herne" <jjherne@linux.ibm.com>
To: Tony Krowiak <akrowiak@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: borntraeger@de.ibm.com, cohuck@redhat.com,
pasic@linux.vnet.ibm.com, jgg@nvidia.com,
alex.williamson@redhat.com, kwankhede@nvidia.com,
frankja@linux.ibm.com, david@redhat.com, imbrenda@linux.ibm.com,
hca@linux.ibm.com
Subject: Re: [PATCH v4 2/2] s390/vfio-ap: control access to PQAP(AQIC) interception handler
Date: Mon, 24 May 2021 10:37:29 -0400 [thread overview]
Message-ID: <5d15fdf2-aee8-4e6c-c3e1-f07c76ce5974@linux.ibm.com> (raw)
In-Reply-To: <20210521193648.940864-3-akrowiak@linux.ibm.com>
On 5/21/21 3:36 PM, Tony Krowiak wrote:
> The function pointer to the handler that processes interception of the
> PQAP instruction is contained in the mdev. If the mdev is removed and
> its storage de-allocated during the processing of the PQAP instruction,
> the function pointer could get wiped out before the function is called
> because there is currently nothing that controls access to it.
>
> This patch introduces two new functions:
> * The kvm_arch_crypto_register_hook() function registers a function pointer
> for processing intercepted crypto instructions.
> * The kvm_arch_crypto_register_hook() function un-registers a function
> pointer that was previously registered.
Typo: You meant kvm_arch_crypto_UNregister_hook() in the second bullet.
Just one overall observation on this one. The whole hook system seems kind of
over-engineered if this is our only use for it. It looks like a kvm_s390_crypto_hook is
meant to link a specific module with a function pointer. Do we really need this concept?
I think a simpler design could be to just place a mutex and a function pointer in the
kvm_s390_crypto struct. Then you can grab the mutex in vfio_ap_ops.c when
registering/unregistering. You would also grab the mutex in priv.c when calling the
function pointer. What I am suggesting is essentially the exact same scheme you have
implemented here, but simpler and with less infrastructure.
With that said, I'll point out that I am relative new to this code (and this patch series)
so maybe I've missed something and the extra complexity is needed for some reason. But if
it is not, I'm all in favor of keeping things simple.
--
-- Jason J. Herne (jjherne@linux.ibm.com)
next prev parent reply other threads:[~2021-05-24 14:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 19:36 [PATCH v4 0/2] s390/vfio-ap: fix memory leak in mdev remove callback Tony Krowiak
2021-05-21 19:36 ` [PATCH v4 1/2] " Tony Krowiak
2021-05-25 13:03 ` Halil Pasic
2021-05-25 13:22 ` Tony Krowiak
2021-05-26 12:37 ` Tony Krowiak
2021-05-21 19:36 ` [PATCH v4 2/2] s390/vfio-ap: control access to PQAP(AQIC) interception handler Tony Krowiak
2021-05-23 22:57 ` Jason Gunthorpe
2021-05-25 14:59 ` Tony Krowiak
2021-05-25 15:00 ` Jason Gunthorpe
2021-05-24 14:37 ` Jason J. Herne [this message]
2021-05-25 13:16 ` Tony Krowiak
2021-05-25 13:19 ` Jason Gunthorpe
2021-05-25 15:08 ` Tony Krowiak
2021-05-25 15:11 ` Jason Gunthorpe
2021-05-25 15:56 ` Tony Krowiak
2021-05-25 16:29 ` Jason Gunthorpe
2021-05-27 2:28 ` Tony Krowiak
2021-05-27 11:24 ` Jason Gunthorpe
2021-05-25 13:24 ` Jason J. Herne
2021-05-25 13:26 ` Jason Gunthorpe
2021-05-25 14:07 ` Jason J. Herne
2021-05-25 14:16 ` Jason Gunthorpe
2021-06-14 7:51 ` [PATCH v4 0/2] s390/vfio-ap: fix memory leak in mdev remove callback Christian Borntraeger
2021-06-16 14:24 ` Tony Krowiak
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=5d15fdf2-aee8-4e6c-c3e1-f07c76ce5974@linux.ibm.com \
--to=jjherne@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=frankja@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=jgg@nvidia.com \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pasic@linux.vnet.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