VirtualBox

Changeset 65802 in vbox


Ignore:
Timestamp:
Feb 17, 2017 12:59:39 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113536
Message:

vsheriff: check out kvm_lock_spinning guest stacks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py

    r65743 r65802  
    480480    ktReason_Unknown_File_Not_Found                    = ( 'Unknown',           'File not found' );
    481481    ktReason_Unknown_VM_Crash                          = ( 'Unknown',           'VM crash' );
     482    ktReason_VMM_kvm_lock_spinning                     = ( 'VMM',               'kvm_lock_spinning' );
    482483    ktReason_Ignore_Buggy_Test_Driver                  = ( 'Ignore',            'Buggy test driver' );
    483484    ktReason_Ignore_Stale_Files                        = ( 'Ignore',            'Stale files' );
     
    744745        return False;
    745746
     747    @staticmethod
     748    def extractGuestCpuStack(sInfoText):
     749        """
     750        Extracts the guest CPU stacks from the input file.
     751
     752        Returns a dictionary keyed by the CPU number, value being a list of
     753        raw stack lines (no header).
     754        Returns empty dictionary if no stacks where found.
     755        """
     756        dRet = {};
     757        off = 0;
     758        while True:
     759            offStart = sInfoText.find('=== start guest stack VCPU ', off);
     760            if offStart < 0:
     761                break;
     762            offEnd  = sInfoText.find('=== end guest stack', offStart + 20);
     763            if offEnd < 0:
     764                offEnd = sInfoText.find('=== start guest stack VCPU', offStart + 20);
     765                if offEnd >= 0:
     766                    offEnd += 3;
     767                else:
     768                    offEnd = len(sInfoText);
     769
     770            sStack = sInfoText[offStart : offEnd];
     771            sStack = sStack.replace('\r',''); # paranoia
     772            asLines = sStack.split();
     773
     774            # figure the CPU.
     775            asWords = asLines[0].split();
     776            if asWords < 6 or not asWords[6].isdigit():
     777                break;
     778            iCpu = int(asWords[6]);
     779
     780            # add it.
     781            dRet[iCpu] = [sLine.rstrip() for sLine in asLines[2:-1]]
     782        return dRet;
     783
     784    def investigateInfoKvmLockSpinning(self, oCaseFile, sInfoText, dLogs):
     785        """ Investigates kvm_lock_spinning deadlocks """
     786        #
     787        # Extract the stacks.  We need more than one CPU to create a deadlock.
     788        #
     789        dStacks = self.extractGuestCpuStack(sInfoText);
     790        if len(dStacks) >= 2:
     791            #
     792            # Examin each of the stacks.  Each must have kvm_lock_spinning in
     793            # one of the first three entries.
     794            #
     795            cHits = 0;
     796            for iCpu in dStacks:
     797                asBacktrace = dStacks[iCpu];
     798                for iFrame in xrange(min(3, len(asBacktrace))):
     799                    if asBacktrace[iFrame].find('kvm_lock_spinning') >= 0:
     800                        cHits += 1;
     801                        break;
     802            if cHits == len(dStacks):
     803                return (True, self.ktReason_VMM_kvm_lock_spinning);
     804
     805        _ = dLogs; _ = oCaseFile;
     806        return (False, None);
    746807
    747808    ## Things we search a main or VM log for to figure out why something went bust.
     
    803864    ];
    804865
     866    ## Things we search for in the info.txt file.  Require handlers for now.
     867    katInfoTextHandlers = [
     868        # ( Trigger text,                       handler method )
     869        ( "kvm_lock_spinning",                  investigateInfoKvmLockSpinning ),
     870    ];
     871
    805872    ## Mapping screenshot/failure SHA-256 hashes to failure reasons.
    806873    katSimpleScreenshotHashReasons = [
     
    908975                            return True;
    909976                        fFoundSomething = True;
     977
     978            #
     979            # Complicated stuff.
     980            #
     981            dLogs = {
     982                'sVMLog':       sVMLog,
     983                'sNtHardLog':   sNtHardLog,
     984                'sScreenHash':  sScreenHash,
     985                'sKrnlLog':     sKrnlLog,
     986                'sVgaText':     sVgaText,
     987                'sInfoText':    sInfoText,
     988            };
     989
     990            # info.txt.
     991            if sInfoText is not None and len(sInfoText) > 0:
     992                for sNeedle, fnHandler in self.katInfoTextHandlers:
     993                    if sInfoText.find(sNeedle) > 0:
     994                        (fStop, tReason) = fnHandler(self, oCaseFile, sInfoText, dLogs);
     995                        if tReason is not None:
     996                            oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
     997                            if fStop:
     998                                return True;
     999                            fFoundSomething = True;
    9101000
    9111001            #
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette