From nobody Fri Jun 09 20:02:35 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QdBnl2tB7z4cKsl; Fri, 9 Jun 2023 20:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QdBnl26m5z3DFH; Fri, 9 Jun 2023 20:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686340955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DhuuLBj1EcTtxTprnF0So8vWVQO2/1Zb+Z2rtMVgxb4=; b=djlEy/FtLsh/clk4k6D6DdF162MEfiE1p9xkSgHrReRr8oSA9Nk9twKu5IexVxvmuFLxze tPImbmzcGoI5kdg452r0SA3k1LkApltygkT7qdsdvHNCghDcKPmfVQfkfj2lVNeSNRNp2b S0NV5K66TixzO6qYutxSzvVf+TJa1tl6sYQWpb05Un4t6/iM5nnq21JQO22HfEJfsDPtwr ERBa8efDbQZzutu7OKb7sPxpXoNW+ud33FUjIWSJL6o5gjHF5O6Zy9xEcCwlo4A0zDBuDn Wmc5shagb+w7VGA9/zBWidjGPlpzO0IZVQFjuk2OkDw9GAhFCytsKyWgNq9BMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686340955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DhuuLBj1EcTtxTprnF0So8vWVQO2/1Zb+Z2rtMVgxb4=; b=pg629crQ6ZYZhcUz2JtTh0V5WT1Edwqznjs2/40EwNPeyKhWBwboM7HubMqusObGzr8ljT 4fTWHfYyj77a6VJdna1PtRnHquQiPhRJNeFinoNSSD/+LaC7oYIl1MTxnS/PHgm86W5997 yFIzMgL7oRfsSLG/CuTEN/vrHhbyZ+UOhQaPfmrQHw4IEl2fN3o8QuXddssrXP5u+xGyoS Avz2QOnDQZs6jszDorQR/l5IPg5FIYLmMAgHcX1tQAIqer7lop26Ox5lDT6hUbsZtY7bKK 1bteoj5HbEqq5yFyL/QuywQ2U+FG1LGzvRNDMUgqtffMRB7jxSD46yv/oqpBnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686340955; a=rsa-sha256; cv=none; b=foguO07jckobG04vu5+sCCNsO3sjMu7Z/7Gu+SXE/4Q355mYIn5yD7qKVtFablaSPmWd7D khRE9U9VHF2mG+dVYFN9IrkU3ekr90flHYgyqeliFQPmG7G8/Rrxu7O0+DBltFppZrbTmy nsAnRGBLbR/3Yuo9miIaWDvRO964GOMGe6CVGA2yd7wFknzl9dV+6rm6uTxUN688UNAMHu wUuUOFzuLR21oU9NrRRzfXCfTxC6pOvkMkdx2U6N9uhGCNvmuL0h0ECYJChPp5asfynlW3 u6pQxmuqadh/cflzbqDQXfpLuVen8y0CL4VJGbpoIbF2pJXYNmPIdj1/TWd1UA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QdBnl1Bf3zp12; Fri, 9 Jun 2023 20:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 359K2Zsj089276; Fri, 9 Jun 2023 20:02:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 359K2ZAC089275; Fri, 9 Jun 2023 20:02:35 GMT (envelope-from git) Date: Fri, 9 Jun 2023 20:02:35 GMT Message-Id: <202306092002.359K2ZAC089275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 13cc2842304c - stable/13 - libpmc: expand PMC_OP* defines List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 13cc2842304c8eb8730807e6b3a493cafefe8fd6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=13cc2842304c8eb8730807e6b3a493cafefe8fd6 commit 13cc2842304c8eb8730807e6b3a493cafefe8fd6 Author: Mitchell Horne AuthorDate: 2023-06-01 18:19:22 +0000 Commit: Mitchell Horne CommitDate: 2023-06-09 20:01:55 +0000 libpmc: expand PMC_OP* defines When performing the syscall, specify the full name of the desired operation. This improves grep-ability. No functional change. Reviewed by: jkoshy MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40334 (cherry picked from commit be75e578549fcc1da3754a29fc0e7b63672e7b44) --- lib/libpmc/libpmc.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 0ccefad5ca7d..b4418a30f328 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -78,8 +78,7 @@ static int powerpc_allocate_pmc(enum pmc_event _pe, char* ctrspec, struct pmc_op_pmcallocate *_pmc_config); #endif /* __powerpc__ */ -#define PMC_CALL(cmd, params) \ - syscall(pmc_syscall, PMC_OP_##cmd, (params)) +#define PMC_CALL(op, params) syscall(pmc_syscall, (op), (params)) /* * Event aliases provide a way for the user to ask for generic events @@ -1082,7 +1081,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, } found: - if (PMC_CALL(PMCALLOCATE, &pmc_config) == 0) { + if (PMC_CALL(PMC_OP_PMCALLOCATE, &pmc_config) == 0) { *pmcid = pmc_config.pm_pmcid; retval = 0; } @@ -1101,7 +1100,7 @@ pmc_attach(pmc_id_t pmc, pid_t pid) pmc_attach_args.pm_pmc = pmc; pmc_attach_args.pm_pid = pid; - return (PMC_CALL(PMCATTACH, &pmc_attach_args)); + return (PMC_CALL(PMC_OP_PMCATTACH, &pmc_attach_args)); } int @@ -1126,7 +1125,7 @@ pmc_configure_logfile(int fd) struct pmc_op_configurelog cla; cla.pm_logfd = fd; - if (PMC_CALL(CONFIGURELOG, &cla) < 0) + if (PMC_CALL(PMC_OP_CONFIGURELOG, &cla) < 0) return (-1); return (0); } @@ -1150,7 +1149,7 @@ pmc_detach(pmc_id_t pmc, pid_t pid) pmc_detach_args.pm_pmc = pmc; pmc_detach_args.pm_pid = pid; - return (PMC_CALL(PMCDETACH, &pmc_detach_args)); + return (PMC_CALL(PMC_OP_PMCDETACH, &pmc_detach_args)); } int @@ -1161,7 +1160,7 @@ pmc_disable(int cpu, int pmc) ssa.pm_cpu = cpu; ssa.pm_pmc = pmc; ssa.pm_state = PMC_STATE_DISABLED; - return (PMC_CALL(PMCADMIN, &ssa)); + return (PMC_CALL(PMC_OP_PMCADMIN, &ssa)); } int @@ -1172,7 +1171,7 @@ pmc_enable(int cpu, int pmc) ssa.pm_cpu = cpu; ssa.pm_pmc = pmc; ssa.pm_state = PMC_STATE_FREE; - return (PMC_CALL(PMCADMIN, &ssa)); + return (PMC_CALL(PMC_OP_PMCADMIN, &ssa)); } /* @@ -1292,13 +1291,13 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, int pmc_flush_logfile(void) { - return (PMC_CALL(FLUSHLOG,0)); + return (PMC_CALL(PMC_OP_FLUSHLOG, 0)); } int pmc_close_logfile(void) { - return (PMC_CALL(CLOSELOG,0)); + return (PMC_CALL(PMC_OP_CLOSELOG, 0)); } int @@ -1306,7 +1305,7 @@ pmc_get_driver_stats(struct pmc_driverstats *ds) { struct pmc_op_getdriverstats gms; - if (PMC_CALL(GETDRIVERSTATS, &gms) < 0) + if (PMC_CALL(PMC_OP_GETDRIVERSTATS, &gms) < 0) return (-1); /* copy out fields in the current userland<->library interface */ @@ -1327,7 +1326,7 @@ pmc_get_msr(pmc_id_t pmc, uint32_t *msr) struct pmc_op_getmsr gm; gm.pm_pmcid = pmc; - if (PMC_CALL(PMCGETMSR, &gm) < 0) + if (PMC_CALL(PMC_OP_PMCGETMSR, &gm) < 0) return (-1); *msr = gm.pm_msr; return (0); @@ -1357,7 +1356,7 @@ pmc_init(void) /* check the kernel module's ABI against our compiled-in version */ abi_version = PMC_VERSION; - if (PMC_CALL(GETMODULEVERSION, &abi_version) < 0) + if (PMC_CALL(PMC_OP_GETMODULEVERSION, &abi_version) < 0) return (pmc_syscall = -1); /* ignore patch & minor numbers for the comparison */ @@ -1367,7 +1366,7 @@ pmc_init(void) } bzero(&op_cpu_info, sizeof(op_cpu_info)); - if (PMC_CALL(GETCPUINFO, &op_cpu_info) < 0) + if (PMC_CALL(PMC_OP_GETCPUINFO, &op_cpu_info) < 0) return (pmc_syscall = -1); cpu_info.pm_cputype = op_cpu_info.pm_cputype; @@ -1391,7 +1390,7 @@ pmc_init(void) * Get soft events list. */ soft_event_info.pm_class = PMC_CLASS_SOFT; - if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info) < 0) + if (PMC_CALL(PMC_OP_GETDYNEVENTINFO, &soft_event_info) < 0) return (pmc_syscall = -1); /* Map soft events to static list. */ @@ -1720,7 +1719,7 @@ pmc_pmcinfo(int cpu, struct pmc_pmcinfo **ppmci) pmci->pm_cpu = cpu; - if (PMC_CALL(GETPMCINFO, pmci) < 0) { + if (PMC_CALL(PMC_OP_GETPMCINFO, pmci) < 0) { free(pmci); return (-1); } @@ -1739,7 +1738,7 @@ pmc_read(pmc_id_t pmc, pmc_value_t *value) pmc_read_op.pm_flags = PMC_F_OLDVALUE; pmc_read_op.pm_value = -1; - if (PMC_CALL(PMCRW, &pmc_read_op) < 0) + if (PMC_CALL(PMC_OP_PMCRW, &pmc_read_op) < 0) return (-1); *value = pmc_read_op.pm_value; @@ -1752,7 +1751,7 @@ pmc_release(pmc_id_t pmc) struct pmc_op_simple pmc_release_args; pmc_release_args.pm_pmcid = pmc; - return (PMC_CALL(PMCRELEASE, &pmc_release_args)); + return (PMC_CALL(PMC_OP_PMCRELEASE, &pmc_release_args)); } int @@ -1764,7 +1763,7 @@ pmc_rw(pmc_id_t pmc, pmc_value_t newvalue, pmc_value_t *oldvaluep) pmc_rw_op.pm_flags = PMC_F_NEWVALUE | PMC_F_OLDVALUE; pmc_rw_op.pm_value = newvalue; - if (PMC_CALL(PMCRW, &pmc_rw_op) < 0) + if (PMC_CALL(PMC_OP_PMCRW, &pmc_rw_op) < 0) return (-1); *oldvaluep = pmc_rw_op.pm_value; @@ -1779,7 +1778,7 @@ pmc_set(pmc_id_t pmc, pmc_value_t value) sc.pm_pmcid = pmc; sc.pm_count = value; - if (PMC_CALL(PMCSETCOUNT, &sc) < 0) + if (PMC_CALL(PMC_OP_PMCSETCOUNT, &sc) < 0) return (-1); return (0); } @@ -1790,7 +1789,7 @@ pmc_start(pmc_id_t pmc) struct pmc_op_simple pmc_start_args; pmc_start_args.pm_pmcid = pmc; - return (PMC_CALL(PMCSTART, &pmc_start_args)); + return (PMC_CALL(PMC_OP_PMCSTART, &pmc_start_args)); } int @@ -1799,7 +1798,7 @@ pmc_stop(pmc_id_t pmc) struct pmc_op_simple pmc_stop_args; pmc_stop_args.pm_pmcid = pmc; - return (PMC_CALL(PMCSTOP, &pmc_stop_args)); + return (PMC_CALL(PMC_OP_PMCSTOP, &pmc_stop_args)); } int @@ -1826,7 +1825,7 @@ pmc_write(pmc_id_t pmc, pmc_value_t value) pmc_write_op.pm_pmcid = pmc; pmc_write_op.pm_flags = PMC_F_NEWVALUE; pmc_write_op.pm_value = value; - return (PMC_CALL(PMCRW, &pmc_write_op)); + return (PMC_CALL(PMC_OP_PMCRW, &pmc_write_op)); } int @@ -1835,5 +1834,5 @@ pmc_writelog(uint32_t userdata) struct pmc_op_writelog wl; wl.pm_userdata = userdata; - return (PMC_CALL(WRITELOG, &wl)); + return (PMC_CALL(PMC_OP_WRITELOG, &wl)); }