From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796284915; b=WI4sIYANiBsr/FaDzTb2dMXd9wnKc7CfGjjxj6AXA0wpJsby6927L7WEJnH5TVH0Kwrr WDR+SMuaXAPnR83htXchd3dvJ1WJKLBWWQofCoACThcDbFct1l1IcVXp3+KsMGlaISlu+ mz5kZBGUVPP8jSVxMJy+PMRVa05DB2QfYTVMm5SCtHk48sDb7iKfl7DgdzXH1ZlhrD+nW E8IexkmTMpEZZTF+qTJnQKffo5bfZutRl5qxZdkCjt+NZQ8TU6/AkynpE3rZIaafh7QTu N76cGuH98C7Kv3ris8X4buSbwAOCkqRiluJlDaj2O+EUp4/2QaUqQ9r11+ogK20pw4g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796284915; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=vBi8/Mx0xtlD5bQ1hSif6l6um898TQw0v4TSrtyV5+A=; b=UIRAZ/l3MLc2vAn01lBucDrU1ZbeQJNe331ewiemLK2Zi50l/IuivGqqS7HHmyTR10Lv Txmb/Qy+HzblBGkCCItmVec+gYb2zaqQ4892Mit6FtGWvifDDuwDYLiJOeCjei6RnV8KI Yp/8B3bkmCs5U5bfwurLMmcY5K0jvfL5jqslr9VOQJxVxoie2c8b7xorpRCiLSn2DnWwC 59gTT9iUWAMrGxYcy7qtK2BcvYkDgt+bM/GSZywZFwQipOwd+utsD47cpKfOyB59Hwad1 h3XkbraXAUWZBIU7BYeRWgv3PYN0LAEMIjupD7g32Qky2lacoHWoSrDrzCGzzmupD9w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c2lyKwJu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D62C4606A322; Thu, 3 Dec 2026 08:01:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c2lyKwJu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BEF41F00893; Thu, 3 Dec 2026 08:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796284915; bh=vBi8/Mx0xtlD5bQ1hSif6l6um898TQw0v4TSrtyV5+A=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=c2lyKwJukTOHLliy6cbufOB9zNTm+K60oEoA8xhTqs0FNA/IBj8jjp1bVpT0/lnNz VH7HPSySxZNeiFPtCg+wZExgKtFc7N3v0TnqF18aYxx9FLkJrIAQvrIXKgo/tz+i8D IDgLN/ZFrNKHl9msptHUG7IFRwD+j0UMdFfUeY0gUrOmSlMeCCeE2DQMTopVnfY+ri Ede+S0wpQmG+09gnILdHVHj1WTdoBCBwoLDItAxsVMO97Ap5KqH4jsg9BhR0pVBS5A T/txqf/wnmVSsjmGQUKGutW20GXgRovK0PYaSFPo/tT+9BT/5r/gPgJAv9khnIx0/t 8AFdtvyaZCr5A== Subject: Re: [PATCH net v7 1/4] ice: stop the service task before the PF is unloaded From: netdev-bot+sashiko@kernel.org To: poros@redhat.com Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, aleksandr.loktionov@intel.com, horms@kernel.org, michal.swiatkowski@linux.intel.com, grzegorz.nitka@intel.com, pmenzel@molgen.mpg.de, wojciech.drewek@intel.com, marcin.szycik@linux.intel.com, martyna.szapar-mudlaw@linux.intel.com, ivecera@redhat.com, alice.michael@intel.com, jacob.e.keller@intel.com, jbrandeb@kernel.org, patryk.holda@intel.com, sx.rinitha@intel.com, aaron.ma@canonical.com, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Date: Thu, 03 Dec 2026 08:01:53 +0000 Message-ID: <179628491355.3146.6554967854382312283@kernel.org> In-Reply-To: <20261202071642.2527605-2-poros@redhat.com> References: <20261202071642.2527605-2-poros@redhat.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The patch fixes a second, older bug in the recovery mode branch of ice_remove() (drivers/net/ethernet/intel/ice/ice_main.c), but the… - [Low] ice: clear_bit(ICE_SERVICE_SCHED) before disable_work_sync() in shutdown -- ice: stop the service task before the PF is unloaded This patch moves the service task stop and the AdminQ waiter cancel in ice_remove() back to right after ice_free_vfs(). It adds ice_service_task_shutdown(), which also calls disable_work_sync() and timer_shutdown_sync() so nothing can re-arm the work or the timer. The recovery mode branch of ice_remove() now uses the same final stop. > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c > index 47c6798c97e8f..b05eda1bf50ae 100644 > --- a/drivers/net/ethernet/intel/ice/ice_main.c > +++ b/drivers/net/ethernet/intel/ice/ice_main.c [ ... ] > @@ -5375,7 +5391,7 @@ static void ice_remove(struct pci_dev *pdev) > } > > if (ice_is_recovery_mode(&pf->hw)) { > - ice_service_task_stop(pf); > + ice_service_task_shutdown(pf); > scoped_guard(devl, priv_to_devlink(pf)) { > ice_deinit_devlink(pf); > } [Severity: Low] This change looks right, but it seems to fix a second, older bug that the Fixes tag doesn't cover. Should this also carry a Fixes tag for 1de25c6b984d ("ice: support FW Recovery Mode")? The recovery mode branch of ice_remove() comes from 1de25c6b984d, and 8a37f9e2ff40 never changed it. Before this patch the branch called ice_service_task_stop() once and returned. That function runs timer_delete_sync() first and cancel_work_sync() second. If ice_service_task_recovery_mode() is running at that moment, it re-arms the timer unconditionally after the delete: ice_service_task_recovery_mode() { ... ice_service_task_complete(pf); mod_timer(&pf->serv_tmr, jiffies + msecs_to_jiffies(100)); } cancel_work_sync() only waits for that run to finish. After that, ice_service_timer() keeps re-arming itself no matter what ICE_SERVICE_DIS says: ice_service_timer() { ... mod_timer(&pf->serv_tmr, round_jiffies(pf->serv_tmr_period + jiffies)); ice_service_task_schedule(pf); } So the timer can still fire after the PF has been freed and the module has been unloaded. The commit message only says "The recovery mode branch of ice_remove() gets the same final stop". Trees that have 1de25c6b984d but not 8a37f9e2ff40 would not see that this fix applies to them. Could the message also say that this path is fixed, and add the extra tag? Fixes: 1de25c6b984d ("ice: support FW Recovery Mode") [ ... ] > @@ -1707,6 +1707,22 @@ static int ice_service_task_stop(struct ice_pf *pf) > return ret; > } > > +/** > + * ice_service_task_shutdown - stop the service task for PF removal > + * @pf: board private structure > + * > + * A caller that passed the ICE_SERVICE_DIS test before the stop can > + * still queue the work after it, and a run in progress can arm the > + * timer after its delete. The PF is going away, so make both > + * permanently dead, nothing restarts them. > + */ > +static void ice_service_task_shutdown(struct ice_pf *pf) > +{ > + ice_service_task_stop(pf); > + disable_work_sync(&pf->serv_task); > + timer_shutdown_sync(&pf->serv_tmr); > +} > + > /** > * ice_service_task_restart - restart service task and schedule works > * @pf: board private structure [Severity: Low] ice_service_task_shutdown() starts with ice_service_task_stop(), and that clears ICE_SERVICE_SCHED right after cancel_work_sync(), before disable_work_sync() has run. That leaves the window this helper is meant to close still open for the SCHED bit. ice_service_task_schedule() tests the bits and queues the work in separate steps: if (!test_bit(ICE_SERVICE_DIS, pf->state) && !test_and_set_bit(ICE_SERVICE_SCHED, pf->state) && !test_bit(ICE_NEEDS_RESTART, pf->state)) queue_work(ice_wq, &pf->serv_task); So this interleaving looks possible: 1. CPU0 in ice_service_task_schedule() passes the ICE_SERVICE_DIS test and sets ICE_SERVICE_SCHED. 2. CPU1 in ice_remove() runs ice_service_task_stop(), which sets ICE_SERVICE_DIS, finds nothing queued in cancel_work_sync() and clears ICE_SERVICE_SCHED. 3. CPU0 calls queue_work(), so pf->serv_task is now pending while ICE_SERVICE_SCHED is clear. 4. A worker starts running it before CPU1 reaches disable_work_sync(), which then waits for that run to finish. ice_service_task() and ice_service_task_recovery_mode() both finish through ice_service_task_complete(), which then hits: WARN_ON(!test_bit(ICE_SERVICE_SCHED, pf->state)); If CPU0 instead does its test_and_set_bit() after the clear, the work is cancelled by disable_work_sync() and ICE_SERVICE_SCHED is left set on a PF that is going away. Neither case is a use-after-free, since disable_work_sync() still drains the run before the VSIs are freed, but rmmod can splat a warning. Would it be cleaner to open code the final stop so the bit is cleared last: set ICE_SERVICE_DIS, timer_shutdown_sync(), disable_work_sync(), and only then clear_bit(ICE_SERVICE_SCHED)? Once the timer is shut down, a run that calls mod_timer() on its way out is a no-op, and once the work is disabled nothing can queue it again. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202071642.2527605-1-poros%40redhat.com