VirtualBox

Changeset 90462 in vbox for trunk/src


Ignore:
Timestamp:
Aug 1, 2021 9:27:16 PM (4 years ago)
Author:
vboxsync
Message:

VMMDev: New port for lock contention testing. [grr] bugref:6695

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VMMDevTesting.cpp

    r90461 r90462  
    582582                }
    583583
    584                 /*
    585                  * Configure the locking contention test.
    586                  */
    587                 case VMMDEV_TESTING_IOPORT_LOCKED - VMMDEV_TESTING_IOPORT_BASE:
    588                     switch (cb)
    589                     {
    590                         case 4:
    591                         case 2:
    592                         case 1:
    593                         {
    594                             int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VINF_SUCCESS);
    595                             AssertRCReturn(rc, rc);
    596 
    597                             u32 &= ~VMMDEV_TESTING_LOCKED_MBZ_MASK;
    598                             if (pThis->TestingLockControl.u32 != u32)
    599                             {
    600                                 pThis->TestingLockControl.u32 = u32;
    601                                 PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hTestingLockEvt);
    602                             }
    603 
    604                             PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    605                             return VINF_SUCCESS;
    606                         }
    607 
    608                         default:
    609                             AssertFailed();
    610                             return VERR_INTERNAL_ERROR_2;
    611                     }
    612 
    613584                default:
    614585                    break;
     
    617588            return VINF_SUCCESS;
    618589        }
     590
     591        /*
     592         * Configure the locking contention test.
     593         */
     594        case VMMDEV_TESTING_IOPORT_LOCKED - VMMDEV_TESTING_IOPORT_BASE:
     595            switch (cb)
     596            {
     597                case 4:
     598                case 2:
     599                case 1:
     600                {
     601                    int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VINF_SUCCESS);
     602                    AssertRCReturn(rc, rc);
     603
     604                    u32 &= ~VMMDEV_TESTING_LOCKED_MBZ_MASK;
     605                    if (pThis->TestingLockControl.u32 != u32)
     606                    {
     607                        pThis->TestingLockControl.u32 = u32;
     608                        PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hTestingLockEvt);
     609                    }
     610
     611                    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     612                    return VINF_SUCCESS;
     613                }
     614
     615                default:
     616                    AssertFailed();
     617                    return VERR_INTERNAL_ERROR_2;
     618            }
    619619
    620620        default:
     
    695695            }
    696696            break;
     697
     698        /*
     699         * Just return the current locking configuration value after first
     700         * acquiring the lock of course.
     701         */
     702        case VMMDEV_TESTING_IOPORT_LOCKED - VMMDEV_TESTING_IOPORT_BASE:
     703            switch (cb)
     704            {
     705                case 4:
     706                case 2:
     707                case 1:
     708                {
     709                    int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VINF_SUCCESS);
     710                    AssertRCReturn(rc, rc);
     711
     712                    *pu32 = pThis->TestingLockControl.u32;
     713
     714                    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     715                    return VINF_SUCCESS;
     716                }
     717
     718                default:
     719                    AssertFailed();
     720                    return VERR_INTERNAL_ERROR_2;
     721            }
    697722
    698723        /*
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