Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753722AbdGCJfb (ORCPT ); Mon, 3 Jul 2017 05:35:31 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59884 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753610AbdGCJf3 (ORCPT ); Mon, 3 Jul 2017 05:35:29 -0400 Cc: Sudeep Holla , LKML , Alexey Klimov , Jassi Brar Subject: Re: [PATCH 1/2] mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone To: Jassi Brar References: <1498835681-23975-1-git-send-email-sudeep.holla@arm.com> <3c542b86-4de1-3c97-5e2d-1335115ac9a3@arm.com> From: Sudeep Holla Organization: ARM Message-ID: Date: Mon, 3 Jul 2017 10:35:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <3c542b86-4de1-3c97-5e2d-1335115ac9a3@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2467 Lines: 64 On 03/07/17 09:57, Sudeep Holla wrote: > > > On 01/07/17 12:25, Jassi Brar wrote: >> On Fri, Jun 30, 2017 at 8:44 PM, Sudeep Holla wrote: >>> 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(-) >>> >>> 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; >>> >> It has to be restored back in mbox_free_channel() > > Ah right, will fix and repost. > I was too fast to response, I see we already take care of that in free channel. So I think it should be fine as is. if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK)) chan->txdone_method = TXDONE_BY_POLL; -- Regards, Sudeep