[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: About gcc builtin atomics



On Tue, Jun 26, 2012 at 11:30 AM, Mikael Pettersson <mikpe@it.uu.se> wrote:
> On Tue, 26 Jun 2012 10:48:02 +0200, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> On Tue, Jun 26, 2012 at 10:26 AM, Thorsten Glaser <tg@mirbsd.de> wrote:
>> > Geert Uytterhoeven dixit:
>> >
>> >>Even if they're fixed on ARAnyM, this doesn't fix the CAS problems on sev=
>> eral
>> >>instantations of real hardware....
>> >
>> > Right. That=E2=80=99s why we use the syscall always. OK.
>> > (On Linux, but not on e.g. FreeMiNT.)
>>
>> FreeMiNT on which hardware?
>>
>> arch/m68k/Kconfig.cpu has:
>>
>> config RMW_INSNS
>>     bool "Use read-modify-write instructions"
>>     depends on ADVANCED
>>     ---help---
>>       This allows to use certain instructions that work with indivisible
>>       read-modify-write bus cycles. While this is faster than the
>>       workaround of disabling interrupts, it can conflict with DMA
>>       ( = direct memory access) on many Amiga systems, and it is also said
>>       to destabilize other machines. It is very likely that this will
>>       cause serious problems on any Amiga or Atari Medusa if set. The only
>>       configuration where it should work are 68030-based Ataris, where it
>>       apparently improves performance. But you've been warned! Unless you
>>       really know what you are doing, say N. Try Y only if you're quite
>>       adventurous.
>
> I'd really like to see a more detailed description of the platform
> issue.  For starters,
>
> 1. "conflict with DMA" is very vague, what exactly are the symptoms?

If both the CPU and the DMA device assert the data lines on the bus
during a write-cycle, memory corruption will handle.

On Amiga, Chip RAM is known not to support RMW cycles, as the even
bus cycles are reserved for the Amiga custom chips, and the odd for the
CPU. RMW uses two successive bus cycles.

The hardware MMU page table updates are also RMW cycles, so it
should work fine on other RAM?

> 2. "said to destabilize other machines" is also very vague, details?
> 3. are the 030s OK everywhere or just on Atari? what about 040s?

I don't remember the details.

> 4. the option description says nothing about user-space; as the gcc
>   code is for shared variables in normal user-space program memory
>   rather than e.g. accessing control registers in MMIO space, it's
>   entirely possible that CAS is OK in user-space (at least as long
>   as mmap of MMIO space is disallowed)

On Amiga, it depends on which memory is accessed. E.g. if you mmap
the frame buffer, that'll be Chip RAM, and using CAS on that is unsafe.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


Reply to: