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=1796537214; b=WC1LxgiRw3RswtwtqDDYqXpck3zMP6CLL5l3QmBfONkFfQf1rbFHdF21bIbaaKu5ko+Z U3mYm0FgvQNasw0wOOXHpufJFTrdOpm9h5k3GAbCwzI9R+SVFvhTiPG6MpORsLDkqZNgB Y7Mm8zN80JpNwfk+A2d0bVpXxISGA9AJxqOMrXGRpmfANiquRI9nIn7H9w9YuZpFyTR7T IXtw+PfNO/0KD5xSjXHAcNVvJptHJVh0DCBNH3JSRhN56wPg+zTBDNTU8qzbVEHsf/DYs TPS7bCHJbfCg6Eec0lrW8sSXaPifgqUnoeFF7CbHd8dFkZT1RJzRyA7T4OuGj9CPbTg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796537214; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=83F5fn92fi8oGr7c4TAU5mAUDEXB1AwDx1BLqvOXSSk=; b=apSBU0iS3H43ZqvGhk4aV9EJe9HwB19uXMBlAOwVwATt+g7CER3WhT2jUafViVdeYrgo zZAhqKgFn6/df0Xs3XucaHMxycsL24vMU7+JAk0wujQXfBLQxtE1FuNvC53aSHweN66Ai I6IAHtec5/JrNy5gs4czJkOMy1TQvRCbVqF/fgq9vRA/iGTjM7IlNnNv6i7XJEGsTwPc7 wHRJ1QdBnbEpTQYLPC4395Iauz136QKAYb/NmxCSo/I5Cdawm98H2TrGz+c1NthRZW3Xq 6kM69z9JHuZbflniMftUacA9UZDQMcgQvKRK58BxFv1TDpCG1TbwAFoVUEFRW3V9Bzw== 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=Qr135KJ6; 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 8B283606A31F for ; Sun, 6 Dec 2026 06:06:54 +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=Qr135KJ6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16B331F00A07; Sun, 6 Dec 2026 06:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796537214; bh=83F5fn92fi8oGr7c4TAU5mAUDEXB1AwDx1BLqvOXSSk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Qr135KJ6aeSxic48oPCduxSzvWoWJKWFzncM7Ka1oo49wGXAs5j+c3QCLLGB3CZnT HJ0HfLghdwr00RqjmRxu4s3+u+8Cn0PeSHJbxRNl86ThvL6v39JyVN3s/jgE1HLFd/ u+FwnRthn0aqTkO5ou2fZFJy7P4SpTNkqkIm+zT/xZ4WBf0ArXT7KWJZ3PTNd8uZXn BukAzLrSuhCAbTvI+KkpX1hc5WCQKgno3079gvdXjFqzGts8cGM6GiU6YoJxEj5VFN FIMNlRwhi9kkqwSVtfeaxa0tj999mpQoLj+KRMABTrUcSVXd8uO5/uX+JBgPtKdqrd FRJrwnIM/ooKQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 6/6] selftests/sched_ext: Test task field reset across sub-scheduler handoffs Reply-To: sashiko-reviews@lists.linux.dev To: "Changwoo Min" Cc: sched-ext@lists.linux.dev In-Reply-To: <20261206053728.2026272-7-changwoo@igalia.com> References: <20261206053728.2026272-1-changwoo@igalia.com> <20261206053728.2026272-7-changwoo@igalia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 06:06:53 +0000 X-Mailing-List: sched-ext@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] selftests/sched_ext: SCX_EQ() double-evaluates calls in handoffs() - [Low] selftests/sched_ext: sub_handoff.c duplicates helpers from sibling tests -- commit 20ecdae3e4d6197a4eacc5c0de5f09501133284c Author: Changwoo Min selftests/sched_ext: Test task field reset across sub-scheduler handoffs This commit adds the sub_handoff sched_ext selftest, which loads a cid-form scheduler as both root and sub-scheduler to verify that p->scx.bpf_priv and dsq_vtime are cleared across handoffs and that ops.init_task() observes the previous owner. > diff --git a/tools/testing/selftests/sched_ext/sub_handoff.c b/tools/test= ing/selftests/sched_ext/sub_handoff.c > new file mode 100644 > index 0000000000000..e79eea4c95424 > --- /dev/null > +++ b/tools/testing/selftests/sched_ext/sub_handoff.c > @@ -0,0 +1,341 @@ [ ... ] > +static u64 get_cgroup_id(const char *path) > +{ > + union { > + u64 id; > + unsigned char bytes[8]; > + } id =3D {}; > + struct file_handle *handle; > + int mount_id, ret; > + > + handle =3D calloc(1, sizeof(*handle) + sizeof(id)); > + if (!handle) > + return 0; > + handle->handle_bytes =3D sizeof(id); > + ret =3D name_to_handle_at(AT_FDCWD, path, handle, &mount_id, 0); > + if (!ret && handle->handle_bytes =3D=3D sizeof(id)) > + memcpy(id.bytes, handle->f_handle, sizeof(id)); > + free(handle); > + > + return ret ? 0 : id.id; > +} > + > +static u64 now_ns(void) > +{ > + struct timespec ts; > + > + clock_gettime(CLOCK_MONOTONIC, &ts); > + return (u64)ts.tv_sec * 1000000000ULL + ts.tv_nsec; > +} [ ... ] > +static bool wait_pid_sleeping(pid_t pid, u64 timeout_ms) [ ... ] [Severity: Low] Could get_cgroup_id(), now_ns(), and wait_pid_sleeping() be shared in util.c and util.h instead of duplicated here? All three already exist in tools/testing/selftests/sched_ext/sub_core_caps.= c, and cgroup_nr_cpus.c has another copy of get_cgroup_id() as cgroup_id(). The sched_ext selftest Makefile already links util.o into the runner binary. [ ... ] > + SCX_EQ(sched_setscheduler(pid, SCHED_EXT, ¶m), 0); > + SCX_EQ(wait_u64(&root->nr_enable, 1), 1); [ ... ] > + SCX_EQ(wait_u64(&sub->nr_enable, 1), 1); [ ... ] > + SCX_EQ(wait_u64(&root->nr_enable, 2), 2); [Severity: Low] Can SCX_EQ() evaluate wait_u64() and sched_setscheduler() twice on failure? SCX_EQ() expands _x in both the comparison and the failure message: tools/testing/selftests/sched_ext/scx_test.h: #define SCX_EQ(_x, _y) SCX_FAIL_IF((_x) !=3D (_y), "Expected %s =3D=3D %s (= %lu =3D=3D %lu)", \ #_x, #_y, (u64)(_x), (u64)(_y)) If wait_u64() times out after 30 seconds, the second evaluation blocks for another 30 seconds and can print a contradictory actual value if the counter updates in the meantime. On failure, sched_setscheduler() is also called a second time. Storing each return value in a local variable before passing it to SCX_EQ() avoids the duplicate calls. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206053728.2026= 272-1-changwoo@igalia.com?part=3D6