Re: [PATCH net] mctp i3c: fix MCTP I3C driver multi-thread issue
From: Jeremy Kerr
Date: Thu Jan 02 2025 - 21:34:38 EST
Hi Leo,
> We found a timeout problem with the pldm command on our system. The
> reason is that the MCTP-I3C driver has a race condition when receiving
> multiple-packet messages in multi-thread, resulting in a wrong packet
> order problem.
>
> We identified this problem by adding a debug message to the
> mctp_i3c_read function.
Mostly out of curiosity, could you share a little detail about what you
were observing with that read behaviour? Were the IBIs being handed by
different CPUs in that case?
I assume that you were seeing the netif_rx() out of sequence with the
skbs populated from i3c_device_do_priv_xfers(), is that right?
> Therefore, we try to solve this problem by adding a mutex to the
> mctp_i3c_read function.
Just to clarify the intent here, and if I'm correct with the assumption
above, it would be good to a comment on what this lock is serialising.
If you're re-rolling with Jakub's Fixes request, can you add a comment
too? Something like:
/* ensure that we netif_rx() in the same order as the i3c reads */
mutex_lock(&mi->lock);
Otherwise, all looks good. Thanks for the contribution!
Cheers,
Jeremy