From patchwork Wed Dec 7 09:15:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Yejian X-Patchwork-Id: 30724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp76069wrr; Wed, 7 Dec 2022 01:30:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf739TeQ8+Tkgwgdjwf4amN8Qwy2w581K8qjBYUjsKaYE5K7rs8pKIjcDdpMSCZr8tUbx6JR X-Received: by 2002:a62:be01:0:b0:575:caf6:5cd8 with SMTP id l1-20020a62be01000000b00575caf65cd8mr35036361pff.22.1670405441936; Wed, 07 Dec 2022 01:30:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670405441; cv=none; d=google.com; s=arc-20160816; b=kYq6zpdEC4hONBAx22udztGiyatMlwccsARI0OvyBuLul6wSzIqogg9b3BBTbLGGRw LKHc+eC/zuYt8KILLuRhkp5IMIcLbkeJwE8TCkWVCBCD92PhxXX9GeZaWbh2QfYBueif jRwYc5PqQ9zZYiNJkmqkRoG6xEPJYwYy09nSTFSWHR019L7f2NL5el//TDJk73RXzwDk zmIauohPG9l0EfPusXl7f2z37j/4OYXLAyoDJFeUS3QqaZRVnAkW2hIKlRfGsGbsZk0w fKvNdmNSe2O8b+1EsuUPe9qB+AqCKVF33kn3dPICBft7+Km2rYLC92YZ0wiwpWy9D/5A iWEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Vv0qR+YbmwYaDGdL/NziN65+TrmWzeuPp9ZEA/IZSTU=; b=u5Vp6ZLBrxrhqTN3TQM+XZ7FRfn5T6426sGvvCVMt0QC+NBm8gV0yvZKgK65M8F6WI GqfcIBJLuVCGBgnCTvEPMNKnJcOwCyLLU4ICjQqWxRbs3w0QJe0KJOgvGtiImtskQusi flRM0gE/omjcEBiLJ5vkxQK7gmSdpPvPRrC0+9YKn8/0a2VLfJr7l6Ef3PK2EMoC1UxB CPgEuuzCYOgPLrZMy3u+9qSImlTrOI9SYKgBhO4d0GYl0kjE+PUM8PKjP323ovluLrWu fdRKBvusj2ayDytsWXvFCxeebECYiBam3tex2ssXH2S0IP2lmMIB4rXs/+NWb0cyeZ4c pxxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a634546000000b00478f472515asi1248945pgk.771.2022.12.07.01.30.22; Wed, 07 Dec 2022 01:30:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbiLGJQe (ORCPT + 99 others); Wed, 7 Dec 2022 04:16:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbiLGJP6 (ORCPT ); Wed, 7 Dec 2022 04:15:58 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA29331EC6; Wed, 7 Dec 2022 01:15:09 -0800 (PST) Received: from dggpeml100012.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NRs6f6tVgz15MwZ; Wed, 7 Dec 2022 17:14:18 +0800 (CST) Received: from localhost.localdomain (10.67.175.61) by dggpeml100012.china.huawei.com (7.185.36.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Dec 2022 17:15:07 +0800 From: Zheng Yejian To: , , CC: , , Subject: [PATCH] tracing: Fix issue of missing one synthetic field Date: Wed, 7 Dec 2022 17:15:57 +0800 Message-ID: <20221207091557.3137904-1-zhengyejian1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.67.175.61] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100012.china.huawei.com (7.185.36.121) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751547056670526170?= X-GMAIL-MSGID: =?utf-8?q?1751547056670526170?= The maximum number of synthetic fields supported is defined as SYNTH_FIELDS_MAX which value currently is 64, but it actually fails when try to generate a synthetic event with 64 fields by executing like: # echo "my_synth_event int v1; int v2; int v3; int v4; int v5; int v6;\ int v7; int v8; int v9; int v10; int v11; int v12; int v13; int v14;\ int v15; int v16; int v17; int v18; int v19; int v20; int v21; int v22;\ int v23; int v24; int v25; int v26; int v27; int v28; int v29; int v30;\ int v31; int v32; int v33; int v34; int v35; int v36; int v37; int v38;\ int v39; int v40; int v41; int v42; int v43; int v44; int v45; int v46;\ int v47; int v48; int v49; int v50; int v51; int v52; int v53; int v54;\ int v55; int v56; int v57; int v58; int v59; int v60; int v61; int v62;\ int v63; int v64" >> /sys/kernel/tracing/synthetic_events Correct the field counting to fix it. Fixes: c9e759b1e845 ("tracing: Rework synthetic event command parsing") Signed-off-by: Zheng Yejian --- kernel/trace/trace_events_synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index c3b582d19b62..67592eed0be8 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -1282,12 +1282,12 @@ static int __create_synth_event(const char *name, const char *raw_fields) goto err_free_arg; } - fields[n_fields++] = field; if (n_fields == SYNTH_FIELDS_MAX) { synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0); ret = -EINVAL; goto err_free_arg; } + fields[n_fields++] = field; n_fields_this_loop++; }