stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SCHEDL_SMT forced on!
@ 2018-12-16  6:21 Barry Kauler
  2018-12-16  8:27 ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Barry Kauler @ 2018-12-16  6:21 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Peter Zijlstra, Andy Lutomirski, Linus Torvalds, Jiri Kosina,
	Tom Lendacky, Josh Poimboeuf, Andrea Arcangeli, David Woodhouse,
	Tim Chen, Andi Kleen, Dave Hansen, Casey Schaufler, Asit Mallick,
	Arjan van de Ven, Jon Masters, Waiman Long, Greg KH, Dave Stewart,
	Kees Cook, stable

Mr Gleixner,
I was upset when I compiled 4.14.87 found that SCHED_SMT had been
forced on. At the time, I just reported it to my blog, and posted a
question about it to a couple of forums, and stayed with an earlier
kernel.

However, when 4.14.88 came out, and still the same situation, alarm
bells went off, and I looked through the kernel changelog. Found it,
4.14.86:

"x86/Kconfig: Select SCHED_SMT if SMP enabled"

Then:

"CONFIG_SCHED_SMT is enabled by all distros, so there is not a real point to
    have it configurable. ..."

...that is a lie. It would be correct to state that is true of the
distros you use, and presumably also for all of you guys who signed
off on it.

Puppy Linux is an example of a distro that has mostly not had
SCHED_SMT enabled. Ditto for most of the forks of Puppy. Two distros
that I currently maintain, Quirky and EasyOS (easyos.org) have SMP
enabled but not SCHED_SMT.

The difference between them is important, they should remain
independently settable. I am so surprised that all of you guys went
along with forcing it on.

For the record, my blog post:

http://bkhome.org/news/201812/kernel-41487-compiled.html

Regards,
Barry Kauler

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16  6:21 SCHEDL_SMT forced on! Barry Kauler
@ 2018-12-16  8:27 ` Greg KH
  2018-12-16 17:39   ` Andi Kleen
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2018-12-16  8:27 UTC (permalink / raw)
  To: Barry Kauler
  Cc: Thomas Gleixner, Peter Zijlstra, Andy Lutomirski, Linus Torvalds,
	Jiri Kosina, Tom Lendacky, Josh Poimboeuf, Andrea Arcangeli,
	David Woodhouse, Tim Chen, Andi Kleen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On Sun, Dec 16, 2018 at 02:21:55PM +0800, Barry Kauler wrote:
> Mr Gleixner,
> I was upset when I compiled 4.14.87 found that SCHED_SMT had been
> forced on. At the time, I just reported it to my blog, and posted a
> question about it to a couple of forums, and stayed with an earlier
> kernel.
> 
> However, when 4.14.88 came out, and still the same situation, alarm
> bells went off, and I looked through the kernel changelog. Found it,
> 4.14.86:
> 
> "x86/Kconfig: Select SCHED_SMT if SMP enabled"
> 
> Then:
> 
> "CONFIG_SCHED_SMT is enabled by all distros, so there is not a real point to
>     have it configurable. ..."
> 
> ...that is a lie. It would be correct to state that is true of the
> distros you use, and presumably also for all of you guys who signed
> off on it.
> 
> Puppy Linux is an example of a distro that has mostly not had
> SCHED_SMT enabled. Ditto for most of the forks of Puppy. Two distros
> that I currently maintain, Quirky and EasyOS (easyos.org) have SMP
> enabled but not SCHED_SMT.
> 
> The difference between them is important, they should remain
> independently settable. I am so surprised that all of you guys went
> along with forcing it on.

Is having this option enabled causing a problem for you?  Does it cause
slowdowns or runtime issues?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16  8:27 ` Greg KH
@ 2018-12-16 17:39   ` Andi Kleen
  2018-12-16 21:29     ` Barry Kauler
  0 siblings, 1 reply; 13+ messages in thread
From: Andi Kleen @ 2018-12-16 17:39 UTC (permalink / raw)
  To: Greg KH
  Cc: Barry Kauler, Thomas Gleixner, Peter Zijlstra, Andy Lutomirski,
	Linus Torvalds, Jiri Kosina, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On Sun, Dec 16, 2018 at 09:27:46AM +0100, Greg KH wrote:
> On Sun, Dec 16, 2018 at 02:21:55PM +0800, Barry Kauler wrote:
> > Mr Gleixner,
> > I was upset when I compiled 4.14.87 found that SCHED_SMT had been
> > forced on. At the time, I just reported it to my blog, and posted a
> > question about it to a couple of forums, and stayed with an earlier
> > kernel.
> > 
> > However, when 4.14.88 came out, and still the same situation, alarm
> > bells went off, and I looked through the kernel changelog. Found it,
> > 4.14.86:
> > 
> > "x86/Kconfig: Select SCHED_SMT if SMP enabled"
> > 
> > Then:
> > 
> > "CONFIG_SCHED_SMT is enabled by all distros, so there is not a real point to
> >     have it configurable. ..."
> > 
> > ...that is a lie. It would be correct to state that is true of the
> > distros you use, and presumably also for all of you guys who signed
> > off on it.
> > 
> > Puppy Linux is an example of a distro that has mostly not had
> > SCHED_SMT enabled. Ditto for most of the forks of Puppy. Two distros
> > that I currently maintain, Quirky and EasyOS (easyos.org) have SMP
> > enabled but not SCHED_SMT.
> > 
> > The difference between them is important, they should remain
> > independently settable. I am so surprised that all of you guys went
> > along with forcing it on.
> 
> Is having this option enabled causing a problem for you?  Does it cause
> slowdowns or runtime issues?

>From the blog:

>>>
Note, way back in the early days when I was first compiling the kernel for multi-core CPUs, SMT (hyperthreading), which simulates more than one core for each actual core, was causing file corruption. So, disabled it, and never trusted it after that.
<<

Since nearly everyone else has the option enabled we 
are quite confident there is no data corruption caused by it.
So there shouldn't be any reason to turn it off.

-Andi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 17:39   ` Andi Kleen
@ 2018-12-16 21:29     ` Barry Kauler
  2018-12-16 21:37       ` Jiri Kosina
  0 siblings, 1 reply; 13+ messages in thread
From: Barry Kauler @ 2018-12-16 21:29 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Greg KH, Thomas Gleixner, Peter Zijlstra, Andy Lutomirski,
	Linus Torvalds, Jiri Kosina, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On 12/17/18, Andi Kleen <ak@linux.intel.com> wrote:
> ...
> From the blog:
>
>>>>
> Note, way back in the early days when I was first compiling the kernel for
> multi-core CPUs, SMT (hyperthreading), which simulates more than one core
> for each actual core, was causing file corruption. So, disabled it, and
> never trusted it after that.
> <<
>
> Since nearly everyone else has the option enabled we
> are quite confident there is no data corruption caused by it.
> So there shouldn't be any reason to turn it off.
>

I am an outsider, looking in, have only followed the RETPOLINE etc.
stuff fairly superficially. Would this statement be correct or
incorrect?:

With CONFIG_SCHED_SMT disabled, CONFIG_RETPOLINE is not needed.
With CONFIG_SCHED_SMT enabled, then CONFIG_RETPOLINE is required for
security reasons.
Enabling CONFIG_SCHED_SMT speeds up some operations, enabling
CONFIG_RETPOLINE slows it down again.
End result, not much speed gain, far more complicated kernel.

Regards,
Barry Kauler

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 21:29     ` Barry Kauler
@ 2018-12-16 21:37       ` Jiri Kosina
  2018-12-16 21:58         ` Barry Kauler
  0 siblings, 1 reply; 13+ messages in thread
From: Jiri Kosina @ 2018-12-16 21:37 UTC (permalink / raw)
  To: Barry Kauler
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On Mon, 17 Dec 2018, Barry Kauler wrote:

> With CONFIG_SCHED_SMT disabled, CONFIG_RETPOLINE is not needed.

This is not true. Retpoline protects also against a scenario where process 
A posions BTB for process B that gets scheduled afterwards on the same 
core, irrespective of SMT.

> With CONFIG_SCHED_SMT enabled, then CONFIG_RETPOLINE is required for
> security reasons.

This is answered by the above as well. Retpoline is needed irrespective of 
SMT.

> Enabling CONFIG_SCHED_SMT speeds up some operations, enabling
> CONFIG_RETPOLINE slows it down again.

There is no 'again', as those two things are not really dependent in any 
way.

> End result, not much speed gain, far more complicated kernel.

And therefore this is bogus :)

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 21:37       ` Jiri Kosina
@ 2018-12-16 21:58         ` Barry Kauler
  2018-12-16 22:01           ` Jiri Kosina
  2018-12-17  8:36           ` Peter Zijlstra
  0 siblings, 2 replies; 13+ messages in thread
From: Barry Kauler @ 2018-12-16 21:58 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On 12/17/18, Jiri Kosina <jikos@kernel.org> wrote:
> On Mon, 17 Dec 2018, Barry Kauler wrote:
>
>> With CONFIG_SCHED_SMT disabled, CONFIG_RETPOLINE is not needed.
>
> This is not true. Retpoline protects also against a scenario where process
> A posions BTB for process B that gets scheduled afterwards on the same
> core, irrespective of SMT.
>
>> With CONFIG_SCHED_SMT enabled, then CONFIG_RETPOLINE is required for
>> security reasons.
>
> This is answered by the above as well. Retpoline is needed irrespective of
> SMT.
>
>> Enabling CONFIG_SCHED_SMT speeds up some operations, enabling
>> CONFIG_RETPOLINE slows it down again.
>
> There is no 'again', as those two things are not really dependent in any
> way.
>
>> End result, not much speed gain, far more complicated kernel.
>
> And therefore this is bogus :)
>

Thanks for the response.
So I guess it comes down to basic philosophy:

"SMT is a distinct feature, separate from SMP, and I think that it is
important to keep that distinction."

You guys have chosen to remove that distinction, and to remove the
choice for many specialised, such as embedded, situations, where they
would maybe want that choice.

I guess this will have to be my last post on the topic, as I can't
offer any other justification for my stance, other than the above.

Regards,
Barry Kauler

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 21:58         ` Barry Kauler
@ 2018-12-16 22:01           ` Jiri Kosina
  2018-12-16 22:12             ` Jiri Kosina
                               ` (2 more replies)
  2018-12-17  8:36           ` Peter Zijlstra
  1 sibling, 3 replies; 13+ messages in thread
From: Jiri Kosina @ 2018-12-16 22:01 UTC (permalink / raw)
  To: Barry Kauler
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On Mon, 17 Dec 2018, Barry Kauler wrote:

> Thanks for the response.
> So I guess it comes down to basic philosophy:
> 
> "SMT is a distinct feature, separate from SMP, and I think that it is
> important to keep that distinction."
> 
> You guys have chosen to remove that distinction, and to remove the
> choice for many specialised, such as embedded, situations, where they
> would maybe want that choice.

They have that choice. SMT can be disabled on kernel cmdline, and in many 
cases also in BIOS.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 22:01           ` Jiri Kosina
@ 2018-12-16 22:12             ` Jiri Kosina
  2018-12-16 22:26               ` Barry Kauler
  2018-12-16 22:13             ` Barry Kauler
  2018-12-16 22:31             ` Arjan van de Ven
  2 siblings, 1 reply; 13+ messages in thread
From: Jiri Kosina @ 2018-12-16 22:12 UTC (permalink / raw)
  To: Barry Kauler
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On Sun, 16 Dec 2018, Jiri Kosina wrote:

> They have that choice. SMT can be disabled on kernel cmdline, and in 
> many cases also in BIOS.

And if your worry is about the code size (that the kernel scheduler always 
has the SMT-aware bits in it), I guess making it conditional should be 
backed by real usecase.

The current situation is backed mostly by the fact that there is no known 
usecase that'd want it disabled, everybody we are aware of out there is 
enabling it.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 22:01           ` Jiri Kosina
  2018-12-16 22:12             ` Jiri Kosina
@ 2018-12-16 22:13             ` Barry Kauler
  2018-12-16 22:17               ` Jiri Kosina
  2018-12-16 22:31             ` Arjan van de Ven
  2 siblings, 1 reply; 13+ messages in thread
From: Barry Kauler @ 2018-12-16 22:13 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On 12/17/18, Jiri Kosina <jikos@kernel.org> wrote:
> On Mon, 17 Dec 2018, Barry Kauler wrote:
>
>> Thanks for the response.
>> So I guess it comes down to basic philosophy:
>>
>> "SMT is a distinct feature, separate from SMP, and I think that it is
>> important to keep that distinction."
>>
>> You guys have chosen to remove that distinction, and to remove the
>> choice for many specialised, such as embedded, situations, where they
>> would maybe want that choice.
>
> They have that choice. SMT can be disabled on kernel cmdline, and in many
> cases also in BIOS.
>

Being forced to do it on the kernel commandline is not satisfactory.
If it can be done there, why not also retain it as a configuration
option?

Regards,
Barry Kauler

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 22:13             ` Barry Kauler
@ 2018-12-16 22:17               ` Jiri Kosina
  0 siblings, 0 replies; 13+ messages in thread
From: Jiri Kosina @ 2018-12-16 22:17 UTC (permalink / raw)
  To: Barry Kauler
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On Mon, 17 Dec 2018, Barry Kauler wrote:

> Being forced to do it on the kernel commandline is not satisfactory. If 
> it can be done there, why not also retain it as a configuration option?

It's not realy the same thing.

SMT can be turned on and off dynamically either during boot, or during 
runtime (by offlining/onlining SMT siblings).

If scheduler is compiled as SMT unaware, then it stays so "forever". So 
you can't populate that kernel to SMT and non-SMT system configurations, 
you can't migrate the running system between SMT and non-SMT systems, etc.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 22:12             ` Jiri Kosina
@ 2018-12-16 22:26               ` Barry Kauler
  0 siblings, 0 replies; 13+ messages in thread
From: Barry Kauler @ 2018-12-16 22:26 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On 12/17/18, Jiri Kosina <jikos@kernel.org> wrote:
> On Sun, 16 Dec 2018, Jiri Kosina wrote:
>
>> They have that choice. SMT can be disabled on kernel cmdline, and in
>> many cases also in BIOS.
>
> And if your worry is about the code size (that the kernel scheduler always
> has the SMT-aware bits in it), I guess making it conditional should be
> backed by real usecase.
>
> The current situation is backed mostly by the fact that there is no known
> usecase that'd want it disabled, everybody we are aware of out there is
> enabling it.
>

I have already pointed out that some distros are not enabling it.

Your argument is like saying "All of the distros have enabled
CONFIG_SOUND, so let us always force it enabled".

Yet, there are situations where they don't want sound. And perhaps, in
an embedded application, they might want to par the kernel down to the
essentials, for maximum simplicity and security, keeping SMP if the
kernel has multiple cores, but not needing SCHED_SMT. I can see an
engineer wanting that choice.

Regards,
Barry Kauler

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 22:01           ` Jiri Kosina
  2018-12-16 22:12             ` Jiri Kosina
  2018-12-16 22:13             ` Barry Kauler
@ 2018-12-16 22:31             ` Arjan van de Ven
  2 siblings, 0 replies; 13+ messages in thread
From: Arjan van de Ven @ 2018-12-16 22:31 UTC (permalink / raw)
  To: Jiri Kosina, Barry Kauler
  Cc: Andi Kleen, Greg KH, Thomas Gleixner, Peter Zijlstra,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Jon Masters, Waiman Long,
	Dave Stewart, Kees Cook, stable

On 12/16/2018 2:01 PM, Jiri Kosina wrote:
> On Mon, 17 Dec 2018, Barry Kauler wrote:
> 
>> Thanks for the response.
>> So I guess it comes down to basic philosophy:
>>
>> "SMT is a distinct feature, separate from SMP, and I think that it is
>> important to keep that distinction."
>>
>> You guys have chosen to remove that distinction, and to remove the
>> choice for many specialised, such as embedded, situations, where they
>> would maybe want that choice.
> 
> They have that choice. SMT can be disabled on kernel cmdline, and in many
> cases also in BIOS.
> 

SCHED_SMT does not control hyperthreading... it just controls the OS awareness
of it in the scheduler (e.g. it knows about shared caches).
Even without SCHED_SMT will you see all the logical CPUs... you just get more shitty
scheduling behavior.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SCHEDL_SMT forced on!
  2018-12-16 21:58         ` Barry Kauler
  2018-12-16 22:01           ` Jiri Kosina
@ 2018-12-17  8:36           ` Peter Zijlstra
  1 sibling, 0 replies; 13+ messages in thread
From: Peter Zijlstra @ 2018-12-17  8:36 UTC (permalink / raw)
  To: Barry Kauler
  Cc: Jiri Kosina, Andi Kleen, Greg KH, Thomas Gleixner,
	Andy Lutomirski, Linus Torvalds, Tom Lendacky, Josh Poimboeuf,
	Andrea Arcangeli, David Woodhouse, Tim Chen, Dave Hansen,
	Casey Schaufler, Asit Mallick, Arjan van de Ven, Jon Masters,
	Waiman Long, Dave Stewart, Kees Cook, stable

On Mon, Dec 17, 2018 at 05:58:11AM +0800, Barry Kauler wrote:
> 
> "SMT is a distinct feature, separate from SMP, and I think that it is
> important to keep that distinction."

Note that building a kernel without CONFIG_SCHED_SMT does _NOT_ disable
SMT. All it accomplishes is that the scheduler will not be SMT aware and
consider each SMT-sibling as a fully independent CPU.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-12-17  8:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-16  6:21 SCHEDL_SMT forced on! Barry Kauler
2018-12-16  8:27 ` Greg KH
2018-12-16 17:39   ` Andi Kleen
2018-12-16 21:29     ` Barry Kauler
2018-12-16 21:37       ` Jiri Kosina
2018-12-16 21:58         ` Barry Kauler
2018-12-16 22:01           ` Jiri Kosina
2018-12-16 22:12             ` Jiri Kosina
2018-12-16 22:26               ` Barry Kauler
2018-12-16 22:13             ` Barry Kauler
2018-12-16 22:17               ` Jiri Kosina
2018-12-16 22:31             ` Arjan van de Ven
2018-12-17  8:36           ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).