Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1157627pxf; Fri, 9 Apr 2021 01:11:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3oEZBWhnuDsXotaKBlS67YVVMNvYaH2y60oaQu7PYNTJ79LPcCHjR2ZUJ0c/sH8c9bE1l X-Received: by 2002:a17:902:f212:b029:e9:56f2:18ba with SMTP id m18-20020a170902f212b02900e956f218bamr11618762plc.75.1617955883412; Fri, 09 Apr 2021 01:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617955883; cv=none; d=google.com; s=arc-20160816; b=DiTkEGrtRKjTvUOs6mYeZBARMkUZ0nYMazcnV3u2fFmcEG3ArS4e2UqKga6SrdX1aN p2esLyNxFAw8E2kBVWMuBdFlree0mouZsMvzhPRZ4epZPmIfpQ4FHyqRY8I3F4AGOriJ ssIPZyoavST3kRUtKzrtn1xsB5sFOoj3ngVE3/l576vUHSDNeYbB5kgubaQCJaO9WPGe fRqJF4e4t5opuJgVonqHo8/QxVZOMxT/GF29nftjl8EBdgbE8Olc37K5qs8ZYyN3hoMn 7RfnPV1lw1mzBWvzYatMFvJO83KMNCm4acV8FOAsRYgUBc1XfIw4p4iH2aN16nZ6qyyY YaJw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=oMQnkpNydPuwHeLwOwD6pr0oIYbZT0IE6tD5wSdcxaQ=; b=cjE7bUI195NpEkNaReMFVebTLxQBHMym14+Iv/HuCD4CAYVHtb2vcmtJq/jIGrj0EX LF5bpHcz4G3h8XjNpCnw0SJJttdcI0tuWNAebDL+ATqQhToDnlIcs5yBtDe6GAtuyJ2s csQteFAIFjv6GL2J7Hk5wz6U30hdfN34W7tE0i9BbMThGZ+vfY1+GsshXqKG/4H+PDd+ qe1y5g0jeskfCMuMokHu7B785aOUyE5sEKkoQuaq2YnUqG92pCq4WxIPzCoCsbOsQbmp 29YNlqCVpsGGMDj+mvzpJH4RMWvLOCilPtFm2L3w5Ylk+30SbhOWyFbn2sxJCEs+6fdg xjfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="S9K/fQ+s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si2385945pjo.119.2021.04.09.01.11.11; Fri, 09 Apr 2021 01:11:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="S9K/fQ+s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231371AbhDIIJn (ORCPT + 99 others); Fri, 9 Apr 2021 04:09:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37904 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbhDIIJm (ORCPT ); Fri, 9 Apr 2021 04:09:42 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 139834f7048406; Fri, 9 Apr 2021 04:09:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=oMQnkpNydPuwHeLwOwD6pr0oIYbZT0IE6tD5wSdcxaQ=; b=S9K/fQ+s+mwT3phk7AQUQJ6EHTUBZ62L/o+KBgazilF/BcNUDky2aXHRi9y8fzgjO2Ry fl/A+AIvXpeGrAaPsM28QqSvBbNtZ/XN17y+jiNCyT6adcEBB2UeJ8x663oR+d0PhOhU mGyTlFC4kvav+TcdyjD5pEhlxoBBg7CJzh65bEVHKzUm8hR1QIg/OPDT6TEj2HFG83WW DWlAqp7qsGW+TrYcNPUtNj0ZFeFhg6tr9Vksjr3bmbQs4b8zn9kQWQHAlrngiy6OS/22 DAG6H+eYVuFDP/aCq5JRUFOiKLuwP2RWfqMbfbaB+lkSlk1VIB9ni+aM7dumKyhKMBkm Vg== Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 37rvpw5j1k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 04:09:29 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13983Ce6017354; Fri, 9 Apr 2021 08:09:27 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma01fra.de.ibm.com with ESMTP id 37rvmq97bn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 08:09:26 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13989NC848628088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Apr 2021 08:09:24 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB3D742041; Fri, 9 Apr 2021 08:09:23 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D65B4203F; Fri, 9 Apr 2021 08:09:23 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 9 Apr 2021 08:09:23 +0000 (GMT) From: Thomas Richter To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org Cc: svens@linux.ibm.com, gor@linux.ibm.com, sumanthk@linux.ibm.com, hca@linux.ibm.com, Thomas Richter Subject: [PATCH] perf ftrace: Command fails on s390 Date: Fri, 9 Apr 2021 10:09:12 +0200 Message-Id: <20210409080912.2960595-1-tmricht@linux.ibm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: sTKAVn5_S4EkFvKp8EGEFBoeb9Zes4bc X-Proofpoint-GUID: sTKAVn5_S4EkFvKp8EGEFBoeb9Zes4bc X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-09_04:2021-04-08,2021-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 mlxlogscore=999 spamscore=0 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104090059 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Command 'perf ftrace -v -- ls' fails in s390 (at least 5.12.0rc6). The root cause is a missing pointer dereference which causes an array element address to be used as PID. Fix this by extracting the PID. Output before: # ./perf ftrace -v -- ls function_graph tracer is used write '-263732416' to tracing/set_ftrace_pid failed: Invalid argument failed to set ftrace pid # Output after: ./perf ftrace -v -- ls function_graph tracer is used # tracer: function_graph # # CPU DURATION FUNCTION CALLS # | | | | | | | 4) | rcu_read_lock_sched_held() { 4) 0.552 us | rcu_lockdep_current_cpu_online(); 4) 6.124 us | } Signed-off-by: Thomas Richter --- tools/perf/builtin-ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index d49448a1060c..87cb11a7a3ee 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -289,7 +289,7 @@ static int set_tracing_pid(struct perf_ftrace *ftrace) for (i = 0; i < perf_thread_map__nr(ftrace->evlist->core.threads); i++) { scnprintf(buf, sizeof(buf), "%d", - ftrace->evlist->core.threads->map[i]); + perf_thread_map__pid(ftrace->evlist->core.threads, i)); if (append_tracing_file("set_ftrace_pid", buf) < 0) return -1; } -- 2.30.2