Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1270599rdb; Fri, 20 Oct 2023 13:28:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoLvFV6M/px+CDruQJjeyknuHsmfr64uO9NPviLZLryrs0Gxm2u4dyWJu5nVkWPqn4pjtL X-Received: by 2002:a17:90a:a413:b0:277:68c3:64b9 with SMTP id y19-20020a17090aa41300b0027768c364b9mr8682685pjp.5.1697833720443; Fri, 20 Oct 2023 13:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697833720; cv=none; d=google.com; s=arc-20160816; b=vAkPO7TQ2+atp181RzIrTsh7sBDAXOryavXF9IjzySnc5QNJZJTTXkIC1lKfF5N3uu JbbD4KfwngDmPE/+Bc9pM0V6Ca9NQRyr6XywQXYfA9adWiZAbKD/y+dYKCcpOWUB4JM3 upJHODEl1Qkt2onAbA/CFfbG/FK630HNOXFFadHYYVKaRtLPl5WaGOGkXfHhTMSqnOEB 4/o6XVhC1X6jZBfqx6zXHPr4THiaeUrbRNcjervrft380H6NP7k3pHY9oITJlzzWcQe0 IpSR6jvoB9xN3Nf3WsJqomyR9GWxOWCawfRAJt7top0eZUP5RkqnJGLf5V92GP1L/qjd QVoA== 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 :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=qTiOa3xz3hCv82hRwt5SP4EUGvp5sMI4ujgh36PFooo=; fh=koYFp8MtoEkJkpXj6gU6RFV94+YdwhulwF8Eon7mWcY=; b=miKKs5erQkJnllohhK2Jm8c2w56tAhn8ZhsmjjSnXieFZPjB2TzRL1PPYNFKM8dxce U9GW9Rug57DZSSWQ/pBp2MA4HnHKyBFlhQlOISrPI16SP4JhHBe1+pcy8gCPRbklyPJY D++5DvMjG+yX9ky2oB6ChWfeskJR0wA8n6O4DVF6AcwwkSMX7Ub+3VHQ5IJ6fbfsNItj +Qnbsc9uJwQ2SlA9H134JN8UrBd1mrKKNm/UMmipMf+bDfM/1tawE7DvT5VvLiGqyyZz yKDmFgrfIkGj8IjkjqKTr/rrq7aRXF9sJ0gb1NjBS2Adj1j3oVBDHe1wfmoqYP3NDgTc xjsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id lk2-20020a17090b33c200b002744e9b7a22si5191920pjb.9.2023.10.20.13.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 13:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 361A98075141; Fri, 20 Oct 2023 13:28:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229659AbjJTU2I convert rfc822-to-8bit (ORCPT + 99 others); Fri, 20 Oct 2023 16:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjJTU2H (ORCPT ); Fri, 20 Oct 2023 16:28:07 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34ED31A4 for ; Fri, 20 Oct 2023 13:28:05 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-257-zI88p2-XMhqEsh7vrL2SXA-1; Fri, 20 Oct 2023 21:28:01 +0100 X-MC-Unique: zI88p2-XMhqEsh7vrL2SXA-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 20 Oct 2023 21:27:59 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Fri, 20 Oct 2023 21:27:59 +0100 From: David Laight To: 'Al Viro' , Eric Dumazet CC: gus Gusenleitner Klaus , Al Viro , Thomas Gleixner , lkml , Ingo Molnar , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "David S. Miller" , "dsahern@kernel.org" , "kuba@kernel.org" , Paolo Abeni Subject: RE: AW: [PATCH] amd64: Fix csum_partial_copy_generic() Thread-Topic: AW: [PATCH] amd64: Fix csum_partial_copy_generic() Thread-Index: AQHaAmMpLw1zxmi7jUCMTwySbq0j57BTHnww Date: Fri, 20 Oct 2023 20:27:59 +0000 Message-ID: <8b3d330b4d624bf3b77c1197a6bf9538@AcuMS.aculab.com> References: <20231018154205.GT800259@ZenIV> <20231019050250.GV800259@ZenIV> <20231019061427.GW800259@ZenIV> <20231019063925.GX800259@ZenIV> <20231019080615.GY800259@ZenIV> In-Reply-To: <20231019080615.GY800259@ZenIV> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 20 Oct 2023 13:28:24 -0700 (PDT) From: Al Viro > Sent: 19 October 2023 09:06 > > On Thu, Oct 19, 2023 at 09:39:45AM +0200, Eric Dumazet wrote: > > > I wonder if the csum_and_copy_...() helpers are really needed in modern days, > > with much bigger cpu caches. The L1 data caches aren't that big. OTOH ethernet chips tend to do checksum offloading. I do wonder if the extra complexity is worth it. Which code paths is it used on? ICMP can't possibly be common enough to make any difference. It can't be used for TCP receive - the check has to be done earlier. Plausibly TCP transmit - but the bytestream nature must make that hard. It might be usable on UDP transmit - but they'll be small and still in the L1 cache later on. For UDP receive I guess deferring the checksum check until recv() might save the date being loaded in the cache twice - but it doesn't need to be done with the copy for typical short UDP. > > > > Maybe we could remove them and use more standard copy + standard > > checksum over kernel buffers. > > FWIW, the reason we don't hit that shit all the time is that on almost > all paths all-zeroes block of data would be rejected anyway/could not > happen. Note that e.g. for ICMPv6 the csum includes the pseudo-header > and there's no way for that to be all-zeroes, etc. > > Whatever we do long-term (and I'd really like to get that mess dealt > with properly - fuckup is definitely mine, and I should have checked > the users of that stuff properly back then), I don't believe that > it's doable this late in the cycle. What is wrong with something akin to the original suggested patch? So that the csum fragment function can never return zero. For x86 the fastest code might be 'xor %eax,%eax; dec %eax' to avoid the 32bit immediate constant. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)