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, 11 Jan 2021 13:35:10 +0100
From:   Frederic Weisbecker <frederic@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     "Paul E . McKenney" <paulmck@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>, stable@...r.kernel.org
Subject: Re: [RFC PATCH 4/8] rcu/nocb: Trigger self-IPI on late deferred wake
 up before user resume

On Mon, Jan 11, 2021 at 01:04:24PM +0100, Peter Zijlstra wrote:
> > +static DEFINE_PER_CPU(struct irq_work, late_wakeup_work) =
> > +	IRQ_WORK_INIT(late_wakeup_func);
> > +
> >  /**
> >   * rcu_user_enter - inform RCU that we are resuming userspace.
> >   *
> > @@ -692,9 +704,17 @@ noinstr void rcu_user_enter(void)
> >  	struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
> >  
> >  	lockdep_assert_irqs_disabled();
> > -	do_nocb_deferred_wakeup(rdp);
> > +	/*
> > +	 * We may be past the last rescheduling opportunity in the entry code.
> > +	 * Trigger a self IPI that will fire and reschedule once we resume to
> > +	 * user/guest mode.
> > +	 */
> > +	if (do_nocb_deferred_wakeup(rdp) && need_resched())
> > +		irq_work_queue(this_cpu_ptr(&late_wakeup_work));
> > +
> >  	rcu_eqs_enter(true);
> >  }
> 
> Do we have the guarantee that every architecture that supports NOHZ_FULL
> has arch_irq_work_raise() on?

Yes it's a requirement for NOHZ_FULL to work. But you make me realize this
is tacit and isn't constrained anywhere in the code. I'm going to add
HAVE_IRQ_WORK_RAISE and replace the weak definition with a config
based.

> 
> Also, can't you do the same thing you did earlier and do that wakeup
> thing before we complete exit_to_user_mode_prepare() ?

I do it for CONFIG_GENERIC_ENTRY but the other architectures have their own
exit to user loop that I would need to audit and make sure that interrupts aren't
ever re-enabled before resuming to user and there is no possible rescheduling
point. I could manage to handle arm and arm64 but the others scare me:

$ git grep HAVE_CONTEXT_TRACKING
arch/csky/Kconfig:      select HAVE_CONTEXT_TRACKING
arch/mips/Kconfig:      select HAVE_CONTEXT_TRACKING
arch/powerpc/Kconfig:   select HAVE_CONTEXT_TRACKING            if PPC64
arch/riscv/Kconfig:     select HAVE_CONTEXT_TRACKING
arch/sparc/Kconfig:     select HAVE_CONTEXT_TRACKING

:-s

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ