Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1514442ybf; Sun, 1 Mar 2020 11:16:24 -0800 (PST) X-Google-Smtp-Source: APXvYqx8b7DDlZVkfXGKgoDYJnaYhkxarc6yyF/Wsfxinhokxc+xs1aZ5YUexjSx0w2nVU3Bd/2e X-Received: by 2002:a9d:6c01:: with SMTP id f1mr10289977otq.133.1583090183897; Sun, 01 Mar 2020 11:16:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583090183; cv=none; d=google.com; s=arc-20160816; b=0g+Z5fmqJCvGfGgm81R9f2zN2DwR14dQFcaXjOlcZl5mtmOwO/NRvrGr1cOrt78yrQ jVnN5H/nqnFs6HWPgQA6vFMkNL2Bb3ZVrSQmOcKgJhnvw/mHaZMJq2iiqAB7dvCEdeXC RqneMskwwgsVwckW5HVTtpPdXLAI7xvTgyNwkMyQ9neQ/QFWfw5ORIi++MNR35/Wib8/ 3dHN/E/2jY4WczLuXzVxp+Xs6MoeKHL122y7pCXlDn2bz7ekMn/UsNo3FbfnPtS0LZDX qFWDXj2Ni88M8XytkNWi2lmkLiQjg8YhOrtHPVBRX9/KaERlTvLcSOJbDnxMGBQV+/LS lKEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ifuAoTf+x6CAvmGsomDe7DLmPxxuwzt2pWbiX2xlTek=; b=1DQDalUf9QnCy07ar3aQ/XtaonP8+an18drHzXPkcoCgUSzpMxDRzS9oqP5IZPV8Uj jtfrjLADy744uU/fwiv01kuVlB4ILxNAWput3NeTlS/FgaIXBywqqlWguDE7TUEYMI2L REl8zHgttYPPckwqQojlFSPzwUhVTJEap1yGGQ9uuvDPhomGasCUm4yxKApurVEQzmjZ HUouN4COP/kWoj5GekRlPSFaIDWJ2Qa3ibxTqQPwTAdZhQ2a93ygS2VuJGfuxxfIVb4O wBM5EeQGvpW3WwGvtKkXDk7kupgwwOxSlTw0NHj+qtkN5xX93PV0wXtJ/gP5o/o97xZt qOMw== 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 x14si5798523otj.322.2020.03.01.11.16.12; Sun, 01 Mar 2020 11:16:23 -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 S1726561AbgCATPo (ORCPT + 99 others); Sun, 1 Mar 2020 14:15:44 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:33535 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726359AbgCATPo (ORCPT ); Sun, 1 Mar 2020 14:15:44 -0500 X-Originating-IP: 71.238.64.75 Received: from localhost (c-71-238-64-75.hsd1.or.comcast.net [71.238.64.75]) (Authenticated sender: josh@joshtriplett.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 8F863E000A; Sun, 1 Mar 2020 19:15:02 +0000 (UTC) Date: Sun, 1 Mar 2020 11:15:01 -0800 From: Josh Triplett To: Keith Busch Cc: Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nvme: Check for readiness more quickly, to speed up boot time Message-ID: <20200301191501.GA235404@localhost> References: <20200229025228.GA203607@localhost> <20200301183231.GA544682@dhcp-10-100-145-180.wdl.wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200301183231.GA544682@dhcp-10-100-145-180.wdl.wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 01, 2020 at 10:32:31AM -0800, Keith Busch wrote: > On Fri, Feb 28, 2020 at 06:52:28PM -0800, Josh Triplett wrote: > > @@ -2074,7 +2074,7 @@ static int nvme_wait_ready(struct nvme_ctrl *ctrl, u64 cap, bool enabled) > > if ((csts & NVME_CSTS_RDY) == bit) > > break; > > > > - msleep(100); > > + usleep_range(1000, 2000); > > if (fatal_signal_pending(current)) > > return -EINTR; > > if (time_after(jiffies, timeout)) { > > The key being this sleep schedules the task unlike udelay. Right; I don't think it's reasonable to busyloop here, just sleep for less time. > It's neat you can boot where 100ms is considered a long time. It's been fun. This was one of the longest single delays in a ~1s boot. > This clearly helps when you've one nvme that becomes ready quickly, but > what happens with many nvme's that are slow to ready? This change will > end up polling the status of those 1000's of times, I wonder if there's > a point where this frequent sleep/wake cycle initializing a whole lot > of nvme devices in parallel may interfere with other init tasks. usleep_range allows the kernel to consolidate those wakeups, so if you have multiple NVMe devices, the kernel should in theory just wake up once, check them all for readiness, and go back to sleep. > I doubt there's really an issue there, but thought it's worth considering > what happens at the other end of the specturm. > > Anyway, the patch looks fine to me. > > Reviewed-by: Keith Busch Thank you! Does this seem reasonable to enqueue for 5.7? - Josh Triplett