get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2228349/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2228349,
    "url": "http://patchwork.ozlabs.org/api/patches/2228349/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260426080056.16558-1-atrajeev@linux.ibm.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20260426080056.16558-1-atrajeev@linux.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260426080056.16558-1-atrajeev@linux.ibm.com/",
    "date": "2026-04-26T08:00:56",
    "name": "[V3] tools/perf: Fix the check for parameterized field in event term",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f0e09c79e4d142237e440141bce9abf1a85e455e",
    "submitter": {
        "id": 90290,
        "url": "http://patchwork.ozlabs.org/api/people/90290/?format=api",
        "name": "Athira Rajeev",
        "email": "atrajeev@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260426080056.16558-1-atrajeev@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 501513,
            "url": "http://patchwork.ozlabs.org/api/series/501513/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=501513",
            "date": "2026-04-26T08:00:56",
            "name": "[V3] tools/perf: Fix the check for parameterized field in event term",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/501513/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2228349/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2228349/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev+bounces-20104-incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=DmQWFcdv;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20104-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "lists.ozlabs.org;\n arc=none smtp.remote-ip=148.163.158.5",
            "lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com",
            "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=DmQWFcdv;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com\n (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com;\n envelope-from=atrajeev@linux.ibm.com; receiver=lists.ozlabs.org)"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g3K0156NLz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 26 Apr 2026 18:01:21 +1000 (AEST)",
            "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4g3K010ynXz2yjm;\n\tSun, 26 Apr 2026 18:01:21 +1000 (AEST)",
            "from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n [148.163.158.5])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4g3Jzw3Q0pz2xfX\n\tfor <linuxppc-dev@lists.ozlabs.org>; Sun, 26 Apr 2026 18:01:16 +1000 (AEST)",
            "from pps.filterd (m0360072.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63Q2NWT6410288;\n\tSun, 26 Apr 2026 08:01:10 GMT",
            "from ppma21.wdc07v.mail.ibm.com\n (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drn8v3e1q-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tSun, 26 Apr 2026 08:01:09 +0000 (GMT)",
            "from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1])\n\tby ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 63Q7s1b6028239;\n\tSun, 26 Apr 2026 08:01:08 GMT",
            "from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226])\n\tby ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ds8xjrtg2-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tSun, 26 Apr 2026 08:01:08 +0000 (GMT)",
            "from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com\n [10.20.54.104])\n\tby smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63Q815oD46989810\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tSun, 26 Apr 2026 08:01:05 GMT",
            "from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id E37692004B;\n\tSun, 26 Apr 2026 08:01:04 +0000 (GMT)",
            "from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id A880A20043;\n\tSun, 26 Apr 2026 08:00:59 +0000 (GMT)",
            "from localhost.localdomain (unknown [9.124.219.109])\n\tby smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP;\n\tSun, 26 Apr 2026 08:00:59 +0000 (GMT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1777190481;\n\tcv=none;\n b=kz+bnJF2PSD4uQqWiSVhdO0v4b6r7TLysgpPTXNlWYpLhOdV5UDp12fa9Y93dhKAbmrfxraMbaV6j8VhOTYzazd2t3Mc0E2dTJFZ5zpviV+45ykImZ4ZJARUAmxxE4+ONge9lx0JScB1CiPct+KwuiGHG1RdWeCvDWQPCYWUFhSMsfoOZ7v9JiqblzUQjEqh0qDyqSTSDqi4iElT2AHkH67sQFpVD5W/gkygAN+Q3SnltjUGPewnBOPuzIe3+EcZakv9xF9ES/Tg6Hn6R64/7Ii4BXKz8nTELK9fDEONOX/NdiTi/KXe0qJ/mAXkAI//r2i7LJLjiBVsPeX+5P5T9w==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1777190481; c=relaxed/relaxed;\n\tbh=JuVyF6PxycQPFwSUxIOPDTHyHWo+BkLkQpJUxESNAIo=;\n\th=From:To:Cc:Subject:Date:Message-Id:MIME-Version;\n b=QjPajQDZrDmtF0iF7d1T5WlLadXjpZQZau20igLLiaS+ASa3dX1n320YhDdW4Uk7nQRoM0KhgVfMgbPTd69kIkp7rKCs4X5MUzugsltbRa4ovQ/z95bWsu/v7xccfFdW6aIeumcynxhMl1I9fCk52WJq6D2IOkhuvej/NWZRVtA+rNNIRNLOu3GDTLIGpFAQHL+y9vFEwXkELCHR03F0Nc90eRSLp6atMs/fmZfxIZadn9RFYGBwKg2WWly6zwktz5XEgNfTYD6vlFyXxtbeSVaadgoXgWVKJkTXm3StAO+zYl92R7eQ2714LMMurzOsXKp1WshxcGo87MEDOiBm2A==",
        "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com;\n dkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=DmQWFcdv; dkim-atps=neutral;\n spf=pass (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com;\n envelope-from=atrajeev@linux.ibm.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=linux.ibm.com",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n\t:content-transfer-encoding:date:from:message-id:mime-version\n\t:subject:to; s=pp1; bh=JuVyF6PxycQPFwSUxIOPDTHyHWo+BkLkQpJUxESNA\n\tIo=; b=DmQWFcdvBmAx8pZAfxyb9aS+l4BNV66dScdZhHaMU2P3izI4BMaPHpUOS\n\tKn3t650uWzXimQT9/cKAKRG7FtHphcVQQIIJVicX9OlIzhvJhONqP/KM1goUCxAa\n\t+GXxtENhyL3wEd3t2dGzaN53AAZIaUk286yrhpe4f3bgSHKyKEiX7tZ27cPaiT/1\n\toFub1cIafn7AQQ3Nk4EznIZu7+NMpNQqC9StQjeZaUaAr13A9fu7gh5blPm+Evrk\n\t4KDbzKWIF0WlKM4KgVI524Hd7TcB6N+3Jr06jpeHYSSxl2Y6hZOI2PEppuSGisWw\n\txEQCyLRghTrr/E423pvWAMwYn2RtQ==",
        "From": "Athira Rajeev <atrajeev@linux.ibm.com>",
        "To": "acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com,\n        mpetlan@redhat.com, tmricht@linux.ibm.com, maddy@linux.ibm.com,\n        irogers@google.com, namhyung@kernel.org",
        "Cc": "linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n        atrajeev@linux.ibm.com, hbathini@linux.vnet.ibm.com,\n        Tejas.Manhas1@ibm.com, Tanushree.Shah@ibm.com, Shivani.Nittor@ibm.com",
        "Subject": "[PATCH V3] tools/perf: Fix the check for parameterized field in event\n term",
        "Date": "Sun, 26 Apr 2026 13:30:56 +0530",
        "Message-Id": "<20260426080056.16558-1-atrajeev@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.39.5 (Apple Git-154)",
        "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org",
        "List-Id": "<linuxppc-dev.lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>",
        "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>",
        "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>",
        "Precedence": "list",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "X-Proofpoint-Reinject": "loops=2 maxloops=12",
        "X-Authority-Analysis": "v=2.4 cv=CIIamxrD c=1 sm=1 tr=0 ts=69edc645 cx=c_pps\n a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17\n a=KlCRr-_lrQmZq1rU:21 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22\n a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8\n a=FQl2jcZq-z-9k4ZDHbEA:9",
        "X-Proofpoint-ORIG-GUID": "lNXlQ2n2XLBM1UCil7_SNIWDM-oYPSCn",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDI2MDA4MSBTYWx0ZWRfX3DVSoX7Tt3JM\n wRI9khH1B446Ahxjl4vvumIkLA0IHr7bCT0xQ2eL4ql+9UmRS/DzVgv7qgmXa5YvOzxNJ+jnhhn\n S3EhTKYPKaaStfr1JudL1RiAfZT1OGNdNyoNGBFDEXw7r+hRT/F0xrdZhIoMIQujDuDxsyjr2sq\n Pl0GSM/jOYN24MfynSngbRFwAKcx9naaL4Jwq4ylr+zK2XcObk3TqkF2joytNQof361hjueJztR\n i5koha7ZKjztqZcrAVHBYs/sZQvxyGVwBn8rL0i/03BaNhJcff7T+CSuwSazdIp4j26Ta6AxVNb\n 1PzwJvb+8OJwCi3JKL1gSOykOpN4rQj6PaYcaWy8eed8qfls9j2HEg6ruhILZQQ0qG3Lh6TYWv4\n 7+oKBt1JPgcSvFgXbwyBTeQIK3Y0NUtewyvNXWtl5l1xKhmFfaiTmqfYjboG3+DN4vNL53c97f3\n Z5xgStA8UgRHgj1r6BA==",
        "X-Proofpoint-GUID": "ZgYgzs-vG_k9QRn0Dxo670ZD2DsynqCi",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-26_03,2026-04-21_02,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n spamscore=0 phishscore=0 malwarescore=0 suspectscore=0 adultscore=0\n impostorscore=0 lowpriorityscore=0 clxscore=1015 bulkscore=0\n priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc=\n route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000\n definitions=main-2604260081",
        "X-Spam-Status": "No, score=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tRCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1 OzLabs 8",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"
    },
    "content": "The format_alias() function in util/pmu.c has a check to\ndetect whether the event has parameterized field ( =? ).\nThe string alias->terms contains the event and if the event\nhas user configurable parameter, there will be presence of\nsub string \"=?\" in the alias->terms.\n\nSnippet of code:\n\n /* Paramemterized events have the parameters shown. */\n       if (strstr(alias->terms, \"=?\")) {\n               /* No parameters. */\n               snprintf(buf, len, \"%.*s/%s/\", (int)pmu_name_len, pmu->name, alias->name);\n\nif \"strstr\" contains the substring, it returns a pointer\nand hence enters the above check which is not the expected\ncheck. And hence \"perf list\" doesn't have the parameterized\nfields in the result.\n\nFix this check to use:\n\nif (!strstr(alias->terms, \"=?\")) {\n\nWith this change, perf list shows the events correctly with\nthe strings showing parameters.\n\nOther changes in this patch:\n- Replace snprintf with scnprintf in buffer offset calculations to\nensure the 'used' count will not exceed the \"len\"\n- If a parameterized event uses a built-in perf keyword for its\nparameter name (eg, config=?), the lexer parses it as a predefined\nterm token, which sets term->config to NULL. Add check to use\nparse_events__term_type_str() if term->config is NULL\n\nSigned-off-by: Athira Rajeev <atrajeev@linux.ibm.com>\n---\nChangelog:\nv2 -> v3:\nAfter review from Sashiko, added below changes:\n- Corrected commit message to say \"strstr\" which was previously\nadded as \"str_ends_with\".\n- Updated snprintf with scnprintf in perf_pmu__for_each_event()\nas well.\nv1 -> v2:\nAfter review from Sashiko, added below changes:\n- Replace snprintf with scnprintf in buffer offset calculations to\nensure the 'used' count will not exceed the \"len\"\n- If a parameterized event uses a built-in perf keyword for its\nparameter name (eg, config=?), the lexer parses it as a predefined\nterm token, which sets term->config to NULL. Add check to use\nparse_events__term_type_str() if term->config is NULL\n\n tools/perf/util/pmu.c | 20 ++++++++++++--------\n 1 file changed, 12 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c\nindex 23337d2fa281..ca0ceb0623ca 100644\n--- a/tools/perf/util/pmu.c\n+++ b/tools/perf/util/pmu.c\n@@ -2117,7 +2117,7 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu,\n \t\t\t\t\t\t   skip_duplicate_pmus);\n \n \t/* Paramemterized events have the parameters shown. */\n-\tif (strstr(alias->terms, \"=?\")) {\n+\tif (!strstr(alias->terms, \"=?\")) {\n \t\t/* No parameters. */\n \t\tsnprintf(buf, len, \"%.*s/%s/\", (int)pmu_name_len, pmu->name, alias->name);\n \t\treturn buf;\n@@ -2129,15 +2129,19 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu,\n \t\tpr_err(\"Failure to parse '%s' terms '%s': %d\\n\",\n \t\t\talias->name, alias->terms, ret);\n \t\tparse_events_terms__exit(&terms);\n-\t\tsnprintf(buf, len, \"%.*s/%s/\", (int)pmu_name_len, pmu->name, alias->name);\n+\t\tscnprintf(buf, len, \"%.*s/%s/\", (int)pmu_name_len, pmu->name, alias->name);\n \t\treturn buf;\n \t}\n-\tused = snprintf(buf, len, \"%.*s/%s\", (int)pmu_name_len, pmu->name, alias->name);\n+\tused = scnprintf(buf, len, \"%.*s/%s\", (int)pmu_name_len, pmu->name, alias->name);\n \n \tlist_for_each_entry(term, &terms.terms, list) {\n+\t\tconst char *name = term->config;\n+\n+\t\tif (!name)\n+\t\t\tname = parse_events__term_type_str(term->type_term);\n \t\tif (term->type_val == PARSE_EVENTS__TERM_TYPE_STR)\n-\t\t\tused += snprintf(buf + used, sub_non_neg(len, used),\n-\t\t\t\t\t\",%s=%s\", term->config,\n+\t\t\tused += scnprintf(buf + used, sub_non_neg(len, used),\n+\t\t\t\t\t\",%s=%s\", name,\n \t\t\t\t\tterm->val.str);\n \t}\n \tparse_events_terms__exit(&terms);\n@@ -2237,13 +2241,13 @@ int perf_pmu__for_each_event(struct perf_pmu *pmu, bool skip_duplicate_pmus,\n \t\tinfo.scale_unit = NULL;\n \t\tif (strlen(event->unit) || event->scale != 1.0) {\n \t\t\tinfo.scale_unit = buf + buf_used;\n-\t\t\tbuf_used += snprintf(buf + buf_used, sizeof(buf) - buf_used,\n+\t\t\tbuf_used += scnprintf(buf + buf_used, sizeof(buf) - buf_used,\n \t\t\t\t\t\"%G%s\", event->scale, event->unit) + 1;\n \t\t}\n \t\tinfo.desc = event->desc;\n \t\tinfo.long_desc = event->long_desc;\n \t\tinfo.encoding_desc = buf + buf_used;\n-\t\tbuf_used += snprintf(buf + buf_used, sizeof(buf) - buf_used,\n+\t\tbuf_used += scnprintf(buf + buf_used, sizeof(buf) - buf_used,\n \t\t\t\t\"%.*s/%s/\", (int)pmu_name_len, info.pmu_name, event->terms) + 1;\n \t\tinfo.str = event->terms;\n \t\tinfo.topic = event->topic;\n@@ -2254,7 +2258,7 @@ int perf_pmu__for_each_event(struct perf_pmu *pmu, bool skip_duplicate_pmus,\n \t}\n \tif (pmu->selectable) {\n \t\tinfo.name = buf;\n-\t\tsnprintf(buf, sizeof(buf), \"%s//\", pmu->name);\n+\t\tscnprintf(buf, sizeof(buf), \"%s//\", pmu->name);\n \t\tinfo.alias = NULL;\n \t\tinfo.scale_unit = NULL;\n \t\tinfo.desc = NULL;\n",
    "prefixes": [
        "V3"
    ]
}