Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste

From: Heiko Carstens
Date: Thu Jun 08 2017 - 09:17:35 EST


On Thu, Jun 08, 2017 at 01:24:01PM +0200, Martin Schwidefsky wrote:
> On Thu, 8 Jun 2017 08:25:31 +0200
> Heiko Carstens <heiko.carstens@xxxxxxxxxx> wrote:
> > It would be more consistent, since right now a 32-bit ELF file with
> > PT_S390_REQUEST_PGSTE will be exectuted, but the page tables won't have any
> > pgstes. That's sort of odd, isn't it? And that later on it won't be able to
> > create a virtual machine because our current implementation doesn't allow
> > that for compat tasks is sort of unrelated.
> > But anyway, I'll leave that up to you, it doesn't really matter.
>
> Actually the code will be less complex if we add PT_S390_REQUEST_PGSTE for
> 32-bit ELF files as well. It does not make sense to define the segment for
> a compat process as KVM won't work but you get what you ask for..
>
> This looks like this:
>
> #define arch_elf_pt_proc(ehdr, phdr, elf, interp, state) \
> ({ \
> int _rc = 0; \
> if (phdr->p_type == PT_S390_REQUEST_PGSTE && \
> !page_table_allocate_pgste && \
> !test_thread_flag(TIF_REQUEST_PGSTE)) { \
> set_thread_flag(TIF_REQUEST_PGSTE); \
> set_pt_regs_flag(task_pt_regs(current), \
> PIF_SYSCALL_RESTART); \
> _rc = -EAGAIN; \
> } \
> _rc; \
> })
>
> phdr is a (struct elf_phd *) which is either define to a a (struct elf64_phdr *)
> or a (struct elf32_phdr *). The check works in both cases.

Yes, that makes sense.