From owner-freebsd-current@FreeBSD.ORG Wed Apr 1 08:29:09 2015 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA54A1B3; Wed, 1 Apr 2015 08:29:09 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31B0169B; Wed, 1 Apr 2015 08:29:09 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t318T48S042800 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 1 Apr 2015 11:29:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t318T48S042800 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t318T3KP042799; Wed, 1 Apr 2015 11:29:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Apr 2015 11:29:03 +0300 From: Konstantin Belousov To: "Kenneth D. Merry" Subject: Re: async pass(4) patches available Message-ID: <20150401082903.GW2379@kib.kiev.ua> References: <20150330222358.GA46342@mithlond.kdm.org> <20150331004912.GM2379@kib.kiev.ua> <20150331225051.GA64520@mithlond.kdm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150331225051.GA64520@mithlond.kdm.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: current@freebsd.org, scsi@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2015 08:29:09 -0000 On Tue, Mar 31, 2015 at 04:50:51PM -0600, Kenneth D. Merry wrote: > On Tue, Mar 31, 2015 at 03:49:12 +0300, Konstantin Belousov wrote: > > On Mon, Mar 30, 2015 at 04:23:58PM -0600, Kenneth D. Merry wrote: > > > Kernel memory for data transferred via the queued interface is > > > allocated from the zone allocator in MAXPHYS sized chunks, and user > > > data is copied in and out. This is likely faster than the > > > vmapbuf()/vunmapbuf() method used by the CAMIOCOMMAND ioctl in > > > configurations with many processors (there are more TLB shootdowns > > > caused by the mapping/unmapping operation) but may not be as fast > > > as running with unmapped I/O. > > cam_periph_mapmem() uses vmapbuf() with an indicator to always map the > > user pages mostly because I do not know CAM code and wanted to make > > the least intrusive changes there. It is not inherently impossible > > to pass unmapped pages down from cam_periph_mapmem(), but might > > require some more plumbing for driver to indicate that it is acceptable. > > I think that would probably not be too difficult to change. That API isn't > one that is exposed, so changing it shouldn't be a problem. The only > reason not to do unmapped I/O there is just if the underlying controller > doesn't support it. The lower parts of the stack shouldn't be trying to > sniff the data that is read or written to the device, although that has > happened in the past. We'd have to audit a couple of the drivers to > make sure they aren't trying to access the data. This is why I mentioned 'plumbing' required to map pages when needed. > > > > The new memory handling model for user requests also allows > > > applications to send CCBs with request sizes that are larger than > > > MAXPHYS. The pass(4) driver now limits queued requests to the I/O > > > size listed by the SIM driver in the maxio field in the Path > > > Inquiry (XPT_PATH_INQ) CCB. > > > > > > There are some things things would be good to add: > > > > > > 1. Come up with a way to do unmapped I/O on multiple buffers. > > > Currently the unmapped I/O interface operates on a struct bio, > > > which includes only one address and length. It would be nice > > > to be able to send an unmapped scatter/gather list down to > > > busdma. This would allow eliminating the copy we currently do > > > for data. > > Only because nothing more was needed. The struct bio does not use > > address/length pair when unmapped, it passes the list of physical > > pages, see bio_ma array pointer. It is indeed taylored to be a pointer > > to struct buf' b_pages, but it does not have to be. > > > > The busdma unmapped non-specific interface is bus_dmamap_load_ma(), > > which again takes array of pages to load. If you want some additional > > helper, suitable for your goals, please provide the desired interface > > definition. > > What I'd like to be able to do is pass down a CCB with a user virtual > S/G list (CAM_DATA_SG, but with user virtual pointers) and have busdma deal > with it. Is there an existing definition of the 'user s/g list' ? Some structure, or existing example of use ? > > The trouble would likely be figuring out a flag to use to indicate that the > S/G list in question contains user virtual pointers. (Backwards/binary > compatibility is always an issue with CCB flags, since they have all been > used.) > > But that is essentially what is needed. > I can write the code, but I need API specification. Also, ideally I need a rough example which uses the API.