From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by mail.toke.dk (Postfix) with ESMTPS id 2EF4D9DA220 for ; Fri, 6 Jan 2023 18:17:31 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=OQ2i+YjN Received: by mail-pf1-x434.google.com with SMTP id x26so1500254pfq.10 for ; Fri, 06 Jan 2023 09:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TavTUbONX2+yXfbTWhYMTZaU5crQvqDDzZMkJ5klCoI=; b=OQ2i+YjNeDuVeemoCKcA2XSQdxATDnzDlf0RB/QbImUC7WJyGCcbS+x3ItHv4p3bSv YtxcAO9wJ4U1ZRz0pWW0kdxuj3iVn5LCbwY9VXEc7SoFVY4Ze4VN/J86L/Rbi4fdQ4ia kZvZbvJQ7T8FOXHZOUs1OjOneoLgnPKriCppNEFspUmNHyuAXeq93f8Nha/QLLXXAnBq 9w9xVh0G2hrl7s1FC1d0QezYm/Qge3h8cpEjHDWd+xIR8NJIjmhy5oDNQ5IuXJ2E3f+u ruL+MhSEBDfwy5449lBWB+myk7pp+6o1q4jlikuYrUb1HA3LP1/eqL/vSQDsyAmD669O mmDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=TavTUbONX2+yXfbTWhYMTZaU5crQvqDDzZMkJ5klCoI=; b=SGWdDdAJN4hRz48FLHjJkqMprShm9B3zqONqqjvKRZpaQA7Lvk6w59mL5rXaHacSgN iZaL1rxf6Tu51t5u5c67pNXBrraFE8+hEFTm7PeQ67NMt5ljFdz8SZW4Hj+wUL0HZdJB 5c/qppOqrA3qrH356nzKga36yWDEyE2eTHZklVNDNSS9M/lz+DkGPOiHiY8XWZ3suzQ8 ECDj81cOHB+aBEf+gNDvpoPwlcKisgGIIWZIrtaZfT+bHjtmd50ajPyAJfyUGqaqC4tU kBCPIWUNxFkIXqdL5wgtVIyqW/tRdOotBNiSst/vTWMQbwxhnLKkT3PyGQGB+S8nVUFI BJaw== X-Gm-Message-State: AFqh2kr6czW7cVbc9B0MjYnFjMcU/fuxMchWyf1hWehbFS+vrrIll7Ej QeOTmL20CjZdj/r3pG55+mh0n0z6mVfy6cXUMpB3CA== X-Google-Smtp-Source: AMrXdXvZ8opWqDUM60+7TMJoKaRUq+N+CT1X9WhXI5/EMF0PYpXOXugqaMscHIisifaLKZRR3tVlDWwEC+73ayGQIAs= X-Received: by 2002:a63:9d0a:0:b0:49f:478d:a72c with SMTP id i10-20020a639d0a000000b0049f478da72cmr1706861pgd.250.1673025448721; Fri, 06 Jan 2023 09:17:28 -0800 (PST) MIME-Version: 1.0 References: <20230104215949.529093-1-sdf@google.com> <20230104215949.529093-8-sdf@google.com> In-Reply-To: From: Stanislav Fomichev Date: Fri, 6 Jan 2023 09:17:17 -0800 Message-ID: To: Martin KaFai Lau Content-Type: text/plain; charset="UTF-8" Message-ID-Hash: 5MUO2POTK32PEGUCIZ4ZQ6Z7MY33G37X X-Message-ID-Hash: 5MUO2POTK32PEGUCIZ4ZQ6Z7MY33G37X X-MailFrom: sdf@google.com 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 Thu, Jan 5, 2023 at 4:48 PM Martin KaFai Lau wrote: > > 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. Yeah, true, will remove, thanks!