From: Thomas Huth <thuth@redhat.com>
To: Heiko Carstens <hca@linux.ibm.com>,
Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
kvm@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-s390@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>,
Sven Schnelle <svens@linux.ibm.com>
Subject: Re: [PATCH v3 1/9] KVM: s390: Extend MEM_OP ioctl by storage key checked cmpxchg
Date: Fri, 18 Nov 2022 15:37:26 +0100 [thread overview]
Message-ID: <90f07edc-238f-b3d0-80d2-f4b4573f12ad@redhat.com> (raw)
In-Reply-To: <Y3dalbP5yb2gflA9@osiris>
On 18/11/2022 11.12, Heiko Carstens wrote:
> On Thu, Nov 17, 2022 at 11:17:50PM +0100, Janis Schoetterl-Glausch wrote:
>> User space can use the MEM_OP ioctl to make storage key checked reads
>> and writes to the guest, however, it has no way of performing atomic,
>> key checked, accesses to the guest.
>> Extend the MEM_OP ioctl in order to allow for this, by adding a cmpxchg
>> mode. For now, support this mode for absolute accesses only.
>>
>> This mode can be use, for example, to set the device-state-change
>> indicator and the adapter-local-summary indicator atomically.
>>
>> Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
>> ---
>> include/uapi/linux/kvm.h | 5 ++
>> arch/s390/kvm/gaccess.h | 3 ++
>> arch/s390/kvm/gaccess.c | 101 +++++++++++++++++++++++++++++++++++++++
>> arch/s390/kvm/kvm-s390.c | 35 +++++++++++++-
>> 4 files changed, 142 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
>> index 0d5d4419139a..1f36be5493e6 100644
>> --- a/include/uapi/linux/kvm.h
>> +++ b/include/uapi/linux/kvm.h
>> @@ -588,6 +588,8 @@ struct kvm_s390_mem_op {
>> struct {
>> __u8 ar; /* the access register number */
>> __u8 key; /* access key, ignored if flag unset */
>> + __u8 pad1[6]; /* ignored */
>> + __u64 old_p; /* ignored if flag unset */
>
> Just one comment: the suffix "_p" for pointer is quite unusual within
> the kernel. This also would be the first of its kind within kvm.h.
> Usually there is either no suffix or "_addr".
> So for consistency reasons I would suggest to change this to one of
> the common variants.
>
> The code itself looks good from my point of view, even though for the
> sake of simplicity I would have put the complete sign/zero extended
> 128 bit old value into the structure, instead of having a pointer to
> the value.
See
https://lore.kernel.org/kvm/37197cfe-d109-332f-089b-266d7e8e23f8@redhat.com/
... it would break the "IOW" definition of the ioctl. It can be done, but
that confuses tools like valgrind, as far as I know. So I think the idea
with the pointer is better in this case.
Thomas
next prev parent reply other threads:[~2022-11-18 14:41 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 22:17 [PATCH v3 0/9] " Janis Schoetterl-Glausch
2022-11-17 22:17 ` [PATCH v3 1/9] " Janis Schoetterl-Glausch
2022-11-18 10:12 ` Heiko Carstens
2022-11-18 14:37 ` Thomas Huth [this message]
2022-11-18 15:15 ` Heiko Carstens
2022-11-21 17:41 ` Janis Schoetterl-Glausch
2022-12-01 16:15 ` Claudio Imbrenda
2022-12-01 17:44 ` Janis Schoetterl-Glausch
2022-12-02 9:00 ` Claudio Imbrenda
2022-11-17 22:17 ` [PATCH v3 2/9] Documentation: KVM: s390: Describe KVM_S390_MEMOP_F_CMPXCHG Janis Schoetterl-Glausch
2022-11-18 1:50 ` Bagas Sanjaya
2022-11-21 17:44 ` Janis Schoetterl-Glausch
2022-11-22 7:47 ` Thomas Huth
2022-11-22 13:10 ` Janis Schoetterl-Glausch
2022-11-25 8:52 ` Nico Boehr
2022-12-01 16:21 ` Claudio Imbrenda
2022-11-17 22:17 ` [PATCH v3 3/9] KVM: s390: selftest: memop: Pass mop_desc via pointer Janis Schoetterl-Glausch
2022-11-17 22:17 ` [PATCH v3 4/9] KVM: s390: selftest: memop: Replace macros by functions Janis Schoetterl-Glausch
2022-12-01 16:28 ` Claudio Imbrenda
2022-12-01 17:58 ` Janis Schoetterl-Glausch
2022-11-17 22:17 ` [PATCH v3 5/9] KVM: s390: selftest: memop: Move testlist into main Janis Schoetterl-Glausch
2022-11-22 7:52 ` Thomas Huth
2022-11-22 9:34 ` Janis Schoetterl-Glausch
2022-11-17 22:17 ` [PATCH v3 6/9] KVM: s390: selftest: memop: Add cmpxchg tests Janis Schoetterl-Glausch
2022-11-17 22:17 ` [PATCH v3 7/9] KVM: s390: selftest: memop: Add bad address test Janis Schoetterl-Glausch
2022-11-17 22:17 ` [PATCH v3 8/9] KVM: s390: selftest: memop: Fix typo Janis Schoetterl-Glausch
2022-11-17 22:17 ` [PATCH v3 9/9] KVM: s390: selftest: memop: Fix wrong address being used in test Janis Schoetterl-Glausch
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=90f07edc-238f-b3d0-80d2-f4b4573f12ad@redhat.com \
--to=thuth@redhat.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=scgl@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=svens@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®