diff mbox series

[v2,net-next,01/10] ionic: minimal work with 0 budget

Message ID 20240208005725.65134-2-shannon.nelson@amd.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series ionic: add XDP support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 1065 this patch: 1065
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1065 this patch: 1065
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 27 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-09--21-00 (tests: 973)

Commit Message

Nelson, Shannon Feb. 8, 2024, 12:57 a.m. UTC
We should be doing as little as possible besides freeing Tx
space when our napi routines are called with budget of 0, so
jump out before doing anything besides Tx cleaning.

See commit afbed3f74830 ("net/mlx5e: do as little as possible in napi poll when budget is 0")
for more info.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jakub Kicinski Feb. 9, 2024, 10:09 p.m. UTC | #1
On Wed, 7 Feb 2024 16:57:16 -0800 Shannon Nelson wrote:
> We should be doing as little as possible besides freeing Tx
> space when our napi routines are called with budget of 0, so
> jump out before doing anything besides Tx cleaning.
> 
> See commit afbed3f74830 ("net/mlx5e: do as little as possible in napi
> poll when budget is 0") for more info.

Unfortunately to commit you quote proves that this is a real bug which
can crash a non trivial number of machines if kernel printks meet an XDP
workload :( This really should go to net.
Nelson, Shannon Feb. 9, 2024, 11:33 p.m. UTC | #2
On 2/9/2024 2:09 PM, Jakub Kicinski wrote:
> 
> On Wed, 7 Feb 2024 16:57:16 -0800 Shannon Nelson wrote:
>> We should be doing as little as possible besides freeing Tx
>> space when our napi routines are called with budget of 0, so
>> jump out before doing anything besides Tx cleaning.
>>
>> See commit afbed3f74830 ("net/mlx5e: do as little as possible in napi
>> poll when budget is 0") for more info.
> 
> Unfortunately to commit you quote proves that this is a real bug which
> can crash a non trivial number of machines if kernel printks meet an XDP
> workload :( This really should go to net.

Sure - I'll repackage that and send it back out.

sln
diff mbox series

Patch

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
index 54cd96b035d6..6f4776759863 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
@@ -579,6 +579,9 @@  int ionic_tx_napi(struct napi_struct *napi, int budget)
 	work_done = ionic_cq_service(cq, budget,
 				     ionic_tx_service, NULL, NULL);
 
+	if (unlikely(!budget))
+		return budget;
+
 	if (work_done < budget && napi_complete_done(napi, work_done)) {
 		ionic_dim_update(qcq, IONIC_LIF_F_TX_DIM_INTR);
 		flags |= IONIC_INTR_CRED_UNMASK;
@@ -607,6 +610,9 @@  int ionic_rx_napi(struct napi_struct *napi, int budget)
 	u32 work_done = 0;
 	u32 flags = 0;
 
+	if (unlikely(!budget))
+		return budget;
+
 	lif = cq->bound_q->lif;
 	idev = &lif->ionic->idev;
 
@@ -656,6 +662,9 @@  int ionic_txrx_napi(struct napi_struct *napi, int budget)
 	tx_work_done = ionic_cq_service(txcq, IONIC_TX_BUDGET_DEFAULT,
 					ionic_tx_service, NULL, NULL);
 
+	if (unlikely(!budget))
+		return budget;
+
 	rx_work_done = ionic_cq_service(rxcq, budget,
 					ionic_rx_service, NULL, NULL);