From nobody Wed May 13 12:39:51 2026 X-Original-To: dev-commits-src-main@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 4gFtMX2GJQz6dL5J for ; Wed, 13 May 2026 12:39:52 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gFtMW6mfyz3vws for ; Wed, 13 May 2026 12:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778675992; 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=iK+vCNCO0tolrFdbZGv+U0Eq6Dms14KNC3efOEZClLU=; b=YpKyiB6deJPjVSLqPNXaTqYusYFvDQhFNjpQABcGcq4xzLF8IG+v8rGvkHY5paKihZz4jQ br0N3MtJowlvoabhI3GaTnwzsmkKgGh4vwCeqkEKgKy8Z6sZNcitV1y9KfjrSjWtL1T+n4 R/0PsAGqLIM/D0sUDZnpJbZuiqLpxeeQrLH0jfCxue/InbrX/pVVm4N1SKaRtpr1A0ez4f Xj4kN3WO7KQx9N46SUIqwfkK+kqKyW9MMq4ocsW1/kanDyhCUyWaEk73WzWBFEhUz8uvUB 3vBgwy1POUJz6ntsH+9BriN3dj3EsJwdJLJ0zvA92WFxRpLfr+X6mQAlvgypfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778675991; a=rsa-sha256; cv=none; b=EDrAhZgQRylrblfIqcE09qKZ4FHDSrlYLSOkrNGhxAtPJq0d2ioESlykVYXVg55SvfS55Q YjnCh26IqeKqgw8+uqG/cMeRKurnI2KEXW85Xqu7ahbXAotCNMEz6+wvydWLGpYF3FagIK QgEZa0F/bTMTO9w+0MyNfclUxsywuWL/uZTYHvTcHEOscF2v6ineNUj54h8Az+TDv3NvDN x9BszxK+3Y/F2jfPOxg2Y7hG4r7bu8cei7niprAJ0wjl/04HSkjlaQ+SchIEI01g1jFDr+ suNwBa8O4+YlfG0poNi+PT3B2/S8neX2oWaktTohbEupqDMHDDBpEl0yAS9reQ== 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=1778675991; 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=iK+vCNCO0tolrFdbZGv+U0Eq6Dms14KNC3efOEZClLU=; b=FoKjPuDnUGRZGsfaZTkcQIdvAT1Kj7LH6rUtdcTAh4Vo4qtNH2Ki5317ghPnOqAG0gYyeJ /b9xZRRIKVu2Xmvsw3gQRrcf0TVVkMqVpj7fIsDucjDoGJ5VlNmMc7nAOdxXYwhfIN6gbM Smq5jTdZ1R1fMmdgV+sC1+QuIXDw9Yl9turueRj9lYEdYP26LVQWZtExMfbKr7YSnZ5yDy Vy6IkMCZRDdDlthrpqqoFP37htAHBABSw0W+wuAOmrVNuU0Snwj92dLlK4owICeXroLyvf bdFwboZMt2db2GdJCbntJB0azXFx8p5OAkdn73MAmomHOEIo2ISqvri9EWAOmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gFtMW6N6TzqyN for ; Wed, 13 May 2026 12:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c0eb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 13 May 2026 12:39:51 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: e5615cd8094f - main - acpi_spmc(4): INVARIANTS: Do not panic on getting constraints failure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5615cd8094f75a17572b3dae810f48ae8401d6c Auto-Submitted: auto-generated Date: Wed, 13 May 2026 12:39:51 +0000 Message-Id: <6a047117.1c0eb.3a123f6c@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=e5615cd8094f75a17572b3dae810f48ae8401d6c commit e5615cd8094f75a17572b3dae810f48ae8401d6c Author: Olivier Certner AuthorDate: 2026-05-04 19:10:25 +0000 Commit: Olivier Certner CommitDate: 2026-05-13 12:38:22 +0000 acpi_spmc(4): INVARIANTS: Do not panic on getting constraints failure Just continue without constraints checking in this case. To this end, remove the 'constraints_populated' field from 'struct acpi_spmc_softc' and any reference to it. However, we introduce another boolean, 'sc->get_constraints_succeeded', in order to check (under INVARIANTS) that acpi_spmc_get_constraints() is called only once on success. Calling that function another time after a success would leak memory. It would be easy to change that function to support multiple calls (e.g., by adding a call to acpi_spmc_free_constraints() near its start), however trying to retrieve the constraints again simply looks like wasted time as the same results are expected to be returned on each call. Reviewed by: imp, obiwac Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56812 --- sys/dev/acpica/acpi_spmc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c index 33915b536667..9a4264d6785b 100644 --- a/sys/dev/acpica/acpi_spmc.c +++ b/sys/dev/acpica/acpi_spmc.c @@ -223,7 +223,9 @@ struct acpi_spmc_softc { struct eventhandler_entry *eh_suspend; struct eventhandler_entry *eh_resume; - bool constraints_populated; +#ifdef INVARIANTS + bool get_constraints_succeeded; +#endif size_t constraint_count; struct acpi_spmc_constraint *constraints; }; @@ -488,8 +490,6 @@ acpi_spmc_parse_constraints_intel(struct acpi_spmc_softc *sc, ACPI_OBJECT *objec ACPI_OBJECT *detail; ACPI_OBJECT *constraint_package; - KASSERT(!sc->constraints_populated, ("Constraints already populated")); - sc->constraint_count = object->Package.Count; sc->constraints = malloc(sc->constraint_count * sizeof *sc->constraints, M_TEMP, M_WAITOK | M_ZERO); @@ -536,7 +536,6 @@ acpi_spmc_parse_constraints_intel(struct acpi_spmc_softc *sc, ACPI_OBJECT *objec constraint_package->Package.Elements[2].Integer.Value; } - sc->constraints_populated = true; return (0); } @@ -549,8 +548,6 @@ acpi_spmc_parse_constraints_amd(struct acpi_spmc_softc *sc, ACPI_OBJECT *object) struct acpi_spmc_constraint *constraint; ACPI_OBJECT *name_obj; - KASSERT(!sc->constraints_populated, ("Constraints already populated")); - /* * First element in the package is unknown. * Second element is the number of device constraints. @@ -596,7 +593,6 @@ acpi_spmc_parse_constraints_amd(struct acpi_spmc_softc *sc, ACPI_OBJECT *object) constraint_obj->Package.Elements[3].Integer.Value; } - sc->constraints_populated = true; return (0); } @@ -613,8 +609,8 @@ acpi_spmc_get_constraints(device_t dev) struct acpi_spmc_constraint *constraint; sc = device_get_softc(dev); - if (sc->constraints_populated) - return (0); + + MPASS(!sc->get_constraints_succeeded); /* The Microsoft DSM doesn't have this function. */ is_amd = has_dsm(sc, DSM_AMD); @@ -651,6 +647,10 @@ acpi_spmc_get_constraints(device_t dev) constraint->handle = NULL; } } + +#ifdef INVARIANTS + sc->get_constraints_succeeded = true; +#endif return (0); } @@ -661,7 +661,6 @@ acpi_spmc_check_constraints(struct acpi_spmc_softc *sc) bool violation = false; #endif - KASSERT(sc->constraints_populated, ("Constraints not populated")); /* * Avoid printing that constraints are respected when there are no * constraints at all.