From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Sep 22 10:10:02 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 822031065673 for ; Sat, 22 Sep 2012 10:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5673E8FC0A for ; Sat, 22 Sep 2012 10:10:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q8MAA2nx053427 for ; Sat, 22 Sep 2012 10:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q8MAA2YS053426; Sat, 22 Sep 2012 10:10:02 GMT (envelope-from gnats) Resent-Date: Sat, 22 Sep 2012 10:10:02 GMT Resent-Message-Id: <201209221010.q8MAA2YS053426@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jeremy Chadwick Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AED24106567A for ; Sat, 22 Sep 2012 10:02:51 +0000 (UTC) (envelope-from jdc@koitsu.strangled.net) Received: from qmta06.emeryville.ca.mail.comcast.net (qmta06.emeryville.ca.mail.comcast.net [IPv6:2001:558:fe2d:43:76:96:30:56]) by mx1.freebsd.org (Postfix) with ESMTP id 931A58FC0A for ; Sat, 22 Sep 2012 10:02:51 +0000 (UTC) Received: from omta20.emeryville.ca.mail.comcast.net ([76.96.30.87]) by qmta06.emeryville.ca.mail.comcast.net with comcast id 2A1S1k0011smiN4A6A2rGM; Sat, 22 Sep 2012 10:02:51 +0000 Received: from koitsu.strangled.net ([67.180.84.87]) by omta20.emeryville.ca.mail.comcast.net with comcast id 29xq1k00E1t3BNj8g9xqml; Sat, 22 Sep 2012 09:57:51 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 98E7473A1C; Sat, 22 Sep 2012 02:57:50 -0700 (PDT) Message-Id: <20120922095750.98E7473A1C@icarus.home.lan> Date: Sat, 22 Sep 2012 02:57:50 -0700 (PDT) From: Jeremy Chadwick To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: jhb@FreeBSD.org Subject: ports/171866: sysutils/mcelog -- update to 1.0pre3 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jeremy Chadwick List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Sep 2012 10:10:02 -0000 >Number: 171866 >Category: ports >Synopsis: sysutils/mcelog -- update to 1.0pre3 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Sat Sep 22 10:10:01 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Jeremy Chadwick >Release: FreeBSD 9.1-PRERELEASE amd64 >Organization: >Environment: System: FreeBSD icarus.home.lan 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Wed Sep 19 04:41:54 PDT 2012 root@icarus.home.lan:/usr/obj/usr/src/sys/X7SBA_RELENG_9_amd64 amd64 >Description: Update sysutils/mcelog from 1.0pre2 to 1.0pre3. Verified build + usability testing (via mcelog --no-dmi --ascii) with an older Intel MCE. >How-To-Repeat: >Fix: Apply below patch. Once a PR number is generated, the patch will also be available for download here: http://jdc.koitsu.org/freebsd/{prnum}/ Due to the "patching of patches" complexity (hard to read diffs, etc.), if a tarball of the updated sysutils/mcelog directory is needed, just let me know. Index: Makefile =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- Makefile 28 Jun 2012 20:15:27 -0000 1.4 +++ Makefile 22 Sep 2012 09:50:11 -0000 @@ -6,7 +6,7 @@ # PORTNAME= mcelog -DISTVERSION= 1.0pre2 +DISTVERSION= 1.0pre3 CATEGORIES= sysutils MASTER_SITES= ftp://ftp.kernel.org/pub/linux/utils/cpu/mce/ \ http://147.52.159.12/mirrors/ftp.kernel.org/pub/linux/utils/cpu/mce/ \ Index: distinfo =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/distinfo,v retrieving revision 1.1 diff -u -r1.1 distinfo --- distinfo 15 Oct 2011 02:53:31 -0000 1.1 +++ distinfo 22 Sep 2012 09:50:11 -0000 @@ -1,2 +1,2 @@ -SHA256 (mcelog-1.0pre2.tar.gz) = 39bec2a19e2548afe9dbc80f6f9dcee6664fffa7ccc142aeb5e1f8c217c1705c -SIZE (mcelog-1.0pre2.tar.gz) = 174553 +SHA256 (mcelog-1.0pre3.tar.gz) = 0782e0aa952fa4bd641071e6b501774a63993a813a4f494ffd7819521a13c50c +SIZE (mcelog-1.0pre3.tar.gz) = 176649 Index: pkg-descr =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/pkg-descr,v retrieving revision 1.1 diff -u -r1.1 pkg-descr --- pkg-descr 15 Oct 2011 02:53:31 -0000 1.1 +++ pkg-descr 22 Sep 2012 09:50:11 -0000 @@ -4,9 +4,12 @@ This software is heavily patched to work on FreeBSD systems, and thus provides an extremely limited subset of features as -of this writing. The primary purpose is to provide a way to -decode MCE output from the FreeBSD kernel into something more -human-readable using the command 'mcelog --no-dmi --ascii' +of this writing (for example, daemon mode is not currently +supported). + +The primary purpose is to provide a way to decode MCE output +from the FreeBSD kernel into something more human-readable +using the command 'mcelog --no-dmi --ascii'. FreeBSD conversion patches were originally written by John Baldwin and later incorporated into this Index: pkg-message =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/pkg-message,v retrieving revision 1.1 diff -u -r1.1 pkg-message --- pkg-message 15 Oct 2011 02:53:31 -0000 1.1 +++ pkg-message 22 Sep 2012 09:50:11 -0000 @@ -1,7 +1,12 @@ -================================================= -You can decode MCE output from the FreeBSD kernel -by using the following command: +====================================================== +You can decode MCE output from the FreeBSD kernel by +using the following command: -mcelog --no-dmi --ascii --file /path/to/log + mcelog --no-dmi --ascii --file /path/to/log -================================================= +Or if you wish to paste the MCE via stdin: + + mcelog --no-dmi --ascii + {...paste MCE and send EOF/press Ctrl-D...} + +====================================================== Index: files/patch-Makefile =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/files/patch-Makefile,v retrieving revision 1.1 diff -u -r1.1 patch-Makefile --- files/patch-Makefile 15 Oct 2011 02:53:31 -0000 1.1 +++ files/patch-Makefile 22 Sep 2012 09:50:11 -0000 @@ -1,5 +1,5 @@ ---- ./Makefile.orig 2009-12-15 07:18:40.000000000 -0500 -+++ ./Makefile 2011-10-14 22:36:47.000000000 -0400 +--- Makefile.orig 2010-01-20 18:36:52.000000000 -0800 ++++ Makefile 2012-09-22 01:50:21.019688386 -0700 @@ -1,5 +1,5 @@ CFLAGS := -g -Os -prefix := /usr @@ -7,7 +7,7 @@ etcprefix := # Define appropiately for your distribution # DOCDIR := /usr/share/doc/packages/mcelog -@@ -28,10 +28,18 @@ +@@ -28,11 +28,18 @@ .PHONY: install clean depend @@ -15,9 +15,10 @@ OBJ := p4.o k8.o mcelog.o dmi.o tsc.o core2.o bitfield.o intel.o \ nehalem.o dunnington.o tulsa.o config.o memutil.o msg.o \ - eventloop.o leaky-bucket.o memdb.o server.o trigger.o \ -- client.o cache.o sysfs.o yellow.o page.o rbtree.o +- client.o cache.o sysfs.o yellow.o page.o rbtree.o \ +- xeon75xx.o + eventloop.o leaky-bucket.o memdb.o server.o client.o \ -+ cache.o rbtree.o ++ cache.o rbtree.o xeon75xx.o +ifndef FREEBSD +OBJ += page.o trigger.o sysfs.o yellow.o +endif @@ -28,7 +29,7 @@ DISKDB_OBJ := diskdb.o dimm.o db.o CLEAN := mcelog dmi tsc dbquery .depend .depend.X dbquery.o ${DISKDB_OBJ} DOC := mce.pdf -@@ -47,7 +55,7 @@ +@@ -48,7 +55,7 @@ SRC := $(OBJ:.o=.c) @@ -37,7 +38,7 @@ # dbquery intentionally not installed by default install: mcelog -@@ -81,8 +89,6 @@ +@@ -82,8 +89,6 @@ .depend: ${SRC} ${CC} -MM -I. ${SRC} > .depend.X && mv .depend.X .depend Index: files/patch-config.c =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/files/patch-config.c,v retrieving revision 1.1 diff -u -r1.1 patch-config.c --- files/patch-config.c 15 Oct 2011 02:53:31 -0000 1.1 +++ files/patch-config.c 22 Sep 2012 09:50:11 -0000 @@ -1,5 +1,5 @@ ---- ./config.c.orig 2009-12-15 07:18:40.000000000 -0500 -+++ ./config.c 2011-10-14 22:36:47.000000000 -0400 +--- config.c.orig 2010-01-20 18:36:52.000000000 -0800 ++++ config.c 2012-09-22 02:32:52.718116009 -0700 @@ -18,6 +18,9 @@ Author: Andi Kleen */ @@ -10,7 +10,7 @@ #include #include #include -@@ -126,6 +129,21 @@ +@@ -127,6 +130,21 @@ return s; } @@ -32,3 +32,16 @@ int parse_config_file(const char *fn) { FILE *f; +@@ -304,7 +322,12 @@ + s = config_string(header, name); + if (s) { + /* no $PATH */ ++#ifdef __Linux_ + if (trigger_check(s) != 0) { ++#endif ++#ifdef __FreeBSD__ ++ if (access(s, R_OK|X_OK) != 0) { ++#endif + SYSERRprintf("Trigger `%s' not executable\n", s); + exit(1); + } Index: files/patch-eventloop.c =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/files/patch-eventloop.c,v retrieving revision 1.1 diff -u -r1.1 patch-eventloop.c --- files/patch-eventloop.c 15 Oct 2011 02:53:31 -0000 1.1 +++ files/patch-eventloop.c 22 Sep 2012 09:50:11 -0000 @@ -1,5 +1,5 @@ ---- ./eventloop.c.orig 2009-12-15 07:18:40.000000000 -0500 -+++ ./eventloop.c 2011-10-14 22:36:47.000000000 -0400 +--- eventloop.c.orig 2010-01-20 18:36:52.000000000 -0800 ++++ eventloop.c 2012-09-22 02:25:13.281116126 -0700 @@ -38,7 +38,9 @@ static struct pollfd pollfds[MAX_POLLFD]; static struct pollcb pollcbs[MAX_POLLFD]; @@ -18,17 +18,25 @@ int event_signal(int sig) { static int first = 1; -@@ -111,11 +114,17 @@ - return -1; - return 0; - } +@@ -126,17 +129,25 @@ + + static int (*ppoll_vec)(struct pollfd *, nfds_t, const struct timespec + *, const sigset_t *); +#endif void eventloop(void) { ++#ifdef __Linux__ + #if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 5 || __GLIBC__ > 2 + ppoll_vec = ppoll; + #endif + if (!ppoll_vec) + ppoll_vec = ppoll_fallback; ++#endif + for (;;) { +#ifdef __Linux__ - int n = ppoll(pollfds, max_pollfd, NULL, &event_sigs); + int n = ppoll_vec(pollfds, max_pollfd, NULL, &event_sigs); +#endif +#ifdef __FreeBSD__ + int n = poll(pollfds, max_pollfd, -1); Index: files/patch-intel.c =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/files/patch-intel.c,v retrieving revision 1.1 diff -u -r1.1 patch-intel.c --- files/patch-intel.c 15 Oct 2011 02:53:31 -0000 1.1 +++ files/patch-intel.c 22 Sep 2012 09:50:11 -0000 @@ -1,21 +1,30 @@ ---- ./intel.c.orig 2009-12-15 07:18:40.000000000 -0500 -+++ ./intel.c 2011-10-14 22:36:47.000000000 -0400 -@@ -38,7 +38,7 @@ +--- intel.c.orig 2010-01-20 18:36:52.000000000 -0800 ++++ intel.c 2012-09-22 01:58:40.204115724 -0700 +@@ -43,7 +43,7 @@ return CPU_CORE2; else if (model == 0x1d) return CPU_DUNNINGTON; - else if (model == 0x1a) + else if (model == 0x1a || model == 0x2c) /* Nehalem/Westmere */ return CPU_NEHALEM; - - if (model >= 0x1a) -@@ -79,7 +79,9 @@ + else if (model == 0x2e) + return CPU_XEON75XX; +@@ -94,14 +94,18 @@ + if (recordlen > offsetof(struct mce, mcgcap) && m->mcgcap & MCG_CMCI_P) corr_err_cnt = EXTRACT(m->status, 38, 52); - memory_error(m, channel, dimm, corr_err_cnt, recordlen); + memory_error(m, channel[0], dimm[0], corr_err_cnt, recordlen); ++#ifdef __Linux__ + account_page_error(m, channel[0], dimm[0]); ++#endif + /* + * When both DIMMs have a error account the error twice to the page. + */ + if (channel[1] != -1) { + memory_error(m, channel[1], dimm[1], corr_err_cnt, recordlen); +#ifdef __Linux__ - account_page_error(m, channel, dimm, corr_err_cnt); + account_page_error(m, channel[1], dimm[1]); +#endif + } return 1; - } Index: files/patch-mcelog.c =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/files/patch-mcelog.c,v retrieving revision 1.1 diff -u -r1.1 patch-mcelog.c --- files/patch-mcelog.c 15 Oct 2011 02:53:31 -0000 1.1 +++ files/patch-mcelog.c 22 Sep 2012 09:50:12 -0000 @@ -1,12 +1,13 @@ ---- ./mcelog.c.orig 2009-12-15 07:18:40.000000000 -0500 -+++ ./mcelog.c 2011-10-14 22:37:22.000000000 -0400 -@@ -20,8 +20,21 @@ +--- mcelog.c.orig 2010-01-20 18:36:52.000000000 -0800 ++++ mcelog.c 2012-09-22 02:34:19.182116917 -0700 +@@ -20,9 +20,22 @@ #define _GNU_SOURCE 1 #include #include +#ifdef __Linux__ #include #include + #include +#endif +#ifdef __FreeBSD__ +#include @@ -22,22 +23,22 @@ #include #include #include -@@ -57,9 +70,25 @@ +@@ -58,9 +71,25 @@ #include "yellow.h" #include "page.h" +struct mca_record { -+ uint64_t mr_status; -+ uint64_t mr_addr; -+ uint64_t mr_misc; -+ uint64_t mr_tsc; -+ int mr_apic_id; -+ int mr_bank; -+ uint64_t mr_mcg_cap; -+ uint64_t mr_mcg_status; -+ int mr_cpu_id; -+ int mr_cpu_vendor_id; -+ int mr_cpu; ++ uint64_t mr_status; ++ uint64_t mr_addr; ++ uint64_t mr_misc; ++ uint64_t mr_tsc; ++ int mr_apic_id; ++ int mr_bank; ++ uint64_t mr_mcg_cap; ++ uint64_t mr_mcg_status; ++ int mr_cpu_id; ++ int mr_cpu_vendor_id; ++ int mr_cpu; +}; + enum cputype cputype = CPU_GENERIC; @@ -48,7 +49,7 @@ int ignore_nodev; int filter_bogus = 1; -@@ -70,12 +99,18 @@ +@@ -71,12 +100,18 @@ int dump_raw_ascii; int daemon_mode; static char *inputfile; @@ -67,7 +68,7 @@ static void check_cpu(void); -@@ -388,6 +423,7 @@ +@@ -393,6 +428,7 @@ Wprintf("\n"); } @@ -75,7 +76,7 @@ void check_cpu(void) { enum { -@@ -455,7 +491,44 @@ +@@ -460,7 +496,45 @@ } else Eprintf("warning: Cannot open /proc/cpuinfo\n"); } @@ -92,6 +93,7 @@ + + if (checked) + return; ++ + checked = 1; + + do_cpuid(0, regs); @@ -104,23 +106,23 @@ + cpu_id = regs[0]; + family = CPUID_TO_FAMILY(cpu_id); + model = CPUID_TO_MODEL(cpu_id); - -+ if (cpu_forced) ++ ++ if (cpu_forced) + ; -+ else if (!strcmp(vendor,"AuthenticAMD") && ++ else if (!strcmp(vendor,"AuthenticAMD") && + (family == 15 || family == 16 || family == 17)) + cputype = CPU_K8; + else if (!strcmp(vendor,"GenuineIntel")) + cputype = select_intel_cputype(family, model); -+ /* Add checks for other CPUs here */ ++ /* Add checks for other CPUs here */ +} +#endif -+ + +#ifdef __Linux__ static char *skipspace(char *s) { while (isspace(*s)) -@@ -479,6 +552,7 @@ +@@ -484,6 +558,7 @@ } return skipspace(s); } @@ -128,15 +130,15 @@ static void dump_mce_final(struct mce *m, char *symbol, int missing, int recordlen, int dseen) -@@ -501,6 +575,7 @@ - if (recordlen < endof_field(struct mce, f)) \ +@@ -507,6 +582,7 @@ recordlen = endof_field(struct mce, f) -+#ifdef __Linux__ /* Decode ASCII input for fatal messages */ ++#ifdef __Linux__ static void decodefatal(FILE *inf) { -@@ -646,6 +721,227 @@ + struct mce m; +@@ -651,6 +727,227 @@ if (data) dump_mce_final(&m, symbol, missing, recordlen, disclaimer_seen); } @@ -364,18 +366,18 @@ static void remove_pidfile(void) { -@@ -686,6 +982,10 @@ +@@ -709,6 +1006,10 @@ " mcelog [options] --ascii < log\n" " mcelog [options] --ascii --file log\n" "Decode machine check ASCII output from kernel logs\n" -+#ifdef __FreeBSD__ ++#ifdef __FreeBSD_ +" mcelog [options] -M vmcore -N kernel\n" +"Decode machine check error records from kernel crashdump.\n" +#endif "Options:\n" "--cpu CPU Set CPU type CPU to decode (see below for valid types)\n" "--cpumhz MHZ Set CPU Mhz to decode time (output unreliable, not needed on new kernels)\n" -@@ -866,6 +1166,14 @@ +@@ -889,6 +1190,14 @@ case O_CONFIG_FILE: /* parsed in config.c */ break; @@ -390,7 +392,7 @@ case 0: break; default: -@@ -900,8 +1208,10 @@ +@@ -923,8 +1232,10 @@ static void general_setup(void) { @@ -401,7 +403,7 @@ config_cred("global", "run-credentials", &runcred); if (config_bool("global", "filter-memory-errors") == 1) filter_memory_errors = 1; -@@ -924,6 +1234,7 @@ +@@ -947,6 +1258,7 @@ } } @@ -409,7 +411,7 @@ static void process(int fd, unsigned recordlen, unsigned loglen, char *buf) { int i; -@@ -964,6 +1275,173 @@ +@@ -987,6 +1299,173 @@ if (finish) exit(0); } @@ -583,7 +585,7 @@ static void noargs(int ac, char **av) { -@@ -1022,22 +1500,30 @@ +@@ -1045,22 +1524,30 @@ char *buf; }; @@ -607,16 +609,15 @@ parse_config(av); -- while ((opt = getopt_long(ac, av, "", options, NULL)) != -1) { +#ifdef __FreeBSD__ -+ while ((opt = getopt_long(ac, av, "M:N:", options, NULL)) != -1) { ++ while ((opt = getopt_long(ac, av, "M:N:", options, NULL)) != -1) { +#else -+ while ((opt = getopt_long(ac, av, "", options, NULL)) != -1) { + while ((opt = getopt_long(ac, av, "", options, NULL)) != -1) { +#endif if (opt == '?') { usage(); } else if (combined_modifier(opt) > 0) { -@@ -1057,13 +1543,21 @@ +@@ -1080,13 +1567,21 @@ } else if (opt == 0) break; } @@ -638,7 +639,7 @@ fd = open(logfn, O_RDONLY); if (fd < 0) { if (ignore_nodev) -@@ -1078,24 +1572,39 @@ +@@ -1101,24 +1596,39 @@ err("MCE_GET_LOG_LEN"); d.buf = xalloc(d.recordlen * d.loglen); Index: files/patch-server.c =================================================================== RCS file: /home/ncvs/ports/sysutils/mcelog/files/patch-server.c,v retrieving revision 1.1 diff -u -r1.1 patch-server.c --- files/patch-server.c 15 Oct 2011 02:53:31 -0000 1.1 +++ files/patch-server.c 22 Sep 2012 09:50:12 -0000 @@ -1,5 +1,5 @@ ---- ./server.c.orig 2009-12-15 07:18:40.000000000 -0500 -+++ ./server.c 2011-10-14 22:36:47.000000000 -0400 +--- server.c.orig 2010-01-20 18:36:52.000000000 -0800 ++++ server.c 2012-09-22 02:39:04.991117023 -0700 @@ -101,7 +101,9 @@ static void dispatch_pages(FILE *fh) @@ -77,3 +77,16 @@ cc = xalloc(sizeof(struct clientcon)); if (register_pollcb(nfd, POLLIN, client_event, cc) < 0) { +@@ -300,7 +336,12 @@ + sigaction(SIGALRM, &sa, &oldsa); + if (sigsetjmp(ping_timeout_ctx, 1) == 0) { + alarm(initial_ping_timeout); ++#ifdef __Linux__ + if (connect(fd, un, sizeof(struct sockaddr_un)) < 0) ++#endif ++#ifdef __FreeBSD__ ++ if (connect(fd, (struct sockaddr *) un, sizeof(struct sockaddr_un)) < 0) ++#endif + goto cleanup; + if (write(fd, PAIR("ping\n")) < 0) + goto cleanup; >Release-Note: >Audit-Trail: >Unformatted: