lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 Jan 2022 10:27:32 +0000
From:   Mark Rutland <mark.rutland@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...hat.com, tglx@...utronix.de, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        bristot@...hat.com, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, linux-api@...r.kernel.org, x86@...nel.org,
        pjt@...gle.com, posk@...gle.com, avagin@...gle.com,
        jannh@...gle.com, tdelisle@...terloo.ca, posk@...k.io
Subject: Re: [RFC][PATCH v2 5/5] sched: User Mode Concurency Groups

On Mon, Jan 24, 2022 at 11:07:04AM +0100, Peter Zijlstra wrote:
> On Mon, Jan 24, 2022 at 11:03:06AM +0100, Peter Zijlstra wrote:
> 
> > > 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 ?

Yup; it's two-fold:

1) We have separate vectors for entry from-user and from-kernel, and I'd like
   to avoid the conditionality (e.g. the user_mode(regs) checks) where possible. 
   Having that unconditional and explicit in the from-user code avoids
   redundant work and is much easier to see that it's correct and balanced.

   We have separate irqentry_from_user() and irqentry_from_kernel() helpers
   today for this.

2) Due to the way we nest classes of exception, on the entry path we manipulate
   the flags differently depending on which specific exception we've taken. On
   the return path we always mask everything (necessary due to the way
   exception return works architecturally).

   Luckily exceptions from-user don't nest, so those cases are simpler than
   exceptions 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.

I'll see what I can do. :)

Thanks,
Mark.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ