From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796445540; b=bYFT3qvYAaY5uJJde949W6u9uqO2ivzO7fQE3J0j9LCjERirPjbsfVb3DVmBJwfTVeYR NqB72U3/0cGHKZb6z4/Cly7HgOIDd3gZOcd2BCGHFJKXjvO5inbNasYBISIEzZdaaDfYV aP9qB2QQPZL4b/Be7KeVYtSeD6TUC0+MmkFtgozY9trlb6jKGIQvaRRrRgJIEZdDent5k +SNnxRwQ2wzuSFnc6eVAWyrZn/YjTVA1cmgR5XiXfktPiXMtmuL8UzgLOgaXV4vQ1CHUP nQvmJGrD6xE8//h7a/QtdpRWYxAKgyp70NIQJAJMgdYU9invSHPtfSzjQXz78pd/ZAw== 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=tC4QflPHMPr1u+LEs+oSt1d1GDzdTT9mi3L1gcTdXlNaoR2GhkSnuzRU1egQ2/4f3QRb HmZ4kJgTtzFTqo1c+JkPYgDoJLsvsnXVDcIOFHd5IKtixwKfWrr6aB6LE11qSnMpdUcTM EdWQOM8182iEKasuX5bQkyFX67TdDoapXFwQtX51+Y3rThmytXVKzsYvZYDMRZ6wIeGp8 JSE39RyOhiERubkrT8trx6Y7W68tDVX81IGst23FbtVM/oSOjkU3+ZP9fh9oXhLTTWZ7Z sfJQpqhZp9NHE/y9CPNcrzuj6foz2a88yab2S6QfSTlOI4hg4UM6Z8BKrlhwjm6us7Q== 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.179 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 9C884606A322 for ; Sat, 5 Dec 2026 04:38:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9C884606A322 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-f179.google.com with SMTP id d2e1a72fcca58-89d6bd67045so952395b3a.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=AAIaIyonViHKxiG3ZBUyl71+gok66WIxLi9iQX3ZNH4LYHkZzOPJRyznpCOqsnz3MM mprSrfXWDsJJDVUMVBwbXxCFY5+hYjqhyNyEGLEhYzv5Gc/wToJK3cukvSYd8u2YnoNx toybYi2GIGXGILY0qkIYS7Pil/uSxzv0Sm/2eZxaVpbPOJjLfTqz37vO+QAf71i54+gz i78c+VpNNRLhifkmVzf4dtBRawj5qipmOsP5N2C+sx5vP40ZeGybuKkao9n0Pw9U5Ez5 3dga2A1EmmOQUX9656MJoy7qh8IyRwg1lPdkx0jSiWFIuZz+CgOoOVRxeySmyd5To+IK QULw== X-Forwarded-Encrypted: i=1; AL+hErEqa1go0gaz7s60fkJ7CanSDQotdJy/NJ99lHCnuQ1a3c/SpOdULy8vP3P9u8isVRTe/W8Ee6GzdVJwncg=@vger.kernel.org X-Gm-Message-State: APuU4Z8wz4eA2gUGtAF64oXJdQAduNA1UwZYV7fygRMRSsxlDZvl7C2g hdYgtEafDdrO+vmNfujQvnaunEWJJ8SuchiWcpivhRD8+w0k6w/gfgUt X-Gm-Gg: AZFdTZf5xtRXRq1NzwLuu0MTNUj+eezvWLKKiWkGTYBY1OaIV6mslyWgwwYfS5YL12E ZxRvsWQdyGH0vEfCO71TUe33440e2uCwxPiRM1JW173aYD7UtPA/xXfrcASGh37jdD8pbjEq1GX I/thHF5JFHqMCqTOxGCpl8Vnhk+VUr2PPeOF9f1+zLA8VxfykCJwizV+b11vyhQVhhrhKWmKBnU oFXvjwns0fvzaUPkfAmmC/NOyCbmgFUEx4w47u6czpxbHqobThgQ2bJaNhQlPP/QsuuLhHTqnZX nXi96dyZYtNHTupiiIObFNj/mdnyvtnM/bWEPTyVuOlD2tTIZWOs/cPKc+AFaUXPaoct7IkCE/n pe5wSBYWQCWwJJSsDrGEef1fmZzfiYZ3V63Fsa1PfttNe1yucBpMH4K6LEOlOBMNUqsUN90qX7S iUz0r0J3weHgXWdJ4ZTLtk8xhwOxF/6VABNxX0SSVuuVJi2jVp3MSujpaWYIJJo3vm10paORGnv Sj1RxeTut5jLcBM3MGZXQxtUH50Ie9HVOeXAjGS0IlEtz5rLmsey0FtJmXkoI2blJOD714w6i/X DB+NmHwLG5aXNUAcZWxZOd77J0Jmeg5qaS92coJQOgVrdWEADyHHhyzUC2x1pzcsnCtvkVwbks3 aPf7Jjdf0AQdXXXpelc5LslymitCEy4Sung== 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: linux-kernel@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.