From: Horng-Shyang Liao <hs.liao@mediatek.com>
To: Jassi Brar <jaswinder.singh@linaro.org>
Cc: CK Hu <ck.hu@mediatek.com>, Daniel Kurtz <djkurtz@chromium.org>,
Monica Wang <monica.wang@mediatek.com>,
Jiaguang Zhang <jiaguang.zhang@mediatek.com>,
Nicolas Boichat <drinkcat@chromium.org>,
Jassi Brar <jassisinghbrar@gmail.com>,
cawa cheng <cawa.cheng@mediatek.com>,
Bibby Hsieh <bibby.hsieh@mediatek.com>,
YT Shen <yt.shen@mediatek.com>,
Damon Chu <damon.chu@mediatek.com>,
Devicetree List <devicetree@vger.kernel.org>,
Sascha Hauer <kernel@pengutronix.de>,
Daoyuan Huang <daoyuan.huang@mediatek.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Glory Hung <glory.hung@mediatek.com>,
Rob Herring <robh+dt@kernel.org>,
linux-mediatek@lists.infradead.org,
Matthias Brugger <matthias.bgg@gmail.com>,
"linux-arm-kernel@lists.infradead.org" <linux-arm->
Subject: Re: [PATCH v14 2/4] CMDQ: Mediatek CMDQ driver
Date: Wed, 5 Oct 2016 20:31:45 +0800 [thread overview]
Message-ID: <1475670705.335.27.camel@mtksdaap41> (raw)
In-Reply-To: <CAJe_ZhcXw1-MOEiiix5VTtKEVr9Z23s_OyikboDYCd0RQwS5pg@mail.gmail.com>
On Wed, 2016-10-05 at 09:07 +0530, Jassi Brar wrote:
> On 5 October 2016 at 08:24, Horng-Shyang Liao <hs.liao@mediatek.com> wrote:
> > On Fri, 2016-09-30 at 17:47 +0800, Horng-Shyang Liao wrote:
> >> On Fri, 2016-09-30 at 17:11 +0800, CK Hu wrote:
>
> >
> > After I trace mailbox driver, I realize that CMDQ driver cannot use
> > tx_done.
> >
> > CMDQ clients will flush many tasks into CMDQ driver, and then CMDQ
> > driver will apply these tasks into GCE HW "immediately". These tasks,
> > which are queued in GCE HW, may not execute immediately since they
> > may need to wait event(s), e.g. vsync.
> >
> > However, in mailbox driver, mailbox uses a software buffer to queue
> > sent messages. It only sends next message until previous message is
> > done. This cannot fulfill CMDQ's requirement.
> >
> I understand
> a) GCE HW can internally queue many tasks in some 'FIFO'
> b) Execution of some task may have to wait until some external event
> occurs (like vsync)
> c) GCE does not generate irq/flag for each task executed (?)
>
> If so, may be your tx_done should return 'true' so long as the GCE HW
> can accept tasks in its 'FIFO'. For mailbox api, any task that is
> queued on GCE, is assumed to be transmitted.
>
> > Quote some code from mailbox driver. Please notice "active_req" part.
> >
> > static void msg_submit(struct mbox_chan *chan)
> > {
> > ...
> > if (!chan->msg_count || chan->active_req)
> > goto exit;
> > ...
> > err = chan->mbox->ops->send_data(chan, data);
> > if (!err) {
> > chan->active_req = data;
> > chan->msg_count--;
> > }
> > ...
> > }
> >
> > static void tx_tick(struct mbox_chan *chan, int r)
> > {
> > ...
> > spin_lock_irqsave(&chan->lock, flags);
> > mssg = chan->active_req;
> > chan->active_req = NULL;
> > spin_unlock_irqrestore(&chan->lock, flags);
> > ...
> > }
> >
> > Current workable CMDQ driver uses mbox_client_txdone() to prevent
> > this issue, and then uses self callback functions to handle done tasks.
> >
> > int cmdq_task_flush_async(struct cmdq_client *client, struct cmdq_task
> > *task, cmdq_async_flush_cb cb, void *data)
> > {
> > ...
> > mbox_send_message(client->chan, task);
> > /* We can send next task immediately, so just call txdone. */
> > mbox_client_txdone(client->chan, 0);
> > ...
> > }
> >
> > Another solution is to use rx_callback; i.e. CMDQ mailbox controller
> > call mbox_chan_received_data() when CMDQ task is done. But, this may
> > violate the design of mailbox. What do you think?
> >
> If my point (c) above does not hold, maybe look at implementing
> tx_done() callback and submit next task from the callback of last
> done.
Hi Jassi,
For point (c), GCE irq means 1~n tasks done or
0~n tasks done + 1 task error.
In irq, we can know which tasks are done by register and GCE pc.
As I mentioned before, we cannot submit next task after previous task
call tx_done. We need to submit multiple tasks to GCE HW immediately
and queue them in GCE HW. Let me explain this requirement by mouse
cursor example. User may move mouse quickly between two vsync, so DRM
may update display registers frequently. For CMDQ, that means many tasks
are flushed into CMDQ driver, and CMDQ driver needs to process all of
them in next vblank. Therefore, we cannot block any CMDQ task in SW
buffer.
CMDQ needs to call callback function to notice clients which tasks are
done. In my previous e-mail, I mentioned that rx_callback may be an
alternative solution. However, it seems to violate the design of
mailbox. Therefore, I think mailbox may not have a good solution for
CMDQ callback currently. IMHO, the better way is to use CMDQ self
callback for now.
Thanks,
HS
next prev parent reply other threads:[~2016-10-05 12:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 1:44 [PATCH v14 0/4] Mediatek MT8173 CMDQ support HS Liao
2016-09-05 1:44 ` [PATCH v14 1/4] dt-bindings: soc: Add documentation for the MediaTek GCE unit HS Liao
2016-09-05 1:44 ` [PATCH v14 2/4] CMDQ: Mediatek CMDQ driver HS Liao
2016-09-22 8:17 ` Jassi Brar
2016-09-23 9:28 ` Horng-Shyang Liao
2016-09-30 8:56 ` Horng-Shyang Liao
2016-09-30 3:06 ` CK Hu
2016-09-30 8:56 ` Horng-Shyang Liao
2016-09-30 9:11 ` CK Hu
2016-09-30 9:47 ` Horng-Shyang Liao
2016-10-05 2:54 ` Horng-Shyang Liao
2016-10-05 3:37 ` Jassi Brar
2016-10-05 12:31 ` Horng-Shyang Liao [this message]
2016-10-05 14:43 ` Jassi Brar
2016-10-06 13:01 ` Horng-Shyang Liao
2016-10-06 13:10 ` Jassi Brar
[not found] ` <CAJe_ZheptRQSmQp2gagqUyXqkOpi1qaTo8QPDTFpQ-+62B6kUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-11 2:40 ` Horng-Shyang Liao
2016-10-11 4:19 ` Jassi Brar
[not found] ` <1473039885-24009-1-git-send-email-hs.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-09-05 1:44 ` [PATCH v14 3/4] arm64: dts: mt8173: Add GCE node HS Liao
2016-09-05 1:44 ` [PATCH v14 4/4] CMDQ: save more energy in idle HS Liao
[not found] ` <1473039885-24009-5-git-send-email-hs.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-09-22 7:52 ` Jassi Brar
2016-09-23 9:28 ` Horng-Shyang Liao
2016-09-30 8:56 ` Horng-Shyang Liao
2016-09-30 9:01 ` Matthias Brugger
2016-09-19 6:43 ` [PATCH v14 0/4] Mediatek MT8173 CMDQ support Horng-Shyang Liao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1475670705.335.27.camel@mtksdaap41 \
--to=hs.liao@mediatek.com \
--cc=bibby.hsieh@mediatek.com \
--cc=cawa.cheng@mediatek.com \
--cc=ck.hu@mediatek.com \
--cc=damon.chu@mediatek.com \
--cc=daoyuan.huang@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=djkurtz@chromium.org \
--cc=drinkcat@chromium.org \
--cc=glory.hung@mediatek.com \
--cc=jassisinghbrar@gmail.com \
--cc=jaswinder.singh@linaro.org \
--cc=jiaguang.zhang@mediatek.com \
--cc=kernel@pengutronix.de \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=monica.wang@mediatek.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=yt.shen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).