Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2098760lqo; Sun, 19 May 2024 13:26:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJcxwoJ7jY9tHQ5KHHh/OEBKGOmZf+8LP3Rk6MGjj3pvFmx4jXEdOcTAZ1sA+F2tGLXXb82KRE90iND5WwJlkyW6Zhf/VCOR6WK+2a+g== X-Google-Smtp-Source: AGHT+IH08wRWklzgCihGpXwkKLWAaq2XnkExxtMZcEy0TSRURw5nSePtNSKGOIOYPkjiT8iLTQLN X-Received: by 2002:a17:902:f550:b0:1e9:6609:37d5 with SMTP id d9443c01a7336-1ef43d186dbmr303483515ad.27.1716150373197; Sun, 19 May 2024 13:26:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716150373; cv=pass; d=google.com; s=arc-20160816; b=nOe1EuGIrgA83o2texqZB80HC0RoxCSftoitah35c4Xa9rLgMjIjWIUadgnp6zgL/U T2hS3Wz/9nxVqCfl1fY6Ps9r9vfC6TuvR9Ri6rssxbjyv/QjkHprWvb8KH/dAZiMXVAD +VjlGwg01xXTe48/ugldKMRq4ltNlhJJRZ7oXDDAQDhKC2RwpKIVl2c6LaCTyTYDfMBZ CsxrDSpEWGUkcZRTgusx0oK+v64kfa0MLTNX+QI9Hb8xUEhAdXCo1b7fyltOR30Xf1hf D3/sjqK/629yBk7Sdpn1WdUznwqkYjsW5Bq9M6mB7AsycLHJk3joMVO0WtYRoBuiFc9W Tk9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KnWX2k85QT2MAHoz6p77qPHOQoZTmF8C99l666ikqsE=; fh=eVY06L/C5FDTmF2RNqfudsnjwkB3tbhT/y33cGhZc0I=; b=HOpXK9KELSlRL+WTHCrjDcXJtj0dN9Hi9I4Cb2Brr0oR/UxYhdpnYZA9SZOA58WiJY /xrvT3vvzoA2NdTc/hr+2kNmbPpVnTFuF5ERgzVJts8oEzZdXx5Y1pEHv9pMwEzP9myH K2tloQ/NwqxHMCBgiad4mVXEetEIQjjsNkAy7RXdgISL3WeSSCeEYzx1tS3Wfoq7M1hi JE577iW0R42tHGfH0z1esc+2/yzscP4W1o0OmAZhP2awRcma+yKdw59YvkY1FWszMjU6 KlVlZIUUi+ELGKvrpLUTcyFx0Wbhf1a3b0pNj/yL6VvmFlO4GSu7uFi3i4GD59XYo5fv A4HA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=o8wz8xu2; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-183233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0bf31603si37613995ad.294.2024.05.19.13.26.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 13:26:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=o8wz8xu2; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-183233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 26DDBB20C52 for ; Sun, 19 May 2024 20:25:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55FCB74429; Sun, 19 May 2024 20:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b="o8wz8xu2" Received: from mail.codeweavers.com (mail.codeweavers.com [4.36.192.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF4046A340; Sun, 19 May 2024 20:25:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=4.36.192.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716150316; cv=none; b=FuuhptwsBnINErDf5+ljS/9kdq7hcK2kB1YoiPSb+W+7m++EvmAAgD+b+Gm5MZCdg7TD4/sgWosaeafJ1L52rJyFqArCpz1YG/Qzrn8m16Hlrd/v5LtK/sHEtzXsYm1Ambr5QrMB6XFf13djjeM8Gn1H6Qk0TYX88Xdbvmzp4pY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716150316; c=relaxed/simple; bh=1LccXFaAPV45Y0RZiRDtNJd+NSqpCVnceyKAJKST3Tc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K2cuBCcuqpoT15W+5+APBG6cWEcWzWpw4rNSo5vqKpJ1bHykzyb3gHxPbDvKJXlfLjEI6yrUWYx9Y0x9A0KN31qleH7sK0FJ1dQx6oCbXGbxqZ63pKQ3Ox/VQ7rUZ/0NZg9nVOKUPk8kr2bGKKBtvokBxXkux7hs3jxcjrE1FT0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com; spf=pass smtp.mailfrom=codeweavers.com; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b=o8wz8xu2; arc=none smtp.client-ip=4.36.192.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codeweavers.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=s1; h=Message-ID:Date:Subject:Cc:To:From:Sender; bh=KnWX2k85QT2MAHoz6p77qPHOQoZTmF8C99l666ikqsE=; b=o8wz8xu22a/Hc4uWWk30bBbKff 0zJd/5csKULqJw+h5IQB9Bh/uUzqVcv3MAE4HlhNGAiGS9sp2gDHbu7k5WEzPKXvA39o9LNeOpQRq jPIyKib6JIYkCbtsAPurmzkXRBbt/U/g3KvmbxC93uK+k3XTskfS34oURjTZe90fz7O47xxEaB2JS XkoITmimrWC/b9XX5UXO4C3QOWf/4Um+JjmaibWfTTBJvXHLef17qulJVdTZqwtFHyx5AM4+8k19E TWzEa3oFaeR28b9vWtUoK2JKm2Zgbpn7+jAMVDOHuWyRgL+gkdJSOXVtdFKp8QXlxurrwBlvao2WJ ShxsKY/w==; Received: from cw137ip160.mn.codeweavers.com ([10.69.137.160] helo=camazotz.mn.codeweavers.com) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s8n5c-008wIn-2h; Sun, 19 May 2024 15:25:04 -0500 From: Elizabeth Figura To: Arnd Bergmann , Greg Kroah-Hartman , Jonathan Corbet , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, wine-devel@winehq.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= , Wolfram Sang , Arkadiusz Hiler , Peter Zijlstra , Andy Lutomirski , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Randy Dunlap , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Elizabeth Figura Subject: [PATCH v5 09/28] ntsync: Introduce NTSYNC_IOC_EVENT_PULSE. Date: Sun, 19 May 2024 15:24:35 -0500 Message-ID: <20240519202454.1192826-10-zfigura@codeweavers.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240519202454.1192826-1-zfigura@codeweavers.com> References: <20240519202454.1192826-1-zfigura@codeweavers.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 This corresponds to the NT syscall NtPulseEvent(). This wakes up any waiters as if the event had been set, but does not set the event, instead resetting it if it had been signalled. Thus, for a manual-reset event, all waiters are woken, whereas for an auto-reset event, at most one waiter is woken. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync.c | 8 ++++++-- include/uapi/linux/ntsync.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c index b070ceccc3af..b0c1d644f0af 100644 --- a/drivers/misc/ntsync.c +++ b/drivers/misc/ntsync.c @@ -534,7 +534,7 @@ static int ntsync_mutex_kill(struct ntsync_obj *mutex, void __user *argp) return ret; } -static int ntsync_event_set(struct ntsync_obj *event, void __user *argp) +static int ntsync_event_set(struct ntsync_obj *event, void __user *argp, bool pulse) { struct ntsync_device *dev = event->dev; __u32 prev_state; @@ -550,6 +550,8 @@ static int ntsync_event_set(struct ntsync_obj *event, void __user *argp) if (all) try_wake_all_obj(dev, event); try_wake_any_event(event); + if (pulse) + event->u.event.signaled = false; ntsync_unlock_obj(dev, event, all); @@ -605,9 +607,11 @@ static long ntsync_obj_ioctl(struct file *file, unsigned int cmd, case NTSYNC_IOC_MUTEX_KILL: return ntsync_mutex_kill(obj, argp); case NTSYNC_IOC_EVENT_SET: - return ntsync_event_set(obj, argp); + return ntsync_event_set(obj, argp, false); case NTSYNC_IOC_EVENT_RESET: return ntsync_event_reset(obj, argp); + case NTSYNC_IOC_EVENT_PULSE: + return ntsync_event_set(obj, argp, true); default: return -ENOIOCTLCMD; } diff --git a/include/uapi/linux/ntsync.h b/include/uapi/linux/ntsync.h index 7fdf79729b20..5586fadd9bdd 100644 --- a/include/uapi/linux/ntsync.h +++ b/include/uapi/linux/ntsync.h @@ -53,5 +53,6 @@ struct ntsync_wait_args { #define NTSYNC_IOC_MUTEX_KILL _IOW ('N', 0x86, __u32) #define NTSYNC_IOC_EVENT_SET _IOR ('N', 0x88, __u32) #define NTSYNC_IOC_EVENT_RESET _IOR ('N', 0x89, __u32) +#define NTSYNC_IOC_EVENT_PULSE _IOR ('N', 0x8a, __u32) #endif -- 2.43.0