Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2598372rdb; Fri, 22 Sep 2023 03:31:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLxLHKk9y6NQo7vb0/Gnt0YUf4JktC2gD9PeEDM1+qHg6oMFRzUiNV6Tu+pN+HY0lpEJ3y X-Received: by 2002:a17:902:82c4:b0:1c1:f5a6:bdfa with SMTP id u4-20020a17090282c400b001c1f5a6bdfamr7551370plz.7.1695378663159; Fri, 22 Sep 2023 03:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695378663; cv=none; d=google.com; s=arc-20160816; b=tcT04w21XlnuM1SkyphmYtKnp0SX8N7H4gFpt4Q9dcfUyQsuLV9WjqZAloTUHIyKG0 oQlnfMT3unxTiA2tOmuubiJ+ePh4uJWD+3Oq/Vyc+HZ2vBBxeUt3o8IyPn61tEHtrQ1a 5ZVgfdo2JRiE0l6rkdG8+KTFR0KD0yP5+2ipX+KwDfXJMTnTC6b4lz8YLl1OMDGpwiiY m//3NWvuqyfAJyHbSCPrdh+BfIOMBghPIlw1XdJ5ZA166TtxB/9fUg07taU2cQw8nbDC FRck3HB481xvyVfwR6W2RPo/T5J+Mw9CBtZMfVbls+TtcNXjthpnVwsGCH3L6vjR8JXe 9TcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+WpmPj40uZjZZL0peyRzGbmlrYopQn2Rm3Wh/gTy5H4=; fh=F9cXzIM6+eqMHjvfyj5TF5u9rE42RCKI684tuK7nORI=; b=EWCYb4jqLLIexpkLtNnx1cfgcGWK9gz8rikWS8f7ZSDtJNMVq9zoWk6XvrVJQvX61S nFggf4b5NRicxRaT7qxzvZC4t2YaBRSJgzWDpOIlmSAVMR+9qtJQzWMaYJ5PIgKJN9vY 9b/eqRjHCxd17SRKp8/2dbI/6xQDWz4DghDHTfXO9oBnPi1R3MUh1r3e226mhS6v44b2 BSv9hWJHGgc4AKEzLPjFZH7uTKTG/7j3WXhyyJeasqc8LVdtVEQkbAmGCvcZDG6rvwTf isUsd5QPL9hhwjI8NRo+6hRmw23O4z1FiWqi9AqDr2ukrNMpK6VoS3Ca4kwkzJzc0PJX 4Csw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o9nXd2ER; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id t14-20020a1709027fce00b001bc2fd76db1si3338954plb.65.2023.09.22.03.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:31:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o9nXd2ER; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7A961858DB4B; Fri, 22 Sep 2023 02:33:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233079AbjIVJdS (ORCPT + 99 others); Fri, 22 Sep 2023 05:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbjIVJdF (ORCPT ); Fri, 22 Sep 2023 05:33:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD648192; Fri, 22 Sep 2023 02:32:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B0F7C433C9; Fri, 22 Sep 2023 09:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695375155; bh=vwZUAYeEfWwnaGPU+f55fpprOAGYNnTdXdHwaC6Ti5o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o9nXd2ERc/xNm7w0xvgZ+jg3uIJWBrEPTC/DuLDyeLQ2YVjNrOfjXaCb5QoLcXhOQ s1yRC7V6cI8Gv0op5YlxFtha2SFI+Gs5PMt/+4yEo9dLmGjdlJbngdoYb/yDveICei SL4Jf1YHttuw0WFbBVRKI1FjVXO1bHFaJ/dCTHA6NGz9mUe6PglwaVqVwjKWo97lEr uGmtucbm6STBFJ37LXVZh9RAz7h3m0M6LsJ3X3hbbebUGAcM/q46hRo4yCB6F0Cml2 Q0jWXfW8jwWbgfYj8SCtNd5UhVXZL3ElDucO33i1B/6qbThCgKSjihp+5NfHv8K4Pl ql2vtkPWxGuNg== Date: Fri, 22 Sep 2023 10:32:27 +0100 From: Simon Horman To: David Howells Cc: Jens Axboe , Al Viro , Linus Torvalds , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 05/11] iov_iter: Convert iterate*() to inline funcs Message-ID: <20230922093227.GV224399@kernel.org> References: <20230920222231.686275-1-dhowells@redhat.com> <20230920222231.686275-6-dhowells@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230920222231.686275-6-dhowells@redhat.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:33:28 -0700 (PDT) On Wed, Sep 20, 2023 at 11:22:25PM +0100, David Howells wrote: ... > @@ -312,23 +192,29 @@ size_t _copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) > return 0; > if (user_backed_iter(i)) > might_fault(); > - iterate_and_advance(i, bytes, base, len, off, > - copyout(base, addr + off, len), > - memcpy(base, addr + off, len) > - ) > - > - return bytes; > + return iterate_and_advance(i, bytes, (void *)addr, > + copy_to_user_iter, memcpy_to_iter); > } > EXPORT_SYMBOL(_copy_to_iter); > > #ifdef CONFIG_ARCH_HAS_COPY_MC > -static int copyout_mc(void __user *to, const void *from, size_t n) > -{ > - if (access_ok(to, n)) { > - instrument_copy_to_user(to, from, n); > - n = copy_mc_to_user((__force void *) to, from, n); > +static __always_inline > +size_t copy_to_user_iter_mc(void __user *iter_to, size_t progress, > + size_t len, void *from, void *priv2) > +{ > + if (access_ok(iter_to, len)) { > + from += progress; > + instrument_copy_to_user(iter_to, from, len); > + len = copy_mc_to_user(iter_to, from, len); Hi David, Sparse complains a bit about the line above, perhaps the '(__force void *)' should be retained from the old code? lib/iov_iter.c:208:39: warning: incorrect type in argument 1 (different address spaces) lib/iov_iter.c:208:39: expected void *to lib/iov_iter.c:208:39: got void [noderef] __user *iter_to > } > - return n; > + return len; > +} > + > +static __always_inline > +size_t memcpy_to_iter_mc(void *iter_to, size_t progress, > + size_t len, void *from, void *priv2) > +{ > + return copy_mc_to_kernel(iter_to, from + progress, len); > } > > /** ...