Re: [PATCH 2/3] skip_prolgoue (amd64)

Yao Qi
2013-12-02T07:34:43Z

On 11/30/2013 06:11 PM, Pedro Alves wrote:
> It seems like we can "dangerously" hit stale cache (probably most
> visible with non-stop mode) between target events:
>
> #1 - all threads set running, dcache is invalidated
>
> #2 - thread 1 stops. As we handle the event, we read code, and cache it.
>
> #3 - others threads continue running. some thread jits something, or
> changes code that was cached.
>
> #4 - thread 2 stops. As we handle the event, we read code, hitting
> stale cache.
>

Yeah, that is a valid case to me.

>
> I'm thinking we might need to flush the dcache before handling each
> event, like we already invalidate the overlay cache (see
> "overlay_cache_invalid = 1" in infrun.c) ?

I don't know why overlay cache is flushed in each event. Doing some
archaeology doesn't give me any clue. I doubt that the overly may
change between any two events. It (flushing overlay cache) looks not
necessary to me, at least, when overlay events breakpoint is enabled.

GDB target cache contains both code cache and stack cache. GDB can
know the JIT event by means of jit event breakpoint, but GDB can't know
whether a thread's stack is modified (by other threads). So we have
to flush target cache before handling *every* event :-/ I'll send a
follow-up patch.

--
Yao (é½å°§)