Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp523048yba; Wed, 3 Apr 2019 13:32:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk8GUXe5qbtrADYodNSoGK3kPeuxL2EXrNE+IJ3kww3vgS5KMMKuqx8TcsaKFgvMaDwcoS X-Received: by 2002:a17:902:7043:: with SMTP id h3mr2149753plt.228.1554323559504; Wed, 03 Apr 2019 13:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554323559; cv=none; d=google.com; s=arc-20160816; b=sJvQF8Y1nt1C+EaI77q2lVtq/K0G2uSRB7S1nLQl8127SSoEkYI0QuN03J5bBA2yP5 l2cOkIf/SFiIvCMiZEG+ohs+iGXF7p3uafd+r12GSKp3+hHEjgUCCZI8hWQGZwy/Xwgx d33HPRF17oZNGwSEpzrws0ToTw9oNM25MU1ySMIMZszcLPiFJROW8bwrKHvjdbuC2mz3 ztjprrWfZqTSSt44wj4jEDCVcEt95dnzdl1iWdNIafA5xd/rRwXZbtacBey+TSSdKT/u IH6ebXzaM5eF9rnpl7FCycFK9KPsEKqtu4n4RH4HyCD/mGWbUXKZ60iBbYAJ4DWyjaya r+0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pABrYDISlrhXz6Arfm5w8XYTATVi1a4LMh0QM9Kxq98=; b=u2rT175cwiFngCRgyo8YUZYZoX42Klxsq6HCoq9MyXoqwG3cb/GvMdfvi0o/thgIDW LahIS6+6a+f0KbMcNuC37Ym5cxq+REfQ0LV1SunLMbo41CPRtjepfAJ4zJhixj0mpGwQ UAGudGB57d0rhK7JkIObVgOsx6w1k39nEFiDxpZjpFcwCPlBdjeBj5m8TlRrGHO5grEb arKLGEkXORQwljtUEjpG0FCZch9BoJ5QrrnMCFWgWO/cQisxRT8HW0iVRTMFAm2L2ZTD CfdcSxiHJbyEH1fgvpwCXN9uQplMSnIORV8nO3MFcRK8PmTsXoLDhf/Otz7i5UsGtByy 6oJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="DzyyDt8/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4si12802970pga.39.2019.04.03.13.32.23; Wed, 03 Apr 2019 13:32:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="DzyyDt8/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726218AbfDCUbt (ORCPT + 99 others); Wed, 3 Apr 2019 16:31:49 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:42277 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbfDCUbs (ORCPT ); Wed, 3 Apr 2019 16:31:48 -0400 Received: by mail-lj1-f193.google.com with SMTP id v22so39132lje.9 for ; Wed, 03 Apr 2019 13:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pABrYDISlrhXz6Arfm5w8XYTATVi1a4LMh0QM9Kxq98=; b=DzyyDt8/Y9BoFn/WPDFfW+mqWzl+pyFSXt2enHQUr5EZAL7xROhldNF32ZxbGgVy7b +jVA0jXo3KbNL9Jcb2g1AakszpF5zircP1i+PxatHUcIce0teGAo0N4V1sbwJ69SvzxM mxwHjJi9K/fpCtKClrdIwJ1yzm4KnEY+jpZlGB7nrFLjLPmNKGw1ESVVLz3KKS8S4WcI X/x1RZ6Wh1pJVd31j2KGJbtX04/fn+e7D9kiUUr0uAf3QE7IdXNGoDRTHC1cNzpqLysZ 1UN+SWBChdcRSyL6DosltQhKsqwb7P62i3taAv7uYpYxQxJY0+/KwQyLZPfgjVJxZNZ7 df/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pABrYDISlrhXz6Arfm5w8XYTATVi1a4LMh0QM9Kxq98=; b=EvWecj7JYCNy/ch+ubhYYuA+7L1FnAWU2Bg9+L+hT16xu7i5X0dRqplqZpG6Lt/S38 nkqHxexwRmK0+BWrBTgod0kvGx1OqT6hSjhWenBoEiwPT3Gj693rhJBR8YBwutwG07r9 UrqlA9WJG8YoDDMxlKuQZAB4cFrMb7cm0FpjmtfVX1mXm0aITygT5Dpf0vtJ+GNWoGyI zzSA5bvYDj1YeJ0Bs3bFWQUkSDwAEZCj/XFT2QBhsJ+mhRcPpGM1Rb7NVGJs/m7+G5JR vv7NkEkMz0niFd/gb/yzs5AjB4sbWjIKNd94cSrEBDOE4PbFutURFEOO0Gd7maITbTI/ Sn1A== X-Gm-Message-State: APjAAAUnz1LK/BMyp206G23EVcZ4d+uQudpkQleCyhDusedmeE6+sDpY Ng4uYSBrYCD9HlKWt8FpEEY= X-Received: by 2002:a2e:8787:: with SMTP id n7mr1008341lji.31.1554323506748; Wed, 03 Apr 2019 13:31:46 -0700 (PDT) Received: from uranus.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id t29sm3463001ljd.82.2019.04.03.13.31.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 13:31:45 -0700 (PDT) Received: by uranus.localdomain (Postfix, from userid 1000) id C6F0846041D; Wed, 3 Apr 2019 23:31:44 +0300 (MSK) Date: Wed, 3 Apr 2019 23:31:44 +0300 From: Cyrill Gorcunov To: Vince Weaver Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Alexander Shishkin , Ingo Molnar , Borislav Petkov , Namhyung Kim , Thomas Gleixner , Jiri Olsa , Stephane Eranian Subject: Re: perf: perf_fuzzer crashes on Pentium 4 systems Message-ID: <20190403203144.GI1421@uranus.lan> References: <20190403191944.GH1421@uranus.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190403191944.GH1421@uranus.lan> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 03, 2019 at 10:19:44PM +0300, Cyrill Gorcunov wrote: > > You know, seems I got what happened -- p4_general_events do > not cover all general events, they stop at PERF_COUNT_HW_BUS_CYCLES, > while more 3 general event left. This is 'cause I've not been following > pmu evolution in code. I will try to cover this events hopefully more > less soon and send you a patch to test (if you don't mind). Still this should not cause nil deref, continue investigating. Vince could oyu please apply the patch below, I doubt if it help with nil issue but worth having anyway --- From: Cyrill Gorcunov Subject: [PATCH] perf/x86/intel/p4: Limit p4_general_events down to real ones p4_general_events are allocated up to PERF_COUNT_HW_MAX while this constant is bigger than the number of general events we do support by now. Thus the all other entries are equal to zero and maps to P4_EVENT_TC_DELIVER_MODE which is wrong of course. Instead drop off PERF_COUNT_HW_MAX constant from declaration, we use ARRAY_SIZE for max_events. Signed-off-by: Cyrill Gorcunov --- arch/x86/events/intel/p4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-tip.git/arch/x86/events/intel/p4.c =================================================================== --- linux-tip.git.orig/arch/x86/events/intel/p4.c +++ linux-tip.git/arch/x86/events/intel/p4.c @@ -648,7 +648,7 @@ static u64 p4_get_alias_event(u64 config return config_match | (config & P4_CONFIG_EVENT_ALIAS_IMMUTABLE_BITS); } -static u64 p4_general_events[PERF_COUNT_HW_MAX] = { +static u64 p4_general_events[] = { /* non-halted CPU clocks */ [PERF_COUNT_HW_CPU_CYCLES] = p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_GLOBAL_POWER_EVENTS) |