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 X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CD2EC433DF for ; Mon, 27 Jul 2020 23:22:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF95E20809 for ; Mon, 27 Jul 2020 23:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595892176; bh=neoNg6aLQ3HBDoqH28Cszm2AXNEiQWXsFwXzUporDEM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=RUQN+t0ThRH/3VkoWMO5jhH7LR5qTpoLHhsq9xFLJwhpl20CNelvZ+5sessUjLN/M YM6Y64a7pMyhXEChte+VYimlExGPUwkErBvO6pPPXWADUQ8c59nLyukFEkLPfuO00G GwdFmhTVNfsqi/j+LYv6ojftxFXkO9qQSty4/Rso= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbgG0XWz (ORCPT ); Mon, 27 Jul 2020 19:22:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:34530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbgG0XWz (ORCPT ); Mon, 27 Jul 2020 19:22:55 -0400 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B1A620829; Mon, 27 Jul 2020 23:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595892174; bh=neoNg6aLQ3HBDoqH28Cszm2AXNEiQWXsFwXzUporDEM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Y6xQ8wsvSS35bRQL73cQDAEPsEPublmmN5RrkIDlmbLWe927WJRRJFzV9cFZHFiOR FtZN+cJDERVKH6+vJh/pkHuiqZShBS+3qv4U4hc2NfztikDojTI5Yb61biZW1a+8f+ tZJcrVj13SPIScw2KBSsJ65yWzMt20qk1SKjNyT0= Received: by mail-lf1-f46.google.com with SMTP id j22so4050011lfm.2; Mon, 27 Jul 2020 16:22:54 -0700 (PDT) X-Gm-Message-State: AOAM530npxPyAB+oCx30SBWIQ2kWLZGlIv6TdAjt5tHb24/afFla30On DVbX2XErNYchNMGIs/PuWWzp9vj4PvLVNzLxVTM= X-Google-Smtp-Source: ABdhPJzoxs9usbDOXkjthb2o1ZCQeNkWmZgUCB99ykeGoSRvwa2URDSjP5m7ksMZEcNn4UUFDAiH2hDeeAE2VPLb51w= X-Received: by 2002:a19:ec12:: with SMTP id b18mr12888686lfa.52.1595892172835; Mon, 27 Jul 2020 16:22:52 -0700 (PDT) MIME-Version: 1.0 References: <20200727231445.1227594-1-andriin@fb.com> <20200727231445.1227594-2-andriin@fb.com> In-Reply-To: <20200727231445.1227594-2-andriin@fb.com> From: Song Liu Date: Mon, 27 Jul 2020 16:22:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 bpf 2/2] selftests/bpf: extend map-in-map selftest to detect memory leaks To: Andrii Nakryiko Cc: bpf , Networking , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Kernel Team , Song Liu , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, Jul 27, 2020 at 4:15 PM Andrii Nakryiko wrote: > > Add test validating that all inner maps are released properly after skeleton > is destroyed. To ensure determinism, trigger kernel-side synchronize_rcu() > before checking map existence by their IDs. > > Signed-off-by: Andrii Nakryiko Acked-by: Song Liu With a couple nit below. > --- > .../selftests/bpf/prog_tests/btf_map_in_map.c | 121 ++++++++++++++++-- > 1 file changed, 108 insertions(+), 13 deletions(-) > > diff --git a/tools/testing/selftests/bpf/prog_tests/btf_map_in_map.c b/tools/testing/selftests/bpf/prog_tests/btf_map_in_map.c > index f7ee8fa377ad..c06b61235212 100644 > --- a/tools/testing/selftests/bpf/prog_tests/btf_map_in_map.c > +++ b/tools/testing/selftests/bpf/prog_tests/btf_map_in_map.c > @@ -5,10 +5,59 @@ > > #include "test_btf_map_in_map.skel.h" > > +static int duration; > + > +__u32 bpf_map_id(struct bpf_map *map) Make the function static? [...] > +int kern_sync_rcu() { static int kern_sync_rcu(void) { checkpatch.pl should complain here. Thanks, Song [...]