From patchwork Tue Dec 12 23:58:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 121687 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4784877qgn; Tue, 12 Dec 2017 15:59:55 -0800 (PST) X-Google-Smtp-Source: ACJfBov+h2qNpceuKU59eSSqsNQBLn5Y3CES+EPhzIdw2+v5etndaF6gnvLFpKw9xCOVatLBvUnv X-Received: by 10.84.197.35 with SMTP id m32mr3943720pld.214.1513123195698; Tue, 12 Dec 2017 15:59:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513123195; cv=none; d=google.com; s=arc-20160816; b=0MWOFxGfOTwfol1FnufdEN9SMzKxrWfZeWzqRErD5cTKrs4i6xDNfbwVo2TN3jcnxN nCuwtgqFJ0vJpdbi8ex+09sQ2gJViHftaHJT7T28IU2hd+2dWlMpJqtzNqrG3MlP0eE5 Vmm/e3XxPn6HGAGzMI3ZtYKjQlRT145sVn3T6z+UTrO9wfbJmCg7eKiMDMi/2Y8FQnCT /9k1rFAE4qlOuDjTq15jBfE2vXtkmvN677+qkZioetJIGBmvqgJAreJ9H9ItOEwmip36 slnDMj1TE+ypcdnnTQXHAuYPZzR54PueYbMjnCRbYYwSLyyesiGVfSvu3PVrdl4Sx/Bz xrKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=L+WVmU0/OMWlFpz28ghtVyeIQxF7iaCrFJbevyP7A7M=; b=Jk39PexVtcha8oRBXaRtEIl5Jy+i8Cv3fDlHpHtlcYkNKOpJwACrj1TPcMuiM6Wtia 0uGFS1xz9y1v4DZuN+TorQmGLmHg3gKDQqJ0fV0GwL3e6aq1b56hipk5CL+A9WZ/LILP bavAk2QqGJ74n6GjCdeOZQBJYtjePnEBpByzN2emp6zHORvb0jzd8mwXGbYX0lumviMS RNgk3CVIo64noLsjhzVHNAmslxy8jYE7Tn4E828murrm0BU8XDA72z/QaUZXQGM9Hdhq Xjis0H+zEbaCuwaWljOJT2LDXUWfdKUEoRZBCmybFbvP5ibkG1QvFlO8lL7CvqaKSkoY g6tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lw8l0+bU; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9si288937pfe.13.2017.12.12.15.59.55; Tue, 12 Dec 2017 15:59:55 -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=@linaro.org header.s=google header.b=Lw8l0+bU; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753051AbdLLX7p (ORCPT + 11 others); Tue, 12 Dec 2017 18:59:45 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36419 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752886AbdLLX7H (ORCPT ); Tue, 12 Dec 2017 18:59:07 -0500 Received: by mail-pf0-f196.google.com with SMTP id p84so496819pfd.3 for ; Tue, 12 Dec 2017 15:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L+WVmU0/OMWlFpz28ghtVyeIQxF7iaCrFJbevyP7A7M=; b=Lw8l0+bUX8SFOH+yTcB4fhQDrpbS5VYPFlqBrwSz+7LR/wmcYbWuOdC1AWPwLAmgiz 9fjSkp3l73UYZvjTiQtGPN0rtQ/4Tin+WzySxg51ihUXnE7zjWGYBu5fP5YLSe6CcICW kybnmCX3d6HrpYcoB64cGFGH2xk8S5Z6BZQ1E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L+WVmU0/OMWlFpz28ghtVyeIQxF7iaCrFJbevyP7A7M=; b=bGsXiXDRlvqEmoveXjjxmDK5iL3sG2rw9BXppUT13XH1QdoV3MxOYIY3+gLMvHoJZ3 xBfoCJslVfIaJ6EVraEd0kSaqbq50WtU9pexvRcLIJ9OMKKINleD/F+kROrdek1nZEsI g1LsseZgVGBLdyQWSNc4Cj0x0qs6aETAsKs4g6dBrwHWylfnX7VdCRYmDLp4n8c0p+DF 5r4ENJIc2pUKw6PMPHxbrem29Sjtv0zuz91q7/G/6Lkw65BKP0FjZNNyAp8AQIGy510G pw3LKdFnKUyEcCUVp0pC/tw2n8hxN6hUsX1FZxbFUYPVAKHsEijPMM+IloAplU5oBvgB 6/gw== X-Gm-Message-State: AKGB3mL3jnDqsRfZE4qtW7zG1ooj5ks409QzpxMr0ZubYS92G8g+e/4w O1Xm4OdSEbEQnnzrlesK0BAYig== X-Received: by 10.101.66.204 with SMTP id l12mr3559670pgp.430.1513123146788; Tue, 12 Dec 2017 15:59:06 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id t202sm270317pgb.75.2017.12.12.15.59.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 15:59:06 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Chris Lew , Jeremy McNicoll , Will Newton Subject: [PATCH 5/5] rpmsg: smd: Don't hold the tx lock during wait Date: Tue, 12 Dec 2017 15:58:57 -0800 Message-Id: <20171212235857.10432-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171212235857.10432-1-bjorn.andersson@linaro.org> References: <20171212235857.10432-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Holding the tx lock while waiting for tx-drain events from the remote side blocks try_send requests from failing quickly, so temporarily drop the tx lock while waiting. While this allows try_send to fail quickly it also could allow a subsequent send to succeed putting a smaller packet in the FIFO while we're waiting for room for our large packet. But as this lock is per channel we expect that clients with ordering concerns implements their own ordering mechanism. Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_smd.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.15.0 diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index ed167ab52a68..10870189c0c8 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -752,12 +752,19 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data, SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 0); + /* Wait without holding the tx_lock */ + mutex_unlock(&channel->tx_lock); + ret = wait_event_interruptible(channel->fblockread_event, qcom_smd_get_tx_avail(channel) >= tlen || channel->state != SMD_CHANNEL_OPENED); if (ret) goto out; + ret = mutex_lock_interruptible(&channel->tx_lock); + if (ret) + goto out; + SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 1); }