From: Fabien DESSENNE <fabien.dessenne-qxv4g6HH51o@public.gmane.org>
To: Jassi Brar <jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Devicetree List
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Benjamin Gaignard
<benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org>,
Loic PALLARDY <loic.pallardy-qxv4g6HH51o@public.gmane.org>,
Arnaud POULIQUEN <arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>,
Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Bjorn Andersson
<bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
srv_heupstream
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
Maxime Coquelin
<mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Ludovic BARRE <ludovic.barre-qxv4g6HH51o@public.gmane.org>
Subject: Re: [PATCH v2 2/2] mailbox: add STMicroelectronics STM32 IPCC driver
Date: Mon, 9 Apr 2018 09:03:25 +0000 [thread overview]
Message-ID: <d9b30262-3b0b-1b46-dee7-ee1a4b77e66e@st.com> (raw)
In-Reply-To: <CABb+yY2Dd2Gr_-+4RaJarq3tve8tgzVqcoJw+MGT=+Vy56PwLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On 06/04/18 18:20, Jassi Brar wrote:
> On Fri, Apr 6, 2018 at 8:35 PM, Fabien DESSENNE <fabien.dessenne-qxv4g6HH51o@public.gmane.org> wrote:
>> On 06/04/18 14:56, Jassi Brar wrote:
>>> On Fri, Apr 6, 2018 at 5:59 PM, Fabien DESSENNE <fabien.dessenne-qxv4g6HH51o@public.gmane.org> wrote:
>>>> Hi
>>>>
>>>>
>>>> On 05/04/18 11:38, Jassi Brar wrote:
>>>>> On Mon, Mar 12, 2018 at 4:28 PM, Fabien Dessenne <fabien.dessenne-qxv4g6HH51o@public.gmane.org> wrote:
>>>>> ....
>>>>>> +
>>>>>> + /* irq */
>>>>>> + for (i = 0; i < IPCC_IRQ_NUM; i++) {
>>>>>> + ipcc->irqs[i] = of_irq_get_byname(dev->of_node, irq_name[i]);
>>>>>> + if (ipcc->irqs[i] < 0) {
>>>>>> + dev_err(dev, "no IRQ specified %s\n", irq_name[i]);
>>>>>> + ret = ipcc->irqs[i];
>>>>>> + goto err_clk;
>>>>>> + }
>>>>>> +
>>>>>> + ret = devm_request_threaded_irq(dev, ipcc->irqs[i], NULL,
>>>>>> + irq_thread[i], IRQF_ONESHOT,
>>>>>> + dev_name(dev), ipcc);
>>>>>>
>>>>> In your interrupt handlers you don't do anything that could block.
>>>>> Threads only adds some delay to your message handling.
>>>>> So maybe use devm_request_irq() ?
>>>> The interrupt handlers call mbox_chan_received_data() /
>>>> mbox_chan_txdone(), which call in turn client's rx_callback() /
>>>> tx_done() / tx_prepare() which behavior may be unsafe. Hence, using a
>>>> threaded irq here seems to be a good choice.
>>>>
>>> rx_callback() is supposed to be atomic.
>> I am worried with this atomic part (and honestly I did not note that the
>> callbacks were expected to be)
>>
>> In my case, remoteproc->virtio->rpmsg is the mailbox client defining the
>> rx_callback.
>> If I follow your suggestion, I shall make this rx_callback Atomic in
>> remoteproc (or in virtio or rpmsg). And this does not seem to be so
>> simple (add a worker in the middle of somewhere?). Bjorn, feel free to
>> comment this part.
>>
>> An alternate implementation consists in using a threaded IRQ for the
>> mailbox interrupt.
>> This option is not only simple, but also ensures to split bottom & half
>> parts at the irq level which is IMHO a general good practice.
>>
>> I can see that some mailbox clients implement callbacks that are NOT
>> atomic and I suspect this is the reason why some mailbox drivers use
>> threaded_irq (rockchip mailbox splits the bottom & half parts).
>>
>> Would it be acceptable to consider the "atomic client callback" as a
>> non-strict rule ?
>>
> Of course you can traverse atomic path from sleepable context (but not
> vice-versa).
So, to be sure we understand each other, I can use threaded_irq, right?
> Please send in the final revision.
>
> Thanks.
next prev parent reply other threads:[~2018-04-09 9:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 10:58 [PATCH v2 0/2] mailbox: introduce STMicroelectronics STM32 IPCC driver Fabien Dessenne
2018-03-12 10:58 ` [PATCH v2 1/2] dt-bindings: mailbox: add STMicroelectronics STM32 IPCC binding Fabien Dessenne
2018-03-18 12:48 ` Rob Herring
2018-03-12 10:58 ` [PATCH v2 2/2] mailbox: add STMicroelectronics STM32 IPCC driver Fabien Dessenne
2018-04-03 9:53 ` [v2,2/2] " Fabien DESSENNE
2018-04-05 9:38 ` [PATCH v2 2/2] " Jassi Brar
[not found] ` <CABb+yY1x7J_oEgU-LR5jPYCoCoUHng84E+CibTxLzdtxhENTBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-06 12:29 ` Fabien DESSENNE
2018-04-06 12:56 ` Jassi Brar
2018-04-06 15:05 ` Fabien DESSENNE
2018-04-06 16:20 ` Jassi Brar
[not found] ` <CABb+yY2Dd2Gr_-+4RaJarq3tve8tgzVqcoJw+MGT=+Vy56PwLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-09 9:03 ` Fabien DESSENNE [this message]
2018-04-09 10:10 ` Jassi Brar
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=d9b30262-3b0b-1b46-dee7-ee1a4b77e66e@st.com \
--to=fabien.dessenne-qxv4g6hh51o@public.gmane.org \
--cc=alexandre.torgue-qxv4g6HH51o@public.gmane.org \
--cc=arnaud.pouliquen-qxv4g6HH51o@public.gmane.org \
--cc=benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=loic.pallardy-qxv4g6HH51o@public.gmane.org \
--cc=ludovic.barre-qxv4g6HH51o@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/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).