From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Carstens Subject: Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Date: Fri, 2 Jun 2017 12:28:48 +0200 Message-ID: <20170602102848.GC4221@osiris> References: <20170529163202.13077-1-david@redhat.com> <20170601124651.3e7969ab@mschwideX1> <20170602070210.GA4221@osiris> <20170602114647.35e6d30f@mschwideX1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Hildenbrand , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Huth , Christian Borntraeger To: Martin Schwidefsky Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54560 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbdFBK24 (ORCPT ); Fri, 2 Jun 2017 06:28:56 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v52ASqaA121341 for ; Fri, 2 Jun 2017 06:28:56 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2au1hccct4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 02 Jun 2017 06:28:56 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Jun 2017 11:28:53 +0100 Content-Disposition: inline In-Reply-To: <20170602114647.35e6d30f@mschwideX1> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Jun 02, 2017 at 11:46:47AM +0200, Martin Schwidefsky wrote: > On Fri, 2 Jun 2017 09:02:10 +0200 > Heiko Carstens wrote: > > Maybe this is a bit over-simplified, but might work. > This is not over-simplified at all, that does work: Good! > +struct arch_elf_state { > +}; > + > +#define INIT_ARCH_ELF_STATE { } > + > +#define arch_elf_pt_proc(ehdr, phdr, elf, interp, state) (0) > +#define arch_check_elf(ehdr, interp, interp_ehdr, state) \ > +({ \ > + struct elf64_hdr *hdr = (void*) ehdr; \ > + int _rc = 0; \ > + if (hdr->e_ident[EI_CLASS] == ELFCLASS64 && \ > + (hdr->e_flags & 0x00000002) && \ > + !page_table_allocate_pgste && \ > + !current->mm->context.alloc_pgste) { \ > + current->mm->context.alloc_pgste = 1; \ However, I think this is over-simplified, unless I'm mistaken. If you set current->mm->context.alloc_pgste here, then that means that 4k page tables will be freed when the original mm will be released, instead of the correct 2k ones. I think you need an additional intermediate context flag here. Something like current->mm->context.request_pgste or whatever, no?