From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23D73C48BCD for ; Tue, 8 Jun 2021 11:27:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 032FF61352 for ; Tue, 8 Jun 2021 11:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbhFHL3q (ORCPT ); Tue, 8 Jun 2021 07:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231895AbhFHL3p (ORCPT ); Tue, 8 Jun 2021 07:29:45 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6336C061574; Tue, 8 Jun 2021 04:27:52 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqZtb-005pZ8-0X; Tue, 08 Jun 2021 11:27:47 +0000 Date: Tue, 8 Jun 2021 11:27:46 +0000 From: Al Viro To: Linus Torvalds Cc: Christoph Hellwig , linux-fsdevel , Linux Kernel Mailing List , David Sterba , Miklos Szeredi , Anton Altaparmakov , David Howells , Matthew Wilcox , Pavel Begunkov Subject: Re: [RFC][PATCHSET] iov_iter work Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 04:35:46PM -0700, Linus Torvalds wrote: > On Mon, Jun 7, 2021 at 3:01 PM Linus Torvalds > wrote: > > > > (b) on all the common non-SET_FS architectures, kernel threads using > > iov_iter_init() wouldn't work anyway, because on those architectures > > it would always fill the thing in with an iov, not a kvec. > > Thinking more about this thing, I think it means that what we *should* > do is simply just > > void iov_iter_init(struct iov_iter *i, unsigned int direction, > const struct iovec *iov, unsigned long nr_segs, > size_t count) > { > WARN_ON_ONCE(direction & ~(READ | WRITE)); > iWARN_ON_ONCE(uaccess_kernel()); > *i = (struct iov_iter) { > .iter_type = ITER_IOVEC, > .data_source = direction, > .iov = iov, > .nr_segs = nr_segs, > .iov_offset = 0, > .count = count > }; > } > > because filling it with a kvec is simply wrong. It's wrong exactly due > to the fact that *if* we have a kernel thread, all the modern > non-SET_FS architectures will just ignore that entirely, and always > use the iov meaning. Updated and pushed out...