From patchwork Wed Feb 26 22:50:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11407433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCF5892A for ; Wed, 26 Feb 2020 22:52:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A37F72072D for ; Wed, 26 Feb 2020 22:52:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WKUKiSq0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A37F72072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51199 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75Y0-0003tv-RD for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Feb 2020 17:52:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38502) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75W6-0001LO-QG for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:50:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j75W4-0002oc-EP for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:50:57 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59166 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j75W4-0002mS-5S for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:50:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582757454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y3sVHPpC5z7VoY7e/tsZvRp+0nd3/grkPunmOWyrVZc=; b=WKUKiSq0b6sno1zpA9TPCfV2Y273LZMiNeHlgnXETrDuR7KgGuLDC4jMyC1CB7GxWAS4XU Qw+Ct+tCbC2Gt73mKGUXyph/4gDNueSm3o9LVDT5PERr4x4YF6VMr2RW6hZpfPgDPQWS/C wJPStZOWTx1Ops21G5b+wjEJVVLK2Y8= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-Dly1K89EPuKsWaSamnmV-g-1; Wed, 26 Feb 2020 17:50:53 -0500 X-MC-Unique: Dly1K89EPuKsWaSamnmV-g-1 Received: by mail-qk1-f199.google.com with SMTP id a10so1268150qkg.11 for ; Wed, 26 Feb 2020 14:50:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q/wVcbMiAF3eKq8v1pcoDKE6nDvgoEVVFIvpT7KHpuA=; b=VBBayYo5Jfrqm7RQUF7Ukyxqdiby9nUqgG9YWFhq9c+oxlS4dAuVmQAsyc49tRSOMg K20z9JGa8ph0Hn+nXnQyAUfTZdWhkqRBgrRCB9ESiQhJVL8zpYzTWs0tFnO2nZw0fbQy z4sAS4wkxKJdS8Aqs0YgVsJipUwjYxeavxlOR8UK3MePpr3ZH0UnI4adkGn7WHxvfqC1 drklK8Wf/z+OiPqbdrbgOSM6vuZ8/RS4kg3zJZf4COyV0KPYXZkL+1Lep0t0UIg4SNZu 4DSxb3rahAeMEEIkPFlXshYB7WDAokxh5NAFPCCR8erPN5titK8SatRo8sCNdBcW191H XyJQ== X-Gm-Message-State: APjAAAXxYXcg1ntJECjl5C3ptGGsxlubOAwbLA5lqUYQCmewmanGgdxn cvscccfhG/CK4B/Epyx6w9KhYEP5dQTvls0bh+0LAmOApMyiGlJCO7BFm8eelFeU8ybyY6aPmx1 57gq7NsZkLBQK4Qk= X-Received: by 2002:a0c:f412:: with SMTP id h18mr1668493qvl.124.1582757452537; Wed, 26 Feb 2020 14:50:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyqiQt88tzWWSEvvGiPwIE/00Rrnh9cUeayh/0UanbySLq51p4WPcsRYDcBSSDI3Ln2XphYKw== X-Received: by 2002:a0c:f412:: with SMTP id h18mr1668470qvl.124.1582757452312; Wed, 26 Feb 2020 14:50:52 -0800 (PST) Received: from xz-x1.redhat.com (CPEf81d0fb19163-CMf81d0fb19160.cpe.net.fido.ca. [72.137.123.47]) by smtp.gmail.com with ESMTPSA id t23sm1859140qtp.82.2020.02.26.14.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 14:50:51 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH 1/5] vfio/pci: Disable INTx fast path if using split irqchip Date: Wed, 26 Feb 2020 17:50:44 -0500 Message-Id: <20200226225048.216508-2-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200226225048.216508-1-peterx@redhat.com> References: <20200226225048.216508-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Auger , Alex Williamson , Cornelia Huck , peterx@redhat.com, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" It's currently broken. Let's use the slow path to at least make it functional. Signed-off-by: Peter Xu Reviewed-by: Eric Auger Tested-by: Eric Auger --- hw/vfio/pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 5e75a95129..98e0e0c994 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -128,6 +128,18 @@ static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) return; } + if (kvm_irqchip_is_split()) { + /* + * VFIO INTx is currently not working with split kernel + * irqchip for level triggered interrupts. Go the slow path + * as long as split is enabled so we can be at least + * functional (even with poor performance). + * + * TODO: Remove this after all things fixed up. + */ + return; + } + /* Get to a known interrupt state */ qemu_set_fd_handler(irqfd.fd, NULL, NULL, vdev); vfio_mask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); From patchwork Wed Feb 26 22:50:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11407435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D2AF92A for ; Wed, 26 Feb 2020 22:54:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7E1A2072D for ; Wed, 26 Feb 2020 22:54:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P8zCp+UV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7E1A2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75ZF-0005jg-5P for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Feb 2020 17:54:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38524) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75W8-0001Mt-AO for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:51:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j75W6-0002sb-G4 for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:51:00 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:23922 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j75W6-0002rW-Bi for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:50:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582757457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/mRLtY489WlJGYmG7WK8HSEeXmEgFeFXIG3vkEXk/ME=; b=P8zCp+UVoqM1SK97BOEbNnapebxiXMKScGVFcyuL1mw0dH4RbQYO4tOsgH18FyRCqHUOGI GNdWlcK2VoFrqYNaD1seCT9snChvWXUIev4ir5HvrTB9MHrRoRV4Shdkzk2JVlZnBOwklW s4LOeU0mwtlsKlJ8gDwN9SYnDUCF6oQ= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-4widsbWHMNa2ELQdQbtBuQ-1; Wed, 26 Feb 2020 17:50:56 -0500 X-MC-Unique: 4widsbWHMNa2ELQdQbtBuQ-1 Received: by mail-qk1-f199.google.com with SMTP id t186so1274429qkf.9 for ; Wed, 26 Feb 2020 14:50:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cqZxLVg/Qw8OIhhdXZxU4+pii1ZGAvbWFanpvIoUUXA=; b=USoD5lKpmRFilKCh7p3i3s9PpcIM0mzbP8IEw+2KuRpB5ybpSGgHz2ToCf8wsVyvzo jnJklhfyEFQR8Htz0SIUkqt2pPCCfM4oOI2ysxmTDUeUUalhUuiXsT0/DDidELbYDsXO 3J85EpY57T7aCw80Dy15YupKHNgk/8jUc8m+hbWFo2e6H2gKe/VAJpWQqS1zny0vsDRU Oe070D9ELLZnVojuB37e2AnOCDWPh0Pdyiw64ycHclV27s3I4YyqMf101blPJ2QZLmVH f2BFppIJSqym6lQ2o0z7G7WSc+8DVGzJ5w/kJrenyV1iO0rxlxCFhA+9LhegHxil/Slp dP7w== X-Gm-Message-State: APjAAAUgir60121ZKCTXS76Hru3wY6qwhtbO/Wh10ru2CjZgcVq+quPp sYpGxwWUWEbjOolXz5R3BhraWUmlF6SP8vcMFSBDhXmBD1WXacT+o3uoJE+9R2l/g+1qYlVUb1i oeZd+n4zklBH9hMI= X-Received: by 2002:a37:4754:: with SMTP id u81mr1692360qka.78.1582757454310; Wed, 26 Feb 2020 14:50:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwQDFh+jpVZfdOWn1tvWu8MIaVy+UhyjFkHZ4JD8Zf120sN2OuQm0oYJGFZctvxit2EvyxsKg== X-Received: by 2002:a37:4754:: with SMTP id u81mr1692345qka.78.1582757454077; Wed, 26 Feb 2020 14:50:54 -0800 (PST) Received: from xz-x1.redhat.com (CPEf81d0fb19163-CMf81d0fb19160.cpe.net.fido.ca. [72.137.123.47]) by smtp.gmail.com with ESMTPSA id t23sm1859140qtp.82.2020.02.26.14.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 14:50:53 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH 2/5] vfio/pci: Use kvm_irqchip_add_irqfd_notifier_gsi() for irqfds Date: Wed, 26 Feb 2020 17:50:45 -0500 Message-Id: <20200226225048.216508-3-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200226225048.216508-1-peterx@redhat.com> References: <20200226225048.216508-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Auger , Alex Williamson , Cornelia Huck , peterx@redhat.com, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" VFIO is currently the only one left that is not using the generic function (kvm_irqchip_add_irqfd_notifier_gsi()) to register irqfds. Let VFIO use the common framework too. Follow up patches will introduce extra features for kvm irqfd, so that VFIO can easily leverage that after the switch. Signed-off-by: Peter Xu Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck --- hw/vfio/pci.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 98e0e0c994..09703362df 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -115,11 +115,7 @@ static void vfio_intx_eoi(VFIODevice *vbasedev) static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) { #ifdef CONFIG_KVM - struct kvm_irqfd irqfd = { - .fd = event_notifier_get_fd(&vdev->intx.interrupt), - .gsi = vdev->intx.route.irq, - .flags = KVM_IRQFD_FLAG_RESAMPLE, - }; + int irq_fd = event_notifier_get_fd(&vdev->intx.interrupt); Error *err = NULL; if (vdev->no_kvm_intx || !kvm_irqfds_enabled() || @@ -141,7 +137,7 @@ static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) } /* Get to a known interrupt state */ - qemu_set_fd_handler(irqfd.fd, NULL, NULL, vdev); + qemu_set_fd_handler(irq_fd, NULL, NULL, vdev); vfio_mask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vdev->intx.pending = false; pci_irq_deassert(&vdev->pdev); @@ -152,17 +148,18 @@ static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) goto fail; } - /* KVM triggers it, VFIO listens for it */ - irqfd.resamplefd = event_notifier_get_fd(&vdev->intx.unmask); - - if (kvm_vm_ioctl(kvm_state, KVM_IRQFD, &irqfd)) { + if (kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, + &vdev->intx.interrupt, + &vdev->intx.unmask, + vdev->intx.route.irq)) { error_setg_errno(errp, errno, "failed to setup resample irqfd"); goto fail_irqfd; } if (vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX, 0, VFIO_IRQ_SET_ACTION_UNMASK, - irqfd.resamplefd, &err)) { + event_notifier_get_fd(&vdev->intx.unmask), + &err)) { error_propagate(errp, err); goto fail_vfio; } @@ -177,12 +174,12 @@ static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) return; fail_vfio: - irqfd.flags = KVM_IRQFD_FLAG_DEASSIGN; - kvm_vm_ioctl(kvm_state, KVM_IRQFD, &irqfd); + kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, &vdev->intx.interrupt, + vdev->intx.route.irq); fail_irqfd: event_notifier_cleanup(&vdev->intx.unmask); fail: - qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev); + qemu_set_fd_handler(irq_fd, vfio_intx_interrupt, NULL, vdev); vfio_unmask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); #endif } @@ -190,12 +187,6 @@ fail: static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev) { #ifdef CONFIG_KVM - struct kvm_irqfd irqfd = { - .fd = event_notifier_get_fd(&vdev->intx.interrupt), - .gsi = vdev->intx.route.irq, - .flags = KVM_IRQFD_FLAG_DEASSIGN, - }; - if (!vdev->intx.kvm_accel) { return; } @@ -209,7 +200,8 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev) pci_irq_deassert(&vdev->pdev); /* Tell KVM to stop listening for an INTx irqfd */ - if (kvm_vm_ioctl(kvm_state, KVM_IRQFD, &irqfd)) { + if (kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, &vdev->intx.interrupt, + vdev->intx.route.irq)) { error_report("vfio: Error: Failed to disable INTx irqfd: %m"); } @@ -217,7 +209,8 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev) event_notifier_cleanup(&vdev->intx.unmask); /* QEMU starts listening for interrupt events. */ - qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev); + qemu_set_fd_handler(event_notifier_get_fd(&vdev->intx.interrupt), + vfio_intx_interrupt, NULL, vdev); vdev->intx.kvm_accel = false; From patchwork Wed Feb 26 22:54:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11407439 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BC5114B4 for ; Wed, 26 Feb 2020 22:55:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1269D2072D for ; Wed, 26 Feb 2020 22:55:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FA5NGAs6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1269D2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75ah-0008GH-7o for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Feb 2020 17:55:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39614) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75a5-0007AX-5d for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j75a3-0002Er-Sn for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:05 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:48518 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j75a3-0002EU-Ou for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582757702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sQ+3B2PsBNwy91uRvIR6aBTCd/S80BOOKAQ9EBJ4pwU=; b=FA5NGAs6moiXN431OuU7VI4zjRCNTeJ9WG2M8o6yh6mJVrCmQazp1u8BBtfh68E5943J7x 5oabUnp/Qn29mpFA2Te3jT3g8rHUTcmxaYeJ+DpfGd5nIeVEhjnK/ZiFLafQOn4inbB9Bi Zt5VRSxdevqGM5F32fk8fR04l6jeKa0= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-Cvn24Kk7N1K38MSJrsABbQ-1; Wed, 26 Feb 2020 17:55:01 -0500 X-MC-Unique: Cvn24Kk7N1K38MSJrsABbQ-1 Received: by mail-qk1-f200.google.com with SMTP id e11so1288176qkl.8 for ; Wed, 26 Feb 2020 14:55:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6iF/hzx5xbCPUIf+puVE70hJQRDvIvHhsPT7aYBtNUQ=; b=SG8A1SnHBryJ3Y/loUBnqKeZESC+FOvZeKUWEMnbMW4bbmWKR7oi7XaQy+4B01r826 Eyz2BVbkAHxnLkFQ/Q4ZrNZ9m9I9t4IehCwZmODrPvJxb70vd0Mp74mBapWhTL3O8WHq C9UT+/DFtfkpTyaMFRcZHNyoAhAHaZiYLGRmfZUWwcpfAVaB3eKiQnZICSSOBgfU/7XC MLZZcHQyry4zd5Tz5tKbXhZfUPhUO7F8rX0/qgNokRbSVwKne63kvP3SYxm4j3FPFIBh muWIVrHE/7LLvcAE/FqdA5ncg/yZ2HJqUGbxiTl9GnHpsQBi7GFWhGS6pHYyt+M4wyBj Hjvg== X-Gm-Message-State: APjAAAW0mfevNk1WvxtMqJZCFepEI2cuJQ0fJdPDSXuJKTOI8FxVZBYM c05SEIx5T4fCyHfKOm1bUI0V6EwGG1FMsoJplbItB4ZUmcMBebQREgMwHitLOWW4+Ww/UNWErDb BX3Onmb9VsHhmxZ0= X-Received: by 2002:a37:6841:: with SMTP id d62mr1705297qkc.365.1582757700027; Wed, 26 Feb 2020 14:55:00 -0800 (PST) X-Google-Smtp-Source: APXvYqz4xcaICWehbAkrsogjl5WAcyo1Iz+HUNOtbzBC/XHoZnKF76Ffq1b9zP/GBq6YIRY1j5YXqQ== X-Received: by 2002:a37:6841:: with SMTP id d62mr1705270qkc.365.1582757699779; Wed, 26 Feb 2020 14:54:59 -0800 (PST) Received: from xz-x1.redhat.com (CPEf81d0fb19163-CMf81d0fb19160.cpe.net.fido.ca. [72.137.123.47]) by smtp.gmail.com with ESMTPSA id n188sm1881855qkc.106.2020.02.26.14.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 14:54:59 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH 3/5] KVM: Pass EventNotifier into kvm_irqchip_assign_irqfd Date: Wed, 26 Feb 2020 17:54:57 -0500 Message-Id: <20200226225457.217014-1-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200226225048.216508-1-peterx@redhat.com> References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Auger , Alex Williamson , Cornelia Huck , Peter Xu , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" So that kvm_irqchip_assign_irqfd() can have access to the EventNotifiers, especially the resample event. It is needed in follow up patch to cache and kick resamplefds from QEMU. Signed-off-by: Peter Xu Reviewed-by: Eric Auger --- accel/kvm/kvm-all.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 439a4efe52..d49b74512a 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1628,9 +1628,13 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg, return kvm_update_routing_entry(s, &kroute); } -static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int rfd, int virq, +static int kvm_irqchip_assign_irqfd(KVMState *s, EventNotifier *event, + EventNotifier *resample, int virq, bool assign) { + int fd = event_notifier_get_fd(event); + int rfd = resample ? event_notifier_get_fd(resample) : -1; + struct kvm_irqfd irqfd = { .fd = fd, .gsi = virq, @@ -1735,7 +1739,9 @@ int kvm_irqchip_add_hv_sint_route(KVMState *s, uint32_t vcpu, uint32_t sint) return -ENOSYS; } -static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int virq, bool assign) +static int kvm_irqchip_assign_irqfd(KVMState *s, EventNotifier *event, + EventNotifier *resample, int virq, + bool assign) { abort(); } @@ -1749,15 +1755,13 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg) int kvm_irqchip_add_irqfd_notifier_gsi(KVMState *s, EventNotifier *n, EventNotifier *rn, int virq) { - return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), - rn ? event_notifier_get_fd(rn) : -1, virq, true); + return kvm_irqchip_assign_irqfd(s, n, rn, virq, true); } int kvm_irqchip_remove_irqfd_notifier_gsi(KVMState *s, EventNotifier *n, int virq) { - return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), -1, virq, - false); + return kvm_irqchip_assign_irqfd(s, n, NULL, virq, false); } int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, From patchwork Wed Feb 26 22:55:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11407441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8EAFC1805 for ; Wed, 26 Feb 2020 22:57:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64DF020838 for ; Wed, 26 Feb 2020 22:57:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i/YT2zqR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64DF020838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75cN-0001uy-Iv for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Feb 2020 17:57:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39660) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75aI-0007Vi-6n for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j75aG-0002X4-GW for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33070 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j75aG-0002Wf-CE for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582757716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2MFa++5YU3mfigF5LahLlLxn2sMKcgokSyXEySgB2+A=; b=i/YT2zqRQ6uTwW8F37mPg2fUjIT21uX1h1/f4dxHVsUuir5K9fCntSm2SI5OfHtHP3yT9u BDnUROvM2UFtJ67vqZfR2yYDrm+1Gzr2H7tNAHI+qiRQd1dVIz0IURxFSSQn/vkCqysb3S wUpV81fDgmMEkceTkrIaPfczYhH5Pn8= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-307-a8rxqva2P2ewOC_0y_UtWg-1; Wed, 26 Feb 2020 17:55:14 -0500 X-MC-Unique: a8rxqva2P2ewOC_0y_UtWg-1 Received: by mail-qv1-f69.google.com with SMTP id l1so1116749qvu.13 for ; Wed, 26 Feb 2020 14:55:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gvTPynuCyHMtJhmuLrYJeDk9O0g1fCDRZ/EK0AB+mbc=; b=b6/GnSIYz7un5z2P31e/qq6cOLai81Ond7osxEB7iF5feknj6I+uhuyn33Ca0CTVKI q+kkDz4ckD+38XJlOCauAfPc3ruVjmBPO5rNn/qdhxembi/SRGIvvHKGc7tlvI17beQu cxIElsvHzjj/h8IEmdpyVC5owVbiP+76K4C9S0ZNnI8JDI0YuGphddyf7/xjS6OfaXva +WUUmZGn6aF7nKg5gNu48LfAi4HS6ViusCM2FKr30vD44IA6X/QCgEVWP7b1rKIrlVUJ VJeV/J04JhErBJEbnf6bJTO4K8zTv1Wju7b201DHdQk5GcySFR7tKNtErDgP5Rjfe5UX D22w== X-Gm-Message-State: APjAAAUTs0MKP576k2wTI6CiwvtRIgLlLs8R3tbdWVJTGT48LAP0pKeU rZtAbzST4ZoZQpUbe8qQPD7g3RazsAtH+zgvK53aWezpE+dpMwPotKP7J+yvbH6l0DK3jeRg6Ib lCNXyLjkQAh2bnfo= X-Received: by 2002:a37:7f03:: with SMTP id a3mr1839073qkd.121.1582757713246; Wed, 26 Feb 2020 14:55:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzjEnLOi/rGeXCye4RkLvxqTmiX3ngZ/iTizZitSsRgdSe20CJ54B1+/YOwPrAVIAC3Ut0E8w== X-Received: by 2002:a37:7f03:: with SMTP id a3mr1839049qkd.121.1582757712942; Wed, 26 Feb 2020 14:55:12 -0800 (PST) Received: from xz-x1.redhat.com (CPEf81d0fb19163-CMf81d0fb19160.cpe.net.fido.ca. [72.137.123.47]) by smtp.gmail.com with ESMTPSA id h34sm1985776qtc.62.2020.02.26.14.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 14:55:12 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH 4/5] KVM: Kick resamplefd for split kernel irqchip Date: Wed, 26 Feb 2020 17:55:10 -0500 Message-Id: <20200226225510.217077-1-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200226225048.216508-1-peterx@redhat.com> References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Auger , Alex Williamson , Cornelia Huck , Peter Xu , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This is majorly only for X86 because that's the only one that supports split irqchip for now. When the irqchip is split, we face a dilemma that KVM irqfd will be enabled, however the slow irqchip is still running in the userspace. It means that the resamplefd in the kernel irqfds won't take any effect and it can miss to ack INTx interrupts on EOIs. One example is split irqchip with VFIO INTx, which will break if we use the VFIO INTx fast path. This patch can potentially supports the VFIO fast path again for INTx, that the IRQ delivery will still use the fast path, while we don't need to trap MMIOs in QEMU for the device to emulate the EIOs (see the callers of vfio_eoi() hook). However the EOI of the INTx will still need to be done from the userspace by caching all the resamplefds in QEMU and kick properly for IOAPIC EOI broadcast. https://patchwork.kernel.org/patch/10738541/#22609933 Suggested-by: Paolo Bonzini Signed-off-by: Peter Xu --- accel/kvm/kvm-all.c | 67 ++++++++++++++++++++++++++++++++++++++++++ accel/kvm/trace-events | 1 + hw/intc/ioapic.c | 11 +++++-- include/sysemu/kvm.h | 4 +++ 4 files changed, 81 insertions(+), 2 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index d49b74512a..c7a863552b 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -159,9 +159,62 @@ static const KVMCapabilityInfo kvm_required_capabilites[] = { static NotifierList kvm_irqchip_change_notifiers = NOTIFIER_LIST_INITIALIZER(kvm_irqchip_change_notifiers); +struct KVMResampleFd { + int gsi; + EventNotifier *resample_event; + QLIST_ENTRY(KVMResampleFd) node; +}; +typedef struct KVMResampleFd KVMResampleFd; + +/* + * Only used with split irqchip where we need to do the resample fd + * kick for the kernel from userspace. + */ +static QLIST_HEAD(, KVMResampleFd) kvm_resample_fd_list = + QLIST_HEAD_INITIALIZER(kvm_resample_fd_list); + #define kvm_slots_lock(kml) qemu_mutex_lock(&(kml)->slots_lock) #define kvm_slots_unlock(kml) qemu_mutex_unlock(&(kml)->slots_lock) +static inline void kvm_resample_fd_remove(int gsi) +{ + KVMResampleFd *rfd; + + QLIST_FOREACH(rfd, &kvm_resample_fd_list, node) { + if (rfd->gsi == gsi) { + QLIST_REMOVE(rfd, node); + break; + } + } +} + +static inline void kvm_resample_fd_insert(int gsi, EventNotifier *event) +{ + KVMResampleFd *rfd = g_new0(KVMResampleFd, 1); + + rfd->gsi = gsi; + rfd->resample_event = event; + + QLIST_INSERT_HEAD(&kvm_resample_fd_list, rfd, node); +} + +void kvm_resample_fd_notify(int gsi) +{ + KVMResampleFd *rfd; + + if (!kvm_irqchip_is_split()) { + return; + } + + QLIST_FOREACH(rfd, &kvm_resample_fd_list, node) { + if (rfd->gsi == gsi) { + event_notifier_set(rfd->resample_event); + trace_kvm_resample_fd_notify(gsi); + break; + } + } +} + int kvm_get_max_memslots(void) { KVMState *s = KVM_STATE(current_accel()); @@ -1644,6 +1697,20 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, EventNotifier *event, if (rfd != -1) { irqfd.flags |= KVM_IRQFD_FLAG_RESAMPLE; irqfd.resamplefd = rfd; + + /* + * When the slow irqchip (e.g. IOAPIC) is in the userspace, + * resamplefd will not work because the EOI of the level + * triggered interrupt will be delivered to userspace + * instead. The userspace needs to remember the resamplefd + * too and kick it when we receive EOI of this IRQ. + */ + assert(assign); + kvm_resample_fd_insert(virq, resample); + } + + if (!assign) { + kvm_resample_fd_remove(virq); } if (!kvm_irqfds_enabled()) { diff --git a/accel/kvm/trace-events b/accel/kvm/trace-events index 4fb6e59d19..a68eb66534 100644 --- a/accel/kvm/trace-events +++ b/accel/kvm/trace-events @@ -16,4 +16,5 @@ kvm_set_ioeventfd_mmio(int fd, uint64_t addr, uint32_t val, bool assign, uint32_ kvm_set_ioeventfd_pio(int fd, uint16_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) "fd: %d @0x%x val=0x%x assign: %d size: %d match: %d" kvm_set_user_memory(uint32_t slot, uint32_t flags, uint64_t guest_phys_addr, uint64_t memory_size, uint64_t userspace_addr, int ret) "Slot#%d flags=0x%x gpa=0x%"PRIx64 " size=0x%"PRIx64 " ua=0x%"PRIx64 " ret=%d" kvm_clear_dirty_log(uint32_t slot, uint64_t start, uint32_t size) "slot#%"PRId32" start 0x%"PRIx64" size 0x%"PRIx32 +kvm_resample_fd_notify(int gsi) "gsi %d" diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index 15747fe2c2..8c75465c62 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -236,8 +236,15 @@ void ioapic_eoi_broadcast(int vector) for (n = 0; n < IOAPIC_NUM_PINS; n++) { entry = s->ioredtbl[n]; - if ((entry & IOAPIC_VECTOR_MASK) != vector || - ((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) != IOAPIC_TRIGGER_LEVEL) { + if ((entry & IOAPIC_VECTOR_MASK) != vector) { + continue; + } + + /* Kick resamplefd if KVM is bypassed */ + kvm_resample_fd_notify(n); + + if (((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) != + IOAPIC_TRIGGER_LEVEL) { continue; } diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 141342de98..b67552c047 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -555,4 +555,8 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source); int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target); struct ppc_radix_page_info *kvm_get_radix_page_info(void); int kvm_get_max_memslots(void); + +/* Notify resamplefd for EOI of specific level triggered interrupts */ +void kvm_resample_fd_notify(int gsi); + #endif From patchwork Wed Feb 26 22:55:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11407443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE45792A for ; Wed, 26 Feb 2020 22:58:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C49B320838 for ; Wed, 26 Feb 2020 22:58:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jOwlRKJQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C49B320838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51307 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75dR-0003Zh-1V for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Feb 2020 17:58:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39702) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j75aQ-0007lh-Og for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j75aP-0002gc-Rc for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:26 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37431 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j75aP-0002gU-O2 for qemu-devel@nongnu.org; Wed, 26 Feb 2020 17:55:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582757725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=67BJoWVgjqRaE3ez8MIcs6ZgskV92ME7JrNNMKV0joI=; b=jOwlRKJQ9hBHfuLgsT7kA3f8Te6ygCGhtQkXH/WZeSZe8Qg/bJ6qSRNFPLDQx8F0oaHiPU +NrlpiJxD5B4kb50kTFPSLitG5gn6kZnGPBvqMxBW3oeTyNv0yo9vSPGLUpDnZ/FxtXBNd InwGc9eyGlJBW+ZCqK4QtECO0ObKUrI= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-Mc33v0rKNwK323RnR6zRWQ-1; Wed, 26 Feb 2020 17:55:23 -0500 X-MC-Unique: Mc33v0rKNwK323RnR6zRWQ-1 Received: by mail-qk1-f200.google.com with SMTP id q123so1317999qkb.1 for ; Wed, 26 Feb 2020 14:55:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wQ1AClskklPLaQx5THQ8KFrAAijnqVsY12r4IQjRE6M=; b=pVWwXZXVYT/3P5VrnjIbcAv86PK6XFAgO7RrpQ51vyuc2kGAy6QqMYqM5ZTamU0D/0 0qaUlGCtcvz8gCgOv0Or1HVv3Qm7DnK2PjnnJRyBOwu6syOfuP0hjv4t5UFf7F5lf9GE YiuhApdddMGF09+XPdoUsD85LbhBRnQ+LzU0c9Z+IFAa0bjGMayWEABRruXsvvPmQxr3 17CXi22KqxN31nL6RnU5j9SwfyF3XFXWde8CUkFAW0dpnlRrHX/5L4L60C1myAbe1GlU TGVYW6uNu/nj7CvDjErs3Hcw+iTcfqAwDs7CYBLozFBeY3eC9zhGfCplJ+Fi3W/xqgYh n1BQ== X-Gm-Message-State: APjAAAV9IqHuI2c72pfd4k/yHSYHwDLOImLIJeuXLk13xjkcGg6eU5OP cal1t/slJtNzGel1llFUyEvsMevAl2LXJMx15V1SL05UDpcFw2gjkuz00f740vxm2MmZyPimli0 O6s8/mPfI2LegMC8= X-Received: by 2002:a37:ba05:: with SMTP id k5mr1834147qkf.257.1582757721826; Wed, 26 Feb 2020 14:55:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxF+juToEgr9MqlCHQQhjmSwzaOaycUbCGOItKyT6fJZXQQMn4EzJPcbVw19kURPqLv3JA+TA== X-Received: by 2002:a37:ba05:: with SMTP id k5mr1834127qkf.257.1582757721603; Wed, 26 Feb 2020 14:55:21 -0800 (PST) Received: from xz-x1.redhat.com (CPEf81d0fb19163-CMf81d0fb19160.cpe.net.fido.ca. [72.137.123.47]) by smtp.gmail.com with ESMTPSA id h8sm1900079qtm.51.2020.02.26.14.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 14:55:19 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH 5/5] Revert "vfio/pci: Disable INTx fast path if using split irqchip" Date: Wed, 26 Feb 2020 17:55:18 -0500 Message-Id: <20200226225518.217138-1-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200226225048.216508-1-peterx@redhat.com> References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Auger , Alex Williamson , Cornelia Huck , Peter Xu , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" With the resamplefd list introduced, we can savely enable VFIO INTx fast path again with split irqchip so it can still be faster than the complete slow path. Signed-off-by: Peter Xu --- hw/vfio/pci.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 09703362df..1c0aa27386 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -124,18 +124,6 @@ static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) return; } - if (kvm_irqchip_is_split()) { - /* - * VFIO INTx is currently not working with split kernel - * irqchip for level triggered interrupts. Go the slow path - * as long as split is enabled so we can be at least - * functional (even with poor performance). - * - * TODO: Remove this after all things fixed up. - */ - return; - } - /* Get to a known interrupt state */ qemu_set_fd_handler(irq_fd, NULL, NULL, vdev); vfio_mask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);