Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp162570pxb; Wed, 27 Oct 2021 00:07:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwL/GRSKyB4upn2uwS/uTWlb6W+e3X8sNpPPs498QK2XwddYmThTUtovVidqTcT3jML1fVh X-Received: by 2002:a17:90b:1649:: with SMTP id il9mr3959475pjb.167.1635318437565; Wed, 27 Oct 2021 00:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635318437; cv=none; d=google.com; s=arc-20160816; b=qvieLIsVT8zFrzWYXfPagk+RFDHh2Vjc8aXbgQ8dd5vocous5SXV0LhSMMOGoetq6u 8kzwE+f8wZEhHYGv6vriK9HL0elWOaug2xPak/NdYaVidjTF4amQaVKeQh8vu77o0Cj7 qPGWEgHhEwqQy0x7be81jCKSlk0lrlV3haQ4wo1IFzoCGMLrraYbxEqPSttcSPfK1hSE 06/kDi7r6L+ExnY8PoLe5aIskcRk3Fz17CMI3Nses3VLBerN1s+K9qtGUAMtW0Tarnd8 nngQsRxnZEk/VdomrvDM/0kVi4T7idCDSt8Rcq9HyIAHlJhCtxdnlVy+ycBIh30GVEts O/Hw== 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=q8MHfbr/h/oCaPvOavFxnKFNIvOBGsa++z17VUpzTuY=; b=sPFfNh5o3q8uG9Qk1MK+i3726D0c5b+WRJ/LLfUe7PZltxtlkGDl3bSzsafNXSrq+q OGs5LNYbJFklzpfXeNQiwFNRQkBK8RvQWeSYZkEGn1Wr+fidcuKLgy1GjDKHjLP1HuCb CjwTuN9qTznSTK8kdX7oSWl84R7UV+Xkj01Sw6JrotNVG6kh7V+yt6ZBxXTgFO0YB5gv j6f0QIFLEZBjZeYnelMW68hHkG4IvCG/StIuqYikElc+QmK+9hGAvmqvUMCAt2E3wBM2 gxQaTHgbiqY8J6YXMjMm2rcKp4i+r/vvraTBMqrrscDO3Sgg0l4K0m+RlFO8f3SV8611 ZJXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gNl/g+F2"; 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 o9si28806168pfe.322.2021.10.27.00.07.04; Wed, 27 Oct 2021 00:07: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="gNl/g+F2"; 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 S238269AbhJZS3d (ORCPT + 99 others); Tue, 26 Oct 2021 14:29:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234464AbhJZS3c (ORCPT ); Tue, 26 Oct 2021 14:29:32 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3675C061745; Tue, 26 Oct 2021 11:27:08 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id t184so340890pfd.0; Tue, 26 Oct 2021 11:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q8MHfbr/h/oCaPvOavFxnKFNIvOBGsa++z17VUpzTuY=; b=gNl/g+F2Em5sxOb14g5D+x6Mdr9Xd1fc7Onej5+HHjPWRzRliJIUmqSYvjF5ep4eZP uAhkRaIc+q6ZqGLjUmH4mHqqXBIx1rpCLh9wa4oEsdCs2zLNXVwIAxjnvyvzBsSlJw22 RHpX0wODi4uAT8B8V6FqG18lAKQjTEBW/yyvquTJYAA2zwDchL8Tm836c3AX6wjapIi8 IxmbMU4JWAVZoTjVfLs++ekSRAby07YstdgG2frUXy571x4LopeSb7umk5ynYOghc1Fi WOiFayj/uz4z41YUWXEQIMUhCKXHCnW9RAmgqVLBArNmv6PnXMRyphlMd2LMTtsf6/JD 1sqQ== 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=q8MHfbr/h/oCaPvOavFxnKFNIvOBGsa++z17VUpzTuY=; b=Jv6GpT61q0Hd1/Y+uT/TutlJAX+liYiJHeiPkad5/Sjh/uNRNppHkBl6uSyJzAL8ZZ 22fEL5PYwUSVLgvPc9DWZGh7/BKrm/dyGlhcTeeukkirKC/TOvC0cSRJV/dkHMiD1O10 vR5g5n6RrV4q2jAh1pfPH66uJeM6mFh6gpjaoc3+xhAOrLDXw8/TrbhVnp9/O8e5Neta QAeLv+c/7+7Oh6xkLSvPNk/8TuIqHkwvwI7h0YEDAVAxMDjKVSmG7OxPliIdJZ/d29pj gsdj214SQddiZTs+Fj+xpJ6frY4X8i0IMnf1i5NEqdPM11MMZEdIgzv6NNhoPi4neauz eTWA== X-Gm-Message-State: AOAM5325yj5nOosD4JrB63y/GYXdlk9Sb1hkRWJK+8PIO58BVm4jN7a6 cxym+Ez49rE+HtMCSdjcCRQgvwpk7OYFZncYLGY= X-Received: by 2002:a63:4f57:: with SMTP id p23mr20260824pgl.376.1635272828098; Tue, 26 Oct 2021 11:27:08 -0700 (PDT) MIME-Version: 1.0 References: <20211026120132.613201817@infradead.org> In-Reply-To: <20211026120132.613201817@infradead.org> From: Alexei Starovoitov Date: Tue, 26 Oct 2021 11:26:57 -0700 Message-ID: Subject: Re: [PATCH v3 00/16] x86: Rewrite the retpoline rewrite logic To: Peter Zijlstra Cc: X86 ML , Josh Poimboeuf , Andrew Cooper , LKML , Nick Desaulniers , bpf Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 26, 2021 at 5:05 AM Peter Zijlstra wrote: > > Hi, > > These patches rewrite the way retpolines are rewritten. Currently objtool emits > alternative entries for most retpoline calls. However trying to extend that led > to trouble (ELF files are horrid). > > Therefore completely overhaul this and have objtool emit a .retpoline_sites > section that lists all compiler generated retpoline thunk calls. Then the > kernel can do with them as it pleases. > > Notably it will: > > - rewrite them to indirect instructions for !RETPOLINE > - rewrite them to lfence; indirect; for RETPOLINE_AMD, > where size allows (boo clang!) > > Specifically, the !RETPOLINE case can now also deal with the clang-special > conditional-indirect-tail-call: > > Jcc __x86_indirect_thunk_\reg. > > Finally, also update the x86 BPF jit to catch up to recent times and do these > same things. > > All this should help improve performance by removing an indirection. > > Patches can (soon) be found here: > > git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git objtool/core > > Changes since v2: > > - rewrite the __x86_indirect_thunk_array[] stuff again > - rewrite the retpoline,amd rewrite logic, it now also supports > rewriting the Jcc case, if the original instruction is long enough, but > more importantly, it's simpler code. > - bpf label simplification patch > - random assorted cleanups > - actually managed to get bpf selftests working Great. The patchset didn't go through BPF CI though. See https://patchwork.kernel.org/project/netdevbpf/patch/20211026120309.658539311@infradead.org/ It's a merge conflict. The patchset failed to apply to both bpf and bpf-next trees: Cmd('git') failed due to: exit code(128) cmdline: git am -3 stdout: 'Applying: objtool: Classify symbols Patch failed at 0001 objtool: Classify symbols When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".' stderr: 'error: sha1 information is lacking or useless (tools/objtool/check.c). error: could not build fake ancestor hint: Use 'git am --show-current-patch=diff' to see the failed patch'