From patchwork Tue Dec 12 23:58:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 121686 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4784533qgn; Tue, 12 Dec 2017 15:59:30 -0800 (PST) X-Google-Smtp-Source: ACJfBovPv4JLgtdXG2Dwz3zdef5xTf6pN0fM01vq9Ejq2CMVoOygdPzK6WoCuZvO3eQzXK6Bgy+z X-Received: by 10.159.247.202 with SMTP id v10mr3842755plz.309.1513123170310; Tue, 12 Dec 2017 15:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513123170; cv=none; d=google.com; s=arc-20160816; b=yW+qcsuYddbkUD9wcsTHXkXQIi8b7JFSijKVmPovx97C3ujUyeI93sl8n4imfvX/QS czAcjx3KUbUvpWTBJvnIuLJW5awq3eKtFdiQUATp4EPPOqX/moW+gRVwV52vpvq1/Oz8 VnOVMIuQVcvjxJ7gPv821MbOKhdx9zxJMcDRWk0TOJeGSmVEND+oYjaRfVATqGc4pUbY HLJ/sPuDI4jTencZvfOx/kiY6Vb8ss+AbKZbWWDZovaYu8Wk88CTk+HeMmam0dhqw9yl MpBi8JxUD15qv3pICiTJYU4NHiEluy/kljKTZcqQOre11MGB+wY4Y4q+vTzzJ69BidPa wqhQ== 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=/OMeT0++q3DjkQ150GU/dIlSKmy49pn+j/+5N656LrM=; b=XFDLy92sUtUxrkc48XFX09jDucd5DkosAdbkbo3AOx61m+K28Z4hnBx7agfAY8Yj2D zhCNn15+W4m7voYa0FXeqib+yFF8/E83FbHnjzFSQox5qxbtzaL7OlLFedlTFU4Qjl6s ziMVHN0oPe3SosWGHE2zhFEmbgOZXkp31A9DJpg63YMEh0WHG8JV8uFvlKEMMSE5JDm+ /JjWnKzXseryd5NwsTxACOPPY11iwIsef0SOyizLfzU2N3f8sdzOl9cmC0/NCg4wAi+Y RKQTsLmftSmmyeQ2Kwxx+M9M65xmV1cK78T4O+LNlEhPFa6nWLGA71oIKueRUhFU0EHJ I7Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bIrFmbcb; 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 n3si258952pld.566.2017.12.12.15.59.30; Tue, 12 Dec 2017 15:59:30 -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=bIrFmbcb; 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 S1752922AbdLLX7L (ORCPT + 11 others); Tue, 12 Dec 2017 18:59:11 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:42474 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752872AbdLLX7F (ORCPT ); Tue, 12 Dec 2017 18:59:05 -0500 Received: by mail-pf0-f193.google.com with SMTP id d23so484172pfe.9 for ; Tue, 12 Dec 2017 15:59:05 -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=/OMeT0++q3DjkQ150GU/dIlSKmy49pn+j/+5N656LrM=; b=bIrFmbcbEzKztD6TLy4BpYzxrVMkiQnvhAUtwuqgTtEJdVYBPSHyrlcgVI/GJeyk+o kVPh6Pb4JwWu0QmzMo0YJmFbAomTjlWsPj/fak+spfEl4YA3sFp81bxO1T/AHPs+EhT5 0Au2duYmmrB531P5Vw4D6tPh+bZNX2MvJXJrI= 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=/OMeT0++q3DjkQ150GU/dIlSKmy49pn+j/+5N656LrM=; b=Td9hSdgnyN3rZjptPqlxNNPaGuqXZN/GmWKGyA9VGIL2lmpMiGlv6pbJMl3T1GbYPu XsuqgyCo3n7PCWgiWRugLqZ0732f0zjern+V7epKwWyzBM7I51JxVkGwUFXxcXV6Yuvh kn88U5nRzXyjshGXQeIkI2QLG8QfsHWL7xe2by2Qceh3CfVHLOCb4xg+fTF+sz0cqiYi drcJixngBcgInbqgzuKTeSmAQGB0Q7aHYKwdDd8AjnSoYPgdbNceRWjcYdTccMyojN9H FnpLsIooH/B5L3uIsT4FTeDcyFb25rjZ7jT8Q4tjDKmOb3x0q8tFq6/COe76B7bfKmg7 CJzA== X-Gm-Message-State: AKGB3mJedcuPMgjYA7oM1ogCPfpc7duhUq2yBGjbivvt1YXDdEUjsJ9a hOcj3Q2J09Q7VYHMZ/n98fWR9Q== X-Received: by 10.101.80.1 with SMTP id f1mr3588825pgo.262.1513123144491; Tue, 12 Dec 2017 15:59:04 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 15:59:03 -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 3/5] rpmsg: smd: Wake up all waiters Date: Tue, 12 Dec 2017 15:58:55 -0800 Message-Id: <20171212235857.10432-4-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 It's possible to have multiple contexts waiting for new channel events and with an upcoming change it's possible to have multiple contexts waiting for a full FIFO. As such we need to wake them all up. Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_smd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.15.0 diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 1beddea6f087..0993e95bf0f5 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -579,7 +579,7 @@ static bool qcom_smd_channel_intr(struct qcom_smd_channel *channel) /* Signal waiting qcom_smd_send() about the interrupt */ if (!GET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR)) - wake_up_interruptible(&channel->fblockread_event); + wake_up_interruptible_all(&channel->fblockread_event); /* Don't consume any data until we've opened the channel */ if (channel->state != SMD_CHANNEL_OPENED) @@ -1191,7 +1191,7 @@ static void qcom_channel_scan_worker(struct work_struct *work) dev_dbg(&edge->dev, "new channel found: '%s'\n", channel->name); set_bit(i, edge->allocated[tbl]); - wake_up_interruptible(&edge->new_channel_event); + wake_up_interruptible_all(&edge->new_channel_event); } } From patchwork Tue Dec 12 23:58:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 121685 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4784359qgn; Tue, 12 Dec 2017 15:59:18 -0800 (PST) X-Google-Smtp-Source: ACJfBovVyoueD4+fUcfkgQjdc7qY9uurG2Cm9IuIS9GnxVNTBn1IwJzmE+fNoUnSgWzbEqKMewtp X-Received: by 10.98.215.90 with SMTP id v26mr4023424pfl.174.1513123158260; Tue, 12 Dec 2017 15:59:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513123158; cv=none; d=google.com; s=arc-20160816; b=Oh2oIpM703D0JgGAWgcOPlXWGzNvfGOHqEefM+58IeAsbTz1csIFGgakGaXPJ+vSOx 22embCFGhNQT67MHcEBzGY94anC8EDfZtXvgNKwWz0av29FYcZdf9WxuxymJZTUbaS59 I1HXpWZ3IzGPYr9CJ1FBQnveZSmpZMHpit+C2H2v9ulyfaC5fbPNWRh/HEKGhFYb78qR du4rR4fdlngRIKqrzX2n+i7qez7UnSNtbLLslEQDk96nhDkd2CAsVSaLRsnc5mtT+bB4 n6Zh7Ajkm4QnDq0w39RnxrgQfZx0STTi3RLQTy5jsPOJd+G/M+ev62wsnSOSiLt9qsnq leuQ== 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=r7hVHeASRwnG15giTIwXO7iaztMlse8qsnfaY/wNG6E=; b=z82IDiqPBnsfJjPCYQ7VMxY61EwOZuZ7cENrU81874q37SqdnudUfTxjjdAR/uBKIZ m8CpN3M0kJ5YRqlug5V6uxmdvdxO8LcLaM91oEvlfeDleH/PbOIroLM16MsxbeGRRujX 8L9hIvrcirJejnsxq4XpBLx+oZ4Llx5K86+F4lUMzuj9GPKEvdbFRrJplRyRpjHLIts/ WY+FYkiBv+TCjdtwNM9nUhjFvjLLcIMNrLTVQ1hr9buTMV3sUWq64Ch5jcS252LlU0RW 4z3NpPoVcqGTnfZcMv7Okj1Ihpq8x9CD/Vph9h1sdC1UoZhAF6CZNHlcVV36yx0cK9/m lDOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V63R61/X; 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 e7si250703plt.807.2017.12.12.15.59.18; Tue, 12 Dec 2017 15:59:18 -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=V63R61/X; 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 S1752953AbdLLX7O (ORCPT + 11 others); Tue, 12 Dec 2017 18:59:14 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:46409 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752882AbdLLX7G (ORCPT ); Tue, 12 Dec 2017 18:59:06 -0500 Received: by mail-pf0-f193.google.com with SMTP id c204so473144pfc.13 for ; Tue, 12 Dec 2017 15:59:06 -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=r7hVHeASRwnG15giTIwXO7iaztMlse8qsnfaY/wNG6E=; b=V63R61/Xc1zqKg8u67vbDijEQHtEJ7r7ZdncaG3G0y+eHQ0nXlis0CODkxfFN9fS5J sFNZPMk6yT5Pv8vKwCqRe4i4ARVNE7IYDU1Ii/nvdVqEHRbmWrz20p6mdrndWLCZPjH9 049tth1PLmDfPNZOcsc/qzogJhqvKV45eg4r8= 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=r7hVHeASRwnG15giTIwXO7iaztMlse8qsnfaY/wNG6E=; b=LKvB2b6rcqI0cZWjHfS89dAwAghwQ4yV09z90xCJ26I9VtnuTlACZl+y2VITo5dkLF DMt/CRL+U0m0qzwMCUaiCxJBbitB2VKT4PBnwAtV0zWIUktzmW/7ECTQlP5DEIdKZkfT i6SV/h6qNeo5CToOIBQDcg56OvWyf8ydGow0E5nH4QrU4ybZSv+FmEz3fyQkR3j2x8BJ ig2vyeNxY+7fnNAF4zchNBx8eKlkXuG9xIkPiuPB8/eDh8JYmpbRD2P+FeYC3g7woJ4w FQGye+SA/0U3pqcb5uHezCRZ03FU1CR/+DbGwoNC0pGih3b7za7pWrOvc7lAzmGhvouw ydtQ== X-Gm-Message-State: AKGB3mIbRycaJBJY/u/2ltOoiQlbL78ay5r+XA6xreY0nRajV268KwIu 1+jWwBzMAaPmn4AWMjmLD/o67A== X-Received: by 10.84.168.37 with SMTP id e34mr4027730plb.10.1513123145653; Tue, 12 Dec 2017 15:59:05 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 15:59:04 -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 4/5] rpmsg: smd: Fail send on a closed channel Date: Tue, 12 Dec 2017 15:58:56 -0800 Message-Id: <20171212235857.10432-5-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 Move the check for a closed channel out from the tx-full loop to fail any send request on a non-open channel. Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_smd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.15.0 diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 0993e95bf0f5..ed167ab52a68 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -743,17 +743,13 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data, if (ret) return ret; - while (qcom_smd_get_tx_avail(channel) < tlen) { + while (qcom_smd_get_tx_avail(channel) < tlen && + channel->state == SMD_CHANNEL_OPENED) { if (!wait) { ret = -EAGAIN; goto out; } - if (channel->state != SMD_CHANNEL_OPENED) { - ret = -EPIPE; - goto out; - } - SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 0); ret = wait_event_interruptible(channel->fblockread_event, @@ -765,6 +761,12 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data, SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 1); } + /* Fail if the channel was closed */ + if (channel->state != SMD_CHANNEL_OPENED) { + ret = -EPIPE; + goto out; + } + SET_TX_CHANNEL_FLAG(channel, fTAIL, 0); qcom_smd_write_fifo(channel, hdr, sizeof(hdr)); 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); }