xref: /linux/Documentation/features/sched/membarrier-sync-core/arch-support.txt (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
16a546c7eSMathieu Desnoyers#
26a546c7eSMathieu Desnoyers# Feature name:          membarrier-sync-core
36a546c7eSMathieu Desnoyers#         Kconfig:       ARCH_HAS_MEMBARRIER_SYNC_CORE
46a546c7eSMathieu Desnoyers#         description:   arch supports core serializing membarrier
56a546c7eSMathieu Desnoyers#
66a546c7eSMathieu Desnoyers# Architecture requirements
76a546c7eSMathieu Desnoyers#
8e7615c92SHeiko Carstens# * arm/arm64/powerpc/s390
96a546c7eSMathieu Desnoyers#
10e69244d2SWill Deacon# Rely on implicit context synchronization as a result of exception return
11e69244d2SWill Deacon# when returning from IPI handler, and when returning to user-space.
126a546c7eSMathieu Desnoyers#
13*cd9b2901SAndrea Parri# * riscv
14*cd9b2901SAndrea Parri#
15*cd9b2901SAndrea Parri# riscv uses xRET as return from interrupt and to return to user-space.
16*cd9b2901SAndrea Parri#
17*cd9b2901SAndrea Parri# Given that xRET is not core serializing, we rely on FENCE.I for providing
18*cd9b2901SAndrea Parri# core serialization:
19*cd9b2901SAndrea Parri#
20*cd9b2901SAndrea Parri#  - by calling sync_core_before_usermode() on return from interrupt (cf.
21*cd9b2901SAndrea Parri#    ipi_sync_core()),
22*cd9b2901SAndrea Parri#
23*cd9b2901SAndrea Parri#  - via switch_mm() and sync_core_before_usermode() (respectively, for
24*cd9b2901SAndrea Parri#    uthread->uthread and kthread->uthread transitions) before returning
25*cd9b2901SAndrea Parri#    to user-space.
26*cd9b2901SAndrea Parri#
27*cd9b2901SAndrea Parri#  The serialization in switch_mm() is activated by prepare_sync_core_cmd().
28*cd9b2901SAndrea Parri#
296a546c7eSMathieu Desnoyers# * x86
306a546c7eSMathieu Desnoyers#
316a546c7eSMathieu Desnoyers# x86-32 uses IRET as return from interrupt, which takes care of the IPI.
326a546c7eSMathieu Desnoyers# However, it uses both IRET and SYSEXIT to go back to user-space. The IRET
336a546c7eSMathieu Desnoyers# instruction is core serializing, but not SYSEXIT.
346a546c7eSMathieu Desnoyers#
356a546c7eSMathieu Desnoyers# x86-64 uses IRET as return from interrupt, which takes care of the IPI.
366a546c7eSMathieu Desnoyers# However, it can return to user-space through either SYSRETL (compat code),
376a546c7eSMathieu Desnoyers# SYSRETQ, or IRET.
386a546c7eSMathieu Desnoyers#
396a546c7eSMathieu Desnoyers# Given that neither SYSRET{L,Q}, nor SYSEXIT, are core serializing, we rely
406a546c7eSMathieu Desnoyers# instead on write_cr3() performed by switch_mm() to provide core serialization
416a546c7eSMathieu Desnoyers# after changing the current mm, and deal with the special case of kthread ->
426a546c7eSMathieu Desnoyers# uthread (temporarily keeping current mm into active_mm) by issuing a
436a546c7eSMathieu Desnoyers# sync_core_before_usermode() in that specific case.
446a546c7eSMathieu Desnoyers#
456a546c7eSMathieu Desnoyers    -----------------------
466a546c7eSMathieu Desnoyers    |         arch |status|
476a546c7eSMathieu Desnoyers    -----------------------
486a546c7eSMathieu Desnoyers    |       alpha: | TODO |
496a546c7eSMathieu Desnoyers    |         arc: | TODO |
50e69244d2SWill Deacon    |         arm: |  ok  |
516a546c7eSMathieu Desnoyers    |       arm64: |  ok  |
528a5aaf97SGuo Ren    |        csky: | TODO |
536a546c7eSMathieu Desnoyers    |     hexagon: | TODO |
54cc8c418bSTiezhu Yang    |   loongarch: | TODO |
556a546c7eSMathieu Desnoyers    |        m68k: | TODO |
566a546c7eSMathieu Desnoyers    |  microblaze: | TODO |
576a546c7eSMathieu Desnoyers    |        mips: | TODO |
586a546c7eSMathieu Desnoyers    |       nios2: | TODO |
596a546c7eSMathieu Desnoyers    |    openrisc: | TODO |
606a546c7eSMathieu Desnoyers    |      parisc: | TODO |
612384b36fSNicholas Piggin    |     powerpc: |  ok  |
62*cd9b2901SAndrea Parri    |       riscv: |  ok  |
63e7615c92SHeiko Carstens    |        s390: |  ok  |
646a546c7eSMathieu Desnoyers    |          sh: | TODO |
656a546c7eSMathieu Desnoyers    |       sparc: | TODO |
666a546c7eSMathieu Desnoyers    |          um: | TODO |
676a546c7eSMathieu Desnoyers    |         x86: |  ok  |
686a546c7eSMathieu Desnoyers    |      xtensa: | TODO |
696a546c7eSMathieu Desnoyers    -----------------------
70