From patchwork Mon Oct 14 10:51:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 13834642 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C37BA199244; Mon, 14 Oct 2024 10:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728903226; cv=none; b=OMzyP8OLXpnQhnilYrtwuqMl3o4dwjPTrP1uPWJ1oiEf0dVhv3isIPuNIoz0nM0ulBBVxj8ER4RyJigNOKtORWnv/7zOB1CARArTkW7arVxc31JnXIpbhW1Td3jASZrUwlW4ejpyWXC4/JfIQ1/oijToUDPqoXzhIL2EE3SRPas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728903226; c=relaxed/simple; bh=Xapmrgmg/ZiUC03GXXM+hUQmQNhKOBc4ORSHm821xOc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=seslbFBa0HYnFIdhKKL3rb6C3uh4I2+JeRKl3r+2zgPKv6W5xUu8BbwQUqwvrXcLIce1c/gcYFzmLzhiFwObsAw5N7ozRGb9EoX+Dq7T1WHQXpzeSiJbnEzJGEDHrENg940XLgqstnWssNrlobLljqgckzLfhPEv+a9wvaSFAg4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TFYBxSyq; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TFYBxSyq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728903224; x=1760439224; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xapmrgmg/ZiUC03GXXM+hUQmQNhKOBc4ORSHm821xOc=; b=TFYBxSyqKjy7HlhTxd5r6/TkGax6cGh59QvuDczibpOSxiJYsHddxUJw yNhWUZtE84chck46dMshajCFSBHzKvl4a8SglhsxF4d5WMLTaCF6TeFhA QiLJMVihud5Whgf8WNLXncW84vDj0xy1H/7A6rCdo9wZb1Xu23rdLxAab qtXGQbdKCYc9p7f+2WzGpFVEapT0UyKIvsg0pCYvQNlheQQic9OyrzE6x d3oQNqwN0sICF1PHRExdGL8bkw1Bf6hXOJucca5BLcfTNf+twnScpCxtE WC7hqBqd1EssUBj2o3YFNA7YJSuixidynWcxt3ZAB6SjeTLKckYcQXhGU w==; X-CSE-ConnectionGUID: HEXrGfK8SnigCrbkYkaSxA== X-CSE-MsgGUID: f8TD5DUUSACbQlAaEz7Cfw== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="39366381" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="39366381" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2024 03:53:44 -0700 X-CSE-ConnectionGUID: 5hjNC/cvSHu7a8Xnij7aUw== X-CSE-MsgGUID: yF50NB1QTRWI+v+Ze9X7og== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,202,1725346800"; d="scan'208";a="77727535" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.245.115.59]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2024 03:53:34 -0700 From: Adrian Hunter To: Peter Zijlstra , Sean Christopherson , Paolo Bonzini Cc: Ingo Molnar , Mark Rutland , Alexander Shishkin , Heiko Carstens , Thomas Richter , Hendrik Brueckner , Suzuki K Poulose , Mike Leach , James Clark , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Yicong Yang , Jonathan Cameron , Will Deacon , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , Andi Kleen , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, H Peter Anvin , Kan Liang , Zhenyu Wang , mizhang@google.com, kvm@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH V13 11/14] perf tools: Add missing_features for aux_start_paused, aux_pause, aux_resume Date: Mon, 14 Oct 2024 13:51:21 +0300 Message-ID: <20241014105124.24473-12-adrian.hunter@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105124.24473-1-adrian.hunter@intel.com> References: <20241014105124.24473-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Display "feature is not supported" error message if aux_start_paused, aux_pause or aux_resume result in a perf_event_open() error. Signed-off-by: Adrian Hunter Acked-by: Ian Rogers Reviewed-by: Andi Kleen Reviewed-by: Leo Yan --- Changes in V13: Add error message also in EOPNOTSUPP case (Leo) tools/perf/util/evsel.c | 12 ++++++++++++ tools/perf/util/evsel.h | 1 + 2 files changed, 13 insertions(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 9621c8c12406..fd28ff5437b5 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -2177,6 +2177,12 @@ bool evsel__detect_missing_features(struct evsel *evsel) perf_missing_features.inherit_sample_read = true; pr_debug2("Using PERF_SAMPLE_READ / :S modifier is not compatible with inherit, falling back to no-inherit.\n"); return true; + } else if (!perf_missing_features.aux_pause_resume && + (evsel->core.attr.aux_pause || evsel->core.attr.aux_resume || + evsel->core.attr.aux_start_paused)) { + perf_missing_features.aux_pause_resume = true; + pr_debug2_peo("Kernel has no aux_pause/aux_resume support, bailing out\n"); + return false; } else if (!perf_missing_features.branch_counters && (evsel->core.attr.branch_sample_type & PERF_SAMPLE_BRANCH_COUNTERS)) { perf_missing_features.branch_counters = true; @@ -3397,6 +3403,10 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, return scnprintf(msg, size, "%s: PMU Hardware doesn't support 'aux_output' feature", evsel__name(evsel)); + if (evsel->core.attr.aux_action) + return scnprintf(msg, size, + "%s: PMU Hardware doesn't support 'aux_action' feature", + evsel__name(evsel)); if (evsel->core.attr.sample_period != 0) return scnprintf(msg, size, "%s: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'", @@ -3427,6 +3437,8 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, return scnprintf(msg, size, "clockid feature not supported."); if (perf_missing_features.clockid_wrong) return scnprintf(msg, size, "wrong clockid (%d).", clockid); + if (perf_missing_features.aux_pause_resume) + return scnprintf(msg, size, "The 'aux_pause / aux_resume' feature is not supported, update the kernel."); if (perf_missing_features.aux_output) return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel."); if (!target__has_cpu(target)) diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index bd08d94d3f8a..d40df2051718 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -221,6 +221,7 @@ struct perf_missing_features { bool weight_struct; bool read_lost; bool branch_counters; + bool aux_pause_resume; bool inherit_sample_read; };