Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2059899rdb; Mon, 20 Nov 2023 00:07:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhxhTO+maGF767Eife0UqCJdn8vii6aSEt32uX5OiJWZcSUYBoiScf3nVzodHtIR6ooK2Y X-Received: by 2002:a9d:7319:0:b0:6d3:3eed:b3e3 with SMTP id e25-20020a9d7319000000b006d33eedb3e3mr7105008otk.8.1700467637703; Mon, 20 Nov 2023 00:07:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700467637; cv=none; d=google.com; s=arc-20160816; b=AQtrH/8qFR5gCW3MOC/XdVcm+VTvWsgwxZ4Cs23ee0OKELoib4hJA4iHYBOv+lYunn GbEhKbAH1uOlEQEwy3cK66sxhbKLbXAc8Us0H2rw5Pud6LlFZJgFFTeYJqqhpYO9uPdI VOzSRZAMvZmXxUIQ6Ee7qLZ/wckm4cGf39wvE7eeayNWjP2hM0TDgzspv8rBDDIc0xwd Ru9HFEjmR8GZezTsU9qEmeervQIOUuOxPg0IYrcitdMun36ZVh3YJIa7DfPDjYbZVu9C ilekV8RffWsoXRNL7uou3fj6y6vIuFaU8jDigSBZfaxh7H+A4L7RDwb2QAREYK1UZ6Ii KcsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=n4NoqTxZnppS8i0nP/xGCXWB/hxXsx67zIl1hkFjXDo=; fh=6JYbqZNmWeK6hBmM1DtV2cJfkSydirELGIkVrao/NK0=; b=aQeDDENlkljv+zAzi/ngwhJ+Cq9GZxKXrFvJLBlJykmYvRRB2J0znzEhyQb0pmplSo epge1kO2dNHQdMsDdbi6beLxK1NozTvAxhmFUFcRVC0cvaDBg80FmbtiwYvFpmEz8hwL rPTkcntggZ0lFZrmLBKsDrxz/lK9aYrjihjUm7nmWDNwj6x1dE8xQI4DxqCTdcOBsO4j byC7w8hZmX06ep9wTNalIsWufs6nmgbde/GSQxrFx+mq1pIGb485IxIj5jpB69/hnROU R1PyYrxdPdCE63Iuw6wFagTLsBiIymjkJlMqq+H8YCv7ndnaccBtnfsysxY5/5U/EEoq NK4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=OGRyE6wZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l22-20020a656816000000b005c200b11630si7567663pgt.45.2023.11.20.00.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:07:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=OGRyE6wZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 56F37807E534; Mon, 20 Nov 2023 00:06:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232073AbjKTIFy (ORCPT + 99 others); Mon, 20 Nov 2023 03:05:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbjKTIFx (ORCPT ); Mon, 20 Nov 2023 03:05:53 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0806E8 for ; Mon, 20 Nov 2023 00:05:47 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6ba54c3ed97so4252363b3a.2 for ; Mon, 20 Nov 2023 00:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1700467547; x=1701072347; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=n4NoqTxZnppS8i0nP/xGCXWB/hxXsx67zIl1hkFjXDo=; b=OGRyE6wZHDiPSa6gF4QXDy5G++VYIEFZkEWmeZEiaskWAB2wUBXtzA5uds46mPpmIB tOe9lhtEvqHdhC3ulemjpZKATvLGbU8hgBrIG5BVVwHGG2ZUNIuZQYotukauA/hBuIRG YptTDtk2RaTYWz51aEQzGQB18IalXh2sqC4SErvC7mZ+3fQwRJA42NBV3fQTU85VvVmv F7RoQe10E6yMVAKEEJcC5js3pXvwarz8J+wa5FW5c4E2S4VaqaBKERXUG+DhVfT2Urnp kRLqGRCEzdGsy85oOI2lKINxkTEKWq3ChqOIkRxk6eeU4aDNjhfThaO37pT2P9HxPaAA b44w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700467547; x=1701072347; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n4NoqTxZnppS8i0nP/xGCXWB/hxXsx67zIl1hkFjXDo=; b=ks+v0PCdMiEMQ2uiCl30tXx1vcuU3VzALCZ4B3teJ0J9Xr5HqSoQCVGPPWxBeh3AFv /C6t01WOQr/pkz2EH8ih/BEb8cbgRXJ2Z0hBP2mz4VGBeLNC28La/qeOy6rrQo8pX8Ep 1QfXHthGMKVHBPYMdAEvUujaLaFLUIQ2GsVwMmfUzHOlTjVV/fVWD/lL7QIgcdBUmfMR 6xawiFXWU7A5Blk3JK4VWlvCE6HLyM/S/rh3w6GupmEhm8Wx6J0mx5IWLN8HoCKGz/V7 te/no773U+JZusshLUOWWdYUbARdffamFConpcLh3ktAPQwkW0p4pPjGACayjtsXrhWR SAJA== X-Gm-Message-State: AOJu0YxvOvQGZeo0KSDEfM1r3FN145m/+nB/sCGg0nJ5RNj0xdHgISOA 9GGt43z7Iw2OVS9RUm+A1xRRaA== X-Received: by 2002:a05:6a00:80a:b0:6cb:910a:c6fe with SMTP id m10-20020a056a00080a00b006cb910ac6femr3670261pfk.7.1700467547194; Mon, 20 Nov 2023 00:05:47 -0800 (PST) Received: from [157.82.205.15] ([157.82.205.15]) by smtp.gmail.com with ESMTPSA id f32-20020a056a000b2000b006c5da63556dsm5673415pfu.178.2023.11.20.00.05.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Nov 2023 00:05:46 -0800 (PST) Message-ID: Date: Mon, 20 Nov 2023 17:05:40 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v2 1/7] bpf: Introduce BPF_PROG_TYPE_VNET_HASH To: Song Liu Cc: 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 , bpf , "open list:DOCUMENTATION" , LKML , Network Development , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, "open list:KERNEL SELFTEST FRAMEWORK" , Yuri Benditovich , Andrew Melnychenko References: <20231015141644.260646-1-akihiko.odaki@daynix.com> <20231015141644.260646-2-akihiko.odaki@daynix.com> <2594bb24-74dc-4785-b46d-e1bffcc3e7ed@daynix.com> <9a4853ad-5ef4-4b15-a49e-9edb5ae4468e@daynix.com> <6253fb6b-9a53-484a-9be5-8facd46c051e@daynix.com> Content-Language: en-US From: Akihiko Odaki In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 00:06:06 -0800 (PST) On 2023/11/20 6:02, Song Liu wrote: > On Sun, Nov 19, 2023 at 12:03 AM Akihiko Odaki wrote: >> > [...] >> >> Unfortunately no. The communication with the userspace can be done with >> two different means: >> - usual socket read/write >> - vhost for direct interaction with a KVM guest >> >> The BPF map may be a valid option for socket read/write, but it is not >> for vhost. In-kernel vhost may fetch hash from the BPF map, but I guess >> it's not a standard way to have an interaction between the kernel code >> and a BPF program. > > I am very new to areas like vhost and KVM. So I don't really follow. > Does this mean we have the guest kernel reading data from host eBPF > programs (loaded by Qemu)? Yes, the guest will read hashes calculated by the host, and the interface is strictly defined with the virtio-net specification. > >>> >>>> >>>> Unfortunately, however, it is not acceptable for the BPF subsystem >>>> because the "stable" BPF is completely fixed these days. The >>>> "unstable/kfunc" BPF is an alternative, but the eBPF program will be >>>> shipped with a portable userspace program (QEMU)[1] so the lack of >>>> interface stability is not tolerable. >>> >>> bpf kfuncs are as stable as exported symbols. Is exported symbols >>> like stability enough for the use case? (I would assume yes.) >>> >>>> >>>> Another option is to hardcode the algorithm that was conventionally >>>> implemented with eBPF steering program in the kernel[2]. It is possible >>>> because the algorithm strictly follows the virtio-net specification[3]. >>>> However, there are proposals to add different algorithms to the >>>> specification[4], and hardcoding the algorithm to the kernel will >>>> require to add more UAPIs and code each time such a specification change >>>> happens, which is not good for tuntap. >>> >>> The requirement looks similar to hid-bpf. Could you explain why that >>> model is not enough? HID also requires some stability AFAICT. >> >> I have little knowledge with hid-bpf, but I assume it is more like a >> "safe" kernel module; in my understanding, it affects the system state >> and is intended to be loaded with some kind of a system daemon. It is >> fine to have the same lifecycle with the kernel for such a BPF program; >> whenever the kernel is updated, the distributor can recompile the BPF >> program with the new kernel headers and ship it along with the kernel >> just as like a kernel module. >> >> In contrast, our intended use case is more like a normal application. >> So, for example, a user may download a container and run QEMU (including >> the BPF program) installed in the container. As such, it is nice if the >> ABI is stable across kernel releases, but it is not guaranteed for >> kfuncs. Such a use case is already covered with the eBPF steering >> program so I want to maintain it if possible. > > TBH, I don't think stability should be a concern for kfuncs used by QEMU. > Many core BPF APIs are now implemented as kfuncs: bpf_dynptr_*, > bpf_rcu_*, etc. As long as there are valid use cases,these kfuncs will > be supported. Documentation/bpf/kfuncs.rst still says: > kfuncs provide a kernel <-> kernel API, and thus are not bound by any > of the strict stability restrictions associated with kernel <-> user > UAPIs. Is it possible to change the statement like as follows: "Most kfuncs provide a kernel <-> kernel API, and thus are not bound by any of the strict stability restrictions associated with kernel <-> user UAPIs. kfuncs that have same stability restrictions associated with UAPIs are exceptional, and must be carefully reviewed by subsystem (and BPF?) maintainers as any other UAPIs are." Regards, Akihiko Odaki