From patchwork Thu Oct 30 20:01:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Bresticker X-Patchwork-Id: 5200221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 87E929F30B for ; Thu, 30 Oct 2014 20:03:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B64CA2024C for ; Thu, 30 Oct 2014 20:03:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAC4020173 for ; Thu, 30 Oct 2014 20:03:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xjvuf-0001ti-43; Thu, 30 Oct 2014 20:01:41 +0000 Received: from mail-qg0-f74.google.com ([209.85.192.74]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjvuX-0001r8-0O for linux-arm-kernel@lists.infradead.org; Thu, 30 Oct 2014 20:01:33 +0000 Received: by mail-qg0-f74.google.com with SMTP id q107so412309qgd.3 for ; Thu, 30 Oct 2014 13:01:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ESotP4+AY+J+pL0AtMOYeliWlG3w/D7IRHwQyJzMw3k=; b=T4vau1+MSaeCQZh78SZ9spvsWH9TzlP0M6aUG+5zFysoUhxAnhwF6j+6h4eu3ncE+K Z5KOHnWSeaGXRSxs0zt76ETJtqPw093OzrAh/EOZ+WMedPrFta2RCagqNDrWjrRW3bdH EvXFIkGnAaoY6v9pTdqkQQzR1LMwm3jB913jtQeM35QfQhLkOyWA38roEafllrJ+wsOb IYffRiqi9T3XAnlwGbwFRw9qE2uo8yRXIdmoFGGQScWn4AwsE6/tzkO2MJF7uk2EmkSf qDVyfjwaUqt3FZBo9CbqQvZdH6OK9NqO9VgUhgjBXIOcdoirEht/ZFfvmEwZ0Qh/B3Mu 7YnA== X-Gm-Message-State: ALoCoQmecSQmwlJH/jL2g4Ng4usFMD7+wiPVMYHonWoo6JtmD4xl/XqVpEhQHtmAOmRQ2Lo6+tT5 X-Received: by 10.224.128.7 with SMTP id i7mr13689099qas.9.1414699271331; Thu, 30 Oct 2014 13:01:11 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id e24si471841yhe.3.2014.10.30.13.01.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Oct 2014 13:01:11 -0700 (PDT) Received: from abrestic.mtv.corp.google.com ([172.22.65.70]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id nFVkLJvX.1; Thu, 30 Oct 2014 13:01:11 -0700 Received: by abrestic.mtv.corp.google.com (Postfix, from userid 137652) id 99B77220EB2; Thu, 30 Oct 2014 13:01:10 -0700 (PDT) From: Andrew Bresticker To: Jassi Brar Subject: [PATCH 2/2] mailbox: Don't unnecessarily re-arm the polling timer Date: Thu, 30 Oct 2014 13:01:07 -0700 Message-Id: <1414699267-17970-2-git-send-email-abrestic@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1414699267-17970-1-git-send-email-abrestic@chromium.org> References: <1414699267-17970-1-git-send-email-abrestic@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141030_130133_117171_78214A27 X-CRM114-Status: GOOD ( 13.60 ) X-Spam-Score: -1.3 (-) Cc: Andrew Bresticker , Thierry Reding , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP poll_txdone() will unconditionally re-arm the polling timer if there was an active request, even if the active request completed and no other requests were submitted. This is fixed by: - only re-arming the timer if the controller reported that the current transmission has not completed, and, - moving the call to poll_txdone() into msg_submit() so that the controller gets polled (and the timer re-armed, if necessary) whenever a new message is submitted. Signed-off-by: Andrew Bresticker Reviewed-by: Thierry Reding --- drivers/mailbox/mailbox.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 5008028..26f74ad 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -28,6 +28,8 @@ static LIST_HEAD(mbox_cons); static DEFINE_MUTEX(con_mutex); +static void poll_txdone(unsigned long data); + static int add_to_rbuf(struct mbox_chan *chan, void *mssg) { int idx; @@ -60,7 +62,7 @@ static void msg_submit(struct mbox_chan *chan) unsigned count, idx; unsigned long flags; void *data; - int err; + int err = -EBUSY; spin_lock_irqsave(&chan->lock, flags); @@ -84,6 +86,9 @@ static void msg_submit(struct mbox_chan *chan) } exit: spin_unlock_irqrestore(&chan->lock, flags); + + if (!err && chan->txdone_method == TXDONE_BY_POLL) + poll_txdone((unsigned long)chan->mbox); } static void tx_tick(struct mbox_chan *chan, int r) @@ -117,10 +122,11 @@ static void poll_txdone(unsigned long data) struct mbox_chan *chan = &mbox->chans[i]; if (chan->active_req && chan->cl) { - resched = true; txdone = chan->mbox->ops->last_tx_done(chan); if (txdone) tx_tick(chan, 0); + else + resched = true; } } @@ -252,9 +258,6 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg) msg_submit(chan); - if (chan->txdone_method == TXDONE_BY_POLL) - poll_txdone((unsigned long)chan->mbox); - if (chan->cl->tx_block && chan->active_req) { unsigned long wait; int ret;