Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19561735rwd; Wed, 28 Jun 2023 10:55:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5apuvj4va1hRmdnWLr3R1wCjscy3ZkPWtEGgoEs32a7NZPu5f8usSvoB9+FR0Edb/WgVtH X-Received: by 2002:a17:90b:4fcc:b0:262:eb20:2dd8 with SMTP id qa12-20020a17090b4fcc00b00262eb202dd8mr2416663pjb.20.1687974950595; Wed, 28 Jun 2023 10:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687974950; cv=none; d=google.com; s=arc-20160816; b=cS5hjZyQ13v8iGngmXW0AOJSpkXKoaW4sG8oWViIKQLC4C2io2iT7pgQW+V0uMh0UF XzlMWV2V/mQNsDuwKOxP8qGmGCDa2XGibiqO+PvoWMNIwyV9jUDJ1J1d5QTo0pxX9Z/c Yp9czIKLXxjnAFjEIdl5rJhRpMc5a2kF5FGH6J+q6mHFcQsHulvvkDEZxRPSuW68C5Da oafJjy/EKCna8zoPggdQnGtgWk/Sg4rd7AIj45Ui2LUdj6bekJ/nXNK/qs5xNVPYmVwY rnsfRO9geqHQd7heFv5ikBq2m2FOuco4ghw6tmDBsTmq0zjfC+n+b0YQV7vOEHehWYDV n+2g== 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=O5iwGD4XHWkWOIfZ3yQGIh6iTIUnFByvMDl0Vq0m8Go=; fh=f9Txz01GlPbSDgUagXtTnJJ5slJUUNysKO2nddZvecU=; b=CzuenVc+v+DB9uUTMUbLu+biMo31Lhi5odA1TUa3y7dsSX8EjqU2Si1R7Ax7tt/adf SL/1NoyD3j6GJauZ9coleZr2PjMVhah5OtrssxZJnCIzkJgYEvDdFgZlSgZ44oc16ogt Z2duVJ8k/0S9ei6UvSoTQ8k+gULlbB8eU1u37S3gzJxXOb2BGZcjjQcg2gUkZZRMxFjv YJkIWLquu6iIUt326NgoclaoGdGi4t3GfrB620CqFnAOWNcV62SzG7PMt2vFf3cK7wpO xAOtA6yEMXoFvuOfI1mtiwAF7R0WpiHk7dM5A+TZD4c8zxmxWPmF9tOUXejdF/9rqwps AWSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EmsspnBz; 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 13-20020a17090a190d00b00259b2afc651si11824608pjg.62.2023.06.28.10.55.37; Wed, 28 Jun 2023 10:55:50 -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=EmsspnBz; 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 S231253AbjF1RpD (ORCPT + 99 others); Wed, 28 Jun 2023 13:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231731AbjF1RpA (ORCPT ); Wed, 28 Jun 2023 13:45:00 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0942134 for ; Wed, 28 Jun 2023 10:44:58 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f122ff663eso8796816e87.2 for ; Wed, 28 Jun 2023 10:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1687974296; x=1690566296; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=O5iwGD4XHWkWOIfZ3yQGIh6iTIUnFByvMDl0Vq0m8Go=; b=EmsspnBzEw/jQHMY0ZC6hqmpzYPwXz49Nr5F3m9lZwltrrIbjpg86UxQ+BIALTUHtC GJkgEuePI9cVYBNs1TCByp/Du2Oh87sFptpCgzbJCzXQTXN1i/nU7yXc9jFS9+Ad9NRB lkDs5CJUVPvZOjnlPt+qKLsa3EIXP4lvu041Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687974296; x=1690566296; 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=O5iwGD4XHWkWOIfZ3yQGIh6iTIUnFByvMDl0Vq0m8Go=; b=jHcYp62JIuMwUOOab0eGqOi9xzDVT462JDjp0LCAHwu8hXzymmGTKCvdbp6m2C26TG oZv7sNn9cRBAbXDRboZbNtHOZkfA23DqUam9ZoHF4N4QrTYdcnhsjTYUqr7Kb1HZQtOT 25QgHB2Fo7NJkKis6v8UHlUAAZO41bX3Bpv89J7W2KFADVrI7jpQT0Udj6cZKFBHZl8g fAS41bhuN6dl1IZDvTE+nSiya3XHed3fo4puCveR9Y6yjhlmgwukio+liW0PF6WA3TNy tejkDKwWiGLNNre6MOjRjg/PdYbDHpieiy2J/tjaCP7KIm6N+t5VdOwXrV74WuUX43Q2 FNHQ== X-Gm-Message-State: AC+VfDx0vKShc1ITeGEbyVI6THShAmmMWy7EL9jWPd/enVNld1f2lE1h SddZyB+yinqt3pqkEy2+zkm7B9HycuCOjJP9V4lJI5ir X-Received: by 2002:ac2:4f0a:0:b0:4fb:7404:538b with SMTP id k10-20020ac24f0a000000b004fb7404538bmr7872835lfr.66.1687974296366; Wed, 28 Jun 2023 10:44:56 -0700 (PDT) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id w25-20020a19c519000000b004ec84d24818sm2003255lfe.282.2023.06.28.10.44.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Jun 2023 10:44:54 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4fb7b2e3dacso5316339e87.0 for ; Wed, 28 Jun 2023 10:44:54 -0700 (PDT) X-Received: by 2002:a05:6512:2527:b0:4fa:a0c3:ef9d with SMTP id be39-20020a056512252700b004faa0c3ef9dmr8121152lfb.18.1687974294238; Wed, 28 Jun 2023 10:44:54 -0700 (PDT) MIME-Version: 1.0 References: <20230628020657.957880-1-goldstein.w.n@gmail.com> <20230628091241.GAZJv5ie0xVGvnMKIM@fat_crate.local> In-Reply-To: From: Linus Torvalds Date: Wed, 28 Jun 2023 10:44:37 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: x86/csum: Remove unnecessary odd handling To: Noah Goldstein Cc: Borislav Petkov , x86@kernel.org, edumazet@google.com, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com, lkml Content-Type: multipart/mixed; boundary="00000000000033860005ff34249b" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, 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 --00000000000033860005ff34249b Content-Type: text/plain; charset="UTF-8" On Wed, 28 Jun 2023 at 08:32, Noah Goldstein wrote: > > Linus, if you're planning a patch and want to just integrate the codes > here I'm happy drop this patch No, that patch looks good to me. In fact, I wasn't planning on integrating my patch at all. I literally did it as a "I would have done it this way instead" exercise. And while I am currently running with my patch in the kernel, I don't even really know if it works and does the right thing. Maybe my use doesn't even trigger csum_partial() at all. I did not do any testing that "yes, I get the same checksum as a result". So (a) removing the pointless one-byte alignment looks good to me. (b) I'd actually hope that somebody who _cares_ about this path and has put some real work into it (as opposed to my "superficial dabbling") would look at my patch and either go "yeah, not worth it", or "looks good, I'll take it". and I'm including that final patch of mine here again in case there was any confusion with the earlier versions (there were at least two known-broken versions I posted). *If* somebody likes it, and verifies that the checksum result is correct, feel free to do anything with that patch, including adding my signed-off-by for it (or taking the credit all for yourself - Mwahahahahaahaa!) Linus --00000000000033860005ff34249b Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Silly-csum-improvement.-Maybe.patch" Content-Disposition: attachment; filename="0001-Silly-csum-improvement.-Maybe.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ljg0at1j0 RnJvbSAyNGExZDUzM2Q5NjA3NDIyMDkyN2Q4NDRhNjE5YTU0NDE5YjY5YjgxIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaW51cyBUb3J2YWxkcyA8dG9ydmFsZHNAbGludXgtZm91bmRh dGlvbi5vcmc+CkRhdGU6IFR1ZSwgMjcgSnVuIDIwMjMgMTM6NTU6MzIgLTA3MDAKU3ViamVjdDog W1BBVENIXSBTaWxseSBjc3VtIGltcHJvdmVtZW50LiBNYXliZS4KCi0tLQogYXJjaC94ODYvbGli L2NzdW0tcGFydGlhbF82NC5jIHwgODMgKysrKysrKysrKysrKysrKy0tLS0tLS0tLS0tLS0tLS0t LQogMSBmaWxlIGNoYW5nZWQsIDM4IGluc2VydGlvbnMoKyksIDQ1IGRlbGV0aW9ucygtKQoKZGlm ZiAtLWdpdCBhL2FyY2gveDg2L2xpYi9jc3VtLXBhcnRpYWxfNjQ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jlc10iCi0JCSAgICA6IFt0bXBfYWNjdW1dICI9JnIiKHRtcF9h Y2N1bSksCi0JCSAgICAgIFt0bXBfY2Fycmllc10gIj0mciIodG1wX2NhcnJpZXMpLCBbcmVzXSAi K3IiKHRlbXA2NCksCi0JCSAgICAgIFtsZW5dICIrciIobGVuKSwgW3NyY10gIityIihidWZmKQot CQkgICAgOiAibSIoKihjb25zdCBjaGFyICopYnVmZikpOworCQlhc20oImFkZHEgJTEsJTBcblx0 IgorCQkgICAgImFkY3EgJDAsJTAiCisJCSAgICA6IityIiAodGVtcDY0KTogInIiICh0ZW1wNjRf MikpOworCX0KKworCS8qCisJICogbGVuID09IDQwIGlzIHRoZSBob3QgY2FzZSBkdWUgdG8gSVB2 NiBoZWFkZXJzLCBzbyByZXR1cm4KKwkgKiBlYXJseSBmb3IgdGhhdCBleGFjdCBjYXNlIHdpdGhv dXQgY2hlY2tpbmcgdGhlIHRhaWwgYnl0ZXMuCisJICovCisJaWYgKGxlbiA+PSA0MCkgeworCQl0 ZW1wNjQgPSB1cGRhdGVfY3N1bV80MGIodGVtcDY0LCBidWZmKTsKKwkJbGVuIC09IDQwOworCQlp ZiAoIWxlbikKKwkJCXJldHVybiBjc3VtX3RhaWwodGVtcDY0LCBvZGQpOworCQlidWZmICs9IDQw OwogCX0KIAogCWlmIChsZW4gJiAzMikgewotLSAKMi40MS4wLjIwMy5nYTRmMmNkMzJiYi5kaXJ0 eQoK --00000000000033860005ff34249b--