Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968700AbdD0X3k (ORCPT ); Thu, 27 Apr 2017 19:29:40 -0400 Received: from ale.deltatee.com ([207.54.116.67]:58545 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932644AbdD0X3f (ORCPT ); Thu, 27 Apr 2017 19:29:35 -0400 To: Jason Gunthorpe References: <1493144468-22493-1-git-send-email-logang@deltatee.com> <1493144468-22493-16-git-send-email-logang@deltatee.com> <20170426073720.okv33ly2ldepilti@dhcp-3-128.uk.xensource.com> <20170427205339.GB26330@obsidianresearch.com> <02ba3c7b-5fab-a06c-fbbf-c3be1c0fae1b@deltatee.com> <20170427221132.GA30036@obsidianresearch.com> <3a7c0d27-0744-4e91-b37f-3885c50455e8@deltatee.com> <20170427232022.GA30398@obsidianresearch.com> Cc: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-nvdimm@ml01.01.org, linux-scsi@vger.kernel.org, open-iscsi@googlegroups.com, megaraidlinux.pdl@broadcom.com, sparmaintainer@unisys.com, devel@driverdev.osuosl.org, target-devel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, dm-devel@redhat.com, Christoph Hellwig , "Martin K. Petersen" , "James E.J. Bottomley" , Jens Axboe , Greg Kroah-Hartman , Dan Williams , Ross Zwisler , Matthew Wilcox , Sumit Semwal , Stephen Bates , Boris Ostrovsky , Juergen Gross , Konrad Rzeszutek Wilk , Julien Grall From: Logan Gunthorpe Message-ID: Date: Thu, 27 Apr 2017 17:29:08 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170427232022.GA30398@obsidianresearch.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.111 X-SA-Exim-Rcpt-To: julien.grall@arm.com, konrad.wilk@oracle.com, jgross@suse.com, boris.ostrovsky@oracle.com, sbates@raithlin.com, sumit.semwal@linaro.org, mawilcox@microsoft.com, ross.zwisler@linux.intel.com, dan.j.williams@intel.com, gregkh@linuxfoundation.org, axboe@kernel.dk, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, hch@lst.de, dm-devel@redhat.com, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, target-devel@vger.kernel.org, devel@driverdev.osuosl.org, sparmaintainer@unisys.com, megaraidlinux.pdl@broadcom.com, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-nvdimm@ml01.01.org, linux-mmc@vger.kernel.org, linux-raid@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, roger.pau@citrix.com, jgunthorpe@obsidianresearch.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v2 15/21] xen-blkfront: Make use of the new sg_map helper function X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1344 Lines: 33 On 27/04/17 05:20 PM, Jason Gunthorpe wrote: > It seems the most robust: test for iomem, and jump to a slow path > copy, otherwise inline the kmap and memcpy > > Every place doing memcpy from sgl will need that pattern to be > correct. Ok, sounds like a good place to start to me. I'll see what I can do for a v3 of this set. Though, I probably won't send anything until after the merge window. >>> sg_miter will still fail when the sg contains __iomem, however I would >>> expect that the sg_copy will work with iomem, by using the __iomem >>> memcpy variant. >> >> Yes, that's true. Any sg_miters that ever see iomem will need to be >> converted to support it. This isn't much different than the other >> kmap(sg_page()) users I was converting that will also fail if they see >> iomem. Though, I suspect an sg_miter user would be easier to convert to >> iomem than a random kmap user. > > How? sg_miter seems like the next nightmare down this path, what is > sg_miter_next supposed to do when something hits an iomem sgl? My proposal is roughly included in the draft I sent upthread. We add an sg_miter flag indicating the iteratee supports iomem and if miter finds iomem (with the support flag set) it sets ioaddr which is __iomem. The iteratee then just needs to null check addr and ioaddr and perform the appropriate action. Logan