Index: trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
===================================================================
--- trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp	(revision 80528)
+++ trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp	(revision 80571)
@@ -196,5 +196,4 @@
     pDescChain->cSegsIn = pDescChain->cSegsOut = 0;
 
-
     pDescChain->uHeadIdx = virtioReadAvailDescIdx(pVirtio, qIdx, pVirtqProxy->uAvailIdx);
     uint16_t uDescIdx = pDescChain->uHeadIdx;
@@ -206,4 +205,5 @@
         pVirtqProxy->uAvailIdx++;
 
+    uint32_t cbIn = 0, cbOut = 0;
     VIRTQ_DESC_T desc;
     do
@@ -212,5 +212,5 @@
 
         /**
-        * Malicious or inept guests may go beyond aSegsIn or aSegsOut boundaries by linking
+        * Malicious guests may go beyond aSegsIn or aSegsOut boundaries by linking
         * several descriptors into a loop. Since there is no legitimate way to get a sequences of
         * linked descriptors exceeding the total number of descriptors in the ring (see @bugref{8620}),
@@ -240,5 +240,5 @@
             Log3Func(("%s IN  desc_idx=%u seg=%u addr=%RGp cb=%u\n",
                 QUEUENAME(qIdx), uDescIdx, pDescChain->cSegsIn, desc.pGcPhysBuf, desc.cb));
-
+            cbIn += desc.cb;
             pSeg = &(pDescChain->aSegsIn[pDescChain->cSegsIn++]);
         }
@@ -247,4 +247,5 @@
             Log3Func(("%s OUT desc_idx=%u seg=%u addr=%RGp cb=%u\n",
                 QUEUENAME(qIdx), uDescIdx, pDescChain->cSegsOut, desc.pGcPhysBuf, desc.cb));
+            cbOut += desc.cb;
             pSeg = &(pDescChain->aSegsOut[pDescChain->cSegsOut++]);
         }
@@ -256,14 +257,15 @@
     } while (desc.fFlags & VIRTQ_DESC_F_NEXT);
 
-    RTSgBufInit(&pVirtqProxy->inSgBuf, (PCRTSGSEG)&pDescChain->aSegsIn,  pDescChain->cSegsIn);
-    RTSgBufInit(&pVirtqProxy->outSgBuf,(PCRTSGSEG)&pDescChain->aSegsOut, pDescChain->cSegsOut);
+    RTSgBufInit(&pVirtqProxy->inSgBuf,  (PCRTSGSEG)&pDescChain->aSegsIn,  pDescChain->cSegsIn);
+    RTSgBufInit(&pVirtqProxy->outSgBuf, (PCRTSGSEG)&pDescChain->aSegsOut, pDescChain->cSegsOut);
 
     if (ppInSegs)
         *ppInSegs  = &pVirtqProxy->inSgBuf;
+
     if (ppOutSegs)
         *ppOutSegs = &pVirtqProxy->outSgBuf;
 
-    Log3Func(("%s -- segs out: %u,  segs in: %u --\n",
-              pVirtqProxy->szVirtqName, pDescChain->cSegsOut, pDescChain->cSegsIn));
+    Log3Func(("%s -- segs OUT: %u (%u bytes)   IN: %u (%u bytes) --\n",
+              pVirtqProxy->szVirtqName, pDescChain->cSegsOut, cbOut, pDescChain->cSegsIn, cbIn));
 
     return VINF_SUCCESS;
@@ -289,5 +291,5 @@
 
     size_t cbRemain = RTSgBufCalcTotalLength(pBufSrc);
-    uint16_t uUsedIdx  = virtioReadUsedRingIdx(pVirtio, qIdx);
+    uint16_t uUsedIdx = virtioReadUsedRingIdx(pVirtio, qIdx);
     Log3Func(("Copying client data to %s, desc chain (head desc_idx %d)\n",
                QUEUENAME(qIdx), uUsedIdx));
@@ -309,9 +311,4 @@
         RT_UNTRUSTED_NONVOLATILE_COPY_FENCE();
 
-    /** TBD to avoid wasting cycles how do we wrap this in test for Log2* enabled? */
-    size_t   cbInSgBuf = RTSgBufCalcTotalLength(pBufDst);
-    size_t   cbWritten = cbInSgBuf  - RTSgBufCalcLengthLeft(pBufDst);
-
-
     /** If this write-ahead crosses threshold where the driver wants to get an event flag it */
     if (pVirtio->uDriverFeatures & VIRTIO_F_EVENT_IDX)
@@ -326,6 +323,15 @@
                         pDescChain->uHeadIdx,
                         pDescChain->cSegsIn);
-    Log3Func(("Copied %u bytes to %u byte buffer\n                Write ahead used_idx=%d, %s used_idx=%d\n",
-             cbWritten, cbInSgBuf, pVirtqProxy->uUsedIdx,  QUEUENAME(qIdx), uUsedIdx));
+
+    if (LogIs2Enabled())
+    {
+        size_t cbInSgBuf = RTSgBufCalcTotalLength(pBufDst);
+        size_t cbWritten = cbInSgBuf - RTSgBufCalcLengthLeft(pBufDst);
+        Log2Func(("Copied %u bytes to %u byte buffer, residual=%d\n",
+             cbWritten, cbInSgBuf, cbInSgBuf - cbWritten));
+    }
+    Log3Func(("Write ahead used_idx=%d, %s used_idx=%d\n",
+         pVirtqProxy->uUsedIdx,  QUEUENAME(qIdx), uUsedIdx));
+
     return VINF_SUCCESS;
 }
