Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5211788rwb; Mon, 31 Jul 2023 21:21:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlEtWt1HmaoLeoLZGWLd1l3eLHRGvSKS6AIcOdv44XkCOVmmXIn0BT/gJl1dOLA5MZ+TQuyR X-Received: by 2002:a05:6358:4186:b0:134:c1e1:3b08 with SMTP id w6-20020a056358418600b00134c1e13b08mr2287123rwc.25.1690863672593; Mon, 31 Jul 2023 21:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690863672; cv=none; d=google.com; s=arc-20160816; b=XT/IPO0AotmHCn2hvoPl/BbYriN5Cl7lfrcEfuMZCYZZc3GJluzo8Ek2bvh5DeTtPI 9TLK2BWvM5ZHPYIroW5xI/8C5JQW/XqYUPLIwIPs9uXjTQIRJH8SEALj6kWM4ocQYGkS 1bXKr0TNi/iC1p5jVhr5aVCTay+001a8G4d7YfanlrlHT21mTJ6kDbpBnNjvra5zrHny 8KapHVNDctcI6YfeGUWIgjFxUffYN19MAegpUJtFihNUNp6clQ19UeCoiTWj+61lvvbD TL8TJfbdn6oUiJy9jHJ4oBhJRLl/u6gDcmILZojjoQTow6+cxvgmJ1layUb0IS5JBHmm a+4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=fgkmHFqFF5DRkvZE6HAty/AtPucyyP2tNxov8gT2qzc=; fh=E6ghH9kERQt3XlXsoU4X7qZ+RqDC0XlI1JFuJGvPopE=; b=pBueHxhlMBIqeegS6Btg09dStaCdIaRU/HFhAC14hByHpK09rKdjs2ncqOGx6Mx9j+ mvwJg7ZcobQPSAwLnGLZw+1mlbI9+PbbPkKWc+UAzH5agw/KTwe4CUhEPDTVonYfkfQO dhQvkKeF5NDzcsl70H8ewdC6JLhXUcfE2oJmpLBdmJuFlFMDgSiAvtK29bcdzJcAOGEU zTczdJTgTJSsApxITg0BleEybCJ4LVN6muvn2fda1xfvWtichI4lTwHLWUHozNwG04MB IGe1rghRjGHkkqLG7Xbn4ToXLcDmLbvmjuZTRdz/YRR3P+JChfI2v7UsiD3dgZg0/aXU Cr1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=akFDDuct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i70-20020a638749000000b00563dbabb693si6087922pge.383.2023.07.31.21.20.54; Mon, 31 Jul 2023 21:21:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=akFDDuct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231280AbjHACnl (ORCPT + 99 others); Mon, 31 Jul 2023 22:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjHACnk (ORCPT ); Mon, 31 Jul 2023 22:43:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A3C10C3; Mon, 31 Jul 2023 19:43:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 65FF2612CA; Tue, 1 Aug 2023 02:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9319AC433C8; Tue, 1 Aug 2023 02:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690857818; bh=n4dsEw0hO1hhcpvbUzRfjMJlHkCbxkrsloRNUT6H/t4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=akFDDuctuT3hHiEMB/+rQBPuCORBi0BotJ2zv0hr8+Wuk4y98aTP6CmXMw6z7tc8v EL423fcpqi+iEBQYH7tcO8+SIRVpRo2F+x2CsiEQDr2AnrnBEbzBqkiq/IH4MqOrkQ 17mCW9HJ70Mwb+iISagAUZix/g5dHrWRvX/XuRkUOrhstxgByzP5dnkbHVBByl5L1R CsPlzcwctPldJb77u/+Cs4VNzfoTovj+QB8JJOKxmmhnNePn83SFgoiv6UzPIcMun4 3b4YyJoT8mG8OQ6xCNaVS0iGqWPhvOWyFQRjgGGsgTLZkzSm05xdpXa+4+/tAhmY6m gFrcg2qMBADWg== Date: Mon, 31 Jul 2023 19:43:36 -0700 From: Jakub Kicinski To: Leon Hwang Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, hawk@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, mykolal@fb.com, shuah@kernel.org, tangyeechou@gmail.com, kernel-patches-bot@fb.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH bpf-next v4 1/2] bpf, xdp: Add tracepoint to xdp attaching failure Message-ID: <20230731194336.5b4bd065@kernel.org> In-Reply-To: <20230730114951.74067-2-hffilwlqm@gmail.com> References: <20230730114951.74067-1-hffilwlqm@gmail.com> <20230730114951.74067-2-hffilwlqm@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 30 Jul 2023 19:49:50 +0800 Leon Hwang wrote: > @@ -9472,6 +9473,7 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) > struct bpf_link_primer link_primer; > struct bpf_xdp_link *link; > struct net_device *dev; > + struct netlink_ext_ack extack; This is not initialized. Also, while fixing that, move it up to maintain the line order by decreasing line length. > int err, fd; > > rtnl_lock(); > @@ -9497,12 +9499,13 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) > goto unlock; > } > > - err = dev_xdp_attach_link(dev, NULL, link); > + err = dev_xdp_attach_link(dev, &extack, link); > rtnl_unlock(); > > if (err) { > link->dev = NULL; > bpf_link_cleanup(&link_primer); > + trace_bpf_xdp_link_attach_failed(extack._msg);