From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=124.71.94.104 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796550678; b=RgRcCcMN5x1ME4cH+skHjTn/DlDiYx0AKRC6GyJIcv54JEsqqHeriOgLY7cMtOVrVlI/ ovwfj6yzEmzpjKk/cijI86PpWcDw5zgilM7Wzd3yAlf1FkuSHZt+dTj24pgzoQ3fhu4xq 88M+aKsfsWRlaXvXwee5lDcLcI7j074QxmU5utIsFuhvJAahpaBr0Y4487w4wwccv9D7V yXMP51LCsmkVDuWsTJ2MLEZtw+wqbSWIyNr7VkvL3FrYpcbCh1ANmknJDGNfbET+bHYtf o/Lx9M8TS4KlmWBc3AghfrEJfbkB4AWWTfP5i5OjnsZFNhuyGVxviYRw0m/6Hwu321w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796550678; h=DMARC-Filter:Received:Received:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo; bh=89XYv769Yxtn/5+Wukn5ViB/rTScBnfcJPCLCBXEAOI=; b=DoSixlFMh1RHCI/MM9nJUx4Ro9NUZVugQLhpLvdoMMVQdXCMQkjA84F8fi9T/PRjchfE tZyrje7a07HSWot1S1NzL5vmO4hCdimDKIB7P3U7zoQo5xeMOSyd2c7lFQmg9DXNVcUd0 nLXk2IfST4dDLg+Sjpl8VOQUHLXNkEGPdtqVfNnIgqavvmwg3d0NsBw3A0+2joiYZdIJG bJVbGkSjfqPq+FJIPtDVZBLUZdxgY4YWrOSerxn0+7tqCFxn10VrTd7QNtMZeFyTb+8sW QCGaUhEXEyPGs4y3R2AUM6rVjv5oZ3mNItvr6eOky1MpeldNb6p3NwEiZMUR5IymQsQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.remote-ip=124.71.94.104 Received: from dggmsgout13.his.huawei.com (dggmsgout13.his.huawei.com [124.71.94.104]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76544606A322; Sun, 6 Dec 2026 09:51:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 76544606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.177]) by dggmsgout13.his.huawei.com (SkyGuard) with ESMTP id 4jj0pq3QFvz1rqZZ; Sun, 6 Dec 2026 17:50:43 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 6746940963; Sun, 6 Dec 2026 17:51:06 +0800 (CST) Received: from localhost.huawei.com (unknown [10.67.174.243]) by APP1 (Coremail) with UTF8SMTPA id cCh0CgA3IJcJMBVrHN8IAA--.22494S2; Sun, 06 Dec 2026 17:51:06 +0800 (CST) From: Xu Kuohai To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , John Fastabend , Puranjay Mohan , Catalin Marinas , Will Deacon , Mark Rutland Subject: [PATCH bpf-next 0/6] bpf, arm64: Reduce instruction sync IPIs Date: Sun, 6 Dec 2026 09:23:41 +0000 Message-ID: X-Mailer: git-send-email 2.43.0 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Ow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WUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyT uYvjxUF1v3UUUUU X-CM-SenderInfo: 50xn30hkdlqx5xdzvxpfor3voofrz/ From: Xu Kuohai On arm64, instruction sync broadcasts IPIs to all online CPUs. A BPF program with multiple subprograms can trigger this synchronization once for every subprogram during loading. So defer instruction sync until all JIT images have been created and the program is ready to execute. Apply the same approach to trampoline creation so struct_ops can sync multiple trampolines with one IPI broadcast. Also remove the synchronization performed when invalidating freed BPF image, since the memory is no longer executable and new code is synchronized before it can run. Xu Kuohai (6): bpf: Defer instruction sync to the end of load time bpf: Defer trampoline creation instruction sync arm64: patching: Add nosync helpers for instruction copy and set bpf, arm64: Defer JIT instruction sync bpf, arm64: Defer trampoline creation instruction sync bpf, arm64: Remove instruction sync when invalidating freed memory arch/arm64/include/asm/text-patching.h | 2 + arch/arm64/kernel/patching.c | 63 +++++++++++++++++++++++--- arch/arm64/net/bpf_jit_comp.c | 22 +++++++-- include/linux/bpf.h | 6 +++ kernel/bpf/bpf_struct_ops.c | 4 ++ kernel/bpf/core.c | 17 ++++++- kernel/bpf/trampoline.c | 3 ++ net/bpf/bpf_dummy_struct_ops.c | 3 ++ 8 files changed, 108 insertions(+), 12 deletions(-) -- 2.47.3