Changeset f3dbe27 in mainline for kernel/generic/include/cpu.h


Ignore:
Timestamp:
2023-04-18T17:33:02Z (19 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
117ad5a2
Parents:
06f81c4
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-04-18 17:27:32)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-04-18 17:33:02)
Message:

Reduce locking further with lazy FPU

It turns out we only need a lock to synchronize between the trap
handler and thread destructor. The atomic operations introduced
are just plain reads and writes, written in an ugly fashion to
appease C11 undefined behavior gods.

In principle we could get rid of that if we made cpu_t::fpu_owner
a strong reference, but that would mean a thread structure could
be held in limbo indefinitely if a new thread is not being
scheduled or doesn't use FPU.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/cpu.h

    r06f81c4 rf3dbe27  
    9898
    9999#ifdef CONFIG_FPU_LAZY
     100        /* For synchronization between FPU trap and thread destructor. */
    100101        IRQ_SPINLOCK_DECLARE(fpu_lock);
    101         struct thread *fpu_owner;
    102102#endif
     103        _Atomic(struct thread *) fpu_owner;
    103104
    104105        /**
Note: See TracChangeset for help on using the changeset viewer.