kernel/smp: Distinguish CPUSet::GetBit from GetBitAtomic.
I checked all invocations of GetBit; as far as I can tell, only the two adjusted here in smp.cpp are done while the Set may be concurrently modified, and even then I don't know that they really need to be atomics, anyway.
This commit is contained in:
@@ -54,6 +54,7 @@ public:
|
||||
inline void ClearBitAtomic(int32 cpu);
|
||||
|
||||
inline bool GetBit(int32 cpu) const;
|
||||
inline bool GetBitAtomic(int32 cpu) const;
|
||||
|
||||
inline bool Matches(const CPUSet& mask) const;
|
||||
inline CPUSet And(const CPUSet& mask) const;
|
||||
@@ -161,6 +162,14 @@ CPUSet::ClearBitAtomic(int32 cpu)
|
||||
|
||||
inline bool
|
||||
CPUSet::GetBit(int32 cpu) const
|
||||
{
|
||||
int32* element = (int32*)&fBitmap[cpu / kArrayBits];
|
||||
return ((uint32)*element & (1u << (cpu % kArrayBits))) != 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
CPUSet::GetBitAtomic(int32 cpu) const
|
||||
{
|
||||
int32* element = (int32*)&fBitmap[cpu / kArrayBits];
|
||||
return ((uint32)atomic_get(element) & (1u << (cpu % kArrayBits))) != 0;
|
||||
|
||||
@@ -760,7 +760,7 @@ check_for_message(int currentCPU, mailbox_source& sourceMailbox)
|
||||
|
||||
msg = sBroadcastMessages;
|
||||
while (msg != NULL) {
|
||||
if (!msg->proc_bitmap.GetBit(currentCPU)) {
|
||||
if (!msg->proc_bitmap.GetBitAtomic(currentCPU)) {
|
||||
// we have handled this one already
|
||||
msg = msg->next;
|
||||
continue;
|
||||
@@ -1260,7 +1260,7 @@ smp_trap_non_boot_cpus(int32 cpu, uint32* rendezVous)
|
||||
smp_cpu_rendezvous(rendezVous);
|
||||
|
||||
while (sBootCPUSpin == 0) {
|
||||
if (sEarlyCPUCallSet.GetBit(cpu))
|
||||
if (sEarlyCPUCallSet.GetBitAtomic(cpu))
|
||||
process_early_cpu_call(cpu);
|
||||
|
||||
cpu_pause();
|
||||
|
||||
Reference in New Issue
Block a user