Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3490772imu; Sun, 11 Nov 2018 16:17:22 -0800 (PST) X-Google-Smtp-Source: AJdET5fq5w8+jeKNpSTXvjiC0vFaHiUdq41HyC8LtgII5aermYuLkzwTYhWalbaGZHrtsX7/Slb3 X-Received: by 2002:a17:902:744b:: with SMTP id e11-v6mr1668444plt.67.1541981842793; Sun, 11 Nov 2018 16:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981842; cv=none; d=google.com; s=arc-20160816; b=OMRuAJHCO4al1ejcto5aFtcgV3zT6liaeFXG4WRnWBCwFyJvTXfa6BQxp7JBBbxhEd meR/ZYBEZR8UtLjyKD3NKmJ+Fyln95/pUOUtoFucpp8ABez6nj1WYNZ4/HF2Ci4Iacws hBP5Fw2myxkiAF8QyoRZsvNhDtC4P9Ev1SAe1IIpV/p0OlO/+sJGftgWr0T+ttbPyUjV ZnxvAK3nyTu9/3AY0NIBFwzRndOrTM6CGy3RuYi/J98kKmXWr72GW9KkO/TPKVe5s2kU xKuQNkvWy6cz/K3bCPz8ZYOOpsXbJGvGg2bxMmyW43hJj8uoLyLOQ5eVWscro6DvIXF7 chfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WcCGjvNhHo7InvGIPUBfFZsqtPdaxITo9r1J95kBwl4=; b=PtHbTpasrR224qFO+75Ii7zq9wGiS6iLPA3QO/+esUxrCpXw50cTjGbCiuA5T88wQa MTS72An6szSJRCt8H3CLbZ2UhOZmL2DdlHaXC8rGFhUrXAZeUZmNV0gBHjZvxJakPUYx ComcMjG0iGVyJL1I1PfAtqMcLBe/RkHGMMaAmOVpvtY/CjP3Ha90nggz2r6+1bUMYdO0 9mwg9UW65EegLesbmeDqvYmG+8JvCaxNCzx3ecol/2QNoCzonyUix1iuwXkuTxSKgtkG p7lAWYfMK68F178lBU/FbDG/tVWQiKVm41NNsyK9tc91UWjfdBE4LgOgViW47pYtMOM4 Rg+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mSZ7bRt7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b24si4648086pgi.308.2018.11.11.16.17.07; Sun, 11 Nov 2018 16:17:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mSZ7bRt7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730149AbeKLIRF (ORCPT + 99 others); Mon, 12 Nov 2018 03:17:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:59376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730094AbeKLIRD (ORCPT ); Mon, 12 Nov 2018 03:17:03 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 591E82175B; Sun, 11 Nov 2018 22:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975227; bh=YLe9JA+/ljFvaLAQeuNcG8/wdX8eJQYlO4FVySp4pww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mSZ7bRt7ra3Cn6hgmgkTThDryw3LQ+SjhnHHujLH0sR85TgcKfzeAm5vBL94ffOEw 6XBTcd/7OOmhW0k2OFgphIZB2nRDz71Yr6qRXNcyrtUQrNvlFjteZKWOiIutVEWk36 tNevDd0fv0enLakQvyDtQbi4GxdZXrfUrcpSqEGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Jiang , Dan Williams , Thomas Gleixner , Alexander Duyck , Dave Hansen , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra Subject: [PATCH 4.19 046/361] x86/numa_emulation: Fix uniform-split numa emulation Date: Sun, 11 Nov 2018 14:16:33 -0800 Message-Id: <20181111221626.445125200@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dave Jiang commit c6ee7a548e2c291398b4f32c1f741c66b9f98e1c upstream. The numa_emulation() routine in the 'uniform' case walks through all the physical 'memblk' instances and divides them into N emulated nodes with split_nodes_size_interleave_uniform(). As each physical node is consumed it is removed from the physical memblk array in the numa_remove_memblk_from() helper. Since split_nodes_size_interleave_uniform() handles advancing the array as the 'memblk' is consumed it is expected that the base of the array is always specified as the argument. Otherwise, on multi-socket (> 2) configurations the uniform-split capability can generate an invalid numa configuration leading to boot failures with signatures like the following: rcu: INFO: rcu_sched detected stalls on CPUs/tasks: Sending NMI from CPU 0 to CPUs 2: NMI backtrace for cpu 2 CPU: 2 PID: 1332 Comm: pgdatinit0 Not tainted 4.19.0-rc8-next-20181019-baseline #59 RIP: 0010:__init_single_page.isra.74+0x81/0x90 [..] Call Trace: deferred_init_pages+0xaa/0xe3 deferred_init_memmap+0x18f/0x318 kthread+0xf8/0x130 ? deferred_free_pages.isra.105+0xc9/0xc9 ? kthread_stop+0x110/0x110 ret_from_fork+0x35/0x40 Fixes: 1f6a2c6d9f121 ("x86/numa_emulation: Introduce uniform split capability") Signed-off-by: Dave Jiang Signed-off-by: Dan Williams Signed-off-by: Thomas Gleixner Tested-by: Alexander Duyck Reviewed-by: Dave Hansen Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/154049911459.2685845.9210186007479774286.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/mm/numa_emulation.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -400,9 +400,17 @@ void __init numa_emulation(struct numa_m n = simple_strtoul(emu_cmdline, &emu_cmdline, 0); ret = -1; for_each_node_mask(i, physnode_mask) { + /* + * The reason we pass in blk[0] is due to + * numa_remove_memblk_from() called by + * emu_setup_memblk() will delete entry 0 + * and then move everything else up in the pi.blk + * array. Therefore we should always be looking + * at blk[0]. + */ ret = split_nodes_size_interleave_uniform(&ei, &pi, - pi.blk[i].start, pi.blk[i].end, 0, - n, &pi.blk[i], nid); + pi.blk[0].start, pi.blk[0].end, 0, + n, &pi.blk[0], nid); if (ret < 0) break; if (ret < n) {