Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4010391pxb; Tue, 25 Jan 2022 01:17:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR0paJcmJks0MjJsrzXSF7CT0R33f5sxfBcwj4JvXJeTuPL2Otyt9jWJ2RWzZvFesaMW/s X-Received: by 2002:a17:906:d555:: with SMTP id cr21mr6205242ejc.418.1643102260783; Tue, 25 Jan 2022 01:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643102260; cv=none; d=google.com; s=arc-20160816; b=o4altCnSGGKlRMnFSWNJPs7TYVWcImNF3tppk6mKhAVDi55HILlFHFI8sWYhPek8EK 278cLHQuEBn8lTueu4lTSHyjNBNhjdQOMD5ohBctCexOOMbKRabwSoNWdeiDzUh8GexC fNDOy8XVwVI29g2f1uvIFDhiIJzTOxOqWxv1fPowNq8KKpZMq8G1B6xcVxCTQdrMubJc 9UsaeVLoBF6GYo3eJBLKDTnsd6pfFc/N5kmam3ZcI2HcQ8xl03SZAbU5Uf1VwUg6GVBQ fKupDlHEHbtQhdFgEzHU5d0lxJtT/DlvHGh8EafaU+dx6EHa7NQOIayZlSglPOmRuSWY GHWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=dyT61F/+H7CcwaycbWvxPVLwL6aVpoLq1rauxes63zs=; b=j76ytDkUpkbIa1ue2r0VwvDmOV26ZzOYIncifI6Dtt3FPcjRRWrakRom3bEO+uRm04 /Pr1CCAsMxVHrQ/8OyxlbIgYa1tGzd8KdMvIpg7e759ziSeujyTX5dd95tDR8C/VeFHR PlYyi6utT7UZ8raCh2BDTXUX7A3eOGN+GmjnaPt3J5ttBzWJr2Rj6vaSsjlapMZX+FGO ksRW+ve9SFX6k7vVajZjKzBSdZviHsr5wu5YbRHhsirvVdjiI2sL85F7bpmPofJe327z 8WC54XZINW/Pji2BV0YbDuzn2momlgyrbTX5G9Eg45kBv7Mq4NVm1si5SO/kFMMzaHP3 H1wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rgGrd1A+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hg5si1719993ejc.279.2022.01.25.01.17.15; Tue, 25 Jan 2022 01:17:40 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rgGrd1A+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356308AbiAYHZD (ORCPT + 99 others); Tue, 25 Jan 2022 02:25:03 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:21140 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1443677AbiAYHV3 (ORCPT ); Tue, 25 Jan 2022 02:21:29 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20P4kQqF031034; Tue, 25 Jan 2022 07:21:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=dyT61F/+H7CcwaycbWvxPVLwL6aVpoLq1rauxes63zs=; b=rgGrd1A+UD8slBcMvDc/3dl3yYSXOc4LF7saLwl79d7a/DQPNQix65N4z2ywxydQMATQ 1K7u7JjcaDme47ImFOnKLRlqatNMU1EH0O4N28X8H/wguA+fIANPpIG8I32N4MMiE5x1 HQtC9HHeDTNBd+aU+NX/P+7PpY756mm0i3lokPJ7nQ9/OLcFlQ9nErnLtXf30eS9eAhL 2adUhrJUcI5yAPIu+vPoSLYPZdOyDnk1SYSCiqX7XxY00MsqRsqVz9VEsaFVGvhFKif7 Hj1L1Z+DVKIaXrMtok9x7Yk6OMpuSL91IYO7eLcStv/ZqzWV3SAIlRyR8YsPJlRCY+oX gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dtafr30ff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jan 2022 07:21:06 +0000 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20P6Fp0f032124; Tue, 25 Jan 2022 07:21:05 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dtafr30f5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jan 2022 07:21:05 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 20P7D94x008053; Tue, 25 Jan 2022 07:21:04 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma04dal.us.ibm.com with ESMTP id 3dr9ja33xr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jan 2022 07:21:04 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20P7L4Tj17105166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jan 2022 07:21:04 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12FD712405E; Tue, 25 Jan 2022 07:21:04 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B44BD124052; Tue, 25 Jan 2022 07:21:03 +0000 (GMT) Received: from localhost (unknown [9.211.142.9]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 25 Jan 2022 07:21:03 +0000 (GMT) From: Nathan Lynch To: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, brking@linux.ibm.com, srikar@linux.vnet.ibm.com Subject: [PATCH] powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up() Date: Tue, 25 Jan 2022 01:21:03 -0600 Message-Id: <20220125072103.70715-1-nathanl@linux.ibm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: dp0YO1CDidMdt_gGX0vysidABI96_2PC X-Proofpoint-ORIG-GUID: _wTH7Yl5XuQ-UE0KFyJBm5Q7lWc7Hio3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-25_02,2022-01-24_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 malwarescore=0 spamscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxscore=0 bulkscore=0 mlxlogscore=952 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2201250047 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace the outdated iteration and timeout calculations here with indefinite spin_until_cond()-wrapped poll of cpu_callin_map. __cpu_up() already does this when waiting for the cpu to set its online bit before returning, so this change is not really making the function more brittle. Removing the msleep(1) in the hotplug path here reduces the time it takes to online a CPU on a P9 PowerVM LPAR from about 30ms to 1ms when exercised via thaw_secondary_cpus(). Signed-off-by: Nathan Lynch --- arch/powerpc/kernel/smp.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index b7fd6a72aa76..990893365fe0 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1270,7 +1270,7 @@ static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle) int __cpu_up(unsigned int cpu, struct task_struct *tidle) { - int rc, c; + int rc; /* * Don't allow secondary threads to come online if inhibited @@ -1314,28 +1314,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) return rc; } - /* - * wait to see if the cpu made a callin (is actually up). - * use this value that I found through experimentation. - * -- Cort - */ - if (system_state < SYSTEM_RUNNING) - for (c = 50000; c && !cpu_callin_map[cpu]; c--) - udelay(100); -#ifdef CONFIG_HOTPLUG_CPU - else - /* - * CPUs can take much longer to come up in the - * hotplug case. Wait five seconds. - */ - for (c = 5000; c && !cpu_callin_map[cpu]; c--) - msleep(1); -#endif - - if (!cpu_callin_map[cpu]) { - printk(KERN_ERR "Processor %u is stuck.\n", cpu); - return -ENOENT; - } + spin_until_cond(cpu_callin_map[cpu] != 0); DBG("Processor %u found.\n", cpu); -- 2.34.1