VirtualBox

Changeset 27217 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Mar 9, 2010 2:53:00 PM (15 years ago)
Author:
vboxsync
Message:

Additions/VBoxServiceBalloon: Solaris fixes and some logging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceBalloon.cpp

    r27119 r27217  
    6262        return VINF_SUCCESS;
    6363
     64    VBoxServiceVerbose(3, "VBoxServiceBalloonSetUser: cNewChunks=%u g_cMemBalloonChunks=%u\n", cNewChunks, g_cMemBalloonChunks);
    6465    int rc = VINF_SUCCESS;
    6566    if (cNewChunks > g_cMemBalloonChunks)
    6667    {
    6768        /* inflate */
     69        g_pavBalloon = (void**)RTMemRealloc(g_pavBalloon, cNewChunks * sizeof(void*));
    6870        uint32_t i;
    69         g_pavBalloon = (void**)RTMemRealloc(g_pavBalloon, cNewChunks * sizeof(void*));
    7071        for (i = g_cMemBalloonChunks; i < cNewChunks; i++)
    7172        {
     
    7980            {
    8081                g_pavBalloon[i] = pv;
    81                 /* protect against access by dangling pointers (may fail) */
     82#ifndef RT_OS_SOLARIS
     83                /*
     84                 * Protect against access by dangling pointers (ignore errors as it may fail).
     85                 * On Solaris it corrupts the address space leaving the process unkillable. This could
     86                 * perhaps be related to what the underlying segment driver does; currently just disable it.
     87                 */
    8288                RTMemProtect(pv, VMMDEV_MEMORY_BALLOON_CHUNK_SIZE, RTMEM_PROT_NONE);
     89#endif
    8390                g_cMemBalloonChunks++;
    8491            }
     
    8996            }
    9097        }
     98        VBoxServiceVerbose(3, "VBoxServiceBalloonSetUser: inflation complete. chunks=%u rc=%d\n", i, rc);
    9199    }
    92100    else
     
    100108            if (RT_SUCCESS(rc))
    101109            {
     110#ifndef RT_OS_SOLARIS
    102111                /* unprotect */
    103112                RTMemProtect(pv, VMMDEV_MEMORY_BALLOON_CHUNK_SIZE, RTMEM_PROT_READ | RTMEM_PROT_WRITE);
     113#endif
    104114                RTMemPageFree(g_pavBalloon[i]);
    105115                g_pavBalloon[i] = NULL;
     
    108118            else
    109119                break;
     120            VBoxServiceVerbose(3, "VBoxServiceBalloonSetUser: deflation complete. chunks=%u rc=%d\n", i, rc);
    110121        }
    111122    }
     
    213224                                   cNewChunks, fHandleInR3 ? "R3" : "R0");
    214225                if (fHandleInR3)
     226                {
    215227                    rc = VBoxServiceBalloonSetUser(cNewChunks);
     228                    if (RT_FAILURE(rc))
     229                    {
     230                        VBoxServiceVerbose(3, "VBoxServiceBalloonWorker: failed to set balloon size %d MB (%s memory)\n",
     231                                    cNewChunks, fHandleInR3 ? "R3" : "R0");
     232                    }
     233                    else
     234                        VBoxServiceVerbose(3, "VBoxServiceBalloonWorker: successfully set requested balloon size %d.\n", cNewChunks);
     235                }
    216236                else
    217237                    g_cMemBalloonChunks = cNewChunks;
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