Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp860228ybt; Fri, 26 Jun 2020 13:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhhENuhKAEaUUBqKMRSIF/vNWgjF/vmNM4Kr21dlqMVw6laW9Kfsy5jgVK775Ilad71SeR X-Received: by 2002:a50:a68f:: with SMTP id e15mr5308928edc.285.1593202924464; Fri, 26 Jun 2020 13:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593202924; cv=none; d=google.com; s=arc-20160816; b=PJw2RNQg1ExO9G3uXC+zNsKW/SriAfhAkl3OoGnR78TFMT2oq9Os3+fKPDF/ajM6oG wUDGSoalFQuTs3gnZ20QxHco/A1yHg7MbUHEwNX4drnFPjc3Wa+gtP646W6tO9meNJ01 4HfAfPSXr8UIZKtIrBn85CzHjedx7U4ZXvj0YHxq5s8/xDnmoUF171eNqhP+CWitxV6V Bl1/SKIJas0nnGd7pWnXdKwDMUpKTS1pDUk/T8RfjnqF8Nw7PqSJdFChvOi9qyIFTJ0H wBe39hfhrcYrKxoyfgPYFdLJuuWstgN+3h5Tqvm8KQwMhvaS6LdUpIFz971ooet8mUZ1 2oIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XSfjPIdCIsSUipm7ILrWBk5ID/BPDxK2vNHFKOdu/U4=; b=LESMlEabO5q5WECXdYt1Gzs4wKJbHp6Qr05BfkJ/sLSyFIrzcZUD41MTHwZJYima+3 mzZzfSvgLxlKe7BG6mT2g34EEa9+4gCclVx1cfyTARszbO37BOXwx8xxwyvV2nzC0eC6 KE/VBFd7MXrX8PuFg4qc5TcHZNHGVRge4KGMpfrTaRUyCu99HNe9vaKMWcQwq5bo/jpe ogxVcUmjzOyJGkNrYQ2jEfjc4TzZd+sPVgFzDrkn5gopyL0b2q7jvsBNF8+XVCvUlP9Y rHxy1yeGBQzhhS57xo+fJbBJjrM0G6KCjU/Pfp6KLcZTwGFIw+Ass+TucsN1ZB51SljK vtuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lSaPK0+J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk25si7264690edb.28.2020.06.26.13.21.41; Fri, 26 Jun 2020 13:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lSaPK0+J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725907AbgFZUVP (ORCPT + 99 others); Fri, 26 Jun 2020 16:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725780AbgFZUVO (ORCPT ); Fri, 26 Jun 2020 16:21:14 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE183C03E979; Fri, 26 Jun 2020 13:21:14 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id di5so141450qvb.11; Fri, 26 Jun 2020 13:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XSfjPIdCIsSUipm7ILrWBk5ID/BPDxK2vNHFKOdu/U4=; b=lSaPK0+JPLyNdjeg44ZWhL5Sd5hWJy4APwBYm0qOhXZECdCcn4WbFgb8s3yDnw5/Fx iX1yc0vAALFXrPmBqCcFTmzr5mi7unSMyHRrYwAj3Cn12HlX5+BgjPFRqrCYK0S0Y8cD BrMztWqqLWfFtCT7Juy0sHsBdEj3d9UXLnnP+Qq/mp6h/8CYS6hzuz7QIi28sp9Eok/n qoHQyb4S8TBuvE7r1HT7lE1QpiK3S6iIoFeyD6Z6zb4s8RKiw8vUdEoxFfrN3Bc7dboN AFihQiXXTOlXXJHBmG1MbuSk4aIY/EM8v9imoRa9RDXIfWj5NWyd8YrutRXzuryKDCDR Nbhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XSfjPIdCIsSUipm7ILrWBk5ID/BPDxK2vNHFKOdu/U4=; b=NlJs8bf1qydGrdFXoxLitllEkMReXJnPWDds6vu0C13gxZojmhdJH/+Gpr6nft/WJ4 Yb15B7hHmA2SUIgkvtQWNJkyfqCFQkcGHK6xPdjCv7YHOPGEXBwzw7tBr8O0W3XoQ2jO oezyZp2HC3HYadbCYDCSiUT3S/zrct1dRrTfO8rvjhpX4oOqZro7lH8trOEqaqJyWHjd KWnKpqMJFjB+/PAdkzIR0GEQ91zokLzPisC4iT01nW6jF6RI9OtbH/ScPbQl2Cg6fkju d59uLjwubMZ6RhXSi6G9900s9HJ0csMAUcDzIxY7IkKQ2eo1LRujKYCKrxVbrD+JKman C6WA== X-Gm-Message-State: AOAM531xsGeRYgAZbmYgPUjqzXbuq3RWav8A90zyZoj5VWcsZxEoOj0H 60O0f/aX9fXNQYCA1DXsu37+xLSPOW3xKQ7y5VI= X-Received: by 2002:a0c:f388:: with SMTP id i8mr4888184qvk.224.1593202874252; Fri, 26 Jun 2020 13:21:14 -0700 (PDT) MIME-Version: 1.0 References: <20200626001332.1554603-1-songliubraving@fb.com> <20200626001332.1554603-5-songliubraving@fb.com> In-Reply-To: <20200626001332.1554603-5-songliubraving@fb.com> From: Andrii Nakryiko Date: Fri, 26 Jun 2020 13:21:03 -0700 Message-ID: Subject: Re: [PATCH v2 bpf-next 4/4] selftests/bpf: add bpf_iter test with bpf_get_task_stack() To: Song Liu Cc: bpf , Networking , open list , Peter Ziljstra , Alexei Starovoitov , Daniel Borkmann , Kernel Team , john fastabend , KP Singh Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 25, 2020 at 5:15 PM Song Liu wrote: > > The new test is similar to other bpf_iter tests. > > Signed-off-by: Song Liu > --- > .../selftests/bpf/prog_tests/bpf_iter.c | 17 ++++++ > .../selftests/bpf/progs/bpf_iter_task_stack.c | 60 +++++++++++++++++++ > 2 files changed, 77 insertions(+) > create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c > > diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c > index 87c29dde1cf96..baa83328f810d 100644 > --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c > +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c > @@ -5,6 +5,7 @@ > #include "bpf_iter_netlink.skel.h" > #include "bpf_iter_bpf_map.skel.h" > #include "bpf_iter_task.skel.h" > +#include "bpf_iter_task_stack.skel.h" > #include "bpf_iter_task_file.skel.h" > #include "bpf_iter_test_kern1.skel.h" > #include "bpf_iter_test_kern2.skel.h" > @@ -106,6 +107,20 @@ static void test_task(void) > bpf_iter_task__destroy(skel); > } > > +static void test_task_stack(void) > +{ > + struct bpf_iter_task_stack *skel; > + > + skel = bpf_iter_task_stack__open_and_load(); > + if (CHECK(!skel, "bpf_iter_task_stack__open_and_load", > + "skeleton open_and_load failed\n")) > + return; > + > + do_dummy_read(skel->progs.dump_task_stack); > + > + bpf_iter_task_stack__destroy(skel); > +} > + > static void test_task_file(void) > { > struct bpf_iter_task_file *skel; > @@ -392,6 +407,8 @@ void test_bpf_iter(void) > test_bpf_map(); > if (test__start_subtest("task")) > test_task(); > + if (test__start_subtest("task_stack")) > + test_task_stack(); > if (test__start_subtest("task_file")) > test_task_file(); > if (test__start_subtest("anon")) > diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c b/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c > new file mode 100644 > index 0000000000000..83aca5b1a7965 > --- /dev/null > +++ b/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c > @@ -0,0 +1,60 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* Copyright (c) 2020 Facebook */ > +/* "undefine" structs in vmlinux.h, because we "override" them below */ > +#define bpf_iter_meta bpf_iter_meta___not_used > +#define bpf_iter__task bpf_iter__task___not_used > +#include "vmlinux.h" > +#undef bpf_iter_meta > +#undef bpf_iter__task > +#include > +#include > + > +char _license[] SEC("license") = "GPL"; > + > +/* bpf_get_task_stack needs a stackmap to work */ no it doesn't anymore :) please drop [...]