From patchwork Fri Jun 30 15:14:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 106715 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp6052957obb; Fri, 30 Jun 2017 08:15:07 -0700 (PDT) X-Received: by 10.99.168.71 with SMTP id i7mr5720138pgp.279.1498835707647; Fri, 30 Jun 2017 08:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498835707; cv=none; d=google.com; s=arc-20160816; b=lc8s/miLgbL9AMnQihRlzSJg7LqrjOQh6aoUPwmOUne9QzZAyvLNmT4JwncM1kU1yT G1NZ0bPDL9NQajBARzAmqWZ+bdLY0mXTELogQB9JNRu6Ms+hW64v9S1DN2Kdk044geR6 +fiEbIzmQqGfCzvhDfF8b4rAZgk7WxY6Iz7gZ2V/w2LnQQf2oFzvMDypT9vqeBmTNuza ijxQDr+bhILEiF3oxr4kaKSXBjUem2RSQowTQYGtjaWVcuOHUMUPz+SWHxpRKQJgwSIZ xDI19o3hjeN6QGUqK+SbB8GCFdS755h7ekZuBXThPOPMXSPMaKbF6pCuAa43cpxvy7Nm YGiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=BvppY/sRVVZgjAF1MPTVfbb1V6pvauXaN8HvizmmtMk=; b=eaR9t/9bejI8lbsoi97e2Fv9ZcYZZBfYnhwQujTggo2sohVFLlFBRnqSu2+PTdoeEd IiHjoJnO7xgXu5QOBSzQUltssDSZNX59vBF3La3J0tGFg1xkjhmHRlxmJUM70ELBsqoc RucO1P9kHJxqHCJtjRVJbtoj+01fRpdLMm38YG1TZwVRuBY6atb1XsRcfqht5poAzKOa MwaHw1VW6OZUzxPw8+iqH7+H7fDhEYd3Xnh5R3qQZhRJyzKFABuYjfISN0j/X3wPxYQc Ge/q0jdJ1xUeaN4VZjzBnRGUwKv8QU9JzAwWTBtKsOjeQoLzV78TmCL9he/MOHAX+UnD 5oZw== 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 g185si5924613pfc.19.2017.06.30.08.15.07; Fri, 30 Jun 2017 08:15:07 -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 S1751695AbdF3POx (ORCPT + 25 others); Fri, 30 Jun 2017 11:14:53 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43526 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975AbdF3POw (ORCPT ); Fri, 30 Jun 2017 11:14:52 -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 C45E580D; Fri, 30 Jun 2017 08:14:51 -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 E12D93F41F; Fri, 30 Jun 2017 08:14:50 -0700 (PDT) From: Sudeep Holla To: LKML , Jassi Brar Cc: Sudeep Holla , Alexey Klimov , Jassi Brar Subject: [PATCH 1/2] mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone Date: Fri, 30 Jun 2017 16:14:40 +0100 Message-Id: <1498835681-23975-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 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 537f4f6d009b..8da30f833262 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);