From: Thomas Huth <thuth@redhat.com>
To: Janis Schoetterl-Glausch <scgl@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>
Cc: 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 v5 01/10] KVM: s390: Extend MEM_OP ioctl by storage key checked cmpxchg
Date: Wed, 11 Jan 2023 11:21:14 +0100 [thread overview]
Message-ID: <32361afe-0f87-b8e1-6214-5a46da31000b@redhat.com> (raw)
In-Reply-To: <205f71e7ea88e7fb2e7bf1e013855b3ed0639150.camel@linux.ibm.com>
On 11/01/2023 11.00, Janis Schoetterl-Glausch wrote:
> On Wed, 2023-01-11 at 08:59 +0100, Thomas Huth wrote:
>> On 10/01/2023 21.26, 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 | 7 +++
>>> arch/s390/kvm/gaccess.h | 3 ++
>>> arch/s390/kvm/gaccess.c | 102 +++++++++++++++++++++++++++++++++++++++
>>> arch/s390/kvm/kvm-s390.c | 41 +++++++++++++++-
>>> 4 files changed, 151 insertions(+), 2 deletions(-)
>>>
> [...]
>
>>> +/**
>>> + * cmpxchg_guest_abs_with_key() - Perform cmpxchg on guest absolute address.
>>> + * @kvm: Virtual machine instance.
>>> + * @gpa: Absolute guest address of the location to be changed.
>>> + * @len: Operand length of the cmpxchg, required: 1 <= len <= 16. Providing a
>>> + * non power of two will result in failure.
>>> + * @old_addr: Pointer to old value. If the location at @gpa contains this value, the
>>> + * exchange will succeed. After calling cmpxchg_guest_abs_with_key() *@old
>>> + * contains the value at @gpa before the attempt to exchange the value.
>>> + * @new: The value to place at @gpa.
>>> + * @access_key: The access key to use for the guest access.
>>> + *
>>> + * Atomically exchange the value at @gpa by @new, if it contains *@old.
>>> + * Honors storage keys.
>>> + *
>>> + * Return: * 0: successful exchange
>>> + * * 1: exchange unsuccessful
>>> + * * a program interruption code indicating the reason cmpxchg could
>>> + * not be attempted
>>
>> PGM_OPERATION has also the value 1 ... can we be sure that it never happens
>> here?
>
> Currently yes, only program errors are those explicit in the code,
> PGM_ADDRESSING and PGM_PROTECTION.
>
>> ... maybe it would make sense to use KVM_S390_MEMOP_R_NO_XCHG for
>> return value here instead of 1, too, just to be on the safe side?
>
> I didn't like that idea because I consider KVM_S390_MEMOP_R_NO_XCHG to be
> part of the KVM's api surface and cmpxchg_guest_abs_with_key is an internal
> function that shouldn't concern itself with that.
>
> But being unclear on PGM_OPERATION is indeed ugly.
> Maybe I should just replace "a program interruption code ..." with the specific ones?
Yes, that would help to avoid this confusion. With such a change feel free
to add:
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2023-01-11 10:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 20:26 [PATCH v5 00/10] " Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 01/10] " Janis Schoetterl-Glausch
2023-01-11 7:59 ` Thomas Huth
2023-01-11 10:00 ` Janis Schoetterl-Glausch
2023-01-11 10:21 ` Thomas Huth [this message]
2023-01-11 9:35 ` Janosch Frank
2023-01-11 15:19 ` Janis Schoetterl-Glausch
2023-01-11 17:26 ` Janosch Frank
2023-01-12 12:48 ` Janis Schoetterl-Glausch
2023-01-11 9:38 ` Janosch Frank
2023-01-11 15:29 ` Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 02/10] Documentation: KVM: s390: Describe KVM_S390_MEMOP_F_CMPXCHG Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 03/10] KVM: s390: selftest: memop: Pass mop_desc via pointer Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 04/10] KVM: s390: selftest: memop: Replace macros by functions Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 05/10] KVM: s390: selftest: memop: Move testlist into main Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 06/10] KVM: s390: selftest: memop: Add cmpxchg tests Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 07/10] KVM: s390: selftest: memop: Add bad address test Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 08/10] KVM: s390: selftest: memop: Fix typo Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 09/10] KVM: s390: selftest: memop: Fix wrong address being used in test Janis Schoetterl-Glausch
2023-01-10 20:26 ` [PATCH v5 10/10] KVM: s390: selftest: memop: Fix integer literal Janis Schoetterl-Glausch
2023-01-11 11:31 ` [PATCH v5 00/10] KVM: s390: Extend MEM_OP ioctl by storage key checked cmpxchg Janosch Frank
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=32361afe-0f87-b8e1-6214-5a46da31000b@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®