From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D21B2C433E2 for ; Mon, 14 Sep 2020 18:29:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8959421D41 for ; Mon, 14 Sep 2020 18:29:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Y6ZDna6I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726062AbgINS3A (ORCPT ); Mon, 14 Sep 2020 14:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbgINS2D (ORCPT ); Mon, 14 Sep 2020 14:28:03 -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 56180C06178A for ; Mon, 14 Sep 2020 11:28:02 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id e11so9429343wme.0 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=PIJjDGdkSOe4fYOG23vlYjvjyoYC8N2moXVSG/yr7P+bjHh3YrQAKfF3LbTrHox2+N DmyOm49Y95vWTV/jRAqWak8eXw1Yd2IRFRl4laMuZEU58QH1NTkF0O+t4j+J98KRedNl nUXIcRsibHuZcVOxYhyNqVCMWzqo+NHNpHAZWhpCm22ts38/NIgAnyvwKplzVU/EQ0tx /ACJVYpxp9RDSgqy1Ya65pYfxEKuouq/v7sdsJ4hxU3SaJu0IW8AHN3zv0Vtf7q2S9UT 98G/tB11rq90XThErOu6M/5HplxTXLwyZNtEB1Qpg2LZnpBsPnze6PbCf8SMp6R28IVn qznw== X-Gm-Message-State: AOAM530GV4RSQv95I1qG4344OJX9fbE2xBdSBxEf7kkDMXyFneOccsSm I9WdI3oiFSm2Y1wtl1c29N1DZg== X-Google-Smtp-Source: ABdhPJwqlkc2zKOHr4CZKudC+z5XkhQYQppbD4OIiflpEBJodVcF2fyVWwwJjG35lxfxhFMJRptUqA== 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: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DEC8C43461 for ; Mon, 14 Sep 2020 18:29:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DB2121974 for ; Mon, 14 Sep 2020 18:29:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JGQc0oCR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Y6ZDna6I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DB2121974 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HfO6GlkeVFFYnHDwPVqj/6ce+vC/WcKjA8MEwsDRTG4=; b=JGQc0oCRiCEI3SLy/9b/A17PF Gyt3d7lAwUjRos7P2jLuk8dGANonzGuH5Gjyt4ju8I/8KO+v48sMk/JdubiLHDb9JqnzCIENU5RW0 hFAVoGEBmdNy+nb8DwHbQjNdchiLNW8sX7pGQ0XjpWEWvx/haSqkLNVSpZ54Ox+fHEG39SaFQiTAp LJhnNIQZ5aonpJgTH2Z9M9NY5PBJSnqWx4OeXg4RZLuJZWsBaL6uYI2MrLqpWumZzOElTURKw0Dt+ 2Tm8SdEyPbanJ9AVyPbqckQETd5LisIJmsWDiS40OK/M5jlxtSY76e74dN60bA69jReZ1K9UQ1j1+ enH+8kL3Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHtCv-0003sm-4h; Mon, 14 Sep 2020 18:28:05 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHtCs-0003rs-Ei for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 18:28:03 +0000 Received: by mail-wm1-x344.google.com with SMTP id e11so9429342wme.0 for ; Mon, 14 Sep 2020 11:28:01 -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=JQ54f1Iz2hIL78R2t8f73MWDiRHXwE5S7clBVKDNoicaWfcH1d0qdyt3B+SMSLNPPn IsmWwGIwMRMyc+KR5NTOLyJ35F1xnqc8RSBXQ6Y1NEdsGssFU2QDGhdydHXRA+1kreIJ 5FhmwcJXaLLoykV23YKKApf3StB5dec2bhn9yZJW8YeayfTmaQWCT+Ctr8efwVvG2UDb qyJCU9NQS6d9M8LK+VQhp6yTEXElYhEdNYPbDSCcFV8CyDImy7dZGqF9zThtQNMF+TPu 3FYtfh3pZ4qHTaUO4v6gnT+Cs65OL1TzDYH7E/j8r68g+xLQFrGTeu6wQheiaAg5nI3j M/8w== X-Gm-Message-State: AOAM533oYfFjLGO6/AfFg3zecJk00RoC7YvPXthIda8xxulwAWs0IwwL 3tQ5O6Y7d3kGe1+FQRIZ+UvByg== X-Google-Smtp-Source: ABdhPJwqlkc2zKOHr4CZKudC+z5XkhQYQppbD4OIiflpEBJodVcF2fyVWwwJjG35lxfxhFMJRptUqA== 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 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_142802_588646_6713259D X-CRM114-Status: GOOD ( 19.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , Catalin Marinas , Alexei Starovoitov , Will Deacon , ardb@kernel.org, Jean-Philippe Brucker , Anders Roxell , Daniel Borkmann , naresh.kamboju@linaro.org, John Fastabend , Zi Shen Lim , Jakub Kicinski , Andrii Nakryiko , Jesper Dangaard Brouer , Luke Nelson , Jesper Dangaard Brouer , Yonghong Song , KP Singh , linux-arm-kernel@lists.infradead.org, Yauheni Kaliuta , netdev@vger.kernel.org, Linux Kernel Mailing List , "David S. Miller" , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , bpf@vger.kernel.org, Martin KaFai Lau Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 bett= er. > > Right now it might only be used in bpf2a64_offset() and bpf_prog_fill_j= ited_linfo() > > but if we fixup the values on the fly in there, everyone that intends t= o 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=F6rn and Luke. Even if that's true, is any reason at all why we should skip the first elem= ent = 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel