remoteproc: k3-r5: Fix check performed in k3_r5_rproc_{mbox_callback/kick}
RFC PATCH 1/1 remoteproc: k3-r5: Fix check performed in k3_r5_rproc_{mbox_callback/kick}
Commit f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".
The "rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.
---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state = RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but __before__ invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.
The equivalent of this patch for ti_k3_dsp_remoteproc.c might also be required, which I shall post if the current patch is acceptable.
Kindly review and share your feedback on this patch.
Regards,
Siddharth.
drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/remoteproc/ti_k3_r5_remoteproc.c +0 -8
@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {
@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 )
Signature · 1 line
2.40.1
Mathieu Poirier
maintainerQuoted 8 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".
Quoted 4 lines
The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.
Honestly, I am very tempted to just revert f3f11cfe8907 and ea1d6fb5b571.
Quoted 58 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-9@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 ) --2.40.1
Quoted 8 lines · Mathieu Poirier
Quoted 7 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".
Quoted 5 lines
Quoted 4 lines
The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.Honestly, I am very tempted to just revert
f3f11cfe8907andea1d6fb5b571.
Please don't :) , it will break rproc in general for k3 devices.
Couple of solutions for this race around condition (in mine preference order)
1) In https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L190 have a check , if probe in is progress or not
2) https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L1205 -- correct the state to ON or something else
3) Move condition https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/remoteproc_core.c#L1360 before rproc_start_subdevices <https://elixir.bootlin.com/linux/v6.11/C/ident/rproc_start_subdevices> calling
Quoted 58 lines
Quoted 58 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-9@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 ) --2.40.1
Mathieu Poirier
maintainerQuoted 10 lines · Udit
Quoted 8 lines · Mathieu Poirier
Quoted 7 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.Honestly, I am very tempted to just revert
f3f11cfe8907andea1d6fb5b571.Please don't :) , it will break rproc in general for k3 devices.
Why not - it is already broken anyway. Reverting the patches will force TI to actually think about the feature in terms of design, completeness and testing. The merge window opened on Sunday - I'm not going to merge whack-a-mole patches and hope the right fix comes along.
Quoted 3 lines
Couple of solutions for this race around condition (in mine preference order)
This is for the TI team to discuss _and_ test thoroughly. From hereon and until I see things improve, all patches from TI will need to be tagged with R-B and T-B tags (collected on the mailing lists) from two different individuals before I look at them.
Quoted 74 lines
1) In
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L190
have a check , if probe in is progress or not2)
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L1205
-- correct the state to ON or something else3) Move condition
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/remoteproc_core.c#L1360
beforerproc_start_subdevices
<https://elixir.bootlin.com/linux/v6.11/C/ident/rproc_start_subdevices>
callingQuoted 58 lines
Quoted 58 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-9@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 ) --2.40.1
Hi Mathieu,
Quoted 16 lines · Mathieu Poirier
Quoted 15 lines · Udit
Quoted 13 lines · Mathieu Poirier
Quoted 11 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.Honestly, I am very tempted to just revert
f3f11cfe8907andea1d6fb5b571.
Quoted 7 lines
Quoted 2 lines
Please don't :) , it will break rproc in general for k3 devices.
Why not - it is already broken anyway. Reverting the patches will force TI to actually think about the feature in terms of design, completeness and testing. The merge window opened on Sunday - I'm not going to merge whack-a-mole patches and hope the right fix comes along.
Now, I am not advocating here to revert or not.
But where we stand currently
1- Without this patch, IPC is broken in general.
2- With this patch, IPC is conditionally broken.
In either case, we need to fix it.
your call to revert or keep it.
Quoted 8 lines
Quoted 4 lines
Couple of solutions for this race around condition (in mine preference order)
This is for the TI team to discuss _and_ test thoroughly. From hereon and until I see things improve, all patches from TI will need to be tagged with R-B and T-B tags (collected on the mailing lists) from two different individuals before I look at them.
Sure we will take care of above
and fair ask on R-B and T-B tags
Quoted 74 lines
Quoted 74 lines
1) In
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L190
have a check , if probe in is progress or not2)
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L1205
-- correct the state to ON or something else3) Move condition
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/remoteproc_core.c#L1360
beforerproc_start_subdevices
<https://elixir.bootlin.com/linux/v6.11/C/ident/rproc_start_subdevices>
callingQuoted 57 lines
Quoted 57 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-9@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 ) --2.40.1
Quoted 27 lines · Udit
Hi Mathieu,
Quoted 16 lines · Mathieu Poirier
Quoted 15 lines · Udit
Quoted 13 lines · Mathieu Poirier
Quoted 11 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.Honestly, I am very tempted to just revert
f3f11cfe8907andea1d6fb5b571.Quoted 7 lines
Quoted 2 lines
Please don't :) , it will break rproc in general for k3 devices.
Why not - it is already broken anyway. Reverting the patches will force TI to actually think about the feature in terms of design, completeness and testing. The merge window opened on Sunday - I'm not going to merge whack-a-mole patches and hope the right fix comes along.
Quoted 7 lines
Now, I am not advocating here to revert or not.
But where we stand currently
1- Without this patch, IPC is broken in general.
2- With this patch, IPC is conditionally broken.
Sorry for confusion,
here _this_ patch I meant below commit ids
f3f11cfe8907 and ea1d6fb5b571.
Quoted 98 lines
In either case, we need to fix it.
your call to revert or keep it.
Quoted 8 lines
Quoted 4 lines
Couple of solutions for this race around condition (in mine preference order)
This is for the TI team to discuss _and_ test thoroughly. From hereon and until I see things improve, all patches from TI will need to be tagged with R-B and T-B tags (collected on the mailing lists) from two different individuals before I look at them.
Sure we will take care of above
and fair ask on R-B and T-B tags
Quoted 79 lines
Quoted 79 lines
1) In
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L190have a check , if probe in is progress or not
2)
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L1205-- correct the state to ON or something else
3) Move condition
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/remoteproc_core.c#L1360before
rproc_start_subdevices
<https://elixir.bootlin.com/linux/v6.11/C/ident/rproc_start_subdevices>
callingQuoted 59 lines
Quoted 59 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.
drivers/remoteproc/ti_k3_r5_remoteproc.c| 8 --------1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-4@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data) const char *name = kproc->rproc->name; u32 msg = omap_mbox_message(data); - /* Do not forward message from a detached core */ - if (kproc->rproc->state == RPROC_DETACHED) - return; - dev_dbg(dev, "mbox msg: 0x%x\n", msg);switch (msg) {
drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-4@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid) mbox_msg_t msg = (mbox_msg_t)vqid; int ret; - /* Do not forward message to a detached core */ - if (kproc->rproc->state == RPROC_DETACHED) - return; - /* send the index of the triggered virtqueue in the mailbox payload */ ret = mbox_send_message(kproc->mbox, (void *)msg);if (ret < 0)
Signature · 1 line
2.40.1
Mathieu Poirier
maintainerQuoted 32 lines · Udit
Hi Mathieu,
Quoted 16 lines · Mathieu Poirier
Quoted 15 lines · Udit
Quoted 13 lines · Mathieu Poirier
Quoted 11 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.Honestly, I am very tempted to just revert
f3f11cfe8907andea1d6fb5b571.Quoted 7 lines
Quoted 2 lines
Please don't :) , it will break rproc in general for k3 devices.
Why not - it is already broken anyway. Reverting the patches will force TI to actually think about the feature in terms of design, completeness and testing. The merge window opened on Sunday - I'm not going to merge whack-a-mole patches and hope the right fix comes along.
Now, I am not advocating here to revert or not.
But where we stand currently
Quoted 8 lines
1- Without this patch, IPC is broken in general.
2- With this patch, IPC is conditionally broken.
In either case, we need to fix it.
your call to revert or keep it.
I will keep f3f11cfe8907 and ea1d6fb5b571 but will not take this one because 1) we are in the merge window and 2) I have no assurance that this is the right (and complete) fix.
Quoted 88 lines
Quoted 9 lines
Quoted 5 lines
Couple of solutions for this race around condition (in mine preference order)
This is for the TI team to discuss _and_ test thoroughly. From hereon and until I see things improve, all patches from TI will need to be tagged with R-B and T-B tags (collected on the mailing lists) from two different individuals before I look at them.
Sure we will take care of above
and fair ask on R-B and T-B tags
Quoted 74 lines
Quoted 74 lines
1) In
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L190
have a check , if probe in is progress or not2)
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L1205
-- correct the state to ON or something else3) Move condition
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/remoteproc_core.c#L1360
beforerproc_start_subdevices
<https://elixir.bootlin.com/linux/v6.11/C/ident/rproc_start_subdevices>
callingQuoted 57 lines
Quoted 57 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-9@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 ) --2.40.1
Hi Mathieu,
Quoted 16 lines · Mathieu Poirier
Quoted 15 lines · Udit
Quoted 13 lines · Mathieu Poirier
Quoted 11 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.Honestly, I am very tempted to just revert
f3f11cfe8907andea1d6fb5b571.
Quoted 7 lines
Quoted 2 lines
Please don't :) , it will break rproc in general for k3 devices.
Why not - it is already broken anyway. Reverting the patches will force TI to actually think about the feature in terms of design, completeness and testing. The merge window opened on Sunday - I'm not going to merge whack-a-mole patches and hope the right fix comes along.
Apologies for causing this trouble, Mathieu. I have accumulated various use-cases of the driver, including this, and hereon will keep in mind while posting further patches.
Quoted 8 lines
Quoted 4 lines
Couple of solutions for this race around condition (in mine preference order)
This is for the TI team to discuss _and_ test thoroughly. From hereon and until I see things improve, all patches from TI will need to be tagged with R-B and T-B tags (collected on the mailing lists) from two different individuals before I look at them.
Understood, that is a fair ask. Hereon, I will also attach my test logs for all the usecases I've tested a patch with, to give more visibility on the testing done.
Quoted 74 lines
Quoted 74 lines
1) In
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L190
have a check , if probe in is progress or not2)
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L1205
-- correct the state to ON or something else3) Move condition
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/remoteproc_core.c#L1360
beforerproc_start_subdevices
<https://elixir.bootlin.com/linux/v6.11/C/ident/rproc_start_subdevices>
callingQuoted 57 lines
Quoted 57 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-9@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 ) --2.40.1
Mathieu Poirier
maintainers
Quoted 43 lines · Beleswar Prasad Padhi
Hi Mathieu,
Quoted 16 lines · Mathieu Poirier
Quoted 15 lines · Udit
Quoted 13 lines · Mathieu Poirier
Quoted 11 lines · Siddharth Vadapalli
Commit
f3f11cfe8907("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".The "
rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.Honestly, I am very tempted to just revert
f3f11cfe8907andea1d6fb5b571.Quoted 7 lines
Quoted 2 lines
Please don't :) , it will break rproc in general for k3 devices.
Why not - it is already broken anyway. Reverting the patches will force TI to actually think about the feature in terms of design, completeness and testing. The merge window opened on Sunday - I'm not going to merge whack-a-mole patches and hope the right fix comes along.
Apologies for causing this trouble, Mathieu. I have accumulated various use-cases of the driver, including this, and hereon will keep in mind while posting further patches.
Quoted 8 lines
Quoted 4 lines
Couple of solutions for this race around condition (in mine preference order)
This is for the TI team to discuss _and_ test thoroughly. From hereon and until I see things improve, all patches from TI will need to be tagged with R-B and T-B tags (collected on the mailing lists) from two different individuals before I look at them.
Quoted 4 lines
Understood, that is a fair ask. Hereon, I will also attach my test logs for all the usecases I've tested a patch with, to give more visibility on the testing done.
I am not in a position (nor have the time) to look at test logs and as such, there is no point in doing that. That time should be better spent building a CI that goes through all the scenarios and making sure that all patches pass the tests before being sent to the mailing list.
Quoted 74 lines
Quoted 74 lines
Quoted 74 lines
1) In
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L190
have a check , if probe in is progress or not2)
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/ti_k3_r5_remoteproc.c#L1205
-- correct the state to ON or something else3) Move condition
https://elixir.bootlin.com/linux/v6.11/source/drivers/remoteproc/remoteproc_core.c#L1360
beforerproc_start_subdevices
<https://elixir.bootlin.com/linux/v6.11/C/ident/rproc_start_subdevices>
callingQuoted 57 lines
Quoted 57 lines
Fixes f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
Since the commit being fixed is not yet a part of Mainline Linux, this patch is based on linux-next tagged next-20240913.
An alternative to this patch will be a change to the "
__rproc_attach()" function in the "remoteproc_core.c" driver withrproc->state=RPROC_ATTACHED;
being set after "rproc_attach_device()" is invoked, but__before__invoking "rproc_start_subdevices()". Since this change will be performed in the common Remoteproc Core, it appeared to me that fixing it in the TI remoteproc driver is the correct approach.The equivalent of this patch for
ti_k3_dsp_remoteproc.cmight also be required, which I shall post if the current patch is acceptable.Kindly review and share your feedback on this patch.
Regards,
Siddharth.drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)drivers/remoteproc/ti_k3_r5_remoteproc.c +0
-9@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 ) --2.40.1