From: Sudeep Holla <sudeep.holla@arm.com>
To: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Peng Fan <peng.fan@nxp.com>,
linux-kernel@vger.kernel.org,
Bo Zhang <bozhang.zhang@broadcom.com>,
Jim Quinlan <james.quinlan@broadcom.com>,
Gaku Inami <gaku.inami.xh@renesas.com>,
Volodymyr Babchuk <volodymyr_babchuk@epam.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 6/6] firmware: arm_scmi: Check if platform has released shmem before using
Date: Mon, 5 Aug 2019 13:52:45 +0100 [thread overview]
Message-ID: <20190805125245.GA627@e107155-lin> (raw)
In-Reply-To: <CAN5uoS_TA5ELTLtHnUbWhaOHyUDjoKZz0S8SfmXBfR+n-=_M3w@mail.gmail.com>
On Mon, Aug 05, 2019 at 02:33:53PM +0200, Etienne Carriere wrote:
> Hello Sudeep,
>
> On Fri, 26 Jul 2019 at 15:46, Sudeep Holla <sudeep.holla@arm.com> wrote:
> >
> > Sometimes platfom may take too long to respond to the command and OS
> > might timeout before platform transfer the ownership of the shared
> > memory region to the OS with the response.
> >
> > Since the mailbox channel associated with the channel is freed and new
> > commands are dispatch on the same channel, OS needs to wait until it
> > gets back the ownership. If not, either OS may end up overwriting the
> > platform response for the last command(which is fine as OS timed out
> > that command) or platform might overwrite the payload for the next
> > command with the response for the old.
> >
> > The latter is problematic as platform may end up interpretting the
> > response as the payload. In order to avoid such race, let's wait until
> > the OS gets back the ownership before we prepare the shared memory with
> > the payload for the next command.
> >
> > Reported-by: Jim Quinlan <james.quinlan@broadcom.com>
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> > drivers/firmware/arm_scmi/driver.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> > index 69bf85fea967..765573756987 100644
> > --- a/drivers/firmware/arm_scmi/driver.c
> > +++ b/drivers/firmware/arm_scmi/driver.c
> > @@ -265,6 +265,14 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m)
> > struct scmi_chan_info *cinfo = client_to_scmi_chan_info(cl);
> > struct scmi_shared_mem __iomem *mem = cinfo->payload;
> >
> > + /*
> > + * Ideally channel must be free by now unless OS timeout last
> > + * request and platform continued to process the same, wait
> > + * until it releases the shared memory, otherwise we may endup
> > + * overwriting it's response with new command payload or vice-versa
>
> minor typo: s/it's/its/
> maybe also s/command/message/
>
Thanks for taking a look at this, both are fixed locally now.
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-08-05 12:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-26 13:45 [PATCH v2 0/6] firmware: arm_scmi: miscellaneous fixes/updates Sudeep Holla
2019-07-26 13:45 ` [PATCH v2 1/6] firmware: arm_scmi: Use the correct style for SPDX License Identifier Sudeep Holla
2019-07-26 13:45 ` [PATCH v2 2/6] firmware: arm_scmi: Align few names in sensors protocol with SCMI specification Sudeep Holla
2019-07-26 13:45 ` [PATCH v2 3/6] firmware: arm_scmi: Remove extra check for invalid length message responses Sudeep Holla
2019-07-26 13:45 ` [PATCH v2 4/6] firmware: arm_scmi: Fix few trivial typos in comments Sudeep Holla
2019-07-26 13:45 ` [PATCH v2 5/6] firmware: arm_scmi: Use the term 'message' instead of 'command' Sudeep Holla
2019-07-26 13:45 ` [PATCH v2 6/6] firmware: arm_scmi: Check if platform has released shmem before using Sudeep Holla
2019-08-05 12:33 ` Etienne Carriere
2019-08-05 12:52 ` Sudeep Holla [this message]
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=20190805125245.GA627@e107155-lin \
--to=sudeep.holla@arm.com \
--cc=bozhang.zhang@broadcom.com \
--cc=etienne.carriere@linaro.org \
--cc=gaku.inami.xh@renesas.com \
--cc=james.quinlan@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=volodymyr_babchuk@epam.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).