On 03.11.20 18:13, Vladimir Oltean wrote:
> On Thu, Oct 29, 2020 at 10:10:56AM +0200, Claudiu Manoil wrote:
>> When PTP timestamping is enabled on Tx, the controller
>> inserts the Tx timestamp at the beginning of the frame
>> buffer, between SFD and the L2 frame header.  This means
>> that the skb provided by the stack is required to have
>> enough headroom otherwise a new skb needs to be created
>> by the driver to accommodate the timestamp inserted by h/w.
>> Up until now the driver was relying on skb_realloc_headroom()
>> to create new skbs to accommodate PTP frames.  Turns out that
>> this method is not reliable in this context at least, as
>> skb_realloc_headroom() for PTP frames can cause random crashes,
>> mostly in subsequent skb_*() calls, when multiple concurrent
>> TCP streams are run at the same time with the PTP flow
>> on the same device (as seen in James' report).  I also noticed
>> that when the system is loaded by sending multiple TCP streams,
>> the driver receives cloned skbs in large numbers.
>> skb_cow_head() instead proves to be stable in this scenario,
>> and not only handles cloned skbs too but it's also more efficient
>> and widely used in other drivers.
>> The commit introducing skb_realloc_headroom in the driver
>> goes back to 2009, commit 93c1285c5d92
>> ("gianfar: reallocate skb when headroom is not enough for fcb").
>> For practical purposes I'm referencing a newer commit (from 2012)
>> that brings the code to its current structure (and fixes the PTP
>> case).
>>
>> Fixes: 9c4886e5e63b ("gianfar: Fix invalid TX frames returned on error queue 
>> when time stamping")
>> Reported-by: James Jurack <james.jur...@ametek.com>
>> Suggested-by: Jakub Kicinski <k...@kernel.org>
>> Signed-off-by: Claudiu Manoil <claudiu.man...@nxp.com>
>> ---
> 
> Still crashes for me:
> 

Given the various skb modifications in its xmit path, I wonder why
gianfar doesn't clear IFF_TX_SKB_SHARING.

Reply via email to