Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp21800pxb; Wed, 18 Nov 2020 15:22:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwY0eGj+SeiDwee2OWjxfHDp05/7MdhkIP1RwmNr8SlxIdr096usBLqVWqu24g6tgT+mw1M X-Received: by 2002:a50:d5dd:: with SMTP id g29mr28089396edj.344.1605741743087; Wed, 18 Nov 2020 15:22:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605741743; cv=none; d=google.com; s=arc-20160816; b=wzo4vXJpFey6YHx+8mYZ3LEn2vC+WtwDCVDZPRAhgaDe+POwqoanZtnwwkvviE+bh7 fS4VMe0y2nTzCqFCbIwYqpWkPEko3b5JmDPlPaEBzkzRjw5tJIjjiZ+NtVJ09A2bsoqr dbkyb7koRn50kVBSuporK/tooPZFxmr314fdXJOFkg1/d0SpYNwnUO1TWBA25YYOtmTY N0Va47AO9eZLAL6aOv3RF5Q7/QVqQ77XARygzuMQ4C2Fu5Y8Kzj7inFDndnRUM3zC2/V 6pMFuzQoQZacHZYBwLQl9cwM21qbbgRSA3UK7TNiyTdtvo3wgXrwXSdCEYGkUFdv15y4 4+wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=RMGRcQHfQ/cuS0HIuKqbr+XaK+zUQEPh+TGlPKkBoGY=; b=PG3pEQTp+c0xFlvYGRc3PR4pne9T5AWdgQ2IgMAXSGYTMsdWxwqa49gLe92NgH6XEs PVRxKfn+Eqizz1UKWJe7OTPLmtTQRGstAPjX3Z+ACiUOtzPNn2nCyCNwZZFH0DlkQXVb pWN/dP7B9+QUGh6imZc9DO0KUQprkRDcEFWzO0qBLLUXNJyActJ70zhqOFFPCs8WWlTn cvExLVprjh7GF5SXck3FU5zrwimIPmxpwRQrvq/EOBlM7/bKHF/phQkBLm93nWFsdctF X5mvLkvAhcylcmxHYJk874moL5mKrOmGOWvC8J/Ukip32CjuF5jSnyiAhtjuPwSXkDeq xSWA== ARC-Authentication-Results: i=1; mx.google.com; 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 dn20si1560262ejc.47.2020.11.18.15.21.59; Wed, 18 Nov 2020 15:22:23 -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; 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 S1726503AbgKRXSi (ORCPT + 99 others); Wed, 18 Nov 2020 18:18:38 -0500 Received: from mx2.suse.de ([195.135.220.15]:47926 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbgKRXSi (ORCPT ); Wed, 18 Nov 2020 18:18:38 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3BB50B1E1; Wed, 18 Nov 2020 23:18:36 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id EEC2D603F9; Thu, 19 Nov 2020 00:18:35 +0100 (CET) Date: Thu, 19 Nov 2020 00:18:35 +0100 From: Michal Kubecek To: Jens Axboe Cc: Christoph Hellwig , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] eventfd: convert to ->write_iter() Message-ID: <20201118231835.u6hqivoayq5ej4vg@lion.mk-sys.cz> References: <8a4f07e6ec47b681a32c6df5d463857e67bfc965.1605690824.git.mkubecek@suse.cz> <20201118151806.GA25804@infradead.org> <20201118195936.p33qlcjc7gp2zezz@lion.mk-sys.cz> <4e4d222c-ed8b-a40d-0cdc-cf152573645c@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e4d222c-ed8b-a40d-0cdc-cf152573645c@kernel.dk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Michal Kubecek