From patchwork Tue Mar 21 11:30:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 95613 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1389775qgd; Tue, 21 Mar 2017 04:30:26 -0700 (PDT) X-Received: by 10.98.58.7 with SMTP id h7mr39592531pfa.234.1490095826190; Tue, 21 Mar 2017 04:30:26 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6si7835669pfj.269.2017.03.21.04.30.25; Tue, 21 Mar 2017 04:30:26 -0700 (PDT) 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; 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 S1757264AbdCULaY (ORCPT + 21 others); Tue, 21 Mar 2017 07:30:24 -0400 Received: from foss.arm.com ([217.140.101.70]:51102 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752227AbdCULaX (ORCPT ); Tue, 21 Mar 2017 07:30:23 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5C05D28; Tue, 21 Mar 2017 04:30:22 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (e107155-lin.cambridge.arm.com [10.1.211.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 765A33F2E5; Tue, 21 Mar 2017 04:30:21 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Jassi Brar Cc: Sudeep Holla , Alexey Klimov , Jassi Brar Subject: [PATCH 1/3] mailbox: always wait in mbox_send_message for blocking Tx mode Date: Tue, 21 Mar 2017 11:30:14 +0000 Message-Id: <1490095816-10943-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There exists a race when msg_submit return immediately as there was an active request being processed which may have completed just before it's checked again in mbox_send_message. This will result in return to the caller without waiting in mbox_send_message even when it's blocking Tx. This patch fixes the issue by waiting for the completion always if Tx is in blocking mode. Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox") Cc: Jassi Brar Reported-by: Alexey Klimov Signed-off-by: Sudeep Holla --- drivers/mailbox/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Hi Jassi, Here are fixes for few issues we encountered when dealing with multiple requests on multiple channels simultaneously. Regards, Sudeep -- 2.7.4 Reviewed-by: Alexey Klimov diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 4671f8a12872..160d6640425a 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -260,7 +260,7 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg) msg_submit(chan); - if (chan->cl->tx_block && chan->active_req) { + if (chan->cl->tx_block) { unsigned long wait; int ret;