From nobody Wed Dec 17 22:46:47 2025 Received: from mail.nfschina.com (unknown [42.101.60.213]) by smtp.subspace.kernel.org (Postfix) with SMTP id 2EC1117D2; Fri, 14 Mar 2025 07:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.213 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936520; cv=none; b=HpE9yAbj9RxQt8HKLdLkVppfM1Sihkilz/XTaSpgy7QS10EQj3W89c2Jr81+ibtO6fbh4wbvPmN96emdLbHfmMZLoAz0vXvWDbQFJwLOhvOax406H+OAs9HIwwCIjts9i5/2OowqZTGIGko4M0ZH039IQMCpF6F/S3NTX6X0ahw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936520; c=relaxed/simple; bh=nYhJZCbhlaC0rSuAhobyC5FkT87b9GIVB4HH4O/O72o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version; b=fGPbuyf4rPOUySFVKrfutVLfLj941U1PefNXHJPcMINVl30eh+X2qjJFY2Hq3h2bU88n1nD8eTnfdhG7C7o/dLOrDuWv3/DDQ0g4e70wya9re59bSv6AK+CviqZ/H5Ao3Gus3TdpPAnT/MzhFTyaVNXPpOiXHEt3RZ4nxUiqBdk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.213 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from longsh.shanghai.nfschina.local (unknown [180.167.10.98]) by mail.nfschina.com (MailData Gateway V2.8.8) with ESMTPSA id A2D6960680974; Fri, 14 Mar 2025 15:15:08 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: zfigura@codeweavers.com, shuah@kernel.org Cc: Su Hui , wine-devel@winehq.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/4] selftests: ntsync: fix the wrong condition in wake_all Date: Fri, 14 Mar 2025 15:14:51 +0800 Message-Id: <20250314071454.201697-2-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250314071454.201697-1-suhui@nfschina.com> 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 Content-Type: text/plain; charset="utf-8" When 'manual=3Dfalse' and 'signaled=3Dtrue', then expected value when usi= ng NTSYNC_IOC_CREATE_EVENT should be greater than zero. Fix this typo error. Signed-off-by: Su Hui Reviewed-by: Elizabeth Figura --- tools/testing/selftests/drivers/ntsync/ntsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testin= g/selftests/drivers/ntsync/ntsync.c index 3aad311574c4..bfb6fad653d0 100644 --- a/tools/testing/selftests/drivers/ntsync/ntsync.c +++ b/tools/testing/selftests/drivers/ntsync/ntsync.c @@ -968,7 +968,7 @@ TEST(wake_all) auto_event_args.manual =3D false; auto_event_args.signaled =3D true; objs[3] =3D ioctl(fd, NTSYNC_IOC_CREATE_EVENT, &auto_event_args); - EXPECT_EQ(0, objs[3]); + EXPECT_LE(0, objs[3]); =20 wait_args.timeout =3D get_abs_timeout(1000); wait_args.objs =3D (uintptr_t)objs; --=20 2.30.2 From nobody Wed Dec 17 22:46:47 2025 Received: from mail.nfschina.com (unknown [42.101.60.213]) by smtp.subspace.kernel.org (Postfix) with SMTP id 2E85C192B90; Fri, 14 Mar 2025 07:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.213 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936514; cv=none; b=tZf8uG+rp0OVhxpqnZ/LdH+2KEXA7Z/+dYpsEwXvAniRGdFXOCw4dCAStDKpzma6/EUWbFMm6yXudnUJkPbcIYyv9UOkJuo0y633+rIZE1d7ZSKdXsDb7CmhXqG/PJRNk+IP+2R++KsPhMu3ncoy3jMQZ9YmZS1oFtX3pkqCzQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936514; c=relaxed/simple; bh=nr//3ymoIr2kXu5Wal9VqeaXpouWjvTZB3gAxPELClc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version; b=a84quFMNNZDMoRz5058lgSL2qfmYwQD9m4rcbgai2Kz+M8CjvCwf+FSUz9MXCBsR+7KqddT8b+/btzWw2G9s5vjJDYHWpdxsRTbmRNWGvgvB4u2Am173kOxOsx2B/K+b0uFwnx5Ybxz4lOx8b6MR+cOlZ5SS0ZdLK4Dwda3Wypw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.213 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from longsh.shanghai.nfschina.local (unknown [180.167.10.98]) by mail.nfschina.com (MailData Gateway V2.8.8) with ESMTPSA id 35C206068097C; Fri, 14 Mar 2025 15:15:09 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: zfigura@codeweavers.com, shuah@kernel.org Cc: Su Hui , wine-devel@winehq.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/4] selftests: ntsync: avoid possible overflow in 32-bit machine Date: Fri, 14 Mar 2025 15:14:52 +0800 Message-Id: <20250314071454.201697-3-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250314071454.201697-1-suhui@nfschina.com> 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 Content-Type: text/plain; charset="utf-8" When using '-m32' flag to compile this test with gcc, there are some errors when running test: ntsync.c:785:wake_any:Expected ETIMEDOUT (110) =3D=3D ret (0) ntsync.c:823:wake_any:Expected (1) (1) =3D=3D __count (0) ... FAILED: 7 / 11 tests passed. Totals: pass:7 fail:4 xfail:0 xpass:0 skip:0 error:0 There is an overflow about 'timeout'. 'timespec->tv_sec' is 4 bytes in 32-bit machine. And 'timeout.tv_sec * 1000000000' causing the overflow problem, adding a cast to avoid this problem. Signed-off-by: Su Hui Reviewed-by: Elizabeth Figura --- tools/testing/selftests/drivers/ntsync/ntsync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testin= g/selftests/drivers/ntsync/ntsync.c index bfb6fad653d0..ded83dc58e6b 100644 --- a/tools/testing/selftests/drivers/ntsync/ntsync.c +++ b/tools/testing/selftests/drivers/ntsync/ntsync.c @@ -103,7 +103,7 @@ static int wait_objs(int fd, unsigned long request, __u= 32 count, =20 clock_gettime(CLOCK_MONOTONIC, &timeout); =20 - args.timeout =3D timeout.tv_sec * 1000000000 + timeout.tv_nsec; + args.timeout =3D (__u64)timeout.tv_sec * 1000000000 + timeout.tv_nsec; args.count =3D count; args.objs =3D (uintptr_t)objs; args.owner =3D owner; @@ -729,7 +729,7 @@ static __u64 get_abs_timeout(unsigned int ms) { struct timespec timeout; clock_gettime(CLOCK_MONOTONIC, &timeout); - return (timeout.tv_sec * 1000000000) + timeout.tv_nsec + (ms * 1000000); + return ((__u64)timeout.tv_sec * 1000000000) + timeout.tv_nsec + (ms * 100= 0000); } =20 static int wait_for_thread(pthread_t thread, unsigned int ms) --=20 2.30.2 From nobody Wed Dec 17 22:46:47 2025 Received: from mail.nfschina.com (unknown [42.101.60.213]) by smtp.subspace.kernel.org (Postfix) with SMTP id 260EB193073; Fri, 14 Mar 2025 07:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.213 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936515; cv=none; b=oeUjOhyAn5rSAxUjNVzrglbz8WMN5B3U4m9Z3WfFgDwOQC3nTRXd94XQ49UbvYCx1GAg1uTjrL1xoz+Vqrv245UOUy6fM9xN3xrSSXNKYzZVsbAD3dbdtp0dYc3LDY3psKcP9Ao3IxaYWb3Dp3zIw4Ob99XcEkamTsvjorOY/a4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936515; c=relaxed/simple; bh=901H3qnhq05EWF+lSoGZ+w8eo28I5pFtX3w8xPFOlkE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version; b=dtTeMxCyQvAWDqrW5wP4aXCCHKdmKQjdhpx2gRF/Hlt6K8qqKCUrPtfcY31r5yofR/f8vV2O672M0aG03lyiouJRuXeBU8hSLoDuubFl5KflWTJw01ECO35gTO7rEx/uyBXYpXMRZeI2gd1VVOhtTWSI+DTnVoLIx6KJiLlc5ow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.213 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from longsh.shanghai.nfschina.local (unknown [180.167.10.98]) by mail.nfschina.com (MailData Gateway V2.8.8) with ESMTPSA id BB23F6068097E; Fri, 14 Mar 2025 15:15:09 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: zfigura@codeweavers.com, shuah@kernel.org Cc: Su Hui , wine-devel@winehq.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/4] selftests: ntsync: update config Date: Fri, 14 Mar 2025 15:14:53 +0800 Message-Id: <20250314071454.201697-4-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250314071454.201697-1-suhui@nfschina.com> 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 Content-Type: text/plain; charset="utf-8" ntsync should be tested when CONFIG_NTSYNC is setting rather than CONFIG_WINESYNC, correct this. Signed-off-by: Su Hui Reviewed-by: Elizabeth Figura --- tools/testing/selftests/drivers/ntsync/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/ntsync/config b/tools/testing/= selftests/drivers/ntsync/config index 60539c826d06..0aa68de147af 100644 --- a/tools/testing/selftests/drivers/ntsync/config +++ b/tools/testing/selftests/drivers/ntsync/config @@ -1 +1 @@ -CONFIG_WINESYNC=3Dy +CONFIG_NTSYNC=3Dy --=20 2.30.2 From nobody Wed Dec 17 22:46:47 2025 Received: from mail.nfschina.com (unknown [42.101.60.213]) by smtp.subspace.kernel.org (Postfix) with SMTP id 260A4193062; Fri, 14 Mar 2025 07:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.213 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936515; cv=none; b=tRK5oSrGfsPaCmOHipCErdW8Voawm4GaaYMn+1uHOQI6hURip5KE/884fpHmK81YPcJQfELN+jBDcQo65Ijn0gV7Ff5IkWNtqFD3dbEfbld/ydPEiZFczvm8Zvyw5hwhUK8hhef/rylT+lJEzR1xwto7BgH3SHc9QiF0DKsqluA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741936515; c=relaxed/simple; bh=s0mmNox3jAK5QVrE4AMY1kLiVWM6e6Jd1XDMUyY7jH4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version; b=ALNCwRvd3ZIvq5qF+Z5pNb4FEipTn5t2Bow1E4Lqnx5AA37MrjSaL0MN1Ra5bm54rpvFz1dh+TxbfZwoByirthBJQYgJt93IUr/hvt8/84o46OysYWJFRUINDH3Nl1MXIEec7ZIqMa2IRNADmccErttgG09GMgBs7PI5jLHyg2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.213 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from longsh.shanghai.nfschina.local (unknown [180.167.10.98]) by mail.nfschina.com (MailData Gateway V2.8.8) with ESMTPSA id 5520860680974; Fri, 14 Mar 2025 15:15:10 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: zfigura@codeweavers.com, corbet@lwn.net Cc: Su Hui , wine-devel@winehq.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 4/4] docs: ntsync: update NTSYNC_IOC_* Date: Fri, 14 Mar 2025 15:14:54 +0800 Message-Id: <20250314071454.201697-5-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250314071454.201697-1-suhui@nfschina.com> 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 Content-Type: text/plain; charset="utf-8" Some macros in the document do not match the code and the header files, correct these macros according to the definitions in the code. Signed-off-by: Su Hui Reviewed-by: Elizabeth Figura --- Documentation/userspace-api/ntsync.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Documentation/userspace-api/ntsync.rst b/Documentation/userspa= ce-api/ntsync.rst index 25e7c4aef968..969774bf4c60 100644 --- a/Documentation/userspace-api/ntsync.rst +++ b/Documentation/userspace-api/ntsync.rst @@ -152,9 +152,9 @@ The ioctls on the device file are as follows: =20 The ioctls on the individual objects are as follows: =20 -.. c:macro:: NTSYNC_IOC_SEM_POST +.. c:macro:: NTSYNC_IOC_SEM_RELEASE =20 - Post to a semaphore object. Takes a pointer to a 32-bit integer, + Release a semaphore object. Takes a pointer to a 32-bit integer, which on input holds the count to be added to the semaphore, and on output contains its previous count. =20 @@ -186,7 +186,7 @@ The ioctls on the individual objects are as follows: unowned and signaled, and eligible threads waiting on it will be woken as appropriate. =20 -.. c:macro:: NTSYNC_IOC_SET_EVENT +.. c:macro:: NTSYNC_IOC_EVENT_SET =20 Signal an event object. Takes a pointer to a 32-bit integer, which on output contains the previous state of the event. @@ -194,12 +194,12 @@ The ioctls on the individual objects are as follows: Eligible threads will be woken, and auto-reset events will be designaled appropriately. =20 -.. c:macro:: NTSYNC_IOC_RESET_EVENT +.. c:macro:: NTSYNC_IOC_EVENT_RESET =20 Designal an event object. Takes a pointer to a 32-bit integer, which on output contains the previous state of the event. =20 -.. c:macro:: NTSYNC_IOC_PULSE_EVENT +.. c:macro:: NTSYNC_IOC_EVENT_PULSE =20 Wake threads waiting on an event object while leaving it in an unsignaled state. Takes a pointer to a 32-bit integer, which on @@ -213,7 +213,7 @@ The ioctls on the individual objects are as follows: afterwards, and a simultaneous read operation will always report the event as unsignaled. =20 -.. c:macro:: NTSYNC_IOC_READ_SEM +.. c:macro:: NTSYNC_IOC_SEM_READ =20 Read the current state of a semaphore object. Takes a pointer to struct :c:type:`ntsync_sem_args`, which is used as follows: @@ -225,7 +225,7 @@ The ioctls on the individual objects are as follows: * - ``max`` - On output, contains the maximum count of the semaphore. =20 -.. c:macro:: NTSYNC_IOC_READ_MUTEX +.. c:macro:: NTSYNC_IOC_MUTEX_READ =20 Read the current state of a mutex object. Takes a pointer to struct :c:type:`ntsync_mutex_args`, which is used as follows: @@ -242,7 +242,7 @@ The ioctls on the individual objects are as follows: ``EOWNERDEAD``. In this case, ``count`` and ``owner`` are set to zero. =20 -.. c:macro:: NTSYNC_IOC_READ_EVENT +.. c:macro:: NTSYNC_IOC_EVENT_READ =20 Read the current state of an event object. Takes a pointer to struct :c:type:`ntsync_event_args`, which is used as follows: @@ -255,7 +255,7 @@ The ioctls on the individual objects are as follows: - On output, contains 1 if the event is a manual-reset event, and 0 otherwise. =20 -.. c:macro:: NTSYNC_IOC_KILL_OWNER +.. c:macro:: NTSYNC_IOC_MUTEX_KILL =20 Mark a mutex as unowned and abandoned if it is owned by the given owner. Takes an input-only pointer to a 32-bit integer denoting the --=20 2.30.2