[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 1/2] x86/vpt: execute callbacks for masked interrupts
Execute periodic_time callbacks even if the interrupt is not actually injected because the IRQ is masked. Current callbacks from emulated timer devices only update emulated registers, which from my reading of the specs should happen regardless of whether the interrupt has been injected or not. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: Stefan Bader <stefan.bader@xxxxxxxxxxxxx> --- Changes since v1: - s/purged/to_purge/. - Force caller of execute_callbacks to hold the lock. --- xen/arch/x86/hvm/vpt.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 9d27b483b2..e6c2aa01ac 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -247,9 +247,29 @@ static void pt_timer_fn(void *data) pt_unlock(pt); } +static void execute_callbacks(struct vcpu *v, struct list_head *tm) +{ + while ( !list_empty(tm) ) + { + struct periodic_time *pt = list_first_entry(tm, struct periodic_time, + list); + time_cb *cb = pt->cb; + void *cb_priv = pt->priv; + + list_del(&pt->list); + pt->on_list = 0; + spin_unlock(&v->arch.hvm_vcpu.tm_lock); + + cb(v, cb_priv); + + spin_lock(&v->arch.hvm_vcpu.tm_lock); + } +} + int pt_update_irq(struct vcpu *v) { struct list_head *head = &v->arch.hvm_vcpu.tm_list; + LIST_HEAD(to_purge); struct periodic_time *pt, *temp, *earliest_pt; uint64_t max_lag; int irq, is_lapic, pt_vector; @@ -267,7 +287,10 @@ int pt_update_irq(struct vcpu *v) { /* suspend timer emulation */ list_del(&pt->list); - pt->on_list = 0; + if ( pt->cb ) + list_add(&pt->list, &to_purge); + else + pt->on_list = 0; } else { @@ -282,6 +305,12 @@ int pt_update_irq(struct vcpu *v) if ( earliest_pt == NULL ) { + /* + * NB: although the to_purge list is local, calls to + * destroy_periodic_time can still remove items from the list, hence + * the need to hold the lock while accessing it. + */ + execute_callbacks(v, &to_purge); spin_unlock(&v->arch.hvm_vcpu.tm_lock); return -1; } @@ -290,6 +319,8 @@ int pt_update_irq(struct vcpu *v) irq = earliest_pt->irq; is_lapic = (earliest_pt->source == PTSRC_lapic); + execute_callbacks(v, &to_purge); + spin_unlock(&v->arch.hvm_vcpu.tm_lock); /* -- 2.16.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |