Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp585763iog; Mon, 13 Jun 2022 08:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya3XP6f+97jn0eMama+rv4m7T4iEx7pTJvRDKY1jmaZD62QsKe5Pd6/ftbw1vpdWztfpmb X-Received: by 2002:a17:90a:df91:b0:1e3:4dc8:46e7 with SMTP id p17-20020a17090adf9100b001e34dc846e7mr16307502pjv.106.1655134639004; Mon, 13 Jun 2022 08:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655134638; cv=none; d=google.com; s=arc-20160816; b=Bq3mvJHoRmnUl2YGLrF7hC52zTggU63oS0azs/CQLZeYe1T1Phu3cGDPBDKF7TlkQr GRknCKcVId/aB4Qzj+BdQuGsPksaFOnDJ9ieAi5S3sD2b1pkUlrbh2HZIWW5YRlHvlVD 2S5Cbx2UAn6SHv0Nkj/ieEYxPdlUzrcEMfRkXpyOQiSIBbdZZ9m4j0jdXFqw+O72D+UC q5BPnFGbjPvrqxrU3uy1Y9fkLOhIPjMpnJEQAKc9VojSdE2uRM4u8apQCuaC5MR/SbGt d82YJAJawGlH+p9N36iojuym2EAZapMmTJL8waEHF5at1Tl2SLiFqnEvxCBQi2Z8cjmF mgYA== 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=4aByE4qpU2fF/FZeqAxwqgf9Pukqw2+miL8kRSNhEN4=; b=NBrLtgrSy6zaY3kDmLqu5ilHtriDd62dLGoQ/6uxGMao5HgAl2cI++WD+4Jh+mmXXl n4VX4t/mdSp2qUChFvFPJQ9mLioqXiajxHI79bijnOHjaZ6QT6nVaJ4WkWcdJU84cm70 fxMky5lOBfiaMCPleA5fvmDfHHg2LePRX36BrE4Lv0k36g3dtJ+njL5FSs2pb8JjaVbt eNkN+pQ8YSODp8qJJ3s9eRD7LfPtGMQqlyMQ91DY7l2hOg66LUDYLnIvQ9VseHLWS3w6 OUbvX8rlLOPfHsOSSqOPGjS9f/ohg8rVdWBT3U7jZCGK8M+eT80nNbBCbZ4Jevvuqyvn Z4GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eexn0Qnw; 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 a10-20020a631a0a000000b003fd9834603csi9460133pga.563.2022.06.13.08.37.06; Mon, 13 Jun 2022 08:37:18 -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=eexn0Qnw; 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 S1347664AbiFMKw2 (ORCPT + 99 others); Mon, 13 Jun 2022 06:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348582AbiFMKt2 (ORCPT ); Mon, 13 Jun 2022 06:49:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6827C2E0AA; Mon, 13 Jun 2022 03:27:03 -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 ams.source.kernel.org (Postfix) with ESMTPS id E99FCB80E95; Mon, 13 Jun 2022 10:27:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EF8EC34114; Mon, 13 Jun 2022 10:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116020; bh=jF8jZSlmfxE9qd0ZzdwmSA2Q2KJaePP+dIHkpy2PxbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eexn0QnwuCYVlSiy8YNwCvVdJ8ygPpL9eydaBs10gfeS6U1i4QozJ9LYD94W3u+PZ c4Y446mAbo/zbAmaCHQ1u/UiU7luGoTtGhl+DJvmdI/2UkVHaXerxJSzivWMRB3sv6 ConypoEiq3j1rF4ttJVLAvj27syE3jcfX65ZivUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kan Liang , Xing Zhengjun , Ian Rogers , Adrian Hunter , Alexander Shishkin , Andi Kleen , Ingo Molnar , Jiri Olsa , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 101/218] perf jevents: Fix event syntax error caused by ExtSel Date: Mon, 13 Jun 2022 12:09:19 +0200 Message-Id: <20220613094923.616066466@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 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: Zhengjun Xing [ Upstream commit f4df0dbbe62ee8e4405a57b27ccd54393971c773 ] In the origin code, when "ExtSel" is 1, the eventcode will change to "eventcode |= 1 << 21”. For event “UNC_Q_RxL_CREDITS_CONSUMED_VN0.DRS", its "ExtSel" is "1", its eventcode will change from 0x1E to 0x20001E, but in fact the eventcode should <=0x1FF, so this will cause the parse fail: # perf stat -e "UNC_Q_RxL_CREDITS_CONSUMED_VN0.DRS" -a sleep 0.1 event syntax error: '.._RxL_CREDITS_CONSUMED_VN0.DRS' \___ value too big for format, maximum is 511 On the perf kernel side, the kernel assumes the valid bits are continuous. It will adjust the 0x100 (bit 8 for perf tool) to bit 21 in HW. DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21"); So the perf tool follows the kernel side and just set bit8 other than bit21. Fixes: fedb2b518239cbc0 ("perf jevents: Add support for parsing uncore json files") Reviewed-by: Kan Liang Signed-off-by: Xing Zhengjun Acked-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Ingo Molnar Cc: Jiri Olsa Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20220525140410.1706851-1-zhengjun.xing@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/pmu-events/jevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 8e487b2a37a6..dcfbbade657e 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -428,7 +428,7 @@ int json_events(const char *fn, } else if (json_streq(map, field, "ExtSel")) { char *code = NULL; addfield(map, &code, "", "", val); - eventcode |= strtoul(code, NULL, 0) << 21; + eventcode |= strtoul(code, NULL, 0) << 8; free(code); } else if (json_streq(map, field, "EventName")) { addfield(map, &name, "", "", val); -- 2.35.1