Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2921146ybi; Thu, 18 Jul 2019 17:19:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmUwsQQLG0UE8RIXHbs7pdhljGnwZZM/liDt+2SUbmjLSQNpb2sWNgN4t3H/ndyXALfMyA X-Received: by 2002:a17:90a:32c7:: with SMTP id l65mr54334346pjb.1.1563495561628; Thu, 18 Jul 2019 17:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563495561; cv=none; d=google.com; s=arc-20160816; b=HXGw4JUyP4LqXgbH41esr2XEBxXjOiZMQ6xknkVuAct+St2zt4rCAY/m2+OrziKccY uySBREIyLg/8ZrJCk8WKSIFtB634JVquXtycMw5kEAP1mZM44Vdb+Oi40pDIhEP8am/3 eM1Ly7wDydO7AHoujptQE8RFih0cYVolPIOk6pKfa+loXaLfQ3mavgif0YDhGoUyUDsH BEdYF6wRdG0cw4h36W3pUAk/2jluIWGKFooUPMi4qAlnCWqgtGqudR+XXlHzEMXvXWZL d62cx/x/NOKzyDawvlZcuvjXdre+f1fcgP07xaFfA5OMVTh2E2+zEG0mpBABbyChbRT+ x38A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OQEz+Y23NGEmYdMz9oJcrnfQPF32BFHCXhMqemi5dgc=; b=ZO8VV7ASWAxx9IuJIDrg/0OnFnDCL+O5dGVlAz/Wa/MWcPikHkQjTh2+leycfg7ZOw 7sy0Rw4l/2HwTJesXNsIym9RepWNdDkgaZQdyP9JBNEQuApDo5lY4+Bv7QfV/amw2SuL +A877BHCNK8HbHkEprz/TUsoUiboZ6TyfbZisNuf0R7enOLTsg7JCNobhv+svsCpPFuu MxS7IU48ko8q7gMiBbAadciTvoc9YoZfCEXfL568oZm+d4zCCXoi1gTF5W26jO5BH/7T F7y38g7C2HsL7c3qtjgxsqGwK9j4Sl4C66V2ljtGlZ6EHYVtzau9nxp0vpkmCekAv+TI 5wUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si607945pfl.279.2019.07.18.17.19.03; Thu, 18 Jul 2019 17:19:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726131AbfGSARV (ORCPT + 99 others); Thu, 18 Jul 2019 20:17:21 -0400 Received: from kanga.kvack.org ([205.233.56.17]:50944 "EHLO kanga.kvack.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbfGSARV (ORCPT ); Thu, 18 Jul 2019 20:17:21 -0400 X-Greylist: delayed 1256 seconds by postgrey-1.27 at vger.kernel.org; Thu, 18 Jul 2019 20:17:21 EDT Received: by kanga.kvack.org (Postfix, from userid 63042) id 3889F6B0006; Thu, 18 Jul 2019 19:56:16 -0400 (EDT) Date: Thu, 18 Jul 2019 19:56:16 -0400 From: Benjamin LaHaise To: Bjorn Andersson Cc: Al Viro , linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] aio: Support read/write with non-iter file-ops Message-ID: <20190718235616.GM29731@kvack.org> References: <20190718231054.8175-1-bjorn.andersson@linaro.org> <20190718231751.GV17978@ZenIV.linux.org.uk> <20190718234352.GN30636@minitux> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190718234352.GN30636@minitux> User-Agent: Mutt/1.4.2.2i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 18, 2019 at 04:43:52PM -0700, Bjorn Andersson wrote: > On Thu 18 Jul 16:17 PDT 2019, Al Viro wrote: > > > On Thu, Jul 18, 2019 at 04:10:54PM -0700, Bjorn Andersson wrote: > > > Implement a wrapper for aio_read()/write() to allow async IO on files > > > not implementing the iter version of read/write, such as sysfs. This > > > mimics how readv/writev uses non-iter ops in do_loop_readv_writev(). > > > > IDGI. How would that IO manage to be async? And what's the point > > using aio in such situations in the first place? > > The point is that an application using aio to submit io operations on a > set of files, can use the same mechanism to read/write files that > happens to be implemented by driver only implementing read/write (not > read_iter/write_iter) in the registered file_operations struct, such as > kernfs. > > In this particular case I have a sysfs file that is accessing hardware > and hence will block for a while and using this patch I can io_submit() > a write and handle the completion of this in my normal event loop. > > > Each individual io operation will be just as synchronous as the current > iter-based mechanism - for the drivers that implement that. Just adding the fops is not enough. I have patches floating around at Solace that add thread based fallbacks for files that don't have an aio read / write implementation, but I'm not working on that code any more. The thread based methods were quite useful in applications that had a need for using other kernel infrastructure in their main event loops. -ben > Regards, > Bjorn > -- "Thought is the essence of where you are now."