Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1212746iol; Sun, 12 Jun 2022 09:10:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaN0DYA15Ns9A+mvK9uHPxAfZ8Yri4DG2RijU2El93rlLsesE8+RWjdiJS2HJ5P8clx2KO X-Received: by 2002:a17:902:6bc1:b0:15d:1e15:1a75 with SMTP id m1-20020a1709026bc100b0015d1e151a75mr56285171plt.114.1655050216896; Sun, 12 Jun 2022 09:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655050216; cv=none; d=google.com; s=arc-20160816; b=Yf649km8KC59/b4COefAPMPdBnG0wKYkRqjj1tWyQ+dQwObBkBUsOKVPia8+JEZzMS vkYU8Fe4XVeMzzcIuJZF1ZcsvVkGvjnrlDdPkaYNhZ9anXQnrYP6d14m9QycjmxoLI1L QwH6hr4TNp3TjUv4fLz+JHLXABxnxElvvdsOhfhSn2YcnnobU1SF+5tWcNdZoWS6RUeE O3UT9WiMRTJhm0AMBEg7UfqEYnA8gMBaHTrPbn0b1RlC32vVzA6Gwc6Pb2/4q9gO8gvn csKIbEWL0H9L8Grs7iGikRhFt4IF2MABIwzSVcrVdAJeBgwpv/2/EHWGak0f00DcMzk0 fAVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=DtboLJnQWlaQx3cZn/5rtwDm8UnHa+IXUF0Drf8tf3c=; b=ynvz+vb4sp30CQqzQ0QjPDE9AL+Vnqsy8FI3jAptgTU3RL9yLPitEQd6tfmCXvBA3Q v/bAT+uCoslaZbMl2F+JZ2D8dK5X76xTq0CcVAFV5zgmU9ENuz26QWFMxzdhJ2nQA7ni XgD9qWm7XDBmw5hqY57uezBoblbmyAwqRJ9JXAZHRDPXmR/4rZ+6smROA+jBZHRmFBEB Te/iCfrVhFq0tP9RfnBw4kBOWnc17EYKDJcuXN+/Ov4MyHiIuN1NT/RVXIMpU1c03w1g wbdvzjv2WIgFYlLESU+qNybHLgiEwoTkNtA8q+2KproYQa705Yoe1Mr4tokJ1wU1D73L +YZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=cr93iVQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q63-20020a632a42000000b003fd74779846si5902512pgq.826.2022.06.12.09.10.04; Sun, 12 Jun 2022 09:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=cr93iVQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235253AbiFLJAt (ORCPT + 99 others); Sun, 12 Jun 2022 05:00:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235233AbiFLJAo (ORCPT ); Sun, 12 Jun 2022 05:00:44 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 993B4517FF for ; Sun, 12 Jun 2022 02:00:37 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id a15so3704917wrh.2 for ; Sun, 12 Jun 2022 02:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DtboLJnQWlaQx3cZn/5rtwDm8UnHa+IXUF0Drf8tf3c=; b=cr93iVQUbdBVCRI6c2GBMIxrKddY7Fx5VpjMCKS70SP0k7Oaz4l5ex5HXzKO7ThBgL 8qaWw+ktuAEQxYMG1k3ZIbbZpJ2ZqhRKTj+L0lGBnbYTL3blvzDvdZqscET7qs3md+q4 vwhG7ShyCieA5DF/O4ym8nSdvXFeSa2wDJ9VU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DtboLJnQWlaQx3cZn/5rtwDm8UnHa+IXUF0Drf8tf3c=; b=8LUscIJAucslQiYNiBD7BLCfDCqsmYEFvOrhTrCS7k7ZrwUsAgsP1lX29HkFjlZcIS ait0wrVLRl2hT6boOO/u0D0mjIz7V+D0Y5Jo7h5P75uR2CAx0KBUqb+TU2WtmToESbdh S7+cYNwUxcC18jBUHupxGvp21SI/e2l9ixYKa7i7WKjTMGbyE04slGhVQsp7MNWnBmlq FX/d/tucHMFHLIrYlQsq35EgzpTHNTJV6g1alGv3nI3isGGqunsNwsYfxYmcJT5rMs/G uiqZ9xHtAUukVenFVPqC/Ismn1yba2uScS/QPuWZqc75YLS3nUdwWa7X54dqVh/Xbbx3 YF8g== X-Gm-Message-State: AOAM5329nrrooR8KWMckzpwHnMxqL6yZ2onbayodaCcsMp5Pqg51gdgX /HrAAzsDxRgFpYC4baHz+0zJIQ== X-Received: by 2002:a5d:64ac:0:b0:211:7f3b:a0d4 with SMTP id m12-20020a5d64ac000000b002117f3ba0d4mr52839238wrp.490.1655024437221; Sun, 12 Jun 2022 02:00:37 -0700 (PDT) Received: from localhost.localdomain ([178.130.153.185]) by smtp.gmail.com with ESMTPSA id d34-20020a05600c4c2200b0039c5b4ab1b0sm4798603wmp.48.2022.06.12.02.00.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jun 2022 02:00:35 -0700 (PDT) From: Joe Damato To: Alexander Viro , linux-kernel@vger.kernel.org Cc: Joe Damato Subject: [RFC,iov_iter v2 2/8] iov_iter: Introduce iter_copy_type Date: Sun, 12 Jun 2022 01:57:51 -0700 Message-Id: <1655024280-23827-3-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1655024280-23827-1-git-send-email-jdamato@fastly.com> References: <1655024280-23827-1-git-send-email-jdamato@fastly.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 struct iov_iter has a new member: iter_copy_type. This field holds a value designating which type of copy to use: a regular temporal copy (ITER_COPY) or a non-temporal copy (ITER_NOCACHE_COPY). iov_iter initializers have been updated to set the default ITER_COPY type. Signed-off-by: Joe Damato --- include/linux/uio.h | 17 +++++++++++++++++ lib/iov_iter.c | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 739285f..59573ee 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -28,6 +28,12 @@ enum iter_type { ITER_DISCARD, }; +enum iter_copy_type { + /* iter copy types */ + ITER_COPY, + ITER_NOCACHE_COPY, +}; + struct iov_iter_state { size_t iov_offset; size_t count; @@ -35,6 +41,7 @@ struct iov_iter_state { }; struct iov_iter { + u8 iter_copy_type; u8 iter_type; bool nofault; bool data_source; @@ -62,6 +69,11 @@ static inline enum iter_type iov_iter_type(const struct iov_iter *i) return i->iter_type; } +static inline enum iter_copy_type iov_iter_copy_type(const struct iov_iter *i) +{ + return i->iter_copy_type; +} + static inline void iov_iter_save_state(struct iov_iter *iter, struct iov_iter_state *state) { @@ -95,6 +107,11 @@ static inline bool iov_iter_is_discard(const struct iov_iter *i) return iov_iter_type(i) == ITER_DISCARD; } +static inline bool iov_iter_copy_is_nt(const struct iov_iter *i) +{ + return iov_iter_copy_type(i) == ITER_NOCACHE_COPY; +} + static inline bool iov_iter_is_xarray(const struct iov_iter *i) { return iov_iter_type(i) == ITER_XARRAY; diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 6dd5330..d32d7e5 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -511,6 +511,7 @@ void iov_iter_init(struct iov_iter *i, unsigned int direction, { WARN_ON(direction & ~(READ | WRITE)); *i = (struct iov_iter) { + .iter_copy_type = ITER_COPY, .iter_type = ITER_IOVEC, .nofault = false, .data_source = direction, @@ -1175,6 +1176,7 @@ void iov_iter_kvec(struct iov_iter *i, unsigned int direction, { WARN_ON(direction & ~(READ | WRITE)); *i = (struct iov_iter){ + .iter_copy_type = ITER_COPY, .iter_type = ITER_KVEC, .data_source = direction, .kvec = kvec, @@ -1191,6 +1193,7 @@ void iov_iter_bvec(struct iov_iter *i, unsigned int direction, { WARN_ON(direction & ~(READ | WRITE)); *i = (struct iov_iter){ + .iter_copy_type = ITER_COPY, .iter_type = ITER_BVEC, .data_source = direction, .bvec = bvec, @@ -1208,6 +1211,7 @@ void iov_iter_pipe(struct iov_iter *i, unsigned int direction, BUG_ON(direction != READ); WARN_ON(pipe_full(pipe->head, pipe->tail, pipe->ring_size)); *i = (struct iov_iter){ + .iter_copy_type = ITER_COPY, .iter_type = ITER_PIPE, .data_source = false, .pipe = pipe, @@ -1237,6 +1241,7 @@ void iov_iter_xarray(struct iov_iter *i, unsigned int direction, { BUG_ON(direction & ~1); *i = (struct iov_iter) { + .iter_copy_type = ITER_COPY, .iter_type = ITER_XARRAY, .data_source = direction, .xarray = xarray, @@ -1260,6 +1265,7 @@ void iov_iter_discard(struct iov_iter *i, unsigned int direction, size_t count) { BUG_ON(direction != READ); *i = (struct iov_iter){ + .iter_copy_type = ITER_COPY, .iter_type = ITER_DISCARD, .data_source = false, .count = count, -- 2.7.4