From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yonghong Song Subject: Re: [PATCH bpf-next v3 9/9] tools/bpf: add a test for bpf_get_stack with tracepoint prog Date: Sun, 22 Apr 2018 19:58:14 -0700 Message-ID: References: <20180420221842.742330-1-yhs@fb.com> <20180420221842.742330-10-yhs@fb.com> <20180423002732.6fw45mevsz3bixkq@ast-mbp> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , , To: Alexei Starovoitov Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:41796 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753848AbeDWC6q (ORCPT ); Sun, 22 Apr 2018 22:58:46 -0400 In-Reply-To: <20180423002732.6fw45mevsz3bixkq@ast-mbp> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 4/22/18 5:27 PM, Alexei Starovoitov wrote: > On Fri, Apr 20, 2018 at 03:18:42PM -0700, Yonghong Song wrote: >> The test_stacktrace_map and test_stacktrace_build_id are >> enhanced to call bpf_get_stack in the helper to get the >> stack trace as well. The stack traces from bpf_get_stack >> and bpf_get_stackid are compared to ensure that for the >> same stack as represented as the same hash, their ip addresses >> or build id's must be the same. >> >> Signed-off-by: Yonghong Song >> --- >> tools/testing/selftests/bpf/test_progs.c | 63 +++++++++++++++++++--- >> .../selftests/bpf/test_stacktrace_build_id.c | 20 ++++++- >> tools/testing/selftests/bpf/test_stacktrace_map.c | 20 +++++-- >> 3 files changed, 92 insertions(+), 11 deletions(-) >> >> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c >> index dad4c3f..06b922a 100644 >> --- a/tools/testing/selftests/bpf/test_progs.c >> +++ b/tools/testing/selftests/bpf/test_progs.c >> @@ -897,11 +897,40 @@ static int compare_map_keys(int map1_fd, int map2_fd) >> return 0; >> } >> >> +static int compare_stack_ips(int smap_fd, int amap_fd, int stack_trace_len) >> +{ >> + __u32 key, next_key, *cur_key_p, *next_key_p; >> + char val_buf1[stack_trace_len], val_buf2[stack_trace_len]; > > the kernel is trying to get rid of VLAs. > test_progs.c already uses them, but if possible let's not > add more uses of them. okay, try to get rid of these two VLAs. > Other than that looks great.