From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=124.71.93.112 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796308601; b=zI6IE2lJE8tHC+HkDNK761dQnGpDSsM4Bk/FACCXl3QSXHd3JGSxdFAJH99Fp0kz/W4t Jj0SMOrO5byOYjzmEE2aA1eeILREW5PPmz9X24uy/pE0mxJHA0XUnImgPOEHKYKIbWQHe XGHn5nhcq5hkemNWkTza4IkfkPnlksYyrGVWvmQzV9zpEC2btv19BR6/HLNpC0TMqYC6s vUAGO3VBFTv6ys4e9F7jvMv6n4jj2E2hcEgQkWAWTr8zjj8gzd/KYvrGfdJ8Fhj6PCQl8 cpexDo89G9g5hKFhFqLDXsv+qoBvdghj2zIW0WM0T/t1Q+r2SQZJrCseFlCKiBBZGEA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796308601; 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=pUYdySLGnnknhRVqUHlW7+ny+D4Pr6SS3PM8rnPXrQU=; b=I0ZqIIpywP3cDQDL2QifSvj16a7x7P+XkzQUdJ1pf7V2+QqUBLk9W/snGL260cWZZhiV Hyohr6zaA6BJ5D3DApU1q1eP/V8va4PFwvxa8qO96us8+cue/k5d/+qcewQoUv5QTHAUB 1kpqoHBjGVlyHYllQRKF81rVokU1fdDLrhejMtUKOPQ32GQiNpLdRWjJSO+tkWkOqyjcc ZSODhJTmJDnWuI48LbYDYPMhaRCJPX0FyAPm6JyxC4+0zYzkWU4PLziMfN+VFnfLtZdTp f1vklr/yS7zh6ueC4OVbOQmNdfqU8zuZEb/QUbnof5aP3J6nwHe1dJpQQ434JSPXZ+w== 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.93.112 Received: from dggmsgout12.his.huawei.com (dggmsgout12.his.huawei.com [124.71.93.112]) (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 149FA606A32C; Thu, 3 Dec 2026 14:36:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 149FA606A32C 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 dggmsgout12.his.huawei.com (SkyGuard) with ESMTP id 4jgHHh6ltyz1ypB; Thu, 3 Dec 2026 22:36:16 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 17ED540808; Thu, 3 Dec 2026 22:36:35 +0800 (CST) Received: from localhost.huawei.com (unknown [10.67.174.243]) by APP4 (Coremail) with UTF8SMTPA id gCh0CgCX0O9xfhFrfBc2Gw--.61960S2; Thu, 03 Dec 2026 22:36:34 +0800 (CST) From: Xu Kuohai To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Puranjay Mohan , Pawan Gupta Subject: [PATCH bpf-next v2 0/2] bpf: Move IPIs out of pack_mutex and reduce IBPB flushes Date: Thu, 3 Dec 2026 14:09:20 +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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IcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU1 7KsUUUUUU== X-CM-SenderInfo: 50xn30hkdlqx5xdzvxpfor3voofrz/ From: Xu Kuohai BPF JIT memory is allocated through the BPF program pack allocator, which uses a global pack_mutex to protect its packs. While holding this lock, the allocator currently sends IPI to all CPUs on two paths: IBPB flush on the x86 alloc path and CPU pipeline flush on the arm64 free path. Because the caller can be preempted while waiting for the IPI completion, the lock can be held for a long time, causing heavy lock contention on busy systems. This series moves both IPIs out of pack_mutex and tracks dirty state per chunk instead of per pack to reduce IBPB flushes. v2: - Switch to Puranjay's patch to move bpf_arch_text_invalidate out of pack_mutex - Switch to a new approach suggested by Alexei to move the IBPB flush out of pack_mutex v1: https://lore.kernel.org/bpf/cover.1796223449.git.xukuohai@huawei.com/ Puranjay Mohan (1): bpf: Invalidate freed prog pack memory without holding pack_mutex Xu Kuohai (1): bpf: Reduce branch predictor flush and move it out of pack_mutex kernel/bpf/core.c | 101 +++++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 45 deletions(-) -- 2.47.3