Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3959212imm; Mon, 11 Jun 2018 04:50:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJW46BVLjejGFC4zKmBhuRBOcgwFFkjIR+IKN6Nzgzz+gSMQM+0dtNjeMmqwVfeGjYi1V71 X-Received: by 2002:a17:902:1703:: with SMTP id i3-v6mr18023914pli.263.1528717845062; Mon, 11 Jun 2018 04:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528717845; cv=none; d=google.com; s=arc-20160816; b=fydDP15P7HpAeB3mEUEj/2CPX/hGg2+F6HjOyRbifasAnXhO8J3B687VyUeLsY64Ey fnVQglo4CiEImLQob6BDRq0lm9Ah6bVtdeoi/uKK6IyiOMa+42ZfrollT9r6YHcCnB+a 4J6WPYBo0ekdMotbyTDXtqTLQy03tTXhsoXBFan42c/qB2mS4naEeSgdV+PDegsyAyDy vW+yMfDnbaVD7fF1Dy5QTMnDqZXUJxWmEKUW6uEFFlj31z1q4BtmHUgUtcHkWDcFZ55F zQ5Dps1G10pbQpY4WcjtkEzs2U/tATqM/HNXfnuzc1WlDr7i0JY6S1+zwyfspVdX1moZ ZUfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:mime-version :user-agent:date:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=cNEtLmDaVrPfB/Aig8i+YRN5M3GbdFx0itwGMcuYI7E=; b=VfBAw3kwC3J+2SUMbOiz/6qTBuq8XJ4uk+l7RybK9c5hKgoq9aTM8gHCD91FfJbuTV dO56nEt62R2QFRiKZHN+pHY+VLf0l/+VbvritFKLLa6ebMonvfpGR/QJBOVqrScmp0XI uUD6Z/Q+x2Os9xRhwI3d/3iBiVCiA0ZPM6iCqwIhibQfywWeLPrIpMfEmSOchQTe0bp1 I+rDGLHIY2xgCdRORGBYgERHgIhltyPvr153hB/ahLW9vTAzdbTfKyMrWRQbZplbpuhr Yx0fVkYgW/cCdPPjafKuXZ4ojSVsozmO7x1btHpl3Qp7b7aQTN7aNCU7t8djD3OR1vVL AsrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si5746672pgq.503.2018.06.11.04.50.30; Mon, 11 Jun 2018 04:50:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932963AbeFKLuA (ORCPT + 99 others); Mon, 11 Jun 2018 07:50:00 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59918 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932940AbeFKLty (ORCPT ); Mon, 11 Jun 2018 07:49:54 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5BBn8qf134512 for ; Mon, 11 Jun 2018 07:49:53 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jhp6s6h2a-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Jun 2018 07:49:53 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Jun 2018 12:49:50 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 11 Jun 2018 12:49:46 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5BBnjtV22741124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 Jun 2018 11:49:45 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AAB72AE045; Mon, 11 Jun 2018 12:38:37 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E0F6FAE051; Mon, 11 Jun 2018 12:38:36 +0100 (BST) Received: from [9.152.224.155] (unknown [9.152.224.155]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 11 Jun 2018 12:38:36 +0100 (BST) Subject: Re: [PATCH v5 11/13] KVM: s390: implement mediated device open callback To: Halil Pasic , pmorel@linux.ibm.com, Tony Krowiak , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: freude@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, kwankhede@nvidia.com, bjsdjshi@linux.vnet.ibm.com, pbonzini@redhat.com, alex.williamson@redhat.com, pmorel@linux.vnet.ibm.com, alifm@linux.vnet.ibm.com, mjrosato@linux.vnet.ibm.com, jjherne@linux.vnet.ibm.com, thuth@redhat.com, pasic@linux.vnet.ibm.com, berrange@redhat.com, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com, Janosch Frank References: <1525705912-12815-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1525705912-12815-12-git-send-email-akrowiak@linux.vnet.ibm.com> <98ea7ce2-2539-e2ff-4bb4-297e784d87bd@linux.ibm.com> <7bb480ac-5723-83ff-c797-53c1ab0458c1@linux.vnet.ibm.com> <93cd0f46-a410-51c8-00b9-810c1b3d3ae2@linux.ibm.com> <0f37dc39-7355-19e5-40c9-a02a1ea58c2d@linux.vnet.ibm.com> <736a1346-f81a-7f71-7d13-38729ff78e4f@linux.ibm.com> <8f68183d-8385-8025-1898-23cad604ae94@linux.vnet.ibm.com> <9e30c9b0-a04c-0c4e-9d3d-37e7a53a7f72@linux.ibm.com> <5f9c3f97-34e2-bf68-b8ca-ac9288ea5efa@linux.vnet.ibm.com> <010679ed-bd80-42f8-3f6f-e4dee10e82f5@linux.ibm.com> From: Janosch Frank Openpgp: preference=signencrypt Autocrypt: addr=frankja@linux.ibm.com; prefer-encrypt=mutual; keydata= xsFNBFfqIWIBEAC9u1ku3alDY4YilAfKidqWZ46kCnu7WPXkdcgH3ww/9CcgIDoeSr90SnaU T9gQRO92ESh2OO0ff3RMfmQpPG7hivVKu9G8z4Fsblxqi3sSHBNpZu3wYE81UQTlG2EJpccX DXlBUGmMI44Ra3+NoeYbsTn0vU2ke69NgOz9MxE87ZpsvQaDfl7XgxTqo+6DJMRpiCJiSgWs SXa73uTdHWgmauAbUkaExe+Mb0txAHPweh6zDrLmiMHO2aZLRCPiY6aaP4m6DtjAaZcBQRcG kliWjsiPs1i8UPJp00/oZW2sDvHntDcp34JXDEdxpRXlsBFOVaWs/9hkI+91M78+fgVxNyQD bc1KH7wiwoND/OSgeJqvI1kN/bz+qdwlQaoAEfSkOkfu7yC1yyx/VpQSdL1ozczGF/4ABZ+G FteQmDEjdg1C5vHAdmoh+yHqsNSDVgwi7Vr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+vmEPfNxpzAuuS+ASLJ6Zv9QCOUAvzBn Lfg7BvkfUhALMIZnAoyYmxutcWL4XYYAvMG13l8hFYpoQcF4WEnUoP0UuNwXmR4QZvOuiE8u CyL9U2LEYbrPVTIsEtUVmDlCyD1Kq+6LE3aU+n06soITGp9a3/WNLpXUbUYfzRvYJ3p6jssI Pe50r3yPfdgbWIWzeWuLimNVTlbIZAi1Y0VIdCDbDQpXl2DDTB9zZw2yz0kRKxasMCAEsvlA CT0NLoyQplUjM1ir5e6QTwy9+v3niCCesupe7owsFfrg/YZsE9jCy8vWgdPjSnRJkwQqV2Fw lFM6NIuMAY1Y Date: Mon, 11 Jun 2018 13:49:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="p5WSB1KGON5tNXD1JZuJXkKMiYD44HYdo" X-TM-AS-GCONF: 00 x-cbid: 18061111-0028-0000-0000-000002CF822F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061111-0029-0000-0000-00002386985C Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-11_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=973 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806110140 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --p5WSB1KGON5tNXD1JZuJXkKMiYD44HYdo Content-Type: multipart/mixed; boundary="0bQrGcgO62KKUu7NthEmnKLGUSMRsJ8rm"; protected-headers="v1" From: Janosch Frank To: Halil Pasic , pmorel@linux.ibm.com, Tony Krowiak , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: freude@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, kwankhede@nvidia.com, bjsdjshi@linux.vnet.ibm.com, pbonzini@redhat.com, alex.williamson@redhat.com, pmorel@linux.vnet.ibm.com, alifm@linux.vnet.ibm.com, mjrosato@linux.vnet.ibm.com, jjherne@linux.vnet.ibm.com, thuth@redhat.com, pasic@linux.vnet.ibm.com, berrange@redhat.com, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com, Janosch Frank Message-ID: Subject: Re: [PATCH v5 11/13] KVM: s390: implement mediated device open callback References: <1525705912-12815-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1525705912-12815-12-git-send-email-akrowiak@linux.vnet.ibm.com> <98ea7ce2-2539-e2ff-4bb4-297e784d87bd@linux.ibm.com> <7bb480ac-5723-83ff-c797-53c1ab0458c1@linux.vnet.ibm.com> <93cd0f46-a410-51c8-00b9-810c1b3d3ae2@linux.ibm.com> <0f37dc39-7355-19e5-40c9-a02a1ea58c2d@linux.vnet.ibm.com> <736a1346-f81a-7f71-7d13-38729ff78e4f@linux.ibm.com> <8f68183d-8385-8025-1898-23cad604ae94@linux.vnet.ibm.com> <9e30c9b0-a04c-0c4e-9d3d-37e7a53a7f72@linux.ibm.com> <5f9c3f97-34e2-bf68-b8ca-ac9288ea5efa@linux.vnet.ibm.com> <010679ed-bd80-42f8-3f6f-e4dee10e82f5@linux.ibm.com> In-Reply-To: --0bQrGcgO62KKUu7NthEmnKLGUSMRsJ8rm Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 11.06.2018 13:32, Halil Pasic wrote: >=20 >=20 > On 06/11/2018 11:23 AM, Pierre Morel wrote: >> On 08/06/2018 23:59, Tony Krowiak wrote: >>> On 06/07/2018 01:15 PM, Pierre Morel wrote: >>>> >> >> ...snip... >> >>>>>> >>>>>>> >>>>>>> Why maintain a list of kvm_ap_matrix structures if we don't have = to; it is stored >>>>>>> with the mediated matrix device which is passed in to all of the = vfio_ap driver >>>>>>> callbacks. >>>>>> >>>>>> Because using the vm_list which is a static in kvm makes you stick= inside the kvm code. >>> >>> I understand your point here, but even if we did maintain a list of k= vm_ap_matrix structures, >>> we still need the kvm code to configure the guest's CRYCB and eventua= lly ECA.28. There is >>> also code in kvm-ap.c that is called from KVM. >> >> The only code from kvm-ap which is called from KVM is temporary code >> waiting for Harald to offer the clean interface to AP instructions. >> >>> The idea behind kvm-ap.c is that all code >>> related to configuration of AP structures in KVM is in this one spot.= >> >> This I understand, but the code can be in one spot inside VFIO_AP inst= ead >> of inside KVM. >> Putting the code inside KVM induce dependencies between KVM and AP >> while the kvm/vfio interface allows to avoid this dependency. >> >> The purpose of VFIO_AP is to handle the CRYCB, all get/clear/set crycb= masks >> functions should be in VFIO AP. >> >> If we use wrappers in KVM, since the CRYCB is an a SIE extension, >> it is legitimate, the KVM interface to the CRYCB should only >> handle bitmaps and be unaware of the vfio_ap internal structures. Yes, please! >> >> Another concern, the kvm_ap_validate_queue_sharing() should not be >> inside KVM because it is a decision of current VFIO_AP driver >> to not share the queues between guest of level 2. >> >> The Z architecture does not allow to share AP queues between >> guests of level 1 but we could re-engineer the AP bus and the ' >> VFIO AP to offer queue sharing for guest level 2. >> >> This would be a new VFIO_AP driver (and an AP bus extension). >> We should not have to change KVM for this. >> >=20 >=20 > Pierre's proposal makes a lot of sense to me. We would not need to take= > the kvm_lock (which we need to traverse the vm_list safely) for the > validation, and we could have immediate validation (which is in my opin= ion > better). Please do not use the kvm_lock if possible. >=20 > Also your refcount (which is not a refcout) could go away. You simply > traverse your list and check for duplicates when hooking up the mdev > with KVM. >=20 > And my opinion is if we don't have to add code to the kvm module we > better not. >=20 > @Janosch: Does core KVM share my opinion? At least I do. KVM does not care about who has which crypto queue/card. I'd like to have a driver that does internal bookkeeping and then registers the crycb with KVM, so the VM can use it. >=20 > Regards, > Halil >=20 --0bQrGcgO62KKUu7NthEmnKLGUSMRsJ8rm-- --p5WSB1KGON5tNXD1JZuJXkKMiYD44HYdo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJbHmHYAAoJEBcO/8Q8ZEV5AS4QAIwpHJh6L9SUp6BQhM5Sz1iN uA8Gz3HJ8mg7zr7EJg3ExIejQlgCG9kjVwDDZcGOIyEltPD7CuCznrXZh24gq+bv w/uqo5XAeuUCFWSffPRHJLqRu7pUxcPYT1a7z2h6PqC6RV7L1ndiXtMZx5enYC5D Kath9KuFaPGZ6xHP73ms9i4BU7STsFbKxZXBFlDosUBk+e2nSdCh/zV1sTlv8B16 TgrvSqpkhIkLOf8+63tvZDnejg/iIlTmQQf4kA8hDQIXY1v9gyyanabsz5qlP3r/ o13fAxd1a/qfUkWN0H+skPv37ngWcALvm/1lsY9XCvkmioe49BSt3jeMe1LG+oT8 Dm1GaPrQ3gTtl7K2tUj7l9+OFihCBJFnhtDDERVXlDD6Hp9qnF2PrjyVYvmBHyPh xBTyQ5V91PZc++8OqZb/nOyifxteso8qgwiOK3NJKVmj7wZFXPSpX8uxDYP16x+H m0BCPPswiAed3DQjk7+n2ga7mHEb4zoCSAYUzwqQhFkdqKwzYMW5aYO4xhQW0wi7 C2oL9Ke7FgXaNIY1Hs9nEFB5M5hFpKqwtWAYk4f25gvorfG+rGAhwKBPQQSShCRr 77M9T3+ycLpGEOQh7wTZGeG2SmmzYgnC8gTnJ5tz57jWbHplxt8BGlLg35aJ1Tmk /R8ew/jcll6tDwF2yA2/ =UnoK -----END PGP SIGNATURE----- --p5WSB1KGON5tNXD1JZuJXkKMiYD44HYdo--