2024-02-15 16:24:08

by Sean Anderson

[permalink] [raw]
Subject: [RESEND PATCH net v4 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock

smp_call_function_single disables IRQs when executing the callback. To
prevent deadlocks, we must disable IRQs when taking cgr_lock elsewhere.
This is already done by qman_update_cgr and qman_delete_cgr; fix the
other lockers.

Fixes: 96f413f47677 ("soc/fsl/qbman: fix issue in qman_delete_cgr_safe()")
CC: [email protected]
Signed-off-by: Sean Anderson <[email protected]>
Reviewed-by: Camelia Groza <[email protected]>
Tested-by: Vladimir Oltean <[email protected]>
---
I got no response the first time I sent this, so I am resending to net.
This issue was introduced in a series which went through net, so I hope
it makes sense to take it via net.

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/

(no changes since v3)

Changes in v3:
- Change blamed commit to something more appropriate

Changes in v2:
- Fix one additional call to spin_unlock

drivers/soc/fsl/qbman/qman.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index 739e4eee6b75..1bf1f1ea67f0 100644
--- a/drivers/soc/fsl/qbman/qman.c
+++ b/drivers/soc/fsl/qbman/qman.c
@@ -1456,11 +1456,11 @@ static void qm_congestion_task(struct work_struct *work)
union qm_mc_result *mcr;
struct qman_cgr *cgr;

- spin_lock(&p->cgr_lock);
+ spin_lock_irq(&p->cgr_lock);
qm_mc_start(&p->p);
qm_mc_commit(&p->p, QM_MCC_VERB_QUERYCONGESTION);
if (!qm_mc_result_timeout(&p->p, &mcr)) {
- spin_unlock(&p->cgr_lock);
+ spin_unlock_irq(&p->cgr_lock);
dev_crit(p->config->dev, "QUERYCONGESTION timeout\n");
qman_p_irqsource_add(p, QM_PIRQ_CSCI);
return;
@@ -1476,7 +1476,7 @@ static void qm_congestion_task(struct work_struct *work)
list_for_each_entry(cgr, &p->cgr_cbs, node)
if (cgr->cb && qman_cgrs_get(&c, cgr->cgrid))
cgr->cb(p, cgr, qman_cgrs_get(&rr, cgr->cgrid));
- spin_unlock(&p->cgr_lock);
+ spin_unlock_irq(&p->cgr_lock);
qman_p_irqsource_add(p, QM_PIRQ_CSCI);
}

@@ -2440,7 +2440,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
preempt_enable();

cgr->chan = p->config->channel;
- spin_lock(&p->cgr_lock);
+ spin_lock_irq(&p->cgr_lock);

if (opts) {
struct qm_mcc_initcgr local_opts = *opts;
@@ -2477,7 +2477,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
qman_cgrs_get(&p->cgrs[1], cgr->cgrid))
cgr->cb(p, cgr, 1);
out:
- spin_unlock(&p->cgr_lock);
+ spin_unlock_irq(&p->cgr_lock);
put_affine_portal();
return ret;
}
--
2.35.1.1320.gc452695387.dirty


[Embedded World 2024, SECO SpA]<https://www.messe-ticket.de/Nuernberg/embeddedworld2024/Register/ew24517689>


2024-02-19 15:42:56

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [RESEND PATCH net v4 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock

Hi Sean,

On Thu, Feb 15, 2024 at 11:23:26AM -0500, Sean Anderson wrote:
> smp_call_function_single disables IRQs when executing the callback. To
> prevent deadlocks, we must disable IRQs when taking cgr_lock elsewhere.
> This is already done by qman_update_cgr and qman_delete_cgr; fix the
> other lockers.
>
> Fixes: 96f413f47677 ("soc/fsl/qbman: fix issue in qman_delete_cgr_safe()")
> CC: [email protected]
> Signed-off-by: Sean Anderson <[email protected]>
> Reviewed-by: Camelia Groza <[email protected]>
> Tested-by: Vladimir Oltean <[email protected]>
> ---
> I got no response the first time I sent this, so I am resending to net.
> This issue was introduced in a series which went through net, so I hope
> it makes sense to take it via net.
>
> [1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
>
> (no changes since v3)
>
> Changes in v3:
> - Change blamed commit to something more appropriate
>
> Changes in v2:
> - Fix one additional call to spin_unlock

Leo Li (Li Yang) is no longer with NXP. Until we figure out within NXP
how to continue with the maintainership of drivers/soc/fsl/, yes, please
continue to submit this series to 'net'. I would also like to point
out to Arnd that this is the case.

Arnd, a large portion of drivers/soc/fsl/ is networking-related
(dpio, qbman). Would it make sense to transfer the maintainership
of these under the respective networking drivers, to simplify the
procedures?

Also, your patches are whitespace-damaged. They do not apply to the
kernel, and patchwork shows this as well.
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Please repost with this fixed.

2024-04-10 04:54:59

by Christophe Leroy

[permalink] [raw]
Subject: Re: [RESEND PATCH net v4 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock

Hi Vladimir,

Le 19/02/2024 à 16:30, Vladimir Oltean a écrit :
> Hi Sean,
>
> On Thu, Feb 15, 2024 at 11:23:26AM -0500, Sean Anderson wrote:
>> smp_call_function_single disables IRQs when executing the callback. To
>> prevent deadlocks, we must disable IRQs when taking cgr_lock elsewhere.
>> This is already done by qman_update_cgr and qman_delete_cgr; fix the
>> other lockers.
>>
>> Fixes: 96f413f47677 ("soc/fsl/qbman: fix issue in qman_delete_cgr_safe()")
>> CC: [email protected]
>> Signed-off-by: Sean Anderson <[email protected]>
>> Reviewed-by: Camelia Groza <[email protected]>
>> Tested-by: Vladimir Oltean <[email protected]>
>> ---
>> I got no response the first time I sent this, so I am resending to net.
>> This issue was introduced in a series which went through net, so I hope
>> it makes sense to take it via net.
>>
>> [1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
>>
>> (no changes since v3)
>>
>> Changes in v3:
>> - Change blamed commit to something more appropriate
>>
>> Changes in v2:
>> - Fix one additional call to spin_unlock
>
> Leo Li (Li Yang) is no longer with NXP. Until we figure out within NXP
> how to continue with the maintainership of drivers/soc/fsl/, yes, please
> continue to submit this series to 'net'. I would also like to point
> out to Arnd that this is the case.
>
> Arnd, a large portion of drivers/soc/fsl/ is networking-related
> (dpio, qbman). Would it make sense to transfer the maintainership
> of these under the respective networking drivers, to simplify the
> procedures?

I see FREESCALE QUICC ENGINE LIBRARY (drivers/soc/fsl/qe/) is maintained
by Qiang Zhao <[email protected]> but I can't find any mail from him in
the past 4 years in linuxppc-dev list, and everytime I wanted to submit
something I only got responses from Leo Ly.

The last commit he reviewed is 661ea25e5319 ("soc: fsl: qe: Replace
one-element array and use struct_size() helper"), it was in May 2020.

Is he still working at NXP and actively maintaining that library ?
Keeping this part maintained is vital for me as this SOC is embedded in
the two powerpc platform I maintain (8xx and 83xx).

If Qiang Zhao is not able to activaly maintain that SOC anymore, I
volonteer to maintain it.

Thanks
Christophe

2024-04-11 13:06:21

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RESEND PATCH net v4 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock

On Wed, Apr 10, 2024, at 06:54, Christophe Leroy wrote:
> Le 19/02/2024 à 16:30, Vladimir Oltean a écrit :
>> On Thu, Feb 15, 2024 at 11:23:26AM -0500, Sean Anderson wrote:
>>> smp_call_function_single disables IRQs when executing the callback. To
>>> prevent deadlocks, we must disable IRQs when taking cgr_lock elsewhere.
>>> This is already done by qman_update_cgr and qman_delete_cgr; fix the
>>> other lockers.
>>>
>>> Fixes: 96f413f47677 ("soc/fsl/qbman: fix issue in qman_delete_cgr_safe()")
>>> CC: [email protected]
>>> Signed-off-by: Sean Anderson <[email protected]>
>>> Reviewed-by: Camelia Groza <[email protected]>
>>> Tested-by: Vladimir Oltean <[email protected]>
>>> ---
>>> I got no response the first time I sent this, so I am resending to net.
>>> This issue was introduced in a series which went through net, so I hope
>>> it makes sense to take it via net.
>>>
>>> [1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
>>>
>>> (no changes since v3)
>>>
>>> Changes in v3:
>>> - Change blamed commit to something more appropriate
>>>
>>> Changes in v2:
>>> - Fix one additional call to spin_unlock
>>
>> Leo Li (Li Yang) is no longer with NXP. Until we figure out within NXP
>> how to continue with the maintainership of drivers/soc/fsl/, yes, please
>> continue to submit this series to 'net'. I would also like to point
>> out to Arnd that this is the case.
>>
>> Arnd, a large portion of drivers/soc/fsl/ is networking-related
>> (dpio, qbman). Would it make sense to transfer the maintainership
>> of these under the respective networking drivers, to simplify the
>> procedures?

If there are parts that are only used by networking, I'm definitely
fine with moving those out of drivers/soc into the respective users,
but as far as I can tell, all the code there is shared by multiple
subsystems (crypto, dma, usb, ...), so that would likely require
at least a reorganization.

> I see FREESCALE QUICC ENGINE LIBRARY (drivers/soc/fsl/qe/) is maintained
> by Qiang Zhao <[email protected]> but I can't find any mail from him in
> the past 4 years in linuxppc-dev list, and everytime I wanted to submit
> something I only got responses from Leo Ly.
>
> The last commit he reviewed is 661ea25e5319 ("soc: fsl: qe: Replace
> one-element array and use struct_size() helper"), it was in May 2020.
>
> Is he still working at NXP and actively maintaining that library ?
> Keeping this part maintained is vital for me as this SOC is embedded in
> the two powerpc platform I maintain (8xx and 83xx).
>
> If Qiang Zhao is not able to activaly maintain that SOC anymore, I
> volonteer to maintain it.

Thanks, much appreciated. The QE driver is also used on
arm64/ls1043a, but I have not seen any email or pull requests
from Qiang Zhao for that driver either.

The previous setup was that Li Yang picked up patches for
anything under drivers/soc/fsl/ and forwarded them to
[email protected] for me to pick up.

I would very much like to get back to the state of having
one or two maintainers for all of drivers/soc/fsl/ and
not have to worry about individual drivers under it when
they are all maintained by different people.

Shawn Guo is already maintaining the arm64 side of
Layerscape in addition to the i.MX code. Herve Codina in
turn has taken responsibility for qe/qmc.c and qe/tsa.c.

Maybe you can pick one more more maintainers for
drivers/soc/fsl/ between the three of you to collect
patches into a git branch and send pull requests to
[email protected]?

Arnd