]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes to common source files not directly applicable to open-vm-tools.
authorOliver Kurth <okurth@vmware.com>
Wed, 3 Jul 2019 21:26:54 +0000 (14:26 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 3 Jul 2019 21:26:54 +0000 (14:26 -0700)
Reduce malloc/free overheads in the VMX for HGFS over VMCI

open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c
open-vm-tools/lib/include/hgfsServer.h

index 1660831044036584903471e42a7ac3d2d82f0aa8..230a6f9334c7e5a8f78a820d77b9332d36204dce 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2019 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -788,14 +788,10 @@ HSPUMapBuf(HgfsChannelMapVirtAddrFunc mapVa,    // IN: map virtual address funct
         iovIndex < iovCount && remainingSize > 0;
         iovIndex++, mappedIovCount++) {
 
-      iov[iovIndex].context = NULL;
-
       /* Check: Iov in VMCI should never cross page boundary */
       ASSERT(iov[iovIndex].len <= (PAGE_SIZE - PAGE_OFFSET(iov[iovIndex].pa)));
 
-      iov[iovIndex].va = mapVa(iov[iovIndex].pa,
-                               iov[iovIndex].len,
-                               &iov[iovIndex].context);
+      iov[iovIndex].va = mapVa(&iov[iovIndex]);
       if (NULL == iov[iovIndex].va) {
          /* Failed to map the physical address. */
          break;
@@ -842,9 +838,7 @@ HSPUUnmapBuf(HgfsChannelUnmapVirtAddrFunc unmapVa, // IN/OUT: Hgfs Packet
    for (iovIndex = startIndex, endIndex = startIndex + *mappedCount;
         iovIndex < endIndex;
         iovIndex++) {
-      ASSERT(iov[iovIndex].context);
       unmapVa(&iov[iovIndex].context);
-      iov[iovIndex].context = NULL;
       iov[iovIndex].va = NULL;
    }
    *mappedCount = 0;
index d8509c12d55fd650d73374ed652ab0e649e8772e..37bd54d55f64192cbad70b37d556508e31c1cfd4 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2019 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
 #ifndef _HGFS_SERVER_H_
 #define _HGFS_SERVER_H_
 
-#include "hgfs.h"             /* for HGFS_PACKET_MAX */
 #include "dbllnklst.h"
+#include "hgfs.h"             /* for HGFS_PACKET_MAX */
+#include "vm_basic_defs.h"    /* for vmx86_debug */
 
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
+#define HGFS_VMX_IOV_CONTEXT_SIZE (vmx86_debug ? 112 : 96)
 typedef struct HgfsVmxIov {
    void *va;           /* Virtual addr */
    uint64 pa;          /* Physical address passed by the guest */
    uint32 len;         /* length of data; should be <= PAGE_SIZE for VMCI; arbitrary for backdoor */
-   void *context;      /* Mapping context */
+   union {
+      void *ptr;
+      char clientStorage[HGFS_VMX_IOV_CONTEXT_SIZE];
+   } context;         /* Mapping context */
 } HgfsVmxIov;
 
 typedef enum {
@@ -175,8 +180,8 @@ typedef void (*HgfsInvalidateObjectsFunc)(DblLnkLst_Links *shares);
 typedef Bool (*HgfsChannelSendFunc)(void *opaqueSession,
                                     HgfsPacket *packet,
                                     HgfsSendFlags flags);
-typedef void * (*HgfsChannelMapVirtAddrFunc)(uint64 pa, uint32 size, void **context);
-typedef void (*HgfsChannelUnmapVirtAddrFunc)(void **context);
+typedef void * (*HgfsChannelMapVirtAddrFunc)(HgfsVmxIov *iov);
+typedef void (*HgfsChannelUnmapVirtAddrFunc)(void *context);
 typedef void (*HgfsChannelRegisterThreadFunc)(void);
 typedef void (*HgfsChannelUnregisterThreadFunc)(void);