Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1848114rdb; Sun, 19 Nov 2023 13:03:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjEdMqrVnCmojM6TBufDcKdQY0ikSlFIFX+m12hp1xLhVQUu3xXaQb0M/69ogLORIqkCPe X-Received: by 2002:a05:6808:1b0b:b0:3b6:a8f8:fa0d with SMTP id bx11-20020a0568081b0b00b003b6a8f8fa0dmr201297oib.15.1700427784962; Sun, 19 Nov 2023 13:03:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700427784; cv=none; d=google.com; s=arc-20160816; b=HEr9ER7KLeBIRh0aeY/EUZLn+gFuobPvwjlLeX5OzQ5H4syWZTmZ9MvbN/LLaVDU/j KH6fId9EoJvXBLCZA1Y2MeOU+bGSodKmAZqEgtF1qS3E1j/IbxG6bPSBvQD99MvvkqMY F+MVrWBjshON54hlaUrnGLxE3/FQVlv2QE3N0ROqIsdObiA/W01Ir0K2XnpXww/2bq8D rB2Xop0fR2fK9J4Z6SEP8xZ5F459WY8FfllFEkt6Wx2RHZSNm2YWZs3gATTB6M5sF2fi tuTSgI9wVLBGixNa8XkwKswJzdITGqT6y4FMQK8hr4xPfBA1yg7d+I5eMqGPLBeKQdbb hiug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LdCcDCVibEq9XtMPBRAazcWyb1lUm4YRH93xkKpOHbM=; fh=k14T+ltQmYxY47rXINDOvNpSCjIbeWJPI0i5dqbdmVc=; b=EX9wSxSd7TFiBWqCDaiNWEEJit5Lz07NOOD2htNR8sdkRkbCZPfPChLMCWHQi8OoYx spN15wZLrtVbX4+X0+f3OcJ+gMk5snAjNCI0bm8bEJGZrbh/YWNKXQjnMZ3sG79EFQ/T VQ+NKXWMVX4tIsglKlT+/ruMvhx6wGUZi+KFaO/FMuVa+h5dMAzRN6wZDixjQocauH7J 4C8eiOaorNMe1nFuoXGF2jvBu0MBvViwMkP/iNpECsWX/s+UyU02/OT3685xDZTziKj2 dqF8QFDrTo2V5lP3Ny3KRJKpfi0k1mqB/1TaI6xrrvzoRP2IJLfn8ZikvtICIwoeNR4c t/Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FZpuU0td; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y38-20020a634b26000000b0059d48c43152si6727682pga.40.2023.11.19.13.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 13:03:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FZpuU0td; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E8D67806209C; Sun, 19 Nov 2023 13:03:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231450AbjKSVCw (ORCPT + 99 others); Sun, 19 Nov 2023 16:02:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjKSVCv (ORCPT ); Sun, 19 Nov 2023 16:02:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4E9E0 for ; Sun, 19 Nov 2023 13:02:47 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57949C433C9; Sun, 19 Nov 2023 21:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700427767; bh=LdCcDCVibEq9XtMPBRAazcWyb1lUm4YRH93xkKpOHbM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FZpuU0tdRMVqNc17EPw2Yx+O61k7X2a1HFa5dIdI0JeSJbPg+OayhEf8qOUGAqiy3 t65XUeKw8Z935Y5auUU0WejjqnKGgNlEp1OxFv3e2uEtZJlCjgkEV4oIU6FCpC7Ovs QRuW5N2zde8PrWeKWO39XMJLMQysUEvMBI4N3XDwn/odf4AVo7ewp/Cj5zp56782Vv uXEpEyQ8f4mV+dC1VwB33IAfg95hhwshydjYwfaxW2yJAJlvzXqSkLtHWFHq0EA08i vATgFTBKZotJ6LQY5zo+mmwR81AvAOd4c8JUF5epck+DjCpD4r8DMoNr8uQmKeXBP9 R07melvoUfkSw== Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2c509d5ab43so51544441fa.0; Sun, 19 Nov 2023 13:02:47 -0800 (PST) X-Gm-Message-State: AOJu0YwGj2mEpQ+m6A257C8NBKjue25jd2UZAbsg8QKSN2rN22yUTpG2 j67ehwwO4XcsCuSfDiuSEysnjYvWqgn36Y8IvOQ= X-Received: by 2002:a2e:9656:0:b0:2be:54b4:ff90 with SMTP id z22-20020a2e9656000000b002be54b4ff90mr2814616ljh.53.1700427765530; Sun, 19 Nov 2023 13:02:45 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: From: Song Liu Date: Sun, 19 Nov 2023 13:02:33 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 1/7] bpf: Introduce BPF_PROG_TYPE_VNET_HASH To: Akihiko Odaki 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 groat.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 (groat.vger.email [0.0.0.0]); Sun, 19 Nov 2023 13:03:02 -0800 (PST) On Sun, Nov 19, 2023 at 12:03=E2=80=AFAM 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)? > > > >> > >> 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 possibl= e > >> 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 chan= ge > >> 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. Thanks, Song