From patchwork Thu Oct 20 17:26:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp232905wrr; Thu, 20 Oct 2022 10:27:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72V7ZM6Za+8bjsSvPAu/n/0PYOvw61y6kpVC3AmP2q6c51/Ra3rw3UHUgE2nO2eUJ6rAIz X-Received: by 2002:a17:907:16a7:b0:78d:f586:e446 with SMTP id hc39-20020a17090716a700b0078df586e446mr11939645ejc.252.1666286852267; Thu, 20 Oct 2022 10:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666286852; cv=none; d=google.com; s=arc-20160816; b=uSLUl4hHx0gpUUhOf7gZHqvBS5q47T1xxc3OyS+1yY0QGwbAnxqs20tpylyAAkf89o i0R+aj+po/3+4HqwragCdXhbw9EGlU7P6WJjnSjpU68yKESQS7E0w2+GKgrBnhAYKour m+n0npIGoA1KYxbV8d/xsQmtronH/7qRt/VZ012UJTUx3iizlNKMBir+Wb9s0y8aVbMN P/aWMFRfcNP2ol5Ukk/5lyck7EJ/xqK8SNBIvnE/gVn6VdPJw4POLTsBeXmlNAe/SYlu s51LxchWPFj4koM53bqj4s6FLeeM9+lRCw2/8Ia/rYNGr7LC/08v+wwp4TK3ih/cZI7L Stgg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=zyshK7iYZ8XULGV5AWhAfvvym7/uA21Df+Y+HX9QYb0=; b=ZNDrZmV4yFBCmYUUqYk/2T5ZFZXYrFKv8xgX4lbchV8rlWqCCZIiZXfDIeSfF6HTeI SWXojQILNizWtoUjkxVLTs8RjgM1by1fTtF72rQzmD3vBp9bCZhcSwae+B/puGr+eo17 HenT6GvLg2zfsgHEgYIMOoSPqT1vcltYcwzIpH3vsXzlGAN/ugrzQ/G3gx4a0n0cMUp9 arqQXo8Ntwla0zZd1Sy8ab7x5nygvlr/bUNxgAe9fpf1YjMzHpR6Nv1Ep/ML2ggaUA5k B/6SY0021Tx166/JEiUWEHpH1af0hbX58JeIqZ5Sbek9QsnjxqCs7Nw3PE880tquhv/x lkJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=huTJFdkU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs20-20020a170906dc9400b0078d9db99a6bsi16190112ejc.444.2022.10.20.10.27.06; Thu, 20 Oct 2022 10:27:32 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=huTJFdkU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbiJTR0w (ORCPT + 99 others); Thu, 20 Oct 2022 13:26:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbiJTR0t (ORCPT ); Thu, 20 Oct 2022 13:26:49 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 594751A1B01; Thu, 20 Oct 2022 10:26:48 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id o17-20020a17090aac1100b0020d98b0c0f4so4149521pjq.4; Thu, 20 Oct 2022 10:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=zyshK7iYZ8XULGV5AWhAfvvym7/uA21Df+Y+HX9QYb0=; b=huTJFdkUecF8TGzQLLF7zQR3m817T7caMcVFk1X1HFFcunW/qxpRIzuNdRgNp9YqqC 4erIuFOo0N3fk1yBwunPDB7AwfRpS4skpBb3GapttN8tJR4Pj1FP52TRxXE7ZQcBRjAt Uyf9bUk2IqMILVqiZnpCslBjYb6WAI896ZicB9uKXSqaeW4lMwda1d1gN8rr87Mnx4LA 6yv9ET1FPfDyxBHshHme70jUsHjC87DVvGkotDtQdtVN8VpcAp2yB70KmDhgGZl519eA IsVEmtdAbDJu0KoVRoX34HDr5CawYlZiv1XxTaNR4IUdui3x9KpmdHnei4corF9VXRoK mIxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zyshK7iYZ8XULGV5AWhAfvvym7/uA21Df+Y+HX9QYb0=; b=wRojlP4qyexTcDDt1NQ9T2ErvZ9+DJwbMjqwbE6ARNm+i3SqS3aCjKFdOUzohUedbe ZGdx8tsYap1F/FVVk8JX/h2grBBHa/3Im2wO55EMOKE8nhf3azk1+Fc1rYXwBBrsEwKN C+w3T30qT/qkwA3wbuaEN5nxe/pLGjoZgsGb2nHk0yJG+miIEWODEUmyBqZpjri9imH+ sCF1BaXq9qdzLmWMOGgNaRjswYqcbz/ZFUrIkwimmLiPTr/sb+QzHNy/1/O1LjZLMi0Z hYJCZ47bz+BOwD/G/ZWM3HNqavdKB07xfXtMyI2GGq85PQUB41icxkCXC1jtVxERnvbi iXEw== X-Gm-Message-State: ACrzQf1VNVWTowO21RRJ/0tS2D+eCmeH4/6COml4RKBIgm6OEMNCvN+W kFIMKaewISdZKuCmz+OpN4s= X-Received: by 2002:a17:903:32c1:b0:185:5398:8c66 with SMTP id i1-20020a17090332c100b0018553988c66mr15241533plr.135.1666286807796; Thu, 20 Oct 2022 10:26:47 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:47 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 1/8] perf test: Do not use instructions:u explicitly Date: Thu, 20 Oct 2022 10:26:36 -0700 Message-Id: <20221020172643.3458767-2-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747228402584985861?= X-GMAIL-MSGID: =?utf-8?q?1747228402584985861?= I think it's to support non-root user tests. But perf record can handle the case and fall back to a software event (cpu-clock). Practically this would affect when it's run on a VM, but it seems no reason to prevent running the test in the guest. Reviewed-by: Adrian Hunter Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/tests/shell/record.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 301f95427159..747c33a1ec45 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -21,18 +21,18 @@ trap trap_cleanup exit term int test_per_thread() { echo "Basic --per-thread mode test" - if ! perf record -e instructions:u -o ${perfdata} --quiet true 2> /dev/null + if ! perf record -o /dev/null --quiet true 2> /dev/null then - echo "Per-thread record [Skipped instructions:u not supported]" + echo "Per-thread record [Skipped event not supported]" if [ $err -ne 1 ] then err=2 fi return fi - if ! perf record -e instructions:u --per-thread -o ${perfdata} true 2> /dev/null + if ! perf record --per-thread -o ${perfdata} true 2> /dev/null then - echo "Per-thread record of instructions:u [Failed]" + echo "Per-thread record [Failed record]" err=1 return fi @@ -49,7 +49,7 @@ test_register_capture() { echo "Register capture test" if ! perf list | egrep -q 'br_inst_retired.near_call' then - echo "Register capture test [Skipped missing instruction]" + echo "Register capture test [Skipped missing event]" if [ $err -ne 1 ] then err=2 From patchwork Thu Oct 20 17:26:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp232930wrr; Thu, 20 Oct 2022 10:27:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EAMQqDtgYGneRIPFdf43XaVd4CKgRWHCmNxZUFndlMjAt8XY3Gq4PcMAQwz28C7/CK6jR X-Received: by 2002:a17:907:c03:b0:781:fd5a:c093 with SMTP id ga3-20020a1709070c0300b00781fd5ac093mr11979597ejc.89.1666286858424; Thu, 20 Oct 2022 10:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666286858; cv=none; d=google.com; s=arc-20160816; b=zzEpBx+00Shfs3bO40fNuPrxRVsaMxBUf6nkH1uCq0hGYSansj9cOirob1eBt0MAlk j2IdMmrqwCZ/AGF+yANgxsgjpWy50eEdGCJeq1F/vZN9gFx66SFv0iDCwUo9SF46Bjry rUAn9+QAt5edc3+DXcfIwGW6WyZLHihrec4imlZZDvb7xFbqeNms55WI4kBRJa3WiY1o WEEfB5mFbTRt7AsNSCQR2Heje2NAPeqdZKzjXFy7aVxcUFV2Oh9KQev7qE4WWnhM3C7a BT2WNL8DBwXxHFVTvpY4ADxdcoQ+PtGgTvphOhiDISjcF+d1nDm4ma8JsKd2UUqiKaHw ktYQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=eSDt8hP5nyvEWrVukBA1Cz84sJh8J6UC7io/poKcOEs=; b=DGDj1wRCuUhwj/o/HUVylC1I/JN0R/WzaPYERokDubrVIilugn2cKfQpnnlVQLdi3a HalQLkM0tCM3ZlrYkBKFKUnyE6osiJr5oV7xj04fxUyjrs0MdmOZ2wKz6K12mvfv0gz3 j0kUOHruUUbEwrix70FHqXCNmWunmXv/SQwVls7wbmeZQSU/ZVIQYS2r5U0m1WAbfQGj TBFXOHIIiFpkV3a8dUrXM8C3k8Pc/oTmaVrybniSRlHf9IDLdSZIChS0OBhWXcTU2XAJ hR0ctoDGYG0L4cShiuW5ARz6D0Wa0acGwGAH5t9Zjwirnl93trj4w2ABH+ot/X1ovF1w aG7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N0RW9lwt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb36-20020a1709071ca400b0078cba073ec3si19086173ejc.734.2022.10.20.10.27.13; Thu, 20 Oct 2022 10:27:38 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N0RW9lwt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbiJTR04 (ORCPT + 99 others); Thu, 20 Oct 2022 13:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbiJTR0u (ORCPT ); Thu, 20 Oct 2022 13:26:50 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66B402A971; Thu, 20 Oct 2022 10:26:49 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id t12-20020a17090a3b4c00b0020b04251529so182302pjf.5; Thu, 20 Oct 2022 10:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=eSDt8hP5nyvEWrVukBA1Cz84sJh8J6UC7io/poKcOEs=; b=N0RW9lwt1ROLUFDlxho2ayGf0ooWdY2RDq636CZ8ocTQGvJLQPBJ5CqTubBqIfbyu7 PXf+mdlvr8RfVjXEirfd0j43SP5HORrnG20uILv3KjSo4sMhv9MZ5IhUDPfLvfACIep2 s8PptwM6hTbl14Q8eyOudBn/zfvJ1BuxfTyMsKNamtrRQ+6HyPCsNRjs4NtPe+JqmsJH 2aKulOj3uETNV2WYNz4VntKAkzWluXfRmqHnEkcoUKdYRZdFA1jhn5+ZnHGKLI6m70h1 g9XY1pvwe8Ra0bQ9ZXn3O2oTwkSfLBxVWaXrof/x+eahfw1058mxXwMe8bWuJtaZeAei XpoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eSDt8hP5nyvEWrVukBA1Cz84sJh8J6UC7io/poKcOEs=; b=eISdkpxJKB/Usy3u6PEYvm2NnZBZXSuvIHqoqcoU6TzkoPEmN7kdrVqqc8vQyyVQN2 sQB1uJmoSXk80bWp1dtlvvGc0UAQWsQwr9cy62ML0Fww7Io4W+L47htWZDG1ffoi0OvO mQXvazPVvW6QNbthjBD5Lt/hKBEfyVl+4w3uiC0pVdBssoBb+Bm2HGE58mjXnTYXCFba YgVaWPR+s66zAUSsEf9c9TrjHDcWTGpL0Tyxft0A+BETlumGWfo2dDvWAxITJs/T8TRs xXhBzqKNenHzfEAroLtQ+nSPG/54Blczt6Wv0dIZHNFQaabwaX7ZmNh/L7r61pQe1vtL H5Xg== X-Gm-Message-State: ACrzQf2bjayvp89slIDFERhWLFwjZyNSfCXNTGTyJu87YAzXyxoEMrRz zUVa165aFJqZKpTzj3s5VELFG8FfmQo= X-Received: by 2002:a17:90b:4d90:b0:20d:7f17:5983 with SMTP id oj16-20020a17090b4d9000b0020d7f175983mr53643954pjb.197.1666286808881; Thu, 20 Oct 2022 10:26:48 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:48 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 2/8] perf test: Fix shellcheck issues in the record test Date: Thu, 20 Oct 2022 10:26:37 -0700 Message-Id: <20221020172643.3458767-3-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747228408936866243?= X-GMAIL-MSGID: =?utf-8?q?1747228408936866243?= Basically there are 3 issues: 1. quote shell expansion 2. do not use egrep 3. use upper case letters for signal names Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/tests/shell/record.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 747c33a1ec45..464071462809 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -8,16 +8,16 @@ err=0 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) cleanup() { - rm -f ${perfdata} - rm -f ${perfdata}.old - trap - exit term int + rm -f "${perfdata}" + rm -f "${perfdata}".old + trap - EXIT TERM INT } trap_cleanup() { cleanup exit 1 } -trap trap_cleanup exit term int +trap trap_cleanup EXIT TERM INT test_per_thread() { echo "Basic --per-thread mode test" @@ -30,13 +30,13 @@ test_per_thread() { fi return fi - if ! perf record --per-thread -o ${perfdata} true 2> /dev/null + if ! perf record --per-thread -o "${perfdata}" true 2> /dev/null then echo "Per-thread record [Failed record]" err=1 return fi - if ! perf report -i ${perfdata} -q | egrep -q true + if ! perf report -i "${perfdata}" -q | grep -q true then echo "Per-thread record [Failed missing output]" err=1 @@ -47,7 +47,7 @@ test_per_thread() { test_register_capture() { echo "Register capture test" - if ! perf list | egrep -q 'br_inst_retired.near_call' + if ! perf list | grep -q 'br_inst_retired.near_call' then echo "Register capture test [Skipped missing event]" if [ $err -ne 1 ] @@ -56,7 +56,7 @@ test_register_capture() { fi return fi - if ! perf record --intr-regs=\? 2>&1 | egrep -q 'available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15' + if ! perf record --intr-regs=\? 2>&1 | grep -q 'available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15' then echo "Register capture test [Skipped missing registers]" return @@ -64,7 +64,7 @@ test_register_capture() { if ! perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p \ -c 1000 --per-thread true 2> /dev/null \ | perf script -F ip,sym,iregs -i - 2> /dev/null \ - | egrep -q "DI:" + | grep -q "DI:" then echo "Register capture test [Failed missing output]" err=1 From patchwork Thu Oct 20 17:26:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp233003wrr; Thu, 20 Oct 2022 10:27:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ms5oKEEwk2dewbmniJn9lTdYc9SPL1vpMV30Bt64mMT55wZeJlTsJa8atdMT2KbUEmQbF X-Received: by 2002:a17:907:3e9c:b0:78d:ce8b:8548 with SMTP id hs28-20020a1709073e9c00b0078dce8b8548mr12153698ejc.427.1666286867601; Thu, 20 Oct 2022 10:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666286867; cv=none; d=google.com; s=arc-20160816; b=gyuA/DZvo2jK9A6fX8I8fWOy1zDY4Qx/G0dbQ1aCgmS4HpqpbHPQbbJz9I6/3rXhj2 eZmJhb6FN1MVlhi9ORtdQC+jP3sEeqTK/De8dTQoEO29CQZd0UYG4EERdguHp/lISvuR 06VCoxZIa97iCggtkfkD3kITqVpqPHd/DQhVGVSrPx+b3hNvrgpwWGQ5I1gm/N/pUIU2 wx6OIdSw7e1JUarXwrH9oRh3PYKpLkl1xFPnRZjfLPbvBDL1MaIlpB6gbzqFvawKzG2g jw1ZjWsJWHOCoFLtu+QJBW3PdYaJcq9jk0E8uZ/urc6CYkLg8j60SjJcdPbhLuYjhVmu Mtfg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=PH0g+SRm+dkCNaIciH1RdMRbmhrFmdajvY8xociCPdQ=; b=pF2mXZl+xE6c+2lybvNJytDR7gAetw3mxMyR+bihmVVbP1VB2AYWrdJl59XmpoEu/6 crJApL5ZRjN2A2xB4eCtTxaafEcJ1IC27GlV0vmut8ITAF16fctJyQ+YarlNouu4nqyu BgLPxIOIFMOx2xst6BFbcH1DLJxfGwG2qZiED9rlZy5txAYVLhOTdQzPYznNdm9bDgtB jgJVIYPBbbaffLxz59VyfVb6ajX/ikpsX6lYYvfQFwLPND+Byd9YnFIdhV0R1XzHRqzc pO9Gw/wNtRIVm8POJ+PjH5zjh3Ed74cDbltFPGbPfcPRa4Q5HRIH9dHVaZpkwgYbvRik zkCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=L4AhiqLs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a1709063d5100b00781df60a2c8si13830765ejf.342.2022.10.20.10.27.18; Thu, 20 Oct 2022 10:27:47 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=L4AhiqLs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229933AbiJTR1B (ORCPT + 99 others); Thu, 20 Oct 2022 13:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbiJTR0v (ORCPT ); Thu, 20 Oct 2022 13:26:51 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F7171A1B01; Thu, 20 Oct 2022 10:26:50 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id k9so20474769pll.11; Thu, 20 Oct 2022 10:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=PH0g+SRm+dkCNaIciH1RdMRbmhrFmdajvY8xociCPdQ=; b=L4AhiqLscNtbMUNvjtXn237HAUbTRwwvcT2SyM7nA64Vng9WA6lcrXaMqGt4+MITFP fqx9GLLV/YN8HfZWeVaVTavPxjd4UaJrhkdPRd97yrJY0D1n0meMhmMlP6WRuluflecO EVM1LqI1Ya/EqcECbaHAt8TRvlJ+zcpFEWxd8U7f5apMy15Xth17x6EFh2MsCUV9aXNL rQhWOmxdUm9ZPKrmLnNXioYJo/6o3ZGzjqzitL4NMpKLWXUs48/i1KaP/VMbbwKuEOjF p91D9cqAHhXQPC/lSjU+AWA7S+YAfO9KG6QLUxri5eKjFAClqliOI9rOijGtlFlRopzr cdDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PH0g+SRm+dkCNaIciH1RdMRbmhrFmdajvY8xociCPdQ=; b=tDUklj8JRf3scEm+bDrXFkPb4LMNX5vVhUN6YuNpKrd0kZ3vJSPpCrviHMguwEg3WO BbIIU4BsBmmBuqtodyd2yeNYI9arWWuhyaiZmmHltZik8TwUXczTiZDmH16+No5yk0XZ ZC2khdlmdp2GFSB/+BYUIkythUgnWqJfAR/HUjU97CvzQEfEBrgdYR9jxCqz7q8I2Np4 vR+qcftXv9yplI6TPILKmukiHZiVcZqxZlt4Q48pKg7MclN9b5VACIN4NjSEPdhOGmg+ HklXKCZOYjLcUi6VN66/4HSS4BrGBc1fDwiaZbmpKZhZkHZhfNUiftsk8D0ckbJrQI4X 92SA== X-Gm-Message-State: ACrzQf04RoraxGY4qIdzM/jp2SIs04+EvHIjyF/lT2nQR1/zaLmJr+ZL tKSJDwrETjeBwJLVvjEARRA= X-Received: by 2002:a17:902:720a:b0:181:150c:fcc4 with SMTP id ba10-20020a170902720a00b00181150cfcc4mr15153685plb.109.1666286810012; Thu, 20 Oct 2022 10:26:50 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:49 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 3/8] perf test: Use a test program in perf record tests Date: Thu, 20 Oct 2022 10:26:38 -0700 Message-Id: <20221020172643.3458767-4-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747228418440069681?= X-GMAIL-MSGID: =?utf-8?q?1747228418440069681?= If the system has cc it could build a test program with two threads and then use it for more detailed testing. Also it accepts an option to run a thread forever to ensure multi-thread runs. If cc is not found, it falls back to use the default value 'true'. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/tests/shell/record.sh | 64 ++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 464071462809..952981481239 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -6,10 +6,17 @@ set -e err=0 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) +testprog=$(mktemp /tmp/__perf_test.prog.XXXXXX) +testsym="test_loop" cleanup() { rm -f "${perfdata}" rm -f "${perfdata}".old + + if [ "${testprog}" != "true" ]; then + rm -f "${testprog}" + fi + trap - EXIT TERM INT } @@ -19,9 +26,56 @@ trap_cleanup() { } trap trap_cleanup EXIT TERM INT +build_test_program() { + if ! [ -x "$(command -v cc)" ]; then + # No CC found. Fall back to 'true' + testprog=true + testsym=true + return + fi + + echo "Build a test program" + cat < +#include +#include + +void test_loop(void) { + volatile int count = 1000000; + + while (count--) + continue; +} + +void *thfunc(void *arg) { + int forever = *(int *)arg; + + do { + test_loop(); + } while (forever); + + return NULL; +} + +int main(int argc, char *argv[]) { + pthread_t th; + int forever = 0; + + if (argc > 1) + forever = atoi(argv[1]); + + pthread_create(&th, NULL, thfunc, &forever); + test_loop(); + pthread_join(th, NULL); + + return 0; +} +EOF +} + test_per_thread() { echo "Basic --per-thread mode test" - if ! perf record -o /dev/null --quiet true 2> /dev/null + if ! perf record -o /dev/null --quiet ${testprog} 2> /dev/null then echo "Per-thread record [Skipped event not supported]" if [ $err -ne 1 ] @@ -30,13 +84,13 @@ test_per_thread() { fi return fi - if ! perf record --per-thread -o "${perfdata}" true 2> /dev/null + if ! perf record --per-thread -o "${perfdata}" ${testprog} 2> /dev/null then echo "Per-thread record [Failed record]" err=1 return fi - if ! perf report -i "${perfdata}" -q | grep -q true + if ! perf report -i "${perfdata}" -q | grep -q "${testsym}" then echo "Per-thread record [Failed missing output]" err=1 @@ -62,7 +116,7 @@ test_register_capture() { return fi if ! perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p \ - -c 1000 --per-thread true 2> /dev/null \ + -c 1000 --per-thread ${testprog} 2> /dev/null \ | perf script -F ip,sym,iregs -i - 2> /dev/null \ | grep -q "DI:" then @@ -73,6 +127,8 @@ test_register_capture() { echo "Register capture test [Success]" } +build_test_program + test_per_thread test_register_capture From patchwork Thu Oct 20 17:26:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp233477wrr; Thu, 20 Oct 2022 10:28:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e57N63s3ygXXuy0tl5YIbKZMssou6XCYD2TjJg4vxPfV4w5CwoHltnFeyWkIf2nSkGEx1 X-Received: by 2002:a63:f709:0:b0:44f:6cba:3a4f with SMTP id x9-20020a63f709000000b0044f6cba3a4fmr12279157pgh.428.1666286931710; Thu, 20 Oct 2022 10:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666286931; cv=none; d=google.com; s=arc-20160816; b=fyEAIlIqZ/0dXWnr1NUaP/2315GxWgNOoM8qL0lKE6cBQhndv+CVAsK+QuIHgRw/1q unaVGg6ekSIjQHSgFl4jS1kS+EzNhr73reN4/y8lY1qndIybmJes3dAhTAgLUkUBKapW SHmSnL79oXy8H9I/sBCV60w5zJYoep8Q81XPoXEUtZ/w4ypeWWyymSN6z1DnY/ybmKda 2GdE63QdRJiv/oqsMxN8qINoLTc3GNDcujLJZ+wzA7AJOnMugf795xOiamXkTSVzKIoi Zr3IkwVoXQz8jcZ9dbfuKsPK3BEWetW7xqwvQLy0HhNaDvWKEx4ktI3LhyNtiSeD5PXV WQcQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=/QCC/hdBkmsmNSi05vln5MGpdORWqDfmRTbH31VLiIs=; b=DpwVoUCBuW5OlMXz3Okf8lqUQpXOeMJ6/2fQBpNUNf+x3P3Y77yLdYzGra//J8Aath tpooKSVI9LC3pZDIjbrKy4sxqKmLgiw0k5+6rqSCrz80UPwlxPkRYLLPdj0PL7HEAWHA 5Q3hOxCkELpz4M7KKhO03/PhrSKRbVT85jvKVsDqKZmwUjnQAOq7pseMYqt27zlOjkMk oHX9thCPxRHRwttNzMWbWPwWAWjjzXhIQwdHYn2kwJ19mMmCkuAhNim3M8gLWPhPjodz qp6xe3HUpcQImtRbMj5wgbGXY02qWM3dSTlfdHrGoSvpuJFcJuj1wzMZoIQuq0XvESai pYoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TgPCmmev; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a17090a8a0400b001f06a6fdb2fsi3213535pjn.27.2022.10.20.10.28.37; Thu, 20 Oct 2022 10:28:51 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TgPCmmev; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbiJTR1F (ORCPT + 99 others); Thu, 20 Oct 2022 13:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiJTR0x (ORCPT ); Thu, 20 Oct 2022 13:26:53 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 262841A6506; Thu, 20 Oct 2022 10:26:52 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id y8so155373pfp.13; Thu, 20 Oct 2022 10:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=/QCC/hdBkmsmNSi05vln5MGpdORWqDfmRTbH31VLiIs=; b=TgPCmmevrMWHslwgpZzGN+0wgNFE0L7vmF6++6i6B9O49LJAdSoJRq2D1L0D+TajHL nVqiaH9YmHLpiwfRrSkFSy6/d0GAtzWFBcMZ5TNpVHVJhlVeXmq9RKLWjbL96ieJirfm ItpL82zGk7gQnC2E68AkYoxM691rbbR5kCPgD4YAfEQUJVwG6s7dkWcknYUZ1fL4/L0I 0Q5IDDR0pdtlbhFJ6qTNM3h/h/fVddJlHsmP4QlLNvu2AMQHbsSuNMjTAbI6TsGAdadK ZYI1uzumhb1HWvhr4i4iMhMbdmLqRdMZRbobfFDRWTNpYhEpBxksMnv28F6bVX4tIX20 S+jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/QCC/hdBkmsmNSi05vln5MGpdORWqDfmRTbH31VLiIs=; b=m5/gtlWla5iwsvnwHqCQAQdnFmTOBbhwX4WBhiVecwiKY9RSh2IiqW3bgVoO9fS1f2 KXhfGnClQ7nzv5c82GhsA+weQlcOHAFk/YIG2ybA2HbADjyfU+KUN8kWIf+P70uqvKRq y5PmSAnAC3nmeidCKh73hRvGPQw+f51eMX/QEvkmnKbsiJuGM0xDyb/IJjjytwvpwEfI vzT/d66VwNF7QMEDDClauMOxRAznhlnfUypHTWVz6CrLfdXJAbzFv9+uX1K17Di9e+6/ 6LIrhZJ6fOwDeaZyk1mgozfYMnpNTay6jNim+Jlh+XlCtAbHo4QuJCOryQbg6ZEn90BC c30g== X-Gm-Message-State: ACrzQf3NZyaWGMMt5oxRyNiUuj7CVhOABZOcDgNzbh2GGn/m0pHDOizn /WCHiimTtz4o3gFXIjwxYwM= X-Received: by 2002:a62:ce8b:0:b0:562:9e5c:bb5 with SMTP id y133-20020a62ce8b000000b005629e5c0bb5mr15168542pfg.45.1666286811217; Thu, 20 Oct 2022 10:26:51 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:50 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 4/8] perf test: Wait for a new thread when testing --per-thread record Date: Thu, 20 Oct 2022 10:26:39 -0700 Message-Id: <20221020172643.3458767-5-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747228485763422595?= X-GMAIL-MSGID: =?utf-8?q?1747228485763422595?= Just running the target program is not enough to test multi-thread target because it'd be racy perf vs target startup. I used the initial delay but it cannot guarantee for perf to see the thread. Instead, use wait_for_threads helper from shell/lib/waiting.sh to make sure it starts the sibling thread first. Then perf record can use -p option to profile the target process. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/tests/shell/record.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 952981481239..d1640d1daf2e 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -4,6 +4,9 @@ set -e +shelldir=$(dirname "$0") +. "${shelldir}"/lib/waiting.sh + err=0 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) testprog=$(mktemp /tmp/__perf_test.prog.XXXXXX) @@ -96,6 +99,30 @@ test_per_thread() { err=1 return fi + + # run the test program in background (forever) + ${testprog} 1 & + TESTPID=$! + + rm -f "${perfdata}" + + wait_for_threads ${TESTPID} 2 + perf record -p "${TESTPID}" --per-thread -o "${perfdata}" sleep 1 2> /dev/null + kill ${TESTPID} + + if [ ! -e "${perfdata}" ] + then + echo "Per-thread record [Failed record -p]" + err=1 + return + fi + if ! perf report -i "${perfdata}" -q | grep -q "${testsym}" + then + echo "Per-thread record [Failed -p missing output]" + err=1 + return + fi + echo "Basic --per-thread mode test [Success]" } From patchwork Thu Oct 20 17:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp240249wrr; Thu, 20 Oct 2022 10:42:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM698gPzMYBb2tT2k4YmC99OUS3JQAlJ5V5eSlIcLuUcvHgmXj2bl4TJLuQ0gTRLI3pVYVo/ X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr2516406edq.387.1666287747606; Thu, 20 Oct 2022 10:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666287747; cv=none; d=google.com; s=arc-20160816; b=Dm0o3QoN/soHR+B/K/tB4zfVre4gPR8A94BZmHKLB49asshIPhruEKlHOnpVWk5A+2 /2FmD2+mOEr0rV60yOGr+zPowuQ8mrmBn1wm/sTUayXPZUBAf9mGCS1Iwntx/0JMNVRD gaqK/ZpRTIt+y3wRsqhhVEgE+GjFhjzoNYEyU17+yLhGue1FN/8uB1nEYYy57sX2T9VL iPMGFBa3yoGPD7bt1QBDyU4rOWuiwpvPq0Tl80oIUEcBCKeL5kfLZA3D7Ez287fIXtIQ jeBZ5F0v/u7UKYlb9xc643Q0Gp8Tu5cC2hYra9GTwWdyUOBPvrDETSewV/7dbFHK7lEz vdDA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=P4HXp1K6cJN2Uvch9Zt2E9c0l3Bq0y7+eEz+/MYZtlw=; b=XqqunHQdhHjiDtLzykE8Zp7SO4flL54ZreC7vvdAz6GHldO43oty8GsuwDpkWYOXuC vFKiqKykyL1+9sUXjvoh/6BoHh7qlcXsF/7tz37RgexvYejhULHVKF92fLGlBA7GKncO ZvDtJTC/nruei3djjbdCcZR7fgMqefIeGyf3mKCuLKfFyFi7DUviLBVwKyW378TROyz0 vddDOBdwK1wnckE2BmTdUGD5Y+IadwZR4eGVTU++1V1h3bXTpzOPYdXeCKDF9CZTyVNo Mqk5N7HssKTI2HYhjiDHt3rsu7y6UzilNLK/ieUVvwGakSoT1afD540IWrEopEK8o3Ht WxSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T3sM29kg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w15-20020a50c44f000000b0045a26e1b603si16517026edf.531.2022.10.20.10.42.00; Thu, 20 Oct 2022 10:42:27 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T3sM29kg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbiJTR1J (ORCPT + 99 others); Thu, 20 Oct 2022 13:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbiJTR1A (ORCPT ); Thu, 20 Oct 2022 13:27:00 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED5A71A9132; Thu, 20 Oct 2022 10:26:52 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id z5-20020a17090a8b8500b00210a3a2364fso2806791pjn.0; Thu, 20 Oct 2022 10:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=P4HXp1K6cJN2Uvch9Zt2E9c0l3Bq0y7+eEz+/MYZtlw=; b=T3sM29kgnLfPvAoZlUtJdyFjX/xfem16+gUTDb/z1q8QdXRHrcxB/o8lttM99WnClB Tr9Zm8Majl9EDL5o/j5bYa8+RipiwiZgiDdTAKOtCMo0SKZPwkBs83ntd1WA0qYjfOhy A9LohDqY0/8KNsUEEfLRn/xzx4qKg1P5Ab1POUJdJ5Yu6FlSlFV9QGfn6OLB8U0jh9Td YvdIvDWsNujvFQ4i92v096f9ERevwpdnBeIE/2AoA2rJl6rFYzs1ktOCxNb9yeEzvgYi 6NqfkZgFgcpAe4MMoH9KlpCPXUDdMaVQeSX3kuuOO8zYgBUZ0M12uK6fdZmzi96joGqx rsXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=P4HXp1K6cJN2Uvch9Zt2E9c0l3Bq0y7+eEz+/MYZtlw=; b=pOUazFphFz4hN62+Q6yAHyAfTSo15HhDL0w7bISQq6fr6cSqIO+AMSi/u1dgwN4/W/ +CId2zh6OY0nkXDCHiFiG9/Aeiaw6e4eUAiCfHrjktwtnab8tNSWIod8S+2IAeh+KR8d Ji5smjZ4nEIVzsY2DZmuq1CBHAhzWFHfnIDN9VzPwk2ojmW4wUtHYTEcWxwd2uyg0ee7 NELmEcRiNJilN5skPgwqdMkCtNtznJUNnCb5L+YHWrASaEJZd16Qs3i1G880SxhmYcjr YBOkuLNksvmS7KoPqpe+2KeFtERCnCyPHs8smqt4f/c/zQmiKIeqX8DP2gd283l8wb3f KLXA== X-Gm-Message-State: ACrzQf0xOq3yaW/T+mXuTlZ5Gem+jmHDnuTrktBlT1k/eppFaBoUSzzl /nswsg2bK1EtmqvMI/+JpAGxsMnmvS8= X-Received: by 2002:a17:902:f641:b0:17f:3633:5439 with SMTP id m1-20020a170902f64100b0017f36335439mr15072608plg.94.1666286812250; Thu, 20 Oct 2022 10:26:52 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:51 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 5/8] perf test: Add system-wide mode in perf record tests Date: Thu, 20 Oct 2022 10:26:40 -0700 Message-Id: <20221020172643.3458767-6-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747229341458664732?= X-GMAIL-MSGID: =?utf-8?q?1747229341458664732?= Add system wide recording test with the same pattern. It'd skip the test when it failes to run perf record. For system-wide mode, it needs to avoid build-id collection and synthesis because the test only cares about the test program and kernel would generates necessary events as the process starts. Reviewed-by: Adrian Hunter Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/tests/shell/record.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index d1640d1daf2e..345764afb745 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -154,10 +154,31 @@ test_register_capture() { echo "Register capture test [Success]" } +test_system_wide() { + echo "Basic --system-wide mode test" + if ! perf record -aB --synth=no -o "${perfdata}" ${testprog} 2> /dev/null + then + echo "System-wide record [Skipped not supported]" + if [ $err -ne 1 ] + then + err=2 + fi + return + fi + if ! perf report -i "${perfdata}" -q | grep -q "${testsym}" + then + echo "System-wide record [Failed missing output]" + err=1 + return + fi + echo "Basic --system-wide mode test [Success]" +} + build_test_program test_per_thread test_register_capture +test_system_wide cleanup exit $err From patchwork Thu Oct 20 17:26:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp236164wrr; Thu, 20 Oct 2022 10:34:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5X0GYMzLMKHJBOOhmQWx6KXqAMrS9tCJ5fqApx1HSBi4sJGKkBj6Vjs317lrGB4fxnxGMZ X-Received: by 2002:a17:907:a48:b0:77c:51b0:5aeb with SMTP id be8-20020a1709070a4800b0077c51b05aebmr12239002ejc.61.1666287293674; Thu, 20 Oct 2022 10:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666287293; cv=none; d=google.com; s=arc-20160816; b=DIo9gTejzpPa+WPo5sEEYRhz8tL/qKhdd58NpSENkKCQi8AXlmrd7bpaKKN9r2qqMM KVN9VJStCklIVe7pqvltRN/O/98a7HhqzDh4sHtgaQdujsJmHZBdWSQw3eS9KExJPKcu pGpk7vOp13dv8OnuDNHCyXS0CeHgs+v0udsvYnOEbShOkAzqkuxw/EBEaSjxaY0IG70u 6tMS3Au7/x+p5WxOWuyJ6WPFzZCJb75l91xFGOWZuCkwyAxWPbMlaX6ZCSqxNPY+ACrk RT7tng7KxN2B6z3apMEFjzXrMZ5Ca0M7hZHKytKMAe0oQq4TQ3CZcflPoopknyk7joqd YOtw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=dbvlWwvCQIXli5FcQTv9AFEFHOhWzSEZm+yuuSXSI1Y=; b=znWp+M1ZHHMmf2IG+G5+2zSjyNAnWsMb+zt8qK79T4ILetooNg6EUXYT9V1XSNRiDN GAMF/Imf0AsE0cHUeZOp/hrNrEmBPX9T/zfYhZkLq0Flx4upeMok9wst3VvUEBym8Lnn C4Dwu0nQ9374ILoCozgUTpsU90KM3+mOUt/RTHIb6J2F4EDx5yxdYFmuePGAvVa6xAee pA3JqSnJ6f+F8rcNORbSItnUIqqruYa86ShPshTiqhhOtIT5MelOWUMTI1OlA6SLCD/i k+UavTKnWcJDytM1EQnEs2T3ez8j7rL/hdm/BYIsR62Y5/Vgl45nEbH1cSbpucxO207U uOrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cXqwaexV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd40-20020a17090796a800b0078d3ab37efasi19076539ejc.84.2022.10.20.10.34.28; Thu, 20 Oct 2022 10:34:53 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cXqwaexV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbiJTR1M (ORCPT + 99 others); Thu, 20 Oct 2022 13:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbiJTR1A (ORCPT ); Thu, 20 Oct 2022 13:27:00 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F03631B90DD; Thu, 20 Oct 2022 10:26:53 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so4183386pji.1; Thu, 20 Oct 2022 10:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=dbvlWwvCQIXli5FcQTv9AFEFHOhWzSEZm+yuuSXSI1Y=; b=cXqwaexVjlldcSmD9j/JF4WwT60IM8xZoK52mGka5Ar1EDuWUbFq1GNlz4zzWOWW9V kcWXD0mh9qajCcrhNFJGUeAfAEM0IIX4jNjZuVb3XSMKpPOtdXM0tWZcIdIrfORBfl1X L4ZH7yfoYogm1IkfvCXuNKODfsxyFNCSQr6/SBwqEAtzj6W8F6AHDQZyd6O++4hXjzAB ZNkYwgaO8JVss5ptCatN/yS8ClEloJTI0OeFjB92ExQ7ikmIno4llZ6p/fbCF05sGX0j jGnZcUemSPcaH/yuRI5ERe7CZ2kPI4m1D8v/8Hgxd1aPSjW+m9wfCcj6bpXgAIdTG8/y LHXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dbvlWwvCQIXli5FcQTv9AFEFHOhWzSEZm+yuuSXSI1Y=; b=4NtJGA1Si0BH8yUzWkmuRx/akjkTw1mnr/fgWvGZVz651JKff9r3JC8gkLsbX/b6Tg n3Pn3jwtyF3rAJzvoNkTTdpEFaVRwEhvVhe7gVJoc9EFAl5JZl1TjjlG6k/A5aV2VBXN jPTOrcMYknyN4tQDoM6yUALf5terGM6m8Mz23ADpm0cqVdQWkRJeMz+q/SsYhh84iKOg CoY3hoL+nNXbK6aSvNF7vX2dhMko9L+uu8iUtmrQPeT1cPuvoIzir6XEuRs8jD9AFzuJ xUwRCAZ5GMoLfQ8KqdUxwWBKQXrlE5BwdPM8iWGMZ6KlbtycrzDSY83KOCvAqMCwhZN4 /XGw== X-Gm-Message-State: ACrzQf2PeWVwK+JSYqz9MtNWNbvtMe9Hy88oixiC44ne4LXYhd4YVfQo Gf1lEcSDl6jpcoPE6mpThMQ= X-Received: by 2002:a17:90b:3949:b0:211:2cb7:d598 with SMTP id oe9-20020a17090b394900b002112cb7d598mr7037048pjb.73.1666286813303; Thu, 20 Oct 2022 10:26:53 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:52 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 6/8] perf test: Add target workload test in perf record tests Date: Thu, 20 Oct 2022 10:26:41 -0700 Message-Id: <20221020172643.3458767-7-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747228865517691999?= X-GMAIL-MSGID: =?utf-8?q?1747228865517691999?= Add a subtest which profiles the given workload on the command line. As it's a minimal requirement, test should run ok so it doesn't skip the test even if it failed to run the perf record. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/tests/shell/record.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 345764afb745..c59d1459c960 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -174,11 +174,29 @@ test_system_wide() { echo "Basic --system-wide mode test [Success]" } +test_workload() { + echo "Basic target workload test" + if ! perf record -o "${perfdata}" ${testprog} 2> /dev/null + then + echo "Workload record [Failed record]" + err=1 + return + fi + if ! perf report -i "${perfdata}" -q | grep -q "${testsym}" + then + echo "Workload record [Failed missing output]" + err=1 + return + fi + echo "Basic target workload test [Success]" +} + build_test_program test_per_thread test_register_capture test_system_wide +test_workload cleanup exit $err From patchwork Thu Oct 20 17:26:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp236151wrr; Thu, 20 Oct 2022 10:34:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nqTpby/UgjRltNI3osz77BIlnQf0Vj4O42cFtZmpaUentSzvK/JrAtz5m29/DqaD8zL2V X-Received: by 2002:a17:906:730c:b0:791:997f:d65d with SMTP id di12-20020a170906730c00b00791997fd65dmr12199854ejc.18.1666287291153; Thu, 20 Oct 2022 10:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666287291; cv=none; d=google.com; s=arc-20160816; b=A4nG9hPDzSNHWvo3gKc7q5jkESK9KNigSVRjS8J7f8ZNX0X2/iAXFZNxeXrs4R/HVW hGMtcY1c8+D9RKTeJ78ORFwANovksLLHZ5ai/Dh76/0bpDjdrjtIrHaM7JfUgKiwG18f w10bB3MSF9Zu618jl9BdN6HlAHLTI3m3Euj/Def8R9pppfnQMANAHmZFR5epvqRDn4SH 9IE9/TCGMLoYY4/cV1Z7o/p5nlMjdKH1aIettHkazo45aqfv+pBqh8CNQzqLbwh3zfXS OuXxeRH5fkAIeWCPMHzXJu+YPs6abjwk8fPSmJA6bYBbaLPJ+S/EiguJKO22aBYjm16g 6oXw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=76OWpPG6taxwukfGOQIVyyPduKaLqtTpv/FwNGCoWTE=; b=AkVxOJ09mipSlHUjp6rhCMbjIQD2F0OV/SaAhinQLz2WHw+RGUgklhOjSBFElIExb9 /+NbTiSTSNLDGiWzLeXCAgKOIxabuO2F2Adu+bjB3Yf9uw1ZeEYQuy3IGY1zfBIvnaNL vVXtej+zFS4vZpflw4bVpscT/q5DhWUzxGKq44BXZMRU3YFNYo8bE5LhZjqxUJ5paq0G yg0DFOc9n300wznZcH6g1rsnOG1Bkp1KictT9M1mDnF2JMiRo4pFAOBXwC0iaEwvvQlG muKbfG949zzA5adsABJJt8pQn46JH49HMMviTIsc8YD1tVjw1w9wxPNwizJKOob5uCPr nVxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Z6KCfwmi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa42-20020a1709076d2a00b0078c80f5d81bsi15749908ejc.47.2022.10.20.10.34.25; Thu, 20 Oct 2022 10:34:51 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Z6KCfwmi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230085AbiJTR1Q (ORCPT + 99 others); Thu, 20 Oct 2022 13:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbiJTR1D (ORCPT ); Thu, 20 Oct 2022 13:27:03 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFBDB1BC169; Thu, 20 Oct 2022 10:26:54 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so4183428pji.1; Thu, 20 Oct 2022 10:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=76OWpPG6taxwukfGOQIVyyPduKaLqtTpv/FwNGCoWTE=; b=Z6KCfwmiq9NtR6cwQNiCy/gQEIkNFbsC+MCSiH37yTkxXMGoqFN/ePPmZ48zdSmu0u HTxCPD3vtu71oueq4lkzFCHYjyTSb+9VX468KWxtkQMfRaeiKJMI8ORNBHNYtX+A/gpP dqMRomWBp0wu4v5Xos4rA7B+D2g5/OFdqNlWiPvYVeCHQFAly6j14dGpY9HiL2fMmdzu OA8Ui70Q861xHEXcSV493t9E2NiGY4GTb/G0DFqpq8ToSD5IBj6IUWKFZkcE21NbvZnJ dolOi1OhsS7MIcjqv9+reld3g2SwX2GKJmfwAOI0FXLrbIAYYztHihyDjjDVoLZ+QUWt k/nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=76OWpPG6taxwukfGOQIVyyPduKaLqtTpv/FwNGCoWTE=; b=6jRSezQRG753iOHsNiu92mv3FKvmjIzM4rhg1JjrSg+VUyTEH0f5+cYigxdeMtHlBu zIEoFag3Fu+81Cybw0yfQkHNjFXSKkYm2JGamxxCRYsbiMZKFW2NOqA/A1YkA1rW01IE aYcGTzG1QdCLhHsn27PGH7i8IjceOO4RSTAoVLK3M7wm/yp3cN3N8brJNnahMng7dMtp AwC5JQZvtCDgoWIYyKqNpKgJFQ22imIVX4wqXzyWtXcQNnQCwFyxgYWCGA2lxeLEVRVt 2Ubwl8qylgp1O9M/q/egbOmlJxDhr59nVkRLhjRJHoPvqnReKrPcFKFjI6SCnAHY11nA Xjnw== X-Gm-Message-State: ACrzQf2hNMaGZpxqNQzmiO94Y6SZEVKjiapY+GZ9Cr8iMbVYclfxYTgr b6Dd+lG7T4IVSRcNQusVhUo= X-Received: by 2002:a17:90b:33cc:b0:20a:7f32:9632 with SMTP id lk12-20020a17090b33cc00b0020a7f329632mr17637703pjb.149.1666286814349; Thu, 20 Oct 2022 10:26:54 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:54 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 7/8] perf test: Test record with --threads option Date: Thu, 20 Oct 2022 10:26:42 -0700 Message-Id: <20221020172643.3458767-8-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747228862355577543?= X-GMAIL-MSGID: =?utf-8?q?1747228862355577543?= The --threads option changed the perf record behavior significantly, so it'd be nice if we test it separately. Add --threads options with different argument in each test supported and check the result. Also update the cleanup routine because threads recording produces data in a directory. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/tests/shell/record.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index c59d1459c960..01aa9531b369 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -13,8 +13,8 @@ testprog=$(mktemp /tmp/__perf_test.prog.XXXXXX) testsym="test_loop" cleanup() { - rm -f "${perfdata}" - rm -f "${perfdata}".old + rm -rf "${perfdata}" + rm -rf "${perfdata}".old if [ "${testprog}" != "true" ]; then rm -f "${testprog}" @@ -171,6 +171,19 @@ test_system_wide() { err=1 return fi + if ! perf record -aB --synth=no -e cpu-clock,cs --threads=cpu \ + -o "${perfdata}" ${testprog} 2> /dev/null + then + echo "System-wide record [Failed record --threads option]" + err=1 + return + fi + if ! perf report -i "${perfdata}" -q | grep -q "${testsym}" + then + echo "System-wide record [Failed --threads missing output]" + err=1 + return + fi echo "Basic --system-wide mode test [Success]" } @@ -188,6 +201,19 @@ test_workload() { err=1 return fi + if ! perf record -e cpu-clock,cs --threads=package \ + -o "${perfdata}" ${testprog} 2> /dev/null + then + echo "Workload record [Failed record --threads option]" + err=1 + return + fi + if ! perf report -i "${perfdata}" -q | grep -q "${testsym}" + then + echo "Workload record [Failed --threads missing output]" + err=1 + return + fi echo "Basic target workload test [Success]" } From patchwork Thu Oct 20 17:26:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 6316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp240503wrr; Thu, 20 Oct 2022 10:43:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dJOYCNe+cVVHJ3ajLP1x5YfhiFN1mksWLFruE6a7FkOL1kDTUh75lETeTKsG22po9PdAU X-Received: by 2002:a17:90a:1b0d:b0:20d:69b1:70c3 with SMTP id q13-20020a17090a1b0d00b0020d69b170c3mr17705748pjq.5.1666287782671; Thu, 20 Oct 2022 10:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666287782; cv=none; d=google.com; s=arc-20160816; b=uhzVe15V+JHpEmX5HvzX5Jd88TmDrpSAx2/vqpXTLSaUWgsExzpt0uG0MrLiTZbXre IBr+qDpxnywrndzxVQKMs7Ncx4YawbtyOBAR0ZfxENcfv3aI/QKsWPEsYWMhnsVjSqK4 FelZDNjFZPlKIhxPF2hcFNkX/c0xRt5eAKZIA0q6psUiMsrMCJ6cacQ8sONcX9GtSoMn 0MQZ1qyZq4NOd0dR0GsYqJvwPns6GyWy6LItBFEHK1Jmfxc2zI3TGgalTDZYDb+h66p2 q416ySGB6L6TVLXIG9fA7/9X0TEsk5cy+xRD8ipiA4dwgyL3v2Ha8AJHwrvziffH2a1n aSOg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=l6Z6RkNEbmfwHHP7f+jrXNR4HQTQXY+7XH5KVa3sTHw=; b=kToGAldezRRbhJ3YT2gB0cNiqUORfUFlXo/WR2UF+m1OuIFc5vEuFHdCpq44CHQv/I Q7yyoNaBthtzpQiBpPj44UWK61NkxpJen++mOVl9GzDB0/jR56j6c+LMzH3KaGKCsfuo Ty+Ft8rMXArW1sdJUmhd6i6moKH+mTHfhkNx4L0B88BefS9UUMM+50+ttWV0TyVutpud Z1EECPTEpAA5GydTLfXzd0lsn1R+xxoIpMfNROVpdPD3TZs9w2/Xl7nAEaaxMz2Fysnl m4p/7RQcxLwkCei83aD6eUeWtDFkqgR3iFEgW0WlBQUnTcHOiFCsIQhp8bA9fLtXnHg5 5b0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TdE6JdKC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a63c045000000b0043af57e5d16si20470948pgi.724.2022.10.20.10.42.47; Thu, 20 Oct 2022 10:43:02 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TdE6JdKC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbiJTR1Z (ORCPT + 99 others); Thu, 20 Oct 2022 13:27:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbiJTR1E (ORCPT ); Thu, 20 Oct 2022 13:27:04 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B0051C4ED7; Thu, 20 Oct 2022 10:26:56 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id b5so144769pgb.6; Thu, 20 Oct 2022 10:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=l6Z6RkNEbmfwHHP7f+jrXNR4HQTQXY+7XH5KVa3sTHw=; b=TdE6JdKCuD5lMOIrusLTVhFxkdEoXK78uY18+UWcYmD/XXdwZiTurzJucoD8xt6on8 ALYWqn6VexTkr4HtfJ3TBe8OSxfyFmgkUWZr6FiD0LDScoMeMUXoDNKOsZ1ZZJFvFZqd yXCdbJ45pLBU3uC7qEmUYCz/5+ghkrtWo74dliJ9k4NYXRTc93XOMNR63/jy9DrQMaCx Y39YMm9Y/U+ZIRmjoeLQrn13iQEFzzWKumwPShygqhJghQsWVe9BeBkGWzMsDyOtDDma rMLOtPmf9M8GwJ96NsL4/x7eELb4aXGiDJ/EBr7n+SPcvnBTy2YFNENfTgEopqdnXzUJ 7EHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=l6Z6RkNEbmfwHHP7f+jrXNR4HQTQXY+7XH5KVa3sTHw=; b=fyLLbSWaYT3wMOM6ZKigZsNyht5Nct+zUWn1564wfUqQx95+xTpgLZFX/5IGllb6gN mH6RDJOjJfvPx37yqXpoUGGV1lkKEyxb8IqkJa+BbUdsJMmUcFD5p9+weL5Crah4PQr+ qG+LBpYoDtcR8SLULGYnqcRMgbWWy7AtZPmBAnpLl3us8l6d5USQBI+2aks5Ntjf6QdV UjWpWNon0tjBrkqaGFYPsF6skUbwsnrn7ab42vgYfk7Wyqnl0PzfNw2O2yBCfPgNn24t 280IgQMaFs4uF/8eVC+UEs0GN628CxQ2zsUMUzqwfFq+ppbi3rt0YRQ3Vw5HLAlI56CL MUMA== X-Gm-Message-State: ACrzQf2vPiGn0iWn4FsaAR/vjVPjTIPoCRiXM+GPPCsYaFTkcQuhGfTO iItjuFXN3EawQ21YV5sEGqs= X-Received: by 2002:a62:1553:0:b0:565:a402:8b28 with SMTP id 80-20020a621553000000b00565a4028b28mr14813218pfv.36.1666286815298; Thu, 20 Oct 2022 10:26:55 -0700 (PDT) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:637f:7dcc:4bbf:4981]) by smtp.gmail.com with ESMTPSA id q13-20020a170902f34d00b0017680faa1a8sm12951754ple.112.2022.10.20.10.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:26:55 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH 8/8] perf test: Do not set TEST_SKIP for record subtests Date: Thu, 20 Oct 2022 10:26:43 -0700 Message-Id: <20221020172643.3458767-9-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221020172643.3458767-1-namhyung@kernel.org> References: <20221020172643.3458767-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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?1747229377826102670?= X-GMAIL-MSGID: =?utf-8?q?1747229377826102670?= It now has 4 sub tests and one of them should run at least. But once TEST_SKIP (= 2) return value is set, it won't be overwritten unless there's a failure. I think we should return success when one or more tested are skipped but the remaining subtests are passed. So update the test code not to set the err variable when it skips the test. Reviewed-by: Adrian Hunter Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/tests/shell/record.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 01aa9531b369..e93b3a8871fe 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -81,10 +81,6 @@ test_per_thread() { if ! perf record -o /dev/null --quiet ${testprog} 2> /dev/null then echo "Per-thread record [Skipped event not supported]" - if [ $err -ne 1 ] - then - err=2 - fi return fi if ! perf record --per-thread -o "${perfdata}" ${testprog} 2> /dev/null @@ -131,10 +127,6 @@ test_register_capture() { if ! perf list | grep -q 'br_inst_retired.near_call' then echo "Register capture test [Skipped missing event]" - if [ $err -ne 1 ] - then - err=2 - fi return fi if ! perf record --intr-regs=\? 2>&1 | grep -q 'available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15' @@ -159,10 +151,6 @@ test_system_wide() { if ! perf record -aB --synth=no -o "${perfdata}" ${testprog} 2> /dev/null then echo "System-wide record [Skipped not supported]" - if [ $err -ne 1 ] - then - err=2 - fi return fi if ! perf report -i "${perfdata}" -q | grep -q "${testsym}"