From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by mail.toke.dk (Postfix) with ESMTPS id 288659D9CA4 for ; Fri, 6 Jan 2023 01:48:06 +0100 (CET) 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=G19xsRr9 Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1672966082; 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=QjEddYanE4lYdQQeWVmj0T7Odd9F7GFdvNLOeMV7jMU=; b=G19xsRr9ifxxM2AFtDQBlrZ5K+tLRE7D4L7w5jWYahRByZXRX5khc+Mh6tbLCPDW93E1+j ju43zZWh/O72JxuD/AclsDcALd/F9KgDfzLxit1ZGUSeQ7lhyLONuLXVwTS1NIstFbYALd VIEE+H8uV+220xoc+soPuIEdvfrZNaw= Date: Thu, 5 Jan 2023 16:47:55 -0800 MIME-Version: 1.0 Content-Language: en-US To: Stanislav Fomichev References: <20230104215949.529093-1-sdf@google.com> <20230104215949.529093-8-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: <20230104215949.529093-8-sdf@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Message-ID-Hash: ABW5A6NIDXIHJYL4X3KGJPJKNCJQ3QZD X-Message-ID-Hash: ABW5A6NIDXIHJYL4X3KGJPJKNCJQ3QZD 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: 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, bpf@vger.kernel.org X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v6 07/17] 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 1/4/23 1:59 PM, Stanislav Fomichev wrote: > +void *bpf_dev_bound_resolve_kfunc(struct bpf_prog *prog, u32 func_id) > +{ > + const struct xdp_metadata_ops *ops; > + void *p = NULL; > + > + /* We don't hold bpf_devs_lock while resolving several > + * kfuncs and can race with the unregister_netdevice(). > + * We rely on bpf_dev_bound_match() check at attach > + * to render this program unusable. > + */ > + down_read(&bpf_devs_lock); > + if (!prog->aux->offload || !prog->aux->offload->netdev) nit. !prog->aux->offload->netdev check is not needed. Testing !prog->aux->offload should be as good.