From patchwork Tue Dec 18 20:36:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10736263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DC0E13BF for ; Tue, 18 Dec 2018 20:36:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF7012AE25 for ; Tue, 18 Dec 2018 20:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E41772AE28; Tue, 18 Dec 2018 20:36:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8517E2AE25 for ; Tue, 18 Dec 2018 20:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbeLRUgP (ORCPT ); Tue, 18 Dec 2018 15:36:15 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:55448 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbeLRUgO (ORCPT ); Tue, 18 Dec 2018 15:36:14 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBIKYRgR100217; Tue, 18 Dec 2018 20:36:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=DakUgSHR9Nip9pokvWACfQP8KQ7hBSFms1phCxpUTn4=; b=1mXN6VOgTr4FJr8behBUDPEOS2g3nSn5pG7lZMT2DBvdqaznZnIYvnMnm8e3Gyjj+TwD MDDr7Eh5asgWnZ7sBXSqts2MxQDoOLjCep0pcY9FC1hyiNR+tI57Qll2xcOdHS2amRxd 8H/tEjuHxli8jPeJk9XQcyNfll5beb92bWTMZlNOkJrpU5Mfh9QGI9LytqUOTbMe9gVm n+1cplt6K4SQ5mOdm8JHeXrgoq5LKxtoYx4agfv+u4MH2LhMGY82sGFKZEo7EDorGjMw iV8eQMRFkOZO27NDf41RTC9hIGfZh6yTARq7l1bll1sY9V9rOevCmA6Ci6g8HFtTjLcS Hw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2pcq4dwwee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:12 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKaB73015164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:11 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKaBMK013352; Tue, 18 Dec 2018 20:36:11 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Dec 2018 12:36:10 -0800 Subject: [PATCH 4/5] xfs: look for stringified constants in ftrace formats From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 18 Dec 2018 12:36:09 -0800 Message-ID: <154516536986.31115.738289589511424146.stgit@magnolia> In-Reply-To: <154516534392.31115.7010578395334646479.stgit@magnolia> References: <154516534392.31115.7010578395334646479.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9111 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180170 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Look for uninterpretable stringified constants in the ftrace format description for xfs tracepoints. Signed-off-by: Darrick J. Wong --- tests/xfs/735 | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/735.out | 3 ++ tests/xfs/group | 1 + 3 files changed, 77 insertions(+) create mode 100755 tests/xfs/735 create mode 100644 tests/xfs/735.out diff --git a/tests/xfs/735 b/tests/xfs/735 new file mode 100755 index 00000000..d5f4eba0 --- /dev/null +++ b/tests/xfs/735 @@ -0,0 +1,73 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 735 +# +# Look for stringified constants in the __print_symbolic format strings, +# which suggest that we forgot to TRACE_DEFINE_ENUM somewhere, which causes +# incomplete ftrace reporting. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc + +# real QA test starts here +_supported_os Linux +_supported_fs xfs + +cprog=$tmp.ftrace.c +oprog=$tmp.ftrace +sedprog=$tmp.ftrace.sed + +ftrace_dir=/sys/kernel/debug/tracing/events/xfs + +test -d $ftrace_dir || _notrun "ftrace not enabled" + +# The second argument to __print_symbolic is stringified in the tracepoint's +# fmt file, so we look for "{ NUM, STRING }" and try to separate each of them +# into single lines so that we can build a C structure. This will (we hope) +# catch non-constant numbers that the compiler won't know about. +cat > $sedprog << ENDL +s/}, /},\n/g +s/}),/},\n/g +s/})/},\n/g +s/, {/\n{/g +ENDL + +cat > $cprog << ENDL +struct ftrace_chk { + unsigned long long num; + char *str; +} syms[] = { +ENDL +egrep '(__print_flags|__print_symbolic)' $ftrace_dir*/*/format | \ + sed -f $sedprog | grep '^{' | sort | uniq >> $cprog +cat >> $cprog << ENDL +}; + +int main(int argc, char *argv[]) { return 0; } +ENDL + +cat $cprog >> $seqres.full +echo Compiler errors imply missing TRACE_DEFINE_ENUM. +cc -o $oprog $cprog + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/735.out b/tests/xfs/735.out new file mode 100644 index 00000000..844cea1d --- /dev/null +++ b/tests/xfs/735.out @@ -0,0 +1,3 @@ +QA output created by 735 +Compiler errors imply missing TRACE_DEFINE_ENUM. +Silence is golden diff --git a/tests/xfs/group b/tests/xfs/group index dfaae2bc..4a986af3 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -496,3 +496,4 @@ 496 dangerous_fuzzers dangerous_scrub dangerous_repair 497 dangerous_fuzzers dangerous_scrub dangerous_online_repair 498 dangerous_fuzzers dangerous_norepair +735 auto quick