Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp676444pxk; Wed, 16 Sep 2020 14:09:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyNUZeYMY0Xex3Ru5deGBQUhnaKEzc438Qyt9e1sgywUHjQgSbrdYPh54ndkStyzd8L5od X-Received: by 2002:aa7:d04d:: with SMTP id n13mr30681396edo.354.1600290544972; Wed, 16 Sep 2020 14:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600290544; cv=none; d=google.com; s=arc-20160816; b=H5PbUMwcHnCD4pVbq6B9Nw/8A/Bg0G3KVwgkHlyoOuhqE0dA1j2kt5syfW8LC+UoaQ 1ih/dQQbl+Zp0z7iwnYj4VavMmG+v9axpOKInwyU3tg1UDhT203YwdCXb0swodzW4C1U w+WLCwcpli4KeGxoqoGWh8y9RxdaAyZRmQWPh9g0NBCOy35Yn9+nuUYIH8iM6fX3C6M/ 8PyG9cV1u1nZIFshVkIkiWgT6PQsYZ3FZZQ7QaEXEc+aw7d6eztkz5hT/5WdnzS288Ei ayZ844wPDmU6RN7le4oUtntZIzTh+77p0ZGvUBNh/slG5Px5XolBQIvt2I1OzY43Wx7j NiqA== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/MCv6kGzbCOa/DlsDScqqLMNRtWklF6jilIPECQzCg0=; b=AIeqKTqFyNtLCRhsadaHhCsK8xgCCeoofkZvnI1nLVD2kNpiY6Q9VSC8dbtBtiJ0qz fegIcvRDpW/vAJtOA4BVvD9BNFv1F37GKOQx/+8UJPKU9M5sczFo0KdoU5ialPox1wD+ jQEb9x2pwqQqTPRcpCHNU1ah3FvnliOCYs/FoylGgt7tMT/0IRmppwE42i7s4TC2PLwy 6OrNKOcygOzQ/rNsD5Q3xnxWUSMcZDE67NYjS4DXtSNnw050TyDIRaVAwEIyl6vAnldD yvz/krjoThlUa6OdzPJeWfMI1jGjaFtDMaCKuAd0XhDsuJ+awkjruB1vOQy4+IBBJN16 3Yaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z9Mjrknp; 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 n26si12820647ejg.134.2020.09.16.14.08.39; Wed, 16 Sep 2020 14:09:04 -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=Z9Mjrknp; 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 S1726380AbgIPVFW (ORCPT + 99 others); Wed, 16 Sep 2020 17:05:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgIPQPB (ORCPT ); Wed, 16 Sep 2020 12:15:01 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6560EC02C2AE for ; Wed, 16 Sep 2020 09:04:09 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id nw23so11107342ejb.4 for ; Wed, 16 Sep 2020 09:04:09 -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:in-reply-to; bh=/MCv6kGzbCOa/DlsDScqqLMNRtWklF6jilIPECQzCg0=; b=Z9MjrknpOuPF+pqKLQzqZid8FW3zEaHnhoX5IP5NryC11gEwO7uLcWUhqVJxueC9W6 7CyEpxmwOqnfqxe61a1+dIvuU7OnfHkNIofhb5es+kRTzdzNW0FeLmP3GTVpwKsqCAx9 i/yxgS1SeMvI41chMQEFucT6tmbFzA5SyLmdZGcX8ThN3ccdXUQ0V2MbUttBhZ4aR/uG kTDaZX/9nNor4lMYTgCQTv4GahD7XgYuDxdC8I1g6Qdg9zarXeNsOCuXfRjOpkDCi5/h qT5Y31/7nfG6eQqQ4BRT9zXcgnZPcL68LubYbNrQEx0ABy/gIz0PExjwugqJxjUAo47o hPww== 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:in-reply-to; bh=/MCv6kGzbCOa/DlsDScqqLMNRtWklF6jilIPECQzCg0=; b=OgI92oNjG6jbT5tFeqtyyy43m1ZnQle8f3O9xNoFCrujnuD3ZoKEjzAIm0TVWaTfYY CWgPdPnyridRhZxGu2+SXvoKzwk1gE7WNpNvR49B9qHAfe2+M8jXLCPAUf6WLY0MShoU MwBRRtLs3nrWWCeJThmrqrXoiAlDYzlPlwxuVNN5nhQK7m9Y8QQrNAqVmi1Zsp/wzGYh hqJ5CJ+4GMqmUofiO4VYghZkyoJYTUYAWaWyei6ceOL2sNpyllcM5iSY1+wGULrU81TX dTi4fkz/AaCB/3d2m21+HliFFDTNmR8Bqi5NR8/CQ4wa+IXgUfIj0kq5GgZGe8jZgcNv nZhg== X-Gm-Message-State: AOAM533blqrcA+s8kzB5ZVu3rCAr2YSPF+B5jLSczzCdd1WSQCaRvMB6 OG04Bt66EfxfqRHcKu6RNE1BFA== X-Received: by 2002:a17:906:52c2:: with SMTP id w2mr26710730ejn.389.1600272247918; Wed, 16 Sep 2020 09:04:07 -0700 (PDT) Received: from apalos.home (athedsl-246545.home.otenet.gr. [85.73.10.175]) by smtp.gmail.com with ESMTPSA id lc25sm13011774ejb.35.2020.09.16.09.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 09:04:07 -0700 (PDT) Date: Wed, 16 Sep 2020 19:04:04 +0300 From: Ilias Apalodimas To: Will Deacon Cc: bpf@vger.kernel.org, ardb@kernel.org, naresh.kamboju@linaro.org, Jiri Olsa , 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@vger.kernel.org Subject: Re: [PATCH v2] arm64: bpf: Fix branch offset in JIT Message-ID: <20200916160404.GA153139@apalos.home> References: <20200914160355.19179-1-ilias.apalodimas@linaro.org> <20200915131102.GA26439@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200915131102.GA26439@willie-the-truck> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will, On Tue, Sep 15, 2020 at 02:11:03PM +0100, Will Deacon wrote: [...] > > continue; > > } > > - if (ctx->image == NULL) > > - ctx->offset[i] = ctx->idx; > > if (ret) > > return ret; > > } > > + if (ctx->image == NULL) > > + ctx->offset[i] = ctx->idx; > > I think it would be cleared to set ctx->offset[0] before the for loop (with > a comment about what it is) and then change the for loop to iterate from 1 > all the way to prog->len. On a second thought while trying to code this, I'd prefer leaving it as is. First of all we'll have to increase ctx->idx while adding ctx->offset[0] and more importantly, I don't think that's a 'special' case. It's still the same thing i.e the start of the 1st instruction (which happens to be the end of prologue), the next one will be the start of the second instruction etc etc. I don't mind changing if you feel strongly about it, but I think it makese sense as-is. Thanks /Ilias > > Will