From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; spf=pass (mailfrom) smtp.mailfrom=linux.dev (client-ip=91.218.175.19; helo=out-19.mta0.migadu.com; envelope-from=martin.lau@linux.dev; receiver=) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Q2P0kiU9 Received: from out-19.mta0.migadu.com (out-19.mta0.migadu.com [91.218.175.19]) by mail.toke.dk (Postfix) with ESMTPS id C64E19CC202 for ; Wed, 7 Dec 2022 08:24:02 +0100 (CET) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1670397840; 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=B3PEia+i1BuL1UOZCVF48BHXleojofUs1rdo3/67Nvs=; b=Q2P0kiU9qzUSGmCD/3q7Xx7WtlMS3yyMI3z67K73kj6hI63KZp6t6fiXoe8AbusLTZNcUl RXjHZIQHc9wPAUSmg6TPKuM+TWP2f1EdPWMbKhT39lanlGe8A1pr9DezKVuZQkbCajQD6C rbKIMpmEV9gq4Cw8qu3q5hUjiCVNMHY= Date: Tue, 6 Dec 2022 23:23:53 -0800 MIME-Version: 1.0 Content-Language: en-US To: Stanislav Fomichev References: <20221206024554.3826186-1-sdf@google.com> <20221206024554.3826186-4-sdf@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Message-ID-Hash: NKAG3RMMSOTK5URFUQUWLL3USMCMOS5A X-Message-ID-Hash: NKAG3RMMSOTK5URFUQUWLL3USMCMOS5A X-MailFrom: martin.lau@linux.dev X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, Alexei Starovoitov X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v3 03/12] bpf: XDP metadata RX kfuncs List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 12/6/22 8:52 PM, Stanislav Fomichev wrote: > On Tue, Dec 6, 2022 at 8:29 PM Alexei Starovoitov > wrote: >> >> On Mon, Dec 05, 2022 at 06:45:45PM -0800, Stanislav Fomichev wrote: >>> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c >>> index fc4e313a4d2e..00951a59ee26 100644 >>> --- a/kernel/bpf/verifier.c >>> +++ b/kernel/bpf/verifier.c >>> @@ -15323,6 +15323,24 @@ static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn, >>> return -EINVAL; >>> } >>> >>> + *cnt = 0; >>> + >>> + if (resolve_prog_type(env->prog) == BPF_PROG_TYPE_XDP) { >>> + if (bpf_prog_is_offloaded(env->prog->aux)) { >>> + verbose(env, "no metadata kfuncs offload\n"); >>> + return -EINVAL; >>> + } >> >> If I'm reading this correctly than this error will trigger >> for any XDP prog trying to use a kfunc? > > bpf_prog_is_offloaded() should return true only when the program is > fully offloaded to the device (like nfp). So here the intent is to > reject kfunc programs because nft should somehow implement them first. > Unless I'm not setting offload_requested somewhere, not sure I see the > problem. LMK if I missed something. It errors out for all kfunc here though. or it meant to error out for the XDP_METADATA_KFUNC_* only?