Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp118832lqo; Tue, 7 May 2024 14:14:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXtLs8tZQuaLmokugFAhodO5zOB6KTrU9B7oyZxWs98p7ERTGgSxqvETD2XWnQMCXtborjVVGf0te8NgvwgWzubOqdE575OzMH/HvI09w== X-Google-Smtp-Source: AGHT+IGyiJOYqzrHiBGQEXKNOZDlqOA75DO2oW3PU5EI4VO3v7tfJb6HzEw04tlEg1UojK8+ZCEK X-Received: by 2002:a05:6512:3293:b0:51f:fcaf:e92d with SMTP id 2adb3069b0e04-5217c46c23bmr418368e87.18.1715116442900; Tue, 07 May 2024 14:14:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715116442; cv=pass; d=google.com; s=arc-20160816; b=KV249yRTxIKLD+DaAkPHLnVVLl60tudIpk+zvVD6Yt1IXk5F4P843ggL6EID3vaycy KlAwQ0ulpkh624SM9EcGJetgY9R8Kh5zxfHGCvA00HmpUPSvN7KrFwIp2TqAD2Mp0KIw /ahMbpuJ2F4AwCDJvdYnM+V2pryusiNFtGMjazZMBDbmmzNX/bYBaiKEb7Mnloy2DnZm FQKFL4anLRcssHcjPHUi/dSfTqMX/9I1ySuiN7I6Ysb0pbEsenGjiAdKFYeDrQ1ynlQS lrkuYuV4m0/KuNY0fAVr+2kJVObTwhgGcJipJxumuSxsuZF/VnV3BQlVXEyT6IDBg6T/ ji4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=001STfTEIi9HG/YmKeuC4M5zLrVfd9BrqAqYYhpSj4w=; fh=8aOQRm3qDWehoN3rM6z4AzfmeazbnD+0uPlomX6mvjI=; b=b1fk2t+0t4RulgUKz/w1vtV7jY3xY+x8jnyf9NajPzdRvqk6LpwXWl/spBMWvCQWj9 clg8CECMuX8ixAwnsiTvqzEs1NVSzvjqTNXqNs3XBCGnOw8EeeB59TH0DWhwT10YcMGp fkLJXw8aUtD1vXNmYxestI1eyxGKJdWfurrAo8xmC3TygGoa6OqiJESii+4B4YIEWeHj u2Vgwzwdm4d9ySpl+xo2N7WD0KpFKAL3JQPDbpEsZ8jyw0DneVryBmt1HXQ7VZe3nw7n J0+DnBFbzpASCC5h6s8AyZtzEji+04MUifReemsHEll4SGl3MjHq11/gobaLj413DxHE u+CA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bONYswX2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-172209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bx26-20020a0564020b5a00b00572a738c3d2si6230451edb.103.2024.05.07.14.14.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 14:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bONYswX2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-172209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9DFB01F240B7 for ; Tue, 7 May 2024 21:14:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD0937316F; Tue, 7 May 2024 21:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bONYswX2" Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68CF571B5C; Tue, 7 May 2024 21:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715116434; cv=none; b=LSEHpN2huQR2D6hTcovqGDIQHYq6XfsZc3caICt1imfCuXonm9qId5UpYI8TpcfXP61xiuPbKVn5IaB1db83geyGcxVOAQfYjTALyODrtIhSTNYlFcaS65h5IBR7Fw57cG/DAf1Zsx8hDGKAH+FY32YkAU82nVFk0LXcKnJ2KFs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715116434; c=relaxed/simple; bh=+CnbgeoeyKY+pUuJ0UF7xYamzyyRqgzkqxZgusuLnDA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VOqpX2ebvWFOaL/hZ8fbxjZPk6ED/saTR9kUZP6UCRbiUAwY9nGy2dS+zSWTEtxcYIYwCP0pwZtxQblFzLVktU/BBl+nwtduKbdhWTD8Ni+B+Ucv3FHQ9vpAibLdO25wz/FG5Ea9FIaXY3EJDuoeYQMBLnkbVWHTcYqFsJfqdCQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bONYswX2; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a599a298990so987332766b.2; Tue, 07 May 2024 14:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715116431; x=1715721231; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=001STfTEIi9HG/YmKeuC4M5zLrVfd9BrqAqYYhpSj4w=; b=bONYswX2ppKbReLeWZAEjal2mQUvqusaGPRp/6m+VUWN0EBK7SR0CZ8jpyDKAw8ory Vo7m9bX0SrI48uhSZdb9QwfDEEq8UySRVGWlf6pAglD7Xl9qbWzBMo8ku2K/FBxBYvry TEpqRC2op5chW/oQw3lq6FGw0EKhGSNAfzCDQHkjmhwjJG90quqp0wQegTOYF7ZzKMwt 5pSRKHECtMlF2igVTsCKTKfiULA7f0WEALmtX3onbpTDyuj6D9WVVz6AKIHH/gS+/0Z8 hs3llCScXJ+08Yzbidtaij8WwTAVF/xRbQMt85HGiM+SLTebo8WWu4MXX88hB35MeA/U 7atg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715116431; x=1715721231; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=001STfTEIi9HG/YmKeuC4M5zLrVfd9BrqAqYYhpSj4w=; b=PPp+1DFFNvyy3TMo+LQSMEB1OCpxVp7AKJRuMxBqxkCDX22+B89fSBJlAl358hAEuB PFckt/OELtq0pySlQUxtsAwgCe3dZ3RWuae73GEfuEzbqQPDTgHPVqb9qlDblJS4CWZx ZqD5IV6NsVjPTMLrBqvrmRhLThbzswVzgVSZDhp67tYYw2NAbn4mHikZFjy3KTCiVzve 5bNCJ+FXYETYLc7kZJC9ss/5jeIBmiIFhvzXYrcXdzyHG97mv103f/7Au8+5qHFtsQwN h1omLfwfaPE+IDiro+MX0b1eyZ64cqdWzsXG1ydt356TqMzlhOTF4U4AH+PsIlEmc4j7 53cg== X-Forwarded-Encrypted: i=1; AJvYcCXJq+sUASN17pmNbCQYUyLOK/tCkVquN7AF4LHvYP22OC4765UNfO0Q3JeB5qqc4e64zsDe7AuORW6RMmAQeSB91QWiiEJptrqj60crjdavHx5gAijjDGHsyG7D7NVxYd+4 X-Gm-Message-State: AOJu0Yx9pD9O7YzQ0KOPaWQ1awWIAtebh3owAPv34tTCZM/gBJT2AdZX E/ckyFozl5+Dp/xO1WezxVgS1phPs7WRIwVHbhqTuQ7v2658qlM/12NLnpCKgV9xcgPvebdEcmf zhmjrHGG3YSKrRXzOWuuXlhGgCOQ= X-Received: by 2002:a17:906:7c55:b0:a59:ae39:bfba with SMTP id a640c23a62f3a-a59fb959b4bmr40169466b.34.1715116430642; Tue, 07 May 2024 14:13:50 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240502151854.9810-1-puranjay@kernel.org> <20240502151854.9810-4-puranjay@kernel.org> In-Reply-To: <20240502151854.9810-4-puranjay@kernel.org> From: Andrii Nakryiko Date: Tue, 7 May 2024 14:13:33 -0700 Message-ID: Subject: Re: [PATCH bpf-next v6 3/4] arm64, bpf: add internal-only MOV instruction to resolve per-CPU addrs To: Puranjay Mohan , Will Deacon , Catalin Marinas , Zi Shen Lim Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Xu Kuohai , Florent Revest , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Kumar Kartikeya Dwivedi , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , puranjay12@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 2, 2024 at 8:19=E2=80=AFAM Puranjay Mohan = wrote: > > From: Puranjay Mohan > > Support an instruction for resolving absolute addresses of per-CPU > data from their per-CPU offsets. This instruction is internal-only and > users are not allowed to use them directly. They will only be used for > internal inlining optimizations for now between BPF verifier and BPF > JITs. > > Since commit 7158627686f0 ("arm64: percpu: implement optimised pcpu > access using tpidr_el1"), the per-cpu offset for the CPU is stored in > the tpidr_el1/2 register of that CPU. > > To support this BPF instruction in the ARM64 JIT, the following ARM64 > instructions are emitted: > > mov dst, src // Move src to dst, if src !=3D dst > mrs tmp, tpidr_el1/2 // Move per-cpu offset of the current cpu in tmp. > add dst, dst, tmp // Add the per cpu offset to the dst. > > To measure the performance improvement provided by this change, the > benchmark in [1] was used: > > Before: > glob-arr-inc : 23.597 =C2=B1 0.012M/s > arr-inc : 23.173 =C2=B1 0.019M/s > hash-inc : 12.186 =C2=B1 0.028M/s > > After: > glob-arr-inc : 23.819 =C2=B1 0.034M/s > arr-inc : 23.285 =C2=B1 0.017M/s > hash-inc : 12.419 =C2=B1 0.011M/s > > [1] https://github.com/anakryiko/linux/commit/8dec900975ef > > Signed-off-by: Puranjay Mohan > Acked-by: Andrii Nakryiko > --- > arch/arm64/include/asm/insn.h | 7 +++++++ > arch/arm64/lib/insn.c | 11 +++++++++++ > arch/arm64/net/bpf_jit.h | 6 ++++++ > arch/arm64/net/bpf_jit_comp.c | 14 ++++++++++++++ > 4 files changed, 38 insertions(+) Catalin, Will, Zi, Any objections to landing these patches into the bpf-next tree? Can we get some acks from ARM64 folks? Thanks! > > diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.= h > index db1aeacd4cd9..8de0e39b29f3 100644 > --- a/arch/arm64/include/asm/insn.h > +++ b/arch/arm64/include/asm/insn.h > @@ -135,6 +135,11 @@ enum aarch64_insn_special_register { > AARCH64_INSN_SPCLREG_SP_EL2 =3D 0xF210 > }; > [...]