Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1323181rwb; Thu, 6 Oct 2022 11:18:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dFyo+Tlg6I6kuKgi25e3vgf4cpdlLJpZzl+xJsn3pOClm8b72PnAWYWhd32mDYx0VKJzl X-Received: by 2002:a17:90b:1bce:b0:205:e4cd:612 with SMTP id oa14-20020a17090b1bce00b00205e4cd0612mr1051745pjb.32.1665080292093; Thu, 06 Oct 2022 11:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665080292; cv=none; d=google.com; s=arc-20160816; b=AgPR5dvHZcScsacNJ8rM0MGXS3Z+fZ9CIvBkukqVDXznsTVGk4H+IdzdAZWFDidiiv WogiETFIdJay4x3Iw0Jl6OmfzvwMpC2rg5WFWAisVTgiDMocrNTguDeVezbozAoZxtAi lAw1apBwPkMvHkfYUeP5DYvI+HWOrQ1au7XbTx6yGJ2d8OYaktb8hOUNCwxKwywV98LG Ncs5xC5nDfegrKeHR/mMdQnIjLPEorMgw+gxRQONauq6t8yfnTzp50ejo3m8AHz1M+fo gZbubAdZJWMPnJMa/qcR9Tc6dxaf6M+ZSO6ue0+RVA/rxQyj1QgKmZmK92VWdG6QWYcA hU3g== 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=Ew5U/zqlN15J4j3h5hCZA2cjGBGnLv9k5+/aqrXH4Z4=; b=BCRoUjM6wbty22idoMT348YCpNgUlhccc2PUv2GJKy7cUEfSMs2hQnShucAOS8NQ/k jbnbRhFpgnaw1KVeW6HVZeDMuHIpPSas2mNctbW9UjZ3GP1eOcVx2ndRHUoJXojQDvyX 1CUAf6wiGv111PMr2rT16J5+uuVciyE06ytvSKvBmVMS7S1SrrwtOigTALBVYq6Lgxet S2Wjov23+2YfLFKdNGg5aOEDPgPYoif8Zc3aQ8ViTv4VOHkyRP9LqPgA2CcUw9OlruTO Puw4D7RGat2XJ8hY0MmQU+oHdAku9nOI4h0ZR2aScrjdB4TngN5vuM5+NZ6Q/UVr7lSB t26w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=pRTmbm0M; 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 s7-20020a17090302c700b00178a4067331si20203098plk.295.2022.10.06.11.17.55; Thu, 06 Oct 2022 11:18:12 -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=@google.com header.s=20210112 header.b=pRTmbm0M; 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 S231653AbiJFR5D (ORCPT + 99 others); Thu, 6 Oct 2022 13:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbiJFR5B (ORCPT ); Thu, 6 Oct 2022 13:57:01 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2B9AE204 for ; Thu, 6 Oct 2022 10:56:59 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id h8-20020a17090a054800b00205ccbae31eso5011247pjf.5 for ; Thu, 06 Oct 2022 10:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=Ew5U/zqlN15J4j3h5hCZA2cjGBGnLv9k5+/aqrXH4Z4=; b=pRTmbm0MH/KaCv4CN2mlwOQHH8KkdTrXQ4+icasRMMZjojQKWwyW2hZ5bKHq5UouEn ad/1CjPi+CiChlZW8AppPN0is27kUmyRMX7GD2t0wTb+9Zu6OBxbFlQPexrtbx8y5RAA k1jNndWDe7cju5EdavxVLasH0BysgPwxLSnyV4DXxhQcGB6pzErnXzMxTcYm35V6PVFV UEWLggnHagS8Za1Nh9FMd5UQFg6qjGSstyPDkEFQuXEpQx1ZshOA6qySlqv4yqBnp4WQ oWRv5g+ra35HXYY7vzicv7iadRrBGyZ+dQH4aqzup/eBDFEXlTaNBX+dfhwrKiHqq1oI ttqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=Ew5U/zqlN15J4j3h5hCZA2cjGBGnLv9k5+/aqrXH4Z4=; b=RzaUMxL+P9POqUDx8FaiPha+5pMCMlzDABU43//JcHdWQRP2IT2dRlcHjXq9rZPJIK 5ne3ZFe1RKMdcu7o7xmmxfPHgKztLeJeJF7oUOEQ4ydPhhKxkfWf7toYS+OPP6BRbj8w SJd+khDAe5jaPGCtd9Wgb+ulcyustV5r6Pyz/pJxQqsh9qxBrdIx5FZEvTJU09me6sPb /V9JsAdQZNb6FKAY9oVYkHFdqXZ8CeQq6EbvJhIzCWoGRKr86LzLC1DB0FjIU44wGUFJ NuLngi19dHdyCPLw5+1sTPZfhghHOV7I6kjiazq2HA7Ad8pl7wFH7GsIQioSXn9MlcZJ 4AAw== X-Gm-Message-State: ACrzQf3wwcDeZFJILE/lowFu0G0G1v9JyPWhbTN/gYm3ewG4G7P3TYk/ sDMPIN03qZanZUKXMhfutU+S/07speNt929tX8ovHA== X-Received: by 2002:a17:90b:33c3:b0:20a:ebc3:6514 with SMTP id lk3-20020a17090b33c300b0020aebc36514mr10329734pjb.147.1665079018869; Thu, 06 Oct 2022 10:56:58 -0700 (PDT) MIME-Version: 1.0 References: <20220817185410.1174782-1-nathan@kernel.org> In-Reply-To: From: Nick Desaulniers Date: Thu, 6 Oct 2022 10:56:47 -0700 Message-ID: Subject: Re: [PATCH] x86/build: Move '-mindirect-branch-cs-prefix' out of GCC-only block To: Peter Zijlstra , Borislav Petkov Cc: Nathan Chancellor , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, "Moreira, Joao" 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, 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 Tue, Oct 4, 2022 at 2:27 PM Nick Desaulniers wrote: > > On Thu, Aug 18, 2022 at 12:45 AM Peter Zijlstra wrote: > > > > On Wed, Aug 17, 2022 at 03:08:01PM -0700, Nick Desaulniers wrote: > > > On Wed, Aug 17, 2022 at 11:56 AM Nathan Chancellor wrote: > > > > > > > > LLVM 16 will have support for this flag so move it out of the GCC-only > > > > block to allow LLVM builds to take advantage of it. > > > > > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1665 > > > > Link: https://github.com/llvm/llvm-project/commit/6f867f9102838ebe314c1f3661fdf95700386e5a > > > > Signed-off-by: Nathan Chancellor > > > > > > Thanks for the patch, I also boot tested this (in virtual guests for > > > both 64b and 32b). > > > > > > Reviewed-by: Nick Desaulniers > > > Tested-by: Nick Desaulniers > > > > > > Peter, is there anything else special about these prefixes needed to > > > make use of them? > > > > The thing to do is boot with (warning, *very* verbose): > > > > "spectre_v2=retpoline,lfence debug-alternative" > > ah, debug-alternative also needs loglevel=8. Was wondering why I > wasn't getting anything new in the output... > > No kidding on the verbosity. For a defconfig, booting in QEMU and > redirecting stdout to a file produced a 95257 line file. > > $ grep "SMP alternatives: retpoline" /tmp/log.txt | wc -l > 18623 > $ du -h /tmp/log.txt > 11M /tmp/log.txt > $ grep "SMP alternatives: retpoline" /tmp/log.txt | tr -s ' ' > ... > [ 56.736261] SMP alternatives: retpoline at: > pm_check_save_msr+0x30/0x80 (ffffffffaa34b320) len: 6 to: > __x86_indirect_thunk_r11+0x0/0x20 > $ grep "SMP alternatives: retpoline" /tmp/log.txt | tr -s ' ' | cut -d > ' ' -f 10 | sort -u > 5 > 6 > # Curious about the 5, looks like there's only 2 cases: > $ grep "SMP alternatives: retpoline" /tmp/log.txt | grep 'len: 5' > [ 0.147261] SMP alternatives: retpoline at: ret_from_fork+0x1d/0x30 > (ffffffffa9601dbd) len: 5 to: __x86_indirect_thunk_rbx+0x0/0x20 > [ 2.274261] SMP alternatives: retpoline at: __efi_call+0x23/0x30 > (ffffffffa9671663) len: 5 to: __x86_indirect_thunk_rdi+0x0/0x20 For the typical len 6 case: [ 0.710345] SMP alternatives: ffffffffa2b6d1f2: orig: 2e e8 88 5f 09 ff [ 0.711345] SMP alternatives: ffffffffa2b6d1f2: repl: 0f ae e8 41 ff d3 [ 0.712345] SMP alternatives: retpoline at: setup_arch+0x4b0/0x58c (ffffffffa2b6d2ef) len: 6 to: __x86_indirect_thunk_r11+0x0/0x20 2e is the cs prefix, so it looks like this is working. https://github.com/llvm/llvm-project/issues/58201 :^) > Is there anything else I can do to help verify Nathan and Joao's > patches? If not, would you mind Ack'ing this so the x86 maintainers > can pick it up? I see it's already been Acked, so NVM. This is good to go. > Noting that Joao's patch was applied in my tests. > https://reviews.llvm.org/D134915 > I plan to land Joao's patch imminently. Merging. -- Thanks, ~Nick Desaulniers