Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp739110ybc; Sat, 16 Nov 2019 07:52:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwvw33d/P6cByUgtnwtTiS/ToNE/pugo49c0K/ugPAlmQf4utuxXMfy/3J0T9CcUeismv/u X-Received: by 2002:a17:906:5586:: with SMTP id y6mr10607617ejp.76.1573919523166; Sat, 16 Nov 2019 07:52:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919523; cv=none; d=google.com; s=arc-20160816; b=hxzfSxqMN3YhX7gsJATnYjmqPyET0OjIcUihsDjpxhe3YOfWSG3iVblZjYpNBQDxvw pXzaFCicME5PNpHM30RhRnMSbF7ALM1NZgPfXSs8s66nV/24Jn2H2qu7r2jIwC9Exq2h Kwed7T9k0Ke2qi4YGmJISMfI1esMnK5igb3HzME469JhL32rSJSTKGyy+WdQjJucNuK+ BAd40E1NGKutr5yp2CQmAeO29BJUUMpRDMIdG2acjc1nHyVvB3fSjKZat0k3vNMuiFPo ci7nfIFtoP2ke4vvQa0XPwCrinuWsdnPJjrtJRZfEofGp5Ju6aMrZqjapmeWFMfdNjgY 539g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ca2+xYn/xbFeU/2M3VxkDiejgZGUc+D6+ZaXVgbNFJ4=; b=mFqxVFOiwlCGW26b0CLvv34o0ZoXtTFAW2EM3bLWKdVPfcfjjY8dPHNNp6thCpKI4F kiqFFYyGeANW0RBcu3RE8m1eWCs8HLTKET6AZv83pL5AMOmtPMWNNTCD0xSvchO5hGxj mpBxMv8/DB0TRLJzHGmQqdBzZGFCWaDky/0XGr4IoKGVHHjvqcRoHrWGvU+AesQDaWTf wl8JZBsYdUhjzmm+jkRRtSOd8t9Qz/OVTj4FL/BDFC+O34cr6CEC0UR53sY6vM0TOE6y mLpQWLIScEGbFaql7rlvteAStjTjPUWsJGBYghI5GHhgbpvvZar8OF6ZD9IUfQV/N9DM EHag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gd9XkkJa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u24si7865282ejb.93.2019.11.16.07.51.38; Sat, 16 Nov 2019 07:52:03 -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=pass header.i=@kernel.org header.s=default header.b=Gd9XkkJa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728281AbfKPPr2 (ORCPT + 99 others); Sat, 16 Nov 2019 10:47:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:53254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729504AbfKPPqr (ORCPT ); Sat, 16 Nov 2019 10:46:47 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4EA022081E; Sat, 16 Nov 2019 15:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919206; bh=rzlFMkmivZ6Tw8GRPSvnVO/UpRCEyuNnI37LYXz/4rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gd9XkkJayyEygsxtZOEpc4yy1uPi6v/D1WesHqUrHii+APny+LwObsvvCRIDyfm0v 2bmEORw6AHaaJKtidZKdk7c5/bQcMQNd7DTrUBpn87lG1hiGP5otdlVpuxMjIiL1tc nqOFWgg+aW4K3xcjXP21SyQchB9cbj8AFf2BrrEA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shivasharan S , "Martin K . Petersen" , Sasha Levin , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 210/237] scsi: megaraid_sas: Fix msleep granularity Date: Sat, 16 Nov 2019 10:40:45 -0500 Message-Id: <20191116154113.7417-210-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shivasharan S [ Upstream commit 9155cf30a3c4ef97e225d6daddf9bd4b173267e8 ] In megasas_transition_to_ready() driver waits 180seconds for controller to change FW state. Here we are calling msleep(1) in a loop for this. As explained in timers-howto.txt, msleep(1) will actually sleep longer than 1ms. If a faulty controller is connected, we will end up waiting for much more than 180 seconds causing unnecessary delays during load. Change the granularity of msleep() call from 1ms to 1000ms. Signed-off-by: Shivasharan S Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/megaraid/megaraid_sas_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index bc37666f998e6..2f94ab9c23540 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3894,12 +3894,12 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) /* * The cur_state should not last for more than max_wait secs */ - for (i = 0; i < (max_wait * 1000); i++) { + for (i = 0; i < max_wait; i++) { curr_abs_state = instance->instancet-> read_fw_status_reg(instance->reg_set); if (abs_state == curr_abs_state) { - msleep(1); + msleep(1000); } else break; } -- 2.20.1