VirtualBox

Changeset 106300 in vbox


Ignore:
Timestamp:
Oct 12, 2024 4:40:07 AM (7 weeks ago)
Author:
vboxsync
Message:

ValidationKit/bootsectors: always display final micro-tests tally; backport SKIPIT changes to run-bs3-instr-3; bugref:10658; bugref 9898

Location:
trunk/src/VBox/ValidationKit/bootsectors
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-instr-3.c32

    r106061 r106300  
    575575
    576576
    577 /*
    578  * Code to make testing the tests faster.  `bs3CpuInstr3_SkipIt()' randomly
    579  * skips a large fraction of the micro-tests.  It is sufficiently random
    580  * that over a large number of runs, all micro-tests will be hit.
    581  *
    582  * This improves the runtime of the worst case (`#define ALL_TESTS' on a
    583  * debug build, run with '--execute-all-in-iem') from ~9000 to ~800 seconds
    584  * (on an Intel Core i7-10700, fwiw).
    585  *
    586  * To activate this 'developer's speed-testing mode', turn on
    587  * `#define BS3_SKIPIT_DO_SKIP' here.
    588  *
    589  * BS3_SKIPIT_AVG_SKIP governs approximately how many micro-tests are
    590  * skipped in a row; e.g. the default of 26 means about every 27th
    591  * micro-test is run during a particular test run.  (This is not 27x
    592  * faster due to other activities which are not skipped!)  Note this is
    593  * only an average; the actual skips are random.
    594  *
    595  * You can also modify bs3CpuInstr3_SkipIt() to focus on specific sub-tests,
    596  * using its (currently ignored) `bRing, iCfg, iTest, iVal, iVariant' args
    597  * (to enable this: turn on `#define BS3_SKIPIT_DO_ARGS': which costs about
    598  * 3% performance).
    599  *
    600  * Note! The skipping is not compatible with testing the native recompiler as
    601  *       it requires the test code to be run a number of times before it kicks
    602  *       in and does the native recompilation (currently around 16 times).
    603  */
    604 #define BS3_SKIPIT_AVG_SKIP     26
    605 #define BS3_SKIPIT_REPORT_COUNT 150000
    606 #undef  BS3_SKIPIT_DO_SKIP
    607 #undef  BS3_SKIPIT_DO_ARGS
    608 
    609 #ifndef BS3_SKIPIT_DO_SKIP
    610 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) (false)
    611 #else
    612 # include <iprt/asm-amd64-x86.h>
    613 # include <iprt/asm-math.h>
    614 
    615 DECLINLINE(uint32_t) bs3CpuInstr3_SimpleRand(void)
     577#include <iprt/asm-amd64-x86.h>
     578#include <iprt/asm-math.h>
     579
     580DECLINLINE(uint32_t) bs3CpuInstrX_SimpleRand(void)
    616581{
    617582    /*
     
    631596    uint32_t uVal = s_uSeedMemory;
    632597    if (!uVal)
     598    {
    633599        uVal = (uint32_t)ASMReadTSC();
     600        Bs3TestPrintf("PRNG initial seed: 0x%08lx\n", uVal);
     601    }
    634602    uVal = ASMModU64ByU32RetU32(ASMMult2xU32RetU64(uVal, 16807), INT32_MAX);
    635603    s_uSeedMemory = uVal;
     
    637605}
    638606
     607
     608/*
     609 * Code to make testing the tests faster. `bs3CpuInstrX_SkipIt()' randomly
     610 * skips a fraction of the micro-tests.  It is sufficiently random that
     611 * over a large number of runs, all micro-tests will be hit.
     612 *
     613 * Full test runs take ever longer as we add more instructions and fancier
     614 * ways of testing them.  In one example scenario, a debug build running
     615 * bs3-cpu-instr-3 under interpreted IEM went from 9000 to 800 seconds,
     616 * with BS3_SKIPIT_AVG_SKIP set to 26.
     617 *
     618 * To activate this 'developer's speed-testing mode', define
     619 * `BS3_SKIPIT_AVG_SKIP' to a positive integer like 10 or 200.
     620 *
     621 * BS3_SKIPIT_AVG_SKIP governs approximately how many micro-tests are
     622 * skipped in a row; e.g. if set to 100, an average of 100 micro-tests
     623 * in a row are skipped.  (This is not a full 100x faster, due to other
     624 * activities which are not skipped!)  Note this is only an average;
     625 * the actual skips are random.
     626 *
     627 * You can also modify bs3CpuInstrX_SkipIt() to focus on specific sub-tests,
     628 * using its (currently ignored) `bRing, iCfg, iTest, iVal, iVariant' args
     629 * (to enable this: turn on `#define BS3_SKIPIT_DO_ARGS': which costs about
     630 * 3% performance).
     631 *
     632 * Note!  For testing the native recompiler, configure the VM to invoke
     633 * native recompilation quickly with:
     634 *
     635 *     VBoxManage setextradata vmname VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled 1
     636 *     VBoxManage setextradata vmname VBoxInternal/Devices/VMMDev/0/Config/TestingThresholdNativeRecompiler 2
     637 *     VBoxManage setextradata vmname VBoxInternal/IEM/NativeRecompileAtUsedCount 1
     638 */
     639#define BS3_SKIPIT_AVG_SKIP           0
     640#define BS3_SKIPIT_REPORT_COUNT 1000000
     641#undef  BS3_SKIPIT_DO_ARGS
     642
    639643static unsigned g_cSeen, g_cSkipped;
    640644
    641 static void bs3CpuInstr3_ShowTallies(void)
    642 {
     645static void bs3CpuInstrX_ShowTallies(bool always)
     646{
     647    if (!g_cSkipped && !always) return;
    643648    Bs3TestPrintf("Micro-tests %d: tested %d / skipped %d\n", g_cSeen, g_cSeen - g_cSkipped, g_cSkipped);
    644649}
    645650
    646651# ifdef BS3_SKIPIT_DO_ARGS
    647 #  define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstr3_SkipIt(bRing, iCfg, iTest, iVal, iVariant)
    648 static bool bs3CpuInstr3_SkipIt(uint8_t bRing, unsigned iCfg, unsigned iTest, unsigned iVal, unsigned iVariant)
     652#  define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstrX_SkipIt(bRing, iCfg, iTest, iVal, iVariant)
     653static bool bs3CpuInstrX_SkipIt(uint8_t bRing, unsigned iCfg, unsigned iTest, unsigned iVal, unsigned iVariant)
    649654# else
    650 #  define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstr3_SkipIt()
    651 static bool bs3CpuInstr3_SkipIt(void)
     655#  define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstrX_SkipIt()
     656static bool bs3CpuInstrX_SkipIt(void)
    652657# endif
    653658{
     
    657662    /* Cache calls to the relatively expensive random routine */
    658663    if (!s_uTimes)
    659         s_uTimes = bs3CpuInstr3_SimpleRand() % (BS3_SKIPIT_AVG_SKIP * 2 + 1) + 1;
     664        s_uTimes = bs3CpuInstrX_SimpleRand() % (BS3_SKIPIT_AVG_SKIP * 2 + 1) + 1;
    660665    fSkip = --s_uTimes > 0;
    661666    if (fSkip)
     
    663668
    664669    if (++g_cSeen % BS3_SKIPIT_REPORT_COUNT == 0)
    665         bs3CpuInstr3_ShowTallies();
     670        bs3CpuInstrX_ShowTallies(false);
    666671    return fSkip;
    667672}
    668 
    669 #endif /* BS3_SKIPIT_DO_SKIP */
    670673
    671674
     
    1624616249             */
    1624716250            Bs3TestDoModesByOne_pe32(g_aTests, RT_ELEMENTS(g_aTests), BS3TESTMODEBYONEENTRY_F_REAL_MODE_READY);
    16248 #ifdef BS3_SKIPIT_DO_SKIP
    16249             bs3CpuInstr3_ShowTallies();
    16250 #endif
     16251            bs3CpuInstrX_ShowTallies(true);
    1625116252        }
    1625216253        else
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-instr-4.c32

    r106299 r106300  
    22732273 * ways of testing them.  In one example scenario, a debug build running
    22742274 * bs3-cpu-instr-3 under interpreted IEM went from 9000 to 800 seconds,
    2275  * with BS3_SKIPIT_AVG_SKIP on the default 26.
     2275 * with BS3_SKIPIT_AVG_SKIP set to 26.
    22762276 *
    2277  * To activate this 'developer's speed-testing mode', turn on
    2278  * `#define BS3_SKIPIT_DO_SKIP' here.
     2277 * To activate this 'developer's speed-testing mode', define
     2278 * `BS3_SKIPIT_AVG_SKIP' to a positive integer like 10 or 200.
    22792279 *
    22802280 * BS3_SKIPIT_AVG_SKIP governs approximately how many micro-tests are
    2281  * skipped in a row; e.g. the default of 26 means that on average, every
    2282  * 26th micro-test is run during a particular test run.  (This is not 26x
    2283  * faster, due to other activities which are not skipped!)  Note this is
    2284  * only an average; the actual skips are random.
     2281 * skipped in a row; e.g. if set to 100, an average of 100 micro-tests
     2282 * in a row are skipped.  (This is not a full 100x faster, due to other
     2283 * activities which are not skipped!)  Note this is only an average;
     2284 * the actual skips are random.
    22852285 *
    22862286 * You can also modify bs3CpuInstrX_SkipIt() to focus on specific sub-tests,
     
    22962296 *     VBoxManage setextradata vmname VBoxInternal/IEM/NativeRecompileAtUsedCount 1
    22972297 */
    2298 #define BS3_SKIPIT_AVG_SKIP          26
     2298#define BS3_SKIPIT_AVG_SKIP           0
    22992299#define BS3_SKIPIT_REPORT_COUNT 1000000
    2300 #undef  BS3_SKIPIT_DO_SKIP
    23012300#undef  BS3_SKIPIT_DO_ARGS
    23022301
    23032302#ifdef DEBUG_ramshankar
    2304 # undef  BS3_SKIPIT_DO_SKIP
    2305 # define BS3_SKIPIT_DO_SKIP
    23062303# undef  BS3_SKIPIT_AVG_SKIP
    2307 # define BS3_SKIPIT_AVG_SKIP        80
     2304# define BS3_SKIPIT_AVG_SKIP         80
    23082305#endif
    23092306
    2310 #ifndef BS3_SKIPIT_DO_SKIP
    2311 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) (false)
    2312 #else
    23132307static unsigned g_cSeen, g_cSkipped;
    23142308
    2315 static void bs3CpuInstrX_ShowTallies(void)
     2309static void bs3CpuInstrX_ShowTallies(bool always)
    23162310{
     2311    if (!g_cSkipped && !always) return;
    23172312    Bs3TestPrintf("Micro-tests %d: tested %d / skipped %d\n", g_cSeen, g_cSeen - g_cSkipped, g_cSkipped);
    23182313}
     
    23372332
    23382333    if (++g_cSeen % BS3_SKIPIT_REPORT_COUNT == 0)
    2339         bs3CpuInstrX_ShowTallies();
     2334        bs3CpuInstrX_ShowTallies(false);
    23402335    return fSkip;
    23412336}
    23422337
    2343 #endif /* BS3_SKIPIT_DO_SKIP */
    23442338
    23452339/*
     
    1474114735                 */
    1474214736                Bs3TestDoModesByOne_pe32(g_aTests, RT_ELEMENTS(g_aTests), BS3TESTMODEBYONEENTRY_F_REAL_MODE_READY);
    14743 #ifdef BS3_SKIPIT_DO_SKIP
    14744                 bs3CpuInstrX_ShowTallies();
    14745 #endif
     14737                bs3CpuInstrX_ShowTallies(true);
    1474614738            }
    1474714739            else
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