Changeset 8addb24a in mainline


Ignore:
Timestamp:
2023-02-03T17:01:49Z (22 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
aae2869
Parents:
64e9cf4
Message:

Turn spin look hint into a function

Location:
kernel
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/include/arch/asm.h

    r64e9cf4 r8addb24a  
    6767}
    6868
     69_NO_TRACE static inline void cpu_spin_hint(void)
     70{
     71        /*
     72         * Some ISAs have a special instruction for the body of a busy wait loop,
     73         * such as in spinlock and the like. Using it allows the CPU to optimize
     74         * its operation. For an example, see the "pause" instruction on x86.
     75         */
     76}
     77
    6978_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
    7079{
  • kernel/arch/amd64/include/arch/asm.h

    r64e9cf4 r8addb24a  
    5959}
    6060
    61 #define ARCH_SPIN_HINT() asm volatile ("pause\n")
     61_NO_TRACE static inline void cpu_spin_hint(void)
     62{
     63        asm volatile (
     64            "pause\n"
     65        );
     66}
    6267
    6368/** Byte from port
  • kernel/arch/arm32/include/arch/asm.h

    r64e9cf4 r8addb24a  
    6565}
    6666
     67_NO_TRACE static inline void cpu_spin_hint(void)
     68{
    6769#ifdef PROCESSOR_ARCH_armv7_a
    68 #define ARCH_SPIN_HINT() asm volatile ("yield")
     70        asm volatile ("yield");
    6971#endif
     72}
    7073
    7174_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
  • kernel/arch/arm64/include/arch/asm.h

    r64e9cf4 r8addb24a  
    6161}
    6262
    63 #define ARCH_SPIN_HINT() asm volatile ("yield")
     63_NO_TRACE static inline void cpu_spin_hint(void)
     64{
     65        asm volatile ("yield");
     66}
    6467
    6568/** Output byte to port.
  • kernel/arch/ia32/include/arch/asm.h

    r64e9cf4 r8addb24a  
    6464}
    6565
    66 #define ARCH_SPIN_HINT() asm volatile ("pause\n")
     66_NO_TRACE static inline void cpu_spin_hint(void)
     67{
     68        asm volatile (
     69            "pause\n"
     70        );
     71}
    6772
    6873#define GEN_READ_REG(reg) _NO_TRACE static inline sysarg_t read_ ##reg (void) \
  • kernel/arch/ia64/include/arch/asm.h

    r64e9cf4 r8addb24a  
    4444#define IO_SPACE_BOUNDARY       ((void *) (64 * 1024))
    4545
     46_NO_TRACE static inline void cpu_spin_hint(void)
     47{
     48}
     49
    4650/** Map the I/O port address to a legacy I/O address. */
    4751_NO_TRACE static inline uintptr_t p2a(volatile void *p)
  • kernel/arch/mips32/include/arch/asm.h

    r64e9cf4 r8addb24a  
    4545}
    4646
     47_NO_TRACE static inline void cpu_spin_hint(void)
     48{
     49}
     50
    4751_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
    4852{
  • kernel/arch/ppc32/include/arch/asm.h

    r64e9cf4 r8addb24a  
    4242#include <trace.h>
    4343
     44_NO_TRACE static inline void cpu_spin_hint(void)
     45{
     46}
     47
    4448_NO_TRACE static inline uint32_t msr_read(void)
    4549{
  • kernel/arch/riscv64/include/arch/asm.h

    r64e9cf4 r8addb24a  
    4141#include <arch/mm/asid.h>
    4242#include <trace.h>
     43
     44_NO_TRACE static inline void cpu_spin_hint(void)
     45{
     46}
    4347
    4448_NO_TRACE static inline ipl_t interrupts_enable(void)
  • kernel/arch/sparc64/include/arch/asm.h

    r64e9cf4 r8addb24a  
    4444#include <trace.h>
    4545
     46_NO_TRACE static inline void cpu_spin_hint(void)
     47{
     48}
     49
    4650_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
    4751{
  • kernel/generic/src/synch/spinlock.c

    r64e9cf4 r8addb24a  
    4949#include <cpu.h>
    5050
    51 #ifndef ARCH_SPIN_HINT
    52 #define ARCH_SPIN_HINT() ((void)0)
    53 #endif
    54 
    5551/** Initialize spinlock
    5652 *
     
    8278
    8379        while (atomic_flag_test_and_set_explicit(&lock->flag, memory_order_acquire)) {
    84                 ARCH_SPIN_HINT();
     80                cpu_spin_hint();
    8581
    8682#ifdef CONFIG_DEBUG_SPINLOCK
Note: See TracChangeset for help on using the changeset viewer.