Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1788903imm; Thu, 9 Aug 2018 01:52:56 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyYAvZm+2gTfyjXIbxa/YZRee55MdNYXRyy7I1YzBBfqUI++lDsjDscJ6agEkhyE4JtPVXS X-Received: by 2002:a62:6eca:: with SMTP id j193-v6mr1432926pfc.256.1533804776213; Thu, 09 Aug 2018 01:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533804776; cv=none; d=google.com; s=arc-20160816; b=SIskNCfhqsSlGNjcftdwJ685kLpyv7tz5JsnMGWxthOaSlgEfWa1kY+ugo8eumNGQn G3ZUk0SHVFv7tChMh2VP+32GzfuYLnkI3YaMbh5ZUNLj4e4l8nG8LtU2wHyRxcHJlTPx SqAweCEd9qGZPTwEndnKGTOUu/hPJf2x2J74SpEf0gXAmOGfoKqXH24Uhy4fsVZkFuk0 O/0HESU/oHsMujRLiVn1OtFIN8be+4doBWS24+tzbOtlGi/QlyG8ChdgINon7yDYDF2e nzI2DBaRXRTh3JxpaDeNZYogtc83A1/N1EEGUoHl7c45lObw0cMBWl/D9PVZWCnSu0Tk URPQ== 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:reply-to:arc-authentication-results; bh=pqSwKzAswwyTugZCU9/hYFhArKsig5alhc+STRKSgzk=; b=LnJswd/TaN324aKCfG3RjS42F8FcC5mI0O5gsZo7qs3WBYjlUx0W5EgJsx7huUZe6N mPqz9JUpKNLorIUDZ/1TbUcPkNL6cIe3Y7FfSnB9013PntPAGT3hLBKgBgh0oY4fLjp6 uQWbkWjjid+mJYCPRLTSSMeRO3fw+8wFrIFSTIKdVkJbqqC3mIgAxpo9wDLvRU/oW7CE +mqa7YpKtNgKoqo+0lczyGwV+QVG+8pajbfZG7n9IaFw6ZQowTQkhCbXTxwNiE+3xOwb nJEDKzdyAKRAlGc9rWfz84SzbvVZ5npM29TFR2qw92Zw5b8vXoswbt47YLx4VLn3AWuR hLgg== 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 f62-v6si6290243pfg.165.2018.08.09.01.52.41; Thu, 09 Aug 2018 01:52:56 -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 S1729975AbeHILOf (ORCPT + 99 others); Thu, 9 Aug 2018 07:14:35 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51564 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729911AbeHILOe (ORCPT ); Thu, 9 Aug 2018 07:14:34 -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 w798i5aF058817 for ; Thu, 9 Aug 2018 04:50:44 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2krhj5j5k9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Aug 2018 04:50:44 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Aug 2018 09:50:41 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 9 Aug 2018 09:50:37 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w798oaec23658726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 9 Aug 2018 08:50:36 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2750C42042; Thu, 9 Aug 2018 11:50:44 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C8334204C; Thu, 9 Aug 2018 11:50:43 +0100 (BST) Received: from [9.152.224.92] (unknown [9.152.224.92]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Aug 2018 11:50:43 +0100 (BST) Reply-To: pmorel@linux.ibm.com Subject: Re: [PATCH v8 19/22] KVM: s390: Clear Crypto Control Block when using vSIE To: David Hildenbrand , 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, frankja@linux.ibm.com References: <1533739472-7172-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1533739472-7172-20-git-send-email-akrowiak@linux.vnet.ibm.com> <9a7353fa-143f-9048-936a-59f446411e0a@redhat.com> From: Pierre Morel Date: Thu, 9 Aug 2018 10:50:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <9a7353fa-143f-9048-936a-59f446411e0a@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18080908-0008-0000-0000-0000025F4AA8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080908-0009-0000-0000-000021C7597D Message-Id: <8696bba1-af93-07a6-060b-e722165416b8@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-09_03:,, 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808090092 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/08/2018 10:10, David Hildenbrand wrote: > On 08.08.2018 16:44, Tony Krowiak wrote: >> From: Pierre Morel >> >> When we clear the Crypto Control Block (CRYCB) used by a guest >> level 2, the vSIE shadow CRYCB for guest level 3 must be updated >> before the guest uses it. >> >> We achieve this by using the KVM_REQ_VSIE_RESTART synchronous >> request for each vCPU belonging to the guest to force the reload >> of the shadow CRYCB before rerunning the guest level 3. >> >> Signed-off-by: Pierre Morel >> --- >> arch/s390/kvm/kvm-s390.c | 7 +++++++ >> 1 files changed, 7 insertions(+), 0 deletions(-) >> >> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c >> index 0d03249..9203f0b 100644 >> --- a/arch/s390/kvm/kvm-s390.c >> +++ b/arch/s390/kvm/kvm-s390.c >> @@ -1921,6 +1921,9 @@ static void kvm_s390_set_crycb_format(struct kvm *kvm) >> >> void kvm_arch_crypto_clear_masks(struct kvm *kvm) >> { >> + int i; >> + struct kvm_vcpu *vcpu; >> + >> mutex_lock(&kvm->lock); >> kvm_s390_vcpu_block_all(kvm); >> >> @@ -1929,6 +1932,10 @@ void kvm_arch_crypto_clear_masks(struct kvm *kvm) >> memset(&kvm->arch.crypto.crycb->apcb1, 0, >> sizeof(kvm->arch.crypto.crycb->apcb1)); >> >> + /* recreate the shadow crycb for each vcpu */ >> + kvm_for_each_vcpu(i, vcpu, kvm) >> + kvm_s390_sync_request(KVM_REQ_VSIE_RESTART, vcpu); > We have kvm_s390_sync_request_broadcast(), which should boil down to a > one-liner right, thanks >> + >> kvm_s390_vcpu_unblock_all(kvm); >> mutex_unlock(&kvm->lock); >> } >> > -- Pierre Morel Linux/KVM/QEMU in Böblingen - Germany