mbox series

[v5,0/4] Memory corruption due to HW rings allocation

Message ID 20200623134215.31092-1-Renata.Saiakhova@ekinops.com (mailing list archive)
Headers
Series Memory corruption due to HW rings allocation |

Message

Renata Saiakhova June 23, 2020, 1:42 p.m. UTC
  igb and ixgbe and some other drivers allocate HW rings using
rte_eth_dma_zone_reserve(),
which checks first if the memzone exists for a given name, consisting of port
id, queue_id, rx/tx direction, but not for the size, alignment, and socket_id.
If the memzone with a given name exists it is returned, otherwise it is
allocated.
Disconnecting dpdk port from one type of interface (igb) and connecting it
to another type of interface (ixgbe) for the same port id, potentially creates
memory overlap and corruption, because it may require memzone of bigger size.
That's what is happening from switching from igb to ixgbe having the same port
id.

v4->v5: rte_eth_dma_zone_free() marked as __rte_internal instead of
        __rte_experimental
v3->v4: Improve return code in rte_eth_dma_zone_free() in case mz is not found;
        Release explicitly i40e Flow Director rx/tx rings by calling
        rte_eth_dma_zone_free().
v2->v3: Remove #undef ETH_DMA_MZONE_NAME and minor changes in code standard.
v1->v2: Minor changes on code standard and additional fixes in i40e em and ice
        drivers.

Renata Saiakhova (4):
  ethdev: add function to release HW rings
  drivers/net: fix in igb and ixgbe HW rings memory
  drivers/net: fix in i40e HW rings memory overlap
  drivers/net: fix in em and ice HW rings memory overlap

 drivers/net/e1000/em_rxtx.c              |  2 ++
 drivers/net/e1000/igb_rxtx.c             |  2 ++
 drivers/net/i40e/i40e_fdir.c             |  3 +++
 drivers/net/i40e/i40e_rxtx.c             |  2 ++
 drivers/net/ice/ice_rxtx.c               |  2 ++
 drivers/net/ixgbe/ixgbe_rxtx.c           |  2 ++
 lib/librte_ethdev/rte_ethdev.c           | 30 ++++++++++++++++++++++--
 lib/librte_ethdev/rte_ethdev_driver.h    | 17 ++++++++++++++
 lib/librte_ethdev/rte_ethdev_version.map |  7 ++++++
 9 files changed, 65 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit June 23, 2020, 1:53 p.m. UTC | #1
On 6/23/2020 2:42 PM, Renata Saiakhova wrote:
> igb and ixgbe and some other drivers allocate HW rings using
> rte_eth_dma_zone_reserve(),
> which checks first if the memzone exists for a given name, consisting of port
> id, queue_id, rx/tx direction, but not for the size, alignment, and socket_id.
> If the memzone with a given name exists it is returned, otherwise it is
> allocated.
> Disconnecting dpdk port from one type of interface (igb) and connecting it
> to another type of interface (ixgbe) for the same port id, potentially creates
> memory overlap and corruption, because it may require memzone of bigger size.
> That's what is happening from switching from igb to ixgbe having the same port
> id.
> 
> v4->v5: rte_eth_dma_zone_free() marked as __rte_internal instead of
>         __rte_experimental
> v3->v4: Improve return code in rte_eth_dma_zone_free() in case mz is not found;
>         Release explicitly i40e Flow Director rx/tx rings by calling
>         rte_eth_dma_zone_free().
> v2->v3: Remove #undef ETH_DMA_MZONE_NAME and minor changes in code standard.
> v1->v2: Minor changes on code standard and additional fixes in i40e em and ice
>         drivers.
> 
> Renata Saiakhova (4):
>   ethdev: add function to release HW rings
>   drivers/net: fix in igb and ixgbe HW rings memory
>   drivers/net: fix in i40e HW rings memory overlap
>   drivers/net: fix in em and ice HW rings memory overlap

I think good to keep driver patches separate to help the review and acks, but we
can squash them into single patch while merging.