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]
Message-ID: <20140212201709.GB6835@laptop.programming.kicks-ass.net>
Date:	Wed, 12 Feb 2014 21:17:09 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Andy Lutomirski <luto@...capital.net>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Mike Galbraith <bitbucket@...ine.de>, X86 ML <x86@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Too many rescheduling interrupts (still!)

On Wed, Feb 12, 2014 at 10:19:42AM -0800, Andy Lutomirski wrote:
> >  static void ttwu_queue_remote(struct task_struct *p, int cpu)
> >  {
> > -       if (llist_add(&p->wake_entry, &cpu_rq(cpu)->wake_list))
> > -               smp_send_reschedule(cpu);
> > +       struct rq *rq = cpu_rq(cpu);
> > +
> > +       if (llist_add(&p->wake_entry, &rq->wake_list)) {
> > +               set_tsk_need_resched(rq->idle);
> > +               smp_mb__after_clear_bit();
> > +               if (!tsk_is_polling(rq->idle) || rq->curr != rq->idle)
> > +                       smp_send_reschedule(cpu);
> > +       }
> 
> At the very least this needs a comment pointing out that rq->lock is
> intentionally not taken.  This makes my brain hurt a little :)

Oh absolutely; I wanted to write one, but couldn't get a straight story
so gave up for now.

> > +               /*
> > +                * We must clear polling before running sched_ttwu_pending().
> > +                * Otherwise it becomes possible to have entries added in
> > +                * ttwu_queue_remote() and still not get an IPI to process
> > +                * them.
> > +                */
> > +               __current_clr_polling();
> > +
> > +               set_preempt_need_resched();
> > +               sched_ttwu_pending();
> > +
> >                 tick_nohz_idle_exit();
> >                 schedule_preempt_disabled();
> > +               __current_set_polling();
> 
> I wonder if this side has enough barriers to make this work.

sched_ttwu_pending() does xchg() as first op and thereby orders itself
against the clr_polling.


I'll need a fresh brain for your proposal.. will read it again in the
morning.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ