public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/39677]  New: AMD Opteron E needs workaround for lock erratum
@ 2009-04-07 13:36 bonzini at gnu dot org
  2009-04-07 13:42 ` [Bug middle-end/39677] " bonzini at gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: bonzini at gnu dot org @ 2009-04-07 13:36 UTC (permalink / raw)
  To: gcc-bugs

From
http://code.google.com/p/google-perftools/source/browse/trunk/src/base/atomicops-internals-x86.h

  bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence
                            // after acquire compare-and-swap.

...

inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
                                         Atomic32 old_value,
                                         Atomic32 new_value) {
  Atomic32 prev;
  __asm__ __volatile__("lock; cmpxchgl %1,%2"
                       : "=a" (prev)
                       : "q" (new_value), "m" (*ptr), "0" (old_value)
                       : "memory");
  return prev;
}

inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
                                       Atomic32 old_value,
                                       Atomic32 new_value) {
  Atomic32 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
  if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
    __asm__ __volatile__("lfence" : : : "memory");
  }
  return x;
}

inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
                                       Atomic32 old_value,
                                       Atomic32 new_value) {
  return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
}

This bug can also affect lock+xadd combinations.


-- 
           Summary: AMD Opteron E needs workaround for lock erratum
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzini at gnu dot org
GCC target triplet: i386-*-*, x86_64-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39677


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/39677] AMD Opteron E needs workaround for lock erratum
  2009-04-07 13:36 [Bug middle-end/39677] New: AMD Opteron E needs workaround for lock erratum bonzini at gnu dot org
@ 2009-04-07 13:42 ` bonzini at gnu dot org
  2009-04-07 15:02 ` bonzini at gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: bonzini at gnu dot org @ 2009-04-07 13:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bonzini at gnu dot org  2009-04-07 13:42 -------
More info from Solaris bug # 6323525:

if (number_of_cores() < 2) then don't have bug
if (family == 0xf && Model < 0x40) then have bug
if (rdmsr(MSR_BU_CFG/*0xC0011023*/) & 2) then bug is masked

See also http://bugzilla.kernel.org/show_bug.cgi?id=11305


-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-07 13:42:25
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39677


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/39677] AMD Opteron E needs workaround for lock erratum
  2009-04-07 13:36 [Bug middle-end/39677] New: AMD Opteron E needs workaround for lock erratum bonzini at gnu dot org
  2009-04-07 13:42 ` [Bug middle-end/39677] " bonzini at gnu dot org
@ 2009-04-07 15:02 ` bonzini at gnu dot org
  2009-10-13  1:07 ` [Bug target/39677] " rth at gcc dot gnu dot org
  2009-12-07 16:12 ` rth at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: bonzini at gnu dot org @ 2009-04-07 15:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bonzini at gnu dot org  2009-04-07 15:02 -------
I cannot see any better alternative, but I'll point out that saying
"wrong-code" is not exact.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39677


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/39677] AMD Opteron E needs workaround for lock erratum
  2009-04-07 13:36 [Bug middle-end/39677] New: AMD Opteron E needs workaround for lock erratum bonzini at gnu dot org
  2009-04-07 13:42 ` [Bug middle-end/39677] " bonzini at gnu dot org
  2009-04-07 15:02 ` bonzini at gnu dot org
@ 2009-10-13  1:07 ` rth at gcc dot gnu dot org
  2009-12-07 16:12 ` rth at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: rth at gcc dot gnu dot org @ 2009-10-13  1:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rth at gcc dot gnu dot org  2009-10-13 01:07 -------
Not an openmp bug; we've got to make the change for all code gcc generates.


-- 

rth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
          Component|middle-end                  |target
           Keywords|openmp                      |
   Last reconfirmed|2009-04-07 13:42:25         |2009-10-13 01:07:32
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39677


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/39677] AMD Opteron E needs workaround for lock erratum
  2009-04-07 13:36 [Bug middle-end/39677] New: AMD Opteron E needs workaround for lock erratum bonzini at gnu dot org
                   ` (2 preceding siblings ...)
  2009-10-13  1:07 ` [Bug target/39677] " rth at gcc dot gnu dot org
@ 2009-12-07 16:12 ` rth at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: rth at gcc dot gnu dot org @ 2009-12-07 16:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rth at gcc dot gnu dot org  2009-12-07 16:12 -------
Not working on it any longer.


-- 

rth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rth at gcc dot gnu dot org  |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39677


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/39677] AMD Opteron E needs workaround for lock erratum
       [not found] <bug-39677-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-19 18:28 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-19 18:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39677

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So reading https://www.amd.com/system/files/TechDocs/25759.pdf and errata #147,
the errata only occurs if lock is not there:
The erratum will not occur if there is a LOCK prefix on the read-modify-write
instruction. 

And GCC never emits a cmpxchg without a lock prefix so there is nothing to be
done.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-19 18:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-07 13:36 [Bug middle-end/39677] New: AMD Opteron E needs workaround for lock erratum bonzini at gnu dot org
2009-04-07 13:42 ` [Bug middle-end/39677] " bonzini at gnu dot org
2009-04-07 15:02 ` bonzini at gnu dot org
2009-10-13  1:07 ` [Bug target/39677] " rth at gcc dot gnu dot org
2009-12-07 16:12 ` rth at gcc dot gnu dot org
     [not found] <bug-39677-4@http.gcc.gnu.org/bugzilla/>
2021-07-19 18:28 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).