Re: [PATCH v5 6/7] btf: Add lazy sorting validation for binary search
From: Eduard Zingerman
Date: Mon Nov 10 2025 - 15:46:28 EST
On Mon, 2025-11-10 at 09:42 +0800, Donglin Peng wrote:
[...]
> [[Resending in plain text format - previous HTML email was rejected]
>
> Thanks for the feedback. Based on the previous discussions, I plan
> to implement the following changes in the next version:
>
> 1. Modify the btf__permute interface to adopt the ID map approach, as
> suggested by Andrii.
>
> 2. Remove the lazy sort check and move the verification to the BTF
> parsing phase. This addresses two concerns: potential race conditions
> with write operations and const-cast issues. The overhead is negligible
> (approximately 1.4ms for vmlinux BTF).
>
> 3. Invoke the btf__permute interface to implement BTF sorting in resolve_btfids.
>
> I welcome any further suggestions.
Hi Donglin,
I think this summarizes the discussion pretty well.
One thing to notice about (2): if sorting is done by resolve_btfids,
there is no need to check for BTF being sorted in vmlinux BTF.
So, maybe it's a good idea to skip this check for it, as Alexei suggested
(but not for programs BTF).
Thanks,
Eduard.