From nobody Thu Jun 20 17:53:52 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 4W4p5F1jtJz5PC8f; Thu, 20 Jun 2024 17:53:53 +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 4W4p5D6nLTz4y2V; Thu, 20 Jun 2024 17:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718906033; 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=mZR1Jh3pHIQOZyqSuHxNHMxTonIupDMvlNoDNIylqmc=; b=JLh8mEZ8+CrTggXdBrdYdgbdZruX93eGosxRwzFf5AM0T3E5xTez8OhuDhX1bvZ8JKwcHB 5z4NRQDw1qmCaB7RBSlOKOUJL18fqlpNMfpvT9cuI8UC/pcAWEAmI/EC4G5/uAazkZdA1H E4F/ydlW+CVe4qsfWKhAa4JSxwnx9LgO0iQ6f4TAl/TJ0//8E9tm0HLWS3F4n/QQ/Ln3cI GW9SUwZBa7boOkD8YJcm3a0ToBoNg9eVHQEdLNaPqwA8xoI/VD+m047vsrfi24uHxAI9Dl xCYmNohKthZBay6uqGwYrZ8XOZAuH7HfSc8exwFuhJbd/5tbJZfTOKxQvYCbpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718906032; a=rsa-sha256; cv=none; b=P8gNtHl9bKNnv7MY6oVDlM/zIozu//93Fq0NDbVJ1Wukm1jq4MBwzMJrmWWTBUW96aOwGr T5t4JcHuX9f667Gupfwzl1xnB30OhJUYzRk+UmCXOhsDUSOW78kVGHtIXZD+uXO8ghS9F7 IFL4uJ16zMYbYkSxV2Qa2YslLvSEpk0SSiIbqDD+Fbxxrn6Ze60P9ilChx5Lpo7Eh6vrke t+ZP9ZYh+P97vwiiqXP3D9tMEBXcrUJTigh1nlj83fhUKazOeU4g30OvzdBnR5MwF8zcy3 XbLqOD9Mn40LoQIGeDXWdl+sakGyqIw4dUyDKadksCvykTtXvBE9RHhAaqBdFQ== 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=1718906032; 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=mZR1Jh3pHIQOZyqSuHxNHMxTonIupDMvlNoDNIylqmc=; b=eGMyDgS4mEFkv3Q0xxUnAEFK1LlJBry4R+kgWH0nQB/d+RGnQiwiP1RJY3FDl/MCzWa2JI ntcu5sEhsK1Wkv3qnfjdfMU1mJBJBoBIrvzWh6sl6YapSGl9GcYmf7Ut21lzhuaR6YH/PS ciSO2v59I0LDnLgL+rHDxMuquyHtf55nLti1bIXJ2dnCMbc6nKKPM8jABgbDM41BsFJEtR UInU0vK/U9cTFuEXxBWiRWwJQW4uxw4rbA+x/6sn+ShtjPyeOVL8aLNaOx/WNSP2AK89rQ 6yf+T8iok7n/0Rh80pxUuJCkzCi6tjGHZ8ZqVnk+yvI17vVxiBV3dJDHL9+zJg== 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 4W4p5D6GH4zb18; Thu, 20 Jun 2024 17:53:52 +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 45KHrqs5065993; Thu, 20 Jun 2024 17:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45KHrqFr065990; Thu, 20 Jun 2024 17:53:52 GMT (envelope-from git) Date: Thu, 20 Jun 2024 17:53:52 GMT Message-Id: <202406201753.45KHrqFr065990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 3beb43dd4f87 - main - callout: assert that callout_init_*lock* functions are called with a lock 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3beb43dd4f87fee0a8f5536ad103664374f9b97b Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=3beb43dd4f87fee0a8f5536ad103664374f9b97b commit 3beb43dd4f87fee0a8f5536ad103664374f9b97b Author: Gleb Smirnoff AuthorDate: 2024-06-20 17:53:31 +0000 Commit: Gleb Smirnoff CommitDate: 2024-06-20 17:53:31 +0000 callout: assert that callout_init_*lock* functions are called with a lock Quick grep around kernel confirms they all do. --- sys/kern/kern_timeout.c | 5 ++--- sys/sys/callout.h | 9 +++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index e06cf997ab8a..699a57d51f0e 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1331,11 +1331,10 @@ callout_init(struct callout *c, int mpsafe) void _callout_init_lock(struct callout *c, struct lock_object *lock, int flags) { + KASSERT(lock != NULL, ("%s: no lock", __func__)); KASSERT((flags & ~(CALLOUT_RETURNUNLOCKED | CALLOUT_SHAREDLOCK)) == 0, ("%s: bad flags %d", __func__, flags)); - KASSERT(lock != NULL || (flags & CALLOUT_RETURNUNLOCKED) == 0, - ("%s: CALLOUT_RETURNUNLOCKED with no lock", __func__)); - KASSERT(lock == NULL || !(LOCK_CLASS(lock)->lc_flags & LC_SLEEPABLE), + KASSERT(!(LOCK_CLASS(lock)->lc_flags & LC_SLEEPABLE), ("%s: callout %p has sleepable lock", __func__, c)); *c = (struct callout ){ diff --git a/sys/sys/callout.h b/sys/sys/callout.h index f2a5bf92ab46..5d0d896b5d3b 100644 --- a/sys/sys/callout.h +++ b/sys/sys/callout.h @@ -85,14 +85,11 @@ void callout_init(struct callout *, int); void _callout_init_lock(struct callout *, struct lock_object *, int); #define callout_init_mtx(c, mtx, flags) \ - _callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object : \ - NULL, (flags)) + _callout_init_lock((c), &(mtx)->lock_object, (flags)) #define callout_init_rm(c, rm, flags) \ - _callout_init_lock((c), ((rm) != NULL) ? &(rm)->lock_object : \ - NULL, (flags)) + _callout_init_lock((c), &(rm)->lock_object, (flags)) #define callout_init_rw(c, rw, flags) \ - _callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \ - NULL, (flags)) + _callout_init_lock((c), &(rw)->lock_object, (flags)) #define callout_pending(c) ((c)->c_iflags & CALLOUT_PENDING) int callout_reset_sbt_on(struct callout *, sbintime_t, sbintime_t, void (*)(void *), void *, int, int);