Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1104110pxb; Tue, 19 Oct 2021 21:07:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGOXIc3JYjWQXj2K/+Bdv1C9Xk3SnS/QPyF86LvCfXFVvnecT2YeFwbFmTJmY+27V6QJ2/ X-Received: by 2002:a17:90a:4a82:: with SMTP id f2mr4609888pjh.236.1634702861591; Tue, 19 Oct 2021 21:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634702861; cv=none; d=google.com; s=arc-20160816; b=qOcQ0OhlYIP7vfEChy6V8Y0Wfg4Jc807KG6iwAoo2RcJ6shaOdeBXnfpwgubsNqeTM VWHPcfjhjvQDULPwAZOGLFTvCGHojszt7xUDdKX5ZsQ4vzLZLf+n5tPj6jTDUTL736b1 LvhTkbP7dOykeBe+iPVocbs6EqmsMNSjdGUAbHAC9SL8Nn+ghKIYrlAbIwgjbX+VacMT hYsQd0NQftb5Shu0FvW6e0hgsA4o7MccmaMBSp51sLudOs43FstZ6SKTI0nugVco/VPu BVisqejOxfoHXuGC4Gj52Wk5e+CBp3uhNfXlutXaMrU1l8rDI8HN6jL36thmPD8T42+p wbtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4KJFEwUorje8FLlb79ZL0ZwvURLI9xbnmI43eZiaFn0=; b=BCSz7VgpCjfsFSYIzeFcn2CkEqKzm2zAc9js9Wf64N6nsg2ci+jZi8r9d44Husp2U6 WKsQlkzOt9j7TInlls0SxEcM3mxniPILTZMAYib3KYSuG1zOkdOFJr6kxE/tPKyLrpJ9 3DovQ/jssxUTObp4/NGZ1jBUqi5MRketC/CsPYtl6Q8JxShAVHjK1capBhYOxxUj9s+z o4Xuirw6lR1Y0kFlbKwFa+0jMix+xkfjNRwd4u149dcflVUHQAWTHBFDdmdtc/YEj+Cg 0jEl+UinsuSke5n1g4Vdmgrm+SbUIFWfuRfGCVyuSepn3UJWWl0Ej/tgP4mjMqomK96H xFZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AZ7JocdZ; 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 i8si1357464pgl.430.2021.10.19.21.07.26; Tue, 19 Oct 2021 21:07:41 -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=20210112 header.b=AZ7JocdZ; 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 S229822AbhJTEEg (ORCPT + 99 others); Wed, 20 Oct 2021 00:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbhJTEEe (ORCPT ); Wed, 20 Oct 2021 00:04:34 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 503CBC06161C for ; Tue, 19 Oct 2021 21:02:20 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id a8so20618786ilj.10 for ; Tue, 19 Oct 2021 21:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4KJFEwUorje8FLlb79ZL0ZwvURLI9xbnmI43eZiaFn0=; b=AZ7JocdZbxuhbdylEeL4UeSgGfjXq4HkaE6umxJREGHLJZL15imK/PSGAD0hpfmYnX ouCiEAD9wpaQ8Dw55x1J4IF+/C1jUpJroX4jIPH9w4bjr3W1JNb84zsVt56TqLI+G54K PPDwA5DMAJKOdAlh1hLouo3g4zGdNjsHQbmBH2ooYTyzH0fdElPY8IOXei2N6B6Tnahh OcCWJjnVy+PANTWMJ98O2xM/wA2IWpnGqydb1DIViG04E6gpWCRZdPJen2SaAAy0WAww Lw/BFVT3QbaK0lAHs4Xngfi4Pt/kUCxC5fktOHDXcRDJG5PlzzbywX7UKCrcGK+71LlL xxEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4KJFEwUorje8FLlb79ZL0ZwvURLI9xbnmI43eZiaFn0=; b=gjUgKynP/7APg7xra8s9cvJ71okWrMu0DrTxZqXFuHXJ2r34DpvJMhkgX5uSw5XqjP OzHVz/pbFkAMq/QVboIjm2p6csDVyGakWgIHDrX8cqMN33CYPD+Xwexo4X8fXHI1a1/P Xn7G3EQHNBu749Bl0aXVz7yqOBycPvuzbebm3wsj5CTOMGAgDje4gSxkYR+Z/nx7qo2S j5S0Z7ux0qYlCmOXcwx+8St3qsjo4IBUXOVv6Onm+cFdWQSW6nAvJJ0lE0xBLN/MvD9s 8GVVLR05EnfdWW6E2OIj1WxfCF+CaS1P6IdQ7xWpJoEwDDemNfDtpnoChYbclT6IMfEi rRKg== X-Gm-Message-State: AOAM531UwOjMM7TqffqJ2sSBDR32X1iKKZNkLDHfaJunOjPXswE0NGPr cKv96NjHx0eRKYjD/8nYbRTOipSFIghCgXuZx31fIGqV X-Received: by 2002:a05:6e02:12e4:: with SMTP id l4mr13804876iln.25.1634702539054; Tue, 19 Oct 2021 21:02:19 -0700 (PDT) MIME-Version: 1.0 References: <20211010102429.99577-4-laoar.shao@gmail.com> <20211014072707.GA18719@xsang-OptiPlex-9020> <1529739526.13983.1634215325995.JavaMail.zimbra@efficios.com> In-Reply-To: From: Yafang Shao Date: Wed, 20 Oct 2021 12:01:43 +0800 Message-ID: Subject: Re: [sched.h] 317419b91e: perf-sanity-tests.Parse_sched_tracepoints_fields.fail To: Arnaldo Carvalho de Melo Cc: Mathieu Desnoyers , rostedt , kernel test robot , 0day robot , Petr Mladek , Kees Cook , Peter Zijlstra , Alexander Viro , linux-kernel , lkp , Andrew Morton , Valentin Schneider , Qiang Zhang , robdclark , christian , Dietmar Eggemann , Ingo Molnar , Juri Lelli , Vincent Guittot , Ben Segall , Mel Gorman , bristot , aubrey li , yu c chen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 12:51 AM Arnaldo Carvalho de Melo wrote: > > Em Thu, Oct 14, 2021 at 08:42:05AM -0400, Mathieu Desnoyers escreveu: > > ----- On Oct 14, 2021, at 5:24 AM, Yafang Shao laoar.shao@gmail.com wrote: > > > On Thu, Oct 14, 2021 at 3:08 PM kernel test robot wrote: > > > That issue is caused by another hardcode 16 ... > > > > Seems we should make some change as below, > > > > diff --git a/tools/perf/tests/evsel-tp-sched.c > > > b/tools/perf/tests/evsel-tp-sched.c > > > index f9e34bd26cf3..401a737b1d85 100644 > > > --- a/tools/perf/tests/evsel-tp-sched.c > > > +++ b/tools/perf/tests/evsel-tp-sched.c > > > @@ -42,7 +42,7 @@ int test__perf_evsel__tp_sched_test(struct test > > > *test __maybe_unused, int subtes > > > return -1; > > > } > > > > - if (evsel__test_field(evsel, "prev_comm", 16, false)) > > > + if (evsel__test_field(evsel, "prev_comm", TASK_COMM_LEN, false)) > > > > tools/perf/tests/* contains userspace test programs. This means it gets the > > TASK_COMM_LEN from the uapi. The fix you propose won't do any good here. > > That specific test is just checking if the parsing is being done as > expected, i.e. we know beforehand that COMMs have 16 bytes, so the test > expects that. > Right. > Now that it can have a different size, then the test should accept the > two sizes as possible and pass if it is 16 or 24. > > Like in this patch: > Thanks for the suggestion. I will do it as you suggested. > diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c > index f9e34bd26cf33536..182328f3f7f70e0e 100644 > --- a/tools/perf/tests/evsel-tp-sched.c > +++ b/tools/perf/tests/evsel-tp-sched.c > @@ -5,7 +5,7 @@ > #include "tests.h" > #include "debug.h" > > -static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed) > +static int evsel__test_field_alt(struct evsel *evsel, const char *name, int size, int alternate_size, bool should_be_signed) > { > struct tep_format_field *field = evsel__field(evsel, name); > int is_signed; > @@ -23,15 +23,23 @@ static int evsel__test_field(struct evsel *evsel, const char *name, int size, bo > ret = -1; > } > > - if (field->size != size) { > - pr_debug("%s: \"%s\" size (%d) should be %d!\n", > + if (field->size != size && field->size != alternate_size) { > + pr_debug("%s: \"%s\" size (%d) should be %d", > evsel->name, name, field->size, size); > + if (alternate_size > 0) > + pr_debug(" or %d", alternate_size); > + pr_debug("!\n"); > ret = -1; > } > > return ret; > } > > +static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed) > +{ > + return evsel__test_field_alt(evsel, name, size, -1, should_be_signed); > +} > + > int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused) > { > struct evsel *evsel = evsel__newtp("sched", "sched_switch"); > @@ -42,7 +50,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes > return -1; > } > > - if (evsel__test_field(evsel, "prev_comm", 16, false)) > + if (evsel__test_field_alt(evsel, "prev_comm", 16, 24, false)) > ret = -1; > > if (evsel__test_field(evsel, "prev_pid", 4, true)) > @@ -54,7 +62,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes > 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_alt(evsel, "next_comm", 16, 24, false)) > ret = -1; > > if (evsel__test_field(evsel, "next_pid", 4, true)) > @@ -72,7 +80,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes > return -1; > } > > - if (evsel__test_field(evsel, "comm", 16, false)) > + if (evsel__test_field_alt(evsel, "comm", 16, 24, false)) > ret = -1; > > if (evsel__test_field(evsel, "pid", 4, true)) -- Thanks Yafang