Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3333605pxa; Tue, 18 Aug 2020 12:27:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcHI7H7uwBJRnC8O6QyTwuTXRtBDdOntXUgGOvF4Frsx1q0R1rKpIX/lfYChO4iG6SD4OH X-Received: by 2002:aa7:d585:: with SMTP id r5mr20828290edq.30.1597778865787; Tue, 18 Aug 2020 12:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597778865; cv=none; d=google.com; s=arc-20160816; b=V6BxpQPMFkkWKFEcduPb+OqqPRDUAdt2fivsmoB7wX4kP9zgWC+fk0K6IyasNe0ILg aeqWgSIv+BXiUw5BXTPc01laWnmNSguRm4cQ3v9IzPmW5jRlAfzL7F7nQHkKMYa75pVg SczU2SSmy/dBOQPwcHPp6xWDT8O30dAiAMDIozqo75vQhFn2jds+b9vGtJ9WGYjBk/iR MKeeuVkwV4lKCHFHH/Imx2KPLl72Rsz0CvJqRUxJBjqLQtfa8VPwmNAevlv25IiflJS1 TszMkl4Hh1qeMIJbyDLzEpJpzeL0yL4p9966wHiHZNYsg3Xj/XPPDMP7Lw+zryw4UPhS UHsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/VmA06WjlqS7hJumtglP3Mb+v0u9+PDAlYaWZ4/eDGk=; b=JYIkmrnnZfkVdCWl/Q4dIMwWZa2Sg1gqNMwrqcccSUVn5QcRXsWO3ygEu5qR03WLqu uXahUEmTXPBha1xnFLXSchZsPvFxz0ByySsVwapJ+dx5tiQsmxavgyPCxjl/xpOVHXHd S2kxHtuV8SKivojr4qQiXIYXcGNfUFD+1/whmQbYbAPHKRJgwLJDtSTr81zYPhMx/DMA EI6myVgRwaXHnJXsLQdCkJurMaS1NCeE3fVjbn0pXEQmIcCi68vB8Cp+YINYelyk6w6D Qy97jKia/jDB6S2vi8e8JV97mgZ66B3nZO3NQfNTuDjvgyJr1uwwavBvzZBC1QtmKnrQ j8lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="NuXj/bvi"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si13271128ejc.652.2020.08.18.12.27.21; Tue, 18 Aug 2020 12:27:45 -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=@google.com header.s=20161025 header.b="NuXj/bvi"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgHRTZp (ORCPT + 99 others); Tue, 18 Aug 2020 15:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbgHRTZn (ORCPT ); Tue, 18 Aug 2020 15:25:43 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CE27C061389 for ; Tue, 18 Aug 2020 12:25:42 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id s14so3709392plp.4 for ; Tue, 18 Aug 2020 12:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/VmA06WjlqS7hJumtglP3Mb+v0u9+PDAlYaWZ4/eDGk=; b=NuXj/bviyolsRmu1RDbGz62VrMp2i+ohDBzBrMXgR+/HnFYFj/0i0LEFqlai3FiY2c kuQgJP40nkVZmAvEHb01vxOtwtfup5F8I4t3mmfPA+JMwR2OdWbevHG/++mRPaoSZ+h6 Z/neGTcxbz6ZHKdi4jqvnpQ4DQ8Cy5OdPvx3EMxID0/JEPk+WBINjqEkq3YcIbZmoS2r 1B7rxYFTF2g1fMnX1C70UCaAcNU/xYAcR/TZpQqoOOKgNip49d0iNQhJGyD+AV/QVjCh TRn/YZCIZQDPIXv4IxI3aAoQ+nmd0FFaUsj7vVZz7F5wClGHzyNTrcwNLtaaVTN+eYKe U/FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/VmA06WjlqS7hJumtglP3Mb+v0u9+PDAlYaWZ4/eDGk=; b=Lgc9smvdTJwl9iRC9TDnN9oWaD68WACF9B4doEXnoSIMeSQvcaPAPysQfb5B2Rgo1Y 3dt+4C687rERGVwhbOOugh8+dz6VjT0U4iubjsXW7Uc8+ooXytNDDBYjQUtv4R/sBAZb DHoGkGZ8DvJcBewGlaf10kkt3tUzsC/ldD2cwqadRp/47fhF1/gdtuePe0GuMzvxNgkG XrQf/bDn8jAadud8nHVZgP7jhUViz0Tc+V1xeZ8ahn2aPVC4fg1eXhXrHH/0n2Xbzko9 jSHvutgFlOk3w/jFTq6B6mYQQGELhnreoWcdqrKmyEXDCp/0mbi1eG7NJV4Lt7g8YmES t9cg== X-Gm-Message-State: AOAM533P9j44N64j64tFQ0ewPLzHnBvw2Qd9eHMP+rCgl2aq/DwK6Kyh R+fVTjwgZAyMTzU/HdufCzaXOJ3gKrPwZ8zsNpUp2A== X-Received: by 2002:a17:90a:a10c:: with SMTP id s12mr1162103pjp.32.1597778741520; Tue, 18 Aug 2020 12:25:41 -0700 (PDT) MIME-Version: 1.0 References: <20200817220212.338670-1-ndesaulniers@google.com> <76071c24-ec6f-7f7a-4172-082bd574d581@zytor.com> In-Reply-To: From: Nick Desaulniers Date: Tue, 18 Aug 2020 12:25:30 -0700 Message-ID: Subject: Re: [PATCH 0/4] -ffreestanding/-fno-builtin-* patches To: Linus Torvalds , Clement Courbet Cc: "H. Peter Anvin" , Masahiro Yamada , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Michal Marek , Linux Kbuild mailing list , LKML , Kees Cook , Tony Luck , Dmitry Vyukov , Michael Ellerman , Joe Perches , Joel Fernandes , Daniel Axtens , Arvind Sankar , Andy Shevchenko , Alexandru Ardelean , Yury Norov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Ard Biesheuvel , "Paul E . McKenney" , Daniel Kiper , Bruce Ashfield , Marco Elver , Vamshi K Sthambamkadi , Andi Kleen , =?UTF-8?B?RMOhdmlkIEJvbHZhbnNrw70=?= , Eli Friedman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 18, 2020 at 12:19 PM Linus Torvalds wrote: > > On Tue, Aug 18, 2020 at 12:03 PM H. Peter Anvin wrote: > > > > I'm not saying "change the semantics", nor am I saying that playing > > whack-a-mole *for a limited time* is unreasonable. But I would like to go back > > to the compiler authors and get them to implement such a #pragma: "this > > freestanding implementation *does* support *this specific library function*, > > and you are free to call it." > > I'd much rather just see the library functions as builtins that always > do the right thing (with the fallback being "just call the standard > function"). > > IOW, there's nothing wrong with -ffreestanding if you then also have > __builtin_memcpy() etc, and they do the sane compiler optimizations > for memcpy(). > > What we want to avoid is the compiler making *assumptions* based on > standard names, because we may implement some of those things > differently. > > And honestly, a compiler that uses 'bcmp' is just broken. WTH? It's > the year 2020, we don't use bcmp. It's that simple. Fix your damn > broken compiler and use memcmp. The argument that memcmp is more > expensive than bcmp is garbage legacy thinking from four decades ago. > > It's likely the other way around, where people have actually spent > time on memcmp, but not on bcmp. > > If somebody really *wants* to use bcmp, give them the "Get off my > lawn" flag, and leave them alone. But never ever should "use bcmp" be > any kind of default behavior. That's some batshit crazy stuff. > > Linus You'll have to ask Clement about that. I'm not sure I ever saw the "faster bcmp than memcmp" implementation, but I was told "it exists" when I asked for a revert when all of our kernel builds went red. -- Thanks, ~Nick Desaulniers