Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3056197rwe; Mon, 29 Aug 2022 05:14:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MVtxth/pTzMuExp/8z3wIQGgAO0tMzkMmi/veERwVxEU/2qnzsYWK+zpAiMem6kL1t1me X-Received: by 2002:a63:e911:0:b0:429:f942:b78c with SMTP id i17-20020a63e911000000b00429f942b78cmr13844091pgh.538.1661775271144; Mon, 29 Aug 2022 05:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775271; cv=none; d=google.com; s=arc-20160816; b=zawcNlhReZItGWOL9Fr7rLpiUveKMQuG4PsO7iHNou5O0J+hocHdPNRrzSlxiD2F0J tREYrXCjvQNIxb9kqEUkImRa/5pU1GWgICDUu2D4PgDwESPR8h141rE19bMOUAgxNqWp Yk7KPfDX3ivr+JBYVvUqJSr3EAM1l7yjJrsfLiPjiBh1ltAit90qZFyZfqEkAIQc2BSe 2QoHn12wi0iV4etsNo/tryL6zBb21tqokvb89e824nw+P2oRjv4phSgk0k9glS4zn+81 iAIPe7wijFv8R0BYbDPoN78odRF90IAhWLElJuOKMCIMh3PG+2hQvNbVkpKt1yOgZoKr aZlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DamoZYiP9T6iAzViN9OvQayjMg5XEqYjXXxg1SF5UtU=; b=pPmYKLGPMU/n+n4+ab+Yzv38jFUuQEELk++J3LdvnJT/jK2LAPTAaci0bThSfcxSKM dXnck6tulkrFNt1+2onRx1W9YsAl0CDzcrp3YLXFa/I7sEI4uJe97DWzOzl+4EMfXEAh mY/oslwoC632LAh+MIRktpHUvmLaG7mzHgsilajjTzO+xRN2buGYCyRgwsb7ZtZfku6e 65T+k5wIcmi2sof9+VArijRc+CCWwtIODfTXGWygcWd6nR4KFdp1IflxSYYCcsMnay4p O81oSe3gB/P05gbjh8iJ7G6kfkAl/fs1WJ1vb/HP0cm3ZQByQZsQ2g83b5LO58Chz1z4 4HHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IEBJB+AX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a63d954000000b0042b30fbdd76si9333418pgj.779.2022.08.29.05.14.19; Mon, 29 Aug 2022 05:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IEBJB+AX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232772AbiH2LiX (ORCPT + 99 others); Mon, 29 Aug 2022 07:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232877AbiH2LhN (ORCPT ); Mon, 29 Aug 2022 07:37:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A77575CC5; Mon, 29 Aug 2022 04:21:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 49C036119E; Mon, 29 Aug 2022 11:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12405C433C1; Mon, 29 Aug 2022 11:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771939; bh=GFQv9vkR482Mkq74XKiTv2cwC/MfcG8EE0eFatIffww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IEBJB+AX/9s7y5/avodcBExsmrtrPiNO2aQ6kB+Nia6BpsCu5XY9uGruTD9b4x+5D fFuowpbm8QRqDTQTdiZN6sEU9tu2vRoG+VQZDIlkHBJQodJzBgMQDPdjBk/mpI5XFd rSxUIQKf+s7PABwOMh9SBGWKGhv8MNqqMGAMeKys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andi Kleen , Ian Rogers , Arnaldo Carvalho de Melo , Xing Zhengjun , Alexander Shishkin , Ingo Molnar , Jiri Olsa , Kan Liang , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian Subject: [PATCH 5.19 146/158] perf stat: Clear evsel->reset_group for each stat run Date: Mon, 29 Aug 2022 12:59:56 +0200 Message-Id: <20220829105815.221622515@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Rogers commit bf515f024e4c0ca46a1b08c4f31860c01781d8a5 upstream. If a weak group is broken then the reset_group flag remains set for the next run. Having reset_group set means the counter isn't created and ultimately a segfault. A simple reproduction of this is: # perf stat -r2 -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}:W which will be added as a test in the next patch. Fixes: 4804e0111662d7d8 ("perf stat: Use affinity for opening events") Reviewed-by: Andi Kleen Signed-off-by: Ian Rogers Tested-by: Arnaldo Carvalho de Melo Tested-by: Xing Zhengjun Cc: Alexander Shishkin Cc: Andi Kleen Cc: Ingo Molnar Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: https://lore.kernel.org/r/20220822213352.75721-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/builtin-stat.c | 1 + 1 file changed, 1 insertion(+) --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -826,6 +826,7 @@ static int __run_perf_stat(int argc, con } evlist__for_each_entry(evsel_list, counter) { + counter->reset_group = false; if (bpf_counter__load(counter, &target)) return -1; if (!evsel__is_bpf(counter))