Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1722153pxb; Fri, 10 Sep 2021 12:14:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQRU4jjJ0KQoXJIsZ64BA+ljQuTjOe3N/ehZbzLgGv48+2JxdlHNUYSyqAuyXNipQG/h/c X-Received: by 2002:a17:906:850b:: with SMTP id i11mr9524657ejx.84.1631301286138; Fri, 10 Sep 2021 12:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631301286; cv=none; d=google.com; s=arc-20160816; b=kU9SCckYw7CQHYo7hEWerrSghRrPulCjYqhxOn6HP75RCLlN5Lpae0XWtrkTiPrFf5 HITNjfN36o2xTIv8W9YVQcoxSMUwxZ6w3rlEfd506SJBY+Lte/RUpu30rBVw4NEUeUCf qsxjU8F+2zDZYh18X355ROg6hP9ngunZcngzDmUeXewUIVFYntL4yxWKBcBh3fLvg6V8 Pnpj1MWlw6XVQDegTse/+UAAh2oqfWNgf0yl0xQ0cxRsZHxnFsiqyg+hI/VxuHb6BQ9P 9S/tW3VkllfMn/j1KU4igBiFen21utPaSDhYRnAsVklllv6p63emko9UsOa7+JarAZ8t JUVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=OxrV+O/CeDbwvzlEEUi1X1nUVONoUScOOLnqA2lPrtI=; b=ifrslHfVEoSw1VF3FHyjcea/JBL08oq0HtAEfQXbx52+bawqWmoSFGXj3lgGTwikxw vMF+CdAx2QUtjdXk+B5qMB0sYB9If423gqHj68C5lG8mkXGqyyLy82AzlEtodERWfz4o qc2XT4S1T7Z8UI/dDuZmVC1c2GmSDzKQsWCKKXu0+fuJfeYBDncxLf1jaCqdyg3Z3UC/ X5Q+NuZjVARSddHGJ6MXP6QtcAJMcyNvivGy10QDrdKnbkYEa1B7nwJGpRRcW1SAFVWm BPMb1P+FmxpBApOmDWNi5sfPRBBZJbhgEiYZo2wUT55S+MNw+cLiu3PoJWJeDXEhKtR/ qOSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=cf7M63qH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si7011571ejo.47.2021.09.10.12.14.22; Fri, 10 Sep 2021 12:14:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=cf7M63qH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232578AbhIJTMB (ORCPT + 99 others); Fri, 10 Sep 2021 15:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbhIJTMA (ORCPT ); Fri, 10 Sep 2021 15:12:00 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8946FC061574 for ; Fri, 10 Sep 2021 12:10:49 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id m26so2716303pff.3 for ; Fri, 10 Sep 2021 12:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OxrV+O/CeDbwvzlEEUi1X1nUVONoUScOOLnqA2lPrtI=; b=cf7M63qHGucdJ5nIuyxyx87U6Q0r7IEf44Uf9m4ImqdNBVD54amQtC0Hks5tsAn1ex s5HKsnYIU3eljyWUKFbiBv2Q4gxQm2MIc/u7aH5uI1py1sZPNj87CU20WOK2Ss1w0csh jaM8PLgEIhL19Iq2nOEJHagXnTtvD0NH37B7bGNmp4J9zpcbbAcwkD2K4xr4QMIU8xQ2 hwIV5bV6Hr0x1ikoj0noaTtEYsVc41g0Rl+OThWnFntrvzAQ2dO/36F3DwL7xSaGKNii bXzZL5Gx0SHkjm37AagWCx9pXN5Uri6RdgYTzak2+3dc+ldDgTET8Fz+Cekrz9KXUW2k 4P9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OxrV+O/CeDbwvzlEEUi1X1nUVONoUScOOLnqA2lPrtI=; b=poM0AcMKpWhEvWKdaKxqkoB9QgUOfn+ttvNes6U7K11vbkSr+2c8iak1A492tHXcMX Vhz+oXeK8jp2sJsjzHR4CV6fKL8Px6OwkSi9kEvzFHXJAVX4HAaBsyNwAlsESzfk8Wiv 5wR7pdTQtdeJkY8z6ZqfIbag+Kg1HkxDVAI1bVhSxmpzSvwWhPYm/fsa8tzfh3MxOPsy XRvoHJgH+wQxiH843gZgitqM8OVTts4OqRBrR9RCvGaem8X2ZUTEST1/U2YFFrwShP3U hYuT95FdqLN0/tIPXrgZvQnSrqSRDH59L9uhfYw4W9LTCPRnOkqM5ID3IBnTKD6gk+/u aEtg== X-Gm-Message-State: AOAM530G6FNytPqZ9xWwn+uB+KiN6YPYTHM5Wiysg3XEvTZOBMW4Vad8 gFmF+/jdp8cKkowdDoO8B8kMrQ== X-Received: by 2002:a62:158a:0:b0:40d:7fae:d109 with SMTP id 132-20020a62158a000000b0040d7faed109mr9646189pfv.34.1631301048918; Fri, 10 Sep 2021 12:10:48 -0700 (PDT) Received: from ?IPv6:2600:380:4963:7106:aa8b:68a3:b10d:8c01? ([2600:380:4963:7106:aa8b:68a3:b10d:8c01]) by smtp.gmail.com with ESMTPSA id n3sm5512166pfo.101.2021.09.10.12.10.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 12:10:48 -0700 (PDT) Subject: Re: [git pull] iov_iter fixes To: Al Viro , Linus Torvalds Cc: Pavel Begunkov , Linux Kernel Mailing List , linux-fsdevel References: <9855f69b-e67e-f7d9-88b8-8941666ab02f@kernel.dk> <4b26d8cd-c3fa-8536-a295-850ecf052ecd@kernel.dk> <1a61c333-680d-71a0-3849-5bfef555a49f@kernel.dk> From: Jens Axboe Message-ID: Date: Fri, 10 Sep 2021 13:10:47 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/10/21 12:48 PM, Al Viro wrote: > On Fri, Sep 10, 2021 at 10:31:00AM -0700, Linus Torvalds wrote: >> On Fri, Sep 10, 2021 at 10:26 AM Jens Axboe wrote: >>> >>> On 9/10/21 10:58 AM, Linus Torvalds wrote: >>>> On Fri, Sep 10, 2021 at 9:56 AM Al Viro wrote: >>>>> >>>>> What's the point of all those contortions, anyway? You only need it for >>>>> iovec case; don't mix doing that and turning it into flavour-independent >>>>> primitive. >>>> >>>> Good point, making it specific to iovec only gets rid of a lot of >>>> special cases and worries. >>>> >>>> This is fairly specialized, no need to always cater to every possible case. >>> >>> Alright, split into three patches: >>> >>> https://git.kernel.dk/cgit/linux-block/log/?h=iov_iter >> >> That looks sane to me. >> >> Please add some comment about how that >> >> i->iov -= state->nr_segs - i->nr_segs; >> >> actually is the right thing for all the three cases (iow how 'iov', >> 'kvec' and 'bvec' all end up having a union member that acts the same >> way). >> >> But yeah, I like how the io_uring.c code looks better this way too. >> >> Al, what do you think? > > I think that sizeof(struct bio_vec) != sizeof(struct iovec): > struct bio_vec { > struct page *bv_page; > unsigned int bv_len; > unsigned int bv_offset; > }; > takes 3 words on 32bit boxen. > struct iovec > { > void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ > __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ > }; > takes 2 words on 32bit boxen. Ouch yes. I guess we do have to special case BVEC for now, as I do actually need that one internally. I'll add a BUILD_BUG_ON() for the other one while at it. -- Jens Axboe