Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3628066imu; Mon, 28 Jan 2019 08:05:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN6V4teha2YCDYFkXxfTbdrIr5rloetD8hEShmPIAl/+fkXLc/mmEQjbl6nuZ/10YUz+hIC8 X-Received: by 2002:a63:c303:: with SMTP id c3mr20374394pgd.268.1548691536007; Mon, 28 Jan 2019 08:05:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691535; cv=none; d=google.com; s=arc-20160816; b=NUWgispnIUCiX7ASU4YWEJEbNzZuq7tSqlCOWfhug4qSI3/A8eaqFgZgMMyIRK6BEv 9KLGKmfbndhGHySkk9avZc7mgKK9QpSIuP5KuX3dzvDmnTEBhBNHkSKUW3Uqij1WX6wX awmfk1C1E4AJ5iJmobpGKYpgZk2ytVYYK06cFZmR0LBvhc+2QeYRX4HmlCtD0CFucO8T BxKpXcDMohLh7kiTcgc+8ucyZ4I+DL//3vMen4Ar3/por5SDmAwDKDlgKfus5rWlRCbR 1VDOPfux+Xr0fthaJTGI8aGOrrBhfzW42QXYirQQPKhNvX6BAv0QyUjWpMOMZilVuYoP 79vQ== 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=0ZyFiRZ8Gx8OBfROxbkv++XrMknJL7CNOnrvjnGkXJI=; b=PQCA7C374kdcfGaMfs9IhGPsKlVvod6sESk+8O1II3mUsL39B04DghXHIoVykCX6Bq +1j1s1gmHriOW0gCI8xoVk0m+pvT4PgZ2BSNelO5J2BjtudaGAqdFYRwD2+dHwNansCL fgIkA2oQwTSW+G+siws2k+OtQwrwvmTAkhKDaKNguedmwlUdiUpsaRDk0X6TSkO/mJYP ON2T/X+GnfUmAd7Oue52DClJg+tC03wJhfYBLDCE6K7T0uqWw8xXxCVoDWGyQbucYw2n wiHJmPOh97PUm9Z3UF4jWzVQZ6WoXOrJDeFVKnIonk9pSavAXKUwyjGPFIj2i76Gs0Kk IicQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="UdC6bW/+"; 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 u137si767555pfc.133.2019.01.28.08.05.20; Mon, 28 Jan 2019 08:05:35 -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="UdC6bW/+"; 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 S1731362AbfA1QDQ (ORCPT + 99 others); Mon, 28 Jan 2019 11:03:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:48592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731343AbfA1QDQ (ORCPT ); Mon, 28 Jan 2019 11:03:16 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 DEA1C21916; Mon, 28 Jan 2019 16:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691395; bh=tPsCcYNbycxrBc4OFjAldpgUZ7y/P7l5AE+2PXnZEWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UdC6bW/+CXCSZp8h9k+f1KR8nadnCCyXhWyBv4ItSV7pF7Fh8w2P7i6ukjZtwRaDj uIq9Kpx13ifDzjqdTcIJFA0FbEQ50Sus2I4ksDApGWP0vea7o3QrsoxHnuPSEnAKR/ z1pwAp95tiIvOGjM3kgXO3UNmbkPOzTRxwgt814k= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Young Xiao , Jens Axboe , Sasha Levin , linux-block@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 079/258] sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN Date: Mon, 28 Jan 2019 10:56:25 -0500 Message-Id: <20190128155924.51521-79-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 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: Young Xiao [ Upstream commit a11f6ca9aef989b56cd31ff4ee2af4fb31a172ec ] __vdc_tx_trigger should only loop on EAGAIN a finite number of times. See commit adddc32d6fde ("sunvnet: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN") for detail. Signed-off-by: Young Xiao Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/sunvdc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index f68e9baffad7..5d7024057540 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c @@ -45,6 +45,8 @@ MODULE_VERSION(DRV_MODULE_VERSION); #define WAITING_FOR_GEN_CMD 0x04 #define WAITING_FOR_ANY -1 +#define VDC_MAX_RETRIES 10 + static struct workqueue_struct *sunvdc_wq; struct vdc_req_entry { @@ -431,6 +433,7 @@ static int __vdc_tx_trigger(struct vdc_port *port) .end_idx = dr->prod, }; int err, delay; + int retries = 0; hdr.seq = dr->snd_nxt; delay = 1; @@ -443,6 +446,8 @@ static int __vdc_tx_trigger(struct vdc_port *port) udelay(delay); if ((delay <<= 1) > 128) delay = 128; + if (retries++ > VDC_MAX_RETRIES) + break; } while (err == -EAGAIN); if (err == -ENOTCONN) -- 2.19.1