linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Guenter Roeck <linux@roeck-us.net>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Frederic Weisbecker <frederic@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	x86@kernel.org
Subject: Re: [tip: sched/core] sched/core: Initialize the idle task with preemption disabled
Date: Thu, 8 Jul 2021 00:35:23 +1000	[thread overview]
Message-ID: <de7b1d0f-8767-1b33-2950-576029c0d9f7@ozlabs.ru> (raw)
In-Reply-To: <c30097f3-63b4-6fa0-a369-8f4e20ee1040@roeck-us.net>



On 08/07/2021 00:14, Guenter Roeck wrote:
> On 7/7/21 5:11 AM, Valentin Schneider wrote:
>> On 07/07/21 14:03, Frederic Weisbecker wrote:
>>> On Wed, Jul 07, 2021 at 12:55:20AM +0100, Valentin Schneider wrote:
>>>> Thanks for the report.
>>>>
>>>> So somehow the init task ends up with a non-zero preempt_count()? Per
>>>> FORK_PREEMPT_COUNT we should exit __ret_from_fork() with a zero 
>>>> count, are
>>>> you hitting the WARN_ONCE() in finish_task_switch()?
>>>>
>>>> Does CONFIG_DEBUG_PREEMPT=y yield anything interesting?
>>>>
>>>> I can't make sense of this right now, but it's a bit late :) I'll 
>>>> grab some
>>>> toolchain+qemu tomorrow and go poke at it (and while at it I need to 
>>>> do the
>>>> same with powerpc).
>>>
>>> One possible issue is that s390's init_idle_preempt_count() doesn't 
>>> apply on the
>>> target idle task but on the _current_ CPU. And since smp_init() ->
>>> idle_threads_init() is actually called remotely, we are overwriting 
>>> the current
>>> CPU preempt_count() instead of the target one.
>>
>> Indeed, this becomes quite obvious when tracing the preemption count
>> changes. This also means that s390 relied on the idle_thread_get() 
>> from the
>> hotplug machinery to properly setup the preempt count, rather than
>> init_idle_preempt_count() - which is quite yuck.
>>
>> I'll write a patch for that and likely one for powerpc.
>>
> 
> Can you reproduce the problem with a powerpc qemu emulation ?
> If so, how do you reproduce it there ? Reason for asking is that I don't 
> see
> the problem with any of my powerpc emulations, and I would like to add test
> case(s) if possible.

I can reproduce the problem on powerpc easily - qemu with "-smp 2" does it.


-- 
Alexey

  reply	other threads:[~2021-07-07 14:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12  9:46 [PATCH] sched: Initialize the idle task with preemption disabled Valentin Schneider
2021-05-12 11:15 ` [tip: sched/core] sched/core: " tip-bot2 for Valentin Schneider
2021-07-06 19:44   ` Guenter Roeck
2021-07-06 23:55     ` Valentin Schneider
2021-07-07  4:06       ` Guenter Roeck
2021-07-07 12:03       ` Frederic Weisbecker
2021-07-07 12:11         ` Valentin Schneider
2021-07-07 14:14           ` Guenter Roeck
2021-07-07 14:35             ` Alexey Kardashevskiy [this message]
2021-07-07 14:57               ` Valentin Schneider
2021-07-07 15:31                 ` Guenter Roeck
2021-07-07 16:35                 ` Guenter Roeck
2021-07-07 17:31                   ` Valentin Schneider
2021-07-08  1:50                     ` Alexey Kardashevskiy

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=de7b1d0f-8767-1b33-2950-576029c0d9f7@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=valentin.schneider@arm.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).