public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org, Mike Galbraith <efault@gmx.de>,
	Ingo Molnar <mingo@elte.hu>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>
Subject: Re: [RFC PATCH] kernel: sched: Provide a pointer to the valid CPU mask
Date: Thu, 6 Apr 2017 12:47:21 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1704061237210.1716@nanos> (raw)
In-Reply-To: <20170406103516.i3jyjcmee65r3wwj@hirez.programming.kicks-ass.net>

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

On Thu, 6 Apr 2017, Peter Zijlstra wrote:
> On Thu, Apr 06, 2017 at 11:46:33AM +0200, Sebastian Andrzej Siewior wrote:
> > On 2017-04-06 11:32:24 [+0200], Peter Zijlstra wrote:
> > > On Tue, Apr 04, 2017 at 08:42:02PM +0200, Sebastian Andrzej Siewior wrote:
> > > > While converting the existing users I tried to stick with the rules
> > > > above however… well mostly CPUFREQ tries to temporary switch the CPU
> > > > mask to do something on a certain CPU and then switches the mask back it
> > > > its original value.
> > > 
> > > 
> > > There's a bunch of that through ancient and rotten parts of the kernel.
> > > All those sites are broken.
> > > 
> > > Nothing stops userspace from setting a different affinity right after
> > > the kernel does for those threads.
> > 
> > Good. So you are saying I should convert them to something like
> > queue_work_on()?
> 
> Not sure; iirc there were a few variants. Some can indeed simply do
> queue_work_on() and possibly wait for completion. some should maybe be a
> per-cpu kthread, others will be more 'interesting'.
> 
> IIRC MIPS has a case where only 1 in N cores has an FPU. And once a task
> uses FPU, it gets affined to the core that has one or something like
> that.
>
> Of course, nothing then stops someone else breaking that affinity. But I
> suspect it will simply fault on the next FPU instruction and 'reset' the
> mask or something. I've no clue and no real desire to know.

It does nasty games with it's own storage of p->thread.user_cpus_allowed
and a fully seperate implementation of sys_sched_set|getaffinity.

Plus a magic trap handler which forces the thread to a CPU with FPU when
the user_cpus_allowed mask intersects with the cpus_with_fpu_mask...

Magic crap, which could all be replaced by a simple function in the
scheduler which allows to push a task to a FPU CPU and then disable
migration.

Thanks,

	tglx



  reply	other threads:[~2017-04-06 10:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 18:42 [RFC PATCH] kernel: sched: Provide a pointer to the valid CPU mask Sebastian Andrzej Siewior
2017-04-05  7:39 ` Ingo Molnar
2017-04-05  8:37   ` Sebastian Andrzej Siewior
2017-04-06  6:16     ` Ingo Molnar
2017-04-06  7:38       ` Sebastian Andrzej Siewior
2017-04-06  8:01         ` Ingo Molnar
2017-04-06  9:25           ` Sebastian Andrzej Siewior
2017-04-06  9:46             ` Peter Zijlstra
2017-04-06 10:58               ` Thomas Gleixner
2017-04-06 11:41                 ` Peter Zijlstra
2017-04-06  9:35           ` Peter Zijlstra
2017-04-06  9:42             ` Peter Zijlstra
2017-04-06 10:36           ` Thomas Gleixner
2017-04-06 11:02             ` Ingo Molnar
2017-04-06 11:10               ` Thomas Gleixner
2017-04-07  7:13                 ` Ingo Molnar
2017-04-06  9:34   ` Peter Zijlstra
2017-04-06  9:32 ` Peter Zijlstra
2017-04-06  9:46   ` Sebastian Andrzej Siewior
2017-04-06 10:35     ` Peter Zijlstra
2017-04-06 10:47       ` Thomas Gleixner [this message]
2017-04-06 10:57         ` Peter Zijlstra
2017-04-06 11:03           ` Thomas Gleixner
2017-04-06 11:50             ` Peter Zijlstra
2017-04-06 11:56               ` Thomas Gleixner
2017-04-06 12:31                 ` Peter Zijlstra
2017-04-11  1:38 ` [lkp-robot] [kernel] c1f943ee40: kernel_BUG_at_kernel/smpboot.c kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1704061237210.1716@nanos \
    --to=tglx@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox