From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lvmebIko" Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [IPv6:2001:41d0:203:375::b1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C54492 for ; Wed, 22 Nov 2023 10:40:56 -0800 (PST) Message-ID: <20c42052-8cb7-4b8b-a7f8-d9311e37479d@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700678454; 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=POgwYlHJWugxMWQc2iXyXTfQgLlq3kyj4NTmbpwqOFI=; b=lvmebIkoSQTcbgHV35q4mLtMw/9aZgQlEy7sUTHMnnB3PFKSitdHbUQan3MgSNU4Mh72oW aHjN97q06ZZu77I3DyL5R4TiDhgWMFX/yD1rFh5OqpOFxefeViWzjEhbDrLuxTVPdqoNew OWJYDH0au4mggGRP33pe9zIQwB4RJ3c= Date: Wed, 22 Nov 2023 10:40:47 -0800 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next 2/2] bpf: bring back removal of dev-bound id from idr Content-Language: en-US To: Stanislav Fomichev , Daniel Borkmann Cc: ast@kernel.org, andrii@kernel.org, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org References: <20231114045453.1816995-1-sdf@google.com> <20231114045453.1816995-3-sdf@google.com> <49538852-1ca0-49bb-86c2-cb1b95739b91@linux.dev> 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 On 11/22/23 10:05 AM, Stanislav Fomichev wrote: >>>> Commit ef01f4e25c17 ("bpf: restore the ebpf program ID for BPF_AUDIT_UNLOAD >>>> and PERF_BPF_EVENT_PROG_UNLOAD") stopped removing program's id from >>>> idr when the offloaded/bound netdev goes away. I was supposed to >>>> take a look and check in [0], but apparently I did not. >>>> >>>> The purpose of idr removal is to avoid BPF_PROG_GET_NEXT_ID returning >>>> stale ids for the programs that have a dead netdev. This functionality >>> >>> What may be wrong if BPF_PROG_GET_NEXT_ID returns the id? >>> e.g. If the prog is pinned somewhere, it may be useful to know a prog is still loaded in the system. > > bpftool is a bit spooked by those prog ids currently: calling GET_INFO_BY_ID > on those programs returns ENODEV. So we can keep those ids around, but > need some tweaks on the bpftool in this case. LMK if any of you prefer > this option. I think it is in general useful to improve 'bpftool prog show' to keep going for the next prog id if possible. May be print an error message after the prog id and then keep going for the next prog id?