Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3753848pxb; Mon, 1 Feb 2021 04:00:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOdQb2g7mcEbg1A+GY8e4lpsg7hNo8c8Sv/qeSngJjbB3NBxLc/2oLMFJ0SA7G+9YqvCl0 X-Received: by 2002:aa7:d148:: with SMTP id r8mr18340381edo.127.1612180803393; Mon, 01 Feb 2021 04:00:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612180803; cv=none; d=google.com; s=arc-20160816; b=TFCWk0n6Nj4RTEV7FstWdYHgMrbv4OJ3P0e1UpjCwnv+SBn8GTRHRrKuyHYSVY6pof qCKTcGWkfwgvRPwa7QLDoPFsWML797oLqm5vZZS9wX8IpiFZR00Wn9yq2LTBs0FEESHx a5PAOB4kxmo7TJfqWrprydxOWVrn0j0JjltVP7gKrQaXP5mSTy7Ysu02ZxpPXzEpy7sK kK/6fiYFCiUj49GCVBHj8SGewezrJfnJAiFplMoUArEqFsgqwpAYXSZa04lLa+yBlbUt ZRn8A/YfcUHMFmi/tNZxXk887rctxN1+XlOc+LWYResKBIYG3E7kGFEygtdLlVEhlQSc W2XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from; bh=Jkp9bD9F1253/ilvlRBkDdE10NTQ45ycAjr+YPCJSek=; b=kTZLXRX8brkpkdrid8K0BGKzXczPR+KFC1poN496ZKGfItDwdOYoJUIh+39YyLkNt4 OPe5D+RxM9M+y6sjTbhMzevTV5oMyRqbjCXYrKlgYHFBy0o4T5X+ikELhXHn+i5f3BFZ EgA7wa87Rz4R7uDkhExkst8VjmgZ/tjoEWswIMS0nNTgRV0Edr5Jtcme3ONcaj0UTqJv Px0PiLwlS+maLDlbl61tGIoqm7vYjf62YiUkqNJKOWcmzF/F0akNE49PsA4dU+jAEQEu hZAN70gMcwp9Y4ABSc24l8OCGG1fe5tVOVpt9yQfhu8BvVj3+cjSuPkRLTQuohaIL0O9 KJ+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x5si2907289edi.139.2021.02.01.03.59.39; Mon, 01 Feb 2021 04:00:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229831AbhBAL4W (ORCPT + 99 others); Mon, 1 Feb 2021 06:56:22 -0500 Received: from foss.arm.com ([217.140.110.172]:57552 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbhBAL4W (ORCPT ); Mon, 1 Feb 2021 06:56:22 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BC30CED1; Mon, 1 Feb 2021 03:55:36 -0800 (PST) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9EE813F718; Mon, 1 Feb 2021 03:55:35 -0800 (PST) From: Valentin Schneider To: Dietmar Eggemann , 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 In-Reply-To: <6000e39e-7d28-c360-9cd6-8798fd22a9bf@arm.com> References: <20210122123943.1217-1-valentin.schneider@arm.com> <20210122123943.1217-2-valentin.schneider@arm.com> <6000e39e-7d28-c360-9cd6-8798fd22a9bf@arm.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Mon, 01 Feb 2021 11:55:30 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/02/21 10:53, Dietmar Eggemann wrote: > 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 > 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 Damn, I forgot the topology level stuff must terminate in a NULL'd sentinel! Vincent fixed the same thing a few years ago... c515db8cd311 ("sched/numa: Fix initialization of sched_domain_topology for NUMA") Thanks for fixing up my mistake, I ought to have tested !NUMA setups.