Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932263AbdGKIWF (ORCPT ); Tue, 11 Jul 2017 04:22:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49495 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932133AbdGKIWB (ORCPT ); Tue, 11 Jul 2017 04:22:01 -0400 Subject: Re: [PATCH] KVM: s390: Fix KVM_S390_GET_CMMA_BITS ioctl definition To: Gleb Fotengauer-Malinovskiy Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Claudio Imbrenda , "Dmitry V. Levin" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20170710144410.GA10359@glebfm.cloud.tilaa.com> <09c0760e-729d-548a-c3c4-b3afd9e67225@de.ibm.com> <20170710212321.GB2703@glebfm.cloud.tilaa.com> From: Christian Borntraeger Date: Tue, 11 Jul 2017 10:21:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170710212321.GB2703@glebfm.cloud.tilaa.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-IE Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17071108-2213-0000-0000-000001F6A430 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007347; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00885926; UDB=6.00442174; IPR=6.00666076; BA=6.00005467; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016172; XFM=3.00000015; UTC=2017-07-11 08:21:58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071108-2214-0000-0000-000056D50DD9 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-11_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1707110126 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1604 Lines: 39 On 07/10/2017 11:23 PM, Gleb Fotengauer-Malinovskiy wrote: > On Mon, Jul 10, 2017 at 08:43:12PM +0200, Christian Borntraeger wrote: >> On 07/10/2017 04:44 PM, Gleb Fotengauer-Malinovskiy wrote: >>> This ioctl actually writes to parameter too. >> >> Maybe rephrase that to: >> The kernel does not only read struct kvm_s390_cmma_log for KVM_S390_GET_CMMA_BITS, >> it also writes back a return value making this _IOWR instead of _IOW. > > Ok, see v2. > >>> Fixes: 4036e387 ("KVM: s390: ioctls to get and set guest storage attributes") >>> Signed-off-by: Gleb Fotengauer-Malinovskiy >> Acked-by: Christian Borntraeger >> >> >> Out of curiosity, how did you notice that? > > I regenerated strace's ioctl lists. It was obvious from the diff that > *GET* and *SET* could not be both _IOC_WRITE. > In fact we do have multiple GET/SET ioctls in KVM, where both provide a control block that is _IOC_WRITE only. That control block then has an address that will be read/written to depending on get/set. E.g. look at #define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr) #define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr) but as far as I understand, the direction hints only qualify the referenced struct and not the side effects. So for KVM_*_DEVICE_ATTR it is correct to have IOW for both cases. But for GET_CMMA we do indeed write back data. Paolo, Radim, if we want to fix the direction hint, it would be good to merge this in as soon as possible. The new interface was added during this merge window.