Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: netdev-bot+sashiko@kernel.org, oss.patchbox@gmail.com
Cc: sgoutham@marvell.com, gakula@marvell.com, rkannoth@marvell.com,
	sbhatta@marvell.com, bbhushan2@marvell.com, hkelam@marvell.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, horms@kernel.org, jacob.e.keller@intel.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH net] octeontx2-pf: QOS: Don't free SQ memory if disabling the SQ fails
Date: Wed, 2 Dec 2026 13:34:38 +0100	[thread overview]
Message-ID: <a968219a-c886-420d-b03e-7dc8e106f803@redhat.com> (raw)
In-Reply-To: <179567645260.3135.1714589619526936893@kernel.org>

On 11/26/26 08:00, 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 (1) · 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] If otx2_qos_ctx_disable() fails, the new early return in
>    otx2_qos_disable_sq() (qos_sq.c:316-322) leaves all the queue state in…
> - [Low] The commit message says otx2_free_hw_resources() frees the kept
>    memory 'after the SQ and NPA contexts of the whole LF have been…
> 
> Pre-existing issues:
> - [High] This problem wasn't introduced by this patch, but
>    otx2_qos_sq_free_sqbs() (qos_sq.c:116-148), called on every successful…
> 
> --
> 
> octeontx2-pf: QOS: Don't free SQ memory if disabling the SQ fails
> 
> This patch makes otx2_qos_disable_sq() check the return value of
> otx2_qos_ctx_disable(). If the AF mailbox request fails, it now logs an
> error and returns without freeing the SQBs, the pool stack and the aura
> flow-control buffer, which the hardware may still reference.
> 
>> If the disable fails, log an error and keep the memory: leaking it is
>> safer than freeing memory the hardware may still access. If the queue
>> is not set up again, otx2_free_hw_resources() frees it later with the
>> other queues when the interface goes down, after the SQ and NPA
>> contexts of the whole LF have been disabled.
> 
> [Severity: Low]
> Is this ordering accurate? otx2_free_hw_resources() calls
> otx2_free_sq_res(). That function frees the SQB pages of every queue,
> QoS queues included, right after a best-effort SQ disable:
> 
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:otx2_free_sq_res() {
>      ...
> 	/* Disable SQs */
> 	otx2_ctx_disable(&pf->mbox, NIX_AQ_CTYPE_SQ, false);
> 	/* Free SQB pointers */
> 	otx2_sq_free_sqbs(pf);
>      ...
> }
> 
> otx2_ctx_disable() returns void and only logs a mailbox failure. The NPA
> pool and aura contexts are disabled later, in otx2_free_hw_resources():
> 
> 	/* Disable NPA Pool and Aura hw context */
> 	otx2_ctx_disable(mbox, NPA_AQ_CTYPE_POOL, true);
> 	otx2_ctx_disable(mbox, NPA_AQ_CTYPE_AURA, true);
> 	otx2_aura_pool_free(pf);
> 
> So the SQB pages are freed before the NPA contexts are disabled. Only
> pool->stack and pool->fc_addr are freed after that. If the AF mailbox is
> still broken at ifdown, the memory kept by this patch gets freed anyway,
> with no check of the result.
> 
> Could the commit message be reworded to match this?
> 
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c
>> index 683efce519af0..e9ca884cfb4d5 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c
> 
> [ ... ]
> 
>> @@ -311,8 +311,16 @@ void otx2_qos_disable_sq(struct otx2_nic *pfvf, int qidx)
>>   	otx2_cleanup_tx_cqes(pfvf, cq);
>>   
>>   	mutex_lock(&pfvf->mbox.lock);
>> -	otx2_qos_ctx_disable(pfvf, sq_idx, pool_id);
>> +	err = otx2_qos_ctx_disable(pfvf, sq_idx, pool_id);
>>   	mutex_unlock(&pfvf->mbox.lock);
>> +	if (err) {
>> +		/* The SQ, aura and pool may still be enabled, so don't free
>> +		 * the memory they point to.
>> +		 */
>> +		netdev_err(pfvf->netdev,
>> +			   "Failed to disable QoS SQ %d (%d)\n", sq_idx, err);
>> +		return;
>> +	}
> 
> [Severity: Medium]
> otx2_qos_disable_sq() still returns void, so callers can't tell that the
> disable failed. When the same qid is set up again right afterwards, are
> the kept SQB pages and queue buffers leaked?

This looks relevant. Please address it in the next iteration.

/P

      reply	other threads:[~2026-12-02 12:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 19:00 [PATCH net] octeontx2-pf: QOS: Don't free SQ memory if disabling the SQ fails Yuho Choi
2026-11-24 19:02 ` netdev-bot+sinfo
2026-11-26  2:11 ` Ratheesh Kannoth
2026-11-26  7:00 ` netdev-bot+sashiko
2026-12-02 12:34   ` Paolo Abeni [this message]

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=a968219a-c886-420d-b03e-7dc8e106f803@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bbhushan2@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oss.patchbox@gmail.com \
    --cc=rkannoth@marvell.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.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