From nobody Mon Aug 15 17:57:24 2022 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 4M626s1TBgz4Zcqr; Mon, 15 Aug 2022 17:57:25 +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 4M626s0wzHz42Tp; Mon, 15 Aug 2022 17:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660586245; 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=BfDm/jMInDEj2q63nA4ldNnzYNYyf7PYvWBJ+yzbv5I=; b=Dq+y6LjT6Jkta+nwYrSu5AAXkFGO0Z14mAsHZGM6NdAhItPkjee/YppJzoKICjL54Hkr+u BDHmaxqCIm6aXFX2DeYrNzNJ3oRsJ9pj9YYYddUJ06qEBtA8QxWtzknrGsVqX5UoWXyOim Opyxx/gbswdRMpimyxNOqKyDhK0WL19FH74iHkp9+CjKHx9hmla5dIsgYg34TOU9+xt/PY MNH6NYcvMrMrm2vNyC/aDnXcjrJhpvFzvzVzZUk3RodxbD6M4U52Zy620Wppe4SNTpVzAK qJ8ZhVuGLuIFk6wgclPQN0+RBpPRLHjA5qGE1AvyI3sXU1V4bxsJqmaNWk1+hA== 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 4M626s02Dlzdsc; Mon, 15 Aug 2022 17:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27FHvOfX055867; Mon, 15 Aug 2022 17:57:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27FHvOPV055866; Mon, 15 Aug 2022 17:57:24 GMT (envelope-from git) Date: Mon, 15 Aug 2022 17:57:24 GMT Message-Id: <202208151757.27FHvOPV055866@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 2f8b4d7218c2 - stable/13 - acpi_apei: Add sysctl to mute corrected errors. 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: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f8b4d7218c25a802ee5dc809e021bd38cb03643 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660586245; 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=BfDm/jMInDEj2q63nA4ldNnzYNYyf7PYvWBJ+yzbv5I=; b=IuR139Y6VBbw9hywLeXKnqRiN4sdPBQvsNHuq5TuaPOuNxrs4acPYN0tdA01NMrBErW31t sxsYLnFWFAnpOSk7S/+3gE+M5AGMtyAeS8peaN3CnBNNvroPuTGQiPznzgbMyFe8Ot5SRY bP8/5KhVKqzAfYTAc6P35wB9XSuNl17bNCCti6KrG7yqxV5E3upWTOugjx1lezltwcchTj 1XqU6SWgNeFoGH6NTyxleJzkX7yDLNx00MHGjUx5qxSLQ5NHpvFnuaa0xtQYCsu+G8f8Io 7D0BCMyy2E5PTCLRNSZSZS5eaNEsR6V8GIX6eYFUupf43GP/sYpTq+KuXvlmMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660586245; a=rsa-sha256; cv=none; b=Zie9cCwugqaSx0Yqbd/seBcqWE7XEAjtFouzsk/6YouIJ8IzUGXG5yKTz/GngyaL5lgCC5 Xnatj/+gKT6V/ZzKouh8rmDp1JtB+GtKGE9pi6ezrS/t0ow5gi94+SuYbHnQHhvgrzNOOE mDGXeV6cCbYDKWHzxGiipL5MYij4sakEmlID0w7+MO0MCJWP9vOw/77v8UH0tHtQALsw5d tyM3TGYN3m9OCvE9I3s5uqMZXT+uycM3TWbq5+BOxxDpYZCIqSEybCk69BDpguCfvflUEU s8jckI9Rg5LC2y94s62pIEseO3/gYDEoZKdKiWUga20DQoRPSpRk13qxY7CvwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2f8b4d7218c25a802ee5dc809e021bd38cb03643 commit 2f8b4d7218c25a802ee5dc809e021bd38cb03643 Author: Alexander Motin AuthorDate: 2022-08-05 17:45:35 +0000 Commit: Alexander Motin CommitDate: 2022-08-15 17:31:44 +0000 acpi_apei: Add sysctl to mute corrected errors. Setting hw.acpi.apei.log_corrected to 0 will mute corrected errors logging. MFC after: 1 week (cherry picked from commit 52a54b96ed1b7c0a1c04fc7651a1fc036bdc5bbc) --- sys/dev/acpica/acpi_apei.c | 58 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c index 35bab30a68f1..6da1480e94dd 100644 --- a/sys/dev/acpica/acpi_apei.c +++ b/sys/dev/acpica/acpi_apei.c @@ -157,6 +157,10 @@ apei_bus_write_8(struct resource *res, bus_size_t offset, uint64_t val) #define PGE_ID(ge) (fls(MAX(1, (ge)->v1.Notify.PollInterval)) - 1) +static struct sysctl_ctx_list apei_sysctl_ctx; +static struct sysctl_oid *apei_sysctl_tree; +static int log_corrected = 1; + int apei_nmi_handler(void); static const char * @@ -180,6 +184,11 @@ apei_mem_handler(ACPI_HEST_GENERIC_DATA *ged) { struct apei_mem_error *p = (struct apei_mem_error *)GED_DATA(ged); + if (!log_corrected && + (ged->ErrorSeverity == ACPI_HEST_GEN_ERROR_CORRECTED || + ged->ErrorSeverity == ACPI_HEST_GEN_ERROR_NONE)) + return (1); + printf("APEI %s Memory Error:\n", apei_severity(ged->ErrorSeverity)); if (p->ValidationBits & 0x01) printf(" Error Status: 0x%jx\n", p->ErrorStatus); @@ -234,10 +243,10 @@ static int apei_pcie_handler(ACPI_HEST_GENERIC_DATA *ged) { struct apei_pcie_error *p = (struct apei_pcie_error *)GED_DATA(ged); - int h = 0, off; + int off; #ifdef DEV_PCI device_t dev; - int sev; + int h = 0, sev; if ((p->ValidationBits & 0x8) == 0x8) { mtx_lock(&Giant); @@ -266,6 +275,11 @@ apei_pcie_handler(ACPI_HEST_GENERIC_DATA *ged) return (h); #endif + if (!log_corrected && + (ged->ErrorSeverity == ACPI_HEST_GEN_ERROR_CORRECTED || + ged->ErrorSeverity == ACPI_HEST_GEN_ERROR_NONE)) + return (1); + printf("APEI %s PCIe Error:\n", apei_severity(ged->ErrorSeverity)); if (p->ValidationBits & 0x01) printf(" Port Type: %u\n", p->PortType); @@ -308,7 +322,7 @@ apei_pcie_handler(ACPI_HEST_GENERIC_DATA *ged) printf("\n"); } } - return (h); + return (0); } static void @@ -333,6 +347,11 @@ apei_ged_handler(ACPI_HEST_GENERIC_DATA *ged) } else if (memcmp(pcie_uuid, ged->SectionType, ACPI_UUID_LENGTH) == 0) { h = apei_pcie_handler(ged); } else { + if (!log_corrected && + (ged->ErrorSeverity == ACPI_HEST_GEN_ERROR_CORRECTED || + ged->ErrorSeverity == ACPI_HEST_GEN_ERROR_NONE)) + return; + t = ged->SectionType; printf("APEI %s Error %02x%02x%02x%02x-%02x%02x-" "%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x:\n", @@ -646,11 +665,24 @@ static int apei_attach(device_t dev) { struct apei_softc *sc = device_get_softc(dev); + struct acpi_softc *acpi_sc; struct apei_pges *pges; struct apei_ge *ge; ACPI_STATUS status; int rid; + if (!apei_sysctl_tree) { + /* Install hw.acpi.apei sysctl tree */ + acpi_sc = acpi_device_get_parent_softc(dev); + apei_sysctl_tree = SYSCTL_ADD_NODE(&apei_sysctl_ctx, + SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO, + "apei", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "ACPI Platform Error Interface"); + SYSCTL_ADD_INT(&apei_sysctl_ctx, SYSCTL_CHILDREN(apei_sysctl_tree), + OID_AUTO, "log_corrected", CTLFLAG_RWTUN, &log_corrected, 0, + "Log corrected errors to the console"); + } + TAILQ_INIT(&sc->ges); TAILQ_INIT(&sc->nges.ges); TAILQ_INIT(&sc->iges.ges); @@ -779,5 +811,23 @@ static driver_t apei_driver = { sizeof(struct apei_softc), }; -DRIVER_MODULE(apei, acpi, apei_driver, apei_devclass, 0, 0); +static int +apei_modevent(struct module *mod __unused, int evt, void *cookie __unused) +{ + int err = 0; + + switch (evt) { + case MOD_LOAD: + sysctl_ctx_init(&apei_sysctl_ctx); + break; + case MOD_UNLOAD: + sysctl_ctx_free(&apei_sysctl_ctx); + break; + default: + err = EINVAL; + } + return (err); +} + +DRIVER_MODULE(apei, acpi, apei_driver, apei_devclass, apei_modevent, 0); MODULE_DEPEND(apei, acpi, 1, 1, 1);