From patchwork Sat Jul 14 11:16:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 1197761 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7D82B3FD4F for ; Sat, 14 Jul 2012 11:16:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752926Ab2GNLQN (ORCPT ); Sat, 14 Jul 2012 07:16:13 -0400 Received: from www.linutronix.de ([62.245.132.108]:47842 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752841Ab2GNLQM (ORCPT ); Sat, 14 Jul 2012 07:16:12 -0400 Received: from localhost ([127.0.0.1]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Sq0KX-0004Tg-Gv; Sat, 14 Jul 2012 13:16:09 +0200 Date: Sat, 14 Jul 2012 13:16:08 +0200 (CEST) From: Thomas Gleixner To: Jan Kiszka cc: Linus Torvalds , Avi Kivity , linux-kernel , Marcelo Tosatti , KVM list Subject: Re: [GIT PULL] KVM fixes for 3.5-rc6 In-Reply-To: <500118F1.8060300@web.de> Message-ID: References: <4FFEBB39.8090308@redhat.com> <500118F1.8060300@web.de> User-Agent: Alpine 2.02 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 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; }