From patchwork Thu Jan 16 23:17:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93588C33CB3 for ; Thu, 16 Jan 2020 23:41:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6706E2081E for ; Thu, 16 Jan 2020 23:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579218078; bh=ip16o6y/bxfpF03dpSq9CeN954KM9/rB1zBDlMUfgkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=B9cOhraT+O0WuHNAywBDLRUDaJIVRGx/qE9bctGqzmvh1fLaHW5bg2pih+CVnM+pB PEzosAvs9hidd/GiXZNUF/BFb0VR/umy4wyFCoh5yzUFJbHxwaK8DFB6Ppowri/O5n 9Fl3wU5TbeDnL7SSr0z0qShIU1s6k/fqSxfLaD4c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387501AbgAPX1W (ORCPT ); Thu, 16 Jan 2020 18:27:22 -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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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);