VirtualBox

Changeset 54408 in vbox


Ignore:
Timestamp:
Feb 24, 2015 2:06:56 AM (10 years ago)
Author:
vboxsync
Message:

IPRT/r0drv: Added RTMpOnPair and RTMpOnPairIsConcurrentExecSupported, currently generic wrappers around RTMpOnAll but this will change where possible.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/err.h

    r53615 r54408  
    926926/** The requested allocation is too big. */
    927927#define VERR_ALLOCATION_TOO_BIG             (-22407)
     928/** Mismatch. */
     929#define VERR_MISMATCH                       (-22408)
     930/** Wrong type. */
     931#define VERR_WRONG_TYPE                     (-22409)
    928932/** @} */
    929933
     
    16021606/** The specified cpu was not found. */
    16031607#define VERR_CPU_NOT_FOUND                      (-801)
     1608/** Not all of the requested CPUs showed up in the PFNRTMPWORKER. */
     1609#define VERR_NOT_ALL_CPUS_SHOWED                (-802)
     1610/** Internal processing error in the RTMp code.*/
     1611#define VERR_CPU_IPE_1                          (-803)
    16041612/** @} */
    16051613
  • trunk/include/iprt/mp.h

    r54382 r54408  
    246246typedef FNRTMPWORKER *PFNRTMPWORKER;
    247247
     248/** @name RTMPON_F_XXX - RTMpOn flags.
     249 * @{ */
     250/** Caller doesn't care if pfnWorker is executed at the same time on the
     251 *  specified CPUs or not, as long as it gets executed. */
     252#define RTMPON_F_WHATEVER_EXEC      0
     253/** The caller insists on pfnWorker being executed more or less concurrently
     254 * on the specified CPUs. */
     255#define RTMPON_F_CONCURRENT_EXEC    RT_BIT_32(1)
     256/** Mask of valid bits. */
     257#define RTMPON_F_VALID_MASK         UINT32_C(0x00000001)
     258/** @}*/
     259
    248260/**
    249261 * Checks if the RTMpOnAll() is safe with regards to all threads executing
     
    308320 */
    309321RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
     322
     323/**
     324 * Executes a function on two specific CPUs in the system.
     325 *
     326 * @returns IPRT status code.
     327 * @retval  VINF_SUCCESS on success.
     328 * @retval  VERR_NOT_SUPPORTED if this kind of operation isn't supported by the
     329 *          system or if the specified modifier flag isn't supported.
     330 * @retval  VERR_CPU_OFFLINE if one or more of the CPUs are offline (see
     331 *          remarks).
     332 * @retval  VERR_CPU_NOT_FOUND if on or both of the CPUs weren't found.
     333 * @retval  VERR_NOT_ALL_CPUS_SHOWED if one of the CPUs didn't show.
     334 *
     335 * @param   idCpu1          The id of the first CPU.
     336 * @param   idCpu2          The id of the second CPU.
     337 * @param   fFlags          Combination of RTMPON_F_XXX flags.
     338 * @param   pfnWorker       The worker function.
     339 * @param   pvUser1         The first user argument for the worker.
     340 * @param   pvUser2         The second user argument for the worker.
     341 *
     342 * @remarks There is a possible race between one (or both) of the CPUs going
     343 *          offline while setting up the call.  The worker function must take
     344 *          this into account.
     345 */
     346RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
     347
     348/**
     349 * Indicates whether RTMpOnPair supports running the pfnWorker concurrently on
     350 * both CPUs using RTMPON_F_CONCURRENT_EXEC.
     351 *
     352 * @returns true if supported, false if not.
     353 */
     354RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void);
     355
    310356
    311357/**
  • trunk/src/VBox/Runtime/Makefile.kmk

    r54319 r54408  
    18701870        generic/RTMpGetCoreCount-generic.cpp \
    18711871        generic/mppresent-generic.cpp \
     1872        generic/RTMpOnPair-generic.cpp \
    18721873        r0drv/linux/alloc-r0drv-linux.c \
    18731874        r0drv/linux/assert-r0drv-linux.c \
     
    20012002        generic/mppresent-generic.cpp \
    20022003        generic/RTMpGetCoreCount-generic.cpp \
     2004        generic/RTMpOnPair-generic.cpp \
    20032005        nt/RTErrConvertFromNtStatus.cpp \
    20042006        r0drv/generic/threadctxhooks-r0drv-generic.cpp \
     
    20402042        generic/RTTimerCreate-generic.cpp \
    20412043        generic/RTMpGetCoreCount-generic.cpp \
     2044        generic/RTMpOnPair-generic.cpp \
    20422045        generic/mppresent-generic.cpp \
    20432046        generic/timer-generic.cpp \
     
    21372140        generic/RTLogWriteDebugger-generic.cpp \
    21382141        generic/RTLogWriteStdOut-stub-generic.cpp \
     2142        generic/RTMpOnPair-generic.cpp \
    21392143        generic/RTTimerCreate-generic.cpp \
    21402144        generic/mppresent-generic.cpp \
     
    21672171        generic/RTLogWriteStdOut-stub-generic.cpp \
    21682172        generic/RTMpGetCoreCount-generic.cpp \
     2173        generic/RTMpOnPair-generic.cpp \
    21692174        generic/RTTimerCreate-generic.cpp \
    21702175        generic/mppresent-generic.cpp \
     
    22022207        common/string/strchr.asm \
    22032208        generic/RTAssertShouldPanic-generic.cpp \
     2209        generic/RTMpOnPair-generic.cpp \
    22042210        generic/RTTimerCreate-generic.cpp \
    22052211        generic/mppresent-generic.cpp \
  • trunk/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp

    r44529 r54408  
    55
    66/*
    7  * Copyright (C) 2008-2010 Oracle Corporation
     7 * Copyright (C) 2008-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4545
    4646
     47RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
     48{
     49    return false;
     50}
     51RT_EXPORT_SYMBOL(RTMpOnAllIsConcurrentSafe);
     52
     53
    4754RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
    4855{
     
    6572RT_EXPORT_SYMBOL(RTMpOnSpecific);
    6673
     74
     75RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
     76{
     77    NOREF(idCpu1);
     78    NOREF(idCpu2);
     79    NOREF(pfnWorker);
     80    NOREF(pvUser1);
     81    NOREF(pvUser2);
     82    return VERR_NOT_SUP_IN_RAW_MODE;
     83}
     84RT_EXPORT_SYMBOL(RTMpOnPair);
     85
     86
     87
     88RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void)
     89{
     90    return false;
     91}
     92RT_EXPORT_SYMBOL(RTMpOnPairIsConcurrentExecSupported);
     93
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