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.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham 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 31D23C4363D for ; Thu, 24 Sep 2020 14:38:07 +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 C2E8823741 for ; Thu, 24 Sep 2020 14:38:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="06GIdeNN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B5rOfAQG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2E8823741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=dc0kKFJI/3vhR7BSie9MHmfgkCfAdnu+6NDlX/94EpQ=; b=06GIdeNNptcayv1n+XUKmvYtd GI6+cH6i86rHFDh7rgL+bQNEHaRkdQ3uEwG8tpEU1BAsvFMU4nBy0LhqpsxAuyK5K5LqEJpQp6DL7 jvH/S8iYcLFlarz89MOFgv6So2qXAIWJnGL9QrhlDkXsE1lCKAyzEGs99LnsDIYGsBkqVaUGndAPj CP4poxRk5R8/JcePze/Dl3Xb6io7Ks7WkoQcoo/lbhlZwQMBXf8B8OM4uPP6EHtjbAGJWczdTtER4 Cjz1LtDIuSum9tCr7pGO4+UJmwVfpHradxhq/ZBVeeVg5a/Yx8yqmW6OuRW8KfPzx2BknCzxmfAhW IyvKPJE6g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLSMP-0005pD-Ej; Thu, 24 Sep 2020 14:36:37 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLSMM-0005nL-Ov for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 14:36:36 +0000 Received: by mail-pg1-x543.google.com with SMTP id 197so792885pge.8 for ; Thu, 24 Sep 2020 07:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/t8PieN/eFPss7Qpw0jjxSzLNSWlXorRRsXxHO8bkrw=; b=B5rOfAQGAlGeVxwr/0IYp/Z9JGcqYTy72x+HQEwDfYQWEybUAgy5tukLTTH7WtxQan OPiu/ZlDVa62RVJi7WPmsJS8RzFHcrH4wV0cS4nDJFxT/OlTuw8/01/Bo1anPFZgbtcu dPXqMy8YcQPK7f3t+qx9DbRlekyLuKIuyHfPFACkrrmfop/W9vQsPuj0LwRySTR/++Bq J8LNbND9KcnKgBpxRVGT2uXTkHp1mpnEzgPFo6/FtFqpWiehDdtcBY2w0utkHgAm+Kwf KY4goQvP9EEJ11U3AkUcPUNmQDEIN9JpFbD83oPLXkgJyoTx9wZ+xHJCx9j4zLHMgKQu pPgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=/t8PieN/eFPss7Qpw0jjxSzLNSWlXorRRsXxHO8bkrw=; b=K/DEHSj5fAhwSguwtWpRZyPZ7ImdMRpv1vDqmsz31D0/n4TxaEVPHPzhQqwX7+t93x fKJo/u5Pb3RbUewiDMMugqTaZq8+AuBurdaD+9hsifMWoJkO01rzqoMn+VuLKocE+1W6 N3SBbtuik3beoQJmdlSPKvZTCDE8iTtkHryvts7pgHdiYzfqKEFsaPr64BTPyFANLaBX gHFwpD2BiJqy8Ku4yj3Rphwe09AkevDTfdZ4GiSnYp6J9voK872iudgtjuO9h9zgBito mDl41kT8de8zo5sHhr0CxxTvEseoiFhHu1u1MdaePVZ3qCCl4ICFRhywu5LE0sSKymPV MXGA== X-Gm-Message-State: AOAM530jQRwFHKI141oNC5siM+nwkoGbkRU4CH63T60YGudi9YgPwX56 PE08u+11BsgX7UuWTt25+ag= X-Google-Smtp-Source: ABdhPJy9e27mTknYv36d4JU7GC59hiPiimY7cgOXFCU24o+AeS3RgImChNT3If7MjETsBzgL9tuwBg== X-Received: by 2002:a62:7fcf:0:b029:151:15e0:ab82 with SMTP id a198-20020a627fcf0000b029015115e0ab82mr4825933pfd.80.1600958190712; Thu, 24 Sep 2020 07:36:30 -0700 (PDT) Received: from google.com ([101.235.31.111]) by smtp.gmail.com with ESMTPSA id y1sm3341813pgy.0.2020.09.24.07.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 07:36:29 -0700 (PDT) Date: Thu, 24 Sep 2020 23:36:23 +0900 From: Namhyung Kim To: Jiri Olsa Subject: Re: [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events Message-ID: <20200924143623.GA357648@google.com> References: <20200922031346.15051-1-liwei391@huawei.com> <20200922031346.15051-2-liwei391@huawei.com> <20200923054426.GG2893484@krava> <20200923140747.GN2893484@krava> <20200923201900.GQ2893484@krava> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200923201900.GQ2893484@krava> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_103634_827132_FF608335 X-CRM114-Status: GOOD ( 24.69 ) 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 , Wei Li , 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 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); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel