HV: improve pass-thru device interrupt process

for each pass-thru device and its entry owned by one VM, so
change the pass-thru device's softirq lock & entry list into
per VM, so one VM's PT device interrupt process will not
interfere with other VMs; especially in case one user OS
"interrupt storm" happens, it will have little effect on
service OS.

Tracked-On: #866
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Minggui Cao
2018-09-05 14:07:09 +08:00
committed by lijinxia
parent b4e03f2d68
commit 99285f844a
5 changed files with 30 additions and 28 deletions

View File

@@ -394,26 +394,27 @@ static void ptdev_intr_handle_irq(struct vm *vm,
}
}
void ptdev_softirq(__unused uint16_t cpu_id)
void ptdev_softirq(uint16_t pcpu_id)
{
struct vcpu *vcpu = (struct vcpu *)per_cpu(vcpu, pcpu_id);
struct vm *vm = vcpu->vm;
while (1) {
struct ptdev_remapping_info *entry = ptdev_dequeue_softirq();
struct ptdev_msi_info *msi = &entry->msi;
struct vm *vm;
struct ptdev_remapping_info *entry = ptdev_dequeue_softirq(vm);
struct ptdev_msi_info *msi;
if (entry == NULL) {
break;
}
msi = &entry->msi;
/* skip any inactive entry */
if (!is_entry_active(entry)) {
/* service next item */
continue;
}
/* TBD: need valid vm */
vm = entry->vm;
/* handle real request */
if (entry->intr_type == PTDEV_INTR_INTX) {
ptdev_intr_handle_irq(vm, entry);

View File

@@ -185,6 +185,9 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm)
list_add(&vm->list, &vm_list);
spinlock_release(&vm_list_lock);
INIT_LIST_HEAD(&vm->softirq_dev_entry_list);
spinlock_init(&vm->softirq_dev_lock);
/* Set up IO bit-mask such that VM exit occurs on
* selected IO ranges
*/