Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1724303pxa; Sun, 2 Aug 2020 18:47:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf/wy0PBg8odzmFXnZyjB2naf3w7WH9s5Js/bJ+fMAsYwRV3xkRD4E3wgNkp8TT5svodw1 X-Received: by 2002:a17:906:2b8e:: with SMTP id m14mr9206653ejg.249.1596419279236; Sun, 02 Aug 2020 18:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596419279; cv=none; d=google.com; s=arc-20160816; b=bQ1PwZ16v/plPH5CRYq+xCxgw0Ji2daSEaetgDWUByOho9FaeD+L09o/bsSFxuGkgf 9zqC4dYuo+5STn2tggB/C691cX3NhYQQnP+bkx+xJolDUaaF2bZusDu/eC8mdUSyf5kQ S1Zme0RmI0Ul4aZuUCxacKh3Z+i1S4Cb5Kw5glFJI9cJAXp1iozSlf9m7ibceEjqIlv6 I7pdfhfduEPBhHvUkRFiClo9NeTdoDJrK1q1/206EFWRtJz3IEKgwyHeZFaG/PEgUoaK 85Zm0PzRMCPLCP0PL4mxQ6JXLAkJGCMjrsxF1Kw2T7FbX0/lQM6QIHEWjDS8LDSUQFBH LmYQ== 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=qer4CX4K+qk3GBRMjwRPQATSWlfpwQSXhVzzAfNbeKA=; b=dY7wPkH20KFUPKhNcmu0SY65v68OMlEPLqOSKPjfDT4Thu3asedCZLSDGAEhk5R844 a8tfskdBtt+FxV5WL6qxJAumzsVH04FmGxKlawLNEUqN5rO02JHz+KQk62L1neDLvOZJ t0VvbUEAXV+sIZEXdrD54dDaJx3zGvfd7Xfd1CUIUER9Hn+vdVSXXSPJaBzAs3zlrCCo ClNCBhfymUXYJZOk5eBGBTUlGfMUFkUMgo44yOA+1L11VQE/ORXT98R8/1TTtkjEO7Cm 5PnhWNiLPxnXJqck0FMfZrzgmw5Ayc59pvv1+FRmMYa/iaJCd1NmhbZIgwqAA9SQ1Alb xQnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F1AHwahp; 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 cq22si8324911edb.609.2020.08.02.18.47.36; Sun, 02 Aug 2020 18:47:59 -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=F1AHwahp; 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 S1726981AbgHCBqt (ORCPT + 99 others); Sun, 2 Aug 2020 21:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgHCBqs (ORCPT ); Sun, 2 Aug 2020 21:46:48 -0400 Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E443C06174A; Sun, 2 Aug 2020 18:46:48 -0700 (PDT) Received: by mail-yb1-xb42.google.com with SMTP id u43so6092877ybi.11; Sun, 02 Aug 2020 18:46:48 -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=qer4CX4K+qk3GBRMjwRPQATSWlfpwQSXhVzzAfNbeKA=; b=F1AHwahpFGW+JUEX+4SLncBP19BJ7rQqD8J/ngnfqCa/YZX09RhiPHn2Ku+wzd6glf dPn8hrVUf7sn/eo0dtMA3OMBKJssAx17BlgNNjiBEGkTI2bRPxRLkwBe9VR/BWDx03n0 I70+ynZj8Il5jxs1+o0nAI0SDlgF0TLlEjpew20KgxDaYc1MTixpHvgdfxuyGBpNQEXI xeJ4P7vadbbfAsatA333HeFHJ7MYI/GCblU98qBRJlVsSuD4+8vSbY7PMfTxPwIkUMjV 7LYrVQPZE7jC0OjgezMWeMQhNGXslVGHcgkX4xc3lPr+87AmLAAnc+bep845ptdQfGuW b+nA== 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=qer4CX4K+qk3GBRMjwRPQATSWlfpwQSXhVzzAfNbeKA=; b=HhwUWLr16B4AbS9VGCEKPhbBic17SF2cw2iI0EyS1kwyMUjPDWdKswC8ZIgPgdgC4B lW3QnGwSB+8nKFGvPZhUceKAm11BdWEENG9x2XboQoUlTJ3zBdo7YY6nxzEyrrXcp4Wo JX4TvFIuMAGVPBhAUDsxRcMx+1hh22tDkpbQb++CTAwifPTElU9vTeTj5t/K3XCH6YCC yQNz93sq8EMqCskzkLJpQ/RX/o3ZdTMDM8/QBom4I1mlG/jxusshpvEcQBNj9HKTlgPE zIQI9vtEQHq0eXVTxD/IH0SQc+93iexlaheYz3zetlqRK49u7g7Fc18l4SZxQDJm9LE6 mALA== X-Gm-Message-State: AOAM5304TyN4lZ2cZB6DR91HD766g4/670qG4M57HvUKleh45kWf9UZw 5/S4qS01OoqLRlgOoYKexZU9wVGJfMO1TJCjc/Q= X-Received: by 2002:a25:37c8:: with SMTP id e191mr20859632yba.230.1596419207784; Sun, 02 Aug 2020 18:46:47 -0700 (PDT) MIME-Version: 1.0 References: <20200801084721.1812607-1-songliubraving@fb.com> <20200801084721.1812607-5-songliubraving@fb.com> In-Reply-To: <20200801084721.1812607-5-songliubraving@fb.com> From: Andrii Nakryiko Date: Sun, 2 Aug 2020 18:46:37 -0700 Message-ID: Subject: Re: [PATCH bpf-next 4/5] selftests/bpf: move two functions to test_progs.c To: Song Liu Cc: open list , bpf , Networking , Alexei Starovoitov , Daniel Borkmann , Kernel Team , john fastabend , KP Singh , Jesper Dangaard Brouer , Daniel Xu 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 Sat, Aug 1, 2020 at 1:50 AM Song Liu wrote: > > Move time_get_ns() and get_base_addr() to test_progs.c, so they can be > used in other tests. > > Signed-off-by: Song Liu > --- > .../selftests/bpf/prog_tests/attach_probe.c | 21 ------------- > .../selftests/bpf/prog_tests/test_overhead.c | 8 ----- > tools/testing/selftests/bpf/test_progs.c | 30 +++++++++++++++++++ > tools/testing/selftests/bpf/test_progs.h | 2 ++ > 4 files changed, 32 insertions(+), 29 deletions(-) > [...] > static int test_task_rename(const char *prog) > { > int i, fd, duration = 0, err; > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c > index b1e4dadacd9b4..c9e6a5ad5b9a4 100644 > --- a/tools/testing/selftests/bpf/test_progs.c > +++ b/tools/testing/selftests/bpf/test_progs.c > @@ -622,6 +622,36 @@ int cd_flavor_subdir(const char *exec_name) > return chdir(flavor); > } > > +__u64 time_get_ns(void) > +{ I'd try to avoid adding stuff to test_progs.c. There is generic testing_helpers.c, maybe let's put this there? > + struct timespec ts; > + > + clock_gettime(CLOCK_MONOTONIC, &ts); > + return ts.tv_sec * 1000000000ull + ts.tv_nsec; > +} > + > +ssize_t get_base_addr(void) > +{ This would definitely be better in trace_helpers.c, though. > + size_t start, offset; > + char buf[256]; > + FILE *f; > + [...]