From: Loic PALLARDY <loic.pallardy@st.com>
To: Suman Anna <s-anna@ti.com>,
"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
"ohad@wizery.com" <ohad@wizery.com>
Cc: "linux-remoteproc@vger.kernel.org"
<linux-remoteproc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Arnaud POULIQUEN" <arnaud.pouliquen@st.com>,
"benjamin.gaignard@linaro.org" <benjamin.gaignard@linaro.org>
Subject: RE: [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix rpmsg_remove() release order
Date: Thu, 26 Jul 2018 07:09:13 +0000 [thread overview]
Message-ID: <41d5058358014bbd8ab4329ecb5355f6@SFHDAG7NODE2.st.com> (raw)
In-Reply-To: <d9b7192b-2fc7-664f-d9a5-b90c8644b991@ti.com>
> -----Original Message-----
> From: Suman Anna <s-anna@ti.com>
> Sent: Thursday, July 26, 2018 12:32 AM
> To: Loic PALLARDY <loic.pallardy@st.com>; bjorn.andersson@linaro.org;
> ohad@wizery.com
> Cc: linux-remoteproc@vger.kernel.org; linux-kernel@vger.kernel.org;
> Arnaud POULIQUEN <arnaud.pouliquen@st.com>;
> benjamin.gaignard@linaro.org
> Subject: Re: [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix rpmsg_remove()
> release order
>
> Hi Loic,
>
> On 07/25/2018 04:07 PM, Loic Pallardy wrote:
> > In rpmsg_remove() procedure, children are removed then Name
> > Service announcement endpoint is destroyed and device released.
> >
> > Issue with current implementation is if a NS announcement
> > creation request is ongoing (received before virtio reset),
> > child device could be created after children removing.
> > In that case rpmsg_remove() is freeing rpmsg_virtio_bus,
> > leading to an inconsistent state.
> >
> > This patch is destroying NS announcement service endpoint before
> > removing children to guarantee that list of child devices is
> > fixed and all of them will be correctly removed before cleaning
> > resources.
>
> I do not think this is the right fix for the problem you explained.
> The removal of rpmsg devices can actually invoke the announce_destroy
> in the rpmsg_dev_remove().
Yes it was one of my interrogation correcting it like that. But as virtio link has been put in reset state just before, no message could be sent to coprocessor...
Other possible correction (maybe less elegant), keeping current order, is to introduce a rpmsg bus "status" that will be checked before registering new device.
Anyway, we need to prevent new rpmsg device register after children removal to avoid orphan device.
Regards,
Loic
>
> regards
> Suman
>
> >
> > fixes: bcabbccabffe ("rpmsg: Split off generic tail of create_channel()")
> >
> > Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
> > ---
> > drivers/rpmsg/virtio_rpmsg_bus.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c
> b/drivers/rpmsg/virtio_rpmsg_bus.c
> > index 664f957..f5d481f 100644
> > --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> > +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> > @@ -1004,13 +1004,13 @@ static void rpmsg_remove(struct virtio_device
> *vdev)
> >
> > vdev->config->reset(vdev);
> >
> > + if (vrp->ns_ept)
> > + __rpmsg_destroy_ept(vrp, vrp->ns_ept);
> > +
> > ret = device_for_each_child(&vdev->dev, NULL,
> rpmsg_remove_device);
> > if (ret)
> > dev_warn(&vdev->dev, "can't remove rpmsg device: %d\n",
> ret);
> >
> > - if (vrp->ns_ept)
> > - __rpmsg_destroy_ept(vrp, vrp->ns_ept);
> > -
> > idr_destroy(&vrp->endpoints);
> >
> > vdev->config->del_vqs(vrp->vdev);
> >
prev parent reply other threads:[~2018-07-26 7:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-25 21:07 Loic Pallardy
2018-07-25 22:32 ` Suman Anna
2018-07-26 7:09 ` Loic PALLARDY [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=41d5058358014bbd8ab4329ecb5355f6@SFHDAG7NODE2.st.com \
--to=loic.pallardy@st.com \
--cc=arnaud.pouliquen@st.com \
--cc=benjamin.gaignard@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=s-anna@ti.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
all inboxes | Powered by JetHome®