Am Wednesday 06 May 2009 14:10:07 schrieb Avi Kivity:
> [email protected] wrote:
> > From: Christian Borntraeger <[email protected]>
> >
> > This patch reworks the s390 clock comparator wakeup to hrtimer. The clock
> > comparator is a per-cpu value that is compared against the TOD clock. If
> > ckc <= TOD an external interrupt 1004 is triggered. Since the clock 
> > comparator
> > and the TOD clock have a much higher resolution than jiffies we should use
> > hrtimers to trigger the wakeup. This speeds up guest nanosleep for small
> > values.
> >
> > Since hrtimers callbacks run in hard-irq context, I added a tasklet to do
> > the actual work with enabled interrupts. 
> >
> >  
> > -void kvm_s390_idle_wakeup(unsigned long data)
> > +void kvm_s390_tasklet(unsigned long parm)
> >  {
> > -   struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
> > +   struct kvm_vcpu *vcpu = (struct kvm_vcpu *) parm;
> >  
> > -   spin_lock_bh(&vcpu->arch.local_int.lock);
> > +   spin_lock(&vcpu->arch.local_int.lock);
> >     vcpu->arch.local_int.timer_due = 1;
> >     if (waitqueue_active(&vcpu->arch.local_int.wq))
> >             wake_up_interruptible(&vcpu->arch.local_int.wq);
> > -   spin_unlock_bh(&vcpu->arch.local_int.lock);
> > +   spin_unlock(&vcpu->arch.local_int.lock);
> >  }
> >   
> 
> Why can't this be done from the timer context (after adjusting the locks)?

It can be done, in fact I did that in my first version. The thing is, we would 
need to change all local_int.locks to spinlock_irqs, since standard timers are 
softirqs and hrtimers and hardirqs. Enabling and disabling irqs is a relatively 
expensive operating on s390 (but locks via compare and swap are quite cheap). 
Since we take this specific lock in lots of places this lock is on some hot 
pathes. The idle wakeup on the other hand is not that critical.

Christian
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to