Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2269503iof; Wed, 8 Jun 2022 01:00:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXtFuHATO/qD1+kYPmuMw9wJy6ptsMca2LXMDsNOWlRaNgxWQyaiIllZNyXwoW7Rt9IVJp X-Received: by 2002:a63:f156:0:b0:3ab:ada6:b463 with SMTP id o22-20020a63f156000000b003abada6b463mr28477244pgk.462.1654675240571; Wed, 08 Jun 2022 01:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654675240; cv=none; d=google.com; s=arc-20160816; b=pql9d79G4rmC3Zt5kNDw2TNuBJRtHV2JVhI9ZrELOtEacA4JTk13xCH0hjvofyVxzj hUNf7II+Zwc6KDzhsj+jBXC7hcqwqqJHOT6EB3YqgKF3pjnh0hH9iyk2BS16b5Uit5D+ asVk6K/2qFpyV9ETglV+1MdLfrTHBYNN2hoXXQnjKQUapfwXtd9rcOEmrv5No5oOLodo PToK94RRHg7ouBy2AWRDHOCVUdAPglXlnV/Mryorz6ZfwUqeh8SxZh3lHfD64eXP5Ckz sKrVCXNtJu1PhBasttbiUc9/CAe85W2NovNrcTNDdT+2hg1WWI1+LRADyPTmeZFsrF35 Bdbw== 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=nNwP7C6tN6sRgG1Y5m2Rr73R7hd/jm7rzqZc62b2sTI=; b=b4i76Jc1i70Gf89bmiZA/kHZs+lI7MyDiVR925/7YcCoO7IV2KhRTVEYfQAGfEoAV3 gS5XBW9iU9PlWbpyEEEiOCctW36ChfARWqpw7KXFHQ7W/DX3LD/sXrlNpDMXupiNHRVk uK+/SQ9ByjoSohg/YdXnbMOEg99JRQXjgQlwATg7PDnwXE8vWVPyJ5iZmlFWwLlCN7rZ X9SWsOHI0DpIKcI/BhsA0uXTTpLDs/BR49ornao7te6zLBQvxR5Awm0uQQQUsx+bpwtO V8SIpVQzlbCgyg8xOeNz3Sg4FHG69kuO+rP3S6AjGgejW6pohTruTe0CYMxsYU9GPawb I5ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eF5Qy2yV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id lk14-20020a17090b33ce00b001dc21092149si18623163pjb.140.2022.06.08.01.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:00:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eF5Qy2yV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7D44B1EA06E; Wed, 8 Jun 2022 00:30:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442447AbiFHCAe (ORCPT + 99 others); Tue, 7 Jun 2022 22:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837505AbiFHAAI (ORCPT ); Tue, 7 Jun 2022 20:00:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D48A28E3A; Tue, 7 Jun 2022 12:17:59 -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 58187617DA; Tue, 7 Jun 2022 19:17:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26C62C385A2; Tue, 7 Jun 2022 19:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629477; bh=CY+iDginr8y7gYfPZBjwiPcljo0h6gLMrOVyX6LMgGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eF5Qy2yV6IfGzvmfCCxgb5Jrcy96TAqMgUI1ZoBh6zFI0lceChN9YcrGpL/1ZwpAe BzJqCiKMQw40xAp7PTvWGj5LxWe0K/3XVmp78irH6IkRZN+keeuyn1WxfbWNaGbm11 VyNV3yPqkpYiHY4tKKI4n6YzM4YAhv2dq05I9zBE= 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 5.18 704/879] perf jevents: Fix event syntax error caused by ExtSel Date: Tue, 7 Jun 2022 19:03:42 +0200 Message-Id: <20220607165023.282143005@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 159d9eab6e79..b1eb68c861e7 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -612,7 +612,7 @@ static 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, &je.name, "", "", val); -- 2.35.1