On 11/30/18 2:11 PM, Al Viro wrote: > On Fri, Nov 30, 2018 at 01:32:21PM -0700, Jens Axboe wrote: >> On 11/30/18 1:15 PM, Jens Axboe wrote: >>> On 11/30/18 12:21 PM, Al Viro wrote: >>>> On Fri, Nov 30, 2018 at 09:56:43AM -0700, Jens Axboe wrote: >>>>> For an ITER_KVEC, we can just iterate the iov and add the pages >>>>> to the bio directly. >>>> >>>>> + page = virt_to_page(kv->iov_base); >>>>> + size = bio_add_page(bio, page, kv->iov_len, >>>>> + offset_in_page(kv->iov_base)); >>>> >>>> Who said that you *can* do virt_to_page() on those? E.g. vmalloc()'ed >>>> addresses are fine for ITER_KVEC, etc. >>> >>> Then how do you set up a kvec based iter with memory you can safely >>> DMA to/from? >> >> Would this make you happy: >> >> if (!is_vmalloc_addr(kv->iov_base)) >> page = virt_to_page(kv->iov_base); >> else >> page = vmalloc_to_page(kv->iov_base); > > Free advice: don't ever let Linus see anything along those lines. Results > tend to be colourful... We already have those lines in the kernel, XFS for instance. Al, could you please try to be helpful instead of being deliberately obtuse? Examples of being helpful: 1) Informing the sender of why something is a bad idea, instead of just saying it's a bad idea. 2) Making helpful suggestions to improve the current situation. -- Jens Axboe