From patchwork Tue Feb 7 03:50:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 53626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2629761wrn; Mon, 6 Feb 2023 19:53:54 -0800 (PST) X-Google-Smtp-Source: AK7set8p0pI8H6hmwkELx0Q7UYvWLgXbOWTHI0XJU6q4Uh/cWUj9cuagbpW2HhWewJf/2lnuFmvA X-Received: by 2002:a05:6a21:6d9b:b0:bc:bae7:642f with SMTP id wl27-20020a056a216d9b00b000bcbae7642fmr2257977pzb.58.1675742034035; Mon, 06 Feb 2023 19:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675742034; cv=none; d=google.com; s=arc-20160816; b=ycj6a45Gs0m8wo83CMqgdmODOOFTYxWCdt6h4HWQuQRvkdVq5Fh7UlnX/5zC+4m3mE 4sOBYJvWMjDs8I+9gezaHZPry8bw93mYWbCSAuNlJtUtWIU+ESgUZtJxTS5HVXkncuGw fWC4+vnaPqN8vj8I7poG5bJVhUSwFRP5nWVepjuaoi2TnamCuQ8CAe/0+p1Nxh/ojpR3 CCgGam5i6MbCik3b536gHL/LWF74XKK8E09nfW0UPJS8LTD8ukTutWn5JQwrAlOO5DIm p8UtMt8O9MmHWQIHb/OfiPAn+Z4hqcNarfbhYISPjWqVU3wKP5XnLFoed6ucpmN29Ixw p9XA== 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; bh=W3mutvuItj7xOoTulgci5uaRtvKanUnC/3j9qOALhT4=; b=XxDfVZgbfhs3S7cixBTAV6j3AWaL+ZQ1+rZ9pK+i79NbveeQkFL6s8v9UgkjTUmif6 Tzzf2vfo6PgRcY1JzTBpQh/+My9MTStO8//PON8ON2mhxV/zc+EtueKisb6X9RVIRk9o FkO8XARfB4H7t7OkQaXoUXRMxbBBhanB9LgKxkIimxXxpVhoeeNq0ifuqZ62k0dID52y IeToR2SwhORcpYfTsEwOku8e3Snnj6dprRxwIBXIOnhgdbqIXblEh51ywOq0KxZ3rq5W Y/HyjQWSxkwYkT8KJOfyJyn6pX4SQYmm5KwVLdaXZ/Z65UD6AY/Inl9TTpCTPRrrYZTF ydAQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a62a514000000b00587cafeea1bsi12920509pfm.379.2023.02.06.19.53.41; Mon, 06 Feb 2023 19:53:54 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229874AbjBGDvQ (ORCPT + 99 others); Mon, 6 Feb 2023 22:51:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjBGDvO (ORCPT ); Mon, 6 Feb 2023 22:51:14 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8A14421E; Mon, 6 Feb 2023 19:51:12 -0800 (PST) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4P9pyh2Z32znW3W; Tue, 7 Feb 2023 11:49:00 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 7 Feb 2023 11:51:10 +0800 From: Yicong Yang To: , , , , , , , , , CC: , , , Subject: [PATCH] perf tools: Fix auto-complete on aarch64 Date: Tue, 7 Feb 2023 11:50:57 +0800 Message-ID: <20230207035057.43394-1-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757142879348170438?= X-GMAIL-MSGID: =?utf-8?q?1757142879348170438?= From: Yicong Yang On aarch64 CPU related events are not under event_source/devices/cpu/events, they're under event_source/devices/armv8_pmuv3_0/events on my machine. Using current auto-complete script will generate below error: [root@localhost bin]# perf stat -e ls: cannot access '/sys/bus/event_source/devices/cpu/events': No such file or directory Fix this by not test /sys/bus/event_source/devices/cpu/events on aarch64 machine. Fixes: 74cd5815d9af ("perf tool: Improve bash command line auto-complete for multiple events with comma") Signed-off-by: Yicong Yang Reviewed-by: James Clark --- tools/perf/perf-completion.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh index fdf75d45efff..978249d7868c 100644 --- a/tools/perf/perf-completion.sh +++ b/tools/perf/perf-completion.sh @@ -165,7 +165,12 @@ __perf_main () local cur1=${COMP_WORDS[COMP_CWORD]} local raw_evts=$($cmd list --raw-dump) - local arr s tmp result + local arr s tmp result cpu_evts + + # aarch64 doesn't have /sys/bus/event_source/devices/cpu/events + if [[ `uname -m` != aarch64 ]]; then + cpu_evts=$(ls /sys/bus/event_source/devices/cpu/events) + fi if [[ "$cur1" == */* && ${cur1#*/} =~ ^[A-Z] ]]; then OLD_IFS="$IFS" @@ -183,9 +188,9 @@ __perf_main () fi done - evts=${result}" "$(ls /sys/bus/event_source/devices/cpu/events) + evts=${result}" "${cpu_evts} else - evts=${raw_evts}" "$(ls /sys/bus/event_source/devices/cpu/events) + evts=${raw_evts}" "${cpu_evts} fi if [[ "$cur1" == , ]]; then