Received: by 10.223.185.116 with SMTP id b49csp7875267wrg; Thu, 1 Mar 2018 12:44:39 -0800 (PST) X-Google-Smtp-Source: AG47ELsetZ0ZUExzXv4PPVW8wml8G0aX7Cwq2+YkgU/PX7qfoFQ5mNDInLFQtTjk//OtQvGTaDaa X-Received: by 2002:a17:902:6bc2:: with SMTP id m2-v6mr2529167plt.432.1519937079182; Thu, 01 Mar 2018 12:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519937079; cv=none; d=google.com; s=arc-20160816; b=ev47TO03NDg+KH5Xtuo8/fX8KP38FQ4B7Cz5VSAQky3DzqdjNz7DBX7lTBL0nJl41E Hyz8Zkzrqg7GcFz6/CSnYry2/gqWjQQfaBRA75d8Bjr+OVJujJHXlY2qGZkRVAj/Q2Lt RF+rkBCNGxEbfkicNUPD+rBszeuwsBtywlQU7UPFx2IRDgway5yIcm1on0urWL/pY7Sk HyeV2k4cv+BdarvevR611yHlKE1Yn6II96CN5B8UsiDtXijx2dfqC3WmxPPP0pSfjWZ6 Td/SuErpokze4IMbBw+LqrzlUql8Ee2hqRQWncrI3nmJnAHQtjVwTI0EfAwpMxQMjYXl jEeg== 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=SLgL0xt5ckmdOFBq68JsKU5OGrtmZev2lpo+vmXEB2A=; b=rf79KnROVqMjEAMft8+9qwGf+SN6el9BWtwNofY/rACnEuSoUajSrEoEriBrA6GtGx 82P1fimwjtJWOE3CDTSnvre4qgYLil4Dw2BC2IX0gXQbnb3YQu+7zDlCClPozXxvEbVT oF9VYFnkYN3LVrodphW+Rl4ec+sQS5nj+dCzwyjkoa8VDw33EEVC+nnEdFXG4sqRLKS9 N0WarYeXDTzCoGiW9J6YXfJK1NbMQFtOZ918KFBSPfLsOABEEv+5iVgNNi8RT/NqTudl e4R0FhYlxchCkgqzxcwv/4/kvXvtiTzY4h1tOr17f+C1PA0xhbKQq8bkSa8UL6WqANs4 0vCQ== 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 f12si2373049pgr.795.2018.03.01.12.44.24; Thu, 01 Mar 2018 12:44:39 -0800 (PST) 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 S1161716AbeCAUmn (ORCPT + 99 others); Thu, 1 Mar 2018 15:42:43 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60748 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161633AbeCAUml (ORCPT ); Thu, 1 Mar 2018 15:42:41 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w21Kcsg8054937 for ; Thu, 1 Mar 2018 15:42:41 -0500 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2geqw3273f-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 01 Mar 2018 15:42:41 -0500 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Mar 2018 13:42:39 -0700 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 1 Mar 2018 13:42:36 -0700 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w21KgXQF6029690; Thu, 1 Mar 2018 13:42:34 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9281E6E03D; Thu, 1 Mar 2018 13:42:34 -0700 (MST) Received: from oc8043147753.ibm.com (unknown [9.60.75.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 2009D6E035; Thu, 1 Mar 2018 13:42:33 -0700 (MST) Subject: Re: [PATCH v2 13/15] KVM: s390: Configure the guest's CRYCB To: David Hildenbrand , 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, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com References: <1519741693-17440-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1519741693-17440-14-git-send-email-akrowiak@linux.vnet.ibm.com> <99b24fc7-3df9-6620-d1df-917214fbdda2@redhat.com> <081eab40-0bbd-5842-76bc-2974f4544529@redhat.com> From: Tony Krowiak Date: Thu, 1 Mar 2018 15:42:32 -0500 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: <081eab40-0bbd-5842-76bc-2974f4544529@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18030120-8235-0000-0000-00000D197D85 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008609; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00996944; UDB=6.00506878; IPR=6.00776263; MB=3.00019805; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-01 20:42:39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030120-8236-0000-0000-00003FE3E419 Message-Id: <4763e223-1c78-c9a3-42bc-2d3569a716ff@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-01_11:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803010253 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/01/2018 04:37 AM, David Hildenbrand wrote: > On 28.02.2018 21:45, Tony Krowiak wrote: >> On 02/28/2018 04:49 AM, David Hildenbrand wrote: >>>> +static int vfio_ap_mdev_open(struct mdev_device *mdev) >>>> +{ >>>> + struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev); >>>> + unsigned long events; >>>> + int ret; >>>> + >>>> + matrix_mdev->group_notifier.notifier_call = vfio_ap_mdev_group_notifier; >>>> + events = VFIO_GROUP_NOTIFY_SET_KVM; >>>> + ret = vfio_register_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, >>>> + &events, &matrix_mdev->group_notifier); >>>> + >>>> + ret = kvm_ap_configure_matrix(matrix_mdev->kvm, >>>> + matrix_mdev->matrix); >>>> + if (ret) >>>> + return ret; >>>> + >>>> + ret = kvm_ap_enable_ie_mode(matrix_mdev->kvm); >>> Can't this happen while the guest is already running? Or what hinders us >>> from doing that? >> I'm not sure exactly what you're asking here. Are you asking if the >> vfio_ap_mdev_open() >> function can be called multiple times while the guest is running? AFAIK >> this will be >> called only once when the mediated device's file descriptor is opened. >> This happens in >> QEMU when the -device vfio-ap device is realized. > Okay, but from a pure interface point of view, this could happen any > time, even while the guest is already running. Patching in the SCB of a > running VCPU is evil. How can this happen while the guest is running? QEMU opens the fd when the device is realized and AFAIK vfio mdev will not allow any other process to open it until the guest is terminated. What am I missing? > > But I guess we don't have to worry about that when changing they way we > set ECA_APIE, as described in the other mail. >