From patchwork Mon Jul 3 16:41:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 106916 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp77292qge; Mon, 3 Jul 2017 09:41:37 -0700 (PDT) X-Received: by 10.98.148.25 with SMTP id m25mr10844822pfe.7.1499100097829; Mon, 03 Jul 2017 09:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499100097; cv=none; d=google.com; s=arc-20160816; b=kdNx2sRY6myWi1ZWwY3siAc2QA5yrOZYrPFnmo6fEY24S9K1PevfPAeVFGcfAq6+oz dfSMN1f9Hegyk/HTb2G31ZF5CnL+O1arLJm6Jy8x7GV6ogoKIHzbh71GeadGQQFtj0yI 7WdAqmAh84YhuLERuKisXzSJG95vopTgU+ydvzJi+o5oyNpJxnO5a/ZrKBWsb8reepxw QMDM2JEzdKF4+BpMTwexblcU1slCmKGfcbMCw0IKMlHhs1J9A6p4G1kTJsC3dHnLrmNw 7p8pXvipvLnMscbhbwpVxHe7kn3c/RBwax0fHWkHkLqIx4DjkJxALjtu0uhv0hw2gwq6 SGrg== 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:arc-authentication-results; bh=FCzcZHDJGoCipCrVmcuDoJuYR1QZ/IJh0rMfKy5h+RE=; b=vesFS+Ngl3oVh8YhhMfNcbIKciVOpyqoMwDvhBtnaoAK2jdn2Bm2HHdpSGU3JUlpMo LErEZqmoQNd/H+ehH2Fzc7qIieIDhqKZob7WhdCYuOgX+OVu9tLa9OoyaheGK7yinj3T 1sXtuLyTalbxG50dQOQcvnb6mtTdOJSKDvgUkx7a/zOKHStxfnaiJV7qjQ5rMqbhbYWH rJhThkqcP9YRumkxMO4lFlgN3mDYz3ibtTFfQhTMPpG5Uz433U9rUtnhezbBAMQc6HA4 nPcanuSTzr+I5S8eEJ4TBNGqDaWJkKR2oAtMwekOhK0m0Uh6rCqvVoCikRiYrnFlI2od PYYA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z63si13780988plh.435.2017.07.03.09.41.37; Mon, 03 Jul 2017 09:41:37 -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 S932236AbdGCQle (ORCPT + 25 others); Mon, 3 Jul 2017 12:41:34 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36618 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932087AbdGCQla (ORCPT ); Mon, 3 Jul 2017 12:41:30 -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 3758180D; Mon, 3 Jul 2017 09:41:24 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (e107155-lin.cambridge.arm.com [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 537143F3E1; Mon, 3 Jul 2017 09:41:23 -0700 (PDT) From: Sudeep Holla To: LKML , Jassi Brar Cc: Sudeep Holla , Alexey Klimov , Jassi Brar Subject: [UPDATE][PATCH 1/2] mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone Date: Mon, 3 Jul 2017 17:41:13 +0100 Message-Id: <1499100073-18345-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498835681-23975-1-git-send-email-sudeep.holla@arm.com> References: <1498835681-23975-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the mailbox framework sets txdone_method to TXDONE_BY_POLL if the controller sets txdone_by_poll. However some clients can have a mechanism to do TXDONE_BY_ACK which they can specify by knows_txdone. However, we endup setting both TXDONE_BY_POLL and TXDONE_BY_ACK in that case. In such scenario, we may end up with below warnings as the tx ticker is run both by mailbox framework and the client. WARNING: CPU: 1 PID: 0 at kernel/time/hrtimer.c:805 hrtimer_forward+0x88/0xd8 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.12.0-rc5 #242 Hardware name: ARM LTD ARM Juno Development Platform task: ffff8009768ca700 task.stack: ffff8009768f8000 PC is at hrtimer_forward+0x88/0xd8 LR is at txdone_hrtimer+0xd4/0xf8 Call trace: hrtimer_forward+0x88/0xd8 __hrtimer_run_queues+0xe4/0x158 hrtimer_interrupt+0xa4/0x220 arch_timer_handler_phys+0x30/0x40 handle_percpu_devid_irq+0x78/0x130 generic_handle_irq+0x24/0x38 __handle_domain_irq+0x5c/0xb8 gic_handle_irq+0x54/0xa8 This patch fixes the issue by resetting TXDONE_BY_POLL if client has set knows_txdone. Cc: Alexey Klimov Cc: Jassi Brar Signed-off-by: Sudeep Holla --- drivers/mailbox/mailbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 537f4f6d009b..674b35f402f5 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -351,7 +351,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) init_completion(&chan->tx_complete); if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone) - chan->txdone_method |= TXDONE_BY_ACK; + chan->txdone_method = TXDONE_BY_ACK; spin_unlock_irqrestore(&chan->lock, flags); @@ -418,7 +418,7 @@ void mbox_free_channel(struct mbox_chan *chan) spin_lock_irqsave(&chan->lock, flags); chan->cl = NULL; chan->active_req = NULL; - if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK)) + if (chan->txdone_method == TXDONE_BY_ACK) chan->txdone_method = TXDONE_BY_POLL; module_put(chan->mbox->dev->driver->owner);