Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4494101rwj; Tue, 20 Dec 2022 10:50:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXtXTMMjG8w6D61Ukohx3ZQ35oe06SEFLwRrTvFvo+5dmKpoFHs5c+PPxAKt1b00G0iLTmFZ X-Received: by 2002:a17:90a:f3d3:b0:223:376e:c776 with SMTP id ha19-20020a17090af3d300b00223376ec776mr26655471pjb.13.1671562246798; Tue, 20 Dec 2022 10:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671562246; cv=none; d=google.com; s=arc-20160816; b=1GTI2oQSfcRqm3IdJ+EG5iW1ronjkxUcObzkHaJaZIfhB7kBMlIRRD5JiqGR+kKbtN YhES8JgpAndoiu8TsWMkLYAOLjhhCtc6ewHmITHpgpBH1+6X/i37PKtEA/eXNuVtXA19 49IHiz3fr7GFkAsLcv6M+775uX1ZHkUFBOKC3uwC/exYmWqQW14cLd45iVBHYagBRw+V bAQJMq+aVVRRjT82krsk1jxlD3ai/hm7Fo61oTwN+o+AkYKesXmE1Grca/VdLI4Oof1/ cimxY4JZOh4akYsQjD0fKQl+/ab+KrFFwjGczwpudPQE2xp7wzXstLTGEh7oQAuj2lqI t3pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wVrDz8g7SH9DT1Ex5MNw8le1H7QO87iEsxRuh+sciDE=; b=WHMmX3cZuQ4QrMf5dmphOCqg29xjXPRqyT4yyKcLWG5ow6C0Twq2cI3E9DF6qFzx/D uUaEY17zLK4mGk+eGvcg/0SATtLq9+J00UCHbrghRDYVlIWkf9i0XnlmGSBgywGiLBzB G4IoG6flpyt4hxygz9ocXeartI7Z8o0hi8tjKMaDQGY/bzTCTlmr6JHt7xPRBTmW8f+4 p2ADFqCKHUuDwI9/1FmRRMMDAwRtJvSrfg66OEGkBx1il55bZ/lsXZzdrEhj7BE2rV3T LDl7WW2WSG6ZJXgiCLf1gobSVaHvjTR5OQxQleEUyeCS/1vJW6zCH7V7I0YQvFTqcuLu HUlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="D2sAAWG/"; 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 co21-20020a17090afe9500b00219b9479155si18838279pjb.187.2022.12.20.10.50.37; Tue, 20 Dec 2022 10:50:46 -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=@kernel.org header.s=k20201202 header.b="D2sAAWG/"; 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 S234083AbiLTS26 (ORCPT + 69 others); Tue, 20 Dec 2022 13:28:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234039AbiLTS2r (ORCPT ); Tue, 20 Dec 2022 13:28:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 883941DDE3; Tue, 20 Dec 2022 10:28:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFCF7B818B1; Tue, 20 Dec 2022 18:28:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 562FEC433D2; Tue, 20 Dec 2022 18:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671560922; bh=26BJsZF4v8uYU+L0SWB1rBznQrtMVFzrBO3rH/jfIS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D2sAAWG/LXFS34fdSRfw357w1UrXDJZSLS4z+ZYrJo6SksVGs4VPcrDjh41Mvutum DzVEnhqLHx6jcY9S5xr86JnmdAFvpU0YGtyLRjdGRUMpwSqmN9mSLH+2Quns37R99o 4VFSXUs1SBVDZtWZaXc1RTuS1RwidB2SaffXiC9qY7PUozDejgvW49e1/QqTjRxHK9 oooxQL/c29B0k1lV/WBjOEhuamumGIRN9ih5AJkNRP1SDHixz/mTLnRiQA8FziSrwG xk97wG0I6IjAdn0uJtU5Y6gPrD5H93v6QvfOUh7XoIVi3E0WZ8yPR4xSp9nu5J2eC2 ogjV1vlgh1R8g== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 7ECDA40367; Tue, 20 Dec 2022 15:28:39 -0300 (-03) Date: Tue, 20 Dec 2022 15:28:39 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Song Liu , Blake Jones , bpf@vger.kernel.org Subject: Re: [PATCH 0/6] perf lock contention: Add more filter options (v1) Message-ID: References: <20221219201732.460111-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221219201732.460111-1-namhyung@kernel.org> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Em Mon, Dec 19, 2022 at 12:17:26PM -0800, Namhyung Kim escreveu: > Hello, > > This patchset adds a couple of filters to perf lock contention command. Thanks, applied. - Arnaldo > The -Y/--type-filter is to filter by lock types like spinlock or mutex. > > $ sudo ./perf lock con -ab -Y spinlock -E 3 -- ./perf bench sched messaging > # Running 'sched/messaging' benchmark: > # 20 sender and receiver processes per group > # 10 groups == 400 processes run > > Total time: 0.167 [sec] > contended total wait max wait avg wait type caller > > 11 669.31 us 107.17 us 60.85 us spinlock remove_wait_queue+0x14 > 10 586.85 us 87.62 us 58.68 us spinlock prepare_to_wait+0x27 > 186 497.36 us 12.94 us 2.67 us spinlock try_to_wake_up+0x1f5 > > For the same workload, you can see the rwlock results only like below. > > $ sudo ./perf lock con -ab -Y rwlock -E 3 -- ./perf bench sched messaging > # Running 'sched/messaging' benchmark: > # 20 sender and receiver processes per group > # 10 groups == 400 processes run > > Total time: 0.171 [sec] > contended total wait max wait avg wait type caller > > 20 142.11 us 17.10 us 7.11 us rwlock:W do_exit+0x36d > 3 26.49 us 12.04 us 8.83 us rwlock:W release_task+0x6e > 5 12.46 us 5.12 us 2.49 us rwlock:R do_wait+0x8b > > The -L/--lock-filter is to filter by lock address or name. You can use > the existing -l/--lock-addr option to get the info. > > $ sudo ./perf lock con -abl -- ./perf bench sched messaging 2>&1 | grep tasklist_lock > 25 39.78 us 16.51 us 1.59 us ffffffff9d006080 tasklist_lock > > And use it with -L option like below. > > $ sudo ./perf lock con -ab -L tasklist_lock -- ./perf bench sched messaging 2>&1 > # Running 'sched/messaging' benchmark: > # 20 sender and receiver processes per group > # 10 groups == 400 processes run > > Total time: 0.174 [sec] > contended total wait max wait avg wait type caller > > 22 227.18 us 24.16 us 10.33 us rwlock:W do_exit+0x36d > 3 26.12 us 18.03 us 8.71 us rwlock:W release_task+0x6e > > Passing the address is supported too. > > $ sudo ./perf lock con -ab -L ffffffff9d006080 -- ./perf bench sched messaging 2>&1 > # Running 'sched/messaging' benchmark: > # 20 sender and receiver processes per group > # 10 groups == 400 processes run > > Total time: 0.190 [sec] > contended total wait max wait avg wait type caller > > 28 276.62 us 16.90 us 9.88 us rwlock:W do_exit+0x36d > 4 22.36 us 7.04 us 5.59 us rwlock:R do_wait+0x8b > 2 10.51 us 5.38 us 5.25 us rwlock:W release_task+0x6e > > You can get it from 'perf/lock-filter-v1' branch in > > git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git > > Thanks, > Namhyung > > > Namhyung Kim (6): > perf lock contention: Factor out lock_type_table > perf lock contention: Add -Y/--type-filter option > perf lock contention: Support lock type filtering for BPF > perf lock contention: Add -L/--lock-filter option > perf lock contention: Support lock addr/name filtering for BPF > perf test: Update perf lock contention test > > tools/perf/Documentation/perf-lock.txt | 27 +- > tools/perf/builtin-lock.c | 305 ++++++++++++++++-- > tools/perf/tests/shell/lock_contention.sh | 58 +++- > tools/perf/util/bpf_lock_contention.c | 55 +++- > .../perf/util/bpf_skel/lock_contention.bpf.c | 38 ++- > tools/perf/util/lock-contention.h | 10 + > 6 files changed, 451 insertions(+), 42 deletions(-) > > > base-commit: 51c4f2bf5397b34b79a6712221606e0ab2e6f7ed > -- > 2.39.0.314.g84b9a713c41-goog -- - Arnaldo