Re: [PATCH 2/3] MIPS: Setup an instruction emulation in VDSO protected page instead of user stack

From: Leonid Yegoshin
Date: Mon Oct 06 2014 - 16:42:46 EST


On 10/06/2014 05:29 AM, Paul Burton wrote:


First some general questions: is there any reason to need the page used
to be at the same virtual address for each thread? I can't think of one,
and if that's the case then why not simply allocate a series of pages
per-thread via mmap_region or similar, on demand when a thread first
executes an FP branch instruction? That would of course consume some
more virtual address space, but would avoid the hassles of manually
prodding at the TLB, tracking ASIDs & flushing the caches. Perhaps the
shrinker interface could be used to allow freeing those pages if & when
it becomes necessary for long running threads.
The only reason to have the same virtual address is to keep mmap accounting the same. An original 'VDSO' is presented in mmap for all threads of the same mmap.

As for another approach, I think it may be too much code to handle it and too much implicit interlinks with common Linux code and GLIBC/bionic.


Also VDSO is really a misnomer throughout, as I've pointed out to you
before. I'm aware it's an existing misnomer, but it would be nice if
we could clear that up rather than repeat it...

Yes, I agree but that is outside of this patch. I think it has sense to rename the current stuff to something like "Emulation" right before some patch which implement the real VDSO capability on MIPS.

+ if (get_isa16_mode(regs->cp0_epc)) {
+ *(u16 *)&fr->emul = (u16)(ir >> 16);
+ *((u16 *)(&fr->emul) + 1) = (u16)(ir & 0xffff);
This microMIPS case doesn't set badinst, as I pointed out internally.
Thank you, I missed it, may be due to long citation. I will add it.

I
think it would be much cleaner if you were to do something along the
lines of:

I try to keep it as close as an original code for better understanding. Even with it there are questions.

Your variant may be cleaner but it may be some next style change patch.

- Leonid.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/