[PATCH] [RFC] Emulate "lwsync" to run standard user land on e500 cores

David Laight David.Laight at ACULAB.COM
Thu Oct 24 21:18:57 EST 2013


> Subject: Re: [PATCH] [RFC] Emulate "lwsync" to run standard user land on e500 cores
> 
> 
> On Oct 23, 2013, at 5:15 AM, Scott Wood wrote:
> 
> > On Wed, 2013-10-23 at 00:07 -0500, Kumar Gala wrote:
> >> On Oct 18, 2013, at 2:38 AM, Wolfgang Denk wrote:
> >>> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> >>> index f783c93..f330374 100644
> >>> --- a/arch/powerpc/kernel/traps.c
> >>> +++ b/arch/powerpc/kernel/traps.c
> >>> @@ -986,6 +986,13 @@ static int emulate_instruction(struct pt_regs *regs)
> >>> 		return 0;
> >>> 	}
> >>>
> >>> +	/* Emulating the lwsync insn as a sync insn */
> >>> +	if (instword == PPC_INST_LWSYNC) {
> >>> +		PPC_WARN_EMULATED(lwsync, regs);
> >>> +		asm volatile("sync" : : : "memory");
...
> I'm not sure I'm a fan of doing this as it silently hides a significant performance impact.
> 
> Could we possible re-write the userspace instruction to be a 'sync' when we hit this?

You'd need to modify the memory without marking the page dirty.
(Which might be interesting for other cpu-dependant optimisations.)

	David





More information about the Linuxppc-dev mailing list