From nobody Thu Nov 28 14:38:57 2024 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 4Xzf8211ldz5dntR; Thu, 28 Nov 2024 14:38:58 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xzf816Qx5z44Bl; Thu, 28 Nov 2024 14:38:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732804737; 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=FK4XIobTbVBC6cwvingTTSMbEkV0ayyJY4N3hh7Yb/U=; b=RJXXrAOlT76b8n4xCpEvsWFw+/bW9zHT48VuYAly/HTCZI+0XwcFsQEown8CYuquwcfUk0 4gb0y5n6QojjKxkbrgV8SR2IF5D5XifGh3WBixvuWsBxZanG2EjN2IMDqkatwf72x06KEc gCKi/CC0413NmcDF3a6jCjDtSMpGLT9iZf/eexbB+3iD+L+TbxWpAL6uAEdjeuFuZS4bZN EwgExZSAklsKad5ajtN9lRobGPP3wG7GkXQNkUPUWlxPoMRP64Xu5pid5y+807KltoOvcN HupqP+GwnPICMU+ScU0uW0DUn+ZNRmQ1VTr26L5F649FbjjWh9CxUNOZTHli1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732804737; 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=FK4XIobTbVBC6cwvingTTSMbEkV0ayyJY4N3hh7Yb/U=; b=fmBsCzzFqOGWrvzUeiO0U+3l4OJapeo8iuJkFDy/SyUUWunpbKlNMUrOo/FsosdZ1moWPG fw4IPSGSBMmYXL4PinOFWs7tw1atshoC2kFolL5y7SJ9HwmpXoWIp9nne0dRT3sQMvGBPS CnmEB40028JCzXRJQVM4lXnftuGmDtCwuV63pqRlUFnk3YNTG8Frh1lGmJVdda56UE1Ygn Mm8783ewc2KpRh63sN/htopvLroJAdI2XhcFnsSXV87d4pQrUE9fJSqZ6T+RIcyvdmJNm4 LhbAKvur4ewYI+Qv7NmWRn3eSnhG54tPLl5AAHwI7eNHeTrX0pvyA2QFvvOcIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732804737; a=rsa-sha256; cv=none; b=SR2YCd6BCIzIbdr3jWPSGcAAAW+mjd2d35sgb/RGsqVKv5goRw3knymmEVmC0Ap3xrMIrc 6ja8BZ5J50ibpxv+ndzfv0VbN8ox9zrj+2cY8l4wDPfWkQ80NSJ/cDYKLDiBx1uyBV6ISx IAPZ99D2AvBpFvGIcCtB2xHbDCvqvXIf7dobeahLTUEwGMEuZoSBa8pTjhS61zTSGToMJf NAw66MWHAB2AfzW1UJn6iEKU5z2bZhgRcNiLs7bAOI3fzqE1ee0lZURs93PE3chYDeXGwF 7oAyx3TrVsRjMJJim0aVBl7rvPbIC4lBYM1Hw4ZifcnoU2dnJC3byhyHU7Yzvw== 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 4Xzf815yYVzjgH; Thu, 28 Nov 2024 14:38:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ASEcvuj035622; Thu, 28 Nov 2024 14:38:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ASEcvUt035619; Thu, 28 Nov 2024 14:38:57 GMT (envelope-from git) Date: Thu, 28 Nov 2024 14:38:57 GMT Message-Id: <202411281438.4ASEcvUt035619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ee0c917eeb0d - stable/14 - hwpmc: Fix whitespace in logging macros 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ee0c917eeb0dfd2cc74b487cac6374a5892bc4d2 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ee0c917eeb0dfd2cc74b487cac6374a5892bc4d2 commit ee0c917eeb0dfd2cc74b487cac6374a5892bc4d2 Author: Mark Johnston AuthorDate: 2024-11-19 23:48:53 +0000 Commit: Mark Johnston CommitDate: 2024-11-28 14:38:17 +0000 hwpmc: Fix whitespace in logging macros MFC after: 1 week Sponsored by: Klara, Inc. (cherry picked from commit 3c29734502c330fc8f8e345213791722aeaf55c1) --- sys/dev/hwpmc/hwpmc_logging.c | 136 ++++++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 66 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c index 742051720418..8b6c2a1feb5b 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -94,88 +94,92 @@ SYSCTL_INT(_kern_hwpmc, OID_AUTO, nbuffers_pcpu, CTLFLAG_RDTUN, static struct mtx pmc_kthread_mtx; /* sleep lock */ -#define PMCLOG_INIT_BUFFER_DESCRIPTOR(D, buf, domain) do { \ - (D)->plb_fence = ((char *) (buf)) + 1024*pmclog_buffer_size; \ - (D)->plb_base = (D)->plb_ptr = ((char *) (buf)); \ - (D)->plb_domain = domain; \ - } while (0) +#define PMCLOG_INIT_BUFFER_DESCRIPTOR(D, buf, domain) do { \ + (D)->plb_fence = ((char *)(buf)) + 1024 * pmclog_buffer_size; \ + (D)->plb_base = (D)->plb_ptr = ((char *)(buf)); \ + (D)->plb_domain = domain; \ +} while (0) -#define PMCLOG_RESET_BUFFER_DESCRIPTOR(D) do { \ - (D)->plb_ptr = (D)->plb_base; \ - } while (0) +#define PMCLOG_RESET_BUFFER_DESCRIPTOR(D) do { \ + (D)->plb_ptr = (D)->plb_base; \ +} while (0) /* * Log file record constructors. */ -#define _PMCLOG_TO_HEADER(T,L) \ +#define _PMCLOG_TO_HEADER(T, L) \ ((PMCLOG_HEADER_MAGIC << 24) | (T << 16) | ((L) & 0xFFFF)) /* reserve LEN bytes of space and initialize the entry header */ -#define _PMCLOG_RESERVE_SAFE(PO,TYPE,LEN,ACTION, TSC) do { \ - uint32_t *_le; \ - int _len = roundup((LEN), sizeof(uint32_t)); \ - struct pmclog_header *ph; \ - if ((_le = pmclog_reserve((PO), _len)) == NULL) { \ - ACTION; \ - } \ - ph = (struct pmclog_header *)_le; \ - ph->pl_header =_PMCLOG_TO_HEADER(TYPE,_len); \ - ph->pl_tsc = (TSC); \ - _le += sizeof(*ph)/4 /* skip over timestamp */ +#define _PMCLOG_RESERVE_SAFE(PO, TYPE, LEN, ACTION, TSC) do { \ + uint32_t *_le; \ + int _len = roundup((LEN), sizeof(uint32_t)); \ + struct pmclog_header *ph; \ + \ + if ((_le = pmclog_reserve((PO), _len)) == NULL) { \ + ACTION; \ + } \ + ph = (struct pmclog_header *)_le; \ + ph->pl_header =_PMCLOG_TO_HEADER(TYPE,_len); \ + ph->pl_tsc = (TSC); \ + _le += sizeof(*ph) / 4 /* skip over timestamp */ /* reserve LEN bytes of space and initialize the entry header */ -#define _PMCLOG_RESERVE(PO,TYPE,LEN,ACTION) do { \ - uint32_t *_le; \ - int _len = roundup((LEN), sizeof(uint32_t)); \ - uint64_t tsc; \ - struct pmclog_header *ph; \ - tsc = pmc_rdtsc(); \ - spinlock_enter(); \ - if ((_le = pmclog_reserve((PO), _len)) == NULL) { \ - spinlock_exit(); \ - ACTION; \ - } \ - ph = (struct pmclog_header *)_le; \ - ph->pl_header =_PMCLOG_TO_HEADER(TYPE,_len); \ - ph->pl_tsc = tsc; \ - _le += sizeof(*ph)/4 /* skip over timestamp */ - - - -#define PMCLOG_RESERVE_SAFE(P,T,L,TSC) _PMCLOG_RESERVE_SAFE(P,T,L,return,TSC) -#define PMCLOG_RESERVE(P,T,L) _PMCLOG_RESERVE(P,T,L,return) -#define PMCLOG_RESERVE_WITH_ERROR(P,T,L) _PMCLOG_RESERVE(P,T,L, \ - error=ENOMEM;goto error) +#define _PMCLOG_RESERVE(PO, TYPE, LEN, ACTION) do { \ + uint32_t *_le; \ + int _len = roundup((LEN), sizeof(uint32_t)); \ + uint64_t tsc; \ + struct pmclog_header *ph; \ + \ + tsc = pmc_rdtsc(); \ + spinlock_enter(); \ + if ((_le = pmclog_reserve((PO), _len)) == NULL) { \ + spinlock_exit(); \ + ACTION; \ + } \ + ph = (struct pmclog_header *)_le; \ + ph->pl_header =_PMCLOG_TO_HEADER(TYPE,_len); \ + ph->pl_tsc = tsc; \ + +#define PMCLOG_RESERVE_SAFE(P, T, L, TSC) \ + _PMCLOG_RESERVE_SAFE(P, T, L, return, TSC) +#define PMCLOG_RESERVE(P,T,L) \ + _PMCLOG_RESERVE(P, T, L, return) +#define PMCLOG_RESERVE_WITH_ERROR(P, T, L) \ + _PMCLOG_RESERVE(P, T, L, error = ENOMEM; goto error) #define PMCLOG_EMIT32(V) do { *_le++ = (V); } while (0) #define PMCLOG_EMIT64(V) do { \ - *_le++ = (uint32_t) ((V) & 0xFFFFFFFF); \ - *_le++ = (uint32_t) (((V) >> 32) & 0xFFFFFFFF); \ - } while (0) + *_le++ = (uint32_t) ((V) & 0xFFFFFFFF); \ + *_le++ = (uint32_t) (((V) >> 32) & 0xFFFFFFFF); \ +} while (0) /* Emit a string. Caution: does NOT update _le, so needs to be last */ -#define PMCLOG_EMITSTRING(S,L) do { bcopy((S), _le, (L)); } while (0) -#define PMCLOG_EMITNULLSTRING(L) do { bzero(_le, (L)); } while (0) - -#define PMCLOG_DESPATCH_SAFE(PO) \ - pmclog_release((PO)); \ - } while (0) - -#define PMCLOG_DESPATCH_SCHED_LOCK(PO) \ - pmclog_release_flags((PO), 0); \ - } while (0) - -#define PMCLOG_DESPATCH(PO) \ - pmclog_release((PO)); \ - spinlock_exit(); \ - } while (0) - -#define PMCLOG_DESPATCH_SYNC(PO) \ - pmclog_schedule_io((PO), 1); \ - spinlock_exit(); \ - } while (0) - +#define PMCLOG_EMITSTRING(S,L) do { \ + bcopy((S), _le, (L)); \ +} while (0) +#define PMCLOG_EMITNULLSTRING(L) do { \ + bzero(_le, (L)); \ +} while (0) + +#define PMCLOG_DESPATCH_SAFE(PO) \ + pmclog_release((PO)); \ +} while (0) + +#define PMCLOG_DESPATCH_SCHED_LOCK(PO) \ + pmclog_release_flags((PO), 0); \ +} while (0) + +#define PMCLOG_DESPATCH(PO) \ + pmclog_release((PO)); \ + spinlock_exit(); \ +} while (0) + +#define PMCLOG_DESPATCH_SYNC(PO) \ + pmclog_schedule_io((PO), 1); \ + spinlock_exit(); \ +} while (0) #define TSDELTA 4 /*