On Sun, Mar 19, 2023 at 08:29:16PM +0000, Lorenzo Stoakes wrote: > The basis for saying asynchronous was based on Documentation/filesystems/vfs.rst > describing read_iter() as 'possibly asynchronous read with iov_iter as > destination', and read_iter() is what is (now) invoked when accessing > /proc/kcore. > > However I agree this is vague and it is clearer to refer to the fact that we are > now directly writing to user memory and thus wish to avoid spinlocks as we may > need to fault in user memory in doing so. > > Would it be ok for you to go ahead and replace that final paragraph with the > below?:- > > The reason for making this change is to build a basis for vread() to write > to user memory directly via an iterator; as a result we may cause page > faults during which we must not hold a spinlock. Doing this eliminates the > need for a bounce buffer in read_kcore() and thus permits that to be > converted to also use an iterator, as a read_iter() handler. I'd say the purpose of the iterator is to abstract whether we're accessing user memory, kernel memory or a pipe, so I'd suggest: The reason for making this change is to build a basis for vread() to write to memory via an iterator; as a result we may cause page faults during which we must not hold a spinlock. Doing this eliminates the need for a bounce buffer in read_kcore() and thus permits that to be converted to also use an iterator, as a read_iter() handler. I'm still undecided whether this change is really a good thing. I think we have line-of-sight to making vmalloc (and thus kvmalloc) usable from interrupt context, and this destroys that possibility. I wonder if we can't do something like prefaulting the page before taking the spinlock, then use copy_page_to_iter_atomic()