From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796445540; b=Moigubn0KVAnFx4Y26djObZ0BQFuJuPBM2YGEej2Kf5GR9WsTucZmcsZ0fWp1SacDjeH +K9ZsHaHTmg99OQk1977CbIbZAH4jiMpdPYwkEjq7mbBJsNPDkF5W32qsrDrWL07b1HM4 dvEKMvewIrtlAN4CQEP210W8Q0wx63wIFgBmZ/iq228OsS520CN4kzi3HZEw2pA7QxFio N4viCRXNYsAkzbNAOcXK5yMSrKVryib2DeKJfH8OFADxcxxad+XnM0PcT2vA+MhrBFbu8 BO1Lok/zYO6vobKzQfen7TLzYPkOCdvYsVXj/GKzBx9AS4nCmrJ1xlD/FXR98aeREng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796445540; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Content-Type:Date:Message-Id:From:To:Cc:Subject:In-Reply-To: References:Content-Transfer-Encoding:MIME-Version; bh=dl+nc17p0ogm+udo8qdpTSC4jEgkxfyHbgR2wavd1rk=; b=49tdC+5A2/dIymVLZyYyb6me5l7RDA/DbC7FV2LlUaaoYie/ELkvzqvB8DuDvEmEux8W Xbuu0qQgC8VyvX/5eta2s5Klr4riDjOYD+MLoMNFMXCfKik4F7pKcy/qgIobGhE1DNEsh JiMGqwaEF+DMfsazvKR6e/4pgfBNR1PwWrEd+TD3425EHYCsQJfAb4yyXD3do7ES2BXRY K2npIjkC91JDs8OJSN0SVd5LBqsAfMtyFi3Rj8WitR4Mkmfsx5/KipbK+rpHB3nllDa8/ O0rW6kp2jANUM9621eHGrpSAeuVo+78wPnkg1x4jSF0FwQNNVp3374zJwbtoTM9uhlg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Ucf0rGvZ; arc=none smtp.remote-ip=209.85.210.180 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DD5F606A32D for ; Sat, 5 Dec 2026 04:38:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9DD5F606A32D 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.a=rsa-sha256 header.s=20260707 header.b=Ucf0rGvZ Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-89d6bd67045so952390b3a.0 for ; Fri, 04 Dec 2026 20:38:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796445539; x=1797050339; darn=vger.kernel.org; h=mime-version:content-transfer-encoding:references:in-reply-to :subject:cc:to:from:message-id:date:content-type:from:to:cc:subject :date:message-id:reply-to:content-type; bh=dl+nc17p0ogm+udo8qdpTSC4jEgkxfyHbgR2wavd1rk=; b=Ucf0rGvZS3KKT+EwIE4pNWitcDwdbGQs8YQktjCcEQhRERUOjLjAKgsW4AUrJqGYkB O+bfQyaT7BHMtTffDPiLgg8un6RPVPZLVYtDrZx9UFH3mwv3EN2MHPYNc74lIo893cGZ z71jqdcxnccFITBlU9sV37/4b5zufO2IJN4l9efqFMJtIsi/q50hcHs4uX7q5Oce4jC2 l2UzamS5sN+Nw3uIDdcIAwPwR9ao8ky+Rq15gnu8pc9Bx51WY9zKbmViyoAXBOHFfrRD Z/bKQqi9390q9l575u3ENdOmu4KANo9rDwqEF1bCwef75zubCH/Ptarf3paPYFaoKok3 Q7hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796445539; x=1797050339; h=mime-version:content-transfer-encoding:references:in-reply-to :subject:cc:to:from:message-id:date:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=dl+nc17p0ogm+udo8qdpTSC4jEgkxfyHbgR2wavd1rk=; b=qQk9Qav4rJuMmsARwuZt1bkqzRwfvV5pR4jToa0biMy1um9pVzRBlUbSZ7G3GX7sMs ODO8gF/MiQVYPnulvNxJiwosfSyKZ1q2iG2lx3V+7rx0Tt3yQmQi3nxH7GlgsCdo170y k6AAkqlN9VzFjNzhakpXi6Sg44ne1zUXNPp1RowS6upDAbkuQpfyjydYHaBabUv7UPK4 oUKlS0zw5Jykwp68dVt27loxYOQH168bqxJlmkmjc25tHPtXF0dvk6uAwLRsQ6vseFWI /6JwaLLDPfmlMIMD864/15mVq1eScxko2TFDUsOOFMFx7DN+q3hnztvUucCPihjrh7Zj MIRQ== X-Forwarded-Encrypted: i=1; AL+hErGR2vRXuRdXapsnEZ6EC0q2bMLnQRkf8tljjKZpWwJO+QnYadmMyl4Uf6D5SPbYegG8jwo=@vger.kernel.org X-Gm-Message-State: APuU4Z9IXhftVmxoxrVyxZ26g0WaNPukBMCo2lMcbOBDMgrGj60eUMh0 vB5ZdnTi9WWd6v2Jpa+Yl2SciC5kAd9csOjTSYkfznN9Xu3OCmJBlmib X-Gm-Gg: AZFdTZdr0mZFEiaK5pHVJNEbNG2BmQG5E3zq9Yi4+cOL4e9FYgNwwyxlGwoTbSW3QsK mF4V63ASsGRCqo54PNV9y6jNOfgrMy/IKgFDVHg91AreAMQLmkTalpUmY6QatI4THStWCqESEsQ CmlmPxh0iYbhnmNQMONUJcGsT9HR3QxbsNvVAuiLJQXjjcRD2+/L4qJYN4q9VdRHxkw66BuP9eU QwrOHpjRRfq0fgTrn91SEJByF5NAU0E5K8pM9T6HhQ+NYWLG3s8O5+APtiVPTwkyeVsCDgYd1Ce HfmcTAKSXt6IxyTMuljIa446QzgaHZSw7jJqTRRuUJS5HLO3xvpzCi0Ly2FRgQiM6JY/ocFPyhP fG2bane+pZnuHkh4jyAJwv7dmA+TTGFoDR2LLl78BC8qfs9i85yEdqT5qnrXi5mUqsfELvCqQJ5 wfaJV9+DMmP4ZB9N2Hs4jlL/7d7eFDtaF7Vu53kZblR0wVaLToVBLEd+2QykxaGWo8t4a0KNMIM wfmME2iqMBc7riHjxQ7UeyYWHy3k40j2FqFpMqEb4k76LVzFZczYZxfcCh6ua4+mL0SUXcAhRQw wI4C9iJw0qp6UjDqNo4C1FPMClGLBjaDLace6lmgnwOP0e9ZB7x98IpWfa6JjcEN3TsOQEOkh6R OJDeo5lq6i6knoTkYWlldXE+MJ29n/UKveA== X-Received: by 2002:a05:6a00:2d1f:b0:8a0:3617:b53a with SMTP id d2e1a72fcca58-8de2d81b197mr2709395b3a.18.1796445538538; Fri, 04 Dec 2026 20:38:58 -0800 (PST) Received: from localhost ([153.61.198.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8de1397c685sm2793311b3a.55.2026.12.04.20.38.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 20:38:58 -0800 (PST) Content-Type: text/plain; charset=UTF-8 Date: Sat, 05 Dec 2026 04:38:57 +0000 Message-Id: From: "Alexei Starovoitov" To: "Ihor Solodrai" , "Eduard Zingerman" , "Andrii Nakryiko" , "Daniel Borkmann" , "Kumar Kartikeya Dwivedi" Cc: "Alan Maguire" , "Emil Tsalapatis" , "Jiri Olsa" , "Song Liu" , "Tejun Heo" , "Yonghong Song" , , , Subject: Re: [PATCH bpf-next v3 3/6] libbpf: Resolve kfunc variants by prototype In-Reply-To: References: <20261124224811.16134-1-ihor.solodrai@linux.dev> <20261124224811.16134-4-ihor.solodrai@linux.dev> Content-Transfer-Encoding: 8bit X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Thu, Dec 03, 2026 at 08:51 PM Ihor Solodrai wrote: > IMO TL;DR given our prior discussions is that we can accept the > breakages. An updated (or additional, depending on what kernels BPF > program tries to cover) kfunc declaration on BPF side fixes them. Thanks for the analysis. The breakage is kinda bad. In the past we beat the drum that libbpf is backward compatible. Ask Andrii about systemd ... I don't think we want to repeat that story. Let's find a way to do it without breaking? > With this series, such a declaration doesn't resolve on v6.1 to > v6.10. No single declaration resolves on both sides of v6.11. A > program that has to run on both sides can declare both prototypes and > choose in the prog: bpf_kfuncs.h in v6.6 has 'struct __sk_buff *' and 'struct bpf_dynptr *' too, and no __weak. commit cce4c40b9606 changed the kernel side in place. That was safe only because bpf_core_types_are_compat() accepts any two structs. v6.1-v6.10 have no variants. There is one candidate and nothing to select. can we use the struct names only as a tie-break ? No candidate passes kfunc_type_match() and exactly one passes bpf_core_types_are_compat(): take that one. libbpf does the same today. foo(struct a *) next to foo___v1(struct b *) still resolves by the name. bpf_cpumask_populate() keeps working on both sides too. > With this series its essential name is scx_bpf_dsq_insert___v2, while > the kernel's scx_bpf_dsq_insert___v2 is a variant of > scx_bpf_dsq_insert. So it stays unresolved, and compat.bpf.h falls > back to scx_bpf_dsq_insert(). Patch 2 makes compat.bpf.h try > scx_bpf_dsq_insert___v2 first; the scx repo needs the same change. can we cut the func name at the first ___ instead of the last ? Then scx_bpf_dsq_insert___v2___compat gets the candidates of scx_bpf_dsq_insert, and the bool return type selects scx_bpf_dsq_insert___v2(). The existing scx binaries keep working. No need for patch 2 and for the change in the scx repo. I haven't actually tested this idea, but sounds plausible.