Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp739070lqt; Fri, 19 Apr 2024 09:01:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAtiYxY9G+emizMkK/siMmwvuURVyNxg5HnRcwyZBylIIIMyro5GqwYV1zrdyGUSVRSisry57unTNSfX2HkOECkpZeeuzEgfYh2JYe5Q== X-Google-Smtp-Source: AGHT+IFZfQrrT4C7sjknBAbe2n5NOywgAT7sLIEXoRYKVoFX+/Idmgx7uwJSVbcceYEdK3q6G+tQ X-Received: by 2002:a05:6808:219a:b0:3c6:64e:aa01 with SMTP id be26-20020a056808219a00b003c6064eaa01mr3102164oib.7.1713542505494; Fri, 19 Apr 2024 09:01:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713542505; cv=pass; d=google.com; s=arc-20160816; b=fazWcKiVAUAbE0VgbNSd/Pc14jT3he9SHlXdCIKe446RDR3FEpmcAM9vipV3DtoeND lMpDJJEhpsCuqSIV59J9onUhyE5BMh2v8tUrREwla1lBS5Xd/W6AObgB8QyzTZaVoxRi N4phyyvVizE/MwIIMq4PA6LoPjfBINlef2kQCHoFBPFgKAVv3YFNCI1lnPO3wRh1ikZe 7P2wnE/6SO5CL8JJGJfgSbsvYUd/fyGh+qn7Nukjpah9rII2E958lriWM9v3BXr/OEsz NAhxkuHcoPEc4+FxBezptzv96Y9i800xfLLJT8DSnINBNdaUymxjBtn4tojKnujvuEyS esAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=epixK8surSKU7htGDNuCV/Bg3rsnnugbsbdyUHrpE3o=; fh=q4UXWtcyd1MFDR47RrPgEwGOSJCQezDRAV0OMmsdobo=; b=Mn7soo6GuZlw5iEORzAGcIeGpZZ36Clw/Ef3Q/oLTOWQCLiwYVZo+BpzHDF5RLlcY6 R3UKiZpBrLbeC/fyaxHhwysk3190umc3axhsLHjcUIj6eb+BrLHZxerayAE32JuiRioN iWsCl9QJeGvJqqJgpHYUU/rykYiY/iu4noG/UKpe/AKKlHJE/LoyVwrhq9VhxtNdOgif jeKUwNQqNRWo1VQhVxXLxmXv0PgBa7MUwAc7KJSVTbfPJ0/CirXc1ftyorKLUsCn9GvQ TcW8XhTijxtXXV4qoKW3fZuWkj7Vutb2112nUuvWug2MgJV4XepoRAEeWzrKes93c7JG j3xw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tznkkjs7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-151721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 cd1-20020a056130108100b007ec332c5c84si789331uab.109.2024.04.19.09.01.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 09:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151721-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=@kernel.org header.s=k20201202 header.b=tznkkjs7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-151721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 9BC121C21F0B for ; Fri, 19 Apr 2024 16:01:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D177130AF4; Fri, 19 Apr 2024 16:01:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tznkkjs7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 912C212F5A3; Fri, 19 Apr 2024 16:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713542495; cv=none; b=smvyAyOM0RIO8BQFC/zzgh8SBmMBGqbBI64zL2blEeN6rcP/PMgmQsVXmaMlZszKgcD90ErCR//QsZG5uOgpnxlta5NWYwrAamJ4Vd1+0lAnsdlncod5WGnvX2rWCGtPhTsu18rIW05m5B/xlHpM8f6CJIRy9oKjmTEdLDnTRFs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713542495; c=relaxed/simple; bh=oG+eyuNx5evdOk6qBKTdlsXCspoEv9Lhqp4EUQfjFU4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BUnh9tbmvnd9da+6Xh4PXgtVPbWDD1PqPJ6ogZ/n1oKPsQscd2uqUZnd6WnDfHGEakMdeDG9bb2nLHSb27g0P0vwtA/kl2cMItWwRwdorBPEOviuhi4iYcPAfmetylvTt8GiXpzM+hE3JF1QHdRoNPzpy/lFosSW2FQTreDZAoY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tznkkjs7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80551C072AA; Fri, 19 Apr 2024 16:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713542495; bh=oG+eyuNx5evdOk6qBKTdlsXCspoEv9Lhqp4EUQfjFU4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tznkkjs7r7kKe0PM3Z220g4jO4h6fYG7YU4LFLK7mSRkMy4IQYC28WbVKlD32CQqx GF4u0Hkv+nYeEHH8BlohiGSrn1jU1DI7Iez6X8wMQkTej2tCwxXB/CMNeIo/8hHfCa mz4rDuyu+4thwmQkI6q82q8djMm61y4xY7Ks788/1iyfsCm11eQkE/Mwd2klLQsbqU F3iMYb3noSLM0dUD5mBttNHaVuMNhBAbKY06fCk1mtwMI4cA/UPlm0bWbPrErlIbHq zirkVQTHw7zE4gLJ56HXapjkAV8wvGJVvhoxcX0Dea9VUhXw/GSKKTY+iTopDHycdG ycj/ZSEb3W7rg== Date: Fri, 19 Apr 2024 18:01:28 +0200 From: Benjamin Tissoires To: Alexei Starovoitov Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , bpf , LKML , "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [PATCH bpf-next 17/18] bpf: add bpf_wq_start Message-ID: References: <20240416-bpf_wq-v1-0-c9e66092f842@kernel.org> <20240416-bpf_wq-v1-17-c9e66092f842@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Apr 19 2024, Alexei Starovoitov wrote: > On Fri, Apr 19, 2024 at 8:14 AM Benjamin Tissoires wrote: > > > > > > Honestly I just felt the patch series was big enough for a PoC and > > comparison with sleepable bpf_timer. But if we think this needs not to > > be added, I guess that works too :) > > It certainly did its job to compare the two and imo bpf_wq with kfunc approach > looks cleaner overall and will be easier to extend in the long term. Yeah. I agree. I'm also glad we pick the bpf_wq approach as I gave it a lot more care :) Talking about extending, I think I'll need delayed_work soon enough. Most of the time when I receive an input event, the device is preventing any communication with it, and with plain bpf_wq, it's likely that when the code kicks in the device won't have processed the current input, meaning to a useless retry. With delayed_works, I can schedule it slightly later, and have a higher chance of not having to retry. I've got a quick hack locally that I can submit once this series get merged. > > I mean that we'll be adding 3 kfuncs initially: > bpf_wq_init, bpf_wq_start, bpf_wq_set_callback. > > imo that's good enough to land it and get some exposure. sounds good to me. > I'll be using it right away to refactor bpf_arena_alloc.h into > actual arena allocator for bpf progs that is not just a selftest. > > I'm currently working on locks for bpf_arena. > Kumar has a patch set that adds bpf_preempt_disble kfunc and > coupled with bpf_wq we'll have all mechanisms to build > arbitrary data structures/algorithms as bpf programs. Oh. I did not realize that it was that needed for outside of my playground. That's good to hear :) Cheers, Benjamin