VirtualBox

Changeset 96583 in vbox


Ignore:
Timestamp:
Sep 2, 2022 8:35:17 PM (2 years ago)
Author:
vboxsync
Message:

ValKit/LoadGenerator: Only build the amd64 version with the IPI type load, we haven't offically had a VBoxDrv kernel module/driver for non-amd64 for a while. The x86 windows version dragged in RtlGetLastWin32Error via SUP.lib, causing unnecessary trouble with older windows versions. bugref:10261

Location:
trunk/src/VBox/ValidationKit/utils/misc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/misc/Makefile.kmk

    r96407 r96583  
    3838include $(KBUILD_PATH)/subheader.kmk
    3939
     40#
     41# Load generator, optionally with an ring-0 IPI generator.
     42#
    4043PROGRAMS += LoadGenerator
    41 LoadGenerator_TEMPLATE = VBoxValidationKitR3SupDrv
    42 LoadGenerator_SOURCES  = loadgenerator.cpp
     44if1of ($(KBUILD_TARGET_ARCH),amd64)
     45 ifdef VBOX_WITH_R0_MODULES
     46  ifdef VBOX_WITH_VBOXR0_AS_DLL
     47DLLS    += loadgeneratorR0
     48  else
     49SYSMODS += loadgeneratorR0
     50  endif
     51loadgeneratorR0_TEMPLATE := VBoxValidationKitR0
     52loadgeneratorR0_SOURCES  := loadgeneratorR0.cpp
     53 endif
     54LoadGenerator_TEMPLATE := VBoxValidationKitR3SupDrv
     55LoadGenerator_DEFS     := WITH_IPI_LOAD_GEN
     56else
     57LoadGenerator_TEMPLATE := VBoxValidationKitR3
     58endif
     59LoadGenerator_SOURCES  := loadgenerator.cpp
    4360
    44 ifdef VBOX_WITH_R0_MODULES
    45  ifdef VBOX_WITH_VBOXR0_AS_DLL
    46   DLLS    += loadgeneratorR0
    47  else
    48   SYSMODS += loadgeneratorR0
    49  endif
    50  loadgeneratorR0_TEMPLATE = VBoxValidationKitR0
    51  loadgeneratorR0_SOURCES = loadgeneratorR0.cpp
    52 endif
    53 
     61#
     62# vts_rm - Test cleanup utility similar to unix rm.
     63#
    5464PROGRAMS += vts_rm
    5565vts_rm_TEMPLATE = VBoxValidationKitR3
    5666vts_rm_SOURCES  = vts_rm.cpp
    5767
     68#
     69# vts_tar - Tar for untarring and tarring test related stuff.
     70#
    5871PROGRAMS += vts_tar
    5972vts_tar_TEMPLATE = VBoxValidationKitR3
     
    6174vts_tar_SOURCES  = vts_tar.cpp
    6275
     76#
     77# vts_shutdown - initiates a guest or host shut down / reboot.
     78#
    6379PROGRAMS += vts_shutdown
    6480vts_shutdown_TEMPLATE = VBoxValidationKitR3
  • trunk/src/VBox/ValidationKit/utils/misc/loadgenerator.cpp

    r96407 r96583  
    4343#include <iprt/time.h>
    4444#include <iprt/initterm.h>
     45#include <iprt/message.h>
    4546#include <iprt/string.h>
    4647#include <iprt/stream.h>
     
    5152#include <iprt/asm.h>
    5253#include <iprt/getopt.h>
    53 #include <VBox/sup.h>
     54#ifdef WITH_IPI_LOAD_GEN
     55# include <VBox/sup.h>
     56#endif
    5457
    5558
     
    5962/** Whether the threads should quit or not. */
    6063static bool volatile    g_fQuit = false;
    61 static const char      *g_pszProgramName = NULL;
    62 
    63 
    64 /*********************************************************************************************************************************
    65 *   Internal Functions                                                                                                           *
    66 *********************************************************************************************************************************/
    67 static int Error(const char *pszFormat, ...);
    6864
    6965
     
    8682}
    8783
     84#ifdef WITH_IPI_LOAD_GEN
    8885
    8986static int LoadGenIpiInit(void)
     
    109106        }
    110107        else
    111             Error("SUPR3LoadServiceModule(%s): %Rrc\n", szPath, rc);
     108            RTMsgError("SUPR3LoadServiceModule(%s): %Rrc", szPath, rc);
    112109    }
    113110    else
    114         Error("RTPathAppPrivateArch: %Rrc\n", rc);
     111        RTMsgError("RTPathAppPrivateArch: %Rrc", rc);
    115112    return rc;
    116113}
     
    126123        if (RT_FAILURE(rc))
    127124        {
    128             Error("SUPR3CallR0Service: %Rrc\n", rc);
     125            RTMsgError("SUPR3CallR0Service: %Rrc", rc);
    129126            break;
    130127        }
     
    140137}
    141138
    142 
    143 static int Error(const char *pszFormat, ...)
    144 {
    145     va_list va;
    146     RTStrmPrintf(g_pStdErr, "%s: error: ", g_pszProgramName);
    147     va_start(va, pszFormat);
    148     RTStrmPrintfV(g_pStdErr, pszFormat, va);
    149     va_end(va);
    150     return 1;
    151 }
    152 
    153 
    154 static int SyntaxError(const char *pszFormat, ...)
    155 {
    156     va_list va;
    157     RTStrmPrintf(g_pStdErr, "%s: syntax error: ", g_pszProgramName);
    158     va_start(va, pszFormat);
    159     RTStrmPrintfV(g_pStdErr, pszFormat, va);
    160     va_end(va);
    161     return 1;
    162 }
     139#endif
    163140
    164141
     
    173150    {
    174151        { "spin",   NULL,           LoadGenSpinThreadFunction },
     152#ifdef WITH_IPI_LOAD_GEN
    175153        { "ipi",    LoadGenIpiInit, LoadGenIpiThreadFunction },
     154#endif
    176155    };
    177156    unsigned        iLoadType = 0;
     
    185164
    186165    RTR3InitExe(argc, &argv, 0);
    187 
    188     /*
    189      * Set program name.
    190      */
    191     g_pszProgramName = RTPathFilename(argv[0]);
    192166
    193167    /*
     
    213187                cThreads = ValueUnion.u64;
    214188                if (cThreads == 0 || cThreads > RT_ELEMENTS(s_aThreads))
    215                     return SyntaxError("Requested number of threads, %RU32, is out of range (1..%d).\n",
     189                    return RTMsgSyntax("Requested number of threads, %RU32, is out of range (1..%d).",
    216190                                       cThreads, RT_ELEMENTS(s_aThreads) - 1);
    217191                break;
     
    222196                rc = RTStrToUInt64Ex(ValueUnion.psz, &psz, 0, &cNanoSeconds);
    223197                if (RT_FAILURE(rc))
    224                     return SyntaxError("Failed reading the alleged number '%s' (option '%s', rc=%Rrc).\n",
     198                    return RTMsgSyntax("Failed reading the alleged number '%s' (option '%s', rc=%Rrc).",
    225199                                       ValueUnion.psz, rc);
    226200                while (*psz == ' ' || *psz == '\t')
     
    240214                        u64Factor = UINT64_C(3600000000000);
    241215                    else
    242                         return SyntaxError("Unknown time suffix '%s'\n", psz);
     216                        return RTMsgSyntax("Unknown time suffix '%s'", psz);
    243217                    uint64_t u64 = cNanoSeconds * u64Factor;
    244218                    if (u64 < cNanoSeconds || (u64 < u64Factor && u64))
    245                         return SyntaxError("Time representation overflowed! (%RU64 * %RU64)\n",
     219                        return RTMsgSyntax("Time representation overflowed! (%RU64 * %RU64)",
    246220                                           psz, cNanoSeconds, u64Factor);
    247221                    cNanoSeconds = u64;
     
    275249                    }
    276250                    else
    277                         return SyntaxError("can't grok thread type '%s'\n",
     251                        return RTMsgSyntax("can't grok thread type '%s'",
    278252                                           ValueUnion.psz);
    279253                }
     
    282256                    enmThreadType = (RTTHREADTYPE)u32;
    283257                    if (enmThreadType <= RTTHREADTYPE_INVALID || enmThreadType >= RTTHREADTYPE_END)
    284                         return SyntaxError("thread type '%d' is out of range (%d..%d)\n",
     258                        return RTMsgSyntax("thread type '%d' is out of range (%d..%d)",
    285259                                           ValueUnion.psz, RTTHREADTYPE_INVALID + 1, RTTHREADTYPE_END - 1);
    286260                }
     
    302276                    }
    303277                if (ValueUnion.psz)
    304                     return SyntaxError("Unknown load type '%s'.\n", ValueUnion.psz);
     278                    return RTMsgSyntax("Unknown load type '%s'.", ValueUnion.psz);
    305279                break;
    306280            }
    307281
    308282            case 'h':
    309                 RTStrmPrintf(g_pStdOut,
    310                              "Usage: %s [-p|--thread-type <type>] [-t|--timeout <sec|xxx[h|m|s|ms|ns]>] \\\n"
    311                              "       %*s [-n|--number-of-threads <threads>] [-l|--load <loadtype>]\n"
    312                              "\n"
    313                              "Load types: spin, ipi.\n"
    314                              ,
    315                              g_pszProgramName, strlen(g_pszProgramName), "");
     283                RTPrintf("Usage: %s [-p|--thread-type <type>] [-t|--timeout <sec|xxx[h|m|s|ms|ns]>] \\\n"
     284                         "       %*s [-n|--number-of-threads <threads>] [-l|--load <loadtype>]\n"
     285                         "\n"
     286                         "Load types: "
     287                         , RTProcShortName(), strlen(RTProcShortName()), "");
     288                for (size_t i = 0; i < RT_ELEMENTS(s_aLoadTypes); i++)
     289                    RTPrintf(i == 0 ? "%s (default)" : ", %s", s_aLoadTypes[i].pszName);
     290                RTPrintf("\n");
    316291                return 1;
    317292
     
    321296
    322297            case VINF_GETOPT_NOT_OPTION:
    323                 return SyntaxError("Unknown argument #%d: '%s'\n", GetState.iNext-1, ValueUnion.psz);
     298                return RTMsgSyntax("Unknown argument #%d: '%s'", GetState.iNext-1, ValueUnion.psz);
    324299
    325300            default:
     
    335310        const unsigned cCpus = RTMpGetOnlineCount();
    336311        if (cCpus * cThreads > RT_ELEMENTS(s_aThreads))
    337             return SyntaxError("Requested number of threads, %RU32, is out of range (1..%d) when scaled by %d.\n",
     312            return RTMsgSyntax("Requested number of threads, %RU32, is out of range (1..%d) when scaled by %d.",
    338313                               cThreads, RT_ELEMENTS(s_aThreads) - 1, cCpus);
    339314        cThreads *= cCpus;
     
    370345        {
    371346            ASMAtomicXchgBool(&g_fQuit, true);
    372             RTStrmPrintf(g_pStdErr, "%s: failed to create thread #%d, rc=%Rrc\n", g_pszProgramName, i, rc);
     347            RTMsgError("failed to create thread #%d: %Rrc", i, rc);
    373348            while (i-- > 1)
    374349                RTThreadWait(s_aThreads[i], 1500, NULL);
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