Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5472078rwb; Mon, 21 Nov 2022 23:56:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4vY3mxAcSaNtc2pB1Pt8yT5J05qD8tb4sLNEsxwbZqvHGV9NhTmPp/CDCzDzWgm9pKDxDq X-Received: by 2002:a17:906:a843:b0:79e:1059:6d65 with SMTP id dx3-20020a170906a84300b0079e10596d65mr3648710ejb.695.1669103800727; Mon, 21 Nov 2022 23:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669103800; cv=none; d=google.com; s=arc-20160816; b=tqCR2NE3bgJgyE03B12amE/Fib5VHP2Vg+vthnNW+05MGpO4znV93kbxV5iQA2meJx ++RCb4HMNPUpMFUDTIlSf/RLm0ZK+vnt9/c4w0xVSU4CJtm1Hk2t72N3LLSS+Nk2UG2z lxzYd9A+7/P87MDe2Z/7Ubghf0Xj849BiALYFvrJj2UycGWcc6uZY7JulnZh96HVa3bf D5lvTupbOdJDa9v7NoXiW8OMWmHEMcGjoPBMshL/gsblb7KyFda07R6bLpzqa8roP4Fn qFI9qUSLnIcUV18bVXNo1263AzvVYtdx21wslhRd5CKSD73L5Fq8gFSZ7igrRSM78h2S JsjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=EOlyqNEjSyWRhu789TgVJBojhnd7QCjs246Hat/OGCs=; b=Huw/lYEcoxRQtWnzTQjMGRNy4fsBg3yvQqpDQx+aRcVKy8wcyW4KaU9AZnCAOgMVLK /Q0l+huL8+QeL9a+xgRNrV9dt2piOMi8dCNOI+kKdh0u3vOQ4f4d7+5O9F0bu0zaE6u6 Xowzy2JpT1c7wr/9r5qQJZ/mKLA0W9gfH92S2RTL0tuoIEovEPlTM5mimARTZoNFyYgI ssqu7pvdhUPSxOA1r2X+qA6ENOYLaoHVUYhCaUzleZye8NeXSyQEnP99V0JmhYJABfXg ERpo53Kp1Tg0NGuUjwPITtVbdExSZKhS0E5MTpZ9IpijHgrVheOgLLakKlYNgthBuAMa EHTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NDvqtcox; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa44-20020a17090786ac00b007ae0db0c454si11924405ejc.635.2022.11.21.23.56.14; Mon, 21 Nov 2022 23:56:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NDvqtcox; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232479AbiKVHsc (ORCPT + 93 others); Tue, 22 Nov 2022 02:48:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231655AbiKVHsY (ORCPT ); Tue, 22 Nov 2022 02:48:24 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6508326F5 for ; Mon, 21 Nov 2022 23:47:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669103243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EOlyqNEjSyWRhu789TgVJBojhnd7QCjs246Hat/OGCs=; b=NDvqtcoxOtHwCgmaQNu4Vy6F5sTGTDQD8pgysZcedFkf6yaOczSN9oDFXDoouaQgdyyGov 0BP1mf8NrlajGHmQCt99dPuQH7OkEflijGDE8juFlnRc2RvIjM4t8wnMfXVag8XYVm8Wnx quuvnwG/8S0nCWybtsBNuLYmpnzkXaM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-224-W4msMEsiNKaZopfI6oblfA-1; Tue, 22 Nov 2022 02:47:21 -0500 X-MC-Unique: W4msMEsiNKaZopfI6oblfA-1 Received: by mail-wr1-f72.google.com with SMTP id j30-20020adfa55e000000b00241b49be1a3so3940733wrb.4 for ; Mon, 21 Nov 2022 23:47:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EOlyqNEjSyWRhu789TgVJBojhnd7QCjs246Hat/OGCs=; b=8C1yD6EUUOaGPUtgFVZUcGmEobY591pytfSqOULumaLinL8AsVap5uJBTahHnSJI4l v1g8Z9PfGQl35LDVwuG8/W15ecOA1ADY1Gv+JtePhURVSG5mTA/Ei9iyYIemenRd/fOR OPL+HjjPPhbGfjrwHm47s76+u7QoxpH6WIBsS8e6y7plgXvwaeySvZ7FSUeqOxoljBtk llUEAPob4J5xvkOKhwGsv2/bJT6EH9mxj1sj99Bkp2UI/MxmNOe4iBuab2/vcjWV1TYK 40qC//rgZyaGneml/43lX2kv6mo4FNQdxCm6k0Ci7N8FxYbgxqGl088pB3BngPXuWw+T HjGw== X-Gm-Message-State: ANoB5plaSAzoN7LrB1vQXCsAkCbGo9z+NlMQAVxrE1nMOHo1qJFok6MC K1At2LvZbyvoeKb1MeQFw18O4Os1wxTBFI2HOw4Y0UPIrH8VViEnPo0ebw6fwEf4afahElHxF+Y mGGWoNxMOJwvTDE9CMGv1ZViz X-Received: by 2002:a05:600c:3492:b0:3cf:ad59:1465 with SMTP id a18-20020a05600c349200b003cfad591465mr7757622wmq.12.1669103240156; Mon, 21 Nov 2022 23:47:20 -0800 (PST) X-Received: by 2002:a05:600c:3492:b0:3cf:ad59:1465 with SMTP id a18-20020a05600c349200b003cfad591465mr7757600wmq.12.1669103239912; Mon, 21 Nov 2022 23:47:19 -0800 (PST) Received: from [192.168.0.5] (ip-109-43-176-72.web.vodafone.de. [109.43.176.72]) by smtp.gmail.com with ESMTPSA id 23-20020a05600c229700b003cf75213bb9sm20150358wmf.8.2022.11.21.23.47.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Nov 2022 23:47:19 -0800 (PST) Message-ID: Date: Tue, 22 Nov 2022 08:47:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Content-Language: en-US To: Janis Schoetterl-Glausch , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: David Hildenbrand , Jonathan Corbet , 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 , Shuah Khan , Sven Schnelle References: <20221117221758.66326-1-scgl@linux.ibm.com> <20221117221758.66326-3-scgl@linux.ibm.com> From: Thomas Huth Subject: Re: [PATCH v3 2/9] Documentation: KVM: s390: Describe KVM_S390_MEMOP_F_CMPXCHG In-Reply-To: <20221117221758.66326-3-scgl@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/11/2022 23.17, Janis Schoetterl-Glausch wrote: > Describe the semantics of the new KVM_S390_MEMOP_F_CMPXCHG flag for > absolute vm write memops which allows user space to perform (storage key > checked) cmpxchg operations on guest memory. > > Signed-off-by: Janis Schoetterl-Glausch > --- ... > Supported flags: > * ``KVM_S390_MEMOP_F_CHECK_ONLY`` > * ``KVM_S390_MEMOP_F_SKEY_PROTECTION`` > + * ``KVM_S390_MEMOP_F_CMPXCHG`` > + > +The semantics of the flags common with logical acesses are as for logical > +accesses. > + > +For write accesses, the KVM_S390_MEMOP_F_CMPXCHG might be supported. I'd maybe merge this with the last sentence: For write accesses, the KVM_S390_MEMOP_F_CMPXCHG flag is supported if KVM_CAP_S390_MEM_OP_EXTENSION has bit 1 (i.e. bit with value 2) set. ... and speaking of that, I wonder whether it's maybe a good idea to introduce some #defines for bit 1 / value 2, to avoid the confusion ? > +In this case, instead of doing an unconditional write, the access occurs only > +if the target location contains the "size" byte long value pointed to by > +"old_p". This is performed as an atomic cmpxchg. I had to read the first sentence twice to understand it ... maybe it's easier to understand if you move the "size" part to the second sentence: In this case, instead of doing an unconditional write, the access occurs only if the target location contains value pointed to by "old_p". This is performed as an atomic cmpxchg with the length specified by the "size" parameter. ? > "size" must be a power of two > +up to and including 16. > +The value at the target location is written to the location "old_p" points to. IMHO something like this would be better: The value at the target location is replaced with the value from the location that "old_p" points to. > +If the exchange did not take place because the target value doesn't match the > +old value KVM_S390_MEMOP_R_NO_XCHG is returned. > +The KVM_S390_MEMOP_F_CMPXCHG flag is supported if KVM_CAP_S390_MEM_OP_EXTENSION > +has bit 1 (i.e. bit with value 2) set. Thomas PS: Please take my suggestions with a grain of salt ... I'm not a native speaker either.