From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796401493; b=j9Ee/EyYx6LGAJ1fM4O93IN0FBN+56hAVrqASopv+cRYWDl3blEjUOfBdEX8cTuoaP3z H9crY9AT20XciJI5P6NL7nlnhCizyiDS5nunuSmPMYqBKVyKESMyO1p9Y8Ae722aL9OSJ 7cBcaZxRT4scShd5ZRgBxtNWdD+tTLRQcG07W859aW3R3dHlIWeEQ6Po6d/PyLwTXoPKU 8ePU5EPCIlV3gg/R46YANOfzWDypHcpiPtEqAY9s2liK17aCgtzxQm/iuIr6kdO7BrTUU njt9cd53fvIvpmDTYFEcod4hWRiqO866EiO9kYwtAv2okU65iL2ZuqZkw1tDiNYOZGA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401493; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-TM-AS-GCONF:X-Proofpoint-Reinject:X-Proofpoint-ORIG-GUID: X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis:X-Proofpoint-GUID: X-Proofpoint-Spam-Info:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=pESpJ8VWCGM0J4QRzfE9kecBsMmLnaMA/hOXITtFXkM=; b=1ZU9cJukEaetkvQkuIf9vCgmjSSmlmCnOeZZt2jSA4tLme3QWBjg+MmFX7vSljUL8FeM xcqKGYGwKMAq/y7uY4fzsQNxqxadaTXy4i0O012TweUW4VT8JStLWRw6OIYdN/0crzWPO 18cEVzi/t7Huk23asVzUiyGPWhjxSoeY69+tf4nZY2P6vrJtgoXQ91wZFxHUkAlG2yr9m zD1nKJxQD21anzorfNMW+tJAgAUVYFEFSvpz3zxS67mka6DOBMvMXPLqzOY8SX1/apKcP rfPpNkKYLu5vATsomm+WxAgC4zBm0Ax9HMC22tQNfLhVQHrK63vbXdOMyE5O26/1HjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=H1mVezkI; arc=none smtp.remote-ip=148.163.156.1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FAB6606A322; Fri, 4 Dec 2026 16:24:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7FAB6606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=H1mVezkI Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B4EYkp12517321; Fri, 4 Dec 2026 16:24:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=pESpJ8VWCGM0J4QRzfE9kecBsMmLnaMA/hOXITtFX kM=; b=H1mVezkIfmA2nTco3FhYbpWgEGjBdkoBJM072OByTSQcClBZTx3YiqBef +fDoQai0g6cH+EYyrP/rNZanXbFrxs+DQQIHsh/oc8DjBbynZzKqX4aUgBTQAlWw cBmOW6rJFQ7umC33ezXnFlZZ5KHqNgbnMDPYdflGDqcF5JtJ+GsJwzBX0pZooYFu kAoKoipuIzewhgJuib5et6cVDZA/dmOR3A0mGtOrsGprrpIMfsZf309E0OdCNR5s wOjVNHBWdvLTBW3CmCxfwVpVgOmJ4QgFY9rU7taFMj9cI8AlKJfRUviwi6rVDxTz 9qPhrt8w65nPDSqdkOxZjh3HaBieg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4jbqgc2s7f-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 04 Dec 2026 16:24:41 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B4EYHdT2168933; Fri, 4 Dec 2026 16:24:40 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4jb5a1p9um-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Dec 2026 16:24:40 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B4GOcAO57082162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Dec 2026 16:24:39 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9096658052; Fri, 4 Dec 2026 16:24:38 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DB9B5805E; Fri, 4 Dec 2026 16:24:36 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 4 Dec 2026 16:24:36 +0000 (GMT) From: Jens Remus To: Ian Rogers , Arnaldo Carvalho de Melo , Namhyung Kim , Peter Zijlstra , Ingo Molnar Cc: Jens Remus , Jan Polensky , Sumanth Korikkar , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/5] perf python: Honor more perf script options Date: Fri, 4 Dec 2026 17:24:27 +0100 Message-ID: <20261204162426.4171717-7-jremus@linux.ibm.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: PsAgvJVDLRj9k_1STGXU4SSRKmZJ9dVj X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjA0MDA2NCBTYWx0ZWRfX8Vc3tiZQ1lql kBJZ6Icujk4onNcGy9OL+1uZpj01VxTMpmNcylCltkqDAS5aKXyKUTs2o3ypMfcKRepjVlN8/U1 zza3xaFsLp4EgNK0CDFOP8iZ3NLk0J3J8uVkFcZkCLzWMe/I3Z98C+HB2cd+K1oBAKKwtJ1DgPL Ose3PDNB55tsaQC2BSR5HsytuG0cOcG0vncaNFVaVB2KEm8+nzH2VRElRvwL86Y+hcDu3yJH4/+ 3gMwQmZFGPNcTSRGUeEnWmYzFyxPzgbcfniNZbTSY6dAydnLowN1aNhahGUANYiEF9p+TDiBPTV vfILSvthWjJebSrRSI/UzvyuF4njlzHs4YjwBFUg011COPZPhkNNo5wOswcB0qRLT1I1bPZhFoW 8722yAN3D6KdRQcJsT5ocTdYkDNnhFpwFizanf2wztxRYZmRdM79PTqXrTRiC+fa460rK7Eo/f+ qWlOtn1CzsRAJ4WYUwA== X-Authority-Analysis: v=2.4 cv=A435rKWG c=1 sm=1 tr=0 ts=6b12e949 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=cQ4rpYkWD2TLO9heBLgA:9 X-Proofpoint-GUID: L7KcxpODHEo2fBggEHObD_aNyVPMRnG0 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA0MDA2NCBTYWx0ZWRfX3P4qdy/weFLO L8fTjJxneHd0f8EITZqmn1lHXg00A0aR0zeYdTC+Bi9eWmvI+kpukt0TTG1eiuJqQMVVGBgaIya w8JaexuwVKQHLVuFiJo2yg3LTciYAq0= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-04_03,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 adultscore=0 impostorscore=0 spamscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 phishscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612040064 While updating my own perf scripts for commit b02aa1d1343f ("perf script: Support standalone scripts and remove embedded scripting") I noticed that perf script accepts but ignores most of its options when running a Python script: $ perf script [] -s ~/my_script.py Only --vmlinux, --kallsyms, --symfs and --itrace are forwarded to the script's perf.session, via environment variables. perf.session itself hard-codes the other symbol settings, and two of them differ from the perf script defaults: it does not resolve inlined frames, and it reports the kernel DSO by its vmlinux path. So a script cannot reproduce the output of plain perf script. Neither the command line nor the script itself can change these settings, because perf.session has no arguments for them. I use some of these options, so this series forwards --inline, --show-kernel-path, --max-stack, --demangle and --demangle-kernel. For each option, perf.session gains a keyword argument, so a script can set it itself. If it is not given, perf.session uses an environment variable set by perf script from the option, and otherwise the previous hard-coded value. Scripts run directly only gain the keyword arguments, their defaults do not change. Behavior change: Python scripts run by perf script now resolve inlined frames and report the kernel DSO as "[kernel.kallsyms]", like perf script does. Use --no-inline and --show-kernel-path to get the old behavior. Patch 1 also adds callchain_node.inlined, so scripts can tell inlined frames from the frame they are inlined into. Patch 2 exports this flag in the SQLite and PostgreSQL export scripts, which adds a column to the symbols table. Note: On s390 test_export_to_sqlite_python.sh fails, independent of this series, because "perf record -g" defaults to --call-graph dwarf there. The resulting samples exceed sizeof(union perf_event), which commit 2c672ffdad4b ("perf python: Lazily copy events and samples from process_events") rejects with "Unexpected event size: 4168 < 8536". Based on v7.4-rc4. Regards, Jens Jens Remus (5): perf python: Support inlined frames in callchains perf python: Export inlined symbol flag in DB export scripts perf python: Honor perf script --show-kernel-path perf python: Honor perf script --demangle and --demangle-kernel perf python: Honor perf script --max-stack .../perf/Documentation/perf-script-python.txt | 11 +- tools/perf/builtin-script.c | 9 ++ tools/perf/python/export-to-postgresql.py | 32 ++--- tools/perf/python/export-to-sqlite.py | 18 +-- tools/perf/python/perf.pyi | 24 +++- tools/perf/util/python.c | 119 +++++++++++++++++- 6 files changed, 180 insertions(+), 33 deletions(-) base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f -- 2.53.0