From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f50.google.com (mail-dl1-f50.google.com [74.125.82.50]) (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 08BC838A2B4 for ; Mon, 19 Jan 2026 18:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768848222; cv=none; b=U8Ae2upWwABLtSb35TMChguh4Ipd6HJsC9bJOaUjgXUoOpYMi7WhMNmou06j+M/NUla5vZgFF5Bm3UZ8E1odtY8ezRrLWNLVbedbqyi1Mkghzt7rm+AzwGXRiHDuLHydOMFKSr4kNSDxo4OEBHZ21VRYFSx931uxhAr0piEd1iM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768848222; c=relaxed/simple; bh=rrMvrWdYKAI+m6MARZvV3c0GragGaZJHWz5pqVajfjs=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=CJa/MWIvgkzk8I7+V6UTizwcgRr2/VLmvMfABqPdW6xZCQvBrQyXy30q5ydjVKqqaTwxTMy/06RAROmD6CMkROGemMFYG67+tzfsQjJDvjkJO/jftvIsRSF3X7Lxr6amBlRJuxkEu5XczEbUk3zC2Ibelihpch/TGAuGX/HYMKk= 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=KFudIzvv; arc=none smtp.client-ip=74.125.82.50 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KFudIzvv" Received: by mail-dl1-f50.google.com with SMTP id a92af1059eb24-124566b6693so5288705c88.0 for ; Mon, 19 Jan 2026 10:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768848220; x=1769453020; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=3OHeSX7usNST+oUmdkhhpslnqDWteRbjvdPSeCpUyOc=; b=KFudIzvvl/m+g0iGfwyhAd+cZq82E/FeaTiG+uKYOe7QJ1RsRLIU39b1tT085F24ey tpSxSTzNaMk/Xa0CIo++niVk4LrOzB/M9ViIY6cFfoNTXTwrdAIG85GtpfShGkwwjuTj iyVRD086j2p2q41O81J4PcRReIxMXYWHIWZfNnvbgk184NnNRM8OIcSISLU7bG/ctVWJ pKxwCOHWCwcqQgftolSeSaTR+7BQa96WgoRZYYztvtMwmZJh6Kd1WYIOlJtGqK+BmuvY USfJMXHWbWoAvdeLWKeDbBaKjLV+YmRj/hNQ52Ny29DGW8Q23PfxCiaz9b571Q8E8EQV lL7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768848220; x=1769453020; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3OHeSX7usNST+oUmdkhhpslnqDWteRbjvdPSeCpUyOc=; b=HIK+NYMLKSGwpO0zJdk7mH/OdGj7E83un7QkUC6AD3qDN1drAXiYZ/F8dIdp1GULfS tjexhoAR7jlTRmEPa/2+1QFbYcClZKajpK7FYaf9j3ha0vUYU/qhoxUg3CaseVNHAs+1 y738LO4Dwr7zAiFP2xm3Vlwvjl0J78VXEKMpu9/pZjmi+zFuD7G3bSHnMEkmTxlPwDRW Hc/db5I3qvf7ALJ4/6jAMaUvKhhyL6SxdjQ0BJwcrpNtFJRS3+xbUQkErL1mXwzsZ5Vi YdGz+xOg2FkalNsMJF7MLWbxeP1NZNJotaduAk3Wal24UXTN/M/v0e78Y46KIE5JiM1Q jg3Q== X-Forwarded-Encrypted: i=1; AJvYcCV7Sn7pMyoHPzeTlvkCoo/p3hqFBW5P9V86cFOfp3PlV/mugWcKTcpWuOs/WBA2qfn8bMJU6gUde9kIKbw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy37dzCDHEWG3cq1LriCQCuCXQ2py+lOqYrT+ExQ3vYhBNtklVg KTKiKP0z1+Qnr3GNX4kuuXHK/aAJNKxlMKtKeJeOhkxmkwMClEZ0zb4k X-Gm-Gg: AZuq6aJgMCb1Qvfk5UbNlr1Y+uYXKObLNP59s3qMMWq18oOhU0xb/l5wWdpTgBUjkjj zHm87xG5sF6ioPK2jre8WbLb+GXXVDsnfKAEb0grW1oPrlx4XDM9pGVPlLeZJTWet+HPOSffH+J 6Ppt7P2voy6I5hSPlcPNWswLD2xbIZouXyu53uhbXxAPxMixlJQYfJVhWteQrspGtQf2PAdi6Qa ayV0CMc5uOYMtYerc6tYlSfK616r5XJxnS17MUiQUfew2eHCa2Rj/S9Gj1Tr5xFqGIi5eK7/TiJ YBRaAe4FMFh6AnPLgl18fXUn9d0K/11J0e1aYZhy5W2LzS885Y6cJXkVmDqwEumUmu8bYFtOpqa 0L+qjEpvyYeglTJxqHyYhnJzPseGIZt8z/C9ziObCFm0d67brEK0Zx1GO+Z6yWpPINyT1sikGDK 0IlmCwN9nIbBwcgPSHR4PZJrJLsIJ7fdLHryabbtrbLZ4v62yvkSfnmD7uw0HQIMUppQ== X-Received: by 2002:a05:7301:6508:b0:2b6:aeb8:3d8c with SMTP id 5a478bee46e88-2b6b503bcb5mr9877469eec.32.1768848220046; Mon, 19 Jan 2026 10:43:40 -0800 (PST) Received: from ?IPv6:2a03:83e0:115c:1:4cd6:17bf:3333:255f? ([2620:10d:c090:500::aa81]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b6b3502c65sm13727628eec.8.2026.01.19.10.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 10:43:39 -0800 (PST) Message-ID: Subject: Re: [PATCH v3] bpf/verifier: optimize precision backtracking by skipping precise bits From: Eduard Zingerman To: Qiliang Yuan Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, haoluo@google.com, jolsa@kernel.org, kpsingh@kernel.org, linux-kernel@vger.kernel.org, martin.lau@linux.dev, sdf@fomichev.me, song@kernel.org, yonghong.song@linux.dev, yuanql9@chinatelecom.cn Date: Mon, 19 Jan 2026 10:43:37 -0800 In-Reply-To: <20260117100922.38459-1-realwujing@gmail.com> References: <20260117100922.38459-1-realwujing@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Sat, 2026-01-17 at 18:09 +0800, Qiliang Yuan wrote: Hi Qiliang, > 2. System-wide saturation profiling (32 cores): > # Start perf in background > sudo perf stat -a -- sleep 60 & > # Start 32 parallel loops of veristat > for i in {1..32}; do (while true; do ./veristat backtrack_stress.bpf.o= > /dev/null; done &); done I'm not sure system-wide testing is helpful in this context. I'd suggest collecting stats for a single process, e.g. as follows: perf stat -B --all-kernel -r10 -- ./veristat -q pyperf180.bpf.o (Note: pyperf180 is a reasonably complex test for many purposes). And then collecting profiling data: perf record -o \ --all-kernel --call-graph=3Ddwarf --vmlinux=3D \ -- ./veristat -q pyperf180.bpf.o And then inspecting the profiling data using `perf report`. What I see in stats corroborates with Yonghong's findings: W/o the patch: ... 22293282 branch-misses # 2.8 % bran= ch_miss_rate ( +- 1.25% ) (50.10%) 594485451 branches # 1012.5 M/sec = branch_frequency ( +- 1.68% ) (66.67%) 1544503960 cpu-cycles # 2.6 GHz cy= cles_frequency ( +- 0.18% ) (67.02%) 3305212994 instructions # 2.1 instruc= tions insn_per_cycle ( +- 2.04% ) (67.11%) 587496908 stalled-cycles-frontend # 0.38 fronten= d_cycles_idle ( +- 1.21% ) (66.39%) 0.60033 +- 0.00173 seconds time elapsed ( +- 0.29% ) With the patch ... 22397789 branch-misses # 2.8 % bran= ch_miss_rate ( +- 1.27% ) (50.37%) 596289399 branches # 1004.8 M/sec = branch_frequency ( +- 1.59% ) (66.95%) 1546060617 cpu-cycles # 2.6 GHz cy= cles_frequency ( +- 0.16% ) (66.67%) 3325745352 instructions # 2.2 instruc= tions insn_per_cycle ( +- 1.76% ) (66.61%) 588040713 stalled-cycles-frontend # 0.38 fronten= d_cycles_idle ( +- 1.23% ) (66.48%) 0.60697 +- 0.00201 seconds time elapsed ( +- 0.33% ) So, I'd suggest shelving this change for now. If you take a look at the profiling data, you'd notice that low hanging fruit is actually improving bpf_patch_insn_data(), It takes ~40% of time, at-least for this program. This was actually discussed a very long time ago [1]. If you are interested in speeding up verifier, maybe consider taking a look? Best regards, Eduard Zingerman. [1] https://lore.kernel.org/bpf/CAEf4BzY_E8MSL4mD0UPuuiDcbJhh9e2xQo2=3D5w+p= pRWWiYSGvQ@mail.gmail.com/