From: mingming cao <mmc@linux.ibm.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, nnac123@linux.ibm.com,
maddy@linux.ibm.com, mpe@ellerman.id.au,
linuxppc-dev@lists.ozlabs.org, haren@linux.ibm.com,
ricklind@linux.ibm.com, davemarq@linux.ibm.com,
bjking1@linux.ibm.com, shaik.abdulla1@ibm.com
Subject: Re: [PATCH net-next v5 02/15] ibmveth: Prepare MQ RX adapter data structures
Date: Mon, 31 Aug 2026 11:03:31 -0700 [thread overview]
Message-ID: <5c875704-7dbd-494a-bac7-23ced0470b5e@linux.ibm.com> (raw)
In-Reply-To: <20260818014717.3853945-1-kuba@kernel.org>
On 8/17/26 6:47 PM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> ibmveth: Prepare MQ RX adapter data structures
>
> This converts the single-instance RX state in struct ibmveth_adapter (napi,
> buffer_list_addr/dma, rx_queue, rx_buff_pool) into queue-indexed arrays sized
> by a new IBMVETH_MAX_RX_QUEUES, and adds queue_handle[]/queue_irq[] plus
> multi_queue/num_rx_queues bookkeeping. All existing references are
> mechanically retargeted to index 0, and IBMVETH_MAX_RX_QUEUES is kept at 1 so
> behaviour is unchanged.
>
> No Link: tags are present in the commit header.
>
>> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
>> index 73e051d26b9d8..7cb828b476c1b 100644
>> --- a/drivers/net/ethernet/ibm/ibmveth.c
>> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> [ ... ]
>
>> @@ -482,24 +486,24 @@ static int ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,
>>
>> mb();
>>
>> - atomic_dec(&(adapter->rx_buff_pool[pool].available));
>> + atomic_dec(&adapter->rx_buff_pool[0][pool].available);
>>
>> return 0;
>> }
> [Severity: Low]
> This isn't a bug, but the v5 change notes below the --- separator say the
> "extra atomic_dec parentheses" nit from v4 was dropped, and that "this tip
> patch keeps only the mechanical [0] retargeting".
>
> The atomic_dec() in ibmveth_remove_buffer_from_pool() still drops the
> redundant inner parentheses that the baseline had:
>
> - atomic_dec(&(adapter->rx_buff_pool[pool].available));
> + atomic_dec(&adapter->rx_buff_pool[0][pool].available);
>
> Should the changelog be adjusted, or the parentheses kept as-is so the hunk
> really is index-only?
The hunk is the [0] retarget plus dropping those parentheses. Keeping them
fails checkpatch --strict (Unnecessary parentheses) because the retarget
rewrites the line.
>
> [ ... ]
>
>> @@ -1876,6 +1886,10 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
>> netdev->features |= NETIF_F_FRAGLIST;
>> }
>>
>> + /* Initialize queue count - always 1 for now */
>> + adapter->multi_queue = 0;
>> + adapter->num_rx_queues = IBMVETH_DEFAULT_RX_QUEUES;
>> +
> [Severity: Low]
> At this commit these two assignments in ibmveth_probe() are the only accesses
> to multi_queue and num_rx_queues, and queue_handle[]/queue_irq[] have neither
> a reader nor a writer anywhere in the driver.
>
> Combined with IBMVETH_MAX_RX_QUEUES being 1U, every array conversion in this
> patch is a pure layout change with no behavioural effect.
>
> Is it worth mentioning in the commit message which later patch first consumes
> each of these fields? Reading the rest of the series, queue_irq[] and
> queue_handle[] get their first users in ibmveth_toggle_irq() and
> ibmveth_register_logical_lan_queue(), num_rx_queues is read through
> ibmveth_get_num_rx_queues(), and IBMVETH_MAX_RX_QUEUES becomes 16U in
> "ibmveth: Enable multi-queue RX receive path", so nothing is broken here.
ch of these fields? Reading the rest of the series,
> queue_irq[] and queue_handle[] get their first users in
> ibmveth_toggle_irq() and ibmveth_register_logical_lan_queue(),
> num_rx_queues is read through ibmveth_get_num_rx_queues(), and
> IBMVETH_MAX_RX_QUEUES becomes 16U in "ibmveth: Enable multi-queue RX
> receive path", so nothing is broken here.
Yes. v6 names the first consumer of each field. Three of those are
earlier than the map you sketched:
num_rx_queues RX resource-allocation patch
queue_irq[] IRQ control patch (ibmveth_toggle_irq)
multi_queue IRQ control patch (ibmveth_setup_rx_interrupts)
queue_handle[] register-helpers patch, from
H_REGISTER_LOGICAL_LAN (queue 0), not
H_REG_LOGICAL_LAN_QUEUE
>> if (ret == H_SUCCESS &&
>> (ret_attr & IBMVETH_ILLAN_RX_MULTI_BUFF_SUPPORT)) {
>> adapter->rx_buffers_per_hcall = IBMVETH_MAX_RX_PER_HCALL;
>> @@ -1898,10 +1912,10 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
>> memcpy(pool_count, pool_count_cmo, sizeof(pool_count));
>>
>> for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) {
>> - struct kobject *kobj = &adapter->rx_buff_pool[i].kobj;
>> + struct kobject *kobj = &adapter->rx_buff_pool[0][i].kobj;
>> int error;
>>
>> - ibmveth_init_buffer_pool(&adapter->rx_buff_pool[i], i,
>> + ibmveth_init_buffer_pool(&adapter->rx_buff_pool[0][i], i,
>> pool_count[i], pool_size[i],
>> pool_active[i]);
>> error = kobject_init_and_add(kobj, &ktype_veth_pool,
> [Severity: Low]
> This is a pre-existing issue and is not introduced by this patch, which only
> rewrites rx_buff_pool[i] to rx_buff_pool[0][i] on these lines.
>
> The kobjects registered here live inside netdev_priv() memory, and the probe
> failure paths after this loop call free_netdev() without a matching
> kobject_del()/kobject_put():
>
> rc = register_netdev(netdev);
> if (rc) {
> free_netdev(netdev);
> return rc;
> }
>
> The only teardown loop is in ibmveth_remove():
>
> for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
> kobject_put(&adapter->rx_buff_pool[0][i].kobj);
>
> which a failed probe never reaches, so a netif_set_real_num_tx_queues() or
> register_netdev() failure leaves live .../poolN sysfs directories backed by
> freed storage.
>
> Worth noting this is addressed later in the same series: "ibmveth: Enable
> multi-queue RX receive path" adds ibmveth_probe_cleanup(), which calls
> ibmveth_put_pool_kobjs() before free_netdev() on both probe failure paths.
>
> [ ... ]
Yes. v6 notes that the leak predates this [0] retarget. Inline
kobject_put on register failure starts in the MQ enablement patch;
ibmveth_probe_cleanup() replaces it in the statistics patch.
>> diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
>> index c0ef03cad9b9a..fc6a01e810c6e 100644
>> --- a/drivers/net/ethernet/ibm/ibmveth.h
>> +++ b/drivers/net/ethernet/ibm/ibmveth.h
>> @@ -257,6 +257,8 @@ static inline long h_illan_attributes(unsigned long unit_address,
>> #define IBMVETH_MAX_TX_BUF_SIZE (1024 * 64)
>> #define IBMVETH_MAX_QUEUES 16U
>> #define IBMVETH_DEFAULT_QUEUES 8U
>> +#define IBMVETH_MAX_RX_QUEUES 1U
>> +#define IBMVETH_DEFAULT_RX_QUEUES 1U
>> #define IBMVETH_MAX_RX_PER_HCALL 8U
> [ ... ]
>
>> + struct ibmveth_rx_q rx_queue[IBMVETH_MAX_RX_QUEUES];
>> + u64 queue_handle[IBMVETH_MAX_RX_QUEUES];
>> + unsigned int queue_irq[IBMVETH_MAX_RX_QUEUES];
>> + int multi_queue;
>> + unsigned int num_rx_queues;
> [ ... ]
next prev parent reply other threads:[~2026-08-31 18:03 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 7:36 [PATCH net-next v5 00/15] ibmveth: Add multi-queue RX support Mingming Cao
2026-08-14 7:36 ` [PATCH net-next v5 01/15] ibmveth: Add MQ RX hypercall wrappers and call definitions Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 17:58 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 02/15] ibmveth: Prepare MQ RX adapter data structures Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 18:03 ` mingming cao [this message]
2026-08-14 7:36 ` [PATCH net-next v5 03/15] ibmveth: Refactor RX resource allocation for MQ RX bring-up Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 18:12 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 04/15] ibmveth: Refactor buffer pool management for per-queue MQ RX Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 18:20 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 05/15] ibmveth: Refactor RX interrupt control for MQ RX queues Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 18:24 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 06/15] ibmveth: Refactor TX resource allocation in open/close paths Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 18:46 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 07/15] ibmveth: Add RX queue register helpers for MQ Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 18:54 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 08/15] ibmveth: Add queue-aware RX buffer submit helper " Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:00 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 09/15] ibmveth: Harden RX poll path with helpers Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:06 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 10/15] ibmveth: Enable multi-queue RX receive path Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:10 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 11/15] ibmveth: Add per-queue RX and TX statistics collection Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:12 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 12/15] ibmveth: Report MQ-aware RX counts in ethtool get_channels Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:19 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 13/15] ibmveth: Expose per-queue buffer pool details via debugfs Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:20 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 14/15] ibmveth: Implement incremental MQ RX queue resize Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:22 ` mingming cao
2026-08-14 7:36 ` [PATCH net-next v5 15/15] ibmveth: Wire ethtool set_channels to " Mingming Cao
2026-08-18 1:47 ` Jakub Kicinski
2026-08-31 19:24 ` mingming cao
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=5c875704-7dbd-494a-bac7-23ced0470b5e@linux.ibm.com \
--to=mmc@linux.ibm.com \
--cc=andrew+netdev@lunn.ch \
--cc=bjking1@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=davemarq@linux.ibm.com \
--cc=edumazet@google.com \
--cc=haren@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=nnac123@linux.ibm.com \
--cc=pabeni@redhat.com \
--cc=ricklind@linux.ibm.com \
--cc=shaik.abdulla1@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.