From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F5C226B098; Thu, 3 Apr 2025 19:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743707188; cv=none; b=haCvsLxG8ipo2CG4cvKwBY5E19gcohed1UeR5/2uGN55ys92iTHmB1VIc0RdyDsfWItLdTa25BGHY4TQiXkMQJTlkiYQIIGtOAOIsKcZep4r06KxsGp28OBwivoo2vsCYSgqxvYcerl3AMSYWBpLn5KJOPqB/o91N+mzMquQafw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743707188; c=relaxed/simple; bh=AlMhY7Ff80oUbhp+LnDAY2StSfaQ3MlOZ9U1sDD1tYc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KuWo6AGC0NZuLSXeAJMjFnHmDJ535y4zp4OrJF5r8z2P4AETXX/igeywMkSKXqG/W6GPz4/bZnSZ1OoBLDHWI3lmWes1f3HJRk+4oe4ID+UkhnA4Vmju7iCFb8E8j+fcRfE2MKEz4ZbnjiV4gdpgbVP504r9NXcrxeeUYhG5NuY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HFxasqeX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HFxasqeX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00CA3C4CEE8; Thu, 3 Apr 2025 19:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743707188; bh=AlMhY7Ff80oUbhp+LnDAY2StSfaQ3MlOZ9U1sDD1tYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HFxasqeX3eIvBwW7TBODItYzhaQbNi9jadMRXd9sPeVn2/okNH5VFT5lNRatISmae sSOVZbcN8fmpEYbZdTsqXbIXofRl643UGIDpOMGDI8IHizua+Ws0WV1IURtzAoBbZJ EX7YtXE9jJ9fJMHD5XYDAXUCC4G7nGJF0c5qyJLm8jVuRE2oWpNDE7jBYNwuPjpgqu zzZlBgrD3U3ej6Ej5fHbhyOHJFOltCi2dDt3gycTDSKb7UeH1mG819Vogteu3xqjF2 AmMdy86/nxsk/h8mlFo9ee1pbIxvDyy0YopyR5AWXEGDhOPLbJ4VlQB/T/Stci6PIA 6xgSdza+HBlWA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jason Xing , Mina Almasry , Paolo Abeni , Sasha Levin , hawk@kernel.org, ilias.apalodimas@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.12 14/47] page_pool: avoid infinite loop to schedule delayed worker Date: Thu, 3 Apr 2025 15:05:22 -0400 Message-Id: <20250403190555.2677001-14-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250403190555.2677001-1-sashal@kernel.org> References: <20250403190555.2677001-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.12.21 Content-Transfer-Encoding: 8bit From: Jason Xing [ Upstream commit 43130d02baa137033c25297aaae95fd0edc41654 ] We noticed the kworker in page_pool_release_retry() was waken up repeatedly and infinitely in production because of the buggy driver causing the inflight less than 0 and warning us in page_pool_inflight()[1]. Since the inflight value goes negative, it means we should not expect the whole page_pool to get back to work normally. This patch mitigates the adverse effect by not rescheduling the kworker when detecting the inflight negative in page_pool_release_retry(). [1] [Mon Feb 10 20:36:11 2025] ------------[ cut here ]------------ [Mon Feb 10 20:36:11 2025] Negative(-51446) inflight packet-pages ... [Mon Feb 10 20:36:11 2025] Call Trace: [Mon Feb 10 20:36:11 2025] page_pool_release_retry+0x23/0x70 [Mon Feb 10 20:36:11 2025] process_one_work+0x1b1/0x370 [Mon Feb 10 20:36:11 2025] worker_thread+0x37/0x3a0 [Mon Feb 10 20:36:11 2025] kthread+0x11a/0x140 [Mon Feb 10 20:36:11 2025] ? process_one_work+0x370/0x370 [Mon Feb 10 20:36:11 2025] ? __kthread_cancel_work+0x40/0x40 [Mon Feb 10 20:36:11 2025] ret_from_fork+0x35/0x40 [Mon Feb 10 20:36:11 2025] ---[ end trace ebffe800f33e7e34 ]--- Note: before this patch, the above calltrace would flood the dmesg due to repeated reschedule of release_dw kworker. Signed-off-by: Jason Xing Reviewed-by: Mina Almasry Link: https://patch.msgid.link/20250214064250.85987-1-kerneljasonxing@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/core/page_pool.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index a813d30d21353..7b20f6fcb82c0 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -1066,7 +1066,13 @@ static void page_pool_release_retry(struct work_struct *wq) int inflight; inflight = page_pool_release(pool); - if (!inflight) + /* In rare cases, a driver bug may cause inflight to go negative. + * Don't reschedule release if inflight is 0 or negative. + * - If 0, the page_pool has been destroyed + * - if negative, we will never recover + * in both cases no reschedule is necessary. + */ + if (inflight <= 0) return; /* Periodic warning for page pools the user can't see */ -- 2.39.5