MEM: Fatal when no port can be found for an address
Review Request #1037 - Created Feb. 12, 2012 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
MEM: Fatal when no port can be found for an address This patch adds a check in the findPort method to ensure that an invalid port id is never returned. Previously this could happen if no default port was set, and no address matched the request, in which case -1 was returned causing a SEGFAULT when using the id to index in the port array. To clean things up further a symbolic name is added for the invalid port id.
util/regress all passing (disregarding t1000 and eio)
Posted (Feb. 12, 2012, 2:30 a.m.)
Otherwise it seems good to me
-
src/mem/bus.hh (Diff revision 1) -
Perhaps this would be better defined in the Bus class as to not pollute the global namespace?
Review request changed
Updated (Feb. 12, 2012, 9:43 p.m.)
Diff: |
Revision 2 (+20 -8) |
|---|
Review request changed
Updated (Feb. 12, 2012, 9:44 p.m.)
Diff: |
Revision 3 (+19 -8) |
|---|
Ship It!
Posted (Feb. 19, 2012, 6:51 p.m.)
Consensus to ship it?
Posted (Feb. 22, 2012, 1:37 a.m.)
-
src/mem/bus.cc (Diff revision 3) -
This should really be fatal() rather than panic() (I know you were just copying the existing panic() but it's wrong too). Also we could converge to a single fatal() path if the logic went like this: if (useDefaultRange) { for (...) { return defaultPortId; } } else if (defaultPortId != INVALID_PORT_ID) { return defaultPortId; } fatal(...); It'd be good to work name() into the fatal string as well.
Posted (Feb. 22, 2012, 3:45 a.m.)
-
src/mem/bus.cc (Diff revision 3) -
I believe you have your definition of fatal and panic backwards. http://www.gem5.org/Utility_Code#panic.2C_fatal.2C_warn.2C_inform.2C_hack:_which.3F panic() should be called when something happens that should never ever happen regardless of what the user does (i.e., an actual m5 bug). panic() calls abort() which can dump core or enter the debugger. fatal() should be called when the simulation cannot continue due to some condition that is the user's fault (bad configuration, invalid arguments, etc.) and not a simulator bug. fatal() calls exit(1), i.e., a "normal" exit with an error code.
Review request changed
Updated (Feb. 22, 2012, 4:48 p.m.)
Summary: |
|
|||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 4 (+17 -10) |
Ship It!
