mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Valentin Schneider <valentin.schneider@arm.com>,
	linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, peterz@infradead.org,
	vincent.guittot@linaro.org, morten.rasmussen@arm.com,
	mgorman@suse.de, song.bao.hua@hisilicon.com
Subject: Re: [PATCH 1/1] sched/topology: Make sched_init_numa() use a set for the deduplicating sort
Date: Mon, 1 Feb 2021 10:53:53 +0100	[thread overview]
Message-ID: <6000e39e-7d28-c360-9cd6-8798fd22a9bf@arm.com> (raw)
In-Reply-To: <20210122123943.1217-2-valentin.schneider@arm.com>

On 22/01/2021 13:39, Valentin Schneider wrote:

[...]

> @@ -1705,7 +1702,7 @@ void sched_init_numa(void)
>  	/* Compute default topology size */
>  	for (i = 0; sched_domain_topology[i].mask; i++);
>  
> -	tl = kzalloc((i + level + 1) *
> +	tl = kzalloc((i + nr_levels) *
>  			sizeof(struct sched_domain_topology_level), GFP_KERNEL);
>  	if (!tl)
>  		return;

This hunk creates issues during startup on my Arm64 juno board on tip/sched/core.

---8<---

From: Dietmar Eggemann <dietmar.eggemann@arm.com>
Date: Mon, 1 Feb 2021 09:58:04 +0100
Subject: [PATCH] sched/topology: Fix sched_domain_topology_level alloc in
 sched_init_numa

Commit "sched/topology: Make sched_init_numa() use a set for the
deduplicating sort" allocates 'i + nr_levels (level)' instead of
'i + nr_levels + 1' sched_domain_topology_level.

This led to an Oops (on Arm64 juno with CONFIG_SCHED_DEBUG):

sched_init_domains
  build_sched_domains()
    __free_domain_allocs()
      __sdt_free() {
	...
        for_each_sd_topology(tl)
	  ...
          sd = *per_cpu_ptr(sdd->sd, j); <--
	  ...
      }

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
---

./scripts/decode_stacktrace.sh ./vmlinux < input.log

[    0.495693] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[    0.501280] Modules linked in:
[    0.504342] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.11.0-rc2-00025-g7a976f77bb96 #95
[    0.512455] Hardware name: ARM Juno development board (r0) (DT)
[    0.518386] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
[    0.524409] pc : build_sched_domains (kernel/sched/topology.c:1872 kernel/sched/topology.c:1288 kernel/sched/topology.c:2120)
[    0.529132] lr : build_sched_domains (kernel/sched/topology.c:1868 kernel/sched/topology.c:1288 kernel/sched/topology.c:2120)
[    0.533847] sp : ffff800011efbd00
[    0.537165] x29: ffff800011efbd00 x28: ffff800011b69a38
[    0.542496] x27: 0000000000000000 x26: 0000000000000000
[    0.547827] x25: ffff000800191600 x24: 0000000000000000
[    0.553157] x23: ffff800011b69a40 x22: 0000000000000001
[    0.558487] x21: ffff000800056e00 x20: ffff00080016f380
[    0.563818] x19: ffff800011b6a410 x18: 0000000000000000
[    0.569149] x17: 0000000000000000 x16: 0000000000000000
[    0.574478] x15: 0000000000000030 x14: ffffffffffffffff
[    0.579809] x13: ffff800011b82d38 x12: 0000000000000189
[    0.585139] x11: 0000000000000083 x10: ffff800011bdad38
[    0.590469] x9 : 00000000fffff000 x8 : ffff800011b82d38
[    0.595800] x7 : 00000000000000e0 x6 : 000000000000003f
[    0.601130] x5 : 0000000000000000 x4 : 0000000000000000
[    0.606460] x3 : 0000000000000000 x2 : ffff80096d857000
[    0.611790] x1 : 0000000000000001 x0 : 0000000000000001
[    0.617120] Call trace:
[    0.619566] build_sched_domains (kernel/sched/topology.c:1872 kernel/sched/topology.c:1288 kernel/sched/topology.c:2120)
[    0.623934] sched_init_domains (kernel/sched/topology.c:2194)
[    0.627954] sched_init_smp (kernel/sched/core.c:7727)
[    0.631629] kernel_init_freeable (init/main.c:1528)
[    0.635914] kernel_init (init/main.c:1417)
[    0.639416] ret_from_fork (arch/arm64/kernel/entry.S:959)
[ 0.643008] Code: b4000360 93407f1b aa0003e1 f87b7ae2 (f8626821)
All code
========
   0:	60                   	(bad)
   1:	03 00                	add    (%rax),%eax
   3:	b4 1b                	mov    $0x1b,%ah
   5:	7f 40                	jg     0x47
   7:	93                   	xchg   %eax,%ebx
   8:	e1 03                	loope  0xd
   a:	00 aa e2 7a 7b f8    	add    %ch,-0x784851e(%rdx)
  10:*	21 68 62             	and    %ebp,0x62(%rax)		<-- trapping instruction
  13:	f8                   	clc

Code starting with the faulting instruction
===========================================
   0:	21 68 62             	and    %ebp,0x62(%rax)
   3:	f8                   	clc
[    0.649129] ---[ end trace 4453f742a7781011 ]---
[    0.653772] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    0.661449] SMP: stopping secondary CPUs
[    0.665389] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

 kernel/sched/topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index bf5c9bd10bfe..09d35044bd88 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1702,7 +1702,7 @@ void sched_init_numa(void)
 	/* Compute default topology size */
 	for (i = 0; sched_domain_topology[i].mask; i++);
 
-	tl = kzalloc((i + nr_levels) *
+	tl = kzalloc((i + nr_levels + 1) *
 			sizeof(struct sched_domain_topology_level), GFP_KERNEL);
 	if (!tl)
 		return;
-- 
2.25.1

  parent reply	other threads:[~2021-02-01  9:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 12:39 [PATCH 0/1] sched/topology: NUMA distance deduplication Valentin Schneider
2021-01-22 12:39 ` [PATCH 1/1] sched/topology: Make sched_init_numa() use a set for the deduplicating sort Valentin Schneider
2021-01-25  2:23   ` Song Bao Hua (Barry Song)
2021-01-25  9:26     ` Valentin Schneider
2021-01-25 16:45       ` Valentin Schneider
2021-01-25 21:35         ` Song Bao Hua (Barry Song)
2021-01-28 14:47           ` Valentin Schneider
2021-01-29  2:02             ` Song Bao Hua (Barry Song)
2021-02-01 12:03               ` Valentin Schneider
2021-02-01  9:53   ` Dietmar Eggemann [this message]
2021-02-01 10:19     ` Vincent Guittot
2021-02-01 10:35     ` Song Bao Hua (Barry Song)
2021-02-01 11:55     ` Valentin Schneider
2021-02-02 10:03     ` [tip: sched/core] sched/topology: Fix sched_domain_topology_level alloc in sched_init_numa() tip-bot2 for Dietmar Eggemann
2021-02-17 13:17     ` tip-bot2 for Dietmar Eggemann

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=6000e39e-7d28-c360-9cd6-8798fd22a9bf@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=song.bao.hua@hisilicon.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.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

Powered by JetHome