Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4808525imu; Tue, 15 Jan 2019 06:24:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN4LKp/lAcQk5c79cpVOyWx9osko5kzf8Dcn5nvJCgL/m/DmNdRZ1Ejx6jhZbbCsu6BscsS8 X-Received: by 2002:a63:5455:: with SMTP id e21mr4120315pgm.316.1547562254842; Tue, 15 Jan 2019 06:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547562254; cv=none; d=google.com; s=arc-20160816; b=IApi53a70G3zlruqkQZl/5s2qKT2hYYYhVI4Wjl/FH+P5vgPKJIKZi5EwSHuvPNm5L x+4CQ2898z8X4yldpRETju92EoBRl1dhegGnVzBXVGljVqixbHZwmpB6B7NTUsZnucA7 5taGLUPt+24ncxaIkt4h4kQsrfMbIjsQ7g2BMxoATDg6MtOUrGpltK2rfZ1mNl64ZY2F MNNMG8oqor0HTi+B0mU0pyL4wOsKe25PAtzt7j87YbnsAFFRooHqyVmR7bStyV5XzoFf LZD2jRxR9DwPtalLgC6rAkeimPGljrNsI2m2vpx0CzEkvokawYr+X7JNPV+fQfrw1Ou3 nWvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pTszzpsysWlogqpVbwRZ0MRw3aAaKw13X2T4YolhPDg=; b=xz2aBy82h7vEUwJ/Zr+3FYVZw5jvPpvJ5lfbCo4z0R521KjtdvQQgf+ghDq3bTftzH sYiYyiiLFwUDC8Q80hykdp44dla4f6etZ/dqjGinpqRVWMztHWyMiw25cfJmlQ61/L3Q dPZosqVhf9UrkQ+sMdKgMfVMKZw4tWwlFDUs7KnA2L0jXlJ++yjVNSSIxO2GKIcKjrsa YY2Q3pW2F8w1dE/bHgPffW3M5Ok+F/oWOZFPSt4lIaQDNcWP5tkMLZyTnXDAWbzM9y9h bdOxVrkr/01334on70JHGJh6okgheaNHv5Ys2Ud93CQ19C+rgB1ZB77LmmL5H7DnoweI xOtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=V9Ty2nEl; 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 h32si3452474pld.387.2019.01.15.06.23.56; Tue, 15 Jan 2019 06:24:14 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=V9Ty2nEl; 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 S1728858AbfAONvg (ORCPT + 99 others); Tue, 15 Jan 2019 08:51:36 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:33118 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728157AbfAONvg (ORCPT ); Tue, 15 Jan 2019 08:51:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pTszzpsysWlogqpVbwRZ0MRw3aAaKw13X2T4YolhPDg=; b=V9Ty2nEleew/4tK7bK7fr10at Nf5t1bbwsY0iL4AOl0qeHGPZYH6UooBo0BsEKwYB5Yb8HYZVRxal+GD/tdnkpV2VKI48u4vyOyN48 olGiS1ob/4JP+vCA9+AxPn5Gk1AzFYIXhOsg7gRua75yqYrnT935Uuj8XZYFZpQ+Fkmk6M6nrARYL 0TQuk8t2lNYXqKnhbc7m8mLqMErurCXqmGAyobsKFYk/RDCNeIvcvsRb/YJV7KKG+H3rvzt/+uCGM c7FG+g94p3whueVNm1msf4JXUb7D91CnnTBX7ZMOTxIK+jNcOoV5581vdOH1FKzpfvk6c6Cgq4Ajd tx+lwrpfg==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gjP7l-0000mc-Gl; Tue, 15 Jan 2019 13:51:25 +0000 Date: Tue, 15 Jan 2019 05:51:25 -0800 From: Christoph Hellwig To: Atish Patra Cc: linux-riscv@lists.infradead.org, Patrick =?iso-8859-1?Q?St=E4hlin?= , Albert Ou , Jason Cooper , Alan Kao , Dmitriy Cherkasov , Anup Patel , Daniel Lezcano , linux-kernel@vger.kernel.org, Michael Clark , Palmer Dabbelt , Andreas Schwab , Marc Zyngier , Thomas Gleixner , Zong Li Subject: Re: [PATCH v2 1/8] RISC-V: Do not wait indefinitely in __cpu_up Message-ID: <20190115135125.GA28946@infradead.org> References: <1546940318-9752-1-git-send-email-atish.patra@wdc.com> <1546940318-9752-2-git-send-email-atish.patra@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1546940318-9752-2-git-send-email-atish.patra@wdc.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > void *__cpu_up_stack_pointer[NR_CPUS]; > void *__cpu_up_task_pointer[NR_CPUS]; > +static DECLARE_COMPLETION(cpu_running); > > void __init smp_prepare_boot_cpu(void) > { > @@ -81,6 +82,7 @@ void __init setup_smp(void) > > int __cpu_up(unsigned int cpu, struct task_struct *tidle) > { > + int ret = 0; > int hartid = cpuid_to_hartid_map(cpu); > tidle->thread_info.cpu = cpu; > > @@ -96,10 +98,15 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) > task_stack_page(tidle) + THREAD_SIZE); > WRITE_ONCE(__cpu_up_task_pointer[hartid], tidle); > > - while (!cpu_online(cpu)) > - cpu_relax(); > + wait_for_completion_timeout(&cpu_running, > + msecs_to_jiffies(1000)); Having a global completion here worries me. I bet we have some higher level serialization, but can we comment or even better lockdep assert on that? Also please use up your available lines (72 in commit logs, 80 in source files) instead of adding spurious line wraps.