Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3213008rwb; Fri, 9 Dec 2022 11:22:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5XP4wGbeX8gspXdwzwzmEizs8aRhlHYabUoUWbF1u8S6rBbfAse714d7xaxwPHP9HGC0cl X-Received: by 2002:a05:6a20:d685:b0:aa:7ed2:6f39 with SMTP id it5-20020a056a20d68500b000aa7ed26f39mr9801327pzb.41.1670613739997; Fri, 09 Dec 2022 11:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670613739; cv=none; d=google.com; s=arc-20160816; b=j3NMBptOBfvaDZfQdJwgbkDQKEI/KdeYbtYIBCSSj6ud4JIM7fHslhZKOdMe3SQLn+ xPrCdHyocUx8mdCigIceu8bD2WjikLLsoIcRCeTZazxCJVsr2E5FW02cRsUn1FRKyHCQ bMPbv2Ulb1lxa2juVg7sBlhuqyc3swUHTKyFuUNW+I22HPBZFrzIhkcBIHms/3QvY3UM pWMOf/f/E8G2XxaVvKMlUFW7+xCE5jADPIl2K+Jip9LyvY4+gfrxGpOBaWAFCInb4ufl b0bnf/2IJaWPjGf7lM8h2Sx9MSpZU+xr3gKXhSOiuBjkn6PJciWcCxLU/psAWpIPVDHa I3nw== 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=JAU/j1NdwbvUI7spTdVmLXV+d6wFoRxuKA8kjpq/0+E=; b=fwqadxsQly4HGYhctrU0d+Zn2XulBEWFrJl8FrYJTyvi0Y7GViYW5HH1gZNzkdEmqm TIVzUGEWUnqfQVtTXIpZ0ZUzVkWUUqz9+8EIW1w2kyGYHNyZK8DbpZA6lhjggu5evawj l4vN7vogoBxFiqkg2JNsunFJScSmlP+HVqPo/F2TzLcrtMa8V87wvBicYWxjaDsshfKT fci5vw3m07ulLvGPN2WJ0YwCvoWnsPa3uVgc/k+qhGsW5j/eYXTgTQ/L1fIImWMXgXCJ lt4FI6Q5Az+a8jJlmdDniFtFte+YoPEn/MRtC1UQlhcwj3vpBqwx1vDZxfaAwrWSxsjq wPZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="QYEKC//N"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x77-20020a633150000000b00463fc72dae9si2337133pgx.144.2022.12.09.11.22.09; Fri, 09 Dec 2022 11:22:19 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="QYEKC//N"; 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 S229521AbiLITIA (ORCPT + 75 others); Fri, 9 Dec 2022 14:08:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230130AbiLITHn (ORCPT ); Fri, 9 Dec 2022 14:07:43 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 474356441; Fri, 9 Dec 2022 11:07:37 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id y17so5857500plp.3; Fri, 09 Dec 2022 11:07:37 -0800 (PST) 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=JAU/j1NdwbvUI7spTdVmLXV+d6wFoRxuKA8kjpq/0+E=; b=QYEKC//N4gfLrm8aFH4teGNGwE5UrwqLs52KyKuUT76LejDrqWmphcWaZYFyjhECA+ TZJ49uMAvsB1yPTNBuyUG7OdiLmrcImnM5gq9ZVcDTlHJJRHkh1jwHbphHNeCXGEFm3i Vkbhka5SA8PbmbmOrIhSTVUYXr6ihh3f7KiVblSLaPz32acZwxkiQBbEdptB2Ls8pg4m lubRcHW8lgwb2Jr1ri3unZ177hi94vHvw6x9wHqRLgETPZYXSJ6rWUhebYKRny4yY30O 1+BLIyvvF8AOcXq5GsfSyU2nBxtJCWlQEZwRQb+XbQcKYgxpIuYWJbmk6WK/N5rDv5Lj itdQ== 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=JAU/j1NdwbvUI7spTdVmLXV+d6wFoRxuKA8kjpq/0+E=; b=ImhZpiH2sQZ8QVM7BhuEmF28BJu/CyaoAq5yFQfQD5b53ucftGYyemJIC3CwaGIARm p5wg7alrEXWZld9w/Tpsmz3TO7c93Y5UXwKgqT+IWMacY04dwe9OFwebJi+sOzirrBis l4eTw/adeq9JcmSQSnYsvGjqAsnRn5OEG+jNwqn1V/6tjLuJZ6Le+dAbo8JNm32MwrEG xjvyEnGn3BeRFnmDNYA3vPDRct+bt9ejo/eK01g9KRDtzdZiGJHUkmCjR6y3JhDr7YAF ryKqfmqh+OR23/TWcay6nMCR4XY7sn+i0HZiXEK/lyOuXkUPxneYYvwClKB6aRMfALuN JpZg== X-Gm-Message-State: ANoB5pk9hfbnYdxQu3aM87uWdSHbRTPLqoqql8QIUNUGaZUsdiMNn+RJ /3wQz1ziT3z+3W0TeBnRQTU= X-Received: by 2002:a17:90a:8684:b0:219:68f8:7aaa with SMTP id p4-20020a17090a868400b0021968f87aaamr6785914pjn.40.1670612856682; Fri, 09 Dec 2022 11:07:36 -0800 (PST) Received: from balhae.hsd1.ca.comcast.net ([2601:647:6780:ff0:c952:d848:9e00:3cce]) by smtp.gmail.com with ESMTPSA id nd17-20020a17090b4cd100b002135de3013fsm1431432pjb.32.2022.12.09.11.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 11:07:36 -0800 (PST) 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, Song Liu , Blake Jones , bpf@vger.kernel.org Subject: [PATCH 4/4] perf test: Update perf lock contention test Date: Fri, 9 Dec 2022 11:07:27 -0800 Message-Id: <20221209190727.759804-5-namhyung@kernel.org> X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog In-Reply-To: <20221209190727.759804-1-namhyung@kernel.org> References: <20221209190727.759804-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 Add test cases for the task and addr aggregation modes. $ sudo ./perf test -v contention 86: kernel lock contention analysis test : --- start --- test child forked, pid 680006 Testing perf lock record and perf lock contention Testing perf lock contention --use-bpf Testing perf lock record and perf lock contention at the same time Testing perf lock contention --threads Testing perf lock contention --lock-addr test child finished with 0 ---- end ---- kernel lock contention analysis test: Ok Signed-off-by: Namhyung Kim --- tools/perf/tests/shell/lock_contention.sh | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tools/perf/tests/shell/lock_contention.sh b/tools/perf/tests/shell/lock_contention.sh index f7bd0d8eb5c3..cc9ceb9e19ca 100755 --- a/tools/perf/tests/shell/lock_contention.sh +++ b/tools/perf/tests/shell/lock_contention.sh @@ -77,10 +77,58 @@ test_record_concurrent() fi } +test_aggr_task() +{ + echo "Testing perf lock contention --threads" + perf lock contention -i ${perfdata} -t -E 1 -q 2> ${result} + if [ $(cat "${result}" | wc -l) != "1" ]; then + echo "[Fail] Recorded result count is not 1:" $(cat "${result}" | wc -l) + err=1 + exit + fi + + if ! perf lock con -b true > /dev/null 2>&1 ; then + return + fi + + # the perf lock contention output goes to the stderr + perf lock con -a -b -t -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result} + if [ $(cat "${result}" | wc -l) != "1" ]; then + echo "[Fail] BPF result count is not 1:" $(cat "${result}" | wc -l) + err=1 + exit + fi +} + +test_aggr_addr() +{ + echo "Testing perf lock contention --lock-addr" + perf lock contention -i ${perfdata} -l -E 1 -q 2> ${result} + if [ $(cat "${result}" | wc -l) != "1" ]; then + echo "[Fail] Recorded result count is not 1:" $(cat "${result}" | wc -l) + err=1 + exit + fi + + if ! perf lock con -b true > /dev/null 2>&1 ; then + return + fi + + # the perf lock contention output goes to the stderr + perf lock con -a -b -t -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result} + if [ $(cat "${result}" | wc -l) != "1" ]; then + echo "[Fail] BPF result count is not 1:" $(cat "${result}" | wc -l) + err=1 + exit + fi +} + check test_record test_bpf test_record_concurrent +test_aggr_task +test_aggr_addr exit ${err} -- 2.39.0.rc1.256.g54fd8350bd-goog