From: Suman Anna <s-anna@ti.com>
To: Jassi Brar <jaswinder.singh@linaro.org>
Cc: Loic PALLARDY <loic.pallardy@st.com>,
Jassi Brar <jassisinghbrar@gmail.com>,
"Ohad Ben-Cohen (ohad@wizery.com)" <ohad@wizery.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
"Andy Green (andy.green@linaro.org)" <andy.green@linaro.org>,
Russell King <linux@arm.linux.org.uk>,
Arnd Bergmann <arnd@arndb.de>, Tony Lindgren <tony@atomide.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linus Walleij <linus.walleij@linaro.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Omar Ramirez Luna (omar.ramirez@copitl.com)"
<omar.ramirez@copitl.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCHv3 00/14] drivers: mailbox: framework creation
Date: Thu, 25 Apr 2013 17:29:03 -0500 [thread overview]
Message-ID: <5179AE2F.3040403@ti.com> (raw)
In-Reply-To: <CAJe_ZhfDZzq+DzA9XDF3PWFUmwcZnDy-mhE4hLNHmf+V4GhOxw@mail.gmail.com>
Jassi,
On 04/25/2013 12:20 AM, Jassi Brar wrote:
> On 25 April 2013 04:46, Suman Anna <s-anna@ti.com> wrote:
>> On 04/24/2013 03:56 AM, Jassi Brar wrote:
>>
>
>> I think there are two things here - one is what the client needs to do
>> upon sending/receiving a message, and the other is what the send API or
>> the mailbox controller should do when a client tried to send a message
>> and the controller's shared message/transport is not free (irrespective
>> of the atomic or non-atomic context). The kfifos in the common driver
>> code are currently solving the latter problem. The current send API
>> directly uses the controller to send if it is free, and uses buffering
>> only when it is busy. But, I see your point that this should should be
>> the responsibility of the specific controller, or even a property of the
>> specific mailbox belonging to that controller. This direction would put
>> most of the onus on the specific controller drivers, and probably the
>> main API would be very simple. Another factor / attribute to consider is
>> that a given mailbox may be sharable or exclusive, things are simple if
>> it is exclusive to a client driver.
>>
> I never suggested we don't use buffering. I too believe the API should
> buffer requests but also that it should still do atomic callbacks. The
> impact on implementation would be that the queue buffer can not grow
> at runtime. But that should be fine because a reasonable size (say 10
> or even 50) could be chosen and we allow submission of requests from
> tx_done callback.
Yeah, even the current kfifo approach doesn't grow the queue buffer at
runtime, and the size of the kfifo is determined at driver init time
based on the controller. If the queue is also full, then you fail
tranmitting right away. OK, I thought you didn't want buffering, if that
is not the case, then the buffering should be within the main driver
code, like it is now, but configurable based on the controller or
mailbox properties. If it is present in individual controller drivers,
then we would be duplicating stuff. Are you envisioning that this be
left to the individual controllers?
>
>>
>> We are talking two fundamentally different usecases/needs here,
>> depending on the type of the controller. You seem to be coming from a
>> usecase where the client driver needs to know when every message is
>> transmitted (from an atomic context, it is a moot point since either you
>> are successful or not when transmitting).
>>
> I am afraid you are confusing the meaning of 'atomic context' here.
> atomic context doesn't mean instant transmission of data, but that the
> API calls could be made from even atomic context and that the client &
> controller can't sleep in callbacks from the API. So it's not moot.
I understood the atomic context, and the question is about the behavior
of the '.tx_done' callback when sending from atomic context. Is there
such a usecase/need for you in that you want to send a response back
from an atomic context, yet get a callback?
>
>> The remote
>> has to ack before it can be shutdown. I would imagine that getting a
>> .tx_done on a particular message is not good enough to know that the
>> remote is ready for shutdown. I can imagine it to be useful where there
>> is some inherent knowledge that the client needs to proceed with the
>> next steps when a message is sent.
>>
> Of course we are not specifying how the mailbox signals are
> interpreted by the remote. It should suffice just to realize that
> there exists genuine requirement for a client to know when its message
> was received by the remote.
>
>> That said, we need to go with the
>> stricter one.
>>
> Great, that we agree.
>
>> My only concern here is that if there can be multiple
>> clients for a particular mailbox/controller, then all the clients would
>> have to have an agreement on the controller packet type, and the clients
>> would mostly have to include the standard mailbox.h as well as a
>> controller-specific header.
>>
> It's the controller driver that actually puts the data on the bus. So
> only it should define the format in which it accepts data from the
> clients. Every client should simply populate the packet structure
> defined in my_lovely_controller.h and pass on the struct pointer to
> the controller driver via API.
> No negotiations for the driver seat among passengers :)
OK, I was trying to avoid including my_lovely_controller.h and only
include the standard .h file as a client user, the client would anyway
need to have the intrinsic knowledge of the packet structure. And if you
were to do buffering in the common driver code, you would need the size
field outside. The void *msg packet structure would still be an
understanding between the client and the controller. So, it is a
tradeoff between just using void * and leave the buffering to controller
driver (potential duplication) & using a size and void *, along with
buffering in common driver code.
>
>> Overall, I see it coming down to following points:
>> 1. Calling contexts: Atomic & non-atomic contexts, with the latter
>> becoming an extension of the atomic case. I guess this mainly goes with
>> the controller functional integration - whether it is used for
>> non-urgent messaging or h/w controller command messages (like PM
>> usecases?) where .tx_done is relevant.
>>
> Urgency or not is a business of the client driver. The API and the
> controller driver should not delay things more than absolute
> necessary.
> .tx_done is not about urgency but about h/w provision of 'ack'.
>
>> 2. Behavior of the API or controller driver if the controller transport
>> is busy.
> I think we both want requests buffered in the API.
>
>> 3. Shareable/exclusive nature of a mailbox. If it is shareable, then
>> duplicating the behavior between clients is not worth it, and this
>> should be absorbed into the respective controller driver.
>>
> I think the mailbox should be exclusively held by a client. That makes
> many things simpler. Also remote firmwares won't be always robust
> enough to handle commands from different subsystems intermixed. The
> API only has to make sure the mailbox_get/put operations are very
> thin.
This might be the case for specific remotes where we expect only one
client driver to be responsible for talking to it, but for generic
offloading, you do not want to have this restriction. You do not want
peer clients to go through a single main client, as the latencies or the
infrastructure imposed by the main client may not be suitable for the
other clients. The stricter usecase here would be the shareable mailbox,
and if it is exclusive, as dictated by a controller or device property,
then so be it and things would get simplified for that controller/device.
regards
Suman
next prev parent reply other threads:[~2013-04-25 22:34 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 3:23 [PATCHv3 00/14] drivers: mailbox: framework creation Suman Anna
2013-03-21 11:39 ` Linus Walleij
2013-03-21 23:22 ` Stephen Rothwell
2013-03-21 23:37 ` Anna, Suman
2013-04-21 2:40 ` Jassi Brar
2013-04-22 15:56 ` Anna, Suman
2013-04-23 4:51 ` Jassi Brar
2013-04-23 19:20 ` Anna, Suman
2013-04-23 23:30 ` Andy Green
2013-04-24 4:39 ` Jassi Brar
2013-04-24 8:08 ` Loic PALLARDY
2013-04-24 8:56 ` Jassi Brar
2013-04-24 23:16 ` Suman Anna
2013-04-25 5:20 ` Jassi Brar
2013-04-25 22:29 ` Suman Anna [this message]
2013-04-25 23:51 ` Andy Green
2013-04-26 3:46 ` Jassi Brar
2013-04-27 1:04 ` Suman Anna
2013-04-27 1:48 ` Andy Green
2013-04-29 15:32 ` Suman Anna
2013-04-27 4:51 ` Jassi Brar
2013-04-27 18:05 ` [PATCH 1/3] mailbox: rename pl320-ipc specific mailbox.h jaswinder.singh
2013-04-29 12:46 ` Mark Langsdorf
2013-04-27 18:14 ` [RFC 2/3] mailbox: Introduce a new common API jassisinghbrar
2013-05-04 2:20 ` Suman Anna
2013-05-04 19:08 ` Jassi Brar
2013-05-06 23:45 ` Suman Anna
2013-05-07 7:40 ` Jassi Brar
2013-05-07 21:48 ` Suman Anna
2013-05-08 5:44 ` Jassi Brar
2013-05-09 1:25 ` Suman Anna
2013-05-09 16:35 ` Jassi Brar
2013-05-10 0:18 ` Suman Anna
2013-05-10 10:06 ` Jassi Brar
2013-05-10 16:41 ` Suman Anna
2013-04-27 18:14 ` [RFC 3/3] mailbox: pl320: Introduce common API driver jassisinghbrar
2013-04-29 16:44 ` Suman Anna
2013-04-29 16:57 ` Jassi Brar
2013-04-29 17:06 ` Mark Langsdorf
2013-04-29 17:28 ` Jassi Brar
2013-04-29 16:00 ` [PATCHv3 00/14] drivers: mailbox: framework creation Suman Anna
2013-04-29 16:49 ` Jassi Brar
2013-04-24 7:39 ` Loic PALLARDY
2013-04-24 7:59 ` Jassi Brar
2013-04-24 8:39 ` Loic PALLARDY
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=5179AE2F.3040403@ti.com \
--to=s-anna@ti.com \
--cc=andy.green@linaro.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jassisinghbrar@gmail.com \
--cc=jaswinder.singh@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=loic.pallardy@st.com \
--cc=ohad@wizery.com \
--cc=omar.ramirez@copitl.com \
--cc=rafael.j.wysocki@intel.com \
--cc=sfr@canb.auug.org.au \
--cc=tony@atomide.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