From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 17D9A3375CB for ; Sat, 18 Apr 2026 18:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776536046; cv=none; b=Xjz4dgnp2/lW8Hrfp3U1CUVSe382pyZLi7F7i7ge02FemX/OmmAZvYdKNN5ZIOycMMmDEEC7qWaz4MwZfRucMd6lPouI9CIjQ+3pSwzHVjHZMtRlRnPqzofyPGJ9aTBly6qShYFK5eyKnHgBQ7jaw5JHlMbTA2E+6c5dH4R4d5E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776536046; c=relaxed/simple; bh=7RBn27jm2AVfQcHGM0Run5F5ojS7pQWf7fH3/FxJq4g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZG+RsdsOsgmP89Y5bHlDxp3PU/zIHrSuscM175IWAj/95pBI06Y4D97LkIZLfgk0RznWXCO7bzet9cANZQFLvLLt9NCInKjj3INQ7bRGVmluw2lH1D17W2bxrl4nHiadTHjssEhX2bJY6vhcoFFeije6XBeq34LDcAv5Nn4ATSE= 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=eALkrFDr; arc=none smtp.client-ip=209.85.210.171 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="eALkrFDr" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-82f1bfc9b8fso742517b3a.1 for ; Sat, 18 Apr 2026 11:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776536044; x=1777140844; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kEq5CzQFwtAXQUDE7BtOjkL3C6G38PVDQBhAKTNWHjg=; b=eALkrFDrAHvlzw/c96wLEydh0GLNFhsEgQGrlraVxNIpyhKmp5Fpp1HMnk0KKfOYar JGKusaA17cJdbHEQzA3wK2QiiwwA785o6hIv8Uin/hqLXbTHDa0/0FD5UT0SyAhe+0Af 3dow/EBliWkLfRdZnywsnUiIZ0OTAQokGpUihUdSwzWr4Y/CUM1oWow83us3Y1YwrKRT GFbW8TXEOzob0UOmwmZ67/1+7TecuXQxK6QgNhP5Uw5FjZUURDvdkWQ2w9lExyFYKLgl +oT3DztYSiWmWViHF3+h+khG7RwgCreu7rWrNsD5O4O34b8BRr5y08SBkdbFt1n/dNCb QKVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776536044; x=1777140844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kEq5CzQFwtAXQUDE7BtOjkL3C6G38PVDQBhAKTNWHjg=; b=CaXKoafNf5Lv9BwQKStO+hjnDV0SWGQ8VMW3a3mqH6qb+tp5VBi3O7706fYoqfIiGl +q0Pb5jezJI65Tqt8lDEvQbONnhA5ezs9SOqnfNy9UoXAufxoTq1ggTGW6vSxO8KEFQQ lvJhi04pNmhteY7QD6+hqpx/2B3lHHx27ioiL4qil3GNc4bjfgjTrbJePbgTJYx+L4p7 Bk/AGgapjLXqE4HAvLsntVmlTxvUngoH3ZYD84Y7QRquw43W0Hp5GgZm9kb28wicP+cw SppCUYAlQqk2nmUdl1iAkBSk5gkw43wvb8YYAuW142w3u4RXXSXlVLp3fQqjk7WITLfV dfbg== X-Forwarded-Encrypted: i=1; AFNElJ/NsmhFIZDlojN0VTQqqaELoFJVxf5pVL+aF2nxMGtsKmkxuB1keTDvLD2E3MtkMMFD1aDtBSN7NuSFHR0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2kFh3T/D3hWf7MRA58Yntzxfhwla1uFQLViqQgxEDbu4F5sUf a9iDPK4IxzOOd2v0ndHrqndYYFxsCC3qykVmT7U6x6CeYlhcrb3HJlov X-Gm-Gg: AeBDiesiUZz7xg3SaZs6BxvR4ECzLFCPgPFlqw9HRgFZ/E8YHn9gTA1Ihks8jsbce2/ 9vPwe02X4jpIH6e1eS5ZKcLL6k/arYqY6JikaFG9psSVT8TRl72SLrl/iXYFXYHDdVc3uccRxWb PKvi+ezjFgxZFTlheq7rDo+wvYsgF9/nwa5M1ms6EFH1lxXEdqZLVbvCsElOZI5FvQOszq01gRp fpQC2lu2D/D/0JTFKIEEpfujrCgps+K4wWHLTIJfTUiSpgGEwjDQ7kl+BI5tVhgjdxq3zRf8+MP WawvDnFj0tqUlIWa69dvqqKLxpBlecc8udHocXQ74TL14Db6T4RTOasazf2aL4haCZwY3soWD45 sgG0H0n7N6mE11EGQOk+LHCCzgdDFTwytWr8nKKN2c8Ab0CJL9id7jUax4bWBmUNW552y8fDVvh s1hWmX3pc+Gp4bjwi/suRVr6lVOKiqvgYuFfGBae4nkiKpT6DKO6lBQ4+BWDJCwQ== X-Received: by 2002:a05:6a00:14c2:b0:82f:8332:4933 with SMTP id d2e1a72fcca58-82f8c7dd158mr7842814b3a.3.1776536044462; Sat, 18 Apr 2026 11:14:04 -0700 (PDT) Received: from DESKTOP-MUHC17F.tail07b66e.ts.net ([188.253.121.151]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f8e9f7735sm5659402b3a.21.2026.04.18.11.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2026 11:14:03 -0700 (PDT) From: Zhenzhong Wu To: netdev@vger.kernel.org Cc: edumazet@google.com, ncardwell@google.com, kuniyu@google.com, davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, tamird@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Zhenzhong Wu Subject: [PATCH net v2 2/2] selftests/bpf: check epoll readiness after reuseport migration Date: Sun, 19 Apr 2026 02:13:33 +0800 Message-ID: <20260418181333.1713389-3-jt26wzz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418181333.1713389-1-jt26wzz@gmail.com> References: <20260418181333.1713389-1-jt26wzz@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit After migrate_dance() moves established children to the target listener, add it to an epoll set and verify that epoll_wait(..., 0) reports it ready before accept(). This adds epoll coverage for the TCP_ESTABLISHED reuseport migration case in migrate_reuseport. Keep the check limited to TCP_ESTABLISHED cases. TCP_SYN_RECV and TCP_NEW_SYN_RECV still depend on asynchronous handshake completion, so a zero-timeout epoll_wait() would race there. Signed-off-by: Zhenzhong Wu --- .../bpf/prog_tests/migrate_reuseport.c | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c b/tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c index 653b0a20f..580a53424 100644 --- a/tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c +++ b/tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c @@ -18,13 +18,16 @@ * 9. call shutdown() for the second server * and migrate the requests in the accept queue * to the last server socket. - * 10. call accept() for the last server socket. + * 10. for TCP_ESTABLISHED cases, call epoll_wait(..., 0) + * for the last server socket. + * 11. call accept() for the last server socket. * * Author: Kuniyuki Iwashima */ #include #include +#include #include "test_progs.h" #include "test_migrate_reuseport.skel.h" @@ -522,6 +525,33 @@ static void run_test(struct migrate_reuseport_test_case *test_case, goto close_clients; } + /* Only TCP_ESTABLISHED has already-migrated accept-queue entries + * here. Later states still depend on follow-up handshake work. + */ + if (test_case->state == BPF_TCP_ESTABLISHED) { + struct epoll_event ev = { + .events = EPOLLIN, + }; + int epfd; + int nfds; + + epfd = epoll_create1(EPOLL_CLOEXEC); + if (!ASSERT_NEQ(epfd, -1, "epoll_create1")) + goto close_clients; + + ev.data.fd = test_case->servers[MIGRATED_TO]; + if (!ASSERT_OK(epoll_ctl(epfd, EPOLL_CTL_ADD, + test_case->servers[MIGRATED_TO], &ev), + "epoll_ctl")) + goto close_epfd; + + nfds = epoll_wait(epfd, &ev, 1, 0); + ASSERT_EQ(nfds, 1, "epoll_wait"); + +close_epfd: + close(epfd); + } + count_requests(test_case, skel); close_clients: -- 2.43.0