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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,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 87C91C4363D for ; Fri, 2 Oct 2020 09:01:16 +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 152CF20719 for ; Fri, 2 Oct 2020 09:01:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NiV2NYkz"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="coXGkzvI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 152CF20719 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=+Htd21Ll8DuWw0mu9mXY3ClqC/iyDYvqdqPXDD9aVsc=; b=NiV2NYkzTNe+pBqa56q7tbcby KSYQX8g0MvoXn5OxncwW+orltBu7tuimBTfchGTKSw+scHhTePUk7P0il9Ah0VE6UWtBHmZGHAAQ1 +g+ttq1cKDNd2OqtMniHsEkDUgPHdKAWdV0BL0mMzFvuAw7MWQeHDWRHJ1Wij7OYDxfKqnKGThIad 7tDHIck9N1JyYf4xlWqv5aAiBKNleWboDmhEXtdrgZ5IJ8qKDydM5jboStP7518xh7GVu/HTF64w6 AQ7vVmbK4K+KHE0dxVV03/834MKQXvZxOnGbrPEJveLS1tH8767zuQDJSqlsz+QPRRD64kd3ZnV0S UE7ZdSwdg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOGuv-0002na-RK; Fri, 02 Oct 2020 08:59:53 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOGus-0002mV-7m for linux-arm-kernel@lists.infradead.org; Fri, 02 Oct 2020 08:59:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601629186; 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=JY/xYOWXgW3YizpSB7JHHJ7rgxiMthV5yILxf4kE9ow=; b=coXGkzvIgHi6yYDqTHfVur1uYIXQn1Y7aQ25CzVmm9tHZwTCxaYBcXGV8C6ZcpvNXlj9tT visWW6YDc/qq74DKkNb9ulEQjc8XdtqCmhCPrKBcfQxhGq2ITIHaPs3VkFuH/6C+8eZSl8 hpJdb21Ycd6oaCg+WGXn94JqMRfBy4w= 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-589-QzRZ7MVOOASGhdKUHg-GdQ-1; Fri, 02 Oct 2020 04:59:43 -0400 X-MC-Unique: QzRZ7MVOOASGhdKUHg-GdQ-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 D66F010BBED0; Fri, 2 Oct 2020 08:59:40 +0000 (UTC) Received: from krava (unknown [10.40.194.184]) by smtp.corp.redhat.com (Postfix) with SMTP id 31EEA19C71; Fri, 2 Oct 2020 08:59:37 +0000 (UTC) Date: Fri, 2 Oct 2020 10:59:36 +0200 From: Jiri Olsa To: Namhyung Kim , Wei Li Subject: Re: [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events Message-ID: <20201002085936.GE3999500@krava> References: <20200922031346.15051-1-liwei391@huawei.com> <20200922031346.15051-2-liwei391@huawei.com> <20200923054426.GG2893484@krava> <20200923140747.GN2893484@krava> <20200923201900.GQ2893484@krava> <20200924143623.GA357648@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200924143623.GA357648@google.com> 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-20201002_045950_307334_389BFC56 X-CRM114-Status: GOOD ( 30.14 ) 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 , Andi Kleen , Li Bin , Ingo Molnar , 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 Thu, Sep 24, 2020 at 11:36:23PM +0900, Namhyung Kim wrote: > On Wed, Sep 23, 2020 at 10:19:00PM +0200, Jiri Olsa wrote: > > On Wed, Sep 23, 2020 at 11:15:06PM +0900, Namhyung Kim wrote: > > > I think the problem is that armv8_pmu has a cpumask, > > > and the user requested per-task events. > > > > > > The code tried to open the event with a dummy cpu map > > > since it's not a cpu event, but the pmu has cpu map and > > > it's passed to evsel. So there's confusion somewhere > > > whether it should use evsel->cpus or a dummy map. > > > > you're right, I have following cpus file in pmu: > > > > # cat /sys/devices/armv8_pmuv3_0/cpus > > 0-3 > > > > covering all the cpus.. and once you have cpumask/cpus file, > > you're system wide by default in current code, but we should > > not crash ;-) > > > > I tried to cover this case in patch below and I probably broke > > some other use cases, but perhaps we could allow to open counters > > per cpus for given workload > > > > I'll try to look at this more tomorrow > > I'm thinking about a different approach, we can ignore cpu map > for the ARM cpu PMU and use the dummy, not tested ;-) > > Thanks > Namhyung > > > diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c > index 2208444ecb44..cfcdbd7be066 100644 > --- a/tools/lib/perf/evlist.c > +++ b/tools/lib/perf/evlist.c > @@ -45,6 +45,9 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist, > if (!evsel->own_cpus || evlist->has_user_cpus) { > perf_cpu_map__put(evsel->cpus); > evsel->cpus = perf_cpu_map__get(evlist->cpus); > + } else if (!evsel->system_wide && perf_cpu_map__empty(evlist->cpus)) { > + perf_cpu_map__put(evsel->cpus); > + evsel->cpus = perf_cpu_map__get(evlist->cpus); > } else if (evsel->cpus != evsel->own_cpus) { > perf_cpu_map__put(evsel->cpus); > evsel->cpus = perf_cpu_map__get(evsel->own_cpus); > Wei Li, is this fixing your problem? thanks, jirka _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel