Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp894157lqc; Fri, 8 Mar 2024 15:24:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW5kzyJBPU1X9QlxgGFUcd8RYDd6ngGVr3BXdzl6q19oKDWA1wWClRrcBY9brPkmKYebp0dbi5VVNYyPjpImeIhkhkPvnq8Noqr2BTcSQ== X-Google-Smtp-Source: AGHT+IFH3RGsuYA07a+RfY/M1XWboYZw4R48B6XLe3cAgeH0XFVBQ/IfKD51a4E4yzo64R33Jbq7 X-Received: by 2002:a05:651c:22e:b0:2d2:a7af:f017 with SMTP id z14-20020a05651c022e00b002d2a7aff017mr348534ljn.49.1709940292490; Fri, 08 Mar 2024 15:24:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709940292; cv=pass; d=google.com; s=arc-20160816; b=uI651L8zQQ1Rn6jajDE71fC1Ws+pedc/nb8rXs9VZbPmwfV1hon/I60CK75ssJmqFU PIvM1/mF4QuJ5pzHuv/k83GP9uGvJd0OXKqMqoYr+8xZQhvKeqCCYpVBwJSI7MAQcmSP 8OGTtBLN98WaKfSvsU7qsND8twKd4Wh5Enb25r2W5Je4SbWbjdBRL18qHyAbeqZkLxEF WL4t4qGfTzRxCMZpkLTf7UT37xiEBFf9LNU+JFOnlfIqKp7JfCmFpqoXZq6e8qwm4RaZ 2Vh8bAjM/U3WIbJcpGnDDRKVMWl/fK/K/tDWZKYS+7Ovy2Me/IdIX3c9zO3TlOJGhlgf KrYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=C0Xcf7CrCjRB3+pRQptNkSt1J5ww8uUmTJ/VMHdtLlY=; fh=oKAE5tld8VG3ppWQ329NDM8i+kvh4f6hHyi8a2KmQ2o=; b=lobNENT7bEufDoVJeZCGA5LMWLWcwby1397S2fqs64KzKv01W/ZMEVlZof/3FTAxUw 5RxRPXxRDfL3EPBXDdxgl5JJnKlXyG3nVnn6BnBZAyQQKwVPgh4xFgA570s/fhyjhNZ7 lJg9eUBBI5euf67i3J3tv/ndup7ZbfW6M0Ls+P8y6tEX3mpW0ho/AC1XOcayg1xN0JUI Yo+tQbyL5NWZ2su9rFWMYG3m+44DNzUp5H2igDlWcxg2pCilCbmNthKQH+blzEX7ue/a JwmjWjUmjAF0PFVg7EeuO22ruqNBgc3GHyHKk5k0Ywk//uAjCoXq3ZMQzgmYOtLksr9z 0nqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-97689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id by7-20020a0564021b0700b005675a828231si207812edb.567.2024.03.08.15.24.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 15:24:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-97689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 03F9C1F22765 for ; Fri, 8 Mar 2024 23:24:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DF6B3BBEE; Fri, 8 Mar 2024 23:24:44 +0000 (UTC) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CFC61DA3A; Fri, 8 Mar 2024 23:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709940283; cv=none; b=edUNyWsUNYG9pcpIqWJV4FJ6RwJ1BS+jam/vOkBTz9Z4/D73u+GGLHDgzbgDAQG9WtxuruX5/BYDWXZl9l2MFFMjs7UryrZglGO/eNO8tFt2IpO3oFOkF/cv0aZ2M/AeCRHoUpahAt4IXwZKmvqLqadRSrZH0JqieyvL2AebtHM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709940283; c=relaxed/simple; bh=/m+XJfrnXGihUnyC7uap36ib/wCqtej25a0oxz3sQAk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ZmuGb78W/cwCLjRdJhFDCI374lpwasAIjRFew+AK+fsWwZ3Lbz6Vbw8mj+cIVsn37GwCP+eZHFaFBzRz6/1x3KG+nAysuXiOW5EEo9ethCee0S+0j9fc0IrI5Bt4Zwd8x/4Pob9DppgTCu199RveEYKrsG+lC+XUrpqCVZeGWYY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-29954bb87b4so991408a91.2; Fri, 08 Mar 2024 15:24:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709940281; x=1710545081; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C0Xcf7CrCjRB3+pRQptNkSt1J5ww8uUmTJ/VMHdtLlY=; b=Sp+kfW6oBqh0FT2azGxahXFQ35N4L/CVL9mt+/Ck7q++QcfGBT48VX757L1yEgn2/U bkTEeJG4dBDtJH4eUn2FF7k875ONZvjqPmRVvYquhrpXVgXsvnc/chT++ZGzxvQ8ZJOw 3LIQyfZSxO26/QkpWmgYoDTgjWGbkTjoX6SbzILcF71rdK2ABihJpgrRwZ4NX7VS/ccP EgbRJwc1FQQBBL5q7XrMpmjAfo/lCyMgW2G/t6ruaL9J3i0w4m8vKXlUYYUI3uov44c/ rsAGT50fkpy0iw2jf1cAajHwJ1Q4BCUNW56Q3UUCzS6Jhbwl1BeFPdV856wWQLeVKfsz ZmOw== X-Forwarded-Encrypted: i=1; AJvYcCWWU2N+X7S/uw7wx+0hEyC32PVpthCy6WkU9MRe3gn6jNeKWyy+OmlCSVWtyXneQW6kuqXAfJzL6sdylI/CV9oKBO66Fli87ktN3Uy95rYpAkLDR3pJHwoJNn71XRRILHRWMvWh3fiS1hZt1pMEcQ== X-Gm-Message-State: AOJu0Yys8pPoViDIWhFgXumn1KlsmVVmZH/hEFZjD4932hUesZj/jdyg O7f2jfIL/IkK0WotrPyEqTQwPM0pNwscnuGd8SVtpYxz3SUXU9UAeClFgDjYpNZqVNlS7sbC6pS oAJtUCI24D60FGPGflGyU5RJExOc= X-Received: by 2002:a17:90a:c684:b0:299:5b95:cd7d with SMTP id n4-20020a17090ac68400b002995b95cd7dmr548883pjt.45.1709940281323; Fri, 08 Mar 2024 15:24:41 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240308120332.372810-1-retpolanne@posteo.net> In-Reply-To: From: Namhyung Kim Date: Fri, 8 Mar 2024 15:24:29 -0800 Message-ID: Subject: Re: [PATCH v0] perf lock contention: skip traceiter functions To: Anne Macedo Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 8, 2024 at 12:42=E2=80=AFPM Anne Macedo = wrote: > > Arnaldo Carvalho de Melo writes: > > > On Fri, Mar 08, 2024 at 12:03:31PM +0000, Anne Macedo wrote: > >> The perf lock contention program currently shows the caller of the loc= ks > >> as __traceiter_contention_begin+0x??. This caller can be ignored, as i= t is > >> from the traceiter itself. Instead, it should show the real callers fo= r > >> the locks. > >> > >> When fiddling with the --stack-skip parameter, the actual callers for > >> the locks start to show up. However, just ignore the > >> __traceiter_contention_begin and the __traceiter_contention_end symbol= s > >> so the actual callers will show up. > >> > >> Before this patch is applied: > >> > >> sudo perf lock con -a -b -- sleep 3 > >> contended total wait max wait avg wait type calle= r > >> > >> 8 2.33 s 2.28 s 291.18 ms rwlock:W __tra= ceiter_contention_begin+0x44 > >> 4 2.33 s 2.28 s 582.35 ms rwlock:W __tra= ceiter_contention_begin+0x44 > >> 7 140.30 ms 46.77 ms 20.04 ms rwlock:W __tra= ceiter_contention_begin+0x44 > >> 2 63.35 ms 33.76 ms 31.68 ms mutex trace= _contention_begin+0x84 > >> 2 46.74 ms 46.73 ms 23.37 ms rwlock:W __tra= ceiter_contention_begin+0x44 > >> 1 13.54 us 13.54 us 13.54 us mutex trace= _contention_begin+0x84 > >> 1 3.67 us 3.67 us 3.67 us rwsem:R __tra= ceiter_contention_begin+0x44 > >> > >> Before this patch is applied - using --stack-skip 5 > >> > >> sudo perf lock con --stack-skip 5 -a -b -- sleep 3 > >> contended total wait max wait avg wait type calle= r > >> > >> 2 2.24 s 2.24 s 1.12 s rwlock:W do_ep= oll_wait+0x5a0 > >> 4 1.65 s 824.21 ms 412.08 ms rwlock:W do_ex= it+0x338 > >> 2 824.35 ms 824.29 ms 412.17 ms spinlock get_s= ignal+0x108 > >> 2 824.14 ms 824.14 ms 412.07 ms rwlock:W relea= se_task+0x68 > >> 1 25.22 ms 25.22 ms 25.22 ms mutex cgrou= p_kn_lock_live+0x58 > >> 1 24.71 us 24.71 us 24.71 us spinlock do_ex= it+0x44 > >> 1 22.04 us 22.04 us 22.04 us rwsem:R lock_= mm_and_find_vma+0xb0 > >> > >> After this patch is applied: > >> > >> sudo ./perf lock con -a -b -- sleep 3 > >> contended total wait max wait avg wait type calle= r > >> > >> 6 5.27 s 1.76 s 878.55 ms rwlock:W relea= se_task+0x68 > >> 2 2.99 s 2.99 s 1.50 s spinlock do_se= nd_sig_info+0x3c > >> 2 1.77 s 1.77 s 884.39 ms spinlock sigpr= ocmask+0x98 > >> 2 1.76 s 1.76 s 878.56 ms rwlock:W do_ex= it+0x338 > >> 2 1.76 s 1.76 s 878.55 ms rwlock:W relea= se_task+0x68 > >> 5 1.76 s 1.76 s 351.41 ms rwlock:W do_ex= it+0x338 > >> 1 48.10 ms 48.10 ms 48.10 ms mutex trace= _contention_begin+0x84 > >> 4 257.80 us 119.34 us 64.45 us spinlock get_s= ignal+0x108 > >> 1 9.33 us 9.33 us 9.33 us rwlock:W do_ex= it+0x338 > > > > Testing it on the ARM64 board sometimes also show that > > trace_contention_begin+0x84, maybe we need to skip that one as well? > > > I can skip trace_contention_begin and trace_contention_end as well. > > Question: I have 1409 __traceiter symbols on my kernel build, should we > ignore them all? Or is __traceiter_contention_begin and > __traceiter_contention_end the only ones that concern the lock contention= ? > > cat /proc/kallsyms | grep -P '\b__traceiter*' | wc -l > 1409 Currently it's only __traceiter_contention_begin, we don't collect stacktrace at contention_end for now. Also we cannot guarantee if __traceiter_contention_end is right after the contention_begin so I think you should use sym->end of the contention_begin for text_end. And, traceiter functions don't belong to their own section so the comment should be removed. But I hope we can move them to a section to make things clearer. :) Thanks, Namhyung