Skip to content

s390: More this_cpu_*() changes

Heiko Carstens linux-s390 lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest11 patches 4 repliesIn review
  2. v311 patches 4 repliesSuperseded
  3. v212 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v112 patches0 repliesSuperseded

Changes in v4 from the cover letter

- With the change to la instead of agrk also the register pair cannot be mapped to gpr0/gpr1 anymore, since all three registers involved in pcpu operations are now used as base or index registers. If gpr0 is used as base or index register the corresponding instructions treat the content of that register as zero, instead of using its real content. Fix that by using the "a" instead if "d" constraint for register pairs. Also add another sanity check to cover this. [Sashiko]

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11s390/percpu: Fix comment typoarch/s390/include/asm/percpu.h+1 -10 replies
2/11s390/percpu: Add sanity check to GEN_MVIY macroarch/s390/include/asm/percpu.h+7 -20 replies
3/11s390/lowcore: Remove _AC() from LOWCORE_ALT_ADDRESSarch/s390/include/asm/lowcore.h+1 -10 replies
4/11s390/percpu: Let MVIY_PERCPU() calculate alternative displacementarch/s390/include/asm/percpu.h+29 -390 replies
5/11s390/percpu/lowcore: Add and use LC_PERCPU lowcore offset definesarch/s390/include/asm/entry-percpu.h arch/s390/include/asm/lowcore.h arch/s390/include/asm/percpu.h+20 -320 replies
6/11s390/percpu: Rename inline assembly symbolic namesarch/s390/include/asm/percpu.h+30 -300 replies
7/11s390/percpu: Use __PCPU_BEGIN() and __PCPU_END() for inline assembliesarch/s390/include/asm/percpu.h+42 -410 replies
8/11s390/percpu: Use percpu code section for this_cpu_cmpxchg128()arch/s390/include/asm/percpu.h+16 -80 replies
9/11s390/percpu: Use percpu code section for this_cpu_xchg()arch/s390/include/asm/percpu.h+29 -50 replies
10/11s390/percpu: Use percpu code section for this_cpu_cmpxchg()arch/s390/include/asm/percpu.h+27 -50 replies
11/11s390/percpu: Rework to simplify percpu_entry() and percpu_exit()arch/s390/include/asm/entry-percpu.h arch/s390/include/asm/percpu.h arch/s390/kernel/irq.c +2 more+138 -1280 replies

Reviews trailers per patch

None of the 11 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMete DurluAlexander Gordeev
SeriesT-b A-b
1/11
2/11
3/11
4/11
5/11
6/11
7/11
8/11
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/11] s390: More this_cpu_*() changes

v4:
- With the change to la instead of agrk also the register pair cannot be mapped to gpr0/gpr1 anymore, since all three registers involved in pcpu operations are now used as base or index registers. If gpr0 is used as base or index register the corresponding instructions treat the content of that register as zero, instead of using its real content. Fix that by using the "a" instead if "d" constraint for register pairs. Also add another sanity check to cover this. [Sashiko]

v3:
- Add various sanity checks to enforce correct register usage [Mark Rutland]

- Use %N instead of %M operand modifier to access odd register of a register pair in inline assemblies. Strictly speaking this is not correct, since %N is supposed to be used for DImode operands and %M for TImode operands. However both gcc and clang handle them identical, and there is an existing user of %N in the kernel since many years. Therefore use %N to get rid of the not yet released clang 24 dependency. [Christian Borntraeger]

- Use la (load address) instruction with base and index register to generate a CPUs percpu variable address instead of agrk. la is available for all architecture levels. This removes the z196 dependency as minimum architecture level. [Christian Borntraeger]

- Change coding style at some places, and fix various typos in commit messages and comments.

- Fix compile error caused by missing semicolon.

v2:
- Yet another brown paper bug: Re-add CPU migration check to last patch. Unconditionally recalculating and updating the percpu variable address and percpu offset register can corrupt previous context register state in several cases (not only the single case reported by Sashiko).

v1:
Most of this is only about cleaning up the percpu code after preemptible this_cpu_*() operations have been implemented. The first ten patches are all more or less trivial cleanup patches trying to make the code shorter and more readable.

The only non-trivial patch is the last one, which converts s390's this_cpu_*() operations to use a similar scheme like Mark Rutland provided it for arm64 [1]. This allows to simplify the irq entry and exit path, however at the cost of slightly worse code for this_cpu_*() operations.

The simplified irq entry and exit code seems to be worth it. Usable performance numbers are not available yet, however I don't expect big difference to before.

[1] https://lore.kernel.org/all/[email protected]/

Thanks,
Heiko

Heiko Carstens (11):
s390/percpu: Fix comment typo
s390/percpu: Add sanity check to GEN_MVIY macro s390/lowcore: Remove _AC() from LOWCORE_ALT_ADDRESS s390/percpu: Let MVIY_PERCPU() calculate alternative displacement s390/percpu/lowcore: Add and use LC_PERCPU lowcore offset defines s390/percpu: Rename inline assembly symbolic names s390/percpu: Use __PCPU_BEGIN() and __PCPU_END() for inline assemblies s390/percpu: Use percpu code section for this_cpu_cmpxchg128() s390/percpu: Use percpu code section for this_cpu_xchg() s390/percpu: Use percpu code section for this_cpu_cmpxchg() s390/percpu: Rework to simplify percpu_entry() and percpu_exit()

 arch/s390/include/asm/entry-percpu.h |  71 ++----
 arch/s390/include/asm/lowcore.h      |   5 +-
 arch/s390/include/asm/percpu.h       | 354 +++++++++++++++++----------
 arch/s390/kernel/irq.c               |  10 +-
 arch/s390/kernel/nmi.c               |   4 +-
 arch/s390/kernel/traps.c             |   4 +-
 6 files changed, 248 insertions(+), 200 deletions(-)
Signature · 1 line
2.53.0