Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1247904rwd; Thu, 8 Jun 2023 14:55:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+2T9M8eyPMlx00gJQCImoQgIwUz+MvX54IzzCADlYuiijtdYPOf9Hx1VsfGsw1h/95oL8 X-Received: by 2002:a05:6a20:c1a6:b0:10c:ef9f:ddbd with SMTP id bg38-20020a056a20c1a600b0010cef9fddbdmr4710585pzb.8.1686261307972; Thu, 08 Jun 2023 14:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686261307; cv=none; d=google.com; s=arc-20160816; b=ODNzFhIiFouylis+uFNbmYx/D4nojmgKsycC+D9Z9K/IHt5xss2RirZ4CZdOuIozKt 1zhZ24fOFqUVX+FMSYknHf0IwCcZBfV+ocbYbVFzVLPgcJ/M+MtHXfzZn1BZ7Z3zlBjt NMYchdbZbWvkmCzg21GnweM+Sbt9iH3hlAhxAT5dRdxuzEewvGSpIYO6Z2eX9VcJHXmf DAPXdNLC5DlhdxLIgIGNsT3IOd5+1LKK2SnoJjsKSI6DUocsDpGt6Cz0xv77mZR6TNnS 9GKRa7a/86QDgFP4BQTxp4lmEhwmAVeKLV5Erdtf0s4T7+8x0Jcv7jfzwkHeLd80/I86 pgeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=cyFeRj/fNHm8f7mZasGEygukFIEsF4nvWnrQcYPd7hQ=; b=euKEeFXisxnsMgAWnYGHG2Uu/E8Pm1RerUBcjujXRLWkG1bHZhQQ6fUx9Ov4NjS8Jn 4RuHj/uSIxMiJDVAl6uwEm+RpigkIwgo4bialZ0QYD7ylyM48rxyV5EjewTny7ruWI1n U7Y5YXAKxTHohXZjm84v2CRci6rHrM0REA+pIXnYLN3r4jeYEN2Y7CePVopyxBSeLS9Y hRTPo28Q0BxwIAVuawRjGiXijTgvhNmIejU6cAY0hIBYimPnbA7szSH3AFnSa/var6Mw CeC+5Z142Q3zqgQ279BOqRBKblxDrdOv7qZ8PsTqu5fuaRKsxN9lPeBULQ1Lj2Tmdfqj 4sfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ALVinRIP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m30-20020a63711e000000b0053fb89f1e10si1536669pgc.501.2023.06.08.14.54.55; Thu, 08 Jun 2023 14:55:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ALVinRIP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235118AbjFHVNS (ORCPT + 99 others); Thu, 8 Jun 2023 17:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjFHVNQ (ORCPT ); Thu, 8 Jun 2023 17:13:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFEF32700 for ; Thu, 8 Jun 2023 14:13:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64C4761806 for ; Thu, 8 Jun 2023 21:13:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC468C4339B; Thu, 8 Jun 2023 21:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686258794; bh=cuIyjEnaDDKHWGPHVUVqPlwF4bbvZEjknCMBtvezLbo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ALVinRIPZX+aFLgYXJ1Y/B16Nx2vpf8qAeAYJAlZHd63Aqmhp/805FB0GKKb8xtev rF2tmBPV6MInMRnTKmm7J5G1zYaAjq+otXimabF7SOUbl+URABHZwxl82oKVBQdsiZ vJoYriJZCkqNadHyXZ56BXxtrPkCg3pKopX2uyfkJLK7Uqeh1qDBJuRc4Yd1SHuqlW Zs+mVQQWNEh5Ox7iCGm9bP4Ojzls+A/5ke/4H3T6rTSaFjEmnsc2sVFLLEv3aTUhZ1 7IA0Sa3jMzfAykjvKWFS4tvF950x8qLt2LKCUBgHHcMEnr/E6d7WBH4sP4BfvhVu6h kooPumpvbDGmA== Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-4f62d93f38aso1358524e87.0; Thu, 08 Jun 2023 14:13:14 -0700 (PDT) X-Gm-Message-State: AC+VfDxXzXvAwugc2w1hJiQmcVmuleE6wX97a142OYX54Jc7VCbTYvwf eCykNGssjfPT7uG0OLh3Rrby2Gy9fLaQG4AYJt8= X-Received: by 2002:a2e:9009:0:b0:2b1:b0d2:5f03 with SMTP id h9-20020a2e9009000000b002b1b0d25f03mr3772006ljg.15.1686258792914; Thu, 08 Jun 2023 14:13:12 -0700 (PDT) MIME-Version: 1.0 References: <20230607091814.46080-1-puranjay12@gmail.com> <20230607091814.46080-4-puranjay12@gmail.com> In-Reply-To: From: Song Liu Date: Thu, 8 Jun 2023 14:13:00 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 3/3] bpf, arm64: use bpf_jit_binary_pack_alloc To: Puranjay Mohan Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, catalin.marinas@arm.com, mark.rutland@arm.com, bpf@vger.kernel.org, kpsingh@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 8, 2023 at 9:51=E2=80=AFAM Puranjay Mohan wrote: > > Hi Song, > > On Thu, Jun 8, 2023 at 6:28=E2=80=AFPM Song Liu wrote: > > > > On Wed, Jun 7, 2023 at 2:18=E2=80=AFAM Puranjay Mohan wrote: > > > > > [...] > > > + > > > static inline int epilogue_offset(const struct jit_ctx *ctx) > > > { > > > int to =3D ctx->epilogue_offset; > > > @@ -701,7 +716,8 @@ static int add_exception_handler(const struct bpf= _insn *insn, > > > struct jit_ctx *ctx, > > > int dst_reg) > > > { > > > - off_t offset; > > > + off_t ins_offset; > > > + off_t fixup_offset; > > > > Please add some comments for these two offsets. > > Here I am using two variables because I need to change from the RO > buffer for calculating offsets > to the RW buffer for writing. > > Earlier, a single variable could work because it was being reused for > calculating the second offset > after writing the first one. Here, I can't re-calculate using the same > variable because I have to change > to the RW buffer, and using the same variable would need changing back > to the RO buffer. > > So, I am calculating both offsets first, changing to RW buffer and > writing both offsets. > > But I will add comments explaining what these offsets are being used for. Thanks for the explanation! These comments will be useful for future work. Song