From nobody Tue Nov 19 23:51:14 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 4XtLqR0n9Lz5ctrK; Tue, 19 Nov 2024 23:51:15 +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 4XtLqR08f7z52QJ; Tue, 19 Nov 2024 23:51:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732060275; 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=r3RRFyDRADXcjFS/XAFaiYr1MK9LtJAhXQB2ZEg/C1A=; b=oCYCGEsvTNUdZqLUT3U0+ME87e8z1q+kJ+WkasOFdJVMpy6wxk//akcSNh1SoVlkOSNY/c gP/NvvFhyeBrlCIelXg67nioa/fChCE+auCTrEF/W2MZvyX5Jl4JArYk7Jt6l1S4s3S5zW MiaAHynzcJkI25hIrkZHuocVJjrVinLrdUyIi9+mI2fkyVxP/dCpRkU5bsl4STTIhAVNSr vjesNQksgO8kuk5vBwnfLrZ+EGjh3zoTt7fX8jsr7A8lYOjrldiKgTwg/VH+IhAkNNeDYg IhxuSRcPPT0U6gn8CLP89WpMyO6vkpdip7KZsWPAmqMteL/hsZAe8WXCXkrZpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732060275; 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=r3RRFyDRADXcjFS/XAFaiYr1MK9LtJAhXQB2ZEg/C1A=; b=ffMD+tIfo9bYK8N8Lj4yHhE8RpjGNi8QrsBL4r03S1ORwHhY8Nqa/MLsMVaPCWoauS6/k+ 8ar5HHyBlflJF9yhWr927HfxTcuAUqVWr8xOwjVr+1nsBbHlTzG/0OeWveqTE6jyO2YlkF lgEvboCoB3yEerTWWmHGtNEDt0jI/tzY2xFLjz/8mvv78nCL1b/SZn8ndbav16GHJpZo6k WxuA+kcdvMOnpCXkNAmx3FQag/VApFleQHN3kEQU6mfCllRH//DkOpnz/dIYE0NcumWmqj DMJ3Gbn/bsI0XScj2QdeqZBqCW7B3aR8OJdRRcRHMMBB1a+Ldob/gZEFal0Kpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732060275; a=rsa-sha256; cv=none; b=HQUZqkxF4xylolBsUMzGqYAkUF8VoeNPs8LUMX+T547moaQtEfPeLNNyGrjcgPz3PzH1Dr PVzygz4QkxgxTJ0rVChy9jC3wnux7zJLPee6sIsTuMlhvb+FUeE0v470mgkgQq8IJL1JYy 32r8F69O3gbC+shQVK5g1Gdm5oFWWM3DBghoROztI+1UmGW902K+L/kSJgbXHoVhbADUx9 NHRbZ1gwklLLv8V1mBsk+ynTBcZ2RTWAYllcwN1pNZqu/DSPh+guqG+4OaQmg5op/8qfcO xi36jMJM0PQpkh4CMh9Q5N3/yNHimH9YN33TqeWESBQM8O4zQODu9EfX6kXzlQ== 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 4XtLqQ6sL0zWl8; Tue, 19 Nov 2024 23:51:14 +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 4AJNpEXr083926; Tue, 19 Nov 2024 23:51:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJNpEnG083923; Tue, 19 Nov 2024 23:51:14 GMT (envelope-from git) Date: Tue, 19 Nov 2024 23:51:14 GMT Message-Id: <202411192351.4AJNpEnG083923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3c29734502c3 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 3c29734502c330fc8f8e345213791722aeaf55c1 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3c29734502c330fc8f8e345213791722aeaf55c1 commit 3c29734502c330fc8f8e345213791722aeaf55c1 Author: Mark Johnston AuthorDate: 2024-11-19 23:48:53 +0000 Commit: Mark Johnston CommitDate: 2024-11-19 23:48:53 +0000 hwpmc: Fix whitespace in logging macros MFC after: 1 week Sponsored by: Klara, Inc. --- 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 6394d7a9cdad..b472bf856b92 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -93,88 +93,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 /*