Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1136532pxb; Thu, 21 Oct 2021 16:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBqhHnSyvGgl2+5EWwfLwfuAPjUFAzeLkGYU+KwkZvIL9CUysRu3m9vKIRO/kA0sX37/Dc X-Received: by 2002:a17:907:6e02:: with SMTP id sd2mr7170038ejc.46.1634859915866; Thu, 21 Oct 2021 16:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634859915; cv=none; d=google.com; s=arc-20160816; b=PBTQcSMFfM34H8QsfcsDqbSTYC0Y9BdvBVrSYBimIeeMlYRx++ZkAbHgXmx2QIBfmC fAq3IlKff1c7fjtu01CcTVtdufSzpSpTHu3F0D2AsTyd5ws6ZXhmKKkMYrTiqHwpTGyH ccK04Lo8K1muKHl2TYs2z7ZxXIVKd98yCSziU+plgVkTn9YKUpL1j2mZX09zxMYkL5/5 Gx4eg9F9gVNgdPR3+yUgJZ/MiMmP2uRuVML3FbseyvyfX3IGvkMoEUtJ8bT1u0Z+84Hw mXzvQyZwbwrnp4ZsRsgvATo79s3x5oXGEaA2V4g/FTybPiqMjRMbNGZisoTlHjApifRH Doaw== 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=vbHn1t4w6ii4qOpK6OASHe+IZF0/K00mQ93D+vSWtbo=; b=IcTudjE5jI2FeLv7hruldFMQMOS44PJZmClx+wp88Xh9sf1WNDOH5jFamnu65gZH5k YBI0ciN+v7/6k/1/qdTLn4THCp1UDOXumsqqMGGrCDdZm+rgnm6wQcK+dM/GDVYKqlcf AJEVfKILibqjL33dLkbVArJaI4TwnXE+Z4aDNlkycs2Hw9doHqD+Y5cl6X0lzYAKFqC4 NuSBdJN9sXMOo0dk109qH1mQlO2JYJ+S9f5Z556eYvUsFn0DgAiscw7qGT0/kt4M7tWV wPDB1ncHNTJtL1jiRboYmn2+tLII/e+WoXfD/5mkGwJ5y1pDwP/DLA1JYUH9TUYNvAOM xvUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lvGYdZSi; 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 s13si9197531eju.701.2021.10.21.16.44.51; Thu, 21 Oct 2021 16:45:15 -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=lvGYdZSi; 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 S231844AbhJUXol (ORCPT + 99 others); Thu, 21 Oct 2021 19:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhJUXok (ORCPT ); Thu, 21 Oct 2021 19:44:40 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 531A3C061764; Thu, 21 Oct 2021 16:42:24 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id n11-20020a17090a2bcb00b001a1e7a0a6a6so654400pje.0; Thu, 21 Oct 2021 16:42:24 -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=vbHn1t4w6ii4qOpK6OASHe+IZF0/K00mQ93D+vSWtbo=; b=lvGYdZSiEg4NpLU4xu1JfC695jBAeKaDJyQRvBLH7sXDxR1zs75zHAZO3eX6CtqDvi 8h0TPWtdf1wXybZ2M/sXA7d3uDPgamYDnTWPItuq+jnlhTzsmG5znGqndIZJfbd7bpPP nDYBZdTtvQCvNB1+785SB9Y9lKDxklk28yPQd7DgLgmpCZLaZBxAM0fs4iRIQ6OFz+/n 1l6ppu9LBFTrVr/7/ApXbNRAEQ0/ESRpqEjIsGf1Qypbp4sNWze5gaom9bLMg991xqAQ /wgc57su+aGZS/WT7xD8dpfLj0kaySi/d+1POyxclnbj75SNF/uyiudy1gk5RqMLIIOj M0Uw== 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=vbHn1t4w6ii4qOpK6OASHe+IZF0/K00mQ93D+vSWtbo=; b=NhnljbeYtwQ5zeKjLGSbfuH+uC4dgz8GmQwUt8pU9rrS/oSmYfXBAGmfEwEUCjuT7m EwLhBELkP/qVxbfQDwDzPE0+uLH+x2e4ct2jg4So4NnwTF4QGO04b9Z2O5VUqIufiP+G ifYf1fqG6PujZSDWKw2zpHyPgyUs1lENsolaZDQrCj0r1bKtuOmLXokJfX8qorJwc+KS S+sDhiWwF3BSBDuU2qhscbpTN7iF0QiuN3RAEXSdVvd9esEeeu5+T/W/MRojHbsfElEu ifV36PCKMRqEZ47GoJb3WgzkRfZB/JRrDUTMbXeLbyjss6qpc9N5a6ZLJlN4xtMUcjYY jvVg== X-Gm-Message-State: AOAM53148HGCFgB6YxynYrsRVB+jaNkXvfoZmMfv5CuON9ndMe9pRRrp TTN6rbe0s/4po6E+nVxLNUOlosjDJ9hpE2U2p1E= X-Received: by 2002:a17:902:ea09:b0:13f:ac2:c5ae with SMTP id s9-20020a170902ea0900b0013f0ac2c5aemr8052334plg.3.1634859743484; Thu, 21 Oct 2021 16:42:23 -0700 (PDT) MIME-Version: 1.0 References: <20211020104442.021802560@infradead.org> <20211020105843.345016338@infradead.org> <20211021000502.ltn5o6ji6offwzeg@ast-mbp.dhcp.thefacebook.com> <20211021223719.GY174703@worktop.programming.kicks-ass.net> <20211021233852.gbkyl7wpunyyq4y5@treble> In-Reply-To: <20211021233852.gbkyl7wpunyyq4y5@treble> From: Alexei Starovoitov Date: Thu, 21 Oct 2021 16:42:12 -0700 Message-ID: Subject: Re: [PATCH v2 14/14] bpf,x86: Respect X86_FEATURE_RETPOLINE* To: Josh Poimboeuf Cc: Peter Zijlstra , X86 ML , Andrew Cooper , LKML , Nick Desaulniers , Daniel Borkmann , bpf , Andrii Nakryiko Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 4:38 PM Josh Poimboeuf wrote: > > On Thu, Oct 21, 2021 at 04:24:33PM -0700, Alexei Starovoitov wrote: > > On Thu, Oct 21, 2021 at 3:40 PM Peter Zijlstra wrote: > > > > > > On Thu, Oct 21, 2021 at 11:03:33AM -0700, Alexei Starovoitov wrote: > > > > > > > > I nicked it from emit_bpf_tail_call() in the 32bit jit :-) It seemed a > > > > > lot more robust than the 64bit one and I couldn't figure out why the > > > > > difference. > > > > > > > > Interesting. Daniel will recognize that trick then :) > > > > > > > > Is there concurrency on the jit? > > > > > > > > The JIT of different progs can happen in parallel. > > > > > > In that case I don't think the patch is safe. I'll see if I can find a > > > variant that doesn't use static storage. > > > > The variable can only change from one fixed value to another fixed value. > > Different threads will compute the same value. So I think it's safe > > as-is. READ_ONCE/WRITE_ONCE won't hurt though. > > But the size of the generated code differs based on the > emit_bpf_tail_call_indirect() args: 'callee_regs_used' and > 'stack_depth'. So the fixed value can change. Ahh. Right. It's potentially a different offset for every prog. Let's put it into struct jit_context then.