Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp24965pxb; Wed, 18 Nov 2020 15:28:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjAs9SgJhlAhN80mBL928xJMhwNhGUKnsLTs3p2v9CkzSKXJMNLNeNDCZ5uawoKnTR0tQi X-Received: by 2002:aa7:d407:: with SMTP id z7mr28962588edq.234.1605742082365; Wed, 18 Nov 2020 15:28:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605742082; cv=none; d=google.com; s=arc-20160816; b=K2QayPsnzQ/00eSh3arzP8Wg5ap1EXIx+5pGPi6v53ZjFcg+iuMeBkAOBGwyxsFV8f 2/RdBm45rZ/6pUMZkZ8yB02Qj121S3+WjKgvariBvtT81ZbApY2tJmMhGrIoMqhbgGTJ L+MOhH/ljkFavWoZJclyah6d+TOAIswyM9l3q8KhOh05vsxGajRxcIUE2I7mGnL2nLsi DRWWgCDmew85Ed490HZ4FrTQo7r42gH6/aUKXNz6pgNENN5F6X7q9GVoa07y65JUnxMk GhQKXxMciriBB7d4te0UB8Tcb+oJwDR5OZQDgK1egx9cRH8m8SpllbSp29qwC0z5FKSE 1zlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=iVPm75HCejAbfrsPX/m4lDspW5RIkaFULkWaEI+VKIw=; b=gZm+m5UPdiWZmHZPDH98yTlKMygl/WwETbf8qGmEeaQo8W1mDXmNgtWYUlegbccz00 DRMjetG56ArTavxS9AVPBq0idDa0CW6G6aRBFg+B+bNFHRYTRii+LpOqYlozwMiS/sE6 MEaVWYtAM3/IpXBQ3b8JsnPaTzJxkQgSFn2Dqe+8UAWYJtSOeD85hvvyNcSqBIEDFsRP suT2tRXI9sr6obPRaHEnnUECr0Yt+PkZ2CCe4X4LAUkYwithk1OsKR8Tm4xpPmVklGhk 3KyyvzBHyCbOc1jZxCFKv42TJ3RVVZ1bv4pE7ToXHuGC3PvSpRBdcBmuEJQxEvm4BQuM aX2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=sCl5Zm2C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si15907722ejc.351.2020.11.18.15.27.39; Wed, 18 Nov 2020 15:28:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=sCl5Zm2C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726889AbgKRXZk (ORCPT + 99 others); Wed, 18 Nov 2020 18:25:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbgKRXZj (ORCPT ); Wed, 18 Nov 2020 18:25:39 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3784C0613D4 for ; Wed, 18 Nov 2020 15:25:39 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id 131so2600070pfb.9 for ; Wed, 18 Nov 2020 15:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=iVPm75HCejAbfrsPX/m4lDspW5RIkaFULkWaEI+VKIw=; b=sCl5Zm2CR6tiUD87M2YHG8Fe+rfguExcgnvmDaoLUyknnQcaTKbNTRwyTkqMfkrzwv pSDEwDwKtNKsdSuXNu8mPzscp50kLawU+n0Ud/rb76ctnxugAFSudElUer/qKEWSgq87 hydsMrdqBN+AUvIyFmgy3QsmgMTddhIv2jmuQ7Oq0sdh1+2VSn2iZBvtGkU3EnLGXjkh v5o0ecQ1coCrB+exxBEbGj0XknMe6MHuKt/gytC32OB+xoxrC/V9oxH+6XdUKvCwn8hc UNY6T6W8tsg+UH+1yEEJympbB03icjyYuvx0GXr3jrNPXsI//lYAm/Y7iBf2wi6BeZtO 6PXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iVPm75HCejAbfrsPX/m4lDspW5RIkaFULkWaEI+VKIw=; b=Toqerkh2v3NblAND/Qhk7R6YrxML6gp2MuAV2elcW7vbPTK0X+bce9CjhXFNvZT+ws ZdKnDH3jCLbICbSQne8gWsVJtk1LNHzUiFds/LDpRn/XhG2vRbH/TRS/mZ460E1kKvDP fkm0+4+SVJu4uahrA78BtiWx9JIVksgMMl8Mc3NKMAQ3nc1anm/YNyZhum0qfyb/7vxO yqyZ3RKYCQ8aR1T+64eDEZXpzfY9TvQ55SScRQYI+LtQOGgijreMOh8qvISZfrivVblS 34ofM0iDyC5YcnC/O8JL1UTQBvkatgo9txthYKU/hr+5uAVPLVdEws1pX/Jt7yWsD6i1 9ZZQ== X-Gm-Message-State: AOAM533KQmJFAhT/O1Up0Kg2QoU5TaUmngdyyOXWIioKHSduJqlVR6pm Wb3bxNJXXfrGjvh/Ww4WdqPyd6SoPTb63w== X-Received: by 2002:a17:90b:f10:: with SMTP id br16mr1336797pjb.60.1605741938998; Wed, 18 Nov 2020 15:25:38 -0800 (PST) Received: from [192.168.1.134] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id k9sm25833590pfi.188.2020.11.18.15.25.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Nov 2020 15:25:38 -0800 (PST) Subject: Re: [PATCH] eventfd: convert to ->write_iter() To: Michal Kubecek Cc: Christoph Hellwig , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <8a4f07e6ec47b681a32c6df5d463857e67bfc965.1605690824.git.mkubecek@suse.cz> <20201118151806.GA25804@infradead.org> <20201118195936.p33qlcjc7gp2zezz@lion.mk-sys.cz> <4e4d222c-ed8b-a40d-0cdc-cf152573645c@kernel.dk> <20201118231835.u6hqivoayq5ej4vg@lion.mk-sys.cz> From: Jens Axboe Message-ID: <7323253d-003a-456c-166c-d85a614c8bf6@kernel.dk> Date: Wed, 18 Nov 2020 16:25:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201118231835.u6hqivoayq5ej4vg@lion.mk-sys.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/18/20 4:18 PM, Michal Kubecek wrote: > On Wed, Nov 18, 2020 at 02:27:08PM -0700, Jens Axboe wrote: >> On 11/18/20 12:59 PM, Michal Kubecek wrote: >>> On Wed, Nov 18, 2020 at 03:18:06PM +0000, Christoph Hellwig wrote: >>>> On Wed, Nov 18, 2020 at 10:19:17AM +0100, Michal Kubecek wrote: >>>>> While eventfd ->read() callback was replaced by ->read_iter() recently, >>>>> it still provides ->write() for writes. Since commit 4d03e3cc5982 ("fs: >>>>> don't allow kernel reads and writes without iter ops"), this prevents >>>>> kernel_write() to be used for eventfd and with set_fs() removal, >>>>> ->write() cannot be easily called directly with a kernel buffer. >>>>> >>>>> According to eventfd(2), eventfd descriptors are supposed to be (also) >>>>> used by kernel to notify userspace applications of events which now >>>>> requires ->write_iter() op to be available (and ->write() not to be). >>>>> Therefore convert eventfd_write() to ->write_iter() semantics. This >>>>> patch also cleans up the code in a similar way as commit 12aceb89b0bc >>>>> ("eventfd: convert to f_op->read_iter()") did in read_iter(). >>>> >>>> A far as I can tell we don't have an in-tree user that writes to an >>>> eventfd. We can merge something like this once there is a user. >>> >>> As far as I can say, we don't have an in-tree user that reads from >>> sysctl. But you not only did not object to commit 4bd6a7353ee1 ("sysctl: >>> Convert to iter interfaces") which adds ->read_iter() for sysctl, that >>> commit even bears your Signed-off-by. There may be other examples like >>> that. >> >> A better justification for this patch is that users like io_uring can >> potentially write non-blocking to the file if ->write_iter() is >> supported. > > So you think the patch could be accepted with a modified commit message? > (As long as there are no technical issues, of course.) I did not really > expect there would be so much focus on a justification for a patch which > (1) converts f_ops to a more advanced (and apparently preferred) > interface and (2) makes eventfd f_ops more consistent. > > For the record, my original motivation for this patch was indeed an out > of tree module (not mine) using kernel write to eventfd. But that module > can be patched to use eventfd_signal() instead and it will have to be > patched anyway unless eventfd allows kernel_write() in 5.10 (which > doesn't seem likely). So if improving the code is not considered > sufficient to justify the patch, I can live with that easily. My point is that improving eventfd writes from io_uring is a win with this patch, whereas enabling kernel_write() makes people more nervous, and justifiably so as your stated use case is some out of tree module. So yeah, I'd focus on the former and not the latter, as it is actually something I'd personally like to see... -- Jens Axboe