kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Christian Bornträger" <borntrae@de.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>,
	Carsten Otte <cotte@de.ibm.com>,
	kvm@vger.kernel.org,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [patch 0/4] move irq protection role to separate lock v2
Date: Thu, 21 May 2009 10:26:57 +0300	[thread overview]
Message-ID: <4A150241.8070408@redhat.com> (raw)
In-Reply-To: <200905210855.53470.borntrae@de.ibm.com>

Christian Bornträger wrote:
>> @@ -2053,6 +2054,9 @@ static long kvm_vm_ioctl(struct file *fi
>>
>>  	if (kvm->mm != current->mm)
>>  		return -EIO;
>> +
>> +	mutex_lock(&kvm->vm_ioctl_lock);
>> +
>>  	switch (ioctl) {
>>  	case KVM_CREATE_VCPU:
>>  		r = kvm_vm_ioctl_create_vcpu(kvm, arg);
>> @@ -2228,6 +2232,7 @@ static long kvm_vm_ioctl(struct file *fi
>>  		r = kvm_arch_vm_ioctl(filp, ioctl, arg);
>>  	}
>>  out:
>> +	mutex_unlock(&kvm->vm_ioctl_lock);
>>  	return r;
>>  }
>>     
>
> The thing that looks worrysome is that the s390 version of kvm_arch_vm_ioctl 
> has KVM_S390_INTERRUPT. This allows userspace to inject interrupts - which 
> would be serialized. The thing is, that external interrupts and I/O interrupts 
> are floating - which means they can arrive on all cpus. This is somewhat of a 
> fast path.
> On the other hand, kvm_s390_inject_vm already takes the kvm->lock to protect 
> agains hotplug. With this patch we might be able to remove the kvm->lock in 
> kvm_s390_inject_vm - that would reduce the impact. 
>
> This needs more thinking on our side.
>   

x86 actually shares the same problem.  KVM_IRQ_LINE interrupts may 
arrive at any vcpu.  Furthermore, with irqfd interrupts may be injected 
from userspace (the vm process or other processes) or from the kernel 
(assigned device, kernel virtio-net device).  So we have the same 
motivation to drop this lock and replace it by rcu for the fast paths.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2009-05-21  7:27 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 16:56 [patch 0/4] move irq protection role to separate kvm->irq_lock Marcelo Tosatti
2009-05-18 16:56 ` [patch 1/4] KVM: x86: grab pic lock in kvm_pic_clear_isr_ack Marcelo Tosatti
2009-05-18 16:56 ` [patch 2/4] KVM: move coalesced_mmio locking to its own device Marcelo Tosatti
2009-05-20 12:06   ` Avi Kivity
2009-05-20 14:09     ` Marcelo Tosatti
2009-05-20 14:29       ` Avi Kivity
2009-05-20 15:13         ` Marcelo Tosatti
2009-05-20 15:22           ` Marcelo Tosatti
2009-05-20 15:22           ` Avi Kivity
2009-05-20 18:48         ` [patch 0/4] move irq protection role to separate lock v2 Marcelo Tosatti
2009-05-20 18:48           ` [patch 1/4] KVM: x86: grab pic lock in kvm_pic_clear_isr_ack Marcelo Tosatti
2009-05-20 18:48           ` [patch 2/4] KVM: move coalesced_mmio locking to its own device Marcelo Tosatti
2009-05-24 14:04             ` Avi Kivity
2009-05-25 11:04               ` Marcelo Tosatti
2009-05-26 11:24                 ` Avi Kivity
2009-05-26 13:15                   ` Marcelo Tosatti
2009-05-26 13:27                     ` Avi Kivity
2009-05-20 18:48           ` [patch 3/4] KVM: introduce irq_lock, use it to protect ioapic Marcelo Tosatti
2009-05-24 14:10             ` Avi Kivity
2009-05-25 11:11               ` Marcelo Tosatti
2009-05-26 11:33                 ` Avi Kivity
2009-05-28  4:45               ` [patch 0/4] move irq protection role to separate lock v3 Marcelo Tosatti
2009-05-28  4:45               ` [patch 1/4] KVM: x86: grab pic lock in kvm_pic_clear_isr_ack Marcelo Tosatti
2009-05-28  4:45               ` [patch 2/4] KVM: move coalesced_mmio locking to its own device Marcelo Tosatti
2009-05-31 12:14                 ` Avi Kivity
2009-06-01 21:23                   ` Marcelo Tosatti
2009-06-01 21:43                     ` Avi Kivity
2009-06-04 18:08                   ` [patch 0/4] move irq protection role to separate lock v4 Marcelo Tosatti
2009-06-04 18:08                     ` [patch 1/4] KVM: x86: grab pic lock in kvm_pic_clear_isr_ack Marcelo Tosatti
2009-06-04 18:08                     ` [patch 2/4] KVM: move coalesced_mmio locking to its own device Marcelo Tosatti
2009-06-04 18:08                     ` [patch 3/4] KVM: introduce irq_lock, use it to protect ioapic Marcelo Tosatti
2009-06-04 18:08                     ` [patch 4/4] KVM: switch irq injection/acking data structures to irq_lock Marcelo Tosatti
2009-06-08  9:18                     ` [patch 0/4] move irq protection role to separate lock v4 Avi Kivity
2009-05-28  4:45               ` [patch 3/4] KVM: introduce irq_lock, use it to protect ioapic Marcelo Tosatti
2009-05-28  4:45               ` [patch 4/4] KVM: switch irq injection/acking data structures to irq_lock Marcelo Tosatti
2009-05-20 18:48           ` [patch 4/4] KVM: switch irq injection/acking " Marcelo Tosatti
2009-05-21  4:50           ` [patch 0/4] move irq protection role to separate lock v2 Marcelo Tosatti
2009-05-21  6:55             ` Christian Bornträger
2009-05-21  7:26               ` Avi Kivity [this message]
2009-05-21 14:32                 ` Marcelo Tosatti
2009-05-21 15:02                   ` Avi Kivity
2009-05-18 16:56 ` [patch 3/4] KVM: introduce irq_lock, use it protect ioapic Marcelo Tosatti
2009-05-20 12:11   ` Avi Kivity
2009-05-20 14:11     ` Marcelo Tosatti
2009-05-20 14:29       ` Avi Kivity
2009-05-18 16:56 ` [patch 4/4] KVM: switch irq injection/acking to irq_lock Marcelo Tosatti
2009-05-20 12:15   ` Gregory Haskins
2009-05-20 14:16     ` Marcelo Tosatti
2009-05-24 14:53     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A150241.8070408@redhat.com \
    --to=avi@redhat.com \
    --cc=borntrae@de.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).