Re: [RFC v2 3/3] atomic: Add alignment check to instrumented atomic operations

From: Brad Boyer

Date: Tue Sep 16 2025 - 18:12:48 EST


On Tue, Sep 16, 2025 at 02:37:21PM +0200, Arnd Bergmann wrote:
> arch/m68k selects CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS for anything
> other than Dragonball, so I would not expect much performance difference
> at all, unless CASL on unaligned data ends up causing alignment traps
> as it does on most architectures.

I believe it depends on the exact CPU. The 68060 user manual has a
section called "Emulating CAS2 and CAS Misaligned" discussing the
handling of such instances through software emulation. The 68040
user manual doesn't have any similar section. I haven't looked at
the exception handlers in the kernel to see if such cases are being
handled. The documentation says it results in an unimplemented
integer exception, and the handler has to manually lock the bus
while performing normal memory operations.

Brad Boyer
flar@xxxxxxxxxxxxx