diff mbox

[GIT,PULL] KVM fixes for 3.5-rc6

Message ID alpine.LFD.2.02.1207141253490.32033@ionos (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Gleixner July 14, 2012, 11:16 a.m. UTC
On Sat, 14 Jul 2012, Jan Kiszka wrote:
> On 2012-07-14 04:25, Thomas Gleixner wrote:
> This patch here is a workaround to unbreak devices assignment in 3.5
> after the IRQ layer changes without regressing noticeable /wrt overhead.

Yeah, workaround and regression are the proper marketing buzzwords to
excuse mindless hackery.

It took me a minute to figure out that there is no reason at all to
use a threaded interrupt handler for MSI and MSIX.

If you folks are so concerned about performance and overhead then
someone familiar with that code should have done the obvious change
long before the oneshot modifications took place.

I can't be bothered to do a performance test myself, but I bet it's
making an order of magnitude more of a difference than the "oh so
noticeable" few cycles in irq_finalize_oneshot().

Thanks,

	tglx







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

Comments

Jan Kiszka July 14, 2012, 11:23 a.m. UTC | #1
On 2012-07-14 13:16, Thomas Gleixner wrote:
> On Sat, 14 Jul 2012, Jan Kiszka wrote:
>> On 2012-07-14 04:25, Thomas Gleixner wrote:
>> This patch here is a workaround to unbreak devices assignment in 3.5
>> after the IRQ layer changes without regressing noticeable /wrt overhead.
> 
> Yeah, workaround and regression are the proper marketing buzzwords to
> excuse mindless hackery.
> 
> It took me a minute to figure out that there is no reason at all to
> use a threaded interrupt handler for MSI and MSIX.

Thomas, we also explained to you in the cited thread that your simple
approach for this doesn't work as is. We will have a proper solution
soon, but it takes a bit more than a minute - at least us.

Jan
Thomas Gleixner July 14, 2012, 12:33 p.m. UTC | #2
On Sat, 14 Jul 2012, Jan Kiszka wrote:
> On 2012-07-14 13:16, Thomas Gleixner wrote:
> > On Sat, 14 Jul 2012, Jan Kiszka wrote:
> >> On 2012-07-14 04:25, Thomas Gleixner wrote:
> >> This patch here is a workaround to unbreak devices assignment in 3.5
> >> after the IRQ layer changes without regressing noticeable /wrt overhead.
> > 
> > Yeah, workaround and regression are the proper marketing buzzwords to
> > excuse mindless hackery.
> > 
> > It took me a minute to figure out that there is no reason at all to
> > use a threaded interrupt handler for MSI and MSIX.
> 
> Thomas, we also explained to you in the cited thread that your simple
> approach for this doesn't work as is. We will have a proper solution
> soon, but it takes a bit more than a minute - at least us.

And I explained to you in that very thread that the proper solution to
avoid the "overhead" of finalize_oneshot is exaclty the patch I sent
to Linus yesterday:

> The only way we can avoid that, is that we get a hint from the
> underlying irq chip/ handler setup with an extra flag to tell the
> core, that it's safe to avoid the ONESHOT/finalize magic.

So now it took a full month of ignorance to come up with the
mindboggling solution of working around the core change with a private
hack instead of sitting down and doing what was said to be the correct
solution.

And that's what seriously annoys me. Instead of doing it yourself or
at least politely poking me to get it done, stuff just gets hacked
into submission and sold as the "performance regression" saviour.

Of course you are free to ignore my advice, but that does not mean
that I take bullshit from you.

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kiszka July 14, 2012, 12:55 p.m. UTC | #3
On 2012-07-14 14:33, Thomas Gleixner wrote:
> On Sat, 14 Jul 2012, Jan Kiszka wrote:
>> On 2012-07-14 13:16, Thomas Gleixner wrote:
>>> On Sat, 14 Jul 2012, Jan Kiszka wrote:
>>>> On 2012-07-14 04:25, Thomas Gleixner wrote:
>>>> This patch here is a workaround to unbreak devices assignment in 3.5
>>>> after the IRQ layer changes without regressing noticeable /wrt overhead.
>>>
>>> Yeah, workaround and regression are the proper marketing buzzwords to
>>> excuse mindless hackery.
>>>
>>> It took me a minute to figure out that there is no reason at all to
>>> use a threaded interrupt handler for MSI and MSIX.
>>
>> Thomas, we also explained to you in the cited thread that your simple
>> approach for this doesn't work as is. We will have a proper solution
>> soon, but it takes a bit more than a minute - at least us.
> 
> And I explained to you in that very thread that the proper solution to
> avoid the "overhead" of finalize_oneshot is exaclty the patch I sent
> to Linus yesterday:
> 
>> The only way we can avoid that, is that we get a hint from the
>> underlying irq chip/ handler setup with an extra flag to tell the
>> core, that it's safe to avoid the ONESHOT/finalize magic.
> 
> So now it took a full month of ignorance to come up with the
> mindboggling solution of working around the core change with a private
> hack instead of sitting down and doing what was said to be the correct
> solution.

We sat down and tried to avoid the core problem of our use case: IRQ
threading. That we now have to fall back to something else is
unfortunate and was surely not planned.

However, if you push your patch for 3.5, I'm sure Avi will happily drop
the disliked workaround and replace it with ordinary IRQF_ONESHOT tagging.

Jan
Avi Kivity July 16, 2012, 11:36 a.m. UTC | #4
On 07/14/2012 03:55 PM, Jan Kiszka wrote:

>>> The only way we can avoid that, is that we get a hint from the
>>> underlying irq chip/ handler setup with an extra flag to tell the
>>> core, that it's safe to avoid the ONESHOT/finalize magic.
>> 
>> So now it took a full month of ignorance to come up with the
>> mindboggling solution of working around the core change with a private
>> hack instead of sitting down and doing what was said to be the correct
>> solution.
> 
> We sat down and tried to avoid the core problem of our use case: IRQ
> threading. That we now have to fall back to something else is
> unfortunate and was surely not planned.
> 
> However, if you push your patch for 3.5, I'm sure Avi will happily drop
> the disliked workaround and replace it with ordinary IRQF_ONESHOT tagging.

Fine by me, of course, but is mucking around in the irq layer something
we want to do in -rc7?
diff mbox

Patch

Index: linux-2.6/virt/kvm/assigned-dev.c
===================================================================
--- linux-2.6.orig/virt/kvm/assigned-dev.c
+++ linux-2.6/virt/kvm/assigned-dev.c
@@ -105,7 +105,7 @@  static irqreturn_t kvm_assigned_dev_thre
 }
 
 #ifdef __KVM_HAVE_MSI
-static irqreturn_t kvm_assigned_dev_thread_msi(int irq, void *dev_id)
+static irqreturn_t kvm_assigned_dev_msi_handler(int irq, void *dev_id)
 {
 	struct kvm_assigned_dev_kernel *assigned_dev = dev_id;
 
@@ -117,7 +117,7 @@  static irqreturn_t kvm_assigned_dev_thre
 #endif
 
 #ifdef __KVM_HAVE_MSIX
-static irqreturn_t kvm_assigned_dev_thread_msix(int irq, void *dev_id)
+static irqreturn_t kvm_assigned_dev_msix_handler(int irq, void *dev_id)
 {
 	struct kvm_assigned_dev_kernel *assigned_dev = dev_id;
 	int index = find_index_from_host_irq(assigned_dev, irq);
@@ -334,11 +334,6 @@  static int assigned_device_enable_host_i
 }
 
 #ifdef __KVM_HAVE_MSI
-static irqreturn_t kvm_assigned_dev_msi(int irq, void *dev_id)
-{
-	return IRQ_WAKE_THREAD;
-}
-
 static int assigned_device_enable_host_msi(struct kvm *kvm,
 					   struct kvm_assigned_dev_kernel *dev)
 {
@@ -351,9 +346,8 @@  static int assigned_device_enable_host_m
 	}
 
 	dev->host_irq = dev->dev->irq;
-	if (request_threaded_irq(dev->host_irq, kvm_assigned_dev_msi,
-				 kvm_assigned_dev_thread_msi, 0,
-				 dev->irq_name, dev)) {
+	if (request_irq(dev->host_irq, kvm_assigned_dev_msi_handler, 0,
+			dev->irq_name, dev)) {
 		pci_disable_msi(dev->dev);
 		return -EIO;
 	}
@@ -363,11 +357,6 @@  static int assigned_device_enable_host_m
 #endif
 
 #ifdef __KVM_HAVE_MSIX
-static irqreturn_t kvm_assigned_dev_msix(int irq, void *dev_id)
-{
-	return IRQ_WAKE_THREAD;
-}
-
 static int assigned_device_enable_host_msix(struct kvm *kvm,
 					    struct kvm_assigned_dev_kernel *dev)
 {
@@ -383,10 +372,9 @@  static int assigned_device_enable_host_m
 		return r;
 
 	for (i = 0; i < dev->entries_nr; i++) {
-		r = request_threaded_irq(dev->host_msix_entries[i].vector,
-					 kvm_assigned_dev_msix,
-					 kvm_assigned_dev_thread_msix,
-					 0, dev->irq_name, dev);
+		r = request_irq(dev->host_msix_entries[i].vector,
+				kvm_assigned_dev_msix_handler,
+				0, dev->irq_name, dev);
 		if (r)
 			goto err;
 	}