From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45F5631986C for ; Sat, 15 Aug 2026 01:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786756113; cv=none; b=XXmDQyl3aNcAOJG4JhnY6CMtAa6vi/ePC2PovptiOU91L6uMxvv5FwGotNokqcKTgFJC3e3xYxRZcRJMNKABIUE0Rgjg3WFCsQVZ6UvQMHicGRz9EHrJbFnnGiGy/TuhWFW/bQ0Wy95VDo0iO7Oi+92OevIlJJEyEsCPs3RhtNs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786756113; c=relaxed/simple; bh=2kTLjAyAaBeF3tIJ3J75poWZGpgQ8cUkBPsm7La4pXI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=KFgiatXOKxfr76Yo8nSFff6oZFTpZemXUyC0En4eku3Qp2FwLbVyZ8k+fIoi06Wn4gl8nNRSZYlcd4I3avGUXblTaJxVvrv+cCRmw3YiQf3WSz0kMNLLH1/qpgxQBy1sWkXyn2r7pSzICKbMNr9RjE+mJb8XDJV1Dlv9Z1CsFA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UYmPfMck; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UYmPfMck" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-7eb787dec99so1114829a34.0 for ; Fri, 14 Aug 2026 18:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786756111; x=1787360911; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=BUYEVZhB6IjzU8iIkm7Fy+3Re1KgS2KX1bdxTPKKy6E=; b=UYmPfMcksN4rTEyb8RHp5zp3Aa7PoL6VKbQv8RLSG4i2Ij/lM5JcJ7hed4Ldgq6yEN dgw4swbtimYe3BXTb7z50bSrIy1HytyR8SsDPUuuIMDeS+gjixQlXyt1RYphotNYghen ZesOtHMIJnhmdROHsWQPjkTgxappc52goVB08p83P7cskzQ7BvwjhLaiCWEUX0pQp3ah d1lINL4PUhJAle2driELYKmLJflhAQQmPn0SQrb2EpOLqM0vNcS5x801uXq1yht+Wn9a njAH8Ua+msDIxfW9LJ5x91W6Nxx2POca1LgHQXVEysqN5fMppL7G4oqpK1pd1UCMCqTx mlpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786756111; x=1787360911; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=BUYEVZhB6IjzU8iIkm7Fy+3Re1KgS2KX1bdxTPKKy6E=; b=MS+8SYtkt1dlflxv6DkJ1ql0izHEkI/yM7I7QkrEgGOwF4p621jnz4nzfen5YDUZoi Cou1vg+DVgMjg01yd3qN2a+OzzYDkAuLr5QP5n9awWb5NlmXQzien8Mua3Z7aQZgWoid NiL9EJvRkChTQ/oxp8dg7Dfx4H7+Rw7//QQaO3y6xBQX3ZrmlDsxvNb6NM75LaA8b5h5 VkFyVEAQEdbW5ZGxxj++HryNKXPDChHkPig9fpvkBR61x1hJF7RBnSlU4WGJDJnXCDTv /MMZrMNErlYqDWlTdERM/moExwhZo4BoiiM9FBOmaciAjU2nsG4jucBw8XvvKzpKx211 huRQ== X-Forwarded-Encrypted: i=1; AHgh+RoMRvha7sA1s63rLhaP/dzh8h8gQlsfKXjXrR8lHSuA2RKrVev5U2tFutwErY/U5hwt7lqi8Z8R74JsAgs=@vger.kernel.org X-Gm-Message-State: AOJu0YwXHrc0y/lqF0QbQca9J2rgWHwKR2gEUgSnrGrfhMFqJe91GWAV Cie3lfcT0NwcqKCJLdgvLHNqjO9AcVSrJebUYiXXeqhS894+ZCdZvSwL X-Gm-Gg: AR+sD11r6jAorrr8pxydudoeWjWnSz/z/hYsunHB5AkENW+P3ycTVu6rbnqrkO6Hhxw YakbBcKalDN7AVuVZf4DFadlSbf3ki9LBQ14wC0BR0nbl9F22hf26XrwJSFhutJNgzFaFXUwFRq FjSoYSCqsCU55Fvrv1oV0vOXX7P92gUSNGabyJAfi67NPb7TbhZdn3K3jUq742JwO9t9lU9eQ5s KLHkijUYKWuoJFcMHJRtpPW5ADpAbqounxOn//gTe5pOqgZMslytqgAyL/VitW6guXTSl52ITMT t14f0g7YW4AzosPHsQB6DNXC/OE8Bo7ectLvLIX/0Feos+E+BanfhpoznyJzdF/vX41648IIGjo 7wjRmDEs3lMOr9Md69PML5mWzFVDj7KoBCjPi11rjyXUAN4ZCqoGkCasH3v8iklzmSttRYc1Zga joS9Wj/dmTesv0JU+Kp1r0vQ82jGT9aaMEAz9rW/xzlLrife79C0rPu7N1kccKTweS16xMKrnJ7 cgj5JpNBfM6dHxF2HKQHCpuLsmdPWE= X-Received: by 2002:a05:6830:441e:b0:7e9:dd7f:7a83 with SMTP id 46e09a7af769-7f3de1e5583mr8902353a34.0.1786756111121; Fri, 14 Aug 2026 18:08:31 -0700 (PDT) Received: from shiv-machina.. (174-16-201-18.hlrn.qwest.net. [174.16.201.18]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7f3e86282fesm2232153a34.14.2026.08.14.18.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 18:08:30 -0700 (PDT) From: Shivani Gupta To: intel-wired-lan@lists.osuosl.org, Tony Nguyen , Przemek Kitszel Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Jacob Keller , Matthew Vick , Vinicius Costa Gomes , Kurt Kanzenbach , Aleksandr Loktionov Subject: [PATCH iwl-net 0/2] igb: PTP Tx timestamp state fixes Date: Sat, 15 Aug 2026 01:08:25 +0000 Message-Id: <20260815010827.91912-1-shivani07g@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The igb driver keeps a single outstanding Tx hardware timestamp request in adapter->ptp_tx_skb, guarded only by the atomic __IGB_PTP_TX_IN_PROGRESS bit. The fields around it (ptp_tx_skb, ptp_tx_start) are accessed from the transmit path, the retrieval worker, the watchdog and the teardown paths without any common synchronization. Patch 1 ports the fix igc received in commit 9c50e2b150c8 ("igc: Fix race condition in PTP tx code") - which the igc series cover letter already announced as intended for igb - to igb's single-timestamp model: a new ptp_tx_lock protects the timestamp request state and is initialized during software setup, before register_netdev() exposes any consumer. The state bit is removed, and the unsafe cancel_work_sync() calls in the watchdog path (deadlock with the new lock) and the atomic-context transmit error path (sleeping while atomic) are dropped in favor of the worker checking the request state under the lock. igb-specific paths that do not exist in igc (the 82576 polling worker with its timeout branch, and transmit error cleanup that verifies slot ownership) are covered as well. Patch 2 fixes a related lifecycle bug: disabling Tx timestamping with a request outstanding strands the request. On re-enable, all new requests are dropped until the stale one is flagged as a bogus "Tx timestamp hang" by the watchdog up to 15 seconds later. Pending requests are now dropped at disable time. The disabled mode and empty slot are published atomically under the lock introduced by patch 1, so the transmit path cannot admit a replacement request during cleanup (which is why the two patches form one series). Both issues were validated on QEMU's igb (82576) model. The unpatched disable/re-enable blackout reproduces deterministically (recovery only via the 15 s watchdog timeout); the final patches complete 100 cycles without a blackout. A 60-second timestamp stress test with link flaps delivered 6445 of 6469 requests and completed without a KASAN, lockdep, DEBUG_ATOMIC_SLEEP, warning, or panic report. The race window itself is nanoseconds wide and was not directly reproduced; it is identical in structure to the igc bug fixed by 9c50e2b150c8. Note: this series touches the same schedule_work() call sites as Kurt Kanzenbach's pending "[PATCH iwl-next v5] igb: Retrieve Tx timestamp from BH workqueue" (20260305-igb_irq_ts-v5-1-d3b96828ab5b@linutronix.de). The overlap is textual only - that patch changes which workqueue runs ptp_tx_work, this series changes the locking around the request state - and either rebases trivially on the other. Shivani Gupta (2): igb: Fix race condition in PTP tx code igb: Clear pending Tx timestamp requests when disabling Tx timestamping drivers/net/ethernet/intel/igb/igb.h | 3 +- drivers/net/ethernet/intel/igb/igb_main.c | 49 +++++++----- drivers/net/ethernet/intel/igb/igb_ptp.c | 120 ++++++++++++++++++++---------- 3 files changed, 113 insertions(+), 59 deletions(-) base-commit: 24ef02f934eeb48830cff6b739abc3c62b1d107b