VirtualBox

Changeset 82559 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Dec 12, 2019 6:55:29 AM (5 years ago)
Author:
vboxsync
Message:

Storage/DevVirtioSCSI.cpp: Enabled R0, increased req queue count to 4 for potential performance increased, cleaned up some comments and logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp

    r82183 r82559  
    8080#define VIRTIOSCSI_HOST_SCSI_FEATURES_OFFERED       VIRTIOSCSI_HOST_SCSI_FEATURES_NONE
    8181
    82 #define VIRTIOSCSI_REQ_QUEUE_CNT                    1           /**< T.B.D. Consider increasing                      */
     82#define VIRTIOSCSI_REQ_QUEUE_CNT                    4           /**< T.B.D. Consider increasing                      */
    8383#define VIRTIOSCSI_QUEUE_CNT                        (VIRTIOSCSI_REQ_QUEUE_CNT + 2)
    8484#define VIRTIOSCSI_MAX_TARGETS                      256         /**< T.B.D. Figure out a a good value for this.      */
     
    109109#define VIRTQ_REQ_BASE                              2           /**< Spec-defined base index of request queues       */
    110110
    111 #define VIRTQNAME(qIdx) (pThis->aszVIRTQNAMEs[qIdx])            /**< Macro to get queue name from its index          */
     111#define VIRTQNAME(qIdx) (pThis->aszVirtqNames[qIdx])            /**< Macro to get queue name from its index          */
    112112#define CBVIRTQNAME(qIdx) RTStrNLen(VIRTQNAME(qIdx), sizeof(VIRTQNAME(qIdx)))
    113113
     
    126126/**
    127127 * VirtIO SCSI Host Device device-specific configuration (see VirtIO 1.0, section 5.6.4)
    128  * VBox VirtIO framework issues callback to this client (device) to handle MMIO accesses
    129  * to the device-specific configuration parameters. uNumQueues is constant, readonly,
    130  * but maintained in this struct due to the design of local MMIO and logging handling.
    131  * The named constant will be used instead to wherever feasible.
     128 * VBox VirtIO core issues callback to this VirtIO device-specific implementation to handle
     129 * MMIO accesses to device-specific configuration parameters.
    132130 */
    133131typedef struct virtio_scsi_config
     
    160158{
    161159    // Device-writable part
    162     uint32_t uEvent;                                            /**< event:                                          */
     160    uint32_t uEvent;                                            /**< event                                          */
    163161    uint8_t  abVirtioLun[8];                                    /**< lun                                             */
    164162    uint32_t uReason;                                           /**< reason                                          */
     
    427425
    428426    /** Device-specific spec-based VirtIO VIRTQNAMEs */
    429     char                            aszVIRTQNAMEs[VIRTIOSCSI_QUEUE_CNT][VIRTIO_MAX_QUEUE_NAME_SIZE];
     427    char                            aszVirtqNames[VIRTIOSCSI_QUEUE_CNT][VIRTIO_MAX_QUEUE_NAME_SIZE];
    430428
    431429    /** Track which VirtIO queues we've attached to */
     
    554552typedef struct VIRTIOSCSIREQ
    555553{
    556     struct VIRTIOSCSIREQ           *next;                       /**< When linked into redo queue                       */
    557554    PDMMEDIAEXIOREQ                hIoReq;                      /**< Handle of I/O request                             */
    558555    PVIRTIOSCSITARGET              pTarget;                     /**< Target                                            */
     
    577574DECLINLINE(void) virtioScsiSetVirtqNames(PVIRTIOSCSI pThis)
    578575{
    579     RTStrCopy(pThis->aszVIRTQNAMEs[CONTROLQ_IDX], VIRTIO_MAX_QUEUE_NAME_SIZE, "controlq");
    580     RTStrCopy(pThis->aszVIRTQNAMEs[EVENTQ_IDX],   VIRTIO_MAX_QUEUE_NAME_SIZE, "eventq");
     576    RTStrCopy(pThis->aszVirtqNames[CONTROLQ_IDX], VIRTIO_MAX_QUEUE_NAME_SIZE, "controlq");
     577    RTStrCopy(pThis->aszVirtqNames[EVENTQ_IDX],   VIRTIO_MAX_QUEUE_NAME_SIZE, "eventq");
    581578    for (uint16_t qIdx = VIRTQ_REQ_BASE; qIdx < VIRTQ_REQ_BASE + VIRTIOSCSI_REQ_QUEUE_CNT; qIdx++)
    582         RTStrPrintf(pThis->aszVIRTQNAMEs[qIdx], VIRTIO_MAX_QUEUE_NAME_SIZE,
     579        RTStrPrintf(pThis->aszVirtqNames[qIdx], VIRTIO_MAX_QUEUE_NAME_SIZE,
    583580                    "requestq<%d>", qIdx - VIRTQ_REQ_BASE);
    584581}
     
    10451042    RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); /* needed? */
    10461043
    1047     Log2Func((".... Copied %lu bytes from %lu byte guest buffer, residual=%lu\n",
     1044    Log3Func((".... Copied %lu bytes from %lu byte guest buffer, residual=%lu\n",
    10481045         cbCopy, pReq->pDescChain->cbPhysReturn, pReq->pDescChain->cbPhysReturn - cbCopy));
    10491046
     
    11321129        /* Force rejection. todo: figure out right way to handle. Note this is a very
    11331130         * vague and confusing part of the VirtIO spec which deviates from the SCSI standard
    1134          * as Klaus has pointed out on numerous occasions. I have not been able to determine
    1135          * how to implement this properly. Nor do I see any of the guest drivers at this
    1136          * point making use of it, hence the loud log message so we can catch it if/when a guest
    1137          * does access it and can resume the investigation at that point.  r=paul */
     1131         * I have not been able to determine how to implement this properly.  Guest drivers
     1132         * whose source code has been checked, so far, don't seem to use it. If it starts
     1133         * showing up in the logs can try to work */
    11381134        uScsiLun = 0xff;
    11391135    }
     
    11601156     * Handle submission errors
    11611157     */
    1162 
    11631158    if (RT_LIKELY(!fBadLUNFormat))
    11641159    { /*  likely */ }
     
    15811576                  PVIRTIO_DESC_CHAIN_T pDescChain;
    15821577                  int rc = virtioCoreR3DescChainGet(pDevIns, &pThis->Virtio, qIdx,
    1583                                                 pWorkerR3->auRedoDescs[i], &pDescChain);
     1578                                                    pWorkerR3->auRedoDescs[i], &pDescChain);
    15841579                  if (RT_FAILURE(rc))
    15851580                     LogRel(("Error fetching desc chain to redo, %Rrc", rc));
     
    23552350    PVIRTIOSCSICC       pThisCC   = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIOSCSICC);
    23562351
    2357 #if 0 /* need more info about how to use this event */
     2352#if 0 /* need more info about how to use this event. The VirtIO 1.0 specification
     2353       * lists several SCSI related event types but presumes the reader knows
     2354       * how to use them without providing references. */
    23582355    virtioScsiR3ReportMediaChange(pDevIns, pThis, pTarget->uTarget);
    23592356#endif
     
    26622659    /* .uReserved0 = */             0,
    26632660    /* .szName = */                 "virtio-scsi",
    2664     /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS /** @todo | PDM_DEVREG_FLAGS_RZ */ | PDM_DEVREG_FLAGS_NEW_STYLE
     2661    /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE
    26652662                                    | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION
    26662663                                    | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION,
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