Re: [RFC][PATCH v2 5/5] sched: User Mode Concurency Groups
From: Peter Zijlstra <peterz@infradead.org>
Date: 2022-01-24 10:07:28
Also in:
linux-mm, lkml
On Mon, Jan 24, 2022 at 11:03:06AM +0100, Peter Zijlstra wrote:
quoted
Either way, it looks like we'd need helpers along the lines of: | static __always_inline void umcg_enter_from_user(struct pt_regs *regs) | { | if (current->flags & PF_UMCG_WORKER) | umcg_sys_enter(regs, -1); | } | | static __always_inline void umcg_exit_to_user(struct pt_regs *regs) | { | if (current->flags & PF_UMCG_WORKER) | umcg_sys_exit(regs); | }Would something like: #ifndef arch_irqentry_irq_enter static __always_inline bool arch_irqentry_irq_enter(struct pt_regs *regs) { if (!regs_irqs_disabled(regs)) { local_irq_enable(); return true; } return false; } #endif static __always_inline void irqentry_irq_enter(struct pt_regs *regs) { if (arch_irqentry_irq_inherit(regs)) { if (user_mode(regs) && (current->flags & PF_UMCG_WORKER)) umcg_sys_enter(regs, -1); } } Work? Then arm64 can do: static __always_inline bool arch_irqentry_irq_enter(struct pt_regs *regs) { local_daif_inherit(); return interrupts_enabled(regs); } or somesuch...
Ah,.. just read your other email, so your concern is about the user_mode() thing due to ARM64 taking a different exception path for from-user vs from-kernel ? I don't mind too much if arm64 decides to open-code the umcg hooks, but please do it such that's hard to forget a spot.