From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5C44C352A3 for ; Tue, 11 Feb 2020 13:21:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A7F9E206D7 for ; Tue, 11 Feb 2020 13:21:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aFu6X/jl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7F9E206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3650B6B02CC; Tue, 11 Feb 2020 08:21:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 315DF6B02CD; Tue, 11 Feb 2020 08:21:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2050B6B02CE; Tue, 11 Feb 2020 08:21:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id 0528D6B02CC for ; Tue, 11 Feb 2020 08:21:33 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 74934180AD802 for ; Tue, 11 Feb 2020 13:21:33 +0000 (UTC) X-FDA: 76477908066.16.fruit28_2a81baef0ef02 X-HE-Tag: fruit28_2a81baef0ef02 X-Filterd-Recvd-Size: 5711 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 13:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581427291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VvEvaSBDRVHrMA6kt83bhvPKM3ic03ikIZ0HFfjWGD0=; b=aFu6X/jl0MzVv/YAuRJ914tTJ7jn1z8SGA7cscAqERfc0V6lyo1dU/qd8eCKZx4UCUA830 50TJAp7HAZ70qrbdC3hVsQSCM5TGLASDK/vbYX5P/F2nVzbCMazB0H+65kT8r7QaIB1HuX X8OOcR+ij+TvzMh/hwwJk8XmwBOQYvI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-0uzOiFKCMqODvXes5O9GPQ-1; Tue, 11 Feb 2020 08:21:29 -0500 X-MC-Unique: 0uzOiFKCMqODvXes5O9GPQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F09CDB22; Tue, 11 Feb 2020 13:21:27 +0000 (UTC) Received: from gondolin (dhcp-192-195.str.redhat.com [10.33.192.195]) by smtp.corp.redhat.com (Postfix) with ESMTP id C710C5C100; Tue, 11 Feb 2020 13:21:22 +0000 (UTC) Date: Tue, 11 Feb 2020 14:21:20 +0100 From: Cornelia Huck To: Thomas Huth Cc: Christian Borntraeger , Janosch Frank , KVM , David Hildenbrand , Ulrich Weigand , Claudio Imbrenda , Andrea Arcangeli , linux-s390 , Michael Mueller , Vasily Gorbik , linux-mm@kvack.org, Andrew Morton Subject: Re: [PATCH 21/35] KVM: s390/mm: handle guest unpin events Message-ID: <20200211142120.6a57b970.cohuck@redhat.com> In-Reply-To: <2fd5c392-a2b7-c6b8-f079-8b87ee60f65e@redhat.com> References: <20200207113958.7320-1-borntraeger@de.ibm.com> <20200207113958.7320-22-borntraeger@de.ibm.com> <2fd5c392-a2b7-c6b8-f079-8b87ee60f65e@redhat.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 10 Feb 2020 15:58:11 +0100 Thomas Huth wrote: > On 07/02/2020 12.39, Christian Borntraeger wrote: > > From: Claudio Imbrenda > > > > The current code tries to first pin shared pages, if that fails (e.g. > > because the page is not shared) it will export them. For shared pages > > this means that we get a new intercept telling us that the guest is > > unsharing that page. We will make the page secure at that point in time > > and revoke the host access. This is synchronized with other host events, > > e.g. the code will wait until host I/O has finished. > > > > Signed-off-by: Claudio Imbrenda > > [borntraeger@de.ibm.com: patch merging, splitting, fixing] > > Signed-off-by: Christian Borntraeger > > --- > > arch/s390/kvm/intercept.c | 24 ++++++++++++++++++++++++ > > 1 file changed, 24 insertions(+) > > > > diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c > > index 2a966dc52611..e155389a4a66 100644 > > --- a/arch/s390/kvm/intercept.c > > +++ b/arch/s390/kvm/intercept.c > > @@ -16,6 +16,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "kvm-s390.h" > > #include "gaccess.h" > > @@ -484,12 +485,35 @@ static int handle_pv_sclp(struct kvm_vcpu *vcpu) > > return 0; > > } > > > > +static int handle_pv_uvc(struct kvm_vcpu *vcpu) > > +{ > > + struct uv_cb_share *guest_uvcb = (void *)vcpu->arch.sie_block->sidad; > > + struct uv_cb_cts uvcb = { > > + .header.cmd = UVC_CMD_UNPIN_PAGE_SHARED, > > + .header.len = sizeof(uvcb), > > + .guest_handle = kvm_s390_pv_handle(vcpu->kvm), > > + .gaddr = guest_uvcb->paddr, > > + }; > > + int rc; > > + > > + if (guest_uvcb->header.cmd != UVC_CMD_REMOVE_SHARED_ACCESS) { > > + WARN_ONCE(1, "Unexpected UVC 0x%x!\n", guest_uvcb->header.cmd); > > Is there a way to signal the failed command to the guest, too? I'm wondering at which layer the actual problem occurs here. Is it because a (new) command was not interpreted or rejected by the ultravisor so that it ended up being handled by the hypervisor? If so, what should the guest know? > > Thomas > > > > + return 0; > > + } > > + rc = uv_make_secure(vcpu->arch.gmap, uvcb.gaddr, &uvcb); > > + if (rc == -EINVAL && uvcb.header.rc == 0x104) This wants a comment. > > + return 0; > > + return rc; > > +} > > + > > static int handle_pv_notification(struct kvm_vcpu *vcpu) > > { > > if (vcpu->arch.sie_block->ipa == 0xb210) > > return handle_pv_spx(vcpu); > > if (vcpu->arch.sie_block->ipa == 0xb220) > > return handle_pv_sclp(vcpu); > > + if (vcpu->arch.sie_block->ipa == 0xb9a4) > > + return handle_pv_uvc(vcpu); Is it defined by the architecture what the possible commands are for which the hypervisor may get control? If we get something unexpected, is returning 0 the right strategy? > > > > return handle_instruction(vcpu); > > } > > >