Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6204636pxb; Mon, 14 Feb 2022 18:40:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgNoGP39whtALZ5drD1efUsqcuiPK4Ssii5+8c6uHazTl9KbE3FHyFH7NR0yc9Vj36z8Ma X-Received: by 2002:a17:90b:3845:b0:1b8:be38:c66 with SMTP id nl5-20020a17090b384500b001b8be380c66mr1902925pjb.145.1644892800298; Mon, 14 Feb 2022 18:40:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644892800; cv=none; d=google.com; s=arc-20160816; b=bS0Wu+R2zKiDI2PhWp/IvVBE3rf2HqAn8NkUjGoV+BQaX7KjXSCOQwtstpWd4iV6/q PkfOVVMUC2jvfLqdBXOlSY6aC1e8k5OxNE8fQKB8JGAQgN9zNwVEN4F3SQBRUowNXCIi pDd0ZEz0g5jL07lBXDPTdsfSk2v9WLXEQ8F/kpsVQs6cS52QXdyeWH9wbz5tJlVttcgz +18N+1EptQhekgmBM1yJoQDG19YW2qRJmazzqfC+BC1Xha8t+zoz8NpeudzGDyT+3by/ lm50UvCXlJF6j5hr77yQxwmI7z3gzhDuuoZyvCMaNCkmVRJhKxRxd/GT0ZSTdVD8tIe1 XofQ== 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=OFruwUIxpJyCAJe6BUEe5KI8KczW9wuSS9rT9U6kwk8=; b=mProrMlYFvvFlJyHwzMnAYaFsya5eMBdU8cMBMgEwG04LA0Hy1p1307AkMxsQfJRCL AHmX35H3TkxHD1owO82F9edzpaa+n/s71VATCQpHw7r1UPE7JgeSIWQyRZyJiUauv6WB c9XTeJCkGRey1Vug8SLTAnmmH3Mr3fBWzJPTYPA6B5Z6n00T3M0exBF47uA9nbDG8gox fOguy6V2ha7h78N0gmqudsKuJp0g219wOmXh8AUcVOxdsnU7zThmAk+vUxOoEv/Cpco4 afF4qRgIdAKxpI2U3gbfxnEXpgcr+5NSDnjMhSxT8Jqqib0ovNXW3mNw3H/ei+wpDoRJ elpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=pNkfZ896; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s30si13450182pjj.71.2022.02.14.18.39.43; Mon, 14 Feb 2022 18:40:00 -0800 (PST) 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=@google.com header.s=20210112 header.b=pNkfZ896; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbiBOAeM (ORCPT + 99 others); Mon, 14 Feb 2022 19:34:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbiBOAeL (ORCPT ); Mon, 14 Feb 2022 19:34:11 -0500 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 360B512E9E8 for ; Mon, 14 Feb 2022 16:34:02 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id p22so261550lfu.5 for ; Mon, 14 Feb 2022 16:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OFruwUIxpJyCAJe6BUEe5KI8KczW9wuSS9rT9U6kwk8=; b=pNkfZ896aqQt7dxFAL3iK96SFQ7NoXtb2Ceidw3enkYzd0BLbOWPp60JGJUW+qHpzP vha9n63h1RLvgzCbw3+jQYFWQaCzLQ8wumhFW1a9hER8FUDMo215I+ch3kf3QAL6E5le wfg+eWhQzKrURlsaORbokfcPD25ZrXZngEdKY8/wbtkEmsPhlHRQGKCU8+37fX7AlUNN gPxty3ifxG7Ps7xfxpJu+jdhDgHNM8RFfh2TCd3LMjiZINYDyDkRhodU0PCMXA9Xdmx3 k1WO3HjmEjFYIwtTRi+Xapadzjmqc1y4DsUChFQjxHNF/kUwVYPM8/WaKLi3lTASQLbd rFeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OFruwUIxpJyCAJe6BUEe5KI8KczW9wuSS9rT9U6kwk8=; b=FNONy5ss5EdS1bwCneEMwW257IFaxfaOowP/tG81D1nk22v+2Wh4MIpBmPj5vDVR+N xsKxrxkZgUi94v63oZx8gJD4Aq8RPt+1p6pFU/LU6PEhAmPz/f9viw67DDWHOqe6hrPu TxtyUOX0vE0gOw6XXo/g5tQO7HMgYTP6gFNSV6IpfHtuZL/1R0mOI6f87NaQ2uPl5bKS j+VOpSr/bd+uLVXa0kJuXp3JhUAiX6nkN24Eo7fm8MWETVV5rSOs9oKc1LPAy3Ot4kpx JW77IjGhm+YAPJITWhV6IEvwyjK+/FcFjysnTk0wU3FBNoUiqJ/J5DH++FDhK/DJfVGM AkZA== X-Gm-Message-State: AOAM531sS7NUgdxK9iKkgVTlclyCUGgR9eZiKkAH2gGOz+WTGhmeBae9 KSM0QOeSMNZvGvTS0TKqXVW4fS17zEXXrhqbDv+Gc8bOMnKEdg== X-Received: by 2002:ac2:4e10:: with SMTP id e16mr1229400lfr.444.1644885240322; Mon, 14 Feb 2022 16:34:00 -0800 (PST) MIME-Version: 1.0 References: <20220204005742.1222997-1-morbo@google.com> <20220210223134.233757-1-morbo@google.com> In-Reply-To: From: Nick Desaulniers Date: Mon, 14 Feb 2022 16:33:48 -0800 Message-ID: Subject: Re: [PATCH v4] x86: use builtins to read eflags To: Bill Wendling Cc: David Laight , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "x86@kernel.org" , "H . Peter Anvin" , Nathan Chancellor , Juergen Gross , Peter Zijlstra , Andy Lutomirski , "llvm@lists.linux.dev" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 On Sat, Feb 12, 2022 at 1:23 AM Bill Wendling wrote: > > On Fri, Feb 11, 2022 at 4:24 PM Nick Desaulniers > wrote: > > I would like to discuss this further off list with you Bill before you > > resend this patch again. > > That won't be necessary. Bill, I'm sorry; I could have worded that better+differently. In code review, I tend to use phrases like "consider doing X" for suggestions that are merely suggestions; things I don't care about. I should have been more explicit that my concern regarding released versions of clang and CONFIG_UNWINDER_ORC=y was not one of those cases. I like the intent of the patch; with the following fixups, I would gladly sign off on it and encourage the x86 maintainers to consider it further. 1. handle the case of released versions of clang and CONFIG_UNWINDER_ORC=y. Something with a grep'able comment for clang-14 so we can clean that up when the minimally supported version of clang is bumped. 2. update the commit message to refer to previous commits that modified these flags, as per Thomas in response to v1. 3. Note no change in generated code from GCC, as per Thomas in response to v2. Perhaps test a few more configs, since I only checked kmem_cache_free yet native_save_fl and local_irq_save have MANY more call sites. 4. Add `Link: https://github.com/llvm/llvm-project/issues/46875` to commit message. Optionally: 5. Add notes to commit message about the intent of this patch improving profiles for kmem_cache_free for CONFIG_SLAB=y. Feel free to use numbers I cited from our internal bug and https://lore.kernel.org/lkml/CAKwvOdmXxmYgqEOT4vSbN60smSkQRcc3B5duQAhaaYoaDo=Riw@mail.gmail.com/. 6. Add note to commit message about memory operands from Agner Fog's instruction tables in the above lore link. 7. Add note to commit that compilers can schedule the generated instructions from the builtins among instructions from surrounding C statements, which they cannot do for inline asm, as demonstrated by https://godbolt.org/z/EsP1KTjxa. Actually 7 is probably more precise than 3. Since there's no change generally in terms of operands chosen AFAICT, but GCC (and clang) could now better schedule instructions. It's still a good patch; please stick with it! Let me know how I can help. -- Thanks, ~Nick Desaulniers