<html>
    <head>
      <base href="https://bugs.dpdk.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - drivers/common/mlx5: mlx5_malloc() called on invalid socket ID when global MR cache is full and rte_extmem_* API is used"
   href="https://bugs.dpdk.org/show_bug.cgi?id=1256">1256</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>drivers/common/mlx5: mlx5_malloc() called on invalid socket ID when global MR cache is full and rte_extmem_* API is used
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DPDK
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>21.11
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>other
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dev@dpdk.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>baciumariuscristian@yahoo.com
          </td>
        </tr>

        <tr>
          <th>Target Milestone</th>
          <td>---
          </td>
        </tr></table>
      <p>
        <div class="bz_comment_block">
          <pre class="bz_comment_text">Overview:
Attempt to allocate a new mlx5 MR entry when global Btree cache is full ends up
calling mlx5_malloc with the EXTERNAL_HEAP_MIN_SOCKET_ID socket ID, given that
no external-memory heap has been created. Instead the rte_extmem_* API is used.

Steps to reproduce:
- start a primary DPDK process, on a NIC compatible with mlx5_core driver;
- use rte_extmem_register() to register >512 pages of 4KB;
- use rte_dev_dma_map() to dma-map each page;
- rte_eth_tx_burst() an mbuf with an external buffer from the last page of the
registered memory (or a page above index 512). (a virtual address that will not
be found in the global Btree cache);

Actual results:
mlx5_malloc in mlx5_mr_create_primary() fails with "Unable to allocate memory
for a new MR". From this point forward, packets never reach the other end.

Expected results:
MR entries should be successfully retrieved from backup or created when cache
becomes full; calling mlx5_malloc() on external heap socket should not be
possible when rte_extmem_* API is used. As it is stated in the DPDK
documentation[1], "Memory added this way will not be available for any regular
DPDK allocators".

Build Date & Hardware:
20 Jun 2023 on Debian GNU/Linux 4.18.0

[1]: <a href="https://doc.dpdk.org/guides-21.11/prog_guide/env_abstraction_layer.html">https://doc.dpdk.org/guides-21.11/prog_guide/env_abstraction_layer.html</a>
          </pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
      <div itemscope itemtype="http://schema.org/EmailMessage">
        <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
          
          <link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1256">
          <meta itemprop="name" content="View bug">
        </div>
        <meta itemprop="description" content="Bugzilla bug update notification">
      </div>
    </body>
</html>