Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp100077rwl; Wed, 9 Aug 2023 11:31:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1oO4gAqUBE9na1Loqto/SoJz0tFD4g9sV94HhBqh4kUCXMQObf5sjP8wwSoMW2i+Lo4TQ X-Received: by 2002:a05:6a20:cc62:b0:132:ce27:d29e with SMTP id hq34-20020a056a20cc6200b00132ce27d29emr7771pzb.10.1691605904243; Wed, 09 Aug 2023 11:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691605904; cv=none; d=google.com; s=arc-20160816; b=HjLzxTYJppOmoaIwdVx4IJtoaRwOs23UdZ61vB8Mh+hiO9ABceEsrJP/Y6dV3ksRr2 AqX5nfetQtB47UVbikLNTuuAlQ73dCByKyOiusqQqP7Sch/3IjDma6MPxKYJTp8oAKaA ABdWAa0k6QSd7AfT/jk2aDUtQdFO+J8Za5NFCAgjTYayD2WQP/0fOwnj9gRRjjlWiqBS OcASfoH7YwPkWw5EAIs5if2SBb028LMlDDQeL9z4Fss3kZ6jVVyArgzs16sK+oQTeJlf 551MvSB0S/Ps8Oizw5WcypHU0S9QjC/6yrlp2/1AfWA9pno1R7hb1Qk9LcyWekKEeRp2 Js3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1XYH3jJ0fFMcP87tUDEXy9T7rFDPHtJSPapZra9b610=; fh=NSkFotND6f5n2CzMUgfO7aVimyigURJh9i0vO3oG4pQ=; b=SNmdLwbX6LoL6Idkm4VQD2yMufUritX6JQWrG1yxQAIX3UfCp8A+G9Iitivairbi6I jwZXyeLvIupWqZcc0eZoM50Y4UUH+A6VGEiRNnodCBMuP3u/o17VJPtDqWAF9TzC99jS Mne+pDcCCkZ6N7XcI9gX97pnQbOQsanBVDNS9K3407pkGnUEYAu+wxOp4cPWBqqwQc71 06bOfNg1H/XiVa818hFVlpjsoOWoYBum4Jgzt4NVzTq/yDon6A4S6Jfpy2EqsXIaDJHA XmJkg1e+EzS7iVQic/mvsPBguZNIIL70t1B345hiWKZtKDL7v94nNPDNAXXEW6uAOmYK JziQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RqP3Ppkg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a056a00231200b006871e641c8dsi10045987pfh.12.2023.08.09.11.31.27; Wed, 09 Aug 2023 11:31:44 -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=@linux-foundation.org header.s=google header.b=RqP3Ppkg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231195AbjHIRVr (ORCPT + 99 others); Wed, 9 Aug 2023 13:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjHIRVq (ORCPT ); Wed, 9 Aug 2023 13:21:46 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E54EDA for ; Wed, 9 Aug 2023 10:21:46 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b9f0b7af65so859581fa.1 for ; Wed, 09 Aug 2023 10:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1691601704; x=1692206504; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1XYH3jJ0fFMcP87tUDEXy9T7rFDPHtJSPapZra9b610=; b=RqP3PpkgFUk5/+sLrwi/fNb6ViR7Ib+J+zMxnUPUMB/ArHXJxShRVbtUbMxdBMXg7N HLcgcWBi1yypE0jvljNMGPtmh0xdF41Upun8L3x3E7v2cTWPCZSDFMDjNlvEjoHuzhqM TMxHfYcJBnzTl/7BkVkC7ZpBfQ4Mjuu3a0MYQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691601704; x=1692206504; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1XYH3jJ0fFMcP87tUDEXy9T7rFDPHtJSPapZra9b610=; b=TuggyGUDQp1KY7DWBhitIPnypMn9icfoL4PxRhcwf2QKRdbCMhk5YBWErHi/FhSVPJ 1JkxJnbOGXMbd+WPb1PU8MhBO7UYAKDFxrLQ8aB/0B+NTSZzickApjpF8bf4EtYtrVVX v2lOmN1hv3eDB//OI1G0Op0phJkiGnt4/N/qTixpTSwDzDZ4PVbA/KFQ9ij6zmxycFEZ BLJDU+ELtnzvEQTZmuHNEPODXJI7ZCThvtVIbJe8Gzh8tpBBGjj17GMU8Ydgzvajm967 y/kyiGOZR4T5BEtUQAZs22fsZg0/oFZ9n6oH5GCxjV2KVuMI2/XD61tvvNLVuowONdPd Q/Jw== X-Gm-Message-State: AOJu0YybJLeH9RfmDmmrSre1Lj6AWe61jFXTMjHpjZ+uherL+3gifOTh Vv++a/iXQh0XKtPTj1eaZ//cZUUiwtup9wn9rUSUHS0g X-Received: by 2002:a2e:8650:0:b0:2b9:d28c:9c2d with SMTP id i16-20020a2e8650000000b002b9d28c9c2dmr2344585ljj.23.1691601704056; Wed, 09 Aug 2023 10:21:44 -0700 (PDT) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com. [209.85.208.173]) by smtp.gmail.com with ESMTPSA id f12-20020a2e918c000000b002b9b55fefe0sm2806289ljg.131.2023.08.09.10.21.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Aug 2023 10:21:43 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2b9bb097c1bso1044791fa.0 for ; Wed, 09 Aug 2023 10:21:43 -0700 (PDT) X-Received: by 2002:a2e:9ccb:0:b0:2b6:dd9a:e1d3 with SMTP id g11-20020a2e9ccb000000b002b6dd9ae1d3mr2399575ljj.44.1691601702926; Wed, 09 Aug 2023 10:21:42 -0700 (PDT) MIME-Version: 1.0 References: <87edkce118.wl-tiwai@suse.de> <20230809143801.GA693@lst.de> <87wmy4ciap.wl-tiwai@suse.de> In-Reply-To: From: Linus Torvalds Date: Wed, 9 Aug 2023 10:21:26 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC] Introduce uniptr_t as a generic "universal" pointer To: Takashi Iwai Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, Andy Shevchenko , Mark Brown , netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 On Wed, 9 Aug 2023 at 10:01, Linus Torvalds wrote: > > Right now the kernel buffer init is a *bit* more involved than the > above ubuf case: > > struct iov_iter iter; > struct kvec kvec = { kptr, len}; > > iov_iter_kvec(&iter, ITER_SRC/DEST, &kvec, 1, len); > > and that's maybe a *bit* annoying, but we could maybe simplify this > with some helper macros even without ITER_KBUF. Looking at the diff that Christoph quoted, you possibly also want strncpy_from_iov() and honestly, that's a bit of an odd operation for the traditional iov_iter use, but it certainly shouldn't be _hard_ to implement. I'd probably initially implement it as a special case that only deals with the "one single buffer" case (whether user space or kernel space), since that would presumably be what you'd ever have, but extending it to the generic case later if people actually need it would not be problematic - those "iterate_and_advance()" macros in lib/iovec.c are all about that horror. Linus