|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v5 02/11] x86/passthrough: Wrap pt_irq_create_bind() restart block in braces
Enclose the restart/retry block in pt_irq_create_bind() in an explicit
compound statement to prepare for its extraction into a helper function
("x86/passthrough: Extract pt_irq_dpci_setup() from
pt_irq_create_bind()"). Reflow the two comments inside the block that no
longer fit in 80 columns at the increased indentation, and fix an
unbalanced parenthesis in the second one. No functional change.
Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
Changes in v5:
- Fixed two comments to fit 80-columns (and fixed unbalanced-parenthesis
in comment)
- Commit message now names the follow-up patch correctly.
Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
xen/drivers/passthrough/x86/hvm.c | 81 ++++++++++++++++---------------
1 file changed, 42 insertions(+), 39 deletions(-)
diff --git a/xen/drivers/passthrough/x86/hvm.c
b/xen/drivers/passthrough/x86/hvm.c
index b73bb55055..1d5b1fb0f8 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -229,52 +229,55 @@ int pt_irq_create_bind(
return -EINVAL;
restart:
- write_lock(&d->event_lock);
-
- hvm_irq_dpci = domain_get_irq_dpci(d);
- if ( !hvm_irq_dpci && !is_hardware_domain(d) )
{
- unsigned int i;
+ write_lock(&d->event_lock);
- /*
- * NB: the hardware domain doesn't use a hvm_irq_dpci struct because
- * it's only allowed to identity map GSIs, and so the data contained in
- * that struct (used to map guest GSIs into machine GSIs and perform
- * interrupt routing) is completely useless to it.
- */
- hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
- if ( hvm_irq_dpci == NULL )
+ hvm_irq_dpci = domain_get_irq_dpci(d);
+ if ( !hvm_irq_dpci && !is_hardware_domain(d) )
+ {
+ unsigned int i;
+
+ /*
+ * NB: the hardware domain doesn't use a hvm_irq_dpci struct
+ * because it's only allowed to identity map GSIs, and so the
+ * data contained in that struct (used to map guest GSIs into
+ * machine GSIs and perform interrupt routing) is completely
+ * useless to it.
+ */
+ hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
+ if ( hvm_irq_dpci == NULL )
+ {
+ write_unlock(&d->event_lock);
+ return -ENOMEM;
+ }
+ for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
+ INIT_LIST_HEAD(&hvm_irq_dpci->girq[i]);
+
+ hvm_domain_irq(d)->dpci = hvm_irq_dpci;
+ }
+
+ info = pirq_get_info(d, pirq);
+ if ( !info )
{
write_unlock(&d->event_lock);
return -ENOMEM;
}
- for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
- INIT_LIST_HEAD(&hvm_irq_dpci->girq[i]);
-
- hvm_domain_irq(d)->dpci = hvm_irq_dpci;
- }
-
- info = pirq_get_info(d, pirq);
- if ( !info )
- {
- write_unlock(&d->event_lock);
- return -ENOMEM;
- }
- pirq_dpci = pirq_dpci(info);
+ pirq_dpci = pirq_dpci(info);
- /*
- * A crude 'while' loop with us dropping the spinlock and giving
- * the softirq_dpci a chance to run.
- * We MUST check for this condition as the softirq could be scheduled
- * and hasn't run yet. Note that this code replaced tasklet_kill which
- * would have spun forever and would do the same thing (wait to flush out
- * outstanding hvm_dirq_assist calls.
- */
- if ( pt_pirq_softirq_active(pirq_dpci) )
- {
- write_unlock(&d->event_lock);
- cpu_relax();
- goto restart;
+ /*
+ * A crude 'while' loop with us dropping the spinlock and giving
+ * the softirq_dpci a chance to run.
+ * We MUST check for this condition as the softirq could be scheduled
+ * and hasn't run yet. Note that this code replaced tasklet_kill
+ * which would have spun forever and would do the same thing (wait
+ * to flush out outstanding hvm_dirq_assist calls).
+ */
+ if ( pt_pirq_softirq_active(pirq_dpci) )
+ {
+ write_unlock(&d->event_lock);
+ cpu_relax();
+ goto restart;
+ }
}
switch ( pt_irq_bind->irq_type )
--
2.53.0
--
Julian Vetter | Vates Hypervisor & Kernel Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |