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=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no 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 C0A45C33CA1 for ; Wed, 5 Feb 2020 10:35:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CCFD2082E for ; Wed, 5 Feb 2020 10:35:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fOqBb0iU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728342AbgBEKfd (ORCPT ); Wed, 5 Feb 2020 05:35:33 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:56777 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728326AbgBEKfd (ORCPT ); Wed, 5 Feb 2020 05:35:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580898933; 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=86nRbPB17Rpx5sftghR+HRhj/x2mXpTYA88mJxOXZ8M=; b=fOqBb0iUw1miMmCJl+qrPqJ61vNMY6AHBk8mz/7cPgjJx4dq/ViyTfl6MMdz6oDun3Jg6v nH8c8DQINhwxRIksyNXZyL5gPcPXOCPf/8JccOlVw+PdM0GN/5qCfa6zwd0gZZ4VHFY+rq xYtguppYYH/G5QjpAvjCtwbrd00alrE= 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-90-m6loMD6bNWG8bYvRxfIO3A-1; Wed, 05 Feb 2020 05:35:28 -0500 X-MC-Unique: m6loMD6bNWG8bYvRxfIO3A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 621B91075920; Wed, 5 Feb 2020 10:35: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 4EF8D60BF4; Wed, 5 Feb 2020 10:35:23 +0000 (UTC) Date: Wed, 5 Feb 2020 11:35:20 +0100 From: Cornelia Huck To: Christian Borntraeger Cc: Janosch Frank , KVM , David Hildenbrand , Thomas Huth , Ulrich Weigand , Claudio Imbrenda , Andrea Arcangeli Subject: Re: [RFCv2 11/37] KVM: s390/mm: Make pages accessible before destroying the guest Message-ID: <20200205113520.1a90f3d1.cohuck@redhat.com> In-Reply-To: <20200203131957.383915-12-borntraeger@de.ibm.com> References: <20200203131957.383915-1-borntraeger@de.ibm.com> <20200203131957.383915-12-borntraeger@de.ibm.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.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 3 Feb 2020 08:19:31 -0500 Christian Borntraeger wrote: > Before we destroy the secure configuration, we better make all > pages accessible again. This also happens during reboot, where we reboot > into a non-secure guest that then can go again into a secure mode. As s/a secure/secure/ > this "new" secure guest will have a new ID we cannot reuse the old page > state. > > Signed-off-by: Christian Borntraeger > --- > arch/s390/include/asm/pgtable.h | 1 + > arch/s390/kvm/pv.c | 2 ++ > arch/s390/mm/gmap.c | 35 +++++++++++++++++++++++++++++++++ > 3 files changed, 38 insertions(+) (...) > +void s390_reset_acc(struct mm_struct *mm) > +{ > + /* > + * we might be called during > + * reset: we walk the pages and clear > + * close of all kvm file descriptor: we walk the pages and clear s/descriptor/descriptors/ > + * exit of process on fd closure: vma already gone, do nothing > + */ > + if (!mmget_not_zero(mm)) > + return; > + down_read(&mm->mmap_sem); > + walk_page_range(mm, 0, TASK_SIZE, &reset_acc_walk_ops, NULL); > + up_read(&mm->mmap_sem); > + mmput(mm); > +} > +EXPORT_SYMBOL_GPL(s390_reset_acc); Reviewed-by: Cornelia Huck