From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796214885; b=BHF6vhelLjkaeCCrQIiNKYkj48F7X3xPnePAYhgrS69Ix4o0Bgv1g3tn8/RDYdP7LvR6 O+6RgVIxRcnTtvIApVzxleHFy/I3z66k2BDU95iNHCHoA7t4IGhIbvRmKv0ZY4viUIo73 147ngjLghKxD7D1kcb1wjztR4h6JCsMoCSAlUkrSZClFBO4jCERiZkewsJaTfw7AzvahQ UFHBgkF1KuJjSpmZF6L0h1ekWgL0caPbXnC96cS72675q8MTuWI3KksLN6TauKj2R3s60 gt0rbLya/yqS/lSMYsxC/LqZXzASOs1NNcIULJj6nVG+Z6wTuluX97oZMyt5YGqkTaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796214885; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject: To:Cc:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=MnI+bceRTlwd1ocFXz8KRdn/h2TafD2T9xzzU/UQjec=; b=kMgFX1k90lm155EW6suidz/CXYYse+yS3fmisFwgDAbvgIbDuRzj/nLB2Ds26LYQo/vY X5ZCfO17lLW0YKOMS6sFCZ/KnZTh2qgg1VlWun/8WImR+zxSCsgugwRCvI2eByZwb0CTN crMsJQKJh9NBcrAZ84CMfazpP9hLQQinK6ENSynz0XYFeTgVjfvzlvrCnJGCVTOfBz/NY n9pmjPEUgGdRcIE50zZCYk2n+q76r8UbZ5CcSKgyYcEO9REIKhP7lViTN4jb2E+1dxD1u dthHgw3SwtS247khPEL2zM0BvHHAGNed3YM7zt8v/goY5t3w9c8NzqrIcjKJcOcGKMQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b="Q+YYyj/x"; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=GgmrujHw; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14FCC606A336 for ; Wed, 2 Dec 2026 12:34:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 14FCC606A336 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Q+YYyj/x; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=GgmrujHw DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796214885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MnI+bceRTlwd1ocFXz8KRdn/h2TafD2T9xzzU/UQjec=; b=Q+YYyj/xvc1ki81VRFS9Mmq2LrDM5DW/AqKGXLY66uQTB/dzujfqSHNGbgknEgCvAinIFO a/eoudRZULlAisI7QImGWkfs3UHk4HXZH/lEEZ0U4JRt/pBGyupa7qaUouQR9mUWUnjli0 ZKdY2VKQ4UbJS8Kjc7giQLkCNPYJIFs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-NDhH7RPiN6yfhGrJv7cb0A-1; Wed, 2 Dec 2026 12:34:41 +0000 X-MC-Unique: NDhH7RPiN6yfhGrJv7cb0A-1 X-Mimecast-MFC-AGG-ID: NDhH7RPiN6yfhGrJv7cb0A_1796214881 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4a204ac318aso62052365e9.2 for ; Wed, 02 Dec 2026 04:34:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796214880; x=1796819680; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MnI+bceRTlwd1ocFXz8KRdn/h2TafD2T9xzzU/UQjec=; b=GgmrujHwYY3Fn8QzTqTPOM0kTSf8FMM9exjhuWd5aCx3Nv8p6SqxSyyw69esZqAptw PJAF7R+DgOYfGoMtZkhVUtZwCluphGNmKKbLOuIx7d6pwTrj2l63pCdltbtKXxipEDRw qFTlHI7qemqbZUhoSkNe+z5dguv6HrA8N1pUaaKlCFTeydno0XYDoi7Qmk0PoJjUcxll mu6b9V1N+UMYTYt1HMbfSXfme46g78WBtCtTQ3uSHIZsKKnsAY+UJ3titytbB8dpuiVI yzHXMTQfnjoFsaQpeXoVx9u10XMCeF9UDbIjQp7xewUSPj5ritD6Vem5TaZxPEabfka3 gkOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796214880; x=1796819680; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MnI+bceRTlwd1ocFXz8KRdn/h2TafD2T9xzzU/UQjec=; b=oBCMmtsGXsHt6Vyk7hF5sYaNMpFIp6v9JUVWeCY2X0l9q558Li9zn8Ye7SuSRI1EqG vwmSL7+hrXmJfMsKNo/Mh1sOQ1SyuqFpONLXLAicV8JOGE/0b/WK7riHo65bi6zYASoB l5byBmsXK2z31Scj5dzNZn71QEqWOG6lzwl41jlYPYQmteOxHiQXyaAZVoiYhaTUgyco 9xYOEZiiSxFElHWbo8leUudWByVwn5rI1SCLtuX164Hq9g+uGLqk5NZ6xf9m8TaCM5ar Xjoza627iLJCuxy6LKHc9VvoK2NUnBrRpHvWp6eGiyJj8u2NVfEagyiyxl/wqNf9zW95 aB4A== X-Forwarded-Encrypted: i=1; AL+hErE60ln+e2sZgW2ooOKPpOhw+n3kHtWQaMe/O2lEkEly2PczRvI7MQ5HV1gY7+qUf5UJG/Erxv4=@vger.kernel.org X-Gm-Message-State: APuU4Z+txiHYNJqiFvxt8Io3e3M5upoMqtmXLsYr6wx104yMbZGymnLU NmHVG4yOZRrNu+TFAUGFReAkTF0h86f2xOuhb6pj1BsvxP5IApOeZ5MTa25HEVQDnBMDwURKmlQ ucKpr7Icn9asMAKu+skGfZt7ogxKnkyespHPnbCUD5BisZZLVFtiw5bWD8gPbsmNhiQ== X-Gm-Gg: AZFdTZfCORuHIJbVDCAH8Pe1nV7Sfkh2cD6TsbBuLh6RtrJN7rX3MVzMmKB+9e+5sBi 0D1DNkS+enOlkyy3C8AiGi02Huz0SZsIDxXvc2FP25ZY2H9WJqU7JrdhZEIaEZK+eoIJqIAHvtO sfXLCdCPiNzZIQhP8srahYcM9d3KOTAo9+uWRnfWo9stblBpZ1cdOYv8LyDJV/j9pq37rQ5urai jApWacLubLJpUQHtX1q+VJdfBG4zCTrOpO44AGR89IPROv9JUm4Nx30SkJYx8O2Ih8H3nqpFitd dkc+NLm98qcxVd5q1CJisBSJXjihz0go+wEcjGqx6IrOgqrgAQUczSSDi/2knNwwj+Yr2BidymU pLxRh3jUUFr0Q/hpXmaXi241lELzpg2plwJq+0bbLVQvDyM8qWO+gfVCQ9+/EbYy08b02wqKviA XdEGjjI2N9nM4pqiKcMj0touxNyKLvqpevNEi9ZxBa420= X-Received: by 2002:a05:600c:674b:b0:4bb:6947:3e1d with SMTP id 5b1f17b1804b1-4bb8892c0fcmr692295265e9.20.1796214880654; Wed, 02 Dec 2026 04:34:40 -0800 (PST) X-Received: by 2002:a05:600c:674b:b0:4bb:6947:3e1d with SMTP id 5b1f17b1804b1-4bb8892c0fcmr692294815e9.20.1796214880217; Wed, 02 Dec 2026 04:34:40 -0800 (PST) Received: from [192.168.88.30] (ip231-128-192-82.pool-bba.aruba.it. [82.192.128.231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb905f1489sm757707695e9.0.2026.12.02.04.34.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 04:34:39 -0800 (PST) Message-ID: Date: Wed, 2 Dec 2026 13:34:38 +0100 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] octeontx2-pf: QOS: Don't free SQ memory if disabling the SQ fails 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 References: <20261124190046.415260-2-oss.patchbox@gmail.com> <179567645260.3135.1714589619526936893@kernel.org> Content-Language: en-US From: Paolo Abeni In-Reply-To: <179567645260.3135.1714589619526936893@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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