Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2723116imj; Mon, 11 Feb 2019 07:31:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IZd7E53rDajQPXs+qtzxx90sQBxqlgaLHN6/32vR1S54+ECHy9koZCtl1lVt10juZM9XFca X-Received: by 2002:a62:5486:: with SMTP id i128mr36472228pfb.215.1549899101761; Mon, 11 Feb 2019 07:31:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899101; cv=none; d=google.com; s=arc-20160816; b=SRyALDOCZ3M4ftBCPtGlYyaWKws1nkvud2Gfih4qgWg8XT6Irw9tUH0AUwxZUhbYK+ l9CwALby047deMjx/uk/MZBlQcXzZIGKnTFxDDcxtq8y6PBJq+0mBUSdAn11vJHcSocK tvvz6YzQ7H6ADAzrgUXt6nOVpbTRhHPP4DtP46gyNR6MrDsQE21xrJFbQiHCemfx3Yux QsJ2+CypNLqttOL5zxu2gLpzEhM03r33CmfZUO9+tuxcmwV0VvtaKsfI1zK50T3z4EUj z5YL+JoXkvnk1d3XyT10mt0cnj9QiMY/+3VlclIZm4see5s4qk7SztXBAphbxg2pMQQC b0jw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UkuKXoB6hEQXudrEXF4naae/BjhkxZ3OfZFE0unMbaY=; b=L1PYCL6ZQamy68riNeefgQqWWGwdNY1X3j/eIlrJ+8MLcls+RNiyrFJCIvlSCLtjBn cYHWAoBSVRsUExkkKalSCtuDWiPWLwgczei/6pu2I4a5CI45jOVqp6Upx7oJDje7mqVp mtxb9a3RAsmI8Zl0LEfco11Vs91D8sXEWgS4RhFTe4CGBT4AeCHjJ0A4ECJt6x2uX8Xw 8+JtGysJe2HDeQ0VW5qOCyHG7KakCADjrnlyboUyEEnklw02JeOx3PmXHQ4Jd/Txu3Iq dAT2nR9sU3z+QOvBYJRJkVWLHovfdPbZ3z8ah0/BB1dhryKjxhRnaqaDV4ovTTIRz6CS zqkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JMfmfjGP; 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 x67si178127pfb.255.2019.02.11.07.31.25; Mon, 11 Feb 2019 07:31:41 -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=JMfmfjGP; 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 S2389149AbfBKO4T (ORCPT + 99 others); Mon, 11 Feb 2019 09:56:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:43432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389123AbfBKO4O (ORCPT ); Mon, 11 Feb 2019 09:56:14 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C36A02229E; Mon, 11 Feb 2019 14:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896974; bh=87Bw8zAz4gLLvU+JCtZ3xmXExfG+rGT5u2wSKgHiRDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JMfmfjGP3JUeDfUuLk1Caiv8I/8DKoUknvZGI8cDvXi0NoPQkcvK8heE3NhaL3u1h 9xnEPpDGZEbWkx+XYwso+6lUDuD8Ur4eFZ5UGWUNJ0KeT+o8gfOWzZxWb0v24dsovp bKmcBTpCBwTDERrGdoVDcJq4WBg9QvuKJQ8WMuT8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Young Xiao , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 048/205] sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN Date: Mon, 11 Feb 2019 15:17:26 +0100 Message-Id: <20190211141832.005931077@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 ad9749463d4f..ed4d6276e94f 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c @@ -41,6 +41,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 { @@ -427,6 +429,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; @@ -439,6 +442,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