Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4331554imm; Mon, 11 Jun 2018 10:29:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKwd7OzZW6sLyDr7Y/+iaDTE05LK8WhfBPRz70LUrLy7/teoUTqX7BB3zT7BWGEVEkvZ6RS X-Received: by 2002:a62:4bc8:: with SMTP id d69-v6mr109132pfj.244.1528738146537; Mon, 11 Jun 2018 10:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528738146; cv=none; d=google.com; s=arc-20160816; b=QAjsq9pkqBtgnzr1rMDp11jLGmTYrCKxmRuFz5ttbpu08JJ69YHnH3U1St9C0nm4Gc RmmUqauiOD8ODkaYBNU7GYr6bHgShB1W5g98ZHKXwg1xGt6hncPTWLrpLIOhjghGm/Z1 JTBR8wcMp5ISRjUbkNK4E4AdzGnKr1AQ5ME5i2mujrezOu9y7phFqdlJv+D22e2k+nSP GP9yUCG0E1d9udbZ2I7wDN2R4l2oaRV8q1NoHm3Ho2//yOVKsvg042hCkt+bJohzYAMx CEWoXVG8l3IVm1bY+xpn348PAWYcbOltAB0L+CIp/b5f3THiQPVwa29PcKLvzV2tiNjj /0Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=Fq91ir3ycicfs4CTFswhSZgexXUmsSfnZVTD7DIlRqo=; b=ETZbmMm9Gie3Kq5qAqpJw2PNO1SzipRnFnq8JK8RTu3Y4sHRKa0Sqzu7AnpG1VaoT3 AqemrrwtTCuYuLmHIwLJk/afpLljvXB+38ODPY+MCnOkcwA5oLqXrrw30XG5GgBnzhs+ l1w15o3gOW+FcpnY9KD/jE2okG5aYYoS2yFv1BCidMQl2YWcDA2SDv71LRfJkXAhtQDf yeyOlNTxBLdJTSOAmXPMIUJnCTx44NuGjzWpjl+nE0s4TceftMPN9Do5g8ogV3oxH3Yf QJ8t1623sTwnND/BxUQ9F5mOrSEGb6P6FJggFNFOVA6ThNiVs82zl39bRcKqSfK3ivX4 DjsQ== 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 j6-v6si24372392pll.54.2018.06.11.10.28.21; Mon, 11 Jun 2018 10:29:06 -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 S933322AbeFKQ1F (ORCPT + 99 others); Mon, 11 Jun 2018 12:27:05 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34114 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932627AbeFKQ1D (ORCPT ); Mon, 11 Jun 2018 12:27:03 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5BGNYlO070556 for ; Mon, 11 Jun 2018 12:27:03 -0400 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jhup2jt1n-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Jun 2018 12:27:02 -0400 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Jun 2018 12:27:01 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e16.ny.us.ibm.com (146.89.104.203) 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:26:58 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5BGQuhQ11534708 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 Jun 2018 16:26:56 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96297112063; Mon, 11 Jun 2018 12:26:54 -0400 (EDT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1BC41112062; Mon, 11 Jun 2018 12:26:53 -0400 (EDT) Received: from oc8043147753.ibm.com (unknown [9.85.207.139]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 11 Jun 2018 12:26:53 -0400 (EDT) Subject: Re: [PATCH v5 11/13] KVM: s390: implement mediated device open callback To: Janosch Frank , Halil Pasic , pmorel@linux.ibm.com, 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> <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: Tony Krowiak Date: Mon, 11 Jun 2018 12:26:54 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18061116-0072-0000-0000-0000036BEEE6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009170; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01045473; UDB=6.00535351; IPR=6.00824451; MB=3.00021582; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-11 16:27:01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061116-0073-0000-0000-000048533091 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-11_07:,, 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=923 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806110188 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/11/2018 07:49 AM, Janosch Frank wrote: > On 11.06.2018 13:32, Halil Pasic wrote: >> >> 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 kvm_ap_matrix structures, >>>> we still need the kvm code to configure the guest's CRYCB and eventually 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 instead >>> 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. >>> >> >> 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 opinion >> better). > Please do not use the kvm_lock if possible. > >> 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. >> >> And my opinion is if we don't have to add code to the kvm module we >> better not. >> >> @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. I am not sure what you mean by "registers the crycb with KVM". Can you provide more detail? > >> Regards, >> Halil >> >