From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933950AbdKQHEL (ORCPT ); Fri, 17 Nov 2017 02:04:11 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34625 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933618AbdKQHEE (ORCPT ); Fri, 17 Nov 2017 02:04:04 -0500 X-Google-Smtp-Source: AGs4zMba30yLDV4NLgRLjSzR1Td08SxPTyEjqwTFID6+MjdGpmE7zE+NnLYU173qmJCungOMVr9pnA== Date: Thu, 16 Nov 2017 23:04:00 -0800 From: Bjorn Andersson To: Jassi Brar Cc: Linux Kernel Mailing List , Alexey Klimov , Sudeep Holla Subject: Re: [PATCH] mailbox: txdone_method shouldn't always be reset Message-ID: <20171117070400.GV28761@minitux> References: <20171116053126.28640-1-bjorn.andersson@linaro.org> <20171116174211.GQ28761@minitux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 16 Nov 22:47 PST 2017, Jassi Brar wrote: > On 16 Nov 2017 23:12, "Bjorn Andersson" wrote: > On Thu 16 Nov 09:06 PST 2017, Jassi Brar wrote: > > diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c > > index 674b35f..95e480e 100644 > > --- a/drivers/mailbox/mailbox.c > > +++ b/drivers/mailbox/mailbox.c > > @@ -124,7 +124,8 @@ static enum hrtimer_restart txdone_hrtimer(struct > > hrtimer *hrtimer) > > for (i = 0; i < mbox->num_chans; i++) { > > struct mbox_chan *chan = &mbox->chans[i]; > > > > - if (chan->active_req && chan->cl) { > > + if (chan->active_req && chan->cl && > > + chan->txdone_method == TXDONE_BY_POLL) { > > The hrtimer code will crash before reaching this point if the channel > wasn't TXDONE_BY_POLL when it was created, so this part is not needed. > > > We have one timer for all channels of a controller. While this channel may > be run by ACK, some other might need to be POLLed. And we want to avoid > polling this channel. > Oh, you're right. But the fact that the timer function will poll channels that are "upgraded" to ACK is a separate issue. > > > txdone = chan->mbox->ops->last_tx_done(chan); > > if (txdone) > > tx_tick(chan, 0); > > @@ -418,7 +419,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_ACK) > > + if (chan->txdone_method == TXDONE_BY_ACK && > chan->mbox->txdone_poll) > > This should be enough, but the logic here is not obvious. This relies on > the fact that a mbox with txdone_poll would have been initialized as > txdone = POLL and that txdone now being ACK would imply that it was > "upgraded" in the request path. > > So at least this would have to be captured in a comment. > > > Sure I'll add a comment. > Thanks Regards, Bjorn