Skip to content
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ root = true
end_of_line = lf
insert_final_newline = true

[{**/*.cc,**/*.hpp,**/*.ah,**/*.ah.in,**/*.proto}]
[{**/*.cc,**/*.cpp,**/*.hpp,**/*.ah,**/*.ah.in,**/*.proto}]
indent_style = tab
indent_size = 4

Expand Down
2 changes: 1 addition & 1 deletion cmake/bochs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if(BUILD_BOCHS)
set(bochs_configure_params --enable-a20-pin --enable-x86-64 --enable-cpu-level=6 --enable-ne2000 --enable-acpi --enable-pci --enable-usb --enable-trace-cache --enable-fast-function-calls --enable-host-specific-asms --enable-disasm --enable-readline --enable-clgd54xx --enable-fpu --enable-vmx=2 --enable-monitor-mwait --enable-cdrom --enable-sb16=linux --enable-gdb-stub --disable-docbook --with-nogui --with-x11 --with-wx --with-sdl CACHE STRING "Bochs configure parameters")

## Bochs CXX args for calling make
set(bochs_build_CXX CXX=${AGXX}\ -p\ ${PROJECT_SOURCE_DIR}/src\ -p\ ${PROJECT_SOURCE_DIR}/simulators\ -p\ ${PROJECT_SOURCE_DIR}/debuggers\ -p\ ${PROJECT_SOURCE_DIR}/tools\ -p\ ${PROJECT_BINARY_DIR}/src\ -I${PROJECT_SOURCE_DIR}/src/core\ -I${CMAKE_BINARY_DIR}/src/core\ ${CMAKE_AGPP_FLAGS}\ --Xcompiler\ -std=gnu++11\ -Wno-narrowing)
set(bochs_build_CXX CXX=${AGXX}\ -p\ ${PROJECT_SOURCE_DIR}/src\ -p\ ${PROJECT_SOURCE_DIR}/simulators\ -p\ ${PROJECT_SOURCE_DIR}/debuggers\ -p\ ${PROJECT_SOURCE_DIR}/tools\ -p\ ${PROJECT_BINARY_DIR}/src\ -I${PROJECT_SOURCE_DIR}/src/core\ -I${CMAKE_BINARY_DIR}/src/core\ ${CMAKE_AGPP_FLAGS}\ --Xcompiler\ -std=gnu++14\ -Wno-narrowing)
## Bochs libtool command.
set(bochs_build_LIBTOOL LIBTOOL=/bin/sh\ ./libtool\ --tag=CXX)

Expand Down
2 changes: 1 addition & 1 deletion cmake/compilerconfig.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### C++14 ####
# We need at least C++11, as some library headers begin to require it. C++14
# has already aged sufficiently to mandate it here.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
16 changes: 7 additions & 9 deletions src/core/comm/DatabaseCampaignMessage.proto.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@ message DatabaseCampaignMessage {
// using generic InjectionPointMessage
required uint32 injection_instr = 4 [(sql_ignore) = true];
optional uint32 injection_instr_absolute = 5 [(sql_ignore) = true];
required uint32 data_address = 6 [(sql_ignore) = true];
required uint32 data_width = 7 [(sql_ignore) = true];
required uint64 data_address = 6 [(sql_ignore) = true];
required uint64 data_mask = 7 [(sql_ignore) = true];
required string variant = 8 [(sql_ignore) = true];
required string benchmark = 9 [(sql_ignore) = true];

required InjectionPointMessage injection_point = 10 [(sql_ignore) = true];

required bool inject_bursts = 11 [default = false];
enum RegisterInjectionMode {
OFF = 0;
AUTO = 1;
FORCE = 2;
RANDOMJUMP = 3;
enum InjectionMode {
BITFLIP = 0;
BURST = 1;
RANDOMJUMP = 2;
}
optional RegisterInjectionMode register_injection_mode = 12 [default = OFF];
optional InjectionMode injection_mode = 11 [default = BITFLIP];
}

message DatabaseExperimentMessage {
Expand Down
65 changes: 27 additions & 38 deletions src/core/cpn/DatabaseCampaign.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ bool DatabaseCampaign::run() {
CommandLine::option_handle BURST =
cmd.addOption("","inject-bursts", Arg::None,
"--inject-bursts \tinject burst faults (default: single bitflips)");
CommandLine::option_handle REGISTERS =
cmd.addOption("","inject-registers", Arg::None,
"--inject-registers \tinject into ISA registers (default: memory)");
CommandLine::option_handle REGISTERS_FORCE =
cmd.addOption("","force-inject-registers", Arg::None,
"--force-inject-registers \tinject into ISA registers only, ignore high addresses");
CommandLine::option_handle REGISTERS_RANDOMJUMP =
CommandLine::option_handle RANDOMJUMP =
cmd.addOption("","inject-randomjumps", Arg::None,
"--inject-randomjumps \tinject random jumps (interpret data_address as jump target, as prepared by RandomJumpImporter)");

Expand Down Expand Up @@ -105,27 +99,16 @@ bool DatabaseCampaign::run() {
}

if (cmd[BURST]) {
m_inject_bursts = true;
m_injection_mode = DatabaseCampaignMessage::BURST;
log_send << "fault model: burst" << std::endl;
} else if (cmd[RANDOMJUMP]) {
m_injection_mode = DatabaseCampaignMessage::RANDOMJUMP;
log_send << "fault model: randomjump" << std::endl;
} else {
m_inject_bursts = false;
m_injection_mode = DatabaseCampaignMessage::BITFLIP;
log_send << "fault model: single-bit flip" << std::endl;
}

if (cmd[REGISTERS] && !cmd[REGISTERS_FORCE]) {
m_register_injection_mode = DatabaseCampaignMessage::AUTO;
log_send << "register injection: auto" << std::endl;
} else if (cmd[REGISTERS_FORCE]) {
m_register_injection_mode = DatabaseCampaignMessage::FORCE;
log_send << "register injection: on" << std::endl;
} else if (cmd[REGISTERS_RANDOMJUMP]) {
m_register_injection_mode = DatabaseCampaignMessage::RANDOMJUMP;
log_send << "register injection: randomjump" << std::endl;
} else {
m_register_injection_mode = DatabaseCampaignMessage::OFF;
log_send << "register injection: off" << std::endl;
}

if (cmd[PRUNER]) {
m_fspmethod = std::string(cmd[PRUNER].first()->arg);
} else {
Expand Down Expand Up @@ -202,24 +185,23 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
/* Gather jobs */
unsigned long experiment_count;
std::stringstream ss;
std::string sql_select = "SELECT p.id, p.injection_instr, p.injection_instr_absolute, p.data_address, p.data_width, t.instr1, t.instr2 ";
std::string sql_select = "SELECT p.id, p.injection_instr, p.injection_instr_absolute, p.data_address, (t.data_mask & p.data_mask), t.instr1, t.instr2 ";
ss << " FROM fsppilot p "
<< " JOIN trace t"
<< " ON t.variant_id = p.variant_id AND t.data_address = p.data_address AND t.instr2 = p.instr2"
<< " ON t.variant_id = p.variant_id AND t.data_address = p.data_address AND t.instr2 = p.instr2 AND (t.data_mask & p.data_mask)"
<< " WHERE p.fspmethod_id IN (SELECT id FROM fspmethod WHERE method LIKE '" << m_fspmethod << "')"
<< " AND p.variant_id = " << variant.id
<< " ORDER BY t.instr1"; // Smart-Hopping needs this ordering
std::string sql_body = ss.str();

/* Get the number of unfinished experiments */
MYSQL_RES *count = db->query(("SELECT COUNT(*) " + sql_body).c_str(), true);
MYSQL_RES *count = db->query(("SELECT COUNT(*) as injections " + sql_body).c_str(), true);
if (!count) {
exit(1);
}
MYSQL_ROW row = mysql_fetch_row(count);
experiment_count = strtoul(row[0], NULL, 10);


MYSQL_RES *pilots = db->query_stream ((sql_select + sql_body).c_str());
if (!pilots) {
exit(1);
Expand All @@ -235,22 +217,28 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
// calculating at trace instruction zero
ConcreteInjectionPoint ip;

unsigned expected_results = expected_number_of_results(variant.variant, variant.benchmark);

unsigned sent_pilots = 0, skipped_pilots = 0;
unsigned long long expected_injections = 0;
while ((row = mysql_fetch_row(pilots)) != 0) {
unsigned pilot_id = strtoul(row[0], NULL, 10);
unsigned injection_instr = strtoul(row[1], NULL, 10);
uint64_t data_address = strtoul(row[3], NULL, 10);
unsigned data_mask = strtoul(row[4], NULL, 10);
unsigned instr1 = strtoul(row[5], NULL, 10);
unsigned instr2 = strtoul(row[6], NULL, 10);

unsigned expected_results = __builtin_popcount(data_mask);
if (m_injection_mode == DatabaseCampaignMessage::BURST
|| m_injection_mode == DatabaseCampaignMessage::RANDOMJUMP)
expected_results = 1;

if (existing_results_for_pilot(pilot_id) == expected_results) {
skipped_pilots++;
campaignmanager.skipJobs(1);
continue;
}
expected_injections += expected_results - existing_results_for_pilot(pilot_id);

unsigned injection_instr = strtoul(row[1], NULL, 10);
unsigned data_address = strtoul(row[3], NULL, 10);
unsigned data_width = strtoul(row[4], NULL, 10);
unsigned instr1 = strtoul(row[5], NULL, 10);
unsigned instr2 = strtoul(row[6], NULL, 10);

DatabaseCampaignMessage pilot;
pilot.set_pilot_id(pilot_id);
Expand All @@ -267,16 +255,16 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
pilot.set_injection_instr_absolute(injection_instr_absolute);
}
pilot.set_data_address(data_address);
pilot.set_data_width(data_width);
pilot.set_inject_bursts(m_inject_bursts);
pilot.set_register_injection_mode(m_register_injection_mode);
pilot.set_data_mask(data_mask);
pilot.set_injection_mode(m_injection_mode);

this->cb_send_pilot(pilot);

if ((++sent_pilots) % 10000 == 0) {
log_send << "pushed " << sent_pilots << " pilots into the queue" << std::endl;
}
}
log_send << "expecting " << expected_injections << " injections to take place." << std::endl;

if (*mysql_error(db->getHandle())) {
log_send << "MYSQL ERROR: " << mysql_error(db->getHandle()) << std::endl;
Expand Down Expand Up @@ -312,7 +300,7 @@ void DatabaseCampaign::load_completed_pilots(std::vector<Database::Variant> &var
log_send << "loading completed pilot IDs ..." << std::endl;

std::stringstream sql;
sql << "SELECT pilot_id, COUNT(*) FROM fsppilot p"
sql << "SELECT pilot_id, COUNT(*), bit_count(data_mask) FROM fsppilot p"
<< " JOIN " << db_connect.result_table() << " r ON r.pilot_id = p.id"
<< " WHERE variant_id in (" << variant_str.str() << ")"
<< " AND fspmethod_id IN (SELECT id FROM fspmethod WHERE method LIKE '" << m_fspmethod << "')"
Expand All @@ -326,6 +314,7 @@ void DatabaseCampaign::load_completed_pilots(std::vector<Database::Variant> &var
while ((row = mysql_fetch_row(ids)) != 0) {
unsigned pilot_id = strtoul(row[0], NULL, 10);
unsigned result_count = strtoul(row[1], NULL, 10);
unsigned inj_count = strtoul(row[2], NULL, 10);
#ifndef __puma
completed_pilots.add(
make_pair(
Expand Down
12 changes: 1 addition & 11 deletions src/core/cpn/DatabaseCampaign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class DatabaseCampaign : public Campaign {
id_map completed_pilots; // !< map: Pilot IDs -> result count
#endif

bool m_inject_bursts; // !< inject burst faults?
DatabaseCampaignMessage::RegisterInjectionMode m_register_injection_mode; // !< inject into registers? OFF, ON, AUTO (= use registers if address is small)
DatabaseCampaignMessage::InjectionMode m_injection_mode; // !< How should we inject?

public:
DatabaseCampaign() {};
Expand All @@ -59,15 +58,6 @@ class DatabaseCampaign : public Campaign {
*/
virtual bool run_variant(fail::Database::Variant);

/**
* How many results have to are expected from each fsppilot. If
* there are less result rows, the pilot will be again sent to the clients
* @return \c exptected number of results
*/
virtual int expected_number_of_results(std::string variant, std::string benchmark) {
return (m_inject_bursts ? 1 : 8);
}

/**
* Callback function that can be used to add command line options
* to the campaign
Expand Down
Loading