Re: sinval synchronization considered harmful - Mailing list pgsql-hackers

From Tom Lane
Subject Re: sinval synchronization considered harmful
Date
Msg-id 17893.1311717856@sss.pgh.pa.us
Whole thread Raw
In response to Re: sinval synchronization considered harmful  (Noah Misch <noah@2ndQuadrant.com>)
Responses Re: sinval synchronization considered harmful
List pgsql-hackers
Noah Misch <noah@2ndQuadrant.com> writes:
> On Tue, Jul 26, 2011 at 05:05:15PM -0400, Tom Lane wrote:
>> Dirty cache line, maybe not, but what if the assembly code commands the
>> CPU to load those variables into CPU registers before doing the
>> comparison?  If they're loaded with maxMsgNum coming in last (or at
>> least after resetState), I think you can have the problem without any
>> assumptions about cache line behavior at all.  You just need the process
>> to lose the CPU at the right time.

> True.  If the compiler places the resetState load first, you could hit the
> anomaly by "merely" setting a breakpoint on the next instruction, waiting for
> exactly MSGNUMWRAPAROUND messages to enqueue, and letting the backend continue.
> I think, though, we should either plug that _and_ the cache incoherency case or
> worry about neither.

How do you figure that?  The poor-assembly-code-order risk is both a lot
easier to fix and a lot higher probability.  Admittedly, it's still way
way down there, but you only need a precisely-timed sleep, not a
precisely-timed sleep *and* a cache line that somehow remained stale.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: sinval synchronization considered harmful
Next
From: David Fetter
Date:
Subject: Re: [COMMITTERS] pgsql: Add missing newlines at end of error messages