From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0413DC19F2D for ; Tue, 9 Aug 2022 19:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345087AbiHITym (ORCPT ); Tue, 9 Aug 2022 15:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343869AbiHITyl (ORCPT ); Tue, 9 Aug 2022 15:54:41 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D599D2250A for ; Tue, 9 Aug 2022 12:54:40 -0700 (PDT) Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 279JRMve028517 for ; Tue, 9 Aug 2022 12:54:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=facebook; bh=Rj/d5govs7wMo1Zf77zLAwQrXn4dNXCRYFIAVoUJwlk=; b=iqUa/vxWCBnudncWeuZwXCjHU/udShTy65N2PyZUr/hg3BGDu+oJ7egsT5o4QbXsCiF0 A3EQbEFOtuyJhrYrU6qNAwjuNT1zLm59I7MeQz7ImGvHRLNi2TwSw3RLk9mJSK2AV4Hz XQLaR2fYEtxrbYysPs6NkpK1WLhCtBAouXI= Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3huwrc07js-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 09 Aug 2022 12:54:40 -0700 Received: from twshared30313.14.frc2.facebook.com (2620:10d:c085:208::11) by mail.thefacebook.com (2620:10d:c085:21d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 9 Aug 2022 12:54:39 -0700 Received: by devbig931.frc1.facebook.com (Postfix, from userid 460691) id E0A7A6778A37; Tue, 9 Aug 2022 12:54:34 -0700 (PDT) From: Kui-Feng Lee To: , , , , , CC: Kui-Feng Lee Subject: [PATCH bpf-next v4 0/3] Parameterize task iterators. Date: Tue, 9 Aug 2022 12:54:26 -0700 Message-ID: <20220809195429.1043220-1-kuifeng@fb.com> X-Mailer: git-send-email 2.30.2 X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: S7aZMiDCEoTIhYB7JO6v1SnIpF-rLZlx X-Proofpoint-GUID: S7aZMiDCEoTIhYB7JO6v1SnIpF-rLZlx Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-09_05,2022-08-09_02,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Allow creating an iterator that loops through resources of one task/thread. People could only create iterators to loop through all resources of files, vma, and tasks in the system, even though they were interested in on= ly the resources of a specific task or process. Passing the addintional parameters, people can now create an iterator to go through all resources or only the resources of a task. Major Changes: - Add new parameters in bpf_iter_link_info to indicate to go through all tasks or to go through a specific task. - Change the implementations of BPF iterators of vma, files, and tasks to allow going through only the resources of a specific task. - Provide the arguments of parameterized task iterators in bpf_link_info. Differences from v3: - Fix the test case bpf_iter/test Differences from v2: - Supports tid, tgid, and pidfd. - Change 'type' from __u8 to enum bpf_task_iter_type. v3: https://lore.kernel.org/bpf/20220809063501.667610-1-kuifeng@fb.com/ v2: https://lore.kernel.org/bpf/20220801232649.2306614-1-kuifeng@fb.com/ v1: https://lore.kernel.org/bpf/20220726051713.840431-1-kuifeng@fb.com/ Kui-Feng Lee (3): bpf: Parameterize task iterators. bpf: Handle bpf_link_info for the parameterized task BPF iterators. selftests/bpf: Test parameterized task BPF iterators. include/linux/bpf.h | 8 + include/uapi/linux/bpf.h | 43 ++++ kernel/bpf/task_iter.c | 153 +++++++++++-- tools/include/uapi/linux/bpf.h | 43 ++++ .../selftests/bpf/prog_tests/bpf_iter.c | 208 ++++++++++++++++-- .../selftests/bpf/prog_tests/btf_dump.c | 2 +- .../selftests/bpf/progs/bpf_iter_task.c | 9 + .../selftests/bpf/progs/bpf_iter_task_file.c | 7 + .../selftests/bpf/progs/bpf_iter_task_vma.c | 6 +- 9 files changed, 430 insertions(+), 49 deletions(-) --=20 2.30.2