Received: by 10.192.165.148 with SMTP id m20csp169102imm; Fri, 20 Apr 2018 05:02:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx49q/eNVrLrxfMTMORsODjoZSAw9jD9B+rHPwln9x5skFUKq/2hMYw9vfWZnZ9G2rck0G59X X-Received: by 10.98.10.72 with SMTP id s69mr9143028pfi.134.1524225743090; Fri, 20 Apr 2018 05:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524225743; cv=none; d=google.com; s=arc-20160816; b=OYDiEmaG90oW28+O/JvSdoz3cRUZKzaCc+bGMdANK1dLnWxHMFq+wA90ToSaQUTA88 Uz1qrF8RyG655tdCnKI3OjtAcqBu9xymveqgd9LcT7+6UYYGIteCGPJqXoW6Wub0O3nA wL9j9ipL6lc7tLLFj+8eQkyvwo1VINmCzzpDNvhVyNMOucXfFm29Fiy1Zk9bIa518dyl g2ngn5vY3/V7LeJSS9Y6hT13Ev+j2/Fo4pLO8dQHX+5tnEfruLbfDvfaH7SJpolXVws7 6EX6FHkZoadsMTpP1U2P4E/bHyiSCiqbK6Bk+s+WhPtGCibxH7VT0LCjCF972JbcBElu 0O7g== 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=pqgOV7kROg/GU9v3a7w6ruf7BhoWbV8KhYSGjZaoq3g=; b=J6DYplOEQcJ6F1lz2gM+99xhECbMKIGy9YrsvtRRf2JjOW+y2kV7icpT9T4bx7gd6S NWREH1V2X5UYK17+qBUxbxS6spOrVP5hJrhM8UFrQK7XRnFA1XKwUHg9yUSMoNclNJYz n3+TnFWNKooBBjgGpFq2pu2s2i59hP0yCHN4gttNAOGZSxpL/+2Qx/9OHPMvmYaW1MNZ md3uCqKx7smmftZtKXvP59i03Xb07/Lu8RJlZnnpmQ8F1XB1NKys6plyMMjjudidp9AO EVZMEkswEPnwqOAV3KxFx3Ywosst6yr8TIeCUWWdXCTgvyzBeNcT9CPX0mcwF05kD4RS OOvA== 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 w2-v6si6114647plz.226.2018.04.20.05.02.08; Fri, 20 Apr 2018 05:02:23 -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 S1754734AbeDTMAn (ORCPT + 99 others); Fri, 20 Apr 2018 08:00:43 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45976 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754591AbeDTMAi (ORCPT ); Fri, 20 Apr 2018 08:00:38 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3KC09fE063991 for ; Fri, 20 Apr 2018 08:00:37 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hfe00cuqx-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Fri, 20 Apr 2018 08:00:17 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Apr 2018 12:59:55 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 20 Apr 2018 12:59:52 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3KBxqme52691036; Fri, 20 Apr 2018 11:59:52 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55EBC4204B; Fri, 20 Apr 2018 12:51:21 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EDC7642041; Fri, 20 Apr 2018 12:51:20 +0100 (BST) Received: from [9.152.224.155] (unknown [9.152.224.155]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 20 Apr 2018 12:51:20 +0100 (BST) Subject: Re: [PATCH] KVM: s390: reset crypto attributes for all vcpus To: Tony Krowiak , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: borntraeger@de.ibm.com, cohuck@redhat.com, pmorel@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com, pbonzini@redhat.com, rkrcmar@redhat.com References: <1524172432-26211-1-git-send-email-akrowiak@linux.vnet.ibm.com> From: Janosch Frank Openpgp: preference=signencrypt Autocrypt: addr=frankja@linux.ibm.com; prefer-encrypt=mutual; keydata= xsFNBFfqIWIBEAC9u1ku3alDY4YilAfKidqWZ46kCnu7WPXkdcgH3ww/9CcgIDoeSr90SnaU T9gQRO92ESh2OO0ff3RMfmQpPG7hivVKu9G8z4Fsblxqi3sSHBNpZu3wYE81UQTlG2EJpccX DXlBUGmMI44Ra3+NoeYbsTn0vU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ZcqWY1bx3vh2c5NZjCCubY1tb8548x6IprwAYtpmx3XlOXb12Jki/HT qHgeSscyleLbneNO+s8LfhJKY15smPqVKG6leCbtIpliZ0TI2Zif+gYvDZRruHYgHwi9bQzH +wEVDrgess/1dDq3Pt+W7NRhFoKKq7ZQOYkyHE1qdck/cGvq4/XCL9np7+3CBEql+QOtuR2o AdES5cnZwKm7peagQBEaFqgni26de11pW294pJRG0U36mSqxEoyqe97vKUYzsdy1hPPbOPfy 7img6Ifh6WL1b4FIIn9TFbooQ1WRSQvbOzxL+E2x+vmEPfNxpzAuuS+ASLJ6Zv9QCOUAvzBn Lfg7BvkfUhALMIZnAoyYmxutcWL4XYYAvMG13l8hFYpoQcF4WEnUoP0UuNwXmR4QZvOuiE8u CyL9U2LEYbrPVTIsEtUVmDlCyD1Kq+6LE3aU+n06soITGp9a3/WNLpXUbUYfzRvYJ3p6jssI Pe50r3yPfdgbWIWzeWuLimNVTlbIZAi1Y0VIdCDbDQpXl2DDTB9zZw2yz0kRKxasMCAEsvlA CT0NLoyQplUjM1ir5e6QTwy9+v3niCCesupe7owsFfrg/YZsE9jCy8vWgdPjSnRJkwQqV2Fw lFM6NIuMAY1Y Date: Fri, 20 Apr 2018 13:59:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1524172432-26211-1-git-send-email-akrowiak@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n6kp673LA74rEC7tWUKnaqaFFXhqwqKAb" X-TM-AS-GCONF: 00 x-cbid: 18042011-0044-0000-0000-0000054A5EFF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042011-0045-0000-0000-0000288A80B5 Message-Id: <870459b4-228d-0be3-5dd3-48ab480b46de@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-20_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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804200118 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) --n6kp673LA74rEC7tWUKnaqaFFXhqwqKAb Content-Type: multipart/mixed; boundary="zDi7kUaLoViTvIsrjxjUh4nfna871sGlG"; protected-headers="v1" From: Janosch Frank To: Tony Krowiak , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: borntraeger@de.ibm.com, cohuck@redhat.com, pmorel@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com, pbonzini@redhat.com, rkrcmar@redhat.com Message-ID: <870459b4-228d-0be3-5dd3-48ab480b46de@linux.ibm.com> Subject: Re: [PATCH] KVM: s390: reset crypto attributes for all vcpus References: <1524172432-26211-1-git-send-email-akrowiak@linux.vnet.ibm.com> In-Reply-To: <1524172432-26211-1-git-send-email-akrowiak@linux.vnet.ibm.com> --zDi7kUaLoViTvIsrjxjUh4nfna871sGlG Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Thanks, applied. On 19.04.2018 23:13, Tony Krowiak wrote: > Introduces a new function to reset the crypto attributes for all > vcpus whether they are running or not. Each vcpu in KVM will > be removed from SIE prior to resetting the crypto attributes in its > SIE state description. After all vcpus have had their crypto attributes= > reset the vcpus will be restored to SIE. >=20 > This function is incorporated into the kvm_s390_vm_set_crypto(kvm) > function to fix a reported issue whereby the crypto key wrapping > attributes could potentially get out of synch for running vcpus. >=20 > Reported-by: Halil Pasic > Signed-off-by: Tony Krowiak > --- > arch/s390/kvm/kvm-s390.c | 18 ++++++++++++++---- > arch/s390/kvm/kvm-s390.h | 13 +++++++++++++ > 2 files changed, 27 insertions(+), 4 deletions(-) >=20 > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index fa355a6..4fa3037 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -789,6 +789,19 @@ static int kvm_s390_set_mem_control(struct kvm *kv= m, struct kvm_device_attr *att > return ret; > } >=20 > +void kvm_s390_vcpu_crypto_reset_all(struct kvm *kvm) > + { > + int i; > + struct kvm_vcpu *vcpu; > + > + kvm_s390_vcpu_block_all(kvm); > + > + kvm_for_each_vcpu(i, vcpu, kvm) > + kvm_s390_vcpu_crypto_setup(vcpu); > + > + kvm_s390_vcpu_unblock_all(kvm); > +} > + > static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu); >=20 > static int kvm_s390_vm_set_crypto(struct kvm *kvm, struct kvm_device_a= ttr *attr) > @@ -832,10 +845,7 @@ static int kvm_s390_vm_set_crypto(struct kvm *kvm,= struct kvm_device_attr *attr) > return -ENXIO; > } >=20 > - kvm_for_each_vcpu(i, vcpu, kvm) { > - kvm_s390_vcpu_crypto_setup(vcpu); > - exit_sie(vcpu); > - } > + kvm_s390_vcpu_crypto_reset_all(kvm); > mutex_unlock(&kvm->lock); > return 0; > } > diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h > index 1b5621f..981e3ba 100644 > --- a/arch/s390/kvm/kvm-s390.h > +++ b/arch/s390/kvm/kvm-s390.h > @@ -410,4 +410,17 @@ static inline int kvm_s390_use_sca_entries(void) > } > void kvm_s390_reinject_machine_check(struct kvm_vcpu *vcpu, > struct mcck_volatile_info *mcck_info); > + > +/** > + * kvm_s390_vcpu_crypto_reset_all > + * > + * Reset the crypto attributes for each vcpu. This can be done while t= he vcpus > + * are running as each vcpu will be removed from SIE before resetting = the crypt > + * attributes and restored to SIE afterward. > + * > + * Note: The kvm->lock must be held while calling this function > + * > + * @kvm: the KVM guest > + */ > +void kvm_s390_vcpu_crypto_reset_all(struct kvm *kvm); > #endif >=20 --zDi7kUaLoViTvIsrjxjUh4nfna871sGlG-- --n6kp673LA74rEC7tWUKnaqaFFXhqwqKAb 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 iQIcBAEBCAAGBQJa2dY3AAoJEBcO/8Q8ZEV5QRMP/j2ytqH+wyXbC6is8dKiQd6u 8KlWeoDZ5OprEu3pTuXOpVDv2IVVEBYVTcNhWwTF2KqzhoebcMck877TGNRPgfPq xBB1IygZ3Fk25301a6jEz7j++cKKpP+XzMDNb+KJPyF18yck/0ZIvD+dQR5Z/nuO WXiyDR2RWS9tjzc+qVhNjGAxPMPGD1EJMPJBE4aQN6PTz8gyl4ZzhVGhXm8yB93q jdpg3yclD/i8HvS7b/JRDaEuXdMf2DfdxZh2uBlCp9LXdqZyoGlfo03pnGrRM/la 8q94Fpu4L95rTOPuXzlQP5tKUpZxkXdaGQ2gNzj0EN1Jg4sBpJuAUgRpI9cbQBhV vn5Knsjih1l2kVYiLz9TvmavDe0juwzF2/4mLtMrpmWchRilVVcbHnNRLdP0sJD4 MVFR6/xcx1bA0A1C59xvoYWPeyO0zftZ7XXtoxz3epybVIm2HLRti00NssevpVIU Xu2SqVqR9EYo8KVEnQL3eOhEBReYVelcKFH50lV+Y2t/xOJvLho4ixRCVag9MRW7 039bw4t43VI2khi9JeK5Pj7UDgJLVLngzJHvcAGXmfnSI+6GxGg83dJwIRSCkCaj Ze3kLb2f+MPyRfJVxbFXqrwWdpoRZztx7LPCZhsCD07xzRg+vV5EFROVQRJTfhUe 75XP6mkJnPH0Rkn46pXK =/GRu -----END PGP SIGNATURE----- --n6kp673LA74rEC7tWUKnaqaFFXhqwqKAb--