From patchwork Tue Apr 20 07:10:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "vasilii.smirnov--- via Guix-patches\" via" X-Patchwork-Id: 28711 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5238127BC79; Tue, 20 Apr 2021 08:11:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B6B6B27BC77 for ; Tue, 20 Apr 2021 08:11:13 +0100 (BST) Received: from localhost ([::1]:48460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYkXQ-0003gI-TD for patchwork@mira.cbaines.net; Tue, 20 Apr 2021 03:11:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYkXG-0003ba-AV for guix-patches@gnu.org; Tue, 20 Apr 2021 03:11:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYkXF-0005lT-UX for guix-patches@gnu.org; Tue, 20 Apr 2021 03:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYkXF-0001ys-Ni for guix-patches@gnu.org; Tue, 20 Apr 2021 03:11:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47905] gnu: Add rasdaemon. Resent-From: elaexuotee@wilsonb.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 20 Apr 2021 07:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47905 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Leo Famulari Cc: 47905@debbugs.gnu.org Received: via spool by 47905-submit@debbugs.gnu.org id=B47905.16189026427585 (code B ref 47905); Tue, 20 Apr 2021 07:11:01 +0000 Received: (at 47905) by debbugs.gnu.org; 20 Apr 2021 07:10:42 +0000 Received: from localhost ([127.0.0.1]:52811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYkWo-0001y8-C9 for submit@debbugs.gnu.org; Tue, 20 Apr 2021 03:10:42 -0400 Received: from m42-5.mailgun.net ([69.72.42.5]:26420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYkWh-0001xk-NC for 47905@debbugs.gnu.org; Tue, 20 Apr 2021 03:10:33 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1618902630; h=Content-Type: MIME-Version: Message-Id: In-Reply-To: References: From: Subject: Cc: To: Date: Sender; bh=XnWWuuFkO8a097tKLIU6vDrz7bLQ0+kS0UgWsILWBvE=; b=ECIfgnhcKMC2pwC+XMseyEwX5ONuvFZa+wISv0uXRmpUu/ni1D7GM9sHPiWsV9A0rzqmM+Fg w3r8z5E84X50eTWUKUJW4xWpzTMKQ13Btx572DQJ9e9KPD0+UCygQIXklyVVku5p7aH6I6N+ M5QacgVATgszPe+a4Kiz7E0clrSLA9BwDs9dkE0E0Lj/Y7lWe/ZCZ0JFjRz+ft9sDmyZg8BO xBhY309XpsKu9IhwVJA1fO9j1N31eNGeJ/QtY5esx6eTLzdEwxmI2lZ7E7zYj0ubt20rHUhL Q87O523mmYa5dx3Vt0MCnsi1Ro9b2lita9NFaY1QrhGA8OHOLtK2uQ== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyI1NGFiNSIsICI0NzkwNUBkZWJidWdzLmdudS5vcmciLCAiMDg1NDdhIl0= Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 607e7e412cc44d3aea24563a (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Tue, 20 Apr 2021 07:09:53 GMT Received: from localhost (x108155.dynamic.ppp.asahi-net.or.jp [122.249.108.155]) by wilsonb.com (Postfix) with ESMTPSA id AB3E3A3279; Tue, 20 Apr 2021 07:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1618902591; bh=XnWWuuFkO8a097tKLIU6vDrz7bLQ0+kS0UgWsILWBvE=; h=Date:To:Cc:Subject:From:References:In-Reply-To:From; b=zRrTQyRtsDubpAr9y7cckzQlRsdrgIOEq2R6Os2ezwKRICtByG401Nf71Ip4/LQTY uWpLQiVwtawmI/10LnRToUq6hhSwjuESUq5mndKJqMfErVfF6Pom08RGrs3kqRcll7 NiOqnSSGvmrwR8iJzToO0vOEni+4wQBDHghmvLwyrHllYUVSHPMXTOGzdg/wCPrGqL zYXDr3ltH7R/O6j0AIcBeKqngDL2LQqQb61itKpM4QTMahyQa5ztBc46rC4IG4bYkI YLXBgNH7P8HhGFnGTG5cFE/VHLULH+Ui6vSFsrferPqPBxH31h/vnqglrhIA+0ZcdJ qklXc8nLzCuhy/VYxCeBcn4+Y3SJxxy2e/HhirarSAeShfuROK79EdaF9sZocOP0UE I3XyZZHeET16lMY4JsG2BFfyrWRABjmfQHwOcziEWYa8CRUguIIHJ4cCDw1RDv17ce 0YZNq/UjjtT9vhzxiEjSane+r5G8LJ6OXjfJoAXUIEi3tdqjU0epuf27ZufYpXlsE7 9sTWenKOjnc5XYZ3GnL/3vMO1wMG4oMMi4CKWr+rIa3moLKaiMckaC4asPWY49kQG1 RK8Jy3YzL3PAASwnBIKauTOmHxXyz/8lU+cGs1FBj98O1328ddYOgTT/W2kfYz+UcW paFgZQvm+GIx+3vC0b0E7QiI= Date: Tue, 20 Apr 2021 16:10:54 +0900 References: <31MWDEN7Q9XOV.2001N5J6G4U9K@wilsonb.com> In-Reply-To: Message-Id: <34GOUL165TOWY.3FR9YU3I80NFA@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: elaexuotee@wilsonb.com X-ACL-Warn: , elaexuotee--- via Guix-patches X-Patchwork-Original-From: elaexuotee--- via Guix-patches via From: "vasilii.smirnov--- via Guix-patches\" via" X-getmail-retrieved-from-mailbox: Patches This patch updates the license field to contain lgpl2.1, gpl2, and gpl2+. I also added a lot to the docs. Upstream docs are pretty sparse, so I mostly just pilfered from the Linux kernel admin-guide explanation of RAS. At the end of the explanation, I include a URL to that guide directly. From dc8bdf692d3802f87aa5b13a244771e1707c1a1a Mon Sep 17 00:00:00 2001 From: "B. Wilson" Date: Tue, 20 Apr 2021 11:49:26 +0900 Subject: [PATCH] gnu: Add rasdaemon. To: guix-patches@gnu.org * gnu/packages/linux.scm (rasdaemon): New variable. * gnu/services/linux.scm (rasdaemon-configuration) (rasdaemon-configuration?, rasdaemon-configuration-record?) (rasdaemon-service-type): New variables. * doc/guix.texi (Linux Services): Document it. --- doc/guix.texi | 81 ++++++++++++++++++++++++++++++++++++++++++ gnu/packages/linux.scm | 45 +++++++++++++++++++++++ gnu/services/linux.scm | 49 +++++++++++++++++++++++++ 3 files changed, 175 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 58bcfbdbb5..a80ad02223 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -88,6 +88,7 @@ Copyright @copyright{} 2020 John Soo@* Copyright @copyright{} 2020 Jonathan Brielmaier@* Copyright @copyright{} 2020 Edgar Vincent@* Copyright @copyright{} 2021 Maxime Devos@* +Copyright @copyright{} 2021 B. Wilson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -31457,6 +31458,86 @@ parameters, can be done as follow: @end lisp @end deffn +@cindex rasdaemon +@cindex Platform Reliability, Availability and Serviceability daemon +@subsubheading Rasdaemon Service + +The Rasdaemon service provides a daemon which monitors the platform Reliablity, +Availability and Serviceability (RAS) reports from the Linux kernel trace +events, logging them in @file{/var/log/rasdaemon.log}. + +Reliability, Availability and Serviceability is a concept used on servers meant +to measure their robustness. + +@strong{Relability} is the probability that a system will produce correct +outputs: + +@itemize @bullet +@item Generally measured as Mean Time Between Failures (MTBF), and +@item Enhanced by features that help to avoid, detect and repair hardware. +faults +@end itemize + +@strong{Availability} is the probability that a system is operational at a +given time: + +@itemize @bullet +@item Generally measured as a percentage of downtime per a period of time, and +@item Often uses mechanisms to detect and correct hardware faults in runtime. +@end itemize + +@strong{Serviceability} is the simplicity and speed with which a system can be +repaired or maintained: + +@itemize @bullet +@item Generally measured on Mean Time Between Repair (MTBR). +@end itemize + + +Among the monitoring measures, the most usual ones include: + +@itemize @bullet +@item CPU – detect errors at instruction execution and at L1/L2/L3 caches; +@item Memory – add error correction logic (ECC) to detect and correct errors; +@item I/O – add CRC checksums for transferred data; +@item Storage – RAID, journal file systems, checksums, Self-Monitoring, +Analysis and Reporting Technology (SMART). +@end itemize + +By monitoring the number of occurrences of error detections, it is possible to +identify if the probability of hardware errors is increasing, and, on such +case, do a preventive maintenance to replace a degraded component while those +errors are correctable. + +For detailed information about the types of error events gathered and how to +make sense of them, see the kernel administrator's guide at +@url{https://www.kernel.org/doc/html/latest/admin-guide/ras.html}. + +@defvr {Scheme Variable} rasdaemon-service-type +Service type for the @command{rasdaemon} service. It accepts a +@code{rasdaemon-configuration} object. Instantiating like + +@lisp +(service rasdaemon-service-type) +@end lisp + +will load with a default configuration, which monitors all events and logs to +@file{/var/log/rasdaemon.log}. +@end defvr + +@deftp {Data Type} rasdaemon-configuration +The data type representing the configuration of @command{rasdaemon}. + +@table @asis +@item @code{record?} (default: @code{#f}) + +A boolean indicating whether to record the events in an SQLite database. This +provides a more structured access to the information contained in the log file. +The database location is hard-coded to @file{/var/lib/rasdaemon/ras-mc_event.db}. + +@end table +@end deftp + @cindex zram @cindex compressed swap @cindex Compressed RAM-based block devices diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 1ea9d80834..0384ae03df 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -53,6 +53,7 @@ ;;; Copyright © 2020 Zhu Zihao ;;; Copyright © 2020 David Dashyan ;;; Copyright © 2020 pukkamustard +;;; Copyright © 2021 B. Wilson ;;; ;;; This file is part of GNU Guix. ;;; @@ -130,6 +131,7 @@ #:use-module (gnu packages sdl) #:use-module (gnu packages serialization) #:use-module (gnu packages slang) + #:use-module (gnu packages sqlite) #:use-module (gnu packages texinfo) #:use-module (gnu packages tls) #:use-module (gnu packages valgrind) @@ -8037,3 +8039,46 @@ kernel side implementation.") read-only file system optimized for resource-scarce devices. This package provides user-space tools for creating EROFS file systems.") (license license:gpl2+))) + +(define-public rasdaemon + (package + (name "rasdaemon") + (version "0.6.6") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mchehab/rasdaemon") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "13g39x19lfjf9izdcb0nlyfjrgpliivhv4nw3ndgyzi59l3yqc0v")))) + (native-inputs `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool))) + (inputs `(("sqlite" ,sqlite))) + (arguments + `(#:configure-flags '("--enable-all" + "--localstatedir=/var") + #:phases + (modify-phases %standard-phases + (add-before 'configure 'munge-autotools + (lambda _ + ;; For some reason upstream forces sysconfdir=/etc. This results + ;; in EPERM during the install phase. Removing the offending + ;; line lets sysconfdir correctly pick up DESTDIR. + (substitute* "configure.ac" + (("^test .* sysconfdir=/etc\n$") "")) + ;; Upstream tries to create /var/lib/rasdaemon at install time. + ;; This results in EPERM on guix. Instead, the service should + ;; create this at activation time. + (substitute* "Makefile.am" + (("^\\s*\\$\\(install_sh\\) -d .*@RASSTATEDIR@.*$") ""))))))) + (build-system gnu-build-system) + (home-page "https://github.com/mchehab/rasdaemon") + (synopsis "Platform Reliability, Availability and Serviceability tools") + (description "The @code{rasdaemon} program is a daemon which monitors the +platform Reliablity, Availability and Serviceability (RAS) reports from the +Linux kernel trace events. These trace events are logged in +/sys/kernel/debug/tracing, reporting them via syslog/journald.") + (license (list license:gpl2 license:gpl2+ license:lgpl2.1)))) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index 340b330030..5ecc9bdf25 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2020 Brice Waegeneire ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2021 raid5atemyhomework +;;; Copyright © 2021 B. Wilson ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +48,11 @@ kernel-module-loader-service-type + rasdaemon-configuration + rasdaemon-configuration? + rasdaemon-configuration-record? + rasdaemon-service-type + zram-device-configuration zram-device-configuration? zram-device-configuration-size @@ -188,6 +194,49 @@ representation." (extend append) (default-value '()))) + +;;; +;;; Reliability, Availability, and Serviceability (RAS) daemon +;;; + +(define-record-type* + rasdaemon-configuration make-rasdaemon-configuration + rasdaemon-configuration? + (record? rasdaemon-configuration-record? (default #f))) + +(define (rasdaemon-configuration->command-line-args config) + "Translate to its command line arguments + representation" + (let ((record? (rasdaemon-configuration-record? config))) + `(,(file-append rasdaemon "/sbin/rasdaemon") + "--foreground" ,@(if record? '("--record") '())))) + +(define (rasdaemon-activation config) + (let ((record? (rasdaemon-configuration-record? config)) + (rasdaemon-dir "/var/lib/rasdaemon")) + (with-imported-modules '((guix build utils)) + #~(if #$record? (mkdir-p #$rasdaemon-dir))))) + +(define (rasdaemon-shepherd-service config) + (shepherd-service + (documentation "Run rasdaemon") + (provision '(rasdaemon)) + (start #~(make-forkexec-constructor + '#$(rasdaemon-configuration->command-line-args config) + #:log-file "/var/log/rasdaemon.log")) + (stop #~(make-kill-destructor)))) + +(define rasdaemon-service-type + (service-type + (name 'rasdaemon) + (default-value (rasdaemon-configuration)) + (extensions + (list (service-extension shepherd-root-service-type + (compose list rasdaemon-shepherd-service)) + (service-extension activation-service-type rasdaemon-activation))) + (compose concatenate) + (description "Run @command{rasdaemon}, the RAS monitor"))) + ;;; ;;; Kernel module loader. -- 2.31.1