From: netdev-bot+sashiko@kernel.org
To: weh@linux.microsoft.com
Cc: longli@kernel.org, kotaranov@microsoft.com, kuba@kernel.org,
davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
andrew+netdev@lunn.ch, jgg@ziepe.ca, leon@kernel.org,
haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
shradhagupta@linux.microsoft.com, horms@kernel.org,
ernis@linux.microsoft.com, stephen@networkplumber.org,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
gargaditya@linux.microsoft.com, kees+treewide@kernel.org,
kees@kernel.org, mawasthi@linux.microsoft.com, weh@microsoft.com,
edumazet@kernel.org, shacharr@microsoft.com
Subject: Re: [PATCH net-next v11 4/4] net: mana: add dynamic HWC queue depth with reinit path
Date: Sat, 21 Nov 2026 16:29:34 +0000 [thread overview]
Message-ID: <179527857414.3135.3409829551491930106@kernel.org> (raw)
In-Reply-To: <100c6b7a71e86c8d7afd0c55f6b231f01db184d5.1794751992.git.weh@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · 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] The only defect fix in this commit is the HWC doorbell
validation and MMIO suppression: mana_gd_is_valid_doorbell(), the…
- [Medium] The rebuilt HWC gives the PF rings much larger than the
bootstrap rings, but ESTABLISH_HWC carries no size information.
- [Medium] mana_hwc_finish_channel() maps the PF's
HWC_INIT_DATA_MAX_REQUEST report to the VF receive direction…
- [Low] mana_hwc_rebuild_channel() saves `timeout_ms =
mana_hwc_timeout_read(hwc)` on entry.
--
net: mana: add dynamic HWC queue depth with reinit path
The HWC starts on depth-one bootstrap queues. This commit rebuilds it at
the depth the PF reports (2 through 128), falling back to fresh bootstrap
queues if the rebuild fails. It also applies the PF-reported message sizes
as admission limits shared with the GDMA and RDMA request builders. It
validates the device-supplied HWC doorbell index against BAR0 and skips
doorbell MMIO while the doorbell is invalid.
Link: https://lore.kernel.org/r/20260908035201.402424-5-longli@microsoft.com
Link: https://lore.kernel.org/r/179196575846.434549.7933818740976196422@kernel.org
Link: https://lore.kernel.org/r/179455240227.2199510.2666165032389090040@kernel.org
> and suppress MMIO while it is invalid. The original driver accepted an
> unchecked device-supplied index in its MMIO address calculation; this also
> fixes that existing out-of-bounds MMIO path. Backports need the complete
> ownership and validation dependencies, not the entire feature stack by
> default.
[ ... ]
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
[Severity: Medium]
Should this be split into two patches?
As far as I can tell, the only defect fix here is the HWC doorbell
validation:
- mana_gd_is_valid_doorbell()
- the GDMA_EQE_HWC_INIT_EQ_ID_DB check in mana_hwc_init_event_handler()
- the INVALID_DOORBELL early return in mana_gd_ring_doorbell()
- invalidating gc->hwc.doorbell before every ESTABLISH_HWC
Everything else is new behaviour:
- the depth rebuild in mana_hwc_prepare_channel() and
mana_hwc_rebuild_channel()
- the new -EMSGSIZE admission check in mana_hwc_get_msg_index()
- the new request budget in mana_gd_create_dma_region() and
mana_ib_gd_create_dma_region()
- power-of-two rounding in mana_hwc_alloc_dma_buf()
- new -EPROTO probe failures from mana_hwc_validate_report() when the
QUEUE_DEPTH, MAX_REQUEST or MAX_RESPONSE report is zero or missing,
even at depth one
Before this patch, mana_hwc_establish_channel() read those reported
values but nothing used them.
With the Fixes: tag on this commit, stable selection could pull the whole
feature into stable kernels, including the new probe failures. The commit
message says the feature stack should not be backported by default.
However, the fix can't be taken on its own while both are in one commit.
Could the doorbell validation go into its own patch with the Fixes: tag,
and the dynamic depth work be sent without one?
> diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c
> index 8c2495ce5f526..cb73d0725206e 100644
> --- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
> +++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
[ ... ]
> @@ -1175,32 +1256,169 @@ void mana_hwc_free_retained_channel(struct gdma_context *gc)
[ ... ]
> +static int mana_hwc_finish_channel(struct hw_channel_context *hwc,
> + const struct mana_hwc_init_report *report)
> +{
> + int err;
> +
> + /* MAX_REQUEST sizes the RQ; MAX_RESPONSE sizes the SQ. */
> + hwc->rx_msg_size_limit = report->max_req_msg_size;
> + hwc->tx_msg_size_limit = report->max_resp_msg_size;
[Severity: Medium]
Are these two limits applied in the right directions?
mana_hwc_get_max_req_size() returns:
return min(hwc->tx_msg_size_limit, hwc->max_resp_msg_size);
So the PF's MAX_RESPONSE report caps outgoing VF-to-PF requests in
mana_hwc_get_msg_index(), mana_gd_create_dma_region() and
mana_ib_gd_create_dma_region(). MAX_REQUEST caps the response buffers.
Before this patch, mana_gd_create_dma_region() and
mana_ib_gd_create_dma_region() bounded outgoing requests by
hwc->max_req_msg_size.
The comment here seems to follow the stride naming in
mana_hwc_init_queues(), where the RQ is created with
HW_CHANNEL_MAX_REQUEST_SIZE. The old code never used the reported sizes,
so nothing in the tree shows which direction the PF means.
If the PF reports different sizes, the bootstrap channel is kept and
these limits are used:
- MAX_REQUEST=2048 and MAX_RESPONSE=4096 would let the VF send
4096-byte requests the PF said it can't accept.
- MAX_REQUEST=4096 and MAX_RESPONSE=2048 would make CREATE_DMA_REGION
for larger queues fail with -EINVAL, and would shrink the RDMA
ADD_PAGES batches.
Can the PF meaning of MAX_REQUEST and MAX_RESPONSE be confirmed here?
> +
> + err = mana_hwc_test_channel(hwc);
[ ... ]
> +static int mana_hwc_rebuild_channel(struct hw_channel_context *hwc,
> + u16 q_depth,
> + struct mana_hwc_init_report *report)
> +{
> + u32 timeout_ms = mana_hwc_timeout_read(hwc);
> + int cleanup_err;
> + int err;
> +
> + err = mana_hwc_teardown_queues(hwc);
> + if (err)
> + return err;
> +
> + err = mana_hwc_build_channel(hwc, q_depth, report);
[Severity: Medium]
Does the PF know that the rebuilt rings are larger than the bootstrap
rings?
mana_smc_setup_hwc_locked() packs only these into the 256-bit aperture,
with no size fields:
- four page frame numbers (EQ, CQ, RQ, SQ)
- the EQ MSI-X index
- the protocol header
The ring sizes grow with q_depth (mana_hwc_init_queues() passes
q_depth * 2 for the CQ):
mana_hwc_create_cq():
cq_size = roundup_pow_of_two(GDMA_CQE_SIZE * q_depth);
mana_hwc_create_wq():
if (q_type == GDMA_RQ)
queue_size = roundup_pow_of_two(GDMA_MAX_RQE_SIZE * q_depth);
else
queue_size = roundup_pow_of_two(GDMA_MAX_SQE_SIZE * q_depth);
At depth 128 that gives a 16 KiB CQ, a 32 KiB RQ and a 64 KiB SQ. Every
bootstrap ring is 4 KiB.
The same ESTABLISH_HWC message, with no sizes, is used three times: for
the bootstrap, the rebuild, and the restored bootstrap.
Existing kernels have run long-lived traffic on 4 KiB bootstrap rings
while the PF reported a larger QUEUE_DEPTH. So the PF must already work
with 4 KiB rings.
If the PF keeps that geometry, would it disagree with the rebuilt rings
after the first wrap?
If the PF does change geometry on the rebuild, could the restore path in
mana_hwc_restore_bootstrap() let the device write EQEs or CQEs past the
4 KiB coherent allocations?
mana_hwc_test_channel() posts N RX WQEs and raises one EQ test event. No
ring wraps before the channel is published, so the test would not catch
a mismatch.
The commit message says:
the absence of VF size fields in ESTABLISH_HWC does not require
keeping the bootstrap geometry.
Is there a documented PF or firmware contract, or a capability bit, that
backs this up?
> + if (!err)
> + err = mana_hwc_validate_report(hwc, report, q_depth,
> + true, true);
> + if (!err)
> + err = mana_hwc_finish_channel(hwc, report);
> + if (!err)
> + return 0;
> +
> + dev_warn(hwc->dev,
> + "HWC depth %u rebuild failed, restoring bootstrap: %d\n",
> + q_depth, err);
> +
> + cleanup_err = mana_hwc_teardown_queues(hwc);
> + if (cleanup_err)
> + return cleanup_err;
> +
> + /* Do not carry the failed test's reduced wait into the retry. */
> + mana_hwc_timeout_update(hwc, timeout_ms);
[Severity: Low]
Can this overwrite a timeout that the PF set during the rebuild?
timeout_ms is saved on entry to mana_hwc_rebuild_channel(). Once the
rebuilt channel is established, its EQ is live with
mana_hwc_init_event_handler() as the callback. A HWC_DATA_CFG_HWC_TIMEOUT
reconfig event arriving then would do:
case HWC_DATA_CFG_HWC_TIMEOUT:
mana_hwc_timeout_update(hwc, val);
If the establish validation or mana_hwc_test_channel() then fails, this
unconditional update writes the old saved value over the firmware value.
mana_hwc_timeout_update() only refuses to revive 0. It can't tell the
fail-fast value of 1 set by mana_hwc_timeout_reduce() apart from a
firmware update.
The comment on hwc_timeout in struct hw_channel_context also says:
/* Zero permanently cancels waits for this channel instance. Firmware
* and query updates may replace a live nonzero value; fail-fast may
* only reduce a live value to one millisecond.
*/
A driver-internal restore of an older value isn't one of the writers
listed there.
The effect looks limited, because mana_gd_verify_vf_version() queries
the timeout again later when GDMA_DRV_CAP_FLAG_1_HWC_TIMEOUT_RECONFIG is
set.
> +
> + return mana_hwc_restore_bootstrap(hwc, report);
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794751992.git.weh%40linux.microsoft.com
next prev parent reply other threads:[~2026-11-21 16:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 16:00 [PATCH net-next v11 0/4] net: mana: concurrent HWC requests and dynamic queue depth Wei Hu
2026-11-17 16:00 ` [PATCH net-next v11 1/4] net: mana: prepare HWC ownership for safe reinitialization Wei Hu
2026-11-21 16:29 ` netdev-bot+sashiko
2026-11-17 16:00 ` [PATCH net-next v11 2/4] net: mana: give each HWC message slot its own completion state Wei Hu
2026-11-21 16:29 ` netdev-bot+sashiko
2026-11-17 16:01 ` [PATCH net-next v11 3/4] net: mana: support concurrent HWC requests Wei Hu
2026-11-17 18:07 ` Leon Romanovsky
2026-11-21 16:29 ` netdev-bot+sashiko
2026-11-17 16:01 ` [PATCH net-next v11 4/4] net: mana: add dynamic HWC queue depth with reinit path Wei Hu
2026-11-17 18:09 ` Leon Romanovsky
2026-11-21 16:29 ` netdev-bot+sashiko [this message]
2026-11-17 16:03 ` [PATCH net-next v11 0/4] net: mana: concurrent HWC requests and dynamic queue depth netdev-bot+sinfo
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=179527857414.3135.3409829551491930106@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=edumazet@kernel.org \
--cc=ernis@linux.microsoft.com \
--cc=gargaditya@linux.microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=horms@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kees+treewide@kernel.org \
--cc=kees@kernel.org \
--cc=kotaranov@microsoft.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@kernel.org \
--cc=mawasthi@linux.microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shacharr@microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=stephen@networkplumber.org \
--cc=weh@linux.microsoft.com \
--cc=weh@microsoft.com \
--cc=wei.liu@kernel.org \
/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