Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp76747rdb; Sat, 16 Dec 2023 00:16:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGC9pn7c+GQdNCmh5H1lmLPRWulN3ak3CTI7sKJwdbf0vpqmiLb6khuC9maD3rGlzDQAU/4 X-Received: by 2002:a17:902:fa8c:b0:1d3:798b:9d99 with SMTP id lc12-20020a170902fa8c00b001d3798b9d99mr3351144plb.16.1702714561213; Sat, 16 Dec 2023 00:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702714561; cv=none; d=google.com; s=arc-20160816; b=ZrjcMBjNCZMGFibEa7m9Bz105McmXnIPoNLJNIbA5uSxp4vk+39ScOHzrnmChJaH4P /hIMBepetPHKN1GgLpxJVM8Zmck4JfwVHECQ4PTXuc5pstN5Xxd6cDP6aQxjUCDqygTz aSzZ1jzRoGT/6iLuOI0mb362Z+5x2A6Zku5doY9SHVe0ZOLkLzd2RGs1lx0R6zWpdTMV BU3dwaJqrmtinKIVZEKhCIfUNBBE9QuwLDGLbPQbj/qFZOj7zg0gh3cKAQMUIVUzixTp U3BlDgCKk43G18WPWftvV1WY9guA6z1A/GKBLOeoVlY7dZuKQybnbipoSwqSLnndqUsT 7bng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=j34U3DbBJyUmmhCTSIWekoWpOW5ZdWSwa2YWU4yaUK4=; fh=G/J2HMWDBrMRpf//b9ev5izCJrm6gU8HRetQFc5sLKs=; b=Dxo43dQgL57Hy1F4PuhKymhpcyuUJDbk4/T/R/A66mRvXoAedhHzAS56llNqxFsNcx y3Ry1QMTT8UAhJhkWmNTNTh1uO6FoIt85YnAGnJMlcH+vqpzOP1K8w+k9SBBzKppB1gc rRr0foG50e04qBWrVOMZ3yOl/G3orZYhvz+UoKCaEXDMphIbNUGqG20pKevPbxcNCo8z 5QYIyH3OWe+4CLUdacRZLiL3WLVvuHG8Ec4B3olNB0E3nM/hRjiaN/UMTNW9z75mbqKM pt6G93ijzW1k0gUcZyVw20c1KJbwmDdT4dbt+vykgGRkQ5fGWqiJxGIZlSA/jwVj9V9R Brxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=fSQlZQCi; spf=pass (google.com: domain of linux-kernel+bounces-2139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2139-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o10-20020a63e34a000000b00565e0624182si14332790pgj.404.2023.12.16.00.16.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 00:16:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=fSQlZQCi; spf=pass (google.com: domain of linux-kernel+bounces-2139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2139-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A8483287ADF for ; Sat, 16 Dec 2023 08:16:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCCDD1427B; Sat, 16 Dec 2023 08:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="fSQlZQCi" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 E37ED14000 for ; Sat, 16 Dec 2023 08:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=daynix.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6ce6d926f76so1918280b3a.1 for ; Sat, 16 Dec 2023 00:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1702714547; x=1703319347; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=j34U3DbBJyUmmhCTSIWekoWpOW5ZdWSwa2YWU4yaUK4=; b=fSQlZQCinU0xlc/C7XkWiMFc/n4JnuL0J2BMpN1y8kLXwcdhoph+AlxWeMItVAImiE jM6ABIHhQDEgvbUyrzd0X86wCICqDW0QvnwDyNVUmlW8ad0NDZMuENaA94eOpf7oizEP bDYoM5g04sXrYq6RBCcofqg0ond+33l5i0vzg/PGAo3DUXZcGUqXEDVCqO6Cs2Cgyd+8 3XZ+Sn2e9+MB3nRsl1LetszqffjwE/g4YMF7OH5tJCqwkugzCAmwj2hA3oZYRVc8jb3y hGh6UPJHOvtpum9xUHMXBH80bGdJWsu/fBlT2pXpcPZS2i1YXetEGlN4ZOnLjFpAJrP4 FKVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702714547; x=1703319347; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j34U3DbBJyUmmhCTSIWekoWpOW5ZdWSwa2YWU4yaUK4=; b=Prg8vP8o8g6+Olgvih+XQ0k1qWWFHq4ftr2yiZXYrwVP32WrCzAptB8uLr88Z67Jlz Zgi9CcvpmuBdQVEKnNVuI9QoFmFU0r5PVf43ofdt0VF02XOAgb21WRAy9HPkEPYt5FF+ lofQZWqYXLedzGZM5ll7U7q1Eq21PHFiXOG8J0C5IHDonSvSF8jJvOARtaCiEOn06Pf9 ih7UYs2ZaZIKQEyDrN2oOxwqtkXjGs6+tZa7XV/yfbGaFdwRfhmf2VTwUZp5De4sRz2r tyrJ5aFWt1eSqG6Hez9JToFdc7UGxA/9teZjIca3rkXR31nFTUgZhkm2llPZ3ge2I4mo qx5A== X-Gm-Message-State: AOJu0Yy3+pPrqxMp7peRvC21FP2xUtychcgF0bjNb3jjH2uF5/ycCb3j bJynpi0WuDEMHXqRpvzjnJWM/A== X-Received: by 2002:a05:6a00:198b:b0:6ce:78c9:5979 with SMTP id d11-20020a056a00198b00b006ce78c95979mr17324911pfl.18.1702714547181; Sat, 16 Dec 2023 00:15:47 -0800 (PST) Received: from [157.82.205.15] ([157.82.205.15]) by smtp.gmail.com with ESMTPSA id p18-20020a056a000b5200b006ce835b77d9sm14707733pfo.20.2023.12.16.00.15.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Dec 2023 00:15:46 -0800 (PST) Message-ID: <11507101-ca4f-486d-9fb8-a5d4de0b1b85@daynix.com> Date: Sat, 16 Dec 2023 17:15:39 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Should I add BPF kfuncs for userspace apps? And how? Content-Language: en-US To: Stephen Hemminger Cc: Benjamin Tissoires , Alexei Starovoitov , Jason Wang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Jonathan Corbet , Willem de Bruijn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Xuan Zhuo , Mykola Lysenko , Shuah Khan , Yuri Benditovich , Andrew Melnychenko , Benjamin Tissoires , bpf , "open list:DOCUMENTATION" , kvm@vger.kernel.org, LKML , virtualization@lists.linux-foundation.org, "open list:KERNEL SELFTEST FRAMEWORK" , Network Development References: <2f33be45-fe11-4b69-8e89-4d2824a0bf01@daynix.com> <0d68722c-9e29-407b-9ef0-331683c995d2@daynix.com> <20231214094042.75f704f6@hermes.local> <72b8e198-7058-469a-a1e0-17f48330deca@daynix.com> <20231215083644.4dd9a323@hermes.local> From: Akihiko Odaki In-Reply-To: <20231215083644.4dd9a323@hermes.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2023/12/16 1:36, Stephen Hemminger wrote: > On Fri, 15 Dec 2023 14:49:56 +0900 > Akihiko Odaki wrote: > >>>> It is exactly what BPF_PROG_TYPE_SOCKET_FILTER does, but it lacks a >>>> mechanism to report hash values so I need to extend it or invent a new >>>> method. Extending BPF_PROG_TYPE_SOCKET_FILTER is not a way forward since >>>> CO-RE is superior to the context rewrite it relies on. But apparently >>>> adopting kfuncs and CO-RE also means to lose the "we don't break user >>>> space" contract although I have no intention to expose kernel internals >>>> to the eBPF program. >>> >>> An example is how one part of DPDK recomputes RSS over TAP. >>> >>> https://git.dpdk.org/dpdk/tree/drivers/net/tap/bpf/tap_bpf_program.c >>> >>> This feature is likely to be removed, because it is not actively used >>> and the changes in BPF program loading broke it on current kernel >>> releases. Which brings up the point that since the kernel does >>> not have stable API/ABI for BPF program infrastructure, I would >>> avoid it for projects that don't want to deal with that. >> >> It's unfortunate to hear that, but thanks for the information. >> I'll consider more about the option not using BPF (plain ioctl and >> in-kernel implementation). > > With libbpf, things are much better. It is just that projects like > DPDK have to support wide range of kernels including older versions of RHEL. I have checked DPDK documentation. It says it supports the oldest LTS kernel: https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#system-software My use case is QEMU, which has much more relaxed compatibility requirement that refers to recent distribution versions instead of LTS kernels: https://qemu.readthedocs.io/en/v8.1.0/about/build-platforms.html That said, I'm not really concerned about the case running QEMU on older kernels. QEMU developers can just pay extra efforts to support those old kernels if necessary. The more concerning scenario is that a newer kernel breaks compatibility with older QEMU versions; such a scenario has not been considered before AFAIK. QEMU already uses libbpf to load a BPF_PROG_TYPE_SOCKET_FILTER program.