Skip to content

Commit

Permalink
Revert "irqbypass: do not start cons/prod when failed connect"
Browse files Browse the repository at this point in the history
This reverts commit a979a6a.

The reverted commit may cause VM freeze on arm64 with GICv4,
where stopping a consumer is implemented by suspending the VM.
Should the connect fail, the VM will not be resumed, which
is a bit of a problem.

It also erroneously calls the producer destructor unconditionally,
which is unexpected.

Reported-by: Shaokun Zhang <[email protected]>
Suggested-by: Marc Zyngier <[email protected]>
Acked-by: Jason Wang <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Tested-by: Shaokun Zhang <[email protected]>
Signed-off-by: Zhu Lingshan <[email protected]>
[maz: tags and cc-stable, commit message update]
Signed-off-by: Marc Zyngier <[email protected]>
Fixes: a979a6a ("irqbypass: do not start cons/prod when failed connect")
Link: https://lore.kernel.org/r/[email protected]
Link: https://lore.kernel.org/r/[email protected]
Cc: [email protected]
  • Loading branch information
ls-zhu authored and Marc Zyngier committed May 15, 2021
1 parent 6efb943 commit e44b49f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions virt/lib/irqbypass.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,17 @@ static int __connect(struct irq_bypass_producer *prod,
if (prod->add_consumer)
ret = prod->add_consumer(prod, cons);

if (ret)
goto err_add_consumer;

ret = cons->add_producer(cons, prod);
if (ret)
goto err_add_producer;
if (!ret) {
ret = cons->add_producer(cons, prod);
if (ret && prod->del_consumer)
prod->del_consumer(prod, cons);
}

if (cons->start)
cons->start(cons);
if (prod->start)
prod->start(prod);
err_add_producer:
if (prod->del_consumer)
prod->del_consumer(prod, cons);
err_add_consumer:

return ret;
}

Expand Down

0 comments on commit e44b49f

Please sign in to comment.