Skip to contentSkip to conversation

ARM: Remaining PREEMPT_RT bits

PATCH In review Sebastian Andrzej Siewior 2 participants 5 messages Feb 26

Subsystems (2)
lore
Share & tools
lore

Sebastian Andrzej Siewior

author maintainer
#0 lore raw

v5 cover ARM: Remaining PREEMPT_RT bits

this is the last batch I have to enable PREEMPT_RT on the ARM architecture. It is just sending a signal with disabled interrupts and finally enabling PREEMPT_RT on ARM.

Is this okay?

v4…v5: https://lore.kernel.org/all/[email protected]
- Repost.
Russell said in [email protected] that #1 shouldn't be needed anymore because he has changes in his queue which should provide effectively the same changes as #1. I can't access it. Here is the whole set so it does not get lost.
I would appreciate if it could hit the next merge window.

v3…v4: https://lore.kernel.org/all/[email protected]
- Dropped applied patches
- Rebased the remaining one on top of the recent fault handler and branch predictor fixes.

v2…v3: https://lore.kernel.org/all/[email protected]
- Collected tags.

v1…v2: https://lore.kernel.org/all/[email protected]
- Allow to enable jump-labels on UP. The UP build does not involve stop_machine(). Reworked by Arnd.

- Instead of forbidding HAVE_GUP_FAST with HIGHPTE enabled just disable HIGHPTE on PREEMPT_RT. As Arnd explained, HIGHPTE is rarely needed.

- Don't let ARCH_SUPPORTS_RT depend on HAVE_POSIX_CPU_TIMERS_TASK_WORK which in turn depends on !KVM. Since KVM has been removed from ARM it is sufficient to unconditionally allow ARCH_SUPPORTS_RT. Noted by Arnd.

Sebastian Andrzej Siewior (1):
ARM: Allow to enable RT

Yadi.hu (1):
ARM: mm: fault: Enable interrupts before invoking __do_user_fault()

 arch/arm/Kconfig    | 1 +
 arch/arm/mm/fault.c | 4 ++++
 2 files changed, 5 insertions(+)
Signature · 1 line
2.51.0
author maintainer
#1 lore raw

PATCH v5 1/2 ARM: mm: fault: Enable interrupts before invoking __do_user_fault()

From: "Yadi.hu" <[email protected]>

A page fault from userland for a kernel address originates from from do_sect_fault() (!LPAE) or do_page_fault() and ends in __do_user_fault() by sending a signal.

Sending a signal requires to acquire sighand_struct::siglock which is a spinlock_t. On PREEMPT_RT spinlock_t becomes a sleeping spin lock which requires interrupts to be enabled. Since the calling context is user land, interrupts must have been enabled so it is fine to enable them in this case.

Enable interrupts in do_kernel_address_page_fault() unconditional in the user_mode case().
Enable interrupts in do_sect_fault() if they were previously enabled.

[bigeasy: Initial patch/ report by Yadi. Maintained the patch and redid
the patch description since]

---
 arch/arm/mm/fault.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mm/fault.c +4 -0
index ed4330cc3f4e6..3f1c73269c126 100644
@@ -270,6 +270,7 @@ do_kernel_address_page_fault(struct mm_struct *mm, unsigned long addr,
 		 * while interrupts are still disabled, then send a SIGSEGV.
 		 */
 		harden_branch_predictor();
+		local_irq_enable();
 		__do_user_fault(addr, fsr, SIGSEGV, SEGV_MAPERR, regs);
 	} else {
 		/*
@@ -592,6 +593,9 @@ do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 	if (addr >= TASK_SIZE && user_mode(regs))
 		harden_branch_predictor();
 
+	if (interrupts_enabled(regs))
+		local_irq_enable();
+
 	do_bad_area(addr, fsr, regs);
 
 	return 0;
Signature · 1 line
2.51.0
#2 lore raw

Re: [PATCH v5 1/2] ARM: mm: fault: Enable interrupts before invoking __do_user_fault()

Quoted 16 lines · Sebastian Andrzej Siewior

From: "Yadi.hu" <[email protected]>

A page fault from userland for a kernel address originates from from do_sect_fault() (!LPAE) or do_page_fault() and ends in __do_user_fault() by sending a signal.

Sending a signal requires to acquire sighand_struct::siglock which is a spinlock_t. On PREEMPT_RT spinlock_t becomes a sleeping spin lock which requires interrupts to be enabled. Since the calling context is user land, interrupts must have been enabled so it is fine to enable them in this case.

Enable interrupts in do_kernel_address_page_fault() unconditional in the user_mode case().
Enable interrupts in do_sect_fault() if they were previously enabled.

Quoted 7 lines

[bigeasy: Initial patch/ report by Yadi. Maintained the patch and redid
the patch description since]

Sorry, I've been swamped with stmmac for ages, which has become a millstone.

I need to push out these patches:

ARM: provide individual is_translation_fault() and is_permission_fault()
ARM: move FSR fault status definitions before fsr_fs()
ARM: use BIT() and GENMASK() for fault status register fields
ARM: move is_permission_fault() and is_translation_fault() to fault.h
ARM: move vmalloc() lazy-page table population
ARM: ensure interrupts are enabled in __do_user_fault()

which will address some of your issues, and clean up the fault handling code. These patches all date from 5th December. :/

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
author maintainer
#3 lore raw

Re: [PATCH v5 1/2] ARM: mm: fault: Enable interrupts before invoking __do_user_fault()

Quoted 12 lines · Russell King (Oracle)

Sorry, I've been swamped with stmmac for ages, which has become a millstone.

I need to push out these patches:

ARM: provide individual is_translation_fault() and is_permission_fault()
ARM: move FSR fault status definitions before fsr_fs()
ARM: use BIT() and GENMASK() for fault status register fields
ARM: move is_permission_fault() and is_translation_fault() to fault.h
ARM: move vmalloc() lazy-page table population
ARM: ensure interrupts are enabled in __do_user_fault()

Quoted 2 lines

which will address some of your issues, and clean up the fault handling code. These patches all date from 5th December. :/

Okay. Thank you. Please let me know once you pushed them where I can reach them. Then maybe we can reduce this to just 2/2 ;)

Sebastian

author maintainer
#4 lore raw

PATCH v5 2/2 ARM: Allow to enable RT

In reply to Sebastian Andrzej Siewior

All known issues have been adressed.
Allow to select RT.

---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
index ec33376f8e2ba..71fc5dd4123f3 100644
@@ -42,6 +42,7 @@ config ARM
 	select ARCH_SUPPORTS_CFI
 	select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
 	select ARCH_SUPPORTS_PER_VMA_LOCK
+	select ARCH_SUPPORTS_RT
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF
 	select ARCH_USE_MEMTEST
Signature · 1 line
2.51.0