Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8479130ybl; Thu, 16 Jan 2020 17:41:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxIwfvWPxpkoOfQ3/A0DuKqs70M35Ci34R95rro+eUH9PaVjW98YTxOsDmYBV9erjMSHFBe X-Received: by 2002:a9d:7d81:: with SMTP id j1mr4463495otn.267.1579225308235; Thu, 16 Jan 2020 17:41:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579225308; cv=none; d=google.com; s=arc-20160816; b=UuZTPoFkVG9nP9X3TxgkfYb8SoZptYq6h93S/RWrLRaApn/FgsMOwDcR1ah58D3s9q 4ZkOFshUhXlBe0fjLdbur2cto+uOeUgGW6uAHZ+Pbxf8/cevK1vtRVLuP/DYwtf9R/xt Yagmyrp1Xw2AAgyR1wY5MdkTIvgDhYiu7keDixHfOcqcUyRrAEui0X+50tXggE/xaaaO 0VHAsin17t/2xdyzC/3x7fjVD0apEpWySHmDRMPc6Ozr7J25n5R5B4IacsTIHh+F9a7y r40Hj9jtNRg5piKbUSyRjDqrRPnKPZa0JUjDqecLBUxnMIGpSSlXX9JrClpvtE/hRWAH hFpA== 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=oISa3uQjBD8hEu0TYqIxqzrujIrkgN8kRlBLJYED1Vs=; b=EK0KcOGAUMsnh6HelkHsUQVPoPHG8xZTSbk73Vfmt5EMbAYTzVTc9SsLTZlXnsnjWz BPuIuPYrnOflgO/0CsZhRf8wB3ch147dCsere44NOb9F8AmK+z+rttdebi/Obs/4kFwO Ug+jE/r5Nup86CUAyXQZNMDU3dT1GNcLW+kuRK25ZNe9qfSOttQfgMe+Qyqb9JdC7a07 +1R5kroDY5uzZt/iwu4iLRdJaU+PsfIChaiCvfPpw64GQI/AN4XKbQp8Azgp4yh/IXwj BopOFi4HBfzh70sqauOZGuXD5hipJoKBJiJgC0x5W2MYFNGcgtnpINl7EQj4EDA/7/CC pilA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dIf1P/vW"; 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 e22si13848768oiy.124.2020.01.16.17.41.36; Thu, 16 Jan 2020 17:41:48 -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="dIf1P/vW"; 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 S2390256AbgAPX1e (ORCPT + 99 others); Thu, 16 Jan 2020 18:27:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:55118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391116AbgAPXZ2 (ORCPT ); Thu, 16 Jan 2020 18:25:28 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1CB942072E; Thu, 16 Jan 2020 23:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217127; bh=ip16o6y/bxfpF03dpSq9CeN954KM9/rB1zBDlMUfgkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dIf1P/vWP65hzHLjFA+P3Y7apoMtJuEV7YNnU26HsOCypeuNVf1EjuXg9frrMIFSO h+6HY2RQfbVeLTSg3Sri3Pkr/l8sQZjsOjBz+jgkI3IOuTQn6KgYJBDrTn6InQcom2 Mp8KOCfO3moACsqyHvU0QSRFg6x+LNVyaNw//648= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Bogendoerfer , Paul Burton , Ralf Baechle , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH 5.4 142/203] MIPS: SGI-IP27: Fix crash, when CPUs are disabled via nr_cpus parameter Date: Fri, 17 Jan 2020 00:17:39 +0100 Message-Id: <20200116231757.391207929@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231745.218684830@linuxfoundation.org> References: <20200116231745.218684830@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Thomas Bogendoerfer commit e3d765a941f6130fd94e47b2064cfee71f4cbadd upstream. If number of CPUs are limited by the kernel commandline parameter nr_cpus assignment of interrupts accourding to numa rules might not be possibe. As a fallback use one of the online CPUs as interrupt destination. Fixes: 69a07a41d908 ("MIPS: SGI-IP27: rework HUB interrupts") Signed-off-by: Thomas Bogendoerfer Signed-off-by: Paul Burton Cc: Ralf Baechle Cc: James Hogan Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/mips/sgi-ip27/ip27-irq.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/mips/sgi-ip27/ip27-irq.c +++ b/arch/mips/sgi-ip27/ip27-irq.c @@ -73,6 +73,9 @@ static void setup_hub_mask(struct hub_ir int cpu; cpu = cpumask_first_and(mask, cpu_online_mask); + if (cpu >= nr_cpu_ids) + cpu = cpumask_any(cpu_online_mask); + nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); hd->cpu = cpu; if (!cputoslice(cpu)) { @@ -139,6 +142,7 @@ static int hub_domain_alloc(struct irq_d /* use CPU connected to nearest hub */ hub = hub_data(NASID_TO_COMPACT_NODEID(info->nasid)); setup_hub_mask(hd, &hub->h_cpus); + info->nasid = cpu_to_node(hd->cpu); /* Make sure it's not already pending when we connect it. */ REMOTE_HUB_CLR_INTR(info->nasid, swlevel);