Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2373565pxk; Mon, 14 Sep 2020 11:31:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPPc8E20AswWco1sifoJaYDuDDrCsnVMHC34rDdPWNPQvsOgK+rgu2GX/p7/LZGJADbcz7 X-Received: by 2002:a50:cf0b:: with SMTP id c11mr18131375edk.87.1600108308232; Mon, 14 Sep 2020 11:31:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600108308; cv=none; d=google.com; s=arc-20160816; b=vC9RHOF2H36/FU0D3CN7cFqieZAOsKa/Cy1VbBOSFniOFdUMK1ZBUv7lBufPbK2Q4p vCJ3E3Xz9iHZ2IisMOS42ebyVuOZzj0IhG+DlQ6jB4uhwfIcBkoZ1y1V2IUjJx1UYN4m 6/t8z6ZjItkA1rJXw/J9VEDYBly0XPRispyevd+GYys+CSMNeFdT/Ph2gcEQ3p3wwcai YTwFkPS7bYAkkPFqeBP3wuIWgi+9VGy6Vw7iUYRhRlOnvDokCG6sOa+zgy8hORlWL5ur RUFQdOPi+pBj7JGeAbnWXAaO4RYpg6bXyv0zS4fFLAib4erfNU9lnVm8TLZrQDQMErnU yBHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=W3YbmmsfMHlVdLS6jlOLoQAflYIsxSXUugWSN1kR+Rc=; b=ytxvXTlPEIjhWFUV8/Ti/DhKtawnpsxPDHJGCvucSGR/KTAumEjzI8jXjGdaEMPw8J HAqPTpBZBZYaPFA2p5qygSf3f62BFT5P9WZhAnXQAS8mzjRm4TUm3QICd4X7CsZ1+3zF yWErbD9GExE4fteI3oLqLoZygux8+NGcZGHRnccwVQpqOcWM+ONxo8rwkRTD8cikLZBA GOzv4LWhPAAEUAudlv+5oGoU8p4386djHTCLPzDpa/NaL5MJHGeRP8eXcZM0sr7ZUr5O ST1TcW0Wi5ptXevpRyN7KcIlRXBxxmqlQHKh3DfMSDPnqIePBNNM/MFQPnWzyLWOZ2JD mP2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6ZDna6I; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si7908693ejj.57.2020.09.14.11.31.25; Mon, 14 Sep 2020 11:31:48 -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=@linaro.org header.s=google header.b=Y6ZDna6I; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726044AbgINS3s (ORCPT + 99 others); Mon, 14 Sep 2020 14:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgINS2C (ORCPT ); Mon, 14 Sep 2020 14:28:02 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38C6EC06174A for ; Mon, 14 Sep 2020 11:28:02 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id w2so977223wmi.1 for ; Mon, 14 Sep 2020 11:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=W3YbmmsfMHlVdLS6jlOLoQAflYIsxSXUugWSN1kR+Rc=; b=Y6ZDna6IoIoMEvcCeX8HsYV6y5FPwgzJsnsokv96XLNqt3SNXxCM+Z79rfnLiyStCE Muo3JB7WJnyMkZuqp6Ix6dd90jr5V4xhLE1y0JKJmfLJjPTPdcMLxkt9+NCWR9ptZiD5 8/LRFoeOAHM9vnqIEh/YpuIrpjmI6r0yYwHIAB/yxNDCtDTvHtzY/gRXZw0jzU8DJ6F0 Js5DdlCtvhBfq1cIXuWba3rlUzKBodjzXdCdujyGzLUyxBTjIJl/1W9YKjT8LP6mVPle AcgJdV9z+XuJTJUnu4IuWaGWHm0qMdypbmU45KBUpE8awMEcAnapLRZ9bYP3yNoGG0DN 5W5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=W3YbmmsfMHlVdLS6jlOLoQAflYIsxSXUugWSN1kR+Rc=; b=ZgGxbpydyW5nmqiaNycp2ktLMoMnuPvQcjJR/XydolxOpuZM0O7g08K6mowRINWAiJ LxP2ZFHQTVXJoDN5JwRX2RVvRqv6oiGm4BXjUnbv7if/I5ULQTw3w7XnZTCS19OOiMZE 3rmOmgOZe92ilTlOnXpNakpyFTiI7gqMf/G1v1+Y5AGOTykEx8zmqaLif8lslzaMA0WV YdMLHUAN17p82Dgx/LRZCnvB98jtFddCbKrgOUKv17+YAYFQUgY8nJr1opacpsI9mVRi GV0rakGFubuFST5IU5Re6wEhpdgPL7vqZEdciM9Ba31dE2vDPzdPEJhynzyvgP6/1MUW wQww== X-Gm-Message-State: AOAM530PusPPGCigdj41i5PCS59b1RdThwvPh0iLPqnKHAbgrTRw6I6H erGGR55P3wJC33jciPSwynsKgg== X-Received: by 2002:a1c:e256:: with SMTP id z83mr683787wmg.137.1600108080849; Mon, 14 Sep 2020 11:28:00 -0700 (PDT) Received: from apalos.home (athedsl-246545.home.otenet.gr. [85.73.10.175]) by smtp.gmail.com with ESMTPSA id s26sm21264637wmh.44.2020.09.14.11.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 11:28:00 -0700 (PDT) Date: Mon, 14 Sep 2020 21:27:56 +0300 From: Ilias Apalodimas To: Xi Wang Cc: Jesper Dangaard Brouer , Will Deacon , bpf@vger.kernel.org, ardb@kernel.org, naresh.kamboju@linaro.org, Jean-Philippe Brucker , Yauheni Kaliuta , Daniel Borkmann , Alexei Starovoitov , Zi Shen Lim , Catalin Marinas , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List , Anders Roxell , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Luke Nelson Subject: Re: [PATCH] arm64: bpf: Fix branch offset in JIT Message-ID: <20200914182756.GA22294@apalos.home> References: <20200914083622.116554-1-ilias.apalodimas@linaro.org> <20200914122042.GA24441@willie-the-truck> <20200914123504.GA124316@apalos.home> <20200914132350.GA126552@apalos.home> <20200914140114.GG24441@willie-the-truck> <20200914181234.0f1df8ba@carbon> <20200914170205.GA20549@apalos.home> <20200914175516.GA21832@apalos.home> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Xi, On Mon, Sep 14, 2020 at 11:08:13AM -0700, Xi Wang wrote: > On Mon, Sep 14, 2020 at 10:55 AM Ilias Apalodimas > wrote: > > We've briefly discussed this approach with Yauheni while coming up with the > > posted patch. > > I think that contructing the array correctly in the first place is better. > > Right now it might only be used in bpf2a64_offset() and bpf_prog_fill_jited_linfo() > > but if we fixup the values on the fly in there, everyone that intends to use the > > offset for any reason will have to account for the missing instruction. > > I don't understand what you mean by "correctly." What's your correctness spec? > > I don't think there's some consistent semantics of "offsets" across > the JITs of different architectures (maybe it's good to clean that > up). RV64 and RV32 JITs are doing something similar to arm64 with > respect to offsets. CCing Bj?rn and Luke. Even if that's true, is any reason at all why we should skip the first element of the array, that's now needed since 7c2e988f400 to jump back to the first instruction? Introducing 2 extra if conditions and hotfix the array on the fly (and for every future invocation of that), seems better to you? Cheers /Ilias