Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp573201lqp; Thu, 21 Mar 2024 09:11:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPIXiiaGpp2icuKcQkvcWq0xltWPIuywFc0Q39DvmfSUwu2mJIPxXW3TF2FviyIISV4eTk4+bADqafzvfJRqbeRPZk0MBv+YQt0AaGQQ== X-Google-Smtp-Source: AGHT+IED/ES6wTGk83RYtcjNnCsKW+XigDMMDefG3F6S4zAkZpDvpcZgm9GuFShJKV1KSLEh87XH X-Received: by 2002:a17:90a:408f:b0:2a0:1fd7:23d6 with SMTP id l15-20020a17090a408f00b002a01fd723d6mr1974719pjg.1.1711037492776; Thu, 21 Mar 2024 09:11:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711037492; cv=pass; d=google.com; s=arc-20160816; b=K+/FGWYfFN1iYNGrmXTNvb+7/rSBnCiEtwI5GCWxeKxLd4Ucf04ZtCiAbanimaAEDR MUBprRW32Qro37LAMaVBQ+9/AWoXLeMWbNP0T9HRosWqglHmPlA3RDaINt9J+lTtrHqd XrkYKkOFj1TC4kipI+aIH/5unjTlKaA4R5AWcvcOsTe5S+NnhSAL2fgjPcRmpthJJ2Ot 04lWXEUq0GOVwU7t1rQOMzQRCQaC4DFRXEzSapbMkk2Y0Wafh+XvVPtC6R89mo17MQQL strlCsRa5AXBuCa9rnU5XmrqNf93hNlL0xNSidnHlHQcnQjR/dBXl/2CvLl3MWxDyy6C cMIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=l9X/54MANsD/vA3gDB6Zr3YBdoXorm5FGsBGyONKCgo=; fh=WJgJjupbtvE2HXnx4bS9bfGOiWmo2GNT5pbUKQmkZ9I=; b=ckPzXPFtqD7XGlJnt8WX13q2junkKgAyvIr/VIbl1xuK4IPIUYpJC0pjDfqHpRCbsQ 9Lt9zxhdvVFR4WncZTO5LfhFecNF+ebAvm8P/EdPnKvixPgzhBr7Wlt2C7tob11v+tZh pdXT7Pk9k0BsYtwSAFfc2DGN28SCWNkH0ET6WxOsdpfYD0ouTHcDBxEeKZWkx3orAz82 q2XCfEljS8F2MXTyQHLl2upe/Y+wmLfxo1PHwqw33G75nG6Ly9mh6ugDfSLc0FugzkOI 1JeWjfo54HQszOCJzCq8RlWTrgsW4Q0CHApWr5lnVOmnttSpQ5HFZMKwim7l9aWWWfv9 vweg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fs3LJ04Z; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-110272-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ch7-20020a17090af40700b0029c77fee41bsi3903570pjb.3.2024.03.21.09.11.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:11:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110272-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fs3LJ04Z; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-110272-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BF475B23844 for ; Thu, 21 Mar 2024 15:45:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6D0586AD3; Thu, 21 Mar 2024 15:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Fs3LJ04Z" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 0924585940 for ; Thu, 21 Mar 2024 15:44:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711035860; cv=none; b=eiB7caYYFYWd64WqDDC9VgW9lYIcz1PBjFGOoRPf+ux0vYswlvvtBGbp2syWLK28ura2jss+59MY1/96aB/st54mXu4e2qXioCzy68XFGIwtUJC0nRBJetz9Dfa/2qMyqX26KzTh4Ud3REw6+F1v/oXTKSYPXubRmLvVP7B33hg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711035860; c=relaxed/simple; bh=phrwu6hEFwR3OmRq0xmE0wJeGnZ2XPtxhImxOPSRs8k=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=lx3zxbVzO8tyuavryxkOvpWiRv9Ek4lbjE4JmFFHH6n499O/mCZyDqe1nzSCkiOts3QaCOhITs0WfS/JizUHLI3APQTSKC3upbmBvhaUsq3C+t2NkdOvXULVvy+KGJvOIWOy18jJ8c8+namNmBe15OW+FU4vAWfhQTyTC7FG4pE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Fs3LJ04Z; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711035857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l9X/54MANsD/vA3gDB6Zr3YBdoXorm5FGsBGyONKCgo=; b=Fs3LJ04ZtiUPGoM1CQnvBJ4It570s9nkn9kisAUcgEMuMstYAWugyVNJhNeaHrBvIRhXdp WI8rVkE905v0lUM4B6DJjYnNyIrVn3hPIwldfJklSVPG8Fqcr7sv5Zm5w3irj0dyMJzh2r TEeBcKUu3lcYb626Wue3kolOpiJDIRI= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-fBiKanHENraHKqQKbW4-QA-1; Thu, 21 Mar 2024 11:44:15 -0400 X-MC-Unique: fBiKanHENraHKqQKbW4-QA-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2d49ce3736aso12062841fa.1 for ; Thu, 21 Mar 2024 08:44:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711035854; x=1711640654; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l9X/54MANsD/vA3gDB6Zr3YBdoXorm5FGsBGyONKCgo=; b=LxHHxYTpvPOt8PI+t7wYJMitsw6FqF39JfgO9IU9Ni/SiDi2Kb6rWT3tZzgdAuFQKM exGN48P/nEjXLQaq9skkpZQvapIb2V0ATcLYYtX4N02daDqCCm2qsvrnG1NDwHKoaghs mIuNYb4tGvb45mQ8ay6Pb714ScfLPYBGoxQm2rAcVyx4zMdgYPQT8Oiideuga275Kzw+ CnOFZ61sQy5Ar4Xotr9+a/JCFEAgrv+feg3caTEi7fIW/FC4CqOeW4YLZGtg8M6eqR+N UfNaeLodjfcsSSRwKNSgMLAF+l1CDOk1KCsCIVvqA8e21fDid0o3IfZ5eYl94Ut7bTfg C5Xg== X-Forwarded-Encrypted: i=1; AJvYcCUiDdCMmMn9SctbAwuCBzsADl2Lzs1qEw9jp1ETPiZwYiNFILEMhiuUfTHCT+2Byzd2PNpYoUpDXh3vS2IMQzTj9kHYOUc38NVGH3+N X-Gm-Message-State: AOJu0Yw/3m/FvnY5KMxCiH2CC3yRGlk+A9LYnxDzdBmJDz3GY54YAlJl Ilz0hgLa+SqmaghvgqcKWDZU7QXRFZe+rrLwJ+F2zwWZQi5J8sO1h9a5+N3NpKeCkVnU6YEfB8Z nm242RVfStB+oRSycTQS4aFnLc89c6nD9hO5q+G20vGu14Jlm6yAlPPFjzIkapIK/C6yrTIiwH4 c2QYY5hJ9sSG12RogkNObREjFyin6iO1Glow2d X-Received: by 2002:ac2:5b50:0:b0:513:d82a:8d3a with SMTP id i16-20020ac25b50000000b00513d82a8d3amr2417722lfp.35.1711035854146; Thu, 21 Mar 2024 08:44:14 -0700 (PDT) X-Received: by 2002:ac2:5b50:0:b0:513:d82a:8d3a with SMTP id i16-20020ac25b50000000b00513d82a8d3amr2417696lfp.35.1711035853790; Thu, 21 Mar 2024 08:44:13 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240315-hid-bpf-sleepable-v4-0-5658f2540564@kernel.org> <20240315-hid-bpf-sleepable-v4-3-5658f2540564@kernel.org> <70ae8d7d2ed950466a61d118f59c16cb07fc9688.camel@gmail.com> In-Reply-To: <70ae8d7d2ed950466a61d118f59c16cb07fc9688.camel@gmail.com> From: Benjamin Tissoires Date: Thu, 21 Mar 2024 16:44:01 +0100 Message-ID: Subject: Re: [PATCH bpf-next v4 3/6] bpf/helpers: introduce bpf_timer_set_sleepable_cb() kfunc To: Eduard Zingerman Cc: Benjamin Tissoires , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 18, 2024 at 11:52=E2=80=AFPM Eduard Zingerman wrote: > > On Fri, 2024-03-15 at 15:29 +0100, Benjamin Tissoires wrote: > > This patch looks good to me, please see two nitpicks below. > Acked-by: Eduard Zingerman Thanks! > > [...] > > > @@ -1350,6 +1358,11 @@ BPF_CALL_3(bpf_timer_start, struct bpf_timer_ker= n *, timer, u64, nsecs, u64, fla > > goto out; > > } > > > > + if (t->is_sleepable && !(flags & BPF_F_TIMER_SLEEPABLE)) { > > + ret =3D -EINVAL; > > + goto out; > > + } > > Nit: > the BPF_F_TIMER_ABS and BPF_F_TIMER_CPU_PIN don't affect > sleepable timers, should this check be changed to: > '(t->is_sleepable && flags !=3D BPF_F_TIMER_SLEEPABLE)' ? Sounds fair enough. Scheduled this for v5 > > [...] > > > @@ -12151,6 +12175,16 @@ static int check_kfunc_call(struct bpf_verifie= r_env *env, struct bpf_insn *insn, > > } > > } > > > > + if (is_async_callback_calling_kfunc(meta.func_id)) { > > + err =3D push_callback_call(env, insn, insn_idx, meta.subp= rogno, > > + set_timer_callback_state); > > Nit: still think that this fragment would be better as: > > if (is_bpf_timer_set_sleepable_cb_impl_kfunc(meta.func_id)) { > err =3D push_callback_call(env, insn, insn_idx, meta.subp= rogno, > set_timer_callback_state); > > Because of the 'set_timer_callback_state' passed to push_callback_call(). Yeah, sorry I missed that part from the previous reviews. Fixed in v5 Cheers, Benjamin > > > + if (err) { > > + verbose(env, "kfunc %s#%d failed callback verific= ation\n", > > + func_name, meta.func_id); > > + return err; > > + } > > + } > > + > > rcu_lock =3D is_kfunc_bpf_rcu_read_lock(&meta); > > rcu_unlock =3D is_kfunc_bpf_rcu_read_unlock(&meta); > > >