summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/targeting/common/targetservice.C73
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/xmltohb.pl113
-rw-r--r--src/usr/targeting/runtime/start_rt.C3
-rwxr-xr-xsrc/usr/targeting/targetservicestart.C8
4 files changed, 195 insertions, 2 deletions
diff --git a/src/usr/targeting/common/targetservice.C b/src/usr/targeting/common/targetservice.C
index 4489809cf..c6de5a1dd 100644
--- a/src/usr/targeting/common/targetservice.C
+++ b/src/usr/targeting/common/targetservice.C
@@ -53,6 +53,11 @@
#include <attributetraits.H>
#include <targeting/common/utilFilter.H>
+#ifdef __HOSTBOOT_MODULE
+// Generated
+#include <mutexattributes.H>
+#endif
+
#undef EXTRA_SANITY_CHECKING
//******************************************************************************
@@ -1569,6 +1574,74 @@ uint32_t TargetService::getTargetAttributes(Target*i_target,
// Return the number of attributes for this target
return i_target->iv_attrs;
}
+#ifdef __HOSTBOOT_MODULE
+void TargetService::resetMutexAttributes()
+{
+ #define TARG_FN "resetMutexAttributes(...)"
+ TARGETING::AttrRP *l_pAttrRP = &TARG_GET_SINGLETON(TARGETING::theAttrRP);
+ ATTRIBUTE_ID* l_pAttrIds = nullptr;
+ AbstractPointer<void>* l_ppAttrAddrs = nullptr;
+ for( auto targ_iter = targetService().begin();
+ targ_iter != targetService().end();
+ targ_iter++)
+ {
+ uint32_t l_attrCount = 0;
+ Target* l_pTarget = *targ_iter;
+ l_attrCount = targetService().getTargetAttributes(l_pTarget, l_pAttrRP,
+ l_pAttrIds, l_ppAttrAddrs );
+
+ // Make sure that attributes were found
+ if(l_attrCount == 0)
+ {
+ TRACFCOMP( g_trac_targeting,
+ "Target 0x%X has no attributes", get_huid(l_pTarget) );
+ // Continue to next target if there were no attributes
+ continue;
+ }
+
+ for ( uint32_t l_attrIndex = 0; l_attrIndex < l_attrCount; l_attrIndex++)
+ {
+ const ATTRIBUTE_ID l_attrId = l_pAttrIds[l_attrIndex];
+ for( const auto mutexId : hbMutexAttrIds)
+ {
+ if(l_attrId == mutexId)
+ {
+ mutex_t* l_mutex;
+ if(l_pTarget->_tryGetHbMutexAttr(l_attrId, l_mutex))
+ {
+ mutex_init(l_mutex);
+ }
+ else
+ {
+ /*@
+ * @errortype ERRORLOG::ERRL_SEV_PREDICTIVE
+ * @moduleid TARG_SVC_RESET_MUTEX
+ * @reasoncode TARG_SVC_MISSING_ATTR
+ * @userdata1 Attribute Id we attempted to read
+ * @userdata2 Huid of target we attempted to read
+ *
+ * @devdesc For some reason attr IDs in hbMutexAttrIds list
+ * are not matching the attribute IDs that target
+ * service is seeing. This is causing incorrect matching
+ * Make sure mutexattribute.H in genfiles has good values
+ *
+ * @custdesc Attempted to perform an invalid attribute look up
+ */
+ errlHndl_t l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_PREDICTIVE,
+ TARG_SVC_RESET_MUTEX,
+ TARG_SVC_MISSING_ATTR,
+ l_attrId,
+ get_huid(l_pTarget),
+ true); // software error
+ errlCommit(l_errl, TARG_COMP_ID);
+ }
+ }
+ }
+ }
+ }
+ #undef TARG_FN
+}
+#endif
#undef TARG_CLASS
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl
index be87ad0f5..43906fd12 100755
--- a/src/usr/targeting/common/xmltohb/xmltohb.pl
+++ b/src/usr/targeting/common/xmltohb/xmltohb.pl
@@ -266,6 +266,15 @@ if( !($cfgSrcOutputDir =~ "none") )
writeTargAttrMap($attributes, $targAttrFile);
close $targAttrFile;
+ open(MUTEX_ATTR_FILE, ">$cfgSrcOutputDir"."mutexattributes.H")
+ or croak ("Muxtex Attribute file: \"$cfgSrcOutputDir"
+ . "mutexattributes.H\" could not be opened.");
+ my $mutexFile = *MUTEX_ATTR_FILE;
+ writeMutexFileHeader($mutexFile);
+ writeMutexFileAttrs($attributes,$mutexFile);
+ writeMutexFileFooter($mutexFile);
+ close $mutexFile;
+
open(TRAIT_FILE,">$cfgSrcOutputDir"."attributetraits.H")
or croak ("Trait file: \"$cfgSrcOutputDir"
@@ -2251,6 +2260,110 @@ sub writeTargAttrMap {
print $outFile "};\n";
}
+sub writeMutexFileHeader {
+ my($outFile) = @_;
+
+print $outFile <<VERBATIM;
+
+#ifndef TARG_MUTEXATTRIBUTES_H
+#define TARG_MUTEXATTRIBUTES_H
+
+/**
+ * \@file mutexattributes.H
+ *
+ * \@brief Array of attributes Ids whose type is hbmutex
+ *
+ * This header file contains a single array that lists out all of the hbmutex
+ * attributes. This is used on the MPIPL path to know which attributes we need
+ * to reset. This file is autogenerated and should not be altered.
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// STD
+#include <stdint.h>
+VERBATIM
+}
+
+sub writeMutexFileAttrs {
+ my($attributes,$outFile) = @_;
+
+print $outFile <<VERBATIM;
+
+//******************************************************************************
+// Array
+//******************************************************************************
+
+namespace TARGETING
+{
+
+/**
+ * \@brief HB Mutex Attribute IDs
+ *
+ * Array defining all attribute ids found that are of type hbMutex.
+ * This file is autogenerated and should not be altered.
+ */
+const uint32_t hbMutexAttrIds[] = {
+VERBATIM
+
+ my @mutexAttrIds;
+
+ foreach my $attribute (@{$attributes->{attribute}})
+ {
+ #check if hbmutex tag is present
+ #check that attr is readable/writeable
+ if( (exists $attribute->{simpleType})
+ && (exists $attribute->{simpleType}->{hbmutex})
+ && (exists $attribute->{readable})
+ && (exists $attribute->{writeable}))
+ {
+ push @mutexAttrIds, $attribute->{id};
+ }
+ }
+
+ # variables that can be used for writing the enums to the file
+ my $attrId;
+ my $hexVal;
+
+ # Format below intentionally > 80 chars for clarity
+ format ATTRMUTEXFORMAT =
+ @>>>>>>>>>>
+ $hexVal .","
+.
+ select($outFile);
+ $~ = 'ATTRMUTEXFORMAT';
+
+ my $attrIdEnum = getAttributeIdEnumeration($attributes);
+
+ foreach my $enumerator (@{$attrIdEnum->{enumerator}})
+ {
+ $hexVal = $enumerator->{value};
+ $attrId = $enumerator->{name};
+ foreach my $mutexAttrId (@mutexAttrIds)
+ {
+ if( $mutexAttrId eq $attrId )
+ {
+ write;
+ last;
+ }
+ }
+ }
+
+ print $outFile "};\n\n";
+}
+
+sub writeMutexFileFooter {
+ my($outFile) = @_;
+ print $outFile <<VERBATIM;
+} // End namespace TARGETING
+
+#endif // TARG_MUTEXATTRIBUTES_H
+
+VERBATIM
+}
+
################################################################################
# Writes the trait file header
################################################################################
diff --git a/src/usr/targeting/runtime/start_rt.C b/src/usr/targeting/runtime/start_rt.C
index dac7dc137..a60180fd9 100644
--- a/src/usr/targeting/runtime/start_rt.C
+++ b/src/usr/targeting/runtime/start_rt.C
@@ -50,6 +50,9 @@ namespace RT_TARG
TargetService& l_targetService = targetService();
l_targetService.init(Singleton<AttrRP>::instance().getNodeCount());
+ // Reset hb mutex attributes in case they got stuck in a locked state
+ l_targetService.resetMutexAttributes();
+
adjustTargeting4Runtime();
// set global that TARG is ready
diff --git a/src/usr/targeting/targetservicestart.C b/src/usr/targeting/targetservicestart.C
index 882c4391a..459f9e777 100755
--- a/src/usr/targeting/targetservicestart.C
+++ b/src/usr/targeting/targetservicestart.C
@@ -191,6 +191,12 @@ static void initTargeting(errlHndl_t& io_pError)
(void)l_targetService.init();
initializeAttributes(l_targetService, l_isMpipl, l_isIstepMode, l_scratch);
+ //Ensure all mutex attributes are reset on MPIPL
+ if(l_isMpipl)
+ {
+ l_targetService.resetMutexAttributes();
+ }
+
checkProcessorTargeting(l_targetService);
// Print out top-level model value from loaded targeting values.
@@ -483,8 +489,6 @@ static void initializeAttributes(TargetService& i_targetService,
{
tpm->setAttr<ATTR_HB_TPM_INIT_ATTEMPTED>(0);
tpm->setAttr<ATTR_HB_TPM_LOG_MGR_PTR>(0);
- auto tpmMutex=tpm->getHbMutexAttr<ATTR_HB_TPM_MUTEX>();
- mutex_init(tpmMutex);
}
//Assemble list of membuf and zero out some virtual address attributes
OpenPOWER on IntegriCloud