Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4198455pxk; Tue, 22 Sep 2020 12:55:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1gntwU9LojMV0d/SVpBx20fmRbXGBEOUWeIPUpJD8+rwpzj16N32z0lNrXsoSxJ3X/Aof X-Received: by 2002:a17:907:374:: with SMTP id rs20mr6947965ejb.135.1600804510390; Tue, 22 Sep 2020 12:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600804510; cv=none; d=google.com; s=arc-20160816; b=Z03L1luy/PUOB2MbgyWlyb89nEgeh37ni9IPXGvWILsESokgjQonALyHnyxtinym8l cSk3VOr4OHPN9Uyf8nbKt2RYiI5gFfWPXmKR7vRWDLMlcdv/x9Ewk26WH7xnX37q6R88 LFBkquiHnjgRpsYP7MVuVlwgiMWXVa2VX4SYdVPmsrzYF4+Tb7rweGfEDsijd+qZWxAD SUwiWMLvSUkFqXvSo+OVAlNSKe8YwFIwhNkrys7y3EBZVT5V3VRTM4lgYXetJAJJnCW6 O+EyHD+0t2DcWBO8CPldviEdf7sg0mknjeEFCYK51n/6F6vgF5AfeSiJIfnh7C3nDNHL a8Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=r1UwpEL6wfHYtfbMaMrbk8QfZL592/jJ5vAVT/D9Cc4=; b=juylcBdLHBL10XoZnn3/j1rUK0WsdxJy/mpPg2x3cWL9ubjLb5/vJhktZSOdIezndQ CWQGMjV3yL9C5Srn/7eBgKfTlmg+31H6wwZg6Psrzwy2xMtOYvn+atBPCBYZ4ljlaN8A NVX+Y27SG0bymMof8Rxg3uEBDzP32KrbUniH3TOb0IHjpG9+dYv+Zajt6dyepCaQRUib WyAjFA1hqnpLwP8+73BGrbezTm8cxWxPeCrT1tJZsUqL1aqdeIhs942eVcRK9lDucPDF vRMwRHu8jfsO4PerucfjHE9QRR+0gshYDpoXgaKIcA4DDKQY04k2wtPU3hB3/lvNCj4x gXww== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si10884130edl.52.2020.09.22.12.54.22; Tue, 22 Sep 2020 12:55:10 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726629AbgIVTun (ORCPT + 99 others); Tue, 22 Sep 2020 15:50:43 -0400 Received: from mga07.intel.com ([134.134.136.100]:21699 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgIVTun (ORCPT ); Tue, 22 Sep 2020 15:50:43 -0400 IronPort-SDR: MUl1UcJZw/fESt+MydABCh26nT+d5X2MSA+tFuKsKrfbTcaDyFu60yrBRorYGDauSvfqnm7naj yKT9WsUxD8gQ== X-IronPort-AV: E=McAfee;i="6000,8403,9752"; a="224854573" X-IronPort-AV: E=Sophos;i="5.77,291,1596524400"; d="scan'208";a="224854573" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 12:50:39 -0700 IronPort-SDR: 5Zp3q7bqiagXrW4yXDtHWAo51m8BHS/JEsCqhw7KJSPsSoW8cYjsLPjvGoTR0UQ7o79MSH5dS2 +iq1S16j2z/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,291,1596524400"; d="scan'208";a="291411874" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.54.74.11]) by fmsmga008.fm.intel.com with ESMTP; 22 Sep 2020 12:50:35 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 4B453301C71; Tue, 22 Sep 2020 12:50:35 -0700 (PDT) Date: Tue, 22 Sep 2020 12:50:35 -0700 From: Andi Kleen To: Wei Li Cc: Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexey Budankov , Adrian Hunter , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, huawei.libin@huawei.com Subject: Re: [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events Message-ID: <20200922195035.GA42577@tassilo.jf.intel.com> References: <20200922031346.15051-1-liwei391@huawei.com> <20200922031346.15051-2-liwei391@huawei.com> <20200922192321.GL13818@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922192321.GL13818@tassilo.jf.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 12:23:21PM -0700, Andi Kleen wrote: > > 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. > > The flag seems like a hack. How about figuring out the correct number of > CPUs and using that? Also would like to understand what's different on ARM64 than other architectures. Or could this happen on x86 too? -Andi