From: "Sironi, Filippo" <sironi@amazon.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>
Subject: Re: [PATCH] sched/fair: Prevent a division by 0 in scale_rt_capacity()
Date: Wed, 20 Dec 2017 16:45:42 +0000 [thread overview]
Message-ID: <80DE0B49-BAF8-42F5-93DF-4B4890DD8090@amazon.de> (raw)
In-Reply-To: <20171219193314.2wxiehzquoea5dnr@hirez.programming.kicks-ass.net>
> On 19. Dec 2017, at 20:33, Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Sat, Dec 09, 2017 at 09:03:49AM +0100, Filippo Sironi wrote:
>> ... since total = sched_avg_period() + delta can yield 0x100000000,
>> which results in a division by 0, given that div_u64() takes a u32
>> divisor. Use div64_u64() instead.
>>
>> divide error: 0000 [#1] SMP
>> CPU: 7 PID: 0 Comm: swapper/7 Not tainted 4.9.58 #1
>> Hardware name: ...
>> task: ffff8800a24e2800 task.stack: ffffc9000074c000
>> RIP: 0010:[<ffffffff810d36ae>] [<ffffffff810d36ae>] update_group_capacity+0x16e/0x1c0
>> RSP: 0018:ffff8800a74e3c18 EFLAGS: 00010246
>> RAX: 0000000000445ced RBX: 0000000000000007 RCX: 000000000000024d
>> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000000160c0
>> RBP: ffff8800a74e3c38 R08: ffff8800a17d5ac0 R09: ffff8800a74e0000
>> R10: 0000000000000000 R11: 0000000000000000 R12: ffff8800a297e400
>> R13: ffff8800a17d5ac0 R14: 0000000000000000 R15: ffff8800a17d5ac0
>> FS: 0000000000000000(0000) GS:ffff8800a74e0000(0000) knlGS:0000000000000000
>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00000000006f3580 CR3: 0000000001607000 CR4: 00000000007426e0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> PKRU: 55555554
>> Stack:
>> ffff8800a17d5180 ffff8800a74e3e00 ffff8800a17d5a01 ffff8800a74e3c68
>> ffff8800a74e3d90 ffffffff810d37e6 fffffffffffffff8 0000002300010c40
>> 0000000000000040 ffff8800a17d5ad8 0000000000000000 0000000000000000
>> Call Trace:
>> <IRQ> [162553.008569] [<ffffffff810d37e6>] find_busiest_group+0xe6/0x950
>> [<ffffffff810d41d8>] load_balance+0x188/0xa70
>> [<ffffffff810c1093>] ? update_rq_clock.part.88+0x13/0x30
>> [<ffffffff810d5110>] rebalance_domains+0x210/0x290
>> [<ffffffff810d5340>] run_rebalance_domains+0x1b0/0x1d0
>> [<ffffffff810a45d9>] __do_softirq+0x89/0x2b0
>> [<ffffffff810a494b>] irq_exit+0xab/0xb0
>> [<ffffffff8108462e>] smp_reschedule_interrupt+0x2e/0x30
>> [<ffffffff8139d594>] reschedule_interrupt+0x84/0x90
>> <EOI> [162553.008603] [<ffffffff813407bf>] ? cpuidle_enter_state+0x12f/0x2c0
>> [<ffffffff81340972>] cpuidle_enter+0x12/0x20
>> [<ffffffff810dab22>] cpu_startup_entry+0x1a2/0x1f0
>> [<ffffffff810851ad>] start_secondary+0x12d/0x140
>> Code: 0f 00 4c 8b 96 48 09 00 00 48 8b 86 40 09 00 00 48 8b b6 b0 08 00 00 48 d1 ea 4c 29 d6 41 ba 00 00 00 00 49 0f 48 f2 01 d6 31 d2 <48> f7 f6 ba 00 04 00 00 48 29 c2 48 3d ff 03 00 00 b8 01 00 00
>> RIP [<ffffffff810d36ae>] update_group_capacity+0x16e/0x1c0
>> RSP <ffff8800a74e3c18>
>>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Filippo Sironi <sironi@amazon.de>
>> ---
>> kernel/sched/fair.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 4037e19bbca2..04b6f847a241 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -7517,7 +7517,7 @@ static unsigned long scale_rt_capacity(int cpu)
>>
>> total = sched_avg_period() + delta;
>>
>> - used = div_u64(avg, total);
>> + used = div64_u64(avg, total);
>>
>
> so total should not get larger than 2*period IIRC, how did we get so
> large?
>
>From the vmcores I got, it was always delta that made it become very
large.
Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
prev parent reply other threads:[~2017-12-20 17:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-09 8:03 Filippo Sironi
2017-12-11 21:02 ` Rohit Jain
2017-12-19 19:33 ` Peter Zijlstra
2017-12-20 16:45 ` Sironi, Filippo [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=80DE0B49-BAF8-42F5-93DF-4B4890DD8090@amazon.de \
--to=sironi@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®