From: Yinghai Lu <yinghai@kernel.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Infinite loop on boot in free_early_partial due to start==end on tip/master
Date: Fri, 05 Mar 2010 10:16:01 -0800 [thread overview]
Message-ID: <4B914A61.20409@kernel.org> (raw)
In-Reply-To: <1267801390.11737.38014.camel@zakaz.uk.xensource.com>
>
> It's also possible that the presence or absence of PSE is responsible,
> since it impacts atom_size which feeds into alloc_size and has an impact
> on all these calculations.
>
> I was able to reproduce on native 32 bit by disabling PSE and
> artificially increasing dyn_size.
>
> (early) [ 0.000000] pcpu_build_alloc_info initial max_upa/upa is 1
> (early) [ 0.000000] pcpu_build_alloc_info after expansion best_upa/upa is 1
> (early) [ 0.000000] reserve_early_without_check: 0x1ce3000-0x1ce4000 "BOOTMEM"
> (early) [ 0.000000] pcpu_build_alloc_info unit_size 122880 == alloc_size 122880 / upa 1
> (early) [ 0.000000] pcpu_embed_first_chunk size_sum = 122880
> (early) [ 0.000000] pcpu_embed_first_chunk static_size = 91304
> (early) [ 0.000000] pcpu_embed_first_chunk reserved_size = 8192
> (early) [ 0.000000] pcpu_embed_first_chunk dyn_size = 23384
> (early) [ 0.000000] pcpu_embed_first_chunk unit_size 122880
>
> I guess the arises from fb90ef93 "early_res: Add free_early_partial"
> since I don't see any other changes in this area recently.
>
> Following patch fixes this specific issue and adds a warning to catch
> future potential errors of this type.
>
> ---
> Subject: x86: do not free zero sized per cpu areas
>
> This avoids an infinite loop in free_early_partial().
>
> Add a warning to free_early_partial to catch future problems.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>
> diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
> index ef6370b..89a3205 100644
> --- a/arch/x86/kernel/setup_percpu.c
> +++ b/arch/x86/kernel/setup_percpu.c
> @@ -140,7 +140,8 @@ static void __init pcpu_fc_free(void *ptr, size_t size)
> #ifdef CONFIG_NO_BOOTMEM
> u64 start = __pa(ptr);
> u64 end = start + size;
> - free_early_partial(start, end);
> + if (start < end)
> + free_early_partial(start, end);
> #else
> free_bootmem(__pa(ptr), size);
> #endif
> diff --git a/kernel/early_res.c b/kernel/early_res.c
> index 3cb2c66..fbde443 100644
> --- a/kernel/early_res.c
> +++ b/kernel/early_res.c
> @@ -333,6 +333,8 @@ void __init free_early_partial(u64 start, u64 end)
> struct early_res *r;
> int i;
>
> + WARN_ON(start>=end);
> +
> try_next:
> i = find_overlapped_early(start, end);
> if (i >= max_early_res)
>
can you change to
> @@ -333,6 +333,11 @@ void __init free_early_partial(u64 start, u64 end)
> struct early_res *r;
> int i;
>
> + if (unlikely(start>=end)) {
> + WARN_ONCE(1, "free_early_partial get wrong start/end\n:);
> + return;
> + }
> +
> try_next:
> i = find_overlapped_early(start, end);
> if (i >= max_early_res)
>
Thanks
Yinghai
next prev parent reply other threads:[~2010-03-05 18:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-05 15:03 Infinite loop on boot in free_early_partial due to start==end on tip/master Ian Campbell
2010-03-05 18:16 ` Yinghai Lu [this message]
2010-03-05 19:45 ` Ian Campbell
2010-03-05 19:49 ` [PATCH] x86: do not free zero sized per cpu areas Ian Campbell
2010-03-05 19:51 ` Yinghai Lu
2010-03-19 19:24 ` Yinghai Lu
2010-03-19 21:42 ` H. Peter Anvin
2010-03-19 22:18 ` [PATCH -v3] " Yinghai Lu
2010-03-19 22:21 ` H. Peter Anvin
2010-03-19 23:24 ` Yinghai Lu
2010-03-19 23:29 ` H. Peter Anvin
2010-03-19 23:45 ` [PATCH -v4] " Yinghai Lu
2010-03-20 1:00 ` Linus Torvalds
2010-03-20 1:59 ` [PATCH -v5] " Yinghai Lu
2010-03-20 2:41 ` Linus Torvalds
2010-03-20 6:38 ` [PATCH -v6] " Yinghai Lu
2010-03-20 7:12 ` Ian Campbell
2010-03-22 17:30 ` [LKML] " Konrad Rzeszutek Wilk
2010-03-19 23:35 ` [PATCH -v3] " Ian Campbell
2010-03-19 23:43 ` Ian Campbell
2010-03-19 23:43 ` H. Peter Anvin
2010-03-19 18:28 ` Infinite loop on boot in free_early_partial due to start==end on tip/master Konrad Rzeszutek Wilk
2010-03-19 19:04 ` Yinghai Lu
2010-03-19 19:34 ` Ian Campbell
2010-03-19 20:04 ` [LKML] " Konrad Rzeszutek Wilk
2010-03-19 21:17 ` Yinghai Lu
2010-03-19 21:37 ` Ian Campbell
2010-03-20 3:37 ` Tejun Heo
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=4B914A61.20409@kernel.org \
--to=yinghai@kernel.org \
--cc=Ian.Campbell@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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