Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751288AbdFBKyV (ORCPT ); Fri, 2 Jun 2017 06:54:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35980 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbdFBKyT (ORCPT ); Fri, 2 Jun 2017 06:54:19 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DBFBA81241 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DBFBA81241 Subject: Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste To: Heiko Carstens , Martin Schwidefsky Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Huth , Christian Borntraeger References: <20170529163202.13077-1-david@redhat.com> <20170601124651.3e7969ab@mschwideX1> <20170602070210.GA4221@osiris> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <8d240bf8-9450-d3de-6f38-706bbfa71393@redhat.com> Date: Fri, 2 Jun 2017 12:54:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170602070210.GA4221@osiris> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 02 Jun 2017 10:54:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1476 Lines: 37 On 02.06.2017 09:02, Heiko Carstens wrote: > On Thu, Jun 01, 2017 at 12:46:51PM +0200, Martin Schwidefsky wrote: >>> Unfortunately, converting all page tables to 4k pgste page tables is >>> not possible without provoking various race conditions. >> >> That is one approach we tried and was found to be buggy. The point is that >> you are not allowed to reallocate a page table while a VMA exists that is >> in the address range of that page table. >> >> Another approach we tried is to use an ELF flag on the qemu executable. >> That does not work either because fs/exec.c allocates and populates the >> new mm struct for the argument pages before fs/binfmt_elf.c comes into >> play. > > How about if you would fail the system call within arch_check_elf() if you > detect that the binary requires pgstes (as indicated by elf flags) and then > restart the system call? > > That is: arch_check_elf() e.g. would set a thread flag that future mm's > should be allocated with pgstes. Then do_execve() would cleanup everything > and return to entry.S. Upon return to userspace we detect this condition > and simply restart the system call, similar to signals vs -ERESTARTSYS. > > That would make do_execve() cleanup everything and upon reentering it would > allocate an mm with the pgste flag set. Cool, I thought that we would not be able to get around having to make a decision at fork time, but this really looks promising. Thanks for this idea Heiko! -- Thanks, David