Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp88207pxb; Wed, 20 Oct 2021 17:12:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3Gz4tpnN1FsASIBmdGgGtjnoxV8XfjoEX28xTPxbpUc3UkzyfrHZdXphHDkmoX51O/rMl X-Received: by 2002:a17:90a:d48e:: with SMTP id s14mr2595865pju.49.1634775137545; Wed, 20 Oct 2021 17:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634775137; cv=none; d=google.com; s=arc-20160816; b=vtID/vJjPwrlI0omsa15GGhlAlgqZE7d1m2GT7VY+Uu9L6JHKZjjvfd3lLlUYTv+rA 793iz7bWv6lJRugmHPzfiBxsntzlhBZ/jRLUIy1ZgDtb3U8drTnciBXDeh9yyx6FtMUd eRogSR4xgvHXK00/2kxPzpKzJMg0aDESVSWQkwyyhNOKanFCryyCZJLW/BJ7rOxh+6FQ Kgs2qsDC6D4B8PF636Db1QiJWhnhgsTAgez7jWx0yiMIBtbMGcDlcK9vLTFVhHcF1bXv 8quSS063lPFA508yuclS4ElxMA8zFKOUXOExlca7dF25yaKCaS+ZowJPqOTvH4pOZYZv J/Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JyQgagoQZSzTZxL2J4mkxpxPInrkdzrDivEAkUlihtQ=; b=PJOyGGBjv+zH13ASqHWigiHYksseNcrxGijRqKNHMh411kl7Fg4ju3MhzDVW0X7IsE ciGOuxY5tXxN/+vib4rKk+Zbyygg8GinvQf2dMu0gc8rj13hRsB4woqYxiP8hXS+NMFD 1Zxv7MwzSqxoIJikAv9L/X0zE11+bN4a23uNSzQDJY4jsyn47HioHi3eMrgfwb3X6kmK Of6M65ANY34qQqRDpcWJ1GKkom10PIySItRB4i+9EBB1kkMeMcWD904pJqF0NPurPr6c Qm/F7OMSKxxTVOyimHhcUSKP5hMJ8RKZ/CokVZg/2koDTH25YyOVRilD+B43Nev6sx1r Dsaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p3pX7gih; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k4si6703948plk.60.2021.10.20.17.12.02; Wed, 20 Oct 2021 17:12:17 -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=@gmail.com header.s=20210112 header.b=p3pX7gih; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbhJUAKL (ORCPT + 99 others); Wed, 20 Oct 2021 20:10:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbhJUAKL (ORCPT ); Wed, 20 Oct 2021 20:10:11 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37C4AC06161C; Wed, 20 Oct 2021 17:07:56 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id a15-20020a17090a688f00b001a132a1679bso1805364pjd.0; Wed, 20 Oct 2021 17:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JyQgagoQZSzTZxL2J4mkxpxPInrkdzrDivEAkUlihtQ=; b=p3pX7gihCX4twMBURgUKiz7Xe7Z8LQ1enaFG3QZahZhMU1ylIrxztbdqeUBQ9IaQwM I98Sz8Ikx9/qNv39F0M6AphOOFV0tZyBHsb7Q2mnO8EFa1MavBo2gcJ59pheeHj3xRf/ y/hOTOnIPLu4WLBVyen+25AzMfuRHq93vGwEWWx+kGfBqTUVUQdhkazACUudPcG1Tehc w8P9T8u+2TTBXibAV96vp1PFPHcr/CoLxV4QbdOhTwGQh6pnjAEXPCVDwWxXZIVLfrOu LzF95xr81LhOY7HbNRnh/2+BnD+e04SwDrF3/N9IQjGlstkT1Rh1hbsOpkXLIWoTvUcS 6pVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JyQgagoQZSzTZxL2J4mkxpxPInrkdzrDivEAkUlihtQ=; b=XJ8m038rlZ50hEQd04jI0nAk5JJYAApc2nuyJPHaW/vI4WYud1k1YyCSXc9bxoDSkA iUJDcIOtBfKeShheuSQHgZ7lJD6B8CrrUm2EIETNuuzcDb5It5x0lgvUZH2E6SHSw6Wl YaIG9gNk7vO6BSP/xyvPS3YRqOasDi4gCLe14cSNaw6V72V23lXlFjcMTmx1diIa33ZH a61YeRtw1Yu4SSRQfYxD+jN/6Af1IkyIHAbKl1Wz5JUUcQP2mIN4huMhqIn2CQOiKrur poA3sUeppwRgIpN0vOqcn35huQSYFNMi4WHMoO5d8OH67GlTw82ttzqokzpAnFYsUEov 0YQw== X-Gm-Message-State: AOAM530Zn+lZdm/BLpQ7IwVw9p4pClfJEiGfOqkQxB+GlLTUr/zFBQbX vaAwBPQSs8LINx9pvd1B3JM= X-Received: by 2002:a17:902:d2c4:b0:13e:1272:884a with SMTP id n4-20020a170902d2c400b0013e1272884amr2085278plc.34.1634774875693; Wed, 20 Oct 2021 17:07:55 -0700 (PDT) Received: from ast-mbp.dhcp.thefacebook.com ([2620:10d:c090:400::5:8c95]) by smtp.gmail.com with ESMTPSA id e2sm3637285pfd.137.2021.10.20.17.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 17:07:55 -0700 (PDT) Date: Wed, 20 Oct 2021 17:07:53 -0700 From: Alexei Starovoitov To: Peter Zijlstra Cc: x86@kernel.org, jpoimboe@redhat.com, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, ndesaulniers@google.com, bpf@vger.kernel.org, daniel@iogearbox.net Subject: Re: [PATCH v2 14/14] bpf,x86: Respect X86_FEATURE_RETPOLINE* Message-ID: <20211021000753.kdxtjl3nzre2zshb@ast-mbp.dhcp.thefacebook.com> References: <20211020104442.021802560@infradead.org> <20211020105843.345016338@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020105843.345016338@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 12:44:56PM +0200, Peter Zijlstra wrote: > + > + if (cpu_feature_enabled(X86_FEATURE_RETPOLINE_AMD)) { > + EMIT_LFENCE(); > + EMIT2(0xFF, 0xE0 + reg); > + } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) { > + emit_jump(&prog, reg_thunk[reg], ip); > + } else One more question. What's a deal with AMD? I thought the retpoline is effective on it as well. lfence is an optimization or retpoline turned out to be not enough in some cases?