Received: by 10.223.164.202 with SMTP id h10csp211527wrb; Mon, 13 Nov 2017 05:20:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMaziOhAj7H1hqYpckOegQ7KBdG1QslUKEIAx2WY8ho8pDPWYLT+5dw5PI6q2d843LoAPnwt X-Received: by 10.84.130.67 with SMTP id 61mr4468391plc.368.1510579255780; Mon, 13 Nov 2017 05:20:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510579255; cv=none; d=google.com; s=arc-20160816; b=MkxKnQRBldSXxVpbgF80Tbo74lq887GTVmfwxXG+0Z+mQsrSIpkhQtUoxdGJdxLxr+ EDQB/1znT+QnxALyxdEDgOx+VUU0kRVxuBHwa31c4C8SawmJ7Fq+B8XaPOptruEN3awd geOfLpy9BP/Gd5X9MoInt32zyHVBgIRHB0rhYdSs1xEgD0X1W1mbb+/u71t6VGs5ZfCt q3PbB0jq2bD5cw1ALWPhIHhmyYlIqUi+MxXXhnQ8cU/ApxmclA2wL8gXqY5nTIwqmibw I4ec1ue5yt50BG1VRr6otDvbVgl1g2yGqW+je5vqiAhMeUaTeQNUoEIa1L8uVKY0cXmF Beag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=PqVrDkk3Mma+gJZkJ1YrQt/onEuRNWujIzCrqVcDpjo=; b=ee/o8eU303CaKLiq/3MQLsBWx8ufCl9Zoh9ZRVdDMWkwcms4UDo8Rkibt6lG3rPcVW WyeTOAq6RUqKi/H73AJ/kJ/KAxtjUSptavx+XwzICsAvK4e2EyYKIvnrUIbbFOR7OLuj /G3kqMZWFoYZAWL4IUCruF0if5ZG+DMPrMRJyZT5sKRyCF3gDHZ6jQM4QRkgEEahFCxf 9BXoMYCWtpqHLU6AC8Yvq8dGaZmom1oe9NUtlsjFACSAY6dIzTHvlgPGecS0byhdRBOF H8Q6N5Ln4+qx6TcDI4yBOeodzrRp0Xoa9cHVRqHw1nV7h2xCpugoO0uxhf5zP/JkLN1A Ragg== ARC-Authentication-Results: i=1; mx.google.com; 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 bg5si106217plb.458.2017.11.13.05.20.43; Mon, 13 Nov 2017 05:20:55 -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; 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 S1754822AbdKMNUI (ORCPT + 95 others); Mon, 13 Nov 2017 08:20:08 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50544 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754187AbdKMNCD (ORCPT ); Mon, 13 Nov 2017 08:02:03 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 811EDAB7; Mon, 13 Nov 2017 13:02:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matt Redfearn , "Maciej W. Rozycki" , Jiri Slaby , Paul Gortmaker , Chris Metcalf , Thomas Gleixner , Qais Yousef , James Hogan , Paul Burton , Marcin Nowakowski , Andrew Morton , linux-mips@linux-mips.org, Ralf Baechle Subject: [PATCH 4.9 67/87] MIPS: SMP: Use a completion event to signal CPU up Date: Mon, 13 Nov 2017 13:56:24 +0100 Message-Id: <20171113125621.386609934@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matt Redfearn commit a00eeede507c975087b7b8df8cf2c9f88ba285de upstream. If a secondary CPU failed to start, for any reason, the CPU requesting the secondary to start would get stuck in the loop waiting for the secondary to be present in the cpu_callin_map. Rather than that, use a completion event to signal that the secondary CPU has started and is waiting to synchronise counters. Since the CPU presence will no longer be marked in cpu_callin_map, remove the redundant test from arch_cpu_idle_dead(). Signed-off-by: Matt Redfearn Cc: Maciej W. Rozycki Cc: Jiri Slaby Cc: Paul Gortmaker Cc: Chris Metcalf Cc: Thomas Gleixner Cc: Qais Yousef Cc: James Hogan Cc: Paul Burton Cc: Marcin Nowakowski Cc: Andrew Morton Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/14502/ Signed-off-by: Ralf Baechle Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/process.c | 4 +--- arch/mips/kernel/smp.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -50,9 +50,7 @@ #ifdef CONFIG_HOTPLUG_CPU void arch_cpu_idle_dead(void) { - /* What the heck is this check doing ? */ - if (!cpumask_test_cpu(smp_processor_id(), &cpu_callin_map)) - play_dead(); + play_dead(); } #endif --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -68,6 +68,8 @@ EXPORT_SYMBOL(cpu_sibling_map); cpumask_t cpu_core_map[NR_CPUS] __read_mostly; EXPORT_SYMBOL(cpu_core_map); +static DECLARE_COMPLETION(cpu_running); + /* * A logcal cpu mask containing only one VPE per core to * reduce the number of IPIs on large MT systems. @@ -369,7 +371,7 @@ asmlinkage void start_secondary(void) cpumask_set_cpu(cpu, &cpu_coherent_mask); notify_cpu_starting(cpu); - cpumask_set_cpu(cpu, &cpu_callin_map); + complete(&cpu_running); synchronise_count_slave(cpu); set_cpu_online(cpu, true); @@ -430,7 +432,6 @@ void smp_prepare_boot_cpu(void) { set_cpu_possible(0, true); set_cpu_online(0, true); - cpumask_set_cpu(0, &cpu_callin_map); } int __cpu_up(unsigned int cpu, struct task_struct *tidle) @@ -438,11 +439,13 @@ int __cpu_up(unsigned int cpu, struct ta mp_ops->boot_secondary(cpu, tidle); /* - * Trust is futile. We should really have timeouts ... + * We must check for timeout here, as the CPU will not be marked + * online until the counters are synchronised. */ - while (!cpumask_test_cpu(cpu, &cpu_callin_map)) { - udelay(100); - schedule(); + if (!wait_for_completion_timeout(&cpu_running, + msecs_to_jiffies(1000))) { + pr_crit("CPU%u: failed to start\n", cpu); + return -EIO; } synchronise_count_master(cpu); From 1583042245998791511@xxx Fri Nov 03 10:58:51 +0000 2017 X-GM-THRID: 1583042245998791511 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread