From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (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 15675478E58 for ; Thu, 11 Jun 2026 17:18:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781198299; cv=none; b=KV6BG1TPK/wH+58ykrckm6jIxzGIemOC5I0WDpojdLcXiSFv945C8tS/cyeZ5I+9QXOzjkU/C23MkhYr8av2D84CUyUu1KWe6qzUhJY9kVyIFu+Qt8v5AiqKiakfqtEOCM5t1o0phIQhiMoB8w2OgtV39k244Swz/4euxwU2b9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781198299; c=relaxed/simple; bh=BmN+uIK2KozJ/CmJ6jybIyW1ngHuqgsLL5Q2oJs/n+Y=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OW8v29EhQvk/0ux+Jv3E++6fyK8GAZ7znh8xM0BAcmBhuIsxq3AxVE/3TsUei0iXFc1mtrTmb3EQH7Jkizg0PqV2S0np8XTbbWS4DsD9R+LqRCw9xIWW7u6+zeNZIuOKlgyuAnN9JKWzQs2HTUXGKszomFyYd3jk9HtvGjE8FYs= 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=QnWeqW6V; arc=none smtp.client-ip=74.125.82.73 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QnWeqW6V" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-138156c0492so128616c88.1 for ; Thu, 11 Jun 2026 10:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781198292; x=1781803092; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VvL9FN3niBRwopfeT8jFF2/cj8/ZhVUpeFaQcjlgPs4=; b=QnWeqW6Vg0ID251XQ9Ila44zaygx+WNzxVu6qFUbEOE0fpiDOVdEt+0x8rGXfRm7iO 0WwXG+VYSWm1RJQPU5MlKO5dsSMBr1CeDuQ9VvLhdE3dTr2YWUUdcI4IX7Tk5LxpYXdM cYvtjqJgPkGeoqy8Vnmu2qIh/lWumDWoECCNA+VVSWtXq2Q0UlrcuE3xwMl5V/+koGPc CujdkSHsDDNS2gMxGzB2mHTmhKirwMursp1axWeNxiZN/r5I1vcD9l0IQ4D+He+Wip7D hK7zfCvC4fSVR3uCn7+xMwG/Q+iFCUW5y9PZkM7Bg91p+9AAhGqbLhPQhHnY7cdaMPIk aSmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781198292; x=1781803092; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VvL9FN3niBRwopfeT8jFF2/cj8/ZhVUpeFaQcjlgPs4=; b=Vnks++fwy4mOXRN+92/hQU5kE4InuNsSzswqxtVUmBIky3N3qNKS76T/6E4Gmo6N9p c6yXHv2oCSfQyecFCxCJEpqpI/jpMPkRBBmL+6oWnmNx82zLeZcZpkrg3DPL1o2unOxw UHAqmrqXMg9RHKZ1GiMnyhrDEZT0HgFDTCpC0ZoA1En0Z22jVL+LjRhX75UfIHirP5nA kxf3ce1X+iVBlqdbi/uvPY7mdqvvW/ZKiiosYW4BC4jeDyCme1ZxQfBC76O92dLcS9dg 0mfSmEI9ZCDq5Ep/d7rTwAXxaOGCFOhOzlnRs8vK4szuSusulweXPHZmbaMlfTIozu+X FaNA== X-Forwarded-Encrypted: i=1; AFNElJ8Tz6a1xnyx7+1bXF1myp7qeYKfzQAOSlq2ww51GgriFd+3LFFS5f85GA3c6VbL88f7MRUaof+ZU5nK4qg=@vger.kernel.org X-Gm-Message-State: AOJu0YwGqxVIdXeawdUSTv+TvLzy+jH3XyR4aa2CTUvYa1YgQ67J7H5h VAZjfNGNv3K8+QFZIs+fjsf+ATERaPHlmXH02Jp2QQroLmQFsVkPWfi9KahGH+O2OMva5zS4AS7 qSxjhJcDvQg== X-Received: from dlaf26.prod.google.com ([2002:a05:701b:241a:b0:12d:bc1d:8783]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:113:b0:137:e391:1acf with SMTP id a92af1059eb24-1384250354cmr2059009c88.36.1781198291245; Thu, 11 Jun 2026 10:18:11 -0700 (PDT) Date: Thu, 11 Jun 2026 10:17:39 -0700 In-Reply-To: <20260611171756.4008769-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260605191500.2477026-1-irogers@google.com> <20260611171756.4008769-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260611171756.4008769-3-irogers@google.com> Subject: [PATCH v12 02/19] perf python: Add missed explicit dependencies From: Ian Rogers To: irogers@google.com Cc: acme@kernel.org, adrian.hunter@intel.com, alice.mei.rogers@gmail.com, dapeng1.mi@linux.intel.com, james.clark@linaro.org, leo.yan@linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, namhyung@kernel.org, peterz@infradead.org, tmricht@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Fix missing #include of pmus.h found while cleaning the evsel/evlist header files. Also define PY_SSIZE_T_CLEAN before including Python.h to comply with modern Python 3 C-API requirements, and introduce CHECK_INITIALIZED and CHECK_INITIALIZED_INT safety macros to be used by subsequent patches. Signed-off-by: Ian Rogers --- tools/perf/util/python.c | 41 +++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index cc1019d29a5d..98a8dd9b673d 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -1,30 +1,37 @@ // SPDX-License-Identifier: GPL-2.0 +#define PY_SSIZE_T_CLEAN #include -#include + #include -#include + #include +#include + +#include #include -#ifdef HAVE_LIBTRACEEVENT -#include -#endif #include +#include + #include "callchain.h" #include "counts.h" +#include "event.h" #include "evlist.h" #include "evsel.h" -#include "event.h" #include "expr.h" +#include "metricgroup.h" +#include "mmap.h" +#include "pmus.h" #include "print_binary.h" #include "record.h" #include "strbuf.h" #include "thread_map.h" #include "tp_pmu.h" #include "trace-event.h" -#include "metricgroup.h" -#include "mmap.h" #include "util/sample.h" -#include + +#ifdef HAVE_LIBTRACEEVENT +#include +#endif PyMODINIT_FUNC PyInit_perf(void); @@ -38,6 +45,22 @@ PyMODINIT_FUNC PyInit_perf(void); offsetof(struct pyrf_event, sample) + offsetof(struct perf_sample, member), \ 0, help } +#define CHECK_INITIALIZED(ptr, msg) \ + do { \ + if (!(ptr)) { \ + PyErr_SetString(PyExc_ValueError, msg " not initialized"); \ + return NULL; \ + } \ + } while (0) + +#define CHECK_INITIALIZED_INT(ptr, msg) \ + do { \ + if (!(ptr)) { \ + PyErr_SetString(PyExc_ValueError, msg " not initialized"); \ + return -1; \ + } \ + } while (0) + struct pyrf_event { PyObject_HEAD struct evsel *evsel; -- 2.54.0.1136.gdb2ca164c4-goog