From nobody Mon Oct 09 23:19:11 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 4S4FNK1KSsz4whKp; Mon, 9 Oct 2023 23:19:12 +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 4S4FNJ3KmXz3WJL; Mon, 9 Oct 2023 23:19:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696893552; 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=f9tuwATAf8rELPhDmevrIz+LsR9sgTJ/7piD8Bkv51o=; b=sovaFco3X+14sex9sX58LubS4Kbdf8/o89hpo1+P/fvO2qYZJR7vB1F3psvdAgCf+wy+Ax jxyA5/UBeQwrojBJHMyqY2ypMcVoDa322geEtDrAlR2nPHnRJBnRNv8Xg6XkjtqJueY2pY K9fB8SFubPFHj2LBK+fHsT3b3WZSshOq1M5hS46bykJATA87kdAbTZdE8OaPYa9b7x2Ya/ 5skXUKLYmpmkoCqlfx2VJdIX2vBgJv8SBVGGAUwBgJesTgXWogPum8X8Xscn0aUHPqCmm1 KF7Mc7qfvtpuOymCBfnwtXd0UJ5NJoT6/UI8zCUbJQwyxrqFON4Ug3teEH3f7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696893552; a=rsa-sha256; cv=none; b=caFqsyKQLJB+yX7xQjUeQ060OB+bS1B7A7/y42B0jam/O+HcWOI3QHwuThiZAQUk6cQdZS O1UXvz8uGOHaVu2MvJHPH9YCAZ9ZgbQSUIzmUBlEJJtXFSyBElsXJ+YzsUQI04SJokFk9r ulvryHDa4/kPQ7T/tlwZoAl4QhQlb92hRmAIlam7d7BKNRG2ToYdUWN4QfqNypi28V+rMq 4eWz5AxHzGahloy6ilKBtmEvVmF7eiwIPv4vDK88aKHFSFlA4KcJENfj3wb0YxLez5X5FR IWDUXXNoZPrybEA24gdApZf1WLlw6xLIIjGx5olnSbjxMWOlYwi4ggehL5e14Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696893552; 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=f9tuwATAf8rELPhDmevrIz+LsR9sgTJ/7piD8Bkv51o=; b=sVrmBPxjh2l+yU7fF9qFmuQZ5c4N3WvFMJbiDNT7ocaea/KzL1qLszVVMWUvz1pkx8qyYX 7Lf/JqaWp5D98uBC2wqWX0AQ0/ZP/N8JkjM+9zo6hcrAkIh1NU7IaKAY4o8ixgDcS18DPD taWnareeVoz1NJuABsDJlI2wSHpnDYtM/NXRdzhB09aKF/fVrHt/3c43JoExylBXqU4ERX piVRTb2FEW7x2YwueVjNHAp1uzDVE27cpU0SntGNXHlyhpLMipKO+LrKmmwP13oUYcYHTy J46QcIY/ScGL+9ppbjbGq9Juzrhgob4GXaPMn1rD0Yx72eMszgq/Ijppb9fSwg== 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 4S4FNJ0jb8zfp; Mon, 9 Oct 2023 23:19:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 399NJB3x072692; Mon, 9 Oct 2023 23:19:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 399NJBiu072689; Mon, 9 Oct 2023 23:19:11 GMT (envelope-from git) Date: Mon, 9 Oct 2023 23:19:11 GMT Message-Id: <202310092319.399NJBiu072689@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 75b03f73b4a0 - stable/14 - vfs cache: sanitize debug counters 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 75b03f73b4a0f94090aa9fd050e82089c83fe2bb Auto-Submitted: auto-generated The branch stable/14 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=75b03f73b4a0f94090aa9fd050e82089c83fe2bb commit 75b03f73b4a0f94090aa9fd050e82089c83fe2bb Author: Mateusz Guzik AuthorDate: 2023-10-05 12:16:18 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-09 23:19:00 +0000 vfs cache: sanitize debug counters They are very rarely triggered, so no need for per-cpu distribution. At the same time the non-cpu ones still should use atomics to not lose any updates. (cherry picked from commit 2749c222da8a6325d39c0571f72b1dbed2f7d583) --- sys/kern/vfs_cache.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7e059d374c31..38a39331e237 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -553,17 +553,14 @@ static SYSCTL_NODE(_vfs_cache, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Name cache debugging"); #define DEBUGNODE_ULONG(name, varname, descr) \ SYSCTL_ULONG(_vfs_cache_debug, OID_AUTO, name, CTLFLAG_RD, &varname, 0, descr); -#define DEBUGNODE_COUNTER(name, varname, descr) \ - static COUNTER_U64_DEFINE_EARLY(varname); \ - SYSCTL_COUNTER_U64(_vfs_cache_debug, OID_AUTO, name, CTLFLAG_RD, &varname, \ - descr); -DEBUGNODE_COUNTER(zap_bucket_relock_success, zap_bucket_relock_success, +static u_long zap_bucket_relock_success; +DEBUGNODE_ULONG(zap_bucket_relock_success, zap_bucket_relock_success, "Number of successful removals after relocking"); -static long zap_bucket_fail; +static u_long zap_bucket_fail; DEBUGNODE_ULONG(zap_bucket_fail, zap_bucket_fail, ""); -static long zap_bucket_fail2; +static u_long zap_bucket_fail2; DEBUGNODE_ULONG(zap_bucket_fail2, zap_bucket_fail2, ""); -static long cache_lock_vnodes_cel_3_failures; +static u_long cache_lock_vnodes_cel_3_failures; DEBUGNODE_ULONG(vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed"); @@ -1664,7 +1661,7 @@ cache_zap_unlocked_bucket(struct namecache *ncp, struct componentname *cnp, cache_zap_locked(rncp); mtx_unlock(blp); cache_unlock_vnodes(dvlp, vlp); - counter_u64_add(zap_bucket_relock_success, 1); + atomic_add_long(&zap_bucket_relock_success, 1); return (0); } @@ -1760,7 +1757,7 @@ retry: error = cache_zap_locked_bucket(ncp, cnp, hash, blp); if (__predict_false(error != 0)) { - zap_bucket_fail++; + atomic_add_long(&zap_bucket_fail, 1); goto retry; } counter_u64_add(numposzaps, 1); @@ -1986,7 +1983,7 @@ negative_success: counter_u64_add(numnegzaps, 1); error = cache_zap_locked_bucket(ncp, cnp, hash, blp); if (__predict_false(error != 0)) { - zap_bucket_fail2++; + atomic_add_long(&zap_bucket_fail2, 1); goto retry; } cache_free(ncp); @@ -2184,8 +2181,8 @@ cache_lock_vnodes_cel_3(struct celockstate *cel, struct vnode *vp) } else { if (mtx_trylock(vlp)) goto out; - cache_lock_vnodes_cel_3_failures++; cache_unlock_vnodes_cel(cel); + atomic_add_long(&cache_lock_vnodes_cel_3_failures, 1); if (vlp < cel->vlp[0]) { mtx_lock(vlp); mtx_lock(cel->vlp[0]);