From: Petr Mladek <pmladek@suse.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: linux-kernel@vger.kernel.org, Wanpeng Li <wanpeng.li@hotmail.com>,
Ingo Molnar <mingo@kernel.org>, Mike Galbraith <efault@gmx.de>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2] sched/fair: Fix dereference NULL sched domain during select_idle_sibling
Date: Mon, 17 Oct 2016 13:29:05 +0200 [thread overview]
Message-ID: <20161017112905.GO23809@pathway.suse.cz> (raw)
In-Reply-To: <1475971443-3187-1-git-send-email-wanpeng.li@hotmail.com>
On Sun 2016-10-09 08:04:03, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> Commit:
>
> 10e2f1acd01 ("sched/core: Rewrite and improve select_idle_siblings()")
>
> ... improved select_idle_sibling() but also triggered a regression:
>
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000078
> IP: [<ffffffffb10cd332>] select_idle_sibling+0x1c2/0x4f0
> PGD 0
> Oops: 0000 [#1] SMP
> CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.8.0+ #16
> RIP: 0010:[<ffffffffb10cd332>] [<ffffffffb10cd332>] select_idle_sibling+0x1c2/0x4f0
> Call Trace:
> <IRQ>
> select_task_rq_fair+0x749/0x930
> ? select_task_rq_fair+0xb4/0x930
> ? __lock_is_held+0x54/0x70
> try_to_wake_up+0x19a/0x5b0
> default_wake_function+0x12/0x20
> autoremove_wake_function+0x12/0x40
> __wake_up_common+0x55/0x90
> __wake_up+0x39/0x50
> wake_up_klogd_work_func+0x40/0x60
> irq_work_run_list+0x57/0x80
> irq_work_run+0x2c/0x30
> smp_irq_work_interrupt+0x2e/0x40
> irq_work_interrupt+0x96/0xa0
> <EOI>
> ? _raw_spin_unlock_irqrestore+0x45/0x80
> try_to_wake_up+0x4a/0x5b0
> wake_up_state+0x10/0x20
> __kthread_unpark+0x67/0x70
> kthread_unpark+0x22/0x30
> cpuhp_online_idle+0x3e/0x70
> cpu_startup_entry+0x6a/0x450
> start_secondary+0x154/0x180
>
> This can be reproduced by running the ftrace test case of kselftest, the
> test case will hot-unplug the cpu and the cpu will attach to the NULL
> sched-domain during scheduler teardown.
>
> The step 2 for the rewrite select_idle_siblings():
>
> | Step 2) tracks the average cost of the scan and compares this to the
> | average idle time guestimate for the CPU doing the wakeup.
>
> If the cpu which doing the wakeup is the going hot-unplug cpu, then NULL
> sched domain will be dereferenced to acquire the average cost of the scan.
>
> This patch fix it by failing the search of an idle CPU in the LLC process
> if this sched domain is NULL.
>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
This patch helped me as well. I tested intel_powerclamp
conversion to the new CPU hotplug state machine. And this
problem was very easy to trigger.
Feel free to add
Tested-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
prev parent reply other threads:[~2016-10-17 11:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 0:04 Wanpeng Li
2016-10-10 10:25 ` Catalin Marinas
2016-10-11 9:52 ` [tip:sched/urgent] sched/fair: Fix sched domains NULL dereference in select_idle_sibling() tip-bot for Wanpeng Li
2016-10-17 11:29 ` Petr Mladek [this message]
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=20161017112905.GO23809@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=efault@gmx.de \
--cc=kernellwp@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=wanpeng.li@hotmail.com \
/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
Powered by JetHome