From patchwork Sat Dec 4 09:52:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12656433 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AA0CC433EF for ; Sat, 4 Dec 2021 09:55:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E49A66B0083; Sat, 4 Dec 2021 04:53:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF9236B0085; Sat, 4 Dec 2021 04:53:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9AD56B0087; Sat, 4 Dec 2021 04:53:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id BC7556B0083 for ; Sat, 4 Dec 2021 04:53:23 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 894168249980 for ; Sat, 4 Dec 2021 09:53:13 +0000 (UTC) X-FDA: 78879648666.10.2FCC679 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf20.hostedemail.com (Postfix) with ESMTP id 40A70D0000A7 for ; Sat, 4 Dec 2021 09:53:13 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id x5so5349634pfr.0 for ; Sat, 04 Dec 2021 01:53:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jc/1UqX6dBziNJTgW2IO/F7rtsTi2nR5UyyzWa0yaTY=; b=OPS6Tq0grzniAtkhVxBUnYGlNHe2LHenEl9GBTJUtoQpFmZ4NpGLdXZjKUgC7IZqdL ZKWU9aSUkUqHoSXlb9199RCCbprlEwAz/eREA8MLQnnkIgsEEY3qPvF/NMesCapvpCTL CDJI0dUFjTdXdtPWz0FFQdAtRz26RuQoiQvkBRzKFySMAH48+WOoxFj1q+RcM1mq8PJA 4HpF89d8G613VAWp+7lBQWZzOShQCn6ZJ9mRR7ESbX0eCDt7rNkgILW7w1PQEFJhi3gT yF3ugmTHCdttEto30CCqoAPVMIpMK7h+XNAJYJWgzLuqIe2i7V6I3L23Amzdh+sY9Pc8 tOmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jc/1UqX6dBziNJTgW2IO/F7rtsTi2nR5UyyzWa0yaTY=; b=DIVP5gxxxxFzIQkCt2ZJIGHgAYMaPJHvtB71zGyld2bzlv/j+L5sNSHccZYhn/XRnQ TE5h/mT++WQlC9fBqB7u6Ls/S+IAnCV80wol5V1MF10fDFAwOZNXLBJxTm9Wbc097LVO OJRwAYYtTb5UilVOoDDl8ayIubRuiqSSSCJElKL0Vc38jMSYqfKl8CmwYwh+2tGe8sgQ 5qP9ygWcmV19hSgbgiMUW/fpzHtKEdCGTn4OIQi6sAp5PHeZMSyUFYq6sp4PUYWm1xud 1/aX7nOrV/P2/GAOitoWyrxdha2ISG3f4QuUMi2uPfoswIiPvyy2WPoAim6LX4gW37Al mpEQ== X-Gm-Message-State: AOAM532xhxq0tl+tnsjMqNJxQBskdKc3ol4PtdloXEOeGkWeEJYNzWUX IrPGEHfSy6KFYipegRc/PjU= X-Google-Smtp-Source: ABdhPJxOtpMKrYAZBUYRY5WFF9PUZ3+zcvLt12isc0/o9+IZvyummoBi6CX2Z881q/Ptmt968HlHTw== X-Received: by 2002:a63:1107:: with SMTP id g7mr8918770pgl.108.1638611592149; Sat, 04 Dec 2021 01:53:12 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id ms15sm4343198pjb.26.2021.12.04.01.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 01:53:11 -0800 (PST) From: Yafang Shao To: akpm@linux-foundation.org, rostedt@goodmis.org, keescook@chromium.org, pmladek@suse.com, david@redhat.com, arnaldo.melo@gmail.com, andrii.nakryiko@gmail.com Cc: linux-mm@kvack.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao , Mathieu Desnoyers , Alexei Starovoitov , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm 4/5] tools/perf: replace hard-coded 16 with TASK_COMM_LEN Date: Sat, 4 Dec 2021 09:52:55 +0000 Message-Id: <20211204095256.78042-5-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211204095256.78042-1-laoar.shao@gmail.com> References: <20211204095256.78042-1-laoar.shao@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 40A70D0000A7 X-Stat-Signature: kn8sji6snfujnm6x6iue8735yab5a5rp Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OPS6Tq0g; spf=pass (imf20.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1638611593-831296 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: evsel-tp-sched will verify the task comm len in sched:sched_switch and sched:sched_wakeup tracepoints. The len must be same with TASK_COMM_LEN defined in linux/sched.h. In order to make it grepable, we'd better replace the hard-coded 16 with TASK_COMM_LEN. Signed-off-by: Yafang Shao Cc: Mathieu Desnoyers Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Michal Miroslaw Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Matthew Wilcox Cc: David Hildenbrand Cc: Al Viro Cc: Kees Cook Cc: Petr Mladek --- tools/perf/tests/evsel-tp-sched.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c index cf4da3d748c2..83e0ce2e676f 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c @@ -5,6 +5,8 @@ #include "tests.h" #include "debug.h" +#define TASK_COMM_LEN 16 + static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed) { struct tep_format_field *field = evsel__field(evsel, name); @@ -43,7 +45,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse return -1; } - if (evsel__test_field(evsel, "prev_comm", 16, false)) + if (evsel__test_field(evsel, "prev_comm", TASK_COMM_LEN, false)) ret = -1; if (evsel__test_field(evsel, "prev_pid", 4, true)) @@ -55,7 +57,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse if (evsel__test_field(evsel, "prev_state", sizeof(long), true)) ret = -1; - if (evsel__test_field(evsel, "next_comm", 16, false)) + if (evsel__test_field(evsel, "next_comm", TASK_COMM_LEN, false)) ret = -1; if (evsel__test_field(evsel, "next_pid", 4, true)) @@ -73,7 +75,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse return -1; } - if (evsel__test_field(evsel, "comm", 16, false)) + if (evsel__test_field(evsel, "comm", TASK_COMM_LEN, false)) ret = -1; if (evsel__test_field(evsel, "pid", 4, true))