Project

General

Profile

Bug #6166

fix MSI-X support in virtio driver

Added by Andriy Gapon about 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
driver - device drivers
Start date:
2015-08-26
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

  • There is an obvious size mismatch for allocation and deallocation of sc_intr_htable in virtio_register_msi as handler_count and count are not necessarily equal.
  • Rather obviously, there is a missing return statement in virtio_register_msi for the success case. Currently the control flow just proceeds to the error handling code where sc_intr_htable is destroyed.
  • It seems that virtio_enable_msi misses the interrupt teardown code for the case where ddi_intr_enable / ddi_intr_block_enable are successful, but there is a later error.
  • My understanding of the VirtIO specification is that the 24-byte offset for PCI configuration accesses should be used only when MSI-X mode is enabled for a device.
    That is, only when the enable bit is set in the control register of the MSI-X capabilities. But currently the code sets sc_config_offset to VIRTIO_CONFIG_DEVICE_CONFIG_MSI in virtio_register_msi.
    I believe that MSI-X is not actually activated until virtio_enable_msi successfully calls ddi_intr_enable or ddi_intr_block_enable.
  • It seems that there is a little bit of confusion in the code between MSI and MSI-X handling.
    I believe that the 20-byte offset should be used if MSI but not MSI-X happens to be supported (even if otherwise MSI is much more similar to MSI-X than to the legacy interrupts mode).
    At least, the VirtIO specification explicitly talks about the 24-byte offset only for MSI-X mode.

Related issues

Blocks illumos gate - Bug #6341: virtio doesn't try hard enough to get MSI interruptsRejected2015-10-16

Actions
Blocks illumos gate - Bug #6340: virtio lies about falling back to INTx interruptsClosed2015-10-16

Actions

History

#2

Updated by Josef Sipek almost 5 years ago

  • Blocks Bug #6341: virtio doesn't try hard enough to get MSI interrupts added
#3

Updated by Josef Sipek almost 5 years ago

  • Blocks Bug #6340: virtio lies about falling back to INTx interrupts added
#4

Updated by Electric Monk almost 5 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 17ad7f9fd28ceea21aea94421cb8ada963285765

commit  17ad7f9fd28ceea21aea94421cb8ada963285765
Author: Andriy Gapon <avg@FreeBSD.org>
Date:   2015-10-20T04:30:06.000Z

    6166 fix MSI-X support in virtio driver
    Reviewed by: Daniel Kimmel <dan.kimmel@delphix.com>
    Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
    Approved by: Robert Mustacchi <rm@joyent.com>

Also available in: Atom PDF