Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp411365lqp; Wed, 12 Jun 2024 05:40:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWEyLYs8Tw3nYNMHV+wq2ATKxJW6ZbX2zU8aDGT8qMXIwRyUyKayS0kXXn/zuGxK+lwZGqGFTkFcNWndO3DgcrRoreDBkLPQ9uvdMxX7g== X-Google-Smtp-Source: AGHT+IEh3AgGvyyMnrxzaXV20FrETMKwsy7wOGsxFjZ2Q54GqRljK/NkEreY7gNZZGbv96RV/ue4 X-Received: by 2002:a05:620a:4116:b0:795:910f:bead with SMTP id af79cd13be357-797f606d2f4mr193086885a.9.1718196039230; Wed, 12 Jun 2024 05:40:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718196039; cv=pass; d=google.com; s=arc-20160816; b=zE/CbFtdCvrmuypjfZXb397ID5q4GV4PiQJc3WDmdVy7q0U0PzfU2fCsvlAlHTbLVX tt97GIM2yUvgBng0fDmxYssZS7sq2zunlSFGmoij6HZGmlzbbcb5O8yy4Os//URJh3nj smZm0B3Qz0ng/YcQ5Ruvd6J1tdGI30uCuw+hJm+qfaJBsfH/kqw+8IYE5GSJP8uCVFbJ sQUHLrjQdMeVlPnUhUqWlVNW2QzJDayPBq3oxeTB29GordLxjKMAfcbTvSxYYOCDeQ1L aXd6dwp8I7K6DUU9V7w9ftJ7lYGSIyiVSK4FwG7pVoQhuqq7VP4mzjSjstHkcMphM5Gl BheA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:date:dkim-signature; bh=DfSgBhx2prDvvpbn/rXVh0w6qYSSonJrkoho8C5QmNY=; fh=eiryu3L6I76Gp3ypuPsIXyucxMJWcwe63QoDIWrquAs=; b=ooWecdskpWt0p9sP5ICYq3sEfIb5lI0WyKGbIkxA8dtlHlbWxfRAtFE9gFuGLIXknh Wf+WwOKgfCorWq+MMS9W54A0ZfAKoI0yKDIYlHZRp4ngusm8x8RYcCzpEzdr8/rwrB1Z Gl6+ATzZELKq0RjFNm6PHT3T8qbXOp7yfiLPb07I7eSzPl0CBJeuO7OtxQUWrVPNjmM0 CmbaqF7MdLv8uU32VAfAf1i+/F8X/fVO7wU0x3cPXMUPHenVXlVgcncThTN+Cm++MaOJ NzqZQqgZq707W+LX+sP4yl/PuOEhUMXrMnLiyr1rELPmNgkqxvfTUtrFvivW/qujdHqY QS4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=u4YR6W9z; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-211495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211495-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-795555c2d86si1009123885a.679.2024.06.12.05.40.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 05:40:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=u4YR6W9z; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-211495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211495-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EB3B91C21002 for ; Wed, 12 Jun 2024 12:40:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DFB9170844; Wed, 12 Jun 2024 12:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="u4YR6W9z" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A52816FF59 for ; Wed, 12 Jun 2024 12:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718196033; cv=none; b=na4ZyzswUpNzQSAGR0VYZmLlnQHPnFuTgpZScl2MdGIb//orVyXnEnjqmzgVtD2zBnuZIHSd2Efxyac6cGtBh/SrFoCDYCYJkBv1FUH/Ilavjhn32JHGiwd3saM9gML14QvOHO/VdI4p7g5CwMst26rsg8xthiXH/ZHd+XjyNeU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718196033; c=relaxed/simple; bh=c+DRRveXulk99snT5VccdZXEOQB7aOSMnf5enVXmdbQ=; h=Date:Message-Id:Mime-Version:Subject:From:To:Cc:Content-Type; b=NGfQmYeckSTm5FxtYMDkeFTkb2EHyDV0NOtad17a5QPS7fqxhRJqQvtIADCOpwnSaxEQuXhi+JAKclB469TL1iNj+SNmXCDUSYoa9jx67NjLv6v0aMAGjd4bSUtf1E8Hoxh/hEKE4pxPHS712QwUBuE95Uko+OI+0VHlcO3d0Ko= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=u4YR6W9z; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-627f43bec13so41203987b3.0 for ; Wed, 12 Jun 2024 05:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718196031; x=1718800831; darn=vger.kernel.org; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=DfSgBhx2prDvvpbn/rXVh0w6qYSSonJrkoho8C5QmNY=; b=u4YR6W9zi+yi3lOYpXYJI/c0cQHv1faIKiyySmXHvKBzcxQAv4VTrFCMMAJ62XyTYU Lhe07dewELjfoKad4pDBCI7kAlKVkXDRRG6v79GkrvCiVOprft/zKYABldsnVx3ZvjSU XpJaW45o+tTIFPaR/ZeHE1RvNjZdKdsNpyixRiCEryYmiWhCNaE55X+YbWcD+RtFkHMm fXWYmpz5QFw8G0kYBOaKJTeqATcjDF1Zm1xhK5LqnB0NDqJUHCDwSKboKa//f8iKnxZK eSexkE2fcKseibo8VJ9yH1EIXoQcHjvCYidLhtuqSu7O6yI44iFUQflZ8lWmZh8u7FV+ B+ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718196031; x=1718800831; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DfSgBhx2prDvvpbn/rXVh0w6qYSSonJrkoho8C5QmNY=; b=c/z5DjW5jyW2GFNP5eDO1cSeUxAw8VERiYtH4DkxrR1w/KGT0RDQBXV8adYl8M3Tfi E1Bu1zlyAQt+cT9U7SYVYXOuY/kWbur5FsLPPE+pDtbZjq7yPx8kGURBspzhMVxS/xe9 hcawsWvkfW+mEKlEpZVU6+7D9L9OfRSL8IFOptGzXe8Fv7ZQMYu7kpPXXsXNilceLzgz cFFnbs7RzgJSQ+6htnxlHIW7CwlC0n1irNR9tn0dP06vb6dC0KdThCwRNgb8OUfGXKJ5 osXIhJEvgpcCgXZJsRiMOIE9eia3s6tAZwBuilVfnZgw1mX3+yss4Z0vJG4eNw9ABIvj HMiQ== X-Forwarded-Encrypted: i=1; AJvYcCUa03/AhduvW6+CIbxRpfF5uDjyYVdTzIJJawjRtkMzporGrRehi9414QmnXYgcjqhNJ+OXAH8Ly/8VVvzlu2k6vdMsXbo0NsxCRfxH X-Gm-Message-State: AOJu0YycPjQLvX0ORugKQ0USYPP7YG5WdxIiyw/SNKhq//nypNcv0Xyt qoQ383BcTH+ZGzMzWWHTmHnjZlnZ6y283Knw9GiOkDqJArUgPyjDufXs1OutNqqfKrTZsAqiDny 3qqwUpA== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:ea09:ea36:268b:d86f]) (user=irogers job=sendgmr) by 2002:a05:690c:4491:b0:62f:f535:f37 with SMTP id 00721157ae682-62ff535129amr3636757b3.0.1718196031241; Wed, 12 Jun 2024 05:40:31 -0700 (PDT) Date: Wed, 12 Jun 2024 05:40:27 -0700 Message-Id: <20240612124027.2712643-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Subject: [PATCH v1] perf test pmu: Warn don't fail for legacy mixed case event names From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kajol Jain Content-Type: text/plain; charset="UTF-8" PowerPC has mixed case events matching legacy hardware cache events. Warn but don't fail in this case. Event parsing will still work in this case by matching the legacy case. Signed-off-by: Ian Rogers Tested-by: Kajol Jain --- tools/perf/tests/pmu.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c index cc88b5920c3e..201df4446f7c 100644 --- a/tools/perf/tests/pmu.c +++ b/tools/perf/tests/pmu.c @@ -260,26 +260,42 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest static bool permitted_event_name(const char *name) { bool has_lower = false, has_upper = false; + __u64 config; for (size_t i = 0; i < strlen(name); i++) { char c = name[i]; if (islower(c)) { if (has_upper) - return false; + goto check_legacy; has_lower = true; continue; } if (isupper(c)) { if (has_lower) - return false; + goto check_legacy; has_upper = true; continue; } if (!isdigit(c) && c != '.' && c != '_' && c != '-') - return false; + goto check_legacy; } return true; +check_legacy: + /* + * If the event name matches a legacy cache name the legacy encoding + * will still be used. This isn't quite WAI as sysfs events should take + * priority, but this case happens on PowerPC and matches the behavior + * in older perf tools where legacy events were the priority. Be + * permissive and assume later PMU drivers will use all lower or upper + * case names. + */ + if (parse_events__decode_legacy_cache(name, /*extended_pmu_type=*/0, &config) == 0) { + pr_warning("sysfs event '%s' should be all lower/upper case, it will be matched using legacy encoding.", + name); + return true; + } + return false; } static int test__pmu_event_names(struct test_suite *test __maybe_unused, -- 2.45.2.505.gda0bf45e8d-goog