From nobody Mon Oct 6 08:27:59 2025 Received: from mail-m15593.qiye.163.com (mail-m15593.qiye.163.com [101.71.155.93]) (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 7BB112E7BCA; Wed, 23 Jul 2025 13:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753276508; cv=none; b=VDuF6YsRimf1iNM30i5WWTJXZM6pNIza23diWEESt1D1xOU/Zr0cNA/MPHw3kmv0bMhYS2GDhGSBXgxHqySHsGxXsRgaJYDWOVoztkI/oARq5h+9W6Vo/voslMLvegO9qpCFehkvkmojYMkfSyr7I23n0XixN+yd6sMeelBTHwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753276508; c=relaxed/simple; bh=KpTG27xj119EH8QPiH6w84Q+rjHasCFnEYYnEixwibU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=rRLuMBq7mqetYbSao9zZ3rUGohzfdJNcH2Gb8Nx/4+CYBS7LJLrA2ZKIEs1yqtxa7WLGExom2euReYG8sVmHVqw101+L4RdldsOVjq6cYq96lkyerz3dHe8/CCN/ttBK/I1oNQ4l4edYnrwSTtRKKnRR3qMZJIMHGTn61QVqvAA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gztozed.com; spf=pass smtp.mailfrom=gztozed.com; dkim=pass (1024-bit key) header.d=gztozed.com header.i=@gztozed.com header.b=AYXMEE22; arc=none smtp.client-ip=101.71.155.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gztozed.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gztozed.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=gztozed.com header.i=@gztozed.com header.b="AYXMEE22" Received: from localhost.localdomain (unknown [IPV6:240e:6b0:200:4::42]) by smtp.qiye.163.com (Hmail) with ESMTP id d845d995; Wed, 23 Jul 2025 16:38:55 +0800 (GMT+08:00) From: wangyongyong@gztozed.com To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, wangyongyong Subject: [PATCH] net: clear offline CPU backlog.state in dev_cpu_dead() Date: Wed, 23 Jul 2025 16:38:08 +0800 Message-Id: <20250723083808.1220363-1-wangyongyong@gztozed.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJQjdXWS1ZQUlXWQ8JGhUIEh9ZQVkaQhoYVklCHklMS0tNSB9NS1YVFAkWGhdVGRETFh oSFyQUDg9ZV1kYEgtZQVlJT0seQU0ZS0FJS0tBT0FBT0lZV1kWGg8SFR0UWUFZS1VLVUtVS1kG X-HM-Tid: 0a98366f86a30230kunmbbad5f211f61de X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NQg6NAw5CTdILT1WHEs2LEIS MyoaFAhVSlVKTE5ISU5CQkhNQ09JVTMWGhIXVQwaFRwCFBUcAhQVHDscAQ8UAR4fVRgUFkVZV1kS C1lBWUlPSx5BTRlLQUlLS0FPQUFPSVlXWQgBWUFKQ0NDNwY+ DKIM-Signature: a=rsa-sha256; b=AYXMEE22DZ9ZBdaZAEiAM1TbkVL0cu0sG/qV2u2lK5AETvhLAS6AgcFscu6APxea5fQ8rOQpi3rmxj3DHHJkSAdzjUbyDkGUVGg/bbOglRruv9E1uYIXPAwYG/mKR9qNL4Q0fL5AnZRVuQbhXTfEzs2K2kObwJiOdFMC5uehEFI=; s=default; c=relaxed/relaxed; d=gztozed.com; v=1; bh=0afn1/VAo7T4OfiA7X9buT9b9SNPrb22VYySrI//Ito=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" From: wangyongyong When a packet is enqueued to a remote CPU's backlog queue via enqueue_to_ba= cklog(), the following race condition can occur with CPU hotplug: 1. Source CPU sets NAPI_STATE_SCHED on target CPU's softnet_data->backlog.s= tate 2. Source CPU raises NET_RX_SOFTIRQ to schedule NAPI polling 3. Target CPU is taken offline before the IPI arrives 4. dev_cpu_dead() fails to clear NAPI_STATE_SCHED because backlog isn't in = poll_list This results in: - Stale NAPI_STATE_SCHED flag on offline CPU's backlog.state - When the target CPU comes back online, the persistent NAPI_STATE_SCHED fl= ag prevents the backlog from being properly added to poll_list, causing pack= et processing stalls Signed-off-by: wangyongyong --- net/core/dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/dev.c b/net/core/dev.c index be97c440ecd5..fd92ab79c02a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -12385,6 +12385,7 @@ static int dev_cpu_dead(unsigned int oldcpu) else ____napi_schedule(sd, napi); } + oldsd->backlog.state &=3D NAPIF_STATE_THREADED; =20 raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); --=20 2.25.1