Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inclusion of a broadcast option to notify other processes of RAS events #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ rasdaemon_SOURCES = rasdaemon.c ras-events.c ras-mc-handler.c \
if WITH_SQLITE3
rasdaemon_SOURCES += ras-record.c
endif
if WITH_BROADCAST
rasdaemon_SOURCES += ras-server.c
endif
if WITH_AER
rasdaemon_SOURCES += ras-aer-handler.c
endif
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ AM_COND_IF([WITH_SQLITE3], [USE_SQLITE3="yes"], [USE_SQLITE3="no"])

AC_SUBST([SQLITE3_LIBS])

AC_ARG_ENABLE([broadcast],
AS_HELP_STRING([--enable-broadcast], [enable broadcast of events using local sockets (currently experimental)]))

AS_IF([test "x$enable_broadcast" = "xyes" || test "x$enable_all" == "xyes"], [
AC_DEFINE(HAVE_BROADCAST,1,"broadcast RAS events")
AC_SUBST([WITH_BROADCAST])
])

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this feature ("broadcast") doesn't look nice, as this term is more used for TCP/IP special messages that are sent to a range of machines.

The way this feature is mapped, it is actually adding an Unix socket for communication with other process(es).

AM_CONDITIONAL([WITH_BROADCAST], [test x$enable_broadcast = xyes || test x$enable_all == xyes])
AM_COND_IF([WITH_BROADCAST], [USE_BROADCAST="yes"], [USE_BROADCAST="no"])

AC_ARG_ENABLE([aer],
AS_HELP_STRING([--enable-aer], [enable PCIe AER events (currently experimental)]))
Expand Down Expand Up @@ -169,6 +179,7 @@ compile time options summary
============================

Sqlite3 : $USE_SQLITE3
broadcast : $USE_BROADCAST
AER : $USE_AER
MCE : $USE_MCE
EXTLOG : $USE_EXTLOG
Expand Down
6 changes: 6 additions & 0 deletions ras-aer-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ras-logger.h"
#include "bitfield.h"
#include "ras-report.h"
#include "ras-server.h"

/* bit field meaning for correctable error */
static const char *aer_cor_errors[32] = {
Expand Down Expand Up @@ -151,5 +152,10 @@ int ras_aer_event_handler(struct trace_seq *s,
ras_report_aer_event(ras, &ev);
#endif

#ifdef HAVE_BROADCAST
if(ras->broadcast_events)
ras_server_broadcast(AER_EVENT, &ev);
#endif

return 0;
}
6 changes: 6 additions & 0 deletions ras-arm-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "ras-record.h"
#include "ras-logger.h"
#include "ras-report.h"
#include "ras-server.h"

int ras_arm_event_handler(struct trace_seq *s,
struct pevent_record *record,
Expand Down Expand Up @@ -88,5 +89,10 @@ int ras_arm_event_handler(struct trace_seq *s,
ras_report_arm_event(ras, &ev);
#endif

#ifdef HAVE_BROADCAST
if(ras->broadcast_events)
ras_server_broadcast(ARM_EVENT, &ev);
#endif

return 0;
}
6 changes: 6 additions & 0 deletions ras-devlink-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ras-record.h"
#include "ras-logger.h"
#include "ras-report.h"
#include "ras-server.h"

int ras_net_xmit_timeout_handler(struct trace_seq *s,
struct pevent_record *record,
Expand Down Expand Up @@ -148,5 +149,10 @@ int ras_devlink_event_handler(struct trace_seq *s,
ras_report_devlink_event(ras, &ev);
#endif

#ifdef HAVE_BROADCAST
if(ras->broadcast_events)
ras_server_broadcast(DEVLINK_EVENT, &ev);
#endif

return 0;
}
6 changes: 6 additions & 0 deletions ras-diskerror-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "ras-record.h"
#include "ras-logger.h"
#include "ras-report.h"
#include "ras-server.h"


static const struct {
Expand Down Expand Up @@ -127,6 +128,11 @@ int ras_diskerror_event_handler(struct trace_seq *s,
/* Report event to ABRT */
ras_report_diskerror_event(ras, &ev);
#endif

#ifdef HAVE_BROADCAST
if(ras->broadcast_events)
ras_server_broadcast(DISKERROR_EVENT, &ev);
#endif
free(ev.dev);
return 0;
}
9 changes: 8 additions & 1 deletion ras-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "ras-devlink-handler.h"
#include "ras-diskerror-handler.h"
#include "ras-record.h"
#include "ras-server.h"
#include "ras-logger.h"
#include "ras-page-isolation.h"

Expand Down Expand Up @@ -761,7 +762,7 @@ static int add_event_handler(struct ras_events *ras, struct pevent *pevent,
return 0;
}

int handle_ras_events(int record_events)
int handle_ras_events(int record_events, int broadcast_events)
{
int rc, page_size, i;
int num_events = 0;
Expand Down Expand Up @@ -809,6 +810,9 @@ int handle_ras_events(int record_events)
ras_page_account_init();
#endif

if (broadcast_events)
ras->broadcast_events = ras_server_start() == 0;

rc = add_event_handler(ras, pevent, page_size, "ras", "mc_event",
ras_mc_event_handler, NULL, MC_EVENT);
if (!rc)
Expand Down Expand Up @@ -958,6 +962,9 @@ int handle_ras_events(int record_events)
if (pevent)
pevent_free(pevent);

if(ras->broadcast_events)
ras_server_stop();

if (ras) {
for (i = 0; i < NR_EVENTS; i++) {
if (ras->filters[i])
Expand Down
3 changes: 2 additions & 1 deletion ras-events.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct ras_events {
/* Booleans */
unsigned use_uptime: 1;
unsigned record_events: 1;
unsigned broadcast_events: 1;

/* For timestamp */
time_t uptime_diff;
Expand Down Expand Up @@ -99,6 +100,6 @@ enum ghes_severity {

/* Function prototypes */
int toggle_ras_mc_event(int enable);
int handle_ras_events(int record_events);
int handle_ras_events(int record_events, int broadcast_events);

#endif
5 changes: 5 additions & 0 deletions ras-mc-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ras-logger.h"
#include "ras-page-isolation.h"
#include "ras-report.h"
#include "ras-server.h"

int ras_mc_event_handler(struct trace_seq *s,
struct pevent_record *record,
Expand Down Expand Up @@ -195,6 +196,10 @@ int ras_mc_event_handler(struct trace_seq *s,
ras_report_mc_event(ras, &ev);
#endif

#ifdef HAVE_BROADCAST
if(ras->broadcast_events)
ras_server_broadcast(MC_EVENT, &ev);
#endif
return 0;

parse_error:
Expand Down
6 changes: 6 additions & 0 deletions ras-mce-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "ras-record.h"
#include "ras-logger.h"
#include "ras-report.h"
#include "ras-server.h"

/*
* The code below were adapted from Andi Kleen/Intel/SuSe mcelog code,
Expand Down Expand Up @@ -468,5 +469,10 @@ int ras_mce_event_handler(struct trace_seq *s,
ras_report_mce_event(ras, &e);
#endif

#ifdef HAVE_BROADCAST
if(ras->broadcast_events)
ras_server_broadcast(MCE_EVENT, &e);
#endif

return 0;
}
6 changes: 6 additions & 0 deletions ras-non-standard-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "ras-record.h"
#include "ras-logger.h"
#include "ras-report.h"
#include "ras-server.h"

static struct ras_ns_ev_decoder *ras_ns_ev_dec_list;

Expand Down Expand Up @@ -224,6 +225,11 @@ int ras_non_standard_event_handler(struct trace_seq *s,
ras_report_non_standard_event(ras, &ev);
#endif

#ifdef HAVE_BROADCAST
if(ras->broadcast_events)
ras_server_broadcast(NON_STANDARD_EVENT, &ev);
#endif

return 0;
}

Expand Down
Loading