From nobody Sun Jul 14 18:30:15 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYm74YHjz5R8Fl; Sun, 14 Jul 2024 18:30:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYm73z5Zz4Xs4; Sun, 14 Jul 2024 18:30:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2vk7b/Go/7xwFyEy4s9C9k/DIMIuj1YzsGramfJkRpQ=; b=j4okp1kJRtAGh1RxDIVHWgD+Dr5S1sLI6Y6AnCtGmPEJPoMTyf/PDBZfVxW63mWAJwJsYJ P4eLeW7EHlgQRgyBbuRdBY+Bv7Dl5459E97KvIc1BNSs4BpDBAvRK3hiES/jiCZHu+9Jc1 y1XNb4dQWLroreY+hV0s36vx2RW6f66zVtTfnq4ZW43IXQNpOmZnbvCV5Hlgch5muPUKi9 pBhmdM/+v6oIQQXHO92xmElgxFmDH8W9147opNnGksLfZZsM+kClEii3MjHYbcGeAYRMsY copAwy+zJWisunuXqJTfb+0lU0M1qfYtTcPS3uRGqkTTWBXkrbpGaH37zZKmiw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981815; a=rsa-sha256; cv=none; b=wPEZslae3jRWyOps5J3IBMbRmFaT/OflAcDePkETG/+OU+OLs7B50r3bgeBmtw21mtRAxe 0HIOzBsAI1rnBdpBt+hX47o9fPRnvfkMFFKqI796wwpIc3tGhXUgcSj53qhJ1LeKdxdKEj dvZM4K8ZiNQDBQrVGIXVzrhkniAnkPaKk5UNhqz8v9D8eYZ6IHaSX2pzoM213fJh0osY/u bQ0RurB9kj9SVE2KIumy0sVRK/pMjb83G5dvgGZIMaSkeLuz/O1JAwKWlgg0TtxBMrz5nG ZiuH7YUbOflgZ/qe1C9sMii2RzOXCau0BDYNRJ3RI/hX7Fa47TNHn8E0e1PSQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2vk7b/Go/7xwFyEy4s9C9k/DIMIuj1YzsGramfJkRpQ=; b=rJwLByMInwsR+h/hz1FePyQm5tQyfnnFlILrGMdvOS9+ms8djPvZYDVCyncMxOf4/pnXEB /TpkojJ0yOJOCp7lDLVKJxWygBkGYYpdxjYefR8VFi11VN8g+22WHVcm2B+78kxWKqBL71 /wT07GAW2T9nQeqE2LhsuWSO7mA+haxDAXhq0kMZSEhzGzAVyHgtdeGcfVje1vFCbyHPwM WQE/7L0GZMNG8Nx6+M7aCzxIsYL4b9HGZVUWniUwE6e/h7NGcJqfGQpZkMPRBRf2kzGSCW A6V6VVv64DsYvCqXItjwutSX5nX3t96ZQxPrATiFN0h6R0IcVwTkcXHaeINnOw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WMYm73ZbzzKZQ; Sun, 14 Jul 2024 18:30:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46EIUF2c019020; Sun, 14 Jul 2024 18:30:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUFUF019011; Sun, 14 Jul 2024 18:30:15 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:15 GMT Message-Id: <202407141830.46EIUFUF019011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5b98bd30686a - main - sched tests: Avoid underflow when maxcpuid == 0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b98bd30686a358b2a20728a4a6b5cecb7e28dc9 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5b98bd30686a358b2a20728a4a6b5cecb7e28dc9 commit 5b98bd30686a358b2a20728a4a6b5cecb7e28dc9 Author: Mark Johnston AuthorDate: 2024-07-14 16:12:32 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:14 +0000 sched tests: Avoid underflow when maxcpuid == 0 MFC after: 1 week --- tests/sys/kern/sched_affinity.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/sys/kern/sched_affinity.c b/tests/sys/kern/sched_affinity.c index cbba226b3fa2..9af6076c1649 100644 --- a/tests/sys/kern/sched_affinity.c +++ b/tests/sys/kern/sched_affinity.c @@ -67,13 +67,16 @@ ATF_TC_BODY(test_setinvalidcpu, tc) { size_t cpusetsize; cpuset_t *set; + int cpu; + + cpu = maxcpuid > 1 ? maxcpuid - 1 : 0; cpusetsize = CPU_ALLOC_SIZE(maxcpuid + 1); set = CPU_ALLOC(maxcpuid + 1); ATF_REQUIRE(set != NULL); CPU_ZERO_S(cpusetsize, set); CPU_SET_S(maxcpuid + 1, cpusetsize, set); - CPU_SET_S(maxcpuid - 1, cpusetsize, set); + CPU_SET_S(cpu, cpusetsize, set); ATF_REQUIRE(sched_setaffinity(0, cpusetsize, set) == 0); CPU_FREE(set); @@ -82,7 +85,7 @@ ATF_TC_BODY(test_setinvalidcpu, tc) ATF_REQUIRE(set != NULL); CPU_ZERO_S(cpusetsize, set); CPU_SET_S(maxcpuid + 1, cpusetsize, set); - CPU_SET_S(maxcpuid - 1, cpusetsize, set); + CPU_SET_S(cpu, cpusetsize, set); ATF_REQUIRE(cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, cpusetsize, set) == -1); ATF_REQUIRE_EQ(errno, EINVAL);