Opened 6 years ago

Closed 6 years ago

#11121 closed bug (fixed)

Set return value of atomic_get_and_set to prevent attempting to acquire spinlock twice

Reported by: arvindsraj Owned by: axeld
Priority: normal Milestone: R1
Component: System/Boot Loader Version: R1/Development
Keywords: gsoc2014 Cc:
Blocked By: Blocking:
Platform: arm


The return value of atomic_get_and_set isn't set which causes the kernel to incorrectly assume that the spinlock has not been acquired and causes a panic(KDL) when trying to acquire it again.

Attachments (2)

Set-return-value-of-atomic_get_and_set.patch (1.0 KB ) - added by arvindsraj 6 years ago.
Reimplemented-atomic_get_and_set-in-C++.patch (3.4 KB ) - added by arvindsraj 6 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by arvindsraj, 6 years ago

patch: 01

comment:2 by pulkomandy, 6 years ago

pdziepak proposed a C++ implementation of this, which could be used in a cross platform way:

int32_t atomic_get_and_set(int32_t* ptr, int32_t value)
    auto& obj = *reinterpret_cast<std::atomic<int32_t>*>(ptr);

This would make things work for all platforms, however it uses the C++11 std::atomic so we have to keep the current implementation at least for x86_gcc2. But it would be best to have all gcc4 platforms use this.

comment:3 by arvindsraj, 6 years ago

In the newly uploaded patch, I've reimplemented atomic_get_and_set in C++.

comment:4 by pulkomandy, 6 years ago

Resolution: fixed
Status: newclosed

Applied in hrev47708.

Note: See TracTickets for help on using tickets.