From: mingming cao <mmc@linux.ibm.com>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au,
npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com,
sshegde@linux.ibm.com, nnac123@linux.ibm.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com,
linuxppc-dev@lists.ozlabs.org, horms@kernel.org,
davemarq@linux.ibm.com, haren@linux.ibm.com,
ricklind@linux.ibm.com, bjking1@linux.ibm.com,
shaik.abdulla1@ibm.com
Subject: Re: [PATCH net-next 5/8] ibmveth: Refactor TX resource allocation in open/close paths
Date: Sun, 22 Nov 2026 23:34:46 -0800 [thread overview]
Message-ID: <18121720-661e-4418-8fab-156092188b99@linux.ibm.com> (raw)
In-Reply-To: <179539596966.3135.308887197140765933@kernel.org>
On 11/22/26 5:06 PM, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 1
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] In ibmveth_open() (drivers/net/ethernet/ibm/ibmveth.c), this
> patch moves the TX long-term-buffer DMA mapping…
> - [Low] The commit is titled and framed as a refactor ("Move TX LTB
> allocation and free ... into ibmveth_alloc_tx_resources() and…
>
> --
>
> ibmveth: Refactor TX resource allocation in open/close paths
>
> This moves TX long-term buffer allocation and free into the new helpers
> ibmveth_alloc_tx_resources() and ibmveth_free_tx_resources(). It also
> moves the TX LTB allocation in ibmveth_open() to after RX and NAPI are
> running. To cover that, it adds netif_tx_disable() at the start of open()
> and starts the queues under netif_tx_lock_bh().
>
> [Severity: Medium]
> With the new order, can open() fail on CMO partitions where the old order
> worked?
>
> With FW_FEATURE_CMO, every VIO DMA mapping draws on the device's IO
> entitlement through vio_dma_iommu_map_phys()->vio_cmo_alloc(). That call
> returns -ENOMEM when the free reserve plus the excess pool is smaller than
> the request.
>
> By the time ibmveth_alloc_tx_resources() runs, NAPI is enabled and
> ibmveth_schedule_rx_queue(adapter, 0) has scheduled the first replenish.
> The replenish runs in NET_RX softirq, either in ksoftirqd or at the next
> IRQ exit. It can map and post every RX pool buffer before or while the TX
> LTBs are mapped:
>
> ibmveth_open()
> ibmveth_setup_rx_interrupts()
> ibmveth_schedule_rx_queue()
> __napi_schedule()
> ibmveth_poll()
> ibmveth_replenish_task()
> dma_map_single() <- per RX buffer, uses entitlement
> ibmveth_alloc_tx_resources()
> ibmveth_allocate_tx_ltb()
> dma_map_single() <- can now return DMA_MAPPING_ERROR
>
> The two failures are handled differently. An RX mapping failure in
> ibmveth_replenish_buffer_pool() bumps replenish_add_buff_failure and
> breaks out of the loop.
>
> A TX LTB mapping failure makes ibmveth_alloc_tx_resources() return
> -ENOMEM. open() then tears down the IRQs, the logical LAN registration and
> the RX pools, and the interface does not come up.
>
> The direct close()/open() pairs (change_mtu, pool sysfs, set_csum and
> set_tso) are affected too. There, IFF_UP stays set but the adapter is not
> open.
>
> Before this patch, the TX LTBs were mapped before any RX buffer went to
> PHYP, so TX always got entitlement first.
>
> ibmveth_get_desired_dma() seems to make this more likely:
>
> drivers/net/ethernet/ibm/ibmveth.c:ibmveth_get_desired_dma() {
> ...
> /* add size of mapped tx buffers */
> ret += IOMMU_PAGE_ALIGN(IBMVETH_MAX_TX_BUF_SIZE, tbl);
> ...
> }
>
> This counts one 64K TX buffer, but open() maps one LTB per real TX queue.
> The default is min(num_online_cpus(), 8) queues, so up to 512K. Once RX
> has taken its share, is there any entitlement left for TX?
>
> The order is the same at the end of the series. In "ibmveth: Split RX
> poll into per-slot helpers for MQ", ibmveth_alloc_tx_resources() still
> comes after ibmveth_schedule_rx_queue().
You are right, the reorder isn't needed. v2 maps TX before RX buffers go to
PHYP again.
The get_desired_dma() undercount predates this series; I'll look at it
separately. The other Lows are fixed in v2 as well.
pw-bot: cr
Thanks,
Mingming
>> +
>> + /* Start under the xmit lock so a sender that tests DRV_XOFF
>> + * there sees the LTBs this open just published.
>> + */
>> + netif_tx_lock_bh(netdev);
>> netif_tx_start_all_queues(netdev);
>> + netif_tx_unlock_bh(netdev);
> [ ... ]
>
next prev parent reply other threads:[~2026-11-23 7:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 0:07 [PATCH net-next 0/8] ibmveth: prepare the RX path for multi-queue Mingming Cao
2026-11-19 0:07 ` [PATCH net-next 1/8] ibmveth: Prepare MQ RX adapter data structures Mingming Cao
2026-11-19 0:07 ` [PATCH net-next 2/8] ibmveth: Refactor RX resource allocation for MQ RX bring-up Mingming Cao
2026-11-23 1:06 ` netdev-bot+sashiko
2026-11-19 0:07 ` [PATCH net-next 3/8] ibmveth: Refactor buffer pool management for per-queue MQ RX Mingming Cao
2026-11-19 0:07 ` [PATCH net-next 4/8] ibmveth: Refactor RX interrupt control for MQ RX queues Mingming Cao
2026-11-23 1:06 ` netdev-bot+sashiko
2026-11-19 0:07 ` [PATCH net-next 5/8] ibmveth: Refactor TX resource allocation in open/close paths Mingming Cao
2026-11-23 1:06 ` netdev-bot+sashiko
2026-11-23 7:34 ` mingming cao [this message]
2026-11-19 0:07 ` [PATCH net-next 6/8] ibmveth: Add RX queue register helpers for MQ Mingming Cao
2026-11-23 1:06 ` netdev-bot+sashiko
2026-11-19 0:07 ` [PATCH net-next 7/8] ibmveth: Pass the RX queue index through replenish and poll Mingming Cao
2026-11-23 1:06 ` netdev-bot+sashiko
2026-11-19 0:07 ` [PATCH net-next 8/8] ibmveth: Split RX poll into per-slot helpers for MQ Mingming Cao
2026-11-23 1:06 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18121720-661e-4418-8fab-156092188b99@linux.ibm.com \
--to=mmc@linux.ibm.com \
--cc=andrew+netdev@lunn.ch \
--cc=bjking1@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=davem@davemloft.net \
--cc=davemarq@linux.ibm.com \
--cc=edumazet@kernel.org \
--cc=haren@linux.ibm.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nnac123@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=pabeni@redhat.com \
--cc=ricklind@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=shaik.abdulla1@ibm.com \
--cc=sshegde@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox