Zane Shelley | d84ed6e | 2020-06-08 13:41:48 -0500 | [diff] [blame] | 1 | #include <assert.h> |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 2 | #include <unistd.h> |
Ben Tyner | 87eabc6 | 2020-05-14 17:56:54 -0500 | [diff] [blame] | 3 | |
Zane Shelley | ebff0d3 | 2021-11-21 10:52:07 -0600 | [diff] [blame] | 4 | #include <analyzer/analyzer_main.hpp> |
Zane Shelley | a9b4434 | 2021-08-08 17:15:52 -0500 | [diff] [blame] | 5 | #include <analyzer/ras-data/ras-data-parser.hpp> |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 6 | #include <analyzer/service_data.hpp> |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 7 | #include <attn/attn_dump.hpp> |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 8 | #include <hei_main.hpp> |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 9 | #include <util/pdbg.hpp> |
Zane Shelley | d84ed6e | 2020-06-08 13:41:48 -0500 | [diff] [blame] | 10 | #include <util/trace.hpp> |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 11 | |
| 12 | namespace analyzer |
| 13 | { |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 14 | //------------------------------------------------------------------------------ |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 15 | |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 16 | // Forward references for externally defined functions. |
Ben Tyner | 87eabc6 | 2020-05-14 17:56:54 -0500 | [diff] [blame] | 17 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 18 | /** |
| 19 | * @brief Will get the list of active chip and initialize the isolator. |
| 20 | * @param o_chips The returned list of active chips. |
| 21 | */ |
Zane Shelley | 171a2e0 | 2020-11-13 13:56:13 -0600 | [diff] [blame] | 22 | void initializeIsolator(std::vector<libhei::Chip>& o_chips); |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 23 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 24 | /** |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 25 | * @brief Will get the list of active chip and initialize the isolator. |
Zane Shelley | ec227c2 | 2021-12-09 15:54:40 -0600 | [diff] [blame] | 26 | * @param i_type The type of analysis to perform. See enum for details. |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 27 | * @param i_isoData The data gathered during isolation (for FFDC). |
| 28 | * @param o_rootCause The returned root cause signature. |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 29 | * @param i_rasData The RAS data parser. |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 30 | * @return True, if root cause has been found. False, otherwise. |
| 31 | */ |
Zane Shelley | ec227c2 | 2021-12-09 15:54:40 -0600 | [diff] [blame] | 32 | bool filterRootCause(AnalysisType i_type, |
| 33 | const libhei::IsolationData& i_isoData, |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 34 | libhei::Signature& o_rootCause, |
| 35 | const RasDataParser& i_rasData); |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 36 | |
| 37 | /** |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 38 | * @brief Will create and submit a PEL using the given data. |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 39 | * @param i_servData Data regarding service actions gathered during analysis. |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 40 | * @return The platform log ID. Will return zero if no PEL is generated. |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 41 | */ |
Ben Tyner | c1e1c00 | 2022-02-16 15:09:31 -0600 | [diff] [blame] | 42 | uint32_t commitPel(const ServiceData& i_servData); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 43 | |
Zane Shelley | d84ed6e | 2020-06-08 13:41:48 -0500 | [diff] [blame] | 44 | //------------------------------------------------------------------------------ |
| 45 | |
Zane Shelley | ebff0d3 | 2021-11-21 10:52:07 -0600 | [diff] [blame] | 46 | const char* __attn(libhei::AttentionType_t i_type) |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 47 | { |
| 48 | const char* str = ""; |
Zane Shelley | ebff0d3 | 2021-11-21 10:52:07 -0600 | [diff] [blame] | 49 | switch (i_type) |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 50 | { |
| 51 | case libhei::ATTN_TYPE_CHECKSTOP: |
| 52 | str = "CHECKSTOP"; |
| 53 | break; |
| 54 | case libhei::ATTN_TYPE_UNIT_CS: |
| 55 | str = "UNIT_CS"; |
| 56 | break; |
| 57 | case libhei::ATTN_TYPE_RECOVERABLE: |
| 58 | str = "RECOVERABLE"; |
| 59 | break; |
| 60 | case libhei::ATTN_TYPE_SP_ATTN: |
| 61 | str = "SP_ATTN"; |
| 62 | break; |
| 63 | case libhei::ATTN_TYPE_HOST_ATTN: |
| 64 | str = "HOST_ATTN"; |
| 65 | break; |
| 66 | default: |
Zane Shelley | ebff0d3 | 2021-11-21 10:52:07 -0600 | [diff] [blame] | 67 | trace::err("Unsupported attention type: %u", i_type); |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 68 | assert(0); |
| 69 | } |
| 70 | return str; |
| 71 | } |
| 72 | |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 73 | //------------------------------------------------------------------------------ |
| 74 | |
Zane Shelley | ebff0d3 | 2021-11-21 10:52:07 -0600 | [diff] [blame] | 75 | const char* __analysisType(AnalysisType i_type) |
| 76 | { |
| 77 | const char* str = ""; |
| 78 | switch (i_type) |
| 79 | { |
| 80 | case AnalysisType::SYSTEM_CHECKSTOP: |
| 81 | str = "SYSTEM_CHECKSTOP"; |
| 82 | break; |
| 83 | case AnalysisType::TERMINATE_IMMEDIATE: |
| 84 | str = "TERMINATE_IMMEDIATE"; |
| 85 | break; |
| 86 | case AnalysisType::MANUAL: |
| 87 | str = "MANUAL"; |
| 88 | break; |
| 89 | default: |
| 90 | trace::err("Unsupported analysis type: %u", i_type); |
| 91 | assert(0); |
| 92 | } |
| 93 | return str; |
| 94 | } |
| 95 | |
| 96 | //------------------------------------------------------------------------------ |
| 97 | |
| 98 | uint32_t analyzeHardware(AnalysisType i_type, attn::DumpParameters& o_dump) |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 99 | { |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 100 | uint32_t o_plid = 0; // default, zero indicates PEL was not created |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 101 | |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 102 | if (!util::pdbg::queryHardwareAnalysisSupported()) |
| 103 | { |
| 104 | trace::err("Hardware error analysis is not supported on this system"); |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 105 | return o_plid; |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 106 | } |
| 107 | |
Zane Shelley | ebff0d3 | 2021-11-21 10:52:07 -0600 | [diff] [blame] | 108 | trace::inf(">>> enter analyzeHardware(%s)", __analysisType(i_type)); |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 109 | |
| 110 | // Initialize the isolator and get all of the chips to be analyzed. |
| 111 | trace::inf("Initializing the isolator..."); |
| 112 | std::vector<libhei::Chip> chips; |
| 113 | initializeIsolator(chips); |
| 114 | |
| 115 | // Isolate attentions. |
| 116 | trace::inf("Isolating errors: # of chips=%u", chips.size()); |
| 117 | libhei::IsolationData isoData{}; |
| 118 | libhei::isolate(chips, isoData); |
| 119 | |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 120 | // For debug, trace out the original list of signatures before filtering. |
| 121 | for (const auto& sig : isoData.getSignatureList()) |
| 122 | { |
| 123 | trace::inf("Signature: %s 0x%0" PRIx32 " %s", |
| 124 | util::pdbg::getPath(sig.getChip()), sig.toUint32(), |
| 125 | __attn(sig.getAttnType())); |
| 126 | } |
| 127 | |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 128 | // Filter for root cause attention. |
Zane Shelley | cb45738 | 2020-11-02 20:55:06 -0600 | [diff] [blame] | 129 | libhei::Signature rootCause{}; |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 130 | RasDataParser rasData{}; |
Zane Shelley | 5836f4a | 2023-02-09 14:28:08 -0600 | [diff] [blame] | 131 | bool attnFound = false; |
| 132 | try |
| 133 | { |
| 134 | attnFound = filterRootCause(i_type, isoData, rootCause, rasData); |
| 135 | } |
| 136 | catch (const std::exception& e) |
| 137 | { |
| 138 | trace::err("Exception caught during root cause filtering"); |
| 139 | trace::err(e.what()); |
| 140 | attnFound = false; // just in case |
| 141 | } |
Zane Shelley | cb45738 | 2020-11-02 20:55:06 -0600 | [diff] [blame] | 142 | |
Zane Shelley | b7879d3 | 2021-12-06 18:02:03 -0600 | [diff] [blame] | 143 | // If a root cause attention was found, or if this was a system checkstop, |
| 144 | // generate a PEL. |
| 145 | if (attnFound || AnalysisType::SYSTEM_CHECKSTOP == i_type) |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 146 | { |
Zane Shelley | b7879d3 | 2021-12-06 18:02:03 -0600 | [diff] [blame] | 147 | if (attnFound) |
| 148 | { |
| 149 | trace::inf("Root cause attention: %s 0x%0" PRIx32 " %s", |
| 150 | util::pdbg::getPath(rootCause.getChip()), |
| 151 | rootCause.toUint32(), __attn(rootCause.getAttnType())); |
| 152 | } |
| 153 | else |
| 154 | { |
| 155 | // This is bad. Analysis should have found a root cause attention |
| 156 | // for a system checkstop. Issues could range from code bugs to SCOM |
| 157 | // errors. Regardless, generate a PEL with FFDC to assist with |
| 158 | // debug. |
| 159 | trace::err("System checkstop with no root cause attention"); |
| 160 | rootCause = libhei::Signature{}; // just in case |
| 161 | } |
Zane Shelley | cb45738 | 2020-11-02 20:55:06 -0600 | [diff] [blame] | 162 | |
Zane Shelley | b7879d3 | 2021-12-06 18:02:03 -0600 | [diff] [blame] | 163 | // Start building the service data. |
Zane Shelley | 62adf5c | 2022-01-18 21:06:50 -0600 | [diff] [blame] | 164 | ServiceData servData{rootCause, i_type, isoData}; |
Zane Shelley | b7879d3 | 2021-12-06 18:02:03 -0600 | [diff] [blame] | 165 | |
| 166 | // Apply any service actions, if needed. Note that there are no |
| 167 | // resolutions for manual analysis. |
| 168 | if (AnalysisType::MANUAL != i_type) |
| 169 | { |
| 170 | if (attnFound) |
| 171 | { |
Zane Shelley | 2fbd267 | 2022-02-03 13:56:35 -0600 | [diff] [blame] | 172 | try |
| 173 | { |
| 174 | // Resolve the root cause attention. |
Zane Shelley | 2fbd267 | 2022-02-03 13:56:35 -0600 | [diff] [blame] | 175 | rasData.getResolution(rootCause)->resolve(servData); |
| 176 | } |
| 177 | catch (const std::exception& e) |
| 178 | { |
| 179 | trace::err("Exception caught during root cause analysis"); |
| 180 | trace::err(e.what()); |
| 181 | |
| 182 | // We'll still want to create a PEL for the FFDC, but |
| 183 | // since the analysis failed, we need to callout Level 2 |
| 184 | // Support. |
| 185 | servData.calloutProcedure(callout::Procedure::NEXTLVL, |
| 186 | callout::Priority::HIGH); |
| 187 | } |
Zane Shelley | b7879d3 | 2021-12-06 18:02:03 -0600 | [diff] [blame] | 188 | } |
| 189 | else |
| 190 | { |
Zane Shelley | 2fbd267 | 2022-02-03 13:56:35 -0600 | [diff] [blame] | 191 | // Analysis failed so callout the Level 2 Support. |
Zane Shelley | 8af5685 | 2022-01-28 15:07:35 -0600 | [diff] [blame] | 192 | servData.calloutProcedure(callout::Procedure::NEXTLVL, |
| 193 | callout::Priority::HIGH); |
Zane Shelley | b7879d3 | 2021-12-06 18:02:03 -0600 | [diff] [blame] | 194 | } |
| 195 | } |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 196 | |
| 197 | // Create and commit a PEL. |
Ben Tyner | c1e1c00 | 2022-02-16 15:09:31 -0600 | [diff] [blame] | 198 | o_plid = commitPel(servData); |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 199 | |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 200 | if (0 == o_plid) |
| 201 | { |
| 202 | trace::err("Failed to create PEL"); |
| 203 | } |
| 204 | else |
| 205 | { |
| 206 | trace::inf("PEL created: PLID=0x%0" PRIx32, o_plid); |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 207 | |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 208 | // Gather/return information needed for dump. A hardware dump will |
| 209 | // always be used for system checkstop attenions. Software dumps |
| 210 | // will be reserved for MP-IPLs during TI analysis. |
| 211 | // TODO: Need ID from root cause. At the moment, HUID does not exist |
| 212 | // in devtree. Will need a better ID definition. |
Zane Shelley | ebff0d3 | 2021-11-21 10:52:07 -0600 | [diff] [blame] | 213 | o_dump.unitId = 0; |
| 214 | o_dump.dumpType = attn::DumpType::Hardware; |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 215 | } |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 216 | } |
Zane Shelley | b7879d3 | 2021-12-06 18:02:03 -0600 | [diff] [blame] | 217 | else |
| 218 | { |
| 219 | // It is possible for TI handling, or manually initiated analysis via |
| 220 | // the command line, that there will not be an active attention. In |
| 221 | // which case, we will do nothing and let the caller of this function |
| 222 | // determine if this is the expected behavior. |
| 223 | trace::inf("No active attentions found"); |
| 224 | } |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 225 | |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 226 | // All done, clean up the isolator. |
| 227 | trace::inf("Uninitializing isolator..."); |
| 228 | libhei::uninitialize(); |
Ben Tyner | 87eabc6 | 2020-05-14 17:56:54 -0500 | [diff] [blame] | 229 | |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 230 | trace::inf("<<< exit analyzeHardware()"); |
| 231 | |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 232 | return o_plid; |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 233 | } |
| 234 | |
Ben Tyner | eea4542 | 2021-04-15 10:54:14 -0500 | [diff] [blame] | 235 | //------------------------------------------------------------------------------ |
| 236 | |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 237 | } // namespace analyzer |