From patchwork Wed Nov 22 12:48:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13464773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB43FC61D9B for ; Wed, 22 Nov 2023 12:49:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F9D06B056D; Wed, 22 Nov 2023 07:49:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A9676B0575; Wed, 22 Nov 2023 07:49:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54A8D6B0573; Wed, 22 Nov 2023 07:49:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3909C6B0575 for ; Wed, 22 Nov 2023 07:49:22 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0DB691CAB79 for ; Wed, 22 Nov 2023 12:49:22 +0000 (UTC) X-FDA: 81485570964.24.70A045F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id 62302C0021; Wed, 22 Nov 2023 12:49:19 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AqfJxO8X; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700657359; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u5lBAXS5xavBvDM44lddetfuBKoasxPVwxU8ERfFBHA=; b=MwckMpF1m9iJ+YT8zV6fps8tQ37xrIWz4iS6nIuBbfh4Lw6E2HV5EfwavQacvlfJ75W06R +KTLmstYH+PjljOhcMcKTmBft+90V6ntwLKfboDD8pFKZyhoB3Xs+/pLSCzXh5npiXrySQ 4SVc2xQOrdU607yzxnhJQSxag04U4Cc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AqfJxO8X; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700657359; a=rsa-sha256; cv=none; b=Ez8Klq3QyusgrlV/enmB4v2tP3BZocDtVPwIi/lQbVYh8czDuL7f0efKHups3E+auETukG MMv5/58PSzDbD7cXFFEGf/7x9MxmHSNx48bKxwDnZIH/rCrFOmeek9mz3djBfA1gDyxvwz UthImmvKSpT6GzzIyi36Jv0HVxlKzJU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 58AFD61DC7; Wed, 22 Nov 2023 12:49:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD60AC433C9; Wed, 22 Nov 2023 12:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700657358; bh=7uZiA7BV1EHvD8gDrmgEuc8Q4gkEdBarx0UpVsG1vNg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AqfJxO8XzZeGNu0mtpcXDTCSFRPOo0SlhhHv/QC0WO3Obsw0j2/dU4c4FuBQrd/OP DbFK2NJl7j4VWDGp+SPsJ2YNue2rd7Zmwi8E3gfCSqgH9n/YLMrRNAlGE6SQVlsU23 vXqTRkoNBWRDxjRECNLDuPkVcLRsFUNxMuqqdeQsDkcrKlrPNXno9qOAJ6oepLCP+d LXmPkukb1d8ai5dg0mrA/uqMeYv4stTQeV+VB3b1YYMaJJmaWGgihfWA/lNr2WTu1/ 7/ZBuqxZhiJUisLEqasZPLQquM1tLv/D5upbL8C3NSwCaFqd+c3rIUmaf4Nu5T4QBL r9gfOpX5Qg0Tw== From: Christian Brauner Date: Wed, 22 Nov 2023 13:48:22 +0100 Subject: [PATCH v2 1/4] i915: make inject_virtual_interrupt() void MIME-Version: 1.0 Message-Id: <20231122-vfs-eventfd-signal-v2-1-bd549b14ce0c@kernel.org> References: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> In-Reply-To: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Christoph Hellwig , Jan Kara , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, David Woodhouse , Paul Durrant , Oded Gabbay , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Leon Romanovsky , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , Eric Farman , Matthew Rosato , Halil Pasic , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Tony Krowiak , Jason Herne , Harald Freudenberger , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Diana Craciun , Alex Williamson , Eric Auger , Fei Li , Benjamin LaHaise , Christian Brauner , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Kirti Wankhede , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fpga@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-usb@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-aio@kvack.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Jens Axboe , Pavel Begunkov , io-uring@vger.kernel.org X-Mailer: b4 0.13-dev-26615 X-Developer-Signature: v=1; a=openpgp-sha256; l=1755; i=brauner@kernel.org; h=from:subject:message-id; bh=7uZiA7BV1EHvD8gDrmgEuc8Q4gkEdBarx0UpVsG1vNg=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTG/lijOaknSTlcRJzPILDJVd/TRk51g3yQX9PrhU6dq 73z7mzoKGVhEONikBVTZHFoNwmXW85TsdkoUwNmDisTyBAGLk4BmIggF8P/skrZDdMFRVfP+ti2 XjtpR/st0cgfoZuOF904N6NM/+fZTYwMt20s3h3lyVj0+C63y4d/387vnKA8ry7MYWFejO+c6q/ /mAE= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Queue-Id: 62302C0021 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 3g8aw191bas9j3itzxanqja1pwczyix6 X-HE-Tag: 1700657359-245642 X-HE-Meta: U2FsdGVkX1+BqPjW/1YSadA610aDCcR7McQc4MPWhAo5c4hZUiBOqDY53RjSAeYSpcQ1f3FHsa2yUdYK45D2payTCPuWKGDNzIpVDKTQuJ0By5w3Dapdk0XpoAhTnY9LXQCiOrLhqy6pFRcgT527aO2BQiOgerQaBa0z4grnwfQJPYGaAlWiQplalK/w4WhEEBtCJrMMmHSyWxCLMPOikzkcMYqJ9WGGjr/JAtZ9/TS/GOCjRVan3Cn8EGYtHdYY85VhGJBUrEFljevcNBm1uWCfcdggsPKMn6DZP7plhY4lajvKNsupabHmCSJ/MaSZaE4h4+E7puLQrnyFwWC74aMofS7nRZNpTTV8VGnGb/dnX/Re6g6LgqSEyzCptXOoOr4Pf8eS9Gk39Ge9nZnaq8gTufSjXq5G5ZX08RzHImRA1BE1HBoRn5TWXFqyYRGK40RDGVAJvL6KpJ/3ZvFYj/J0QCb0TpGwMDnvvZpiybdCgwP32uBIcX0UP94fWRpBf83kXZ4mUh7vG5ZI6x+wZ67DTtaHbrMxqzhVdJkvbK425pM3blAwq2uuu5zTf4PB9+A55JTWEzeJ7LSiDkVWGs5UK6s5sUyZrPaotqsFJPJqNHaZp+d4/lnmcBENDqgqfy7dvngv2tN2UJthCSsEJU1fpQw+8i3aUQyI5Tna7WEZ76kRTTOSuXRBh0E2QkxlfytCXMeQOAEg9LsR7jkc2bFx9zU9EJLFAbfVpp8V85xCzBElP7dq1e6a4IFSH3lojFR8aLSh4fENfknms/F91/dPn+w4j7Ibd4MpXQCpMWYrnaQx9LeFqYHQiNSYM+OzgPYbBLxIONI3cXPzOzDF4BiFp3ngF2PDCZIh+wi1ox28XRol990E4q7I2kizbmzCJyclaBKGFu03Amj/5QkeQXW5aDqCUYfiaI6e+ZL0tZrbXH+/pvt2cueF7IiEki1Ny0YHlN7l+bF8yV9hcoB bQhd4eP1 0ZMZD6DO6ANOr4TZYYv5kkZYVU/Aw/ijhcrGrBe1W6k5Z4jrKWthaTcANhp51vD6HWXwJm5BmdE//6fgKhzxklyh8XyOsBwny6wN7GMAxMeqgUCFrOo6uq3nru8NqzDjciHfOFoQumb5zLwaXsV7pKVffWzXHrl24D/Zv0xLoS3IHUjpZnhARXE7jUd9njNoLgbzU6GyKOI0n5Uf3Q5fgtWVF9al+Lm6Hw8o8oIPFoHc5ENQrwlcMRmBKyYApU2Ft3LUXzQSvhK5ejb30a+exgucD/BFDaVNKOXTwZrLHOBi4JKKRdi03JdOU+C1k4iuiaq9AOagA11uYlXCoJKW9bOVSWIUUpGjkz3r9bnkQtIeyaBv+6qu85K9hEQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The single caller of inject_virtual_interrupt() ignores the return value anyway. This allows us to simplify eventfd_signal() in follow-up patches. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara Reviewed-by: Zhenyu Wang --- drivers/gpu/drm/i915/gvt/interrupt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/interrupt.c b/drivers/gpu/drm/i915/gvt/interrupt.c index de3f5903d1a7..9665876b4b13 100644 --- a/drivers/gpu/drm/i915/gvt/interrupt.c +++ b/drivers/gpu/drm/i915/gvt/interrupt.c @@ -422,7 +422,7 @@ static void init_irq_map(struct intel_gvt_irq *irq) #define MSI_CAP_DATA(offset) (offset + 8) #define MSI_CAP_EN 0x1 -static int inject_virtual_interrupt(struct intel_vgpu *vgpu) +static void inject_virtual_interrupt(struct intel_vgpu *vgpu) { unsigned long offset = vgpu->gvt->device_info.msi_cap_offset; u16 control, data; @@ -434,10 +434,10 @@ static int inject_virtual_interrupt(struct intel_vgpu *vgpu) /* Do not generate MSI if MSIEN is disabled */ if (!(control & MSI_CAP_EN)) - return 0; + return; if (WARN(control & GENMASK(15, 1), "only support one MSI format\n")) - return -EINVAL; + return; trace_inject_msi(vgpu->id, addr, data); @@ -451,10 +451,10 @@ static int inject_virtual_interrupt(struct intel_vgpu *vgpu) * returned and don't inject interrupt into guest. */ if (!test_bit(INTEL_VGPU_STATUS_ATTACHED, vgpu->status)) - return -ESRCH; - if (vgpu->msi_trigger && eventfd_signal(vgpu->msi_trigger, 1) != 1) - return -EFAULT; - return 0; + return; + if (!vgpu->msi_trigger) + return; + eventfd_signal(vgpu->msi_trigger, 1); } static void propagate_event(struct intel_gvt_irq *irq, From patchwork Wed Nov 22 12:48:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13464774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3DA3C61D9C for ; Wed, 22 Nov 2023 12:49:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 786336B0575; Wed, 22 Nov 2023 07:49:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D1366B057F; Wed, 22 Nov 2023 07:49:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 460E16B0581; Wed, 22 Nov 2023 07:49:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2F9D06B0575 for ; Wed, 22 Nov 2023 07:49:49 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0DD03A0A8F for ; Wed, 22 Nov 2023 12:49:49 +0000 (UTC) X-FDA: 81485572098.20.295FD7D Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf14.hostedemail.com (Postfix) with ESMTP id ABCAA100009; Wed, 22 Nov 2023 12:49:45 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UbDNPfa9; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of brauner@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700657387; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xJl5T+XMkmDtsuZWM1QRWDbA2F+MFRHDRIfMgF5o3Ts=; b=nzwf4Oi2YyN6mou9fnS2wY3qfjyfPdiW/up/pZcedXJxm79tNkqltrSNb4s4ullJZckq5d ssv75dAuGV1676hjnkyJ5b8uQctNPdqEXh+VAdb2zkQCVZ8Ae+Cu3sp9NPtvvAMO6qbxRG 9dF/hUZjdHF7kEMh62RjtJBJoYBhGT8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UbDNPfa9; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of brauner@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700657387; a=rsa-sha256; cv=none; b=Ak8n0OHKkltmRymweHrW5PqLNZ0wYtjBGpxuTNLaHkig4ufQbNRPc3rDXXgQq6kkNqJi5b 10YTQHSPazxk8Np5Y49JDKqqKk6qA90sgp1HgXU2zkKaMCh9mYxMVpPP1IdU+QDozyE9ZN bFKDqbFMaO1N1X2bSh4/cXGuUvGWdM0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 296B5CE2022; Wed, 22 Nov 2023 12:49:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91CE5C433C8; Wed, 22 Nov 2023 12:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700657375; bh=nh47K6W+Vc8FogqOKdn9EuGAudejG+fiQqja1GaMDN0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UbDNPfa92SgC/FVih4oYsCZSX8Au84r3UDGLxcxFD3kNJ0cILRjquBRjMCnHWiXU6 rFxXgEU+wkBKyfJHLn9+1rsFFB1Kr303/Ya8T1NaZQADjzkSWhj2KwbW6iUYzr7qQD ODPckla/vZr2atBvfxYI0b9Ow1ZzhhJx8BEDQ8KgLw3Gpo9CXfzptSyzC1gN/zsYkb UMDNSrRc7Eu8ELWNIb6oEINXMXBwSaqhsT+rN/csku9QrNYOFpvjkwlTOFS7KS1tSY seoHbY//pD1yMKwZaYe8shTB6zX9bLYboDb41GeuiucFIytm23Y36bSlPRzo56g4qP syDpl/qfvLyMQ== From: Christian Brauner Date: Wed, 22 Nov 2023 13:48:23 +0100 Subject: [PATCH v2 2/4] eventfd: simplify eventfd_signal() MIME-Version: 1.0 Message-Id: <20231122-vfs-eventfd-signal-v2-2-bd549b14ce0c@kernel.org> References: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> In-Reply-To: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Christoph Hellwig , Jan Kara , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, David Woodhouse , Paul Durrant , Oded Gabbay , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Leon Romanovsky , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , Eric Farman , Matthew Rosato , Halil Pasic , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Tony Krowiak , Jason Herne , Harald Freudenberger , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Diana Craciun , Alex Williamson , Eric Auger , Fei Li , Benjamin LaHaise , Christian Brauner , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Kirti Wankhede , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fpga@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-usb@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-aio@kvack.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Jens Axboe , Pavel Begunkov , io-uring@vger.kernel.org X-Mailer: b4 0.13-dev-26615 X-Developer-Signature: v=1; a=openpgp-sha256; l=25048; i=brauner@kernel.org; h=from:subject:message-id; bh=nh47K6W+Vc8FogqOKdn9EuGAudejG+fiQqja1GaMDN0=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTG/lijdoT7dGPOuYVM3lzfLx7aG5KrJ7R/YwfzB7ZO7 iqxM1HNHaUsDGJcDLJiiiwO7Sbhcst5KjYbZWrAzGFlAhnCwMUpABPx12D4Zxw7rffMEx9OSftP glv0Jh/8pqzh+ZGPb5KTOFvdRu2p7xn+V/1ZeJPr9i2lhQ9Zglp3rTsxlznxzdyYVq0b51vsBfX XMAAA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Queue-Id: ABCAA100009 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: qsboryseu6os1y453kddab94m9dijg1n X-HE-Tag: 1700657385-661849 X-HE-Meta: U2FsdGVkX19NMVxIJL/3iJ/jsSUa5PwdLAMiBuyxx9MAq4NF2xuwyWAc86p6T5Q3oauoVBiFxvZCGXZW7yDjSpnVmcWRjkb5tosjvyVtMaqFLx4KIn2pnV1OsM2KmZyDwNq5VNc0955pGmu0QnGdfykPmRK9IVlXv6r0x/+/2D76svQvS4kPT3dlElZLKZYlRRUmFMpkxEXZBFQW9EG3PfVlxy4zcxANJDg2ghm3OLmSX09C4Fg8VRGU6Es0aAoK3e/DCaXlJbN/nnAjEL71jllfHG1rk2iK8MHftzFN6CpF6fYZLKTa5M2nY9GAKr/T4rdLS7Sraaq9Na9ATNPC9w4dKmM6iWqJp1+/Nwk0t5j4TnQm85yoijfJaDTeFXPj/HerWofvk+uDIkhrXMMCP676veQhHD0wQ8GUnWV7aa2Bv6xo46RqxaiSFNFaF0n/w10zOvIpLNLE+B8ffz2UAKicbEFP9ZE0+7V/SGetQzt1njvWysg2fvNAjbhaiCHYOqW8sUP898RXSSFQazFXDiETquL6YrBWInVLzYmpI0+4j5KpJ4uZiUa5dJFbzVkiLasSlOOt26avbR26yZQj9+5WQJnQk7Ymfb1v/cxzPXE0WLhBWpkI9Miufi7eomVU+OBQNHoIt7wGCrx1Bs56/SH6gw4gcghDFq4IqOsg3WB8izY9SxOdADecfYgpMyeSMp1liH+gc7FRO3lR7s7JrW7/KzVsEey1BSao/RJ3HmzWwZoo4gq9QlkOhgJfYurH4DtZ8lECB0Wx1Vlq7qrTLtj4xOCyLaOAoxSMnFttzKdEAms04+sjKFtlDKEL3nEWtrGLrdfxZTHzGEqCwLGu/2x2NLk2/gDoK1iCpJyQ1kJ76YBftbuwO+wQksfVfpO65KomDu+Y45CAHM/oHhZSHd/mfF2MmaGSn+eeZaREkAiPWVX+G9LiyyypbQuQrmyphagGQkonV4JO4WRWBra EnOJzdap rWKJoHcTuHzzgJwELqTXlXJkd42LrclLP07DgteMZiANm7ASk7nGNrMyEa+fsBLfGv3tcwdFpEQOZIVGMzQwGgsqfo6EvpV9OW13mMEi3hMN6tVU3YYP/usn9QlYxwSY9uqz2Dk/zdQxukRcYdqF8zPbAfR9L2YQYMW/gbcb6xPpkPx9cg6jBYTrNC8xyz1r0WFr7uxn11+5FlR3ttqxpdp8zBvkRo1XKI0EFMhcB2KIEqXC/93u3TLljwsgSj3bfrMygiJPwQfP7Tf4eF2dFNnLymH11/RiRHm4ZNqZaR0QLzkJyItmqmQCNV4kkiCOAv42D+F9CYUT6dtIdinfnpANBvDmV95IZ2BHGjJE/z0hoc+g= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Ever since the evenfd type was introduced back in 2007 in commit e1ad7468c77d ("signal/timer/event: eventfd core") the eventfd_signal() function only ever passed 1 as a value for @n. There's no point in keeping that additional argument. Signed-off-by: Christian Brauner Acked-by: Xu Yilun Reviewed-by: Jan Kara Acked-by: Eric Farman # s390 Reviewed-by: Stefan Hajnoczi Acked-by: Paolo Bonzini --- arch/x86/kvm/hyperv.c | 2 +- arch/x86/kvm/xen.c | 2 +- drivers/accel/habanalabs/common/device.c | 2 +- drivers/fpga/dfl.c | 2 +- drivers/gpu/drm/drm_syncobj.c | 6 +++--- drivers/gpu/drm/i915/gvt/interrupt.c | 2 +- drivers/infiniband/hw/mlx5/devx.c | 2 +- drivers/misc/ocxl/file.c | 2 +- drivers/s390/cio/vfio_ccw_chp.c | 2 +- drivers/s390/cio/vfio_ccw_drv.c | 4 ++-- drivers/s390/cio/vfio_ccw_ops.c | 6 +++--- drivers/s390/crypto/vfio_ap_ops.c | 2 +- drivers/usb/gadget/function/f_fs.c | 4 ++-- drivers/vdpa/vdpa_user/vduse_dev.c | 6 +++--- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c | 2 +- drivers/vfio/pci/vfio_pci_core.c | 6 +++--- drivers/vfio/pci/vfio_pci_intrs.c | 12 ++++++------ drivers/vfio/platform/vfio_platform_irq.c | 4 ++-- drivers/vhost/vdpa.c | 4 ++-- drivers/vhost/vhost.c | 10 +++++----- drivers/vhost/vhost.h | 2 +- drivers/virt/acrn/ioeventfd.c | 2 +- drivers/xen/privcmd.c | 2 +- fs/aio.c | 2 +- fs/eventfd.c | 9 +++------ include/linux/eventfd.h | 4 ++-- mm/memcontrol.c | 10 +++++----- mm/vmpressure.c | 2 +- samples/vfio-mdev/mtty.c | 4 ++-- virt/kvm/eventfd.c | 4 ++-- 30 files changed, 60 insertions(+), 63 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 238afd7335e4..4943f6b2bbee 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -2388,7 +2388,7 @@ static u16 kvm_hvcall_signal_event(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *h if (!eventfd) return HV_STATUS_INVALID_PORT_ID; - eventfd_signal(eventfd, 1); + eventfd_signal(eventfd); return HV_STATUS_SUCCESS; } diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index e53fad915a62..523bb6df5ac9 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -2088,7 +2088,7 @@ static bool kvm_xen_hcall_evtchn_send(struct kvm_vcpu *vcpu, u64 param, u64 *r) if (ret < 0 && ret != -ENOTCONN) return false; } else { - eventfd_signal(evtchnfd->deliver.eventfd.ctx, 1); + eventfd_signal(evtchnfd->deliver.eventfd.ctx); } *r = 0; diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c index 9711e8fc979d..3a89644f087c 100644 --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -2044,7 +2044,7 @@ static void hl_notifier_event_send(struct hl_notifier_event *notifier_event, u64 notifier_event->events_mask |= event_mask; if (notifier_event->eventfd) - eventfd_signal(notifier_event->eventfd, 1); + eventfd_signal(notifier_event->eventfd); mutex_unlock(¬ifier_event->lock); } diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index dd7a783d53b5..e73f88050f08 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -1872,7 +1872,7 @@ static irqreturn_t dfl_irq_handler(int irq, void *arg) { struct eventfd_ctx *trigger = arg; - eventfd_signal(trigger, 1); + eventfd_signal(trigger); return IRQ_HANDLED; } diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 01da6789d044..b9cc62982196 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -1365,7 +1365,7 @@ static void syncobj_eventfd_entry_fence_func(struct dma_fence *fence, struct syncobj_eventfd_entry *entry = container_of(cb, struct syncobj_eventfd_entry, fence_cb); - eventfd_signal(entry->ev_fd_ctx, 1); + eventfd_signal(entry->ev_fd_ctx); syncobj_eventfd_entry_free(entry); } @@ -1388,13 +1388,13 @@ syncobj_eventfd_entry_func(struct drm_syncobj *syncobj, entry->fence = fence; if (entry->flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE) { - eventfd_signal(entry->ev_fd_ctx, 1); + eventfd_signal(entry->ev_fd_ctx); syncobj_eventfd_entry_free(entry); } else { ret = dma_fence_add_callback(fence, &entry->fence_cb, syncobj_eventfd_entry_fence_func); if (ret == -ENOENT) { - eventfd_signal(entry->ev_fd_ctx, 1); + eventfd_signal(entry->ev_fd_ctx); syncobj_eventfd_entry_free(entry); } } diff --git a/drivers/gpu/drm/i915/gvt/interrupt.c b/drivers/gpu/drm/i915/gvt/interrupt.c index 9665876b4b13..7f4db438e400 100644 --- a/drivers/gpu/drm/i915/gvt/interrupt.c +++ b/drivers/gpu/drm/i915/gvt/interrupt.c @@ -454,7 +454,7 @@ static void inject_virtual_interrupt(struct intel_vgpu *vgpu) return; if (!vgpu->msi_trigger) return; - eventfd_signal(vgpu->msi_trigger, 1); + eventfd_signal(vgpu->msi_trigger); } static void propagate_event(struct intel_gvt_irq *irq, diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c index 8ba53edf2311..869369cb5b5f 100644 --- a/drivers/infiniband/hw/mlx5/devx.c +++ b/drivers/infiniband/hw/mlx5/devx.c @@ -2498,7 +2498,7 @@ static void dispatch_event_fd(struct list_head *fd_list, list_for_each_entry_rcu(item, fd_list, xa_list) { if (item->eventfd) - eventfd_signal(item->eventfd, 1); + eventfd_signal(item->eventfd); else deliver_event(item, data); } diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index ac69b7f361f5..7eb74711ac96 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -184,7 +184,7 @@ static irqreturn_t irq_handler(void *private) { struct eventfd_ctx *ev_ctx = private; - eventfd_signal(ev_ctx, 1); + eventfd_signal(ev_ctx); return IRQ_HANDLED; } diff --git a/drivers/s390/cio/vfio_ccw_chp.c b/drivers/s390/cio/vfio_ccw_chp.c index d3f3a611f95b..38c176cf6295 100644 --- a/drivers/s390/cio/vfio_ccw_chp.c +++ b/drivers/s390/cio/vfio_ccw_chp.c @@ -115,7 +115,7 @@ static ssize_t vfio_ccw_crw_region_read(struct vfio_ccw_private *private, /* Notify the guest if more CRWs are on our queue */ if (!list_empty(&private->crw) && private->crw_trigger) - eventfd_signal(private->crw_trigger, 1); + eventfd_signal(private->crw_trigger); return ret; } diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index 43601816ea4e..bfb35cfce1ef 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -112,7 +112,7 @@ void vfio_ccw_sch_io_todo(struct work_struct *work) private->state = VFIO_CCW_STATE_IDLE; if (private->io_trigger) - eventfd_signal(private->io_trigger, 1); + eventfd_signal(private->io_trigger); } void vfio_ccw_crw_todo(struct work_struct *work) @@ -122,7 +122,7 @@ void vfio_ccw_crw_todo(struct work_struct *work) private = container_of(work, struct vfio_ccw_private, crw_work); if (!list_empty(&private->crw) && private->crw_trigger) - eventfd_signal(private->crw_trigger, 1); + eventfd_signal(private->crw_trigger); } /* diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c index cba4971618ff..ea532a8a4a0c 100644 --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -421,7 +421,7 @@ static int vfio_ccw_mdev_set_irqs(struct vfio_ccw_private *private, case VFIO_IRQ_SET_DATA_NONE: { if (*ctx) - eventfd_signal(*ctx, 1); + eventfd_signal(*ctx); return 0; } case VFIO_IRQ_SET_DATA_BOOL: @@ -432,7 +432,7 @@ static int vfio_ccw_mdev_set_irqs(struct vfio_ccw_private *private, return -EFAULT; if (trigger && *ctx) - eventfd_signal(*ctx, 1); + eventfd_signal(*ctx); return 0; } case VFIO_IRQ_SET_DATA_EVENTFD: @@ -612,7 +612,7 @@ static void vfio_ccw_mdev_request(struct vfio_device *vdev, unsigned int count) "Relaying device request to user (#%u)\n", count); - eventfd_signal(private->req_trigger, 1); + eventfd_signal(private->req_trigger); } else if (count == 0) { dev_notice(dev, "No device request channel registered, blocked until released by user\n"); diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 4db538a55192..542b5be73a6a 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1794,7 +1794,7 @@ static void vfio_ap_mdev_request(struct vfio_device *vdev, unsigned int count) "Relaying device request to user (#%u)\n", count); - eventfd_signal(matrix_mdev->req_trigger, 1); + eventfd_signal(matrix_mdev->req_trigger); } else if (count == 0) { dev_notice(dev, "No device request registered, blocked until released by user\n"); diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index efe3e3b85769..fdd0fc7b8f25 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -831,7 +831,7 @@ static void ffs_user_copy_worker(struct work_struct *work) io_data->kiocb->ki_complete(io_data->kiocb, ret); if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) - eventfd_signal(io_data->ffs->ffs_eventfd, 1); + eventfd_signal(io_data->ffs->ffs_eventfd); if (io_data->read) kfree(io_data->to_free); @@ -2738,7 +2738,7 @@ static void __ffs_event_add(struct ffs_data *ffs, ffs->ev.types[ffs->ev.count++] = type; wake_up_locked(&ffs->ev.waitq); if (ffs->ffs_eventfd) - eventfd_signal(ffs->ffs_eventfd, 1); + eventfd_signal(ffs->ffs_eventfd); } static void ffs_event_add(struct ffs_data *ffs, diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c index 0ddd4b8abecb..6cb5ce4a8b9a 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -493,7 +493,7 @@ static void vduse_vq_kick(struct vduse_virtqueue *vq) goto unlock; if (vq->kickfd) - eventfd_signal(vq->kickfd, 1); + eventfd_signal(vq->kickfd); else vq->kicked = true; unlock: @@ -911,7 +911,7 @@ static int vduse_kickfd_setup(struct vduse_dev *dev, eventfd_ctx_put(vq->kickfd); vq->kickfd = ctx; if (vq->ready && vq->kicked && vq->kickfd) { - eventfd_signal(vq->kickfd, 1); + eventfd_signal(vq->kickfd); vq->kicked = false; } spin_unlock(&vq->kick_lock); @@ -960,7 +960,7 @@ static bool vduse_vq_signal_irqfd(struct vduse_virtqueue *vq) spin_lock_irq(&vq->irq_lock); if (vq->ready && vq->cb.trigger) { - eventfd_signal(vq->cb.trigger, 1); + eventfd_signal(vq->cb.trigger); signal = true; } spin_unlock_irq(&vq->irq_lock); diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c index c51229fccbd6..d62fbfff20b8 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c @@ -54,7 +54,7 @@ static irqreturn_t vfio_fsl_mc_irq_handler(int irq_num, void *arg) { struct vfio_fsl_mc_irq *mc_irq = (struct vfio_fsl_mc_irq *)arg; - eventfd_signal(mc_irq->trigger, 1); + eventfd_signal(mc_irq->trigger); return IRQ_HANDLED; } diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 1929103ee59a..1cbc990d42e0 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -443,7 +443,7 @@ static int vfio_pci_core_runtime_resume(struct device *dev) */ down_write(&vdev->memory_lock); if (vdev->pm_wake_eventfd_ctx) { - eventfd_signal(vdev->pm_wake_eventfd_ctx, 1); + eventfd_signal(vdev->pm_wake_eventfd_ctx); __vfio_pci_runtime_pm_exit(vdev); } up_write(&vdev->memory_lock); @@ -1883,7 +1883,7 @@ void vfio_pci_core_request(struct vfio_device *core_vdev, unsigned int count) pci_notice_ratelimited(pdev, "Relaying device request to user (#%u)\n", count); - eventfd_signal(vdev->req_trigger, 1); + eventfd_signal(vdev->req_trigger); } else if (count == 0) { pci_warn(pdev, "No device request channel registered, blocked until released by user\n"); @@ -2302,7 +2302,7 @@ pci_ers_result_t vfio_pci_core_aer_err_detected(struct pci_dev *pdev, mutex_lock(&vdev->igate); if (vdev->err_trigger) - eventfd_signal(vdev->err_trigger, 1); + eventfd_signal(vdev->err_trigger); mutex_unlock(&vdev->igate); diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index cbb4bcbfbf83..237beac83809 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -94,7 +94,7 @@ static void vfio_send_intx_eventfd(void *opaque, void *unused) ctx = vfio_irq_ctx_get(vdev, 0); if (WARN_ON_ONCE(!ctx)) return; - eventfd_signal(ctx->trigger, 1); + eventfd_signal(ctx->trigger); } } @@ -342,7 +342,7 @@ static irqreturn_t vfio_msihandler(int irq, void *arg) { struct eventfd_ctx *trigger = arg; - eventfd_signal(trigger, 1); + eventfd_signal(trigger); return IRQ_HANDLED; } @@ -689,11 +689,11 @@ static int vfio_pci_set_msi_trigger(struct vfio_pci_core_device *vdev, if (!ctx) continue; if (flags & VFIO_IRQ_SET_DATA_NONE) { - eventfd_signal(ctx->trigger, 1); + eventfd_signal(ctx->trigger); } else if (flags & VFIO_IRQ_SET_DATA_BOOL) { uint8_t *bools = data; if (bools[i - start]) - eventfd_signal(ctx->trigger, 1); + eventfd_signal(ctx->trigger); } } return 0; @@ -707,7 +707,7 @@ static int vfio_pci_set_ctx_trigger_single(struct eventfd_ctx **ctx, if (flags & VFIO_IRQ_SET_DATA_NONE) { if (*ctx) { if (count) { - eventfd_signal(*ctx, 1); + eventfd_signal(*ctx); } else { eventfd_ctx_put(*ctx); *ctx = NULL; @@ -722,7 +722,7 @@ static int vfio_pci_set_ctx_trigger_single(struct eventfd_ctx **ctx, trigger = *(uint8_t *)data; if (trigger && *ctx) - eventfd_signal(*ctx, 1); + eventfd_signal(*ctx); return 0; } else if (flags & VFIO_IRQ_SET_DATA_EVENTFD) { diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c index 665197caed89..61a1bfb68ac7 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -155,7 +155,7 @@ static irqreturn_t vfio_automasked_irq_handler(int irq, void *dev_id) spin_unlock_irqrestore(&irq_ctx->lock, flags); if (ret == IRQ_HANDLED) - eventfd_signal(irq_ctx->trigger, 1); + eventfd_signal(irq_ctx->trigger); return ret; } @@ -164,7 +164,7 @@ static irqreturn_t vfio_irq_handler(int irq, void *dev_id) { struct vfio_platform_irq *irq_ctx = dev_id; - eventfd_signal(irq_ctx->trigger, 1); + eventfd_signal(irq_ctx->trigger); return IRQ_HANDLED; } diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 30df5c58db73..8d9f958946d6 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -178,7 +178,7 @@ static irqreturn_t vhost_vdpa_virtqueue_cb(void *private) struct eventfd_ctx *call_ctx = vq->call_ctx.ctx; if (call_ctx) - eventfd_signal(call_ctx, 1); + eventfd_signal(call_ctx); return IRQ_HANDLED; } @@ -189,7 +189,7 @@ static irqreturn_t vhost_vdpa_config_cb(void *private) struct eventfd_ctx *config_ctx = v->config_ctx; if (config_ctx) - eventfd_signal(config_ctx, 1); + eventfd_signal(config_ctx); return IRQ_HANDLED; } diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index e0c181ad17e3..045f666b4f12 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -2248,7 +2248,7 @@ int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, len -= l; if (!len) { if (vq->log_ctx) - eventfd_signal(vq->log_ctx, 1); + eventfd_signal(vq->log_ctx); return 0; } } @@ -2271,7 +2271,7 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq) log_used(vq, (used - (void __user *)vq->used), sizeof vq->used->flags); if (vq->log_ctx) - eventfd_signal(vq->log_ctx, 1); + eventfd_signal(vq->log_ctx); } return 0; } @@ -2289,7 +2289,7 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq) log_used(vq, (used - (void __user *)vq->used), sizeof *vhost_avail_event(vq)); if (vq->log_ctx) - eventfd_signal(vq->log_ctx, 1); + eventfd_signal(vq->log_ctx); } return 0; } @@ -2715,7 +2715,7 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, log_used(vq, offsetof(struct vring_used, idx), sizeof vq->used->idx); if (vq->log_ctx) - eventfd_signal(vq->log_ctx, 1); + eventfd_signal(vq->log_ctx); } return r; } @@ -2763,7 +2763,7 @@ void vhost_signal(struct vhost_dev *dev, struct vhost_virtqueue *vq) { /* Signal the Guest tell them we used something up. */ if (vq->call_ctx.ctx && vhost_notify(dev, vq)) - eventfd_signal(vq->call_ctx.ctx, 1); + eventfd_signal(vq->call_ctx.ctx); } EXPORT_SYMBOL_GPL(vhost_signal); diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index f60d5f7bef94..9e942fcda5c3 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -249,7 +249,7 @@ void vhost_iotlb_map_free(struct vhost_iotlb *iotlb, #define vq_err(vq, fmt, ...) do { \ pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ if ((vq)->error_ctx) \ - eventfd_signal((vq)->error_ctx, 1);\ + eventfd_signal((vq)->error_ctx);\ } while (0) enum { diff --git a/drivers/virt/acrn/ioeventfd.c b/drivers/virt/acrn/ioeventfd.c index ac4037e9f947..4e845c6ca0b5 100644 --- a/drivers/virt/acrn/ioeventfd.c +++ b/drivers/virt/acrn/ioeventfd.c @@ -223,7 +223,7 @@ static int acrn_ioeventfd_handler(struct acrn_ioreq_client *client, mutex_lock(&client->vm->ioeventfds_lock); p = hsm_ioeventfd_match(client->vm, addr, val, size, req->type); if (p) - eventfd_signal(p->eventfd, 1); + eventfd_signal(p->eventfd); mutex_unlock(&client->vm->ioeventfds_lock); return 0; diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 1ce7f3c7a950..7efc0c62e984 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -1147,7 +1147,7 @@ static irqreturn_t ioeventfd_interrupt(int irq, void *dev_id) if (ioreq->addr == kioeventfd->addr + VIRTIO_MMIO_QUEUE_NOTIFY && ioreq->size == kioeventfd->addr_len && (ioreq->data & QUEUE_NOTIFY_VQ_MASK) == kioeventfd->vq) { - eventfd_signal(kioeventfd->eventfd, 1); + eventfd_signal(kioeventfd->eventfd); state = STATE_IORESP_READY; break; } diff --git a/fs/aio.c b/fs/aio.c index f8589caef9c1..5c5b09e52d75 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1166,7 +1166,7 @@ static void aio_complete(struct aio_kiocb *iocb) * from IRQ context. */ if (iocb->ki_eventfd) - eventfd_signal(iocb->ki_eventfd, 1); + eventfd_signal(iocb->ki_eventfd); /* * We have to order our ring_info tail store above and test diff --git a/fs/eventfd.c b/fs/eventfd.c index 33a918f9566c..dc9e01053235 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -74,20 +74,17 @@ __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask) /** * eventfd_signal - Adds @n to the eventfd counter. * @ctx: [in] Pointer to the eventfd context. - * @n: [in] Value of the counter to be added to the eventfd internal counter. - * The value cannot be negative. * * This function is supposed to be called by the kernel in paths that do not * allow sleeping. In this function we allow the counter to reach the ULLONG_MAX * value, and we signal this as overflow condition by returning a EPOLLERR * to poll(2). * - * Returns the amount by which the counter was incremented. This will be less - * than @n if the counter has overflowed. + * Returns the amount by which the counter was incremented. */ -__u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n) +__u64 eventfd_signal(struct eventfd_ctx *ctx) { - return eventfd_signal_mask(ctx, n, 0); + return eventfd_signal_mask(ctx, 1, 0); } EXPORT_SYMBOL_GPL(eventfd_signal); diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index b9d83652c097..562089431551 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -35,7 +35,7 @@ void eventfd_ctx_put(struct eventfd_ctx *ctx); struct file *eventfd_fget(int fd); struct eventfd_ctx *eventfd_ctx_fdget(int fd); struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); -__u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n); +__u64 eventfd_signal(struct eventfd_ctx *ctx); __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask); int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait, __u64 *cnt); @@ -58,7 +58,7 @@ static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd) return ERR_PTR(-ENOSYS); } -static inline int eventfd_signal(struct eventfd_ctx *ctx, __u64 n) +static inline int eventfd_signal(struct eventfd_ctx *ctx) { return -ENOSYS; } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 774bd6e21e27..dfbb1d3b77b7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4378,7 +4378,7 @@ static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap) * only one element of the array here. */ for (; i >= 0 && unlikely(t->entries[i].threshold > usage); i--) - eventfd_signal(t->entries[i].eventfd, 1); + eventfd_signal(t->entries[i].eventfd); /* i = current_threshold + 1 */ i++; @@ -4390,7 +4390,7 @@ static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap) * only one element of the array here. */ for (; i < t->size && unlikely(t->entries[i].threshold <= usage); i++) - eventfd_signal(t->entries[i].eventfd, 1); + eventfd_signal(t->entries[i].eventfd); /* Update current_threshold */ t->current_threshold = i - 1; @@ -4430,7 +4430,7 @@ static int mem_cgroup_oom_notify_cb(struct mem_cgroup *memcg) spin_lock(&memcg_oom_lock); list_for_each_entry(ev, &memcg->oom_notify, list) - eventfd_signal(ev->eventfd, 1); + eventfd_signal(ev->eventfd); spin_unlock(&memcg_oom_lock); return 0; @@ -4649,7 +4649,7 @@ static int mem_cgroup_oom_register_event(struct mem_cgroup *memcg, /* already in OOM ? */ if (memcg->under_oom) - eventfd_signal(eventfd, 1); + eventfd_signal(eventfd); spin_unlock(&memcg_oom_lock); return 0; @@ -4941,7 +4941,7 @@ static void memcg_event_remove(struct work_struct *work) event->unregister_event(memcg, event->eventfd); /* Notify userspace the event is going away. */ - eventfd_signal(event->eventfd, 1); + eventfd_signal(event->eventfd); eventfd_ctx_put(event->eventfd); kfree(event); diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 22c6689d9302..bd5183dfd879 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -169,7 +169,7 @@ static bool vmpressure_event(struct vmpressure *vmpr, continue; if (level < ev->level) continue; - eventfd_signal(ev->efd, 1); + eventfd_signal(ev->efd); ret = true; } mutex_unlock(&vmpr->events_lock); diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c index 69ba0281f9e0..2284b3751240 100644 --- a/samples/vfio-mdev/mtty.c +++ b/samples/vfio-mdev/mtty.c @@ -234,10 +234,10 @@ static void mtty_trigger_interrupt(struct mdev_state *mdev_state) if (is_msi(mdev_state)) { if (mdev_state->msi_evtfd) - eventfd_signal(mdev_state->msi_evtfd, 1); + eventfd_signal(mdev_state->msi_evtfd); } else if (is_intx(mdev_state)) { if (mdev_state->intx_evtfd && !mdev_state->intx_mask) { - eventfd_signal(mdev_state->intx_evtfd, 1); + eventfd_signal(mdev_state->intx_evtfd); mdev_state->intx_mask = true; } } diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 89912a17f5d5..c0e230f4c3e9 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -61,7 +61,7 @@ static void irqfd_resampler_notify(struct kvm_kernel_irqfd_resampler *resampler) list_for_each_entry_srcu(irqfd, &resampler->list, resampler_link, srcu_read_lock_held(&resampler->kvm->irq_srcu)) - eventfd_signal(irqfd->resamplefd, 1); + eventfd_signal(irqfd->resamplefd); } /* @@ -786,7 +786,7 @@ ioeventfd_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, gpa_t addr, if (!ioeventfd_in_range(p, addr, len, val)) return -EOPNOTSUPP; - eventfd_signal(p->eventfd, 1); + eventfd_signal(p->eventfd); return 0; } From patchwork Wed Nov 22 12:48:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13464775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A062C61D9B for ; Wed, 22 Nov 2023 12:49:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A26D6B0587; Wed, 22 Nov 2023 07:49:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 17A036B0593; Wed, 22 Nov 2023 07:49:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E98876B0597; Wed, 22 Nov 2023 07:49:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C65666B057F for ; Wed, 22 Nov 2023 07:49:55 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9123B140A70 for ; Wed, 22 Nov 2023 12:49:55 +0000 (UTC) X-FDA: 81485572350.20.FDF7BDC Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 054FC1C0012; Wed, 22 Nov 2023 12:49:52 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sH8Tm1wP; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700657393; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vOF3va85WJRYCguY66Nc0jO4xWpwyjTD0+xhuQmKNhc=; b=cN+uWy+E0adwhxA5IkWhxtDIAe+/QCvASxBl8cYDGPXYxCYxXO75hiAujXiX0ZrpWvoZRM 8gQRJvtC527w8mswtroYF7z+HkTQ4rTv2bQXv+vX3HSbyTMeaDY+wiqzci7K8fjHkPKSeW 5Og9W4lW0aTSWQS3XOJ6SyDtm/CsKoE= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sH8Tm1wP; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700657393; a=rsa-sha256; cv=none; b=fWba9Nyo6BWhSD9oOLwm8RkObVNTXo7SFL4D6itBLieCI8e7y6LFzyUAcSS+CL0NGTP+PG nj/aas5LJZ3+Pc/eB2BvOsJVrWuoawNLBDdvESIVXMv3NGzAigLWEmrPX58ptNkPro0HkG O3ZHwvfoLU0eyX7SGjnJ4QHo908PVb4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0ADFE61D62; Wed, 22 Nov 2023 12:49:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 917EAC433D9; Wed, 22 Nov 2023 12:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700657391; bh=hkU4HuuqkNDsQyioSQIrRKs3Tgv1T8STkBb7WyDQZe8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sH8Tm1wP4EJijR7jWPvNmVl3mBtGkN3wNNGbSdSvEFuMdvkY1E+QcVQvJITT2RIsW PEZ3zcrNhYwSEpVPHfg4a4zhavH8mDv02NXVgiIbz8f69fdg4BB2d9Zli1lRzYSb6z EhsClQyaa8F9yvudTBUtM4my+Rx0dMR0LAc+gsTxCigYWjUsjR3qlZZqilJVkyWppo yGn3YPu1G4hIzrWGGgQSL4WErzUbY4QLyvvdHlzbxEk04+A1PVD2meTrRkiqNGZrYf zKCJTM3AbkjVz3eM9Q0Xi3c64W42/3N1VaWB+hvIpTkCgb37ZYi4HaREDHPLbxjZgc W9uhC2VfgcM3w== From: Christian Brauner Date: Wed, 22 Nov 2023 13:48:24 +0100 Subject: [PATCH v2 3/4] eventfd: simplify eventfd_signal_mask() MIME-Version: 1.0 Message-Id: <20231122-vfs-eventfd-signal-v2-3-bd549b14ce0c@kernel.org> References: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> In-Reply-To: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Christoph Hellwig , Jan Kara , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, David Woodhouse , Paul Durrant , Oded Gabbay , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Leon Romanovsky , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , Eric Farman , Matthew Rosato , Halil Pasic , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Tony Krowiak , Jason Herne , Harald Freudenberger , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Diana Craciun , Alex Williamson , Eric Auger , Fei Li , Benjamin LaHaise , Christian Brauner , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Kirti Wankhede , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fpga@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-usb@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-aio@kvack.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Jens Axboe , Pavel Begunkov , io-uring@vger.kernel.org X-Mailer: b4 0.13-dev-26615 X-Developer-Signature: v=1; a=openpgp-sha256; l=3315; i=brauner@kernel.org; h=from:subject:message-id; bh=hkU4HuuqkNDsQyioSQIrRKs3Tgv1T8STkBb7WyDQZe8=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTG/liTnx+1a0vsCaGMN23r18xIsnV/pBwn1ZPp37Mqs 7FRsi+uo5SFQYyLQVZMkcWh3SRcbjlPxWajTA2YOaxMIEMYuDgFYCLd4YwMmxu+PXlzuflnQNcx jdSWzQFP5u+/ce54mkHTWs4J/1MYfRgZVub+qv3K3/m32t58z12JNyZxGoI5uyT1mLNNT0rt0T7 KCQA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspam-User: X-Stat-Signature: xnsnnt164wtuj4zp3eebwcjohdfpzkk1 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 054FC1C0012 X-HE-Tag: 1700657392-978428 X-HE-Meta: U2FsdGVkX194Q3Fcet5QJANMLxCH4KfVET/5VLYV0Fmu2v5imbUZlRE6s3JNqjUTx7S8yHUoCUt7qwoJWc2YaplK9O3aeuIh1x6JUimytDVZPU2ksLUSaxU8sxVoMw9W+UV6vdaaGdJo4JMB5z1BZuqg8BQtIOXDJxy3s9exWWl9AGjg9uBXcTASWHZh0E0xazdU165pBJfiVC3h2XO28C0GKWaP470AAA6QIBUtqLxIt+DujgyB8dDdz4+lfsEzeyvOYhVwbM6FtZ9vOR2sd464sVYScIC6bqgowtGURkhEI2lTzgqGN2j5dWMhD2nfHer1A2MBnWiC/NtG4bVhEE9YRXBxwZDISaoNKrztVGYMowJ9B9JbyAC7tW8KXsgU1tNv3pHTKbvMqD6Ob9H1SzZIS3XSMKqoHkjlFM+JoTqVS4sHrpm3kXMwR2T6djyKbn1hiFLjePKMXsR/Gt7eb3Zkdss2yqmtIaMZZRc6PM7Txt8XN6V+SSX0o8kAg8xzt7yCIj1t1jR4z3A5p+ND/V5+Rg6JIEDOjBMkFsbLDSS+qDO34RgLCEdoXivQxuWHcaSoLbYDKV6Dp+xujg80mt71cb/99ehJprZ/5/sweBwPuIQrRTz70K862dFw0zjAqqyN3gG9Y1mh6lczjA/laSgQ3qK543ZU9cxkS1CX5ZVzpvKZm0UQJ02hRherkijrwZaaOmLju8HMXOT7wcQvgshGXdtWrYJuimVJXZCU0jR/DXOt4G3AflYKBfK1Gbh4GKuVu+OXqD/dGnBt2YzKUh1ZkiIocL3Eau9IilNuNaXaMmFoXqx/Bu4b/km7KydHQmGmOpwyhb0RiJzbtxsIJOyYKkBVCYhHhTPcpxAIYrFHC5GflQPlWaHXr4VRE93Rnd4OILaUIhkVtZ9ngtKASYA8s6ODZ+2yGu4B96rKimWsXSmZWDQGNbC8rKGMwX3OXNgRcuIz9h9VRKKLjL0 8OMuw4YO EJqfQRY4ITnlalYsRQLc0QX+gh1NhdSuxG4NLZ15mZy2monJoOUDDo4xGcTuVdvhCPKF1dGCu3C+DeSt+23kmqvz3BvJoXYVxkKjt/ffSMY3sGorBFqoTM88rAR3xNrGoBRxU5J3Iuc7bicWEgu9ka5uXc+jsdss/wuFDNWNjfTgfg/hWGScPm3DtwZcOcJYU8t3SoJjJjtzX2gaaIiaDq0BwJtHHbrw4iEChb+Zs0LGGsiH+IxlDTxzllwJmSgvpKvhP5GcpRNwyb9ELaLr47sxWrznEiKsNzVU2s3i9HBxpsCYZE7K9dkoI8BGvNd2ZQx3TSHdcD/O2+rRBHdA4FVKZzW1X9sOPFZwr2hay6lDwd6JEPzQ4KTf19w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The eventfd_signal_mask() helper was introduced for io_uring and similar to eventfd_signal() it always passed 1 for @n. So don't bother with that argument at all. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/eventfd.c | 7 ++++--- include/linux/eventfd.h | 5 ++--- io_uring/io_uring.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/eventfd.c b/fs/eventfd.c index dc9e01053235..a9a6de920fb4 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -43,9 +43,10 @@ struct eventfd_ctx { int id; }; -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask) +__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) { unsigned long flags; + __u64 n = 1; /* * Deadlock or stack overflow issues can happen if we recurse here @@ -68,7 +69,7 @@ __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask) current->in_eventfd = 0; spin_unlock_irqrestore(&ctx->wqh.lock, flags); - return n; + return n == 1; } /** @@ -84,7 +85,7 @@ __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask) */ __u64 eventfd_signal(struct eventfd_ctx *ctx) { - return eventfd_signal_mask(ctx, 1, 0); + return eventfd_signal_mask(ctx, 0); } EXPORT_SYMBOL_GPL(eventfd_signal); diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 562089431551..4f8aac7eb62a 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -36,7 +36,7 @@ struct file *eventfd_fget(int fd); struct eventfd_ctx *eventfd_ctx_fdget(int fd); struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); __u64 eventfd_signal(struct eventfd_ctx *ctx); -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask); +__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask); int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait, __u64 *cnt); void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt); @@ -63,8 +63,7 @@ static inline int eventfd_signal(struct eventfd_ctx *ctx) return -ENOSYS; } -static inline int eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, - unsigned mask) +static inline int eventfd_signal_mask(struct eventfd_ctx *ctx, unsigned mask) { return -ENOSYS; } diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index ed254076c723..70170a41eac4 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -558,7 +558,7 @@ static void io_eventfd_ops(struct rcu_head *rcu) int ops = atomic_xchg(&ev_fd->ops, 0); if (ops & BIT(IO_EVENTFD_OP_SIGNAL_BIT)) - eventfd_signal_mask(ev_fd->cq_ev_fd, 1, EPOLL_URING_WAKE); + eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE); /* IO_EVENTFD_OP_FREE_BIT may not be set here depending on callback * ordering in a race but if references are 0 we know we have to free @@ -594,7 +594,7 @@ static void io_eventfd_signal(struct io_ring_ctx *ctx) goto out; if (likely(eventfd_signal_allowed())) { - eventfd_signal_mask(ev_fd->cq_ev_fd, 1, EPOLL_URING_WAKE); + eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE); } else { atomic_inc(&ev_fd->refs); if (!atomic_fetch_or(BIT(IO_EVENTFD_OP_SIGNAL_BIT), &ev_fd->ops)) From patchwork Wed Nov 22 12:48:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13464776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFED3C61D9C for ; Wed, 22 Nov 2023 12:50:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CFEE6B0597; Wed, 22 Nov 2023 07:50:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 880256B059D; Wed, 22 Nov 2023 07:50:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D0576B059B; Wed, 22 Nov 2023 07:50:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5795A6B0595 for ; Wed, 22 Nov 2023 07:50:12 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 331D1160B4F for ; Wed, 22 Nov 2023 12:50:12 +0000 (UTC) X-FDA: 81485573064.28.9DAA82C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id B636320022; Wed, 22 Nov 2023 12:50:09 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fcF4pxKR; spf=pass (imf13.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700657410; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lh2xy1TXIVxTvG8R+nv5DC9yuh9zLnuZywtO3N4UKH8=; b=Zm3MSkLOBIs25hD7Lj+vnFD/POwNwKJHaAEp9rlb08liSi+gK9eTsKOG05PIrCFDpaR2jp AgVK6PIKrE7WGlepDIItV3vC7s5m3gV/Rc6BwwuCyHMO8LfL/23HCIpjcgXrUt5xu42TnA sqmvqqvoZ0/pGHH6dzX1lxTxScAU4zM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700657410; a=rsa-sha256; cv=none; b=UfE96MXuK/NZYZescMnGYhF3IqDM5Pe34+/aEPtVgySRd4nJJXVjajEsAQQaKzBUlzlJou 70+96t7RdzPDxNX6Y9Y7B/Z6M+07DXOcjMyKqL/GHg71srWyksoHPhu/hFvquK3Pkts1YO na7ulUDHDiojQU7OIk3fC5YhCatAFaI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fcF4pxKR; spf=pass (imf13.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E3FAD61DBA; Wed, 22 Nov 2023 12:50:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 467BDC433CB; Wed, 22 Nov 2023 12:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700657408; bh=aU2J72Xp3JKGs0IOk/3BX7BmnbVjjSktFzc5W0fL98s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fcF4pxKRziGSAF2FOqxImPOzC2PEVz+iXrlHdDaPyM6/v6o+f16jjdAN+lC2pUX0Z c6Vj4pEReJ7qSGBsgd/Etcb/Bx/NFbs8vsXFZDe0htqh1OD5+o81eDXmshIPtuoyBK lUfl8SFejNcIDe347vDzewRE22FCt1MWsk2CM4stuQE/3LK9tJj9skrI0zg5sl10Ot aC+S7ghlxwZ2rYR03/mACnTcLYZ3VnGDGFga1iJsrVdoW+9CIorT0HYAGwO2anWZen uIJ0oJqCh8DfwGg5lQlRhQShmsIUNUkRjdY2uwh1ov0dsfb3jgNLqtI1PY54/gVbLF del/29joBTz5A== From: Christian Brauner Date: Wed, 22 Nov 2023 13:48:25 +0100 Subject: [PATCH v2 4/4] eventfd: make eventfd_signal{_mask}() void MIME-Version: 1.0 Message-Id: <20231122-vfs-eventfd-signal-v2-4-bd549b14ce0c@kernel.org> References: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> In-Reply-To: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Christoph Hellwig , Jan Kara , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, David Woodhouse , Paul Durrant , Oded Gabbay , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Leon Romanovsky , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , Eric Farman , Matthew Rosato , Halil Pasic , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Tony Krowiak , Jason Herne , Harald Freudenberger , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Diana Craciun , Alex Williamson , Eric Auger , Fei Li , Benjamin LaHaise , Christian Brauner , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Kirti Wankhede , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fpga@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-usb@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-aio@kvack.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Jens Axboe , Pavel Begunkov , io-uring@vger.kernel.org X-Mailer: b4 0.13-dev-26615 X-Developer-Signature: v=1; a=openpgp-sha256; l=3854; i=brauner@kernel.org; h=from:subject:message-id; bh=aU2J72Xp3JKGs0IOk/3BX7BmnbVjjSktFzc5W0fL98s=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTG/lj73/5dRNiNYIfwQ9VnNb8kSHjtMQlc94/11mwNB qlLZUUiHaUsDGJcDLJiiiwO7Sbhcst5KjYbZWrAzGFlAhnCwMUpABP5zcjwh+t1UN76vf945tSW T/rxjCHQpq4w94r2Zqm/ATIn/7GqSjMyvH01XYi3/rDPbk7Hf182bChuXbCzsfD2+Wr+47+PXN/ CxAMA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Queue-Id: B636320022 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: b13os6xckdnf8fhwxxpngi4b6ugnak7u X-HE-Tag: 1700657409-43352 X-HE-Meta: U2FsdGVkX1/j/Q+92m4Y9c91cLbEC05Vrr+HTXmFyaVbPkFtNgAyvX9hZf/KuRAh5GKHB648hdWJZFQ+HJBMXQPIAZtZZOcUZx1PDqRxtOLdEuigZzofFXiWYhtucfkXlQwLGpORb2RPBABbFu1ZgMWipIWmE55EGryoU+PV4IPa/BD+s4gM8mkj9usy76jaFyviy7BIjpqLo8RJNAU9zjZn+iCQkL4tlH0ugVlGXlxcSW5sUK27fUsgN2UC2BizNNEWH1WeQza/EYpIL+VoerUyGGxvQzoEmgy1PwKWsAh4/Z9J+PSY+UwXCBzCuMGbS7yjhiuIK2J2b+TtcJB9+ZgSYlCRyOB3WYc5pBvYlujgREDfkaaR/x+w3lqkUynA4M/eDKgY+prDDUI+BSy0aZezvIuwrkoGUIA+PQFsqJjiJ3pTxP/fQ5m2kK4YH6um5VhbZbIwdreQ9WdTTSpw/kXV7MnEMD8VK5vT4ph8q1tPV1bBhxoAx7G00za48C+rJ+BVxQj9a4eJs1v+/NzrsO12W3fMnslCqWCMzynylGPtnk9e75MLzXYzWIYa5csoU1SmPnztygcqPagrcrzur9iQtNFE+t4QVODXDNyzoTSLhb6Hggp6ly9HinYmB/EUBJghGTFf/xrwjEpxyqVgU583Ws5RbX8DW0VcI77jRofmfgiVs+kC5qCY/hwrkhcUT2703p9j8j07LazVU5eSSWqrafYJzvwm5f4Gqw+f0wf6qDSQO2YnLt4uQxINKWiqh1IfuFw0KULrpE7zWEM2hiOiiuIE+Fc9ZUhN9gNtnIAJEA8tMEHSI8eN4UTE0zO4LRXB9MU0ONwIV6xV2Mtd9LkrPZMcr59dqXKaHrtoAGDAEw4G1VkmdJiwOYnv5SaBjxTTBTIiUvRr2vdGvnH5/CbRDsp5XKXwDOHwlr5AFe1TLLol0nDtGQVyvT8FBulyuWfnuOkyaxpgBK/7HW1 hgY6b+1k D3ep3O2WgkZR4lwsZECZYDqlwYnf++qJyKK5KTa2RCilPYRgXUHDAXJzYEcYEg+Px8Q5XpA+K6oFu035NSua/AJYgAHIBxprgxsR6k1WafqylMe5E0g0Cj/Tcgirv0n8jNZj8NF2x9f4txn/+JaMNWi9BOKaKLTwOhwEBKyi/swk3OWcH7PiLkGoCHGCzHVSf3kcAE5Wk9DBWAwu1BuO2aTPFsaRH/GhMK02MNRQkcI+xY7lgwiXFTjKxTwDYEpHOzsplNKWUud7RB2RsE760MD6bKt/T3nu/EuH2p5V1WeVuLENRL97AGOddAF2b863H9nkHocFHs+luqSWuhe2y41I5+yXpFyb0vr4bJQyJGW7Aytf/VeutV9CXUA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: No caller care about the return value. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/eventfd.c | 40 +++++++++++++++------------------------- include/linux/eventfd.h | 16 +++++++--------- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/fs/eventfd.c b/fs/eventfd.c index a9a6de920fb4..13be2fb7fc96 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -43,10 +43,19 @@ struct eventfd_ctx { int id; }; -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) +/** + * eventfd_signal - Adds @n to the eventfd counter. + * @ctx: [in] Pointer to the eventfd context. + * @mask: [in] poll mask + * + * This function is supposed to be called by the kernel in paths that do not + * allow sleeping. In this function we allow the counter to reach the ULLONG_MAX + * value, and we signal this as overflow condition by returning a EPOLLERR + * to poll(2). + */ +void eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) { unsigned long flags; - __u64 n = 1; /* * Deadlock or stack overflow issues can happen if we recurse here @@ -57,37 +66,18 @@ __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) * safe context. */ if (WARN_ON_ONCE(current->in_eventfd)) - return 0; + return; spin_lock_irqsave(&ctx->wqh.lock, flags); current->in_eventfd = 1; - if (ULLONG_MAX - ctx->count < n) - n = ULLONG_MAX - ctx->count; - ctx->count += n; + if (ctx->count < ULLONG_MAX) + ctx->count++; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLIN | mask); current->in_eventfd = 0; spin_unlock_irqrestore(&ctx->wqh.lock, flags); - - return n == 1; -} - -/** - * eventfd_signal - Adds @n to the eventfd counter. - * @ctx: [in] Pointer to the eventfd context. - * - * This function is supposed to be called by the kernel in paths that do not - * allow sleeping. In this function we allow the counter to reach the ULLONG_MAX - * value, and we signal this as overflow condition by returning a EPOLLERR - * to poll(2). - * - * Returns the amount by which the counter was incremented. - */ -__u64 eventfd_signal(struct eventfd_ctx *ctx) -{ - return eventfd_signal_mask(ctx, 0); } -EXPORT_SYMBOL_GPL(eventfd_signal); +EXPORT_SYMBOL_GPL(eventfd_signal_mask); static void eventfd_free_ctx(struct eventfd_ctx *ctx) { diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 4f8aac7eb62a..fea7c4eb01d6 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -35,8 +35,7 @@ void eventfd_ctx_put(struct eventfd_ctx *ctx); struct file *eventfd_fget(int fd); struct eventfd_ctx *eventfd_ctx_fdget(int fd); struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); -__u64 eventfd_signal(struct eventfd_ctx *ctx); -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask); +void eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask); int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait, __u64 *cnt); void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt); @@ -58,14 +57,8 @@ static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd) return ERR_PTR(-ENOSYS); } -static inline int eventfd_signal(struct eventfd_ctx *ctx) +static inline void eventfd_signal_mask(struct eventfd_ctx *ctx, unsigned mask) { - return -ENOSYS; -} - -static inline int eventfd_signal_mask(struct eventfd_ctx *ctx, unsigned mask) -{ - return -ENOSYS; } static inline void eventfd_ctx_put(struct eventfd_ctx *ctx) @@ -91,5 +84,10 @@ static inline void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt) #endif +static inline void eventfd_signal(struct eventfd_ctx *ctx) +{ + eventfd_signal_mask(ctx, 0); +} + #endif /* _LINUX_EVENTFD_H */