From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 839CDC4363D for ; Wed, 23 Sep 2020 14:09:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 271542220D for ; Wed, 23 Sep 2020 14:09:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MAZKQ5oA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AcSfhccM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 271542220D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ljZgwnEzBriVrs9sHdINXxqt953O1vFhXxJ5huTzHLw=; b=MAZKQ5oAzbVjJO2TUpIrqLpFS PtD6vvJ9s09Ex0gMjx9q1O082MII1H4Voip2inMc3QcC4WnlzPJvGYRkziFmkp53XcTpUpIpDan+f dks9io49QsjCdlM5hcY2Y9zd+k8ttmDHG8Yj1FznBfUDstOTbSjY+9etAzWo7FTHcI6FDevanr8Nt OFdD3r1ft1ZAwSJMbuWMKcAzHTJfsaWBB1YLcDd/8OVnH/gyl1T1jJppuEVrnZMv3uqxWjmyWfq7S DS6Bus8ixzT6Oco57WvfX01qU4tyEFDfed6sSSES4NWgGebgS9TBqlnAvkPQb98qNAZdY3S7vD81A 3Q48Qf4Cw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kL5RD-0004bs-MP; Wed, 23 Sep 2020 14:08:03 +0000 Received: from us-smtp-1.mimecast.com ([207.211.31.81] helo=us-smtp-delivery-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kL5R9-0004Zv-CE for linux-arm-kernel@lists.infradead.org; Wed, 23 Sep 2020 14:08:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600870077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=it2WE8HSky4eTkM1IOAj4PM/27T11fCRsFPmvTOl5jQ=; b=AcSfhccMY1zRdRDL54VnEp+fP+ibHy9ke4p/cJCCYeW7KTFDIcBoKa8C4/0ua4AOWTcvfs /3oFfblpxKF8w0saB+QRNRm/znqJq7s5Yj0mPXyAa8Sl6P44GLk5BnFmpziQP75yKYWiXR oohRDTRCqPTQDc+bEqFfrNa3b/Oy4oc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-547-yEBWGn5SPUSTUFLSvc4jVw-1; Wed, 23 Sep 2020 10:07:55 -0400 X-MC-Unique: yEBWGn5SPUSTUFLSvc4jVw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76B131007B04; Wed, 23 Sep 2020 14:07:53 +0000 (UTC) Received: from krava (unknown [10.40.192.120]) by smtp.corp.redhat.com (Postfix) with SMTP id 1E72419C4F; Wed, 23 Sep 2020 14:07:48 +0000 (UTC) Date: Wed, 23 Sep 2020 16:07:47 +0200 From: Jiri Olsa To: Namhyung Kim Subject: Re: [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events Message-ID: <20200923140747.GN2893484@krava> References: <20200922031346.15051-1-liwei391@huawei.com> <20200922031346.15051-2-liwei391@huawei.com> <20200923054426.GG2893484@krava> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_100759_461189_B65CD525 X-CRM114-Status: GOOD ( 24.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Andi Kleen , Alexander Shishkin , Alexey Budankov , Adrian Hunter , Arnaldo Carvalho de Melo , linux-kernel , Peter Zijlstra , Ingo Molnar , Li Bin , Wei Li , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Sep 23, 2020 at 10:49:52PM +0900, Namhyung Kim wrote: > On Wed, Sep 23, 2020 at 2:44 PM Jiri Olsa wrote: > > > > On Tue, Sep 22, 2020 at 11:13:45AM +0800, Wei Li wrote: > > > When executing perf stat with armv8_pmu events with a workload, it will > > > report a segfault as result. > > > > please share the perf stat command line you see that segfault for > > It seems the description in the patch 0/2 already has it: > > [root@localhost hulk]# tools/perf/perf stat -e > armv8_pmuv3_0/ll_cache_rd/,armv8_pmuv3_0/ll_cache_miss_rd/ ls > > /dev/null > Segmentation fault yea I found it, but can't reproduce it.. I see the issue from patch 2, but not sure what's the problem so far jirka > > Thanks > Namhyun > > > > > > thanks, > > jirka > > > > > > > > (gdb) bt > > > #0 0x0000000000603fc8 in perf_evsel__close_fd_cpu (evsel=, > > > cpu=) at evsel.c:122 > > > #1 perf_evsel__close_cpu (evsel=evsel@entry=0x716e950, cpu=7) at evsel.c:156 > > > #2 0x00000000004d4718 in evlist__close (evlist=0x70a7cb0) at util/evlist.c:1242 > > > #3 0x0000000000453404 in __run_perf_stat (argc=3, argc@entry=1, argv=0x30, > > > argv@entry=0xfffffaea2f90, run_idx=119, run_idx@entry=1701998435) > > > at builtin-stat.c:929 > > > #4 0x0000000000455058 in run_perf_stat (run_idx=1701998435, argv=0xfffffaea2f90, > > > argc=1) at builtin-stat.c:947 > > > #5 cmd_stat (argc=1, argv=0xfffffaea2f90) at builtin-stat.c:2357 > > > #6 0x00000000004bb888 in run_builtin (p=p@entry=0x9764b8 , > > > argc=argc@entry=4, argv=argv@entry=0xfffffaea2f90) at perf.c:312 > > > #7 0x00000000004bbb54 in handle_internal_command (argc=argc@entry=4, > > > argv=argv@entry=0xfffffaea2f90) at perf.c:364 > > > #8 0x0000000000435378 in run_argv (argcp=, > > > argv=) at perf.c:408 > > > #9 main (argc=4, argv=0xfffffaea2f90) at perf.c:538 > > > > > > After debugging, i found the root reason is that the xyarray fd is created > > > by evsel__open_per_thread() ignoring the cpu passed in > > > create_perf_stat_counter(), while the evsel' cpumap is assigned as the > > > corresponding PMU's cpumap in __add_event(). Thus, the xyarray fd is created > > > with ncpus of dummy cpumap and an out of bounds 'cpu' index will be used in > > > perf_evsel__close_fd_cpu(). > > > > > > To address this, add a flag to mark this situation and avoid using the > > > affinity technique when closing/enabling/disabling events. > > > > > > Fixes: 7736627b865d ("perf stat: Use affinity for closing file descriptors") > > > Fixes: 704e2f5b700d ("perf stat: Use affinity for enabling/disabling events") > > > Signed-off-by: Wei Li > > > --- > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel