Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp667312rdf; Tue, 21 Nov 2023 12:57:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8Gc44RyL2UMt3JorUWWw+U2hkJhSl/rlb8ijAfH4u+b93ZueEN2h5zU5dPVd1lVYqiTjZ X-Received: by 2002:a17:90b:3b83:b0:280:3772:5c2e with SMTP id pc3-20020a17090b3b8300b0028037725c2emr479380pjb.25.1700600274735; Tue, 21 Nov 2023 12:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700600274; cv=none; d=google.com; s=arc-20160816; b=UVclsLG6oaFXicRHSeGfM1aJppRUbTxB8TbCTcdZaucYeE6Mcv6tK6CCn8JN8NgHjf J+ulwevymUe0r3pQNHcpq5GDo9KtQwPAjYY6R+LLxJXnNmnYzKPVlziFPYUQo7e8Fmx9 mepXURZ3nclUF82D2Qk1Rk1dIy5e40W055nU7MqDe71Vq8wgeLdtHfl6HFIhJdqR/IWk bQpE9R9nfD7AIFSvclg0KQYAbhIDU1ihkgZWAAGfl9RFUHBG7R5yiP+1BEz+tMUAJXrA v6L0mKBUjzpR4VLryx2pqGYLIGebEcBZclE3FahtNR+l8EkNVdZtvi2cXUNE3GGTAIF+ LSYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lAXHno8+c8gqgkWr62xW0IQIaSMEQfDVytD9MPG+ruo=; fh=RP9Hg+z2fYW8bc8bXTIQWRDxkmSeUmEq6sYqW6Senyc=; b=u1ZuPoYRh2D7Cd/V5cW1wLWuGKbh7/evVDu2AWCOYuwNeUOSf5AH2pTdIAOoBRerL3 woQDLZgnsvwEWE7sq53fgqXFAHWZWnWLH4X4Yh4ctWNAVVyOg+bS2hYGcGYXp7lVG3wu HRPD+zmNfegkPh/MaJekO010erhCFnGRPs39ru+DBjSe3z7e4htRTfQhO14U1SZzXAiE 6THlSdO5V8/X+RNb0PaN+9klzxYxtTg8ZWMCTMgUA/B1iXktot3FFoexeqJBR4e7PHXu T5ywKIKptRwwogLddX6F8Ei+GfpFa2IeYE3rcdsZMMIug/ObWyGLg6r4Dn0qDKEw61I3 I9DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=UegfZh+p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id mq16-20020a17090b381000b0028098007c8csi14492048pjb.84.2023.11.21.12.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 12:57:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=UegfZh+p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 00E558092ED8; Tue, 21 Nov 2023 12:55:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229582AbjKUUzX (ORCPT + 99 others); Tue, 21 Nov 2023 15:55:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjKUUzW (ORCPT ); Tue, 21 Nov 2023 15:55:22 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3EBC19E for ; Tue, 21 Nov 2023 12:55:17 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5440f25dcc7so8621963a12.0 for ; Tue, 21 Nov 2023 12:55:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1700600116; x=1701204916; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lAXHno8+c8gqgkWr62xW0IQIaSMEQfDVytD9MPG+ruo=; b=UegfZh+pbtWa7wEzbQEbxm/rvSTZhnGyjYIZCMmtk3dL81R0znbugRjVEtWJyjTKMv TmFwkNcqPwMJoexeCD/ukcWAoMJ3ohmIQKuQQ/w54N8tTp/5VplqQ1ByqTXnJgJTdDW9 6NeIy2uxYhFKlSYyz8OsfGv5Hj3bguumDn/r0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700600116; x=1701204916; h=content-transfer-encoding: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=lAXHno8+c8gqgkWr62xW0IQIaSMEQfDVytD9MPG+ruo=; b=eC3pg5SHajVxtkQ/1mge20EicogdPvCaBLFHk49Wt//Mmh/Z84oy2ZwWLMcLF5GRce 75un2HjRFfcabBjdiJMZrW7ADai9TLItGmd/o8Tl5rNn6GULeQLJcXDwlWlI4xDx9Jk3 IkA2xiiuilZ8JOl8LBWh5p4oJrpoqunteh2Z0tXaFaKebzLpnwXbW1hfLBdSCv+GwwLY 2BPhxmFW3KpplfIVwmA1s3/Jb5Pbna0L50NuvGo1B/EJ3VQ5ttx1X77seO4oUfZPkqDC JH6sBn+2KDcaBviWHxIbQg7IxCokFmvVoKUKH4r9Z0cI7x3n8jspUKux3a7exqnitIPJ UElw== X-Gm-Message-State: AOJu0YzBZj6wh5oUkGrH3m+34ugC6fj2+/HcybF01OsB0MOaxgjZZgTu 4hYDRlgVonA2KapQm30/JB0jKjmJjpBiYCFdTuFlfA== X-Received: by 2002:a17:907:1a54:b0:9bf:889e:32a4 with SMTP id mf20-20020a1709071a5400b009bf889e32a4mr47896ejc.54.1700600115917; Tue, 21 Nov 2023 12:55:15 -0800 (PST) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com. [209.85.218.47]) by smtp.gmail.com with ESMTPSA id dv8-20020a170906b80800b009fdc15b5304sm3173177ejb.102.2023.11.21.12.55.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Nov 2023 12:55:15 -0800 (PST) Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a011e9bf336so223837466b.3 for ; Tue, 21 Nov 2023 12:55:15 -0800 (PST) X-Received: by 2002:a17:906:1185:b0:9e5:ee70:5da1 with SMTP id n5-20020a170906118500b009e5ee705da1mr51591eja.53.1700600114697; Tue, 21 Nov 2023 12:55:14 -0800 (PST) MIME-Version: 1.0 References: <20231121010318.524570-1-nickrterrell@gmail.com> <20231121010318.524570-3-nickrterrell@gmail.com> <41F084AA-F027-4288-9F26-E33337E1516A@meta.com> In-Reply-To: <41F084AA-F027-4288-9F26-E33337E1516A@meta.com> From: Linus Torvalds Date: Tue, 21 Nov 2023 12:54:57 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] zstd: Backport Huffman speed improvement from upstream To: Nick Terrell Cc: Nick Terrell , Linux Kernel Mailing List , Yann Collet , Kernel Team , Giovanni Cabiddu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 12:55:28 -0800 (PST) On Tue, 21 Nov 2023 at 12:35, Nick Terrell wrote: > > > > Honestly, any coding rule that includes "don't use the do-while-zero > > construct" is actively broken shit. > > > > Please just fix your upstream rules. Because they are incredible garbag= e. > > Yeah, that=E2=80=99s the plan. Visual Studios fixed that compiler bug in = VS2015 [0], > so we should be safe to migrate to safer macros. I don't even use MSVS, but a minute of googling shows that you should never have done that silly "avoid sane C", and you should always just have done #pragma warning (disable: 4127) for MSVC. Honestly, the fact that the result was instead to disable that standard - and required - construct in the project makes me worry about the whole zstd thing. WTF? The do-while-zero construct is _so_ important that there are (sane) projects that literally *require* the use of it. See for example MISRA code safety rules. The kernel rules aren't quite that strict, but yes, do-while-zero is very much "you should *absolutely* do this" along with all the usual "make sure you have parentheses around macro arguments" rules. We had some RFC patches for this area: https://lore.kernel.org/all/20230511152951.1970870-1-mathieu.desnoyers@e= fficios.com/ And on that note, when I googled for the solution to the MSVC brain damage, I was distressed by how many hits I saw where people thought the do-while-zero pattern was some "legacy pattern". That just shows that there are lots of incompetent people simply do not understand why it's actually *required* for reliable parsing of macros. This is not some "historical stylistic" issue, it's literally a correctness issue for generic macro usage. Linus