powerpc: "paca->soft_enabled" based local atomic operation implementation
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v10 Latest posting 2/217 patches 3 repliesIn review
- v10 posting 1/214 patches 0 repliesSuperseded
- v914 patches 5 repliesSuperseded
Earlier versions · 12
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v8 | 12 patches | 1 reply | Superseded | |
| v7 | 11 patches | 2 replies | Superseded | |
| v6 | 12 patches | 7 replies | Superseded | |
| v5 posting 2/2 | 12 patches | 3 replies | Superseded | |
| v4 posting 2/2 | 12 patches | 11 replies | Superseded | |
| v3 posting 2/2 | 11 patches | 3 replies | Superseded | |
| v2 posting 2/2 | 11 patches | 0 replies | Superseded | |
| v5 RFC posting 1/2 | 12 patches | 0 replies | Superseded | |
| v4 RFC posting 1/2 | 12 patches | 7 replies | Superseded | |
| v3 RFC posting 1/2 | 12 patches | 6 replies | Superseded | |
| v2 RFC posting 1/2 | 11 patches | 10 replies | Superseded | |
| v1 RFC | 9 patches | 21 replies | Superseded |
Changelog v9 from the cover letter
- Split some patches to make reviewing easier
- Included couple fixes
- Updated the comment and commit message
- Renamed variables and functions
Patches in v10 posting 2/2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/17 | powerpc/64: do not trace irqs-off at interrupt return to soft-disabled contextarch/ | +7 | 0 replies | |
| 2/17 | powerpc/64: Add #defines for paca->soft_enabled flagsarch/ arch/ arch/ +12 more | +50 | 1 reply | |
| 3/17 | powerpc/64: Improve inline asm in arch_local_irq_disablearch/ | +5 | 0 replies | |
| 4/17 | powerpc/64: Fix arch_local_irq_disable() prototypearch/ | +15 | 0 replies | |
| 5/17 | powerpc/64: move set_soft_enabled(), rename it, add memory clobberarch/ arch/ arch/ +2 more | +25 | 0 replies | |
| 6/17 | powerpc/64: Implement and use soft_enabled_return APIarch/ arch/ | +14 | 0 replies | |
| 7/17 | powerpc/64: Implement and use soft_enabled_set_return APIarch/ | +15 | 0 replies | |
| 8/17 | powerpc/64: Cleanup hard_irq_disable() macroarch/ | +3 | 0 replies | |
| 9/17 | powerpc/64: Change soft_enabled from flag to bitmaskarch/ arch/ arch/ +15 more | +104 | 0 replies | |
| 10/17 | powerpc/64: Rename soft_enabled to irq_soft_maskarch/ arch/ arch/ +18 more | +99 | 0 replies | |
| 11/17 | powerpc/64s: Avoid using EXCEPTION_PROLOG_1 macro in MASKABLE_*arch/ | +3 | 0 replies | |
| 12/17 | powerpc/64s: Add support to take additional parameter in MASKABLE_* macroarch/ arch/ arch/ | +96 | 0 replies | |
| 13/17 | powerpc/64s: Add support to mask perf interrupts and replay themarch/ arch/ arch/ +2 more | +31 | 1 reply | |
| 14/17 | powerpc: Add new kconfig IRQ_DEBUG_SUPPORTarch/ arch/ arch/ +1 more | +10 | 0 replies | |
| 15/17 | powerpc/64s: Add new set of irq_soft_mask_ functions for PMI maskingarch/ | +71 | 0 replies | |
| 16/17 | powerpc: use generic atomic implementation for local_tarch/ | +1 | 0 replies | |
| 17/17 | powerpc/64s: Implement local_t using irq soft maskingarch/ | +141 | 0 replies |
Reviews trailers per patch
2 of 17 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Madhavan Srinivasan | Nicholas Piggin |
|---|---|---|
| Series | R-b | |
| 1/17 | ||
| 2/17 | ||
| 3/17 | R-b | |
| 4/17 | ||
| 5/17 | ||
| 6/17 | ||
| 7/17 | ||
| 8/17 | ||
| 9/17 | ||
| 10/17 | ||
| 11/17 | ||
| 12/17 | ||
| 13/17 | ||
| 14/17 | R-b | |
| 15/17 | ||
| 16/17 | ||
| 17/17 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v10 00/17] powerpc: "paca->soft_enabled" based local atomic operation implementation
Local atomic operations are fast and highly reentrant per CPU counters. Used for percpu variable updates. Local atomic operations only guarantee variable modification atomicity wrt the CPU which owns the data and these needs to be executed in a preemption safe way.
Here is the design of the patchset. Since local_* operations
are only need to be atomic to interrupts (IIUC), we have two options. Either replay the "op" if interrupted or replay the interrupt after the "op". Initial patchset posted was based on implementing local_* operation based on CR5 which replay's the "op". Patchset had issues in case of rewinding the address pointor from an array. This make the slow path really slow. Since CR5 based implementation proposed using __ex_table to find the rewind address, this rasied concerns about size of __ex_table and vmlinux.
https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123115.html
But this patchset uses Benjamin Herrenschmidt suggestion of using arch_local_irq_disable() to soft_disable interrupts (including PMIs). After finishing the "op", arch_local_irq_restore() called and correspondingly interrupts are replayed if any occured.
Current paca->soft_enabled logic is reserved and MASKABLE_EXCEPTION_* macros are extended to support this feature.
patch re-write the current local_* functions to use arch_local_irq_disbale. Base flow for each function is
{
powerpc_local_irq_pmu_save(flags)
load
..
store
powerpc_local_irq_pmu_restore(flags)}
Reason for the approach is that, currently l[w/d]arx/st[w/d]cx. instruction pair is used for local_* operations, which are heavy on cycle count and they dont support a local variant. So to see whether the new implementation helps, used a modified version of Rusty's benchmark code on local_t.
https://lkml.org/lkml/2008/12/16/450
Modifications to Rusty's benchmark code:
- Executed only local_t test
Here are the values with the patch.
Time in ns per iteration
Local_t Without Patch With Patch
_inc 38 10 _add 38 10 _read 4 4 _add_return 38 10
Currently only asm/local.h has been rewritten, and also the entire change is tested only in PPC64 (pseries guest) and PPC64 LE host. Have only compile tested ppc64e_*.
Changelog v9:
- Split some patches to make reviewing easier
- Included couple fixes
- Updated the comment and commit message
- Renamed variables and functions
Changelog v8:
- Rearranged series.
- Updated the comments
- Fixed a hang in embedded version (thanks to mpe)
- Added couple of more cleanup patches to the series
- Updated commit messages.
Changelog v7:
1)Missed first patch in the series
Changelog v6:
1)Moved the renaming of soft_enabled to soft_disable_mask patch earlier in the series. 2)Added code to hardwire "softe" value in pt_regs for userspace to be always 1 3)rebased to latest upstream.
Changelog v5:
1)Fixed the check in hard_irq_disable() macro for soft_disabled_mask
Changelog v4:
1)split the __SOFT_ENABLED logic check from patch 7 and merged to soft_enabled logic reversing patch.
2)Made changes to commit messages
3)Added a new IRQ_DISBALE_MASK_ALL to include supported disabled mask bits.
Changelog v3:
1)Made suggest to commit messages
2)Added a new patch (patch 12) to rename the soft_enabled to soft_disabled_mask
Changelog v2:
Rebased to latest upstream
Changelog v1:
1)squashed patches 1/2 together and 8/9/10 together for readability 2)Created a separate patch for the kconfig changes
3)Moved the new mask value commit to patch 11.
4)Renamed local_irq_pmu_*() to powerpc_irq_pmu_*() to avoid
namespaces matches with generic kernel local_irq*() functions
5)Renamed __EXCEPTION_PROLOG_1 macro to MASKABLE_EXCEPTION_PROLOG_1 macro 6)Made changes to commit messages
7)Add more comments to codes
Changelog RFC v5:
1)Implemented new set of soft_enabled manipulation functions 2)rewritten arch_local_irq_* functions to use the new soft_enabled_*() 3)Add WARN_ON to identify invalid soft_enabled transitions 4)Added powerpc_local_irq_pmu_save() and powerpc_local_irq_pmu_restore() to
support masking of irqs (with PMI).
5)Added local_irq_pmu_*()s macros with trace_hardirqs_on|off() to match
include/linux/irqflags.h
Changelog RFC v4:
1)Fix build breaks in in ppc64e_defconfig compilation 2)Merged PMI replay code with the exception vector changes patch 3)Renamed the new API to set PMI mask bit as suggested 4)Modified the current arch_local_save and new API function call to
"OR" and store the value to ->soft_enabled instead of just store.
5)Updated the check in the arch_local_irq_restore() to alway check for
greather than or zero to _LINUX mask bit.
6)Updated the commit messages.
Changelog RFC v3:
1)Squashed PMI masked interrupt patch and replay patch together 2)Have created a new patch which includes a new Kconfig and set_irq_set_mask() 3)Fixed the compilation issue with IRQ_DISABLE_MASK_* macros in book3e_*
Changelog RFC v2:
1)Renamed IRQ_DISABLE_LEVEL_* to IRQ_DISABLE_MASK_* and made logic changes
to treat soft_enabled as a mask and not a flag or level.
2)Added a new Kconfig variable to support a WARN_ON 3)Refactored patchset for eaiser review.
4)Made changes to commit messages.
5)Made changes for BOOK3E version
Changelog RFC v1:
1)Commit messages are improved.
2)Renamed the arch_local_irq_disable_var to soft_irq_set_level as suggested 3)Renamed the LAZY_INTERRUPT* macro to IRQ_DISABLE_LEVEL_* as suggested 4)Extended the MASKABLE_EXCEPTION* macros to support additional parameter. 5)Each MASKABLE_EXCEPTION_* macro will carry a "mask_level" 6)Logic to decide on jump to maskable_handler in SOFTEN_TEST is now based on
"mask_level"
7)__EXCEPTION_PROLOG_1 is factored out to support "mask_level" parameter.
This reduced the code changes needed for supporting "mask_level" parameters.
Madhavan Srinivasan (15):
powerpc/64: Add #defines for paca->soft_enabled flags powerpc/64: Fix arch_local_irq_disable() prototype powerpc/64: move set_soft_enabled(), rename it, add memory clobber powerpc/64: Implement and use soft_enabled_return API powerpc/64: Implement and use soft_enabled_set_return API powerpc/64: Cleanup hard_irq_disable() macro
powerpc/64: Change soft_enabled from flag to bitmask powerpc/64: Rename soft_enabled to irq_soft_mask powerpc/64s: Avoid using EXCEPTION_PROLOG_1 macro in MASKABLE_* powerpc/64s: Add support to take additional parameter in MASKABLE_*
macro
powerpc/64s: Add support to mask perf interrupts and replay them
powerpc: Add new kconfig IRQ_DEBUG_SUPPORT
powerpc/64s: Add new set of irq_soft_mask_ functions for PMI masking
powerpc: use generic atomic implementation for local_t powerpc/64s: Implement local_t using irq soft masking
Nicholas Piggin (2):
powerpc/64: do not trace irqs-off at interrupt return to soft-disabled
context
powerpc/64: Improve inline asm in arch_local_irq_disable
arch/powerpc/Kconfig.debug | 4 + arch/powerpc/include/asm/exception-64s.h | 103 ++++++++++------ arch/powerpc/include/asm/head-64.h | 40 +++---- arch/powerpc/include/asm/hw_irq.h | 165 ++++++++++++++++++++++--- arch/powerpc/include/asm/irqflags.h | 14 +-- arch/powerpc/include/asm/kvm_ppc.h | 2 +- arch/powerpc/include/asm/local.h | 200 +++++++++++++------------------ arch/powerpc/include/asm/paca.h | 2 +- arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/kernel/entry_64.S | 50 ++++---- arch/powerpc/kernel/exceptions-64e.S | 20 ++-- arch/powerpc/kernel/exceptions-64s.S | 38 +++--- arch/powerpc/kernel/head_64.S | 11 +- arch/powerpc/kernel/idle_book3e.S | 5 +- arch/powerpc/kernel/idle_power4.S | 5 +- arch/powerpc/kernel/irq.c | 29 ++--- arch/powerpc/kernel/optprobes_head.S | 2 +- arch/powerpc/kernel/process.c | 3 +- arch/powerpc/kernel/ptrace.c | 12 ++ arch/powerpc/kernel/setup_64.c | 5 +- arch/powerpc/kernel/signal_32.c | 8 ++ arch/powerpc/kernel/signal_64.c | 3 + arch/powerpc/kernel/time.c | 6 +- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/perf/core-book3s.c | 2 +- arch/powerpc/xmon/xmon.c | 4 +- 27 files changed, 458 insertions(+), 281 deletions(-)
Signature · 1 line
2.7.4