Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp455560rdh; Tue, 19 Dec 2023 04:16:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IF30O/nHGoma4fGsdS6Z/sh+8TNS9/vEXO1AiiXbICTXQTQm+7vcw8ZoR2SBl4UkgEMXvST X-Received: by 2002:a05:622a:40f:b0:425:8fb1:4f5d with SMTP id n15-20020a05622a040f00b004258fb14f5dmr27249029qtx.83.1702988219089; Tue, 19 Dec 2023 04:16:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702988219; cv=none; d=google.com; s=arc-20160816; b=inY3Anhzj4tgDc2o3kz8Udmr94Vth7eMw1nl+1Qw13EElwbx9qHM6fxU0FnaUI5nld jDDY16aGmz9CeTounU/fiUrSh19L9nDr1OsM6VD87Y5HnfGTFREoVT+TYLCmI9qDCiKu WMaZ1O8RMiT3N1GP9R6XBIw2guMnbogR/ZXpr5TQFqutrPKoV5PrQG3oVnqg/jHCJeHK T7ibaEoyqdqPcxG58SPPv9Q3uCye9qMJanI6kkaIziC7vtYEdH5DeLdZ997tnbV+nHri BhGitv5isgJBWOpIRmnQ+4DlFIF150s/4Qm+6kb+ffadldY+EpFiVH5AsHWZbYH1ZM7p EMmQ== 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=pdERbfWd8axs3o2A8KOivOOsBTH7eU7jDtQCQU5TR64=; fh=Vyy1FtKqmtur08eV57mQgofKBPSQ3I4RVWeyfd0e8oo=; b=Lzguawtu/zx6yjhyKFk1Esvjd3Cpmpt2LnIaZ5lSBA5sYHpRsL8GJvJvGgVm7g5bPQ vkyU8pHoUinA7DfisnJSf+WUBScwVUGtrO3kORMjLMU9Sk5k6kuVt7A2utpUUSFsphWS ZDLGgfZH1W3HOfCJet2dDIwnEaD1RKDpu3Yv2S4TgDCDMDty/7sjxjVhDuaWiQvJtDM/ aoBtaRkdz3RPZDt6LjD58fiXPbqmj+G3TozjO5tC3uR7kAfpgPsIcsRFIfnGwenbBjg6 SSmBu/Qxo5DvTvq4DrSQ304AnNmOWj5IlcuA+UY5KYr/2u0MBpt2LAFavrc5T0rW70Wq DYfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=RAneCU9w; spf=pass (google.com: domain of linux-kernel+bounces-5152-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5152-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ay29-20020a05622a229d00b00423a30ba7a3si26998616qtb.125.2023.12.19.04.16.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 04:16:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5152-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=RAneCU9w; spf=pass (google.com: domain of linux-kernel+bounces-5152-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5152-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D4BE31C22E3B for ; Tue, 19 Dec 2023 12:16:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCA8A179AD; Tue, 19 Dec 2023 12:16:42 +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="RAneCU9w" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 2EE31199AD for ; Tue, 19 Dec 2023 12:16:40 +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-pg1-f169.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso180347a12.3 for ; Tue, 19 Dec 2023 04:16:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1702988199; x=1703592999; 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=pdERbfWd8axs3o2A8KOivOOsBTH7eU7jDtQCQU5TR64=; b=RAneCU9wXoqkp9sJKB3vJwk+9/S5DscO15PpEqNV94MOxjOqcGkbmJq92FLtm07lf1 btXH/h2kapHoettWj7tXmDhw8BybJ3HwzCFMIYT3KB0nAAR1TwaP96hFHo0vF9GsGt+w SMjITtrm39RTTdE/UTAmaNAu6Fee/tYjvknt3QHI5vYw2HiTc5d0mUDpgNidFidPUUR3 2DVAxwx3hZ1Opa9qTJl64XXAQvgzGSezCQPKoomV/OTK6Pt6gX71ng0zBC0FVrR3xUqC 2vdZ4Toauj1JoRWM48Ba+HC3+dJNA6VFdA8yn7HIhjdmQIyLIvy23etcwNDXmP3k9WTD 8NsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702988199; x=1703592999; 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=pdERbfWd8axs3o2A8KOivOOsBTH7eU7jDtQCQU5TR64=; b=ZX6Gb9gnZud9UnzKQB2StvSOB+FC1hrdLIE72SbHOGEtPrNgb8TCJkJRR9Ph1G2vGY a2qmrcMdYGVQ+1hITcXWlUp+B2AxqXu3NDmXFCb5u5q/UgfWkfpgfh61ZWq0w1fDq05R 33iFdp9II8s5SwDc+kIq0ec58ajZqdZO/ThITjFEv9+TemVvEQ6T/rYudMD1ZOXg6mPP lhWBC0zEVcJtEMMc3czRn7sRRbhVgM1R1DsB37EIk9oI2Khz6nFZ425YcEecJgkTMyN0 kLzZ7zY+Bd3DwpH2M+5cirJpvZMo7V8la2vRAzuwnYkVC9JXMQJak1z5BVqa8wxzqyK7 +qew== X-Gm-Message-State: AOJu0Yxjr/RuCCkV+jMSZfcDpe0WtdyO/Z0nQlFqXvY+dNrEWkIl55Xg buEMz3ESQKypH9WEGqswfYBD0g== X-Received: by 2002:a17:90a:303:b0:28a:f0bc:2a9f with SMTP id 3-20020a17090a030300b0028af0bc2a9fmr2996731pje.21.1702988199587; Tue, 19 Dec 2023 04:16:39 -0800 (PST) Received: from [157.82.205.15] ([157.82.205.15]) by smtp.gmail.com with ESMTPSA id g15-20020a17090a4b0f00b0028bb87b2378sm1385953pjh.49.2023.12.19.04.16.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Dec 2023 04:16:39 -0800 (PST) Message-ID: <87ae3eae-84b4-40eb-a637-b65161bdc1ed@daynix.com> Date: Tue, 19 Dec 2023 21:16:32 +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: 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 , 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> From: Akihiko Odaki In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2023/12/19 4:56, Song Liu wrote: > Hi Akihiko, > > On Tue, Dec 12, 2023 at 12:05 AM Akihiko Odaki wrote: >> > [...] >> --- >> >> I'm working on a new feature that aids virtio-net implementations using >> tuntap virtual network device. You can see [1] for details, but >> basically it's to extend BPF_PROG_TYPE_SOCKET_FILTER to report four more >> bytes. > > AFAICT, [1] adds a new program type, which is really hard to ship. However, > you mentioned it is basically "extend BPF_PROG_TYPE_SOCKET_FILTER to > report four more bytes", which confuses me. > > Can we achieve the same goal by extending BPF_PROG_TYPE_SOCKET_FILTER > (without adding a new program type)? Does this require extending > __sk_buff, which > is also not an option any more? It is certainly possible to achieve the same result by extending BPF_PROG_TYPE_SOCKET_FILTER. It is not required to extend __sk_buff; we can repurpose the cb member. But I think such an API will be error-prone than new members dedicated for this particular purpose. Regards, Akihiko Odaki