vmblock: Kill stubs.h, use vm_assert.h. Ditch obj build => INVARIANTS for FreeBSD.
When I ported vmblock over to FreeBSD, I set things up such that
VMX86_DEVEL builds compiled kernel modules with two FreeBSD debugging
features, INVARIANTS and WITNESS, enabled. These features require that
the kernel also be compiled with those options, else they won't load.
This isn't announced anywhere, and people were recently bitten by it.
This change now wraps INVARIANTS & WITNESS inside another make variable,
EXTRA_FREEBSD_DEBUGGING. Rather than use KASSERT, we'll simply rely on
the vm_assert.h approach which eventually leads to Panic (still provided
by stubs.c). Stubs.h was removed due to the redefinition of Panic.
GuestInfo: Use consistent function doc style, misc touchups.
- TCS callbacks moved to "TCS goodies" block near ToolsOnLoad.
- Retrofitted all functions with VMKAPI style doc blocks.
- Ditched the "custom delimiter" argument to SetGuestInfo since it wasn't used.
- Isolated "send uptime" behavior from the "set capabilities" callback handler.
Crossport vmtoolsd changes from CS 980554 into vmcore-main.
Make sure the main loop doesn't start if a plugin has signaled it
top stop during initialization, and avoid doing unnecessary plugin
initialization when a plugin requests the container to quit.
. remove function typedefs from message.h (they're not used anywhere).
. remove function declarations from vixTools.h (functions don't exist).
. remove socketMgr.h (not included by anyone anymore).
. remove stale GuestInfo_GetSystemBitness prototype.
. remove RpcIn_restart() (not used anywhere).
Add HashTable_FreeUnsafe to allow freeing of an atomic hash table
The MXUser read-write lock wants to free its hash table when the lcok
is destroyed, but HashTable_Free has an ASSERT that it cannot be
atomic. Let's add another function HashTable_FreeUnsafe to allow
freeing of an atomic hash table, but the caller has to ensure that no
other thread may be accessing the hash table when it is being freed.
1. Lock rank defines in vm_basic_defs.h move to a new file mutexRank.h.
2. Existing libMutexRank.h moves to mutexRankLib.h.
3. Fix includes in all files that needed it.
FAST_V4 no longer works on linux because it requires session
support and V4 headers. However, V3 fallback should have worked.
Some minor fixes to make V3 fallback work.
I have also changed KERN_DEBUG to KERN_WARNING, since most distros
will only print WARNING messages.
This change extends tools time sync to use the core ideas (and
system call) from NTP's time synchronization algorithm.
I tested this using ATTS for these guests: SLES11-64, RHEL5.4-64,
RHEL4.8-32, WinXP-32, Win7-64. All of the results describe are
ignoring time spikes caused by apparent time falling behind and
catching up (which are not expected to be corrected by tools
timesync).
* Win7-64 hit a bug in the testing framework.
* WinXP-32 looked good (but unchaged from before).
* RHEL4.8-32 looks good (I'm using a 1000Hz kernel using the TSC,
so the lost tick compensation bug hits very severely and thus
provides a good test case for timesync).
* SLES11-64: Stayed within 1.5ms (no data for before).
* RHEL5.4-64: Stayed within 300us (before change it was 25ms).
"With respect to running of a VM, we have decided that we do not need to
differentiate between SLES & SLED. So we offer only one selection for the two. I
think in the future, the UI will begin to call it 'SLE' in most cases."
This was a toughie. The problem here is that everyone calls Log(), Warning(), and the like while holding their own locks, yet LogWriteLogFile() calls a great deal of code itself while processing those calls. Some of this code is high-level and either already takes its own lock or is scheduled to get locking.
We considered several radical solutions, but none of them seemed satisfactory. We could have LogWriteLogFile() simply dump messages on a leaf-lock-protected queue and return, but then we'd have to create a lazy-writer logging thread. We could have LogWriteLogFile() not do complicated stuff like log file rotation itself, but schedule that for later, but again we'd have to invent a lazy mechanism (either a thread or callbacks provided by the log module initializer). And so on.
I settled on a practical solution: coming up with criteria for code that can be called underneath the log lock, and then moving around code in log.c to make it so. The criteria, for now, are quite simple - no code that LogWriteLogFile() calls under the log lock may take its own lock in turn. Basically this means stick with lib/misc and lib/file.
Remove all usage of the VThreadID data type from MXUser. This
includes calling VThread_CurID. This prevents a host of chicken
before the egg problems that are wrapped around vthreadBase.c.
In order to do this two APIs had to change:
1) The per thread contention statistics had to be removed.
This is a loss since there are no tools that were interested
in the data.
2) MXUser_AnyLocksHeld
Changed so a VThreadID wasn't coming in. Trivial. It's
MXUser_IsCurThreadHoldingLocks now.
The check across everything thread case isn't necessary.
Change how topology is changed with the new vmwgfx X driver
Multimon has always been a bit tricky to get to stick when running
a gnome-session since after we turned on multimon gnome would turn the
new output off.
This along with changes to the kernel driver and X driver fixes this.
So now the driver exports the vmware ctrl protocol and RandR1.2 and
expects vmware-user to first the set the topology via the vmware ctrl
and then setup the correct layout via RandR1.2. This is closer to what
the old path did but instead of just setting a single mode that covers
the whole topology it setups the layout as well.
The changes to the kernel driver and X driver will follow.
VMware, Inc [Thu, 17 Jun 2010 22:39:59 +0000 (15:39 -0700)]
Wiper: recognize HFS partitions, also FAT partitions mounted as 'msdos'
A user on the forums was asking about shrinking disks in Mac OS guests.
The command "vmware-tools-cli disk shrink /" currently shows an error:
"Partition / is not shrinkable".
This is because the wiper library does not recognize the mounted HFS
partitions as wipeable. This change recognizes the "hfs" type as a new
PARTITION_HFS value to support shrinking HFS partitions. It also maps
the "msdos" mount type to PARTITION_FAT to support shrinking FAT/FAT32
partitions on Mac OS guests.
VMware, Inc [Thu, 17 Jun 2010 22:33:41 +0000 (15:33 -0700)]
lib/file: make file locking a bit more efficient
When locking a symbolic link the lock file should go "next" to
the symbolic link, not where the link points to. The old code
for dealing with this is overkill; performing unnecessary operations
to get the job done; improve this.
VMware, Inc [Thu, 17 Jun 2010 22:33:12 +0000 (15:33 -0700)]
Remove VIX_COMMAND_[GET|SET|]_PROPERTY.
They are unused. The Tools does process GET_PROPERTY like
GET_TOOLS_STATE, but I couldn't find or remember a version of the
client library that sent a command with this op code for this
purpose.
Also, as a side benefit, remove the flag
VIX_COMMAND_GUEST_RETURNS_ENCODED_STRING, since no request message
sets this flag, and it is a left over remenant from the incorrect
assumption that GuestRPC couldn't handle binary data. This gives
an additional benefit since inspection suggests that there's a bug
in the VMX code for processing responses when this flag is set:
the response length is computed using the encoded string, not
the decoded string (causing random VMX memory to be sent in the
response).
Marcelo Vanzin [Thu, 17 Jun 2010 22:28:29 +0000 (15:28 -0700)]
Remove epoll.c and setnice.c compat autoconf modules
Now that the code does not use compat_set_user_nice() and
compat pollwait ocde we can clean up our makefiles and remove
epoll.c and setnice.c autoconf modules.
VMware, Inc [Thu, 17 Jun 2010 22:20:10 +0000 (15:20 -0700)]
Remove Hostinfo_RawSystemTimerXX interfaces
The RawSystemTimerXX interfaces used to be needed because the
SystemTimerXX interfaces could become reentrant and deadlock.
Since that time, we have changed SystemTimerXX implementations
(no deadlock) and no longer worry about the cost of the lock
(now host-native). So just always use SystemTimerXX.
VMware, Inc [Thu, 17 Jun 2010 22:17:31 +0000 (15:17 -0700)]
Reshuffle Hostinfo_SystemTimerNS
Core observation: the fallback is always gettimeofday(), but
each Posix-y OS has a (possible) monotonic timer.
So, restructure the code so we optionally try OS-specific
timers (which the optimizer can prune out cheaply) then fall
back to the slower microsecond timer.
With two OS-specific timers already present (Visor and Apple),
I'll do the work of adding the third (Posix's clock_gettime).
Note that I use a weak symbol trick to avoid either librt or
libdl dependencies; an app that links librt will get
ns-resolution and everything else falls back to ms-resolution
gettimeofday().
VMware, Inc [Thu, 17 Jun 2010 22:16:18 +0000 (15:16 -0700)]
Linux compat code: do not define KERNEL_VERSION macro
KERNEL_VERSION exists in kernel sources since 2.1.90 so
if we can't find it that means environment is busted and
we better stop instead of defining it ourselves.
VMware, Inc [Thu, 17 Jun 2010 22:14:45 +0000 (15:14 -0700)]
vmmemctl: rework balloon initializtion code
Balloon initialization code is way too complicated for the kernel
driver code. Instead of implementing abstract "init", "cleanup" and
"timer" interfaces on every OS and having call chains like:
OS kernel module init code ->
Common balloon module init ->
OS_Init (os specific initialization code)
Creatie /proc, stats, etc
Balloon_Init (common balloon init code)
OS_TimerStart (start balloon thread)