From patchwork Wed Mar 18 14:52:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11445405 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 5275A17E6 for ; Wed, 18 Mar 2020 14:53:03 +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 EA06320714 for ; Wed, 18 Mar 2020 14:53:02 +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="URpwk+1E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA06320714 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]:51868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa45-0001Nu-RR for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Mar 2020 10:53:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46151) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa3Q-0000Jh-3a for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEa3P-0005Ri-0e for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:20 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:21286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEa3O-0005P6-Sx for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584543138; 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=N/FzVSHMR5XZjET3ZcevxZb9TJHsbHJRszWRidlyteM=; b=URpwk+1EGgiT/eF3V627nHN79bIffsfq+jpihC+BPB4zU7lfqRQY3Tr5TnuwCt03bv0lNJ M5y7+SdWjPRT/5ngw44Eqi8Tq9NTbTsZVlgkxpPJM5RF1c2Rax0eVhHC0iQ1c81FdIoN3K X+q1MwYiA4e2MQ5VPL9EcTBbS7QUM6s= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-IcYOk9j7P0ycMBo5xYAs7A-1; Wed, 18 Mar 2020 10:52:16 -0400 X-MC-Unique: IcYOk9j7P0ycMBo5xYAs7A-1 Received: by mail-wm1-f70.google.com with SMTP id z26so1145654wmk.1 for ; Wed, 18 Mar 2020 07:52:16 -0700 (PDT) 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=ZgrIZqCisTEH3B29D69xtc42FXCdiaXNL/5zv4PuJqI=; b=MwuNMtaAvkuH/JYnsFUhNSuEYUqyOokTDEtkQcilMybm3G9YZI9GBSCnQm2VEw1cwf spgPYhkOpVm/B2nxGVXGpStXfJai0yOa5h9dS4RXgl5MaF5bg3fmz/hmBXFqoSF0OZCt F8dplggzW7Pfx32Aqe63+IOY/uEB1Q+A2Ede5+7tv7BXtceCy428JHItLe0Ivc5lpljz RV7oEMsAp+mx2VSNrvm0jIQC2fdBO5wPuSGKthiOaS/aUOpOREafMBgGENSIK1caPGKJ GblsfunsO8h+erE9gq7Dp5jY+Hfs9ys7vtMFlxEX4D1KrfCgIhipMhRVvpI+TXPB8Y1S hfww== X-Gm-Message-State: ANhLgQ3lf70vgPwORGACYkGIVsB0Ka4j2z4GxJdFNQ2Ff6CwyrbIpUFL VCTYnwf/mklrky2Xr/XtrGCknclCH7Fbp7Lt5GamjYtB+Xn0/B2LhPeuqYWQnR+LsFVpsaj2dTR a1yDhnpZ8kuytHI4= X-Received: by 2002:a1c:f60d:: with SMTP id w13mr5781079wmc.171.1584543135071; Wed, 18 Mar 2020 07:52:15 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt+sMn4Jd6HnCPd+og48mBg7PRmrfzSJ0A8aDwUGv3z+q4KjCIAbU8od8/k1UqYA1bc/p2M4A== X-Received: by 2002:a1c:f60d:: with SMTP id w13mr5781059wmc.171.1584543134820; Wed, 18 Mar 2020 07:52:14 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id c23sm8711520wrb.79.2020.03.18.07.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 07:52:14 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v4 1/5] vfio/pci: Disable INTx fast path if using split irqchip Date: Wed, 18 Mar 2020 10:52:00 -0400 Message-Id: <20200318145204.74483-2-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200318145204.74483-1-peterx@redhat.com> References: <20200318145204.74483-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] [fuzzy] X-Received-From: 216.205.24.74 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. Tested-by: Eric Auger Reviewed-by: Eric Auger Reviewed-by: Alex Williamson Acked-by: Alex Williamson Signed-off-by: Peter Xu --- 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 Mar 18 14:52:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11445407 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 B4BA013B1 for ; Wed, 18 Mar 2020 14:53:13 +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 8A45920752 for ; Wed, 18 Mar 2020 14:53: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="K8eRIGx1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A45920752 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]:51870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa4G-0001jF-MN for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Mar 2020 10:53:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46281) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa3X-0000Tq-12 for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEa3V-0006ZB-OH for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:26 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:29564) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEa3V-0006UL-Jv for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584543145; 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=d7VCARQpa543CzI17Qh3SwV/uYby6Bu6+9e0X/pxZcw=; b=K8eRIGx1QV/oZKk4FoV8Djwpzn8m+uZNnmZ6KjK64y8HyfL/eCrbweNPJblrpJMKx9p+dG HzPJNmgOlv6Ko7gG1Kbb0pwma6oo3Cy5MiYKBccc69IxXBARdbdm/84zjznaI455RaW5AZ tIUS3gcNLhUAd+JUxEBf03xsgkLTdV4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-84-KILDF9pMNDmDXYUCFfFWrA-1; Wed, 18 Mar 2020 10:52:23 -0400 X-MC-Unique: KILDF9pMNDmDXYUCFfFWrA-1 Received: by mail-wm1-f70.google.com with SMTP id p18so1179528wmk.9 for ; Wed, 18 Mar 2020 07:52:22 -0700 (PDT) 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=R4ymvWMCxrIfLkhgyjJ3vQ3SuCXiTnkkegIn5k6FWHQ=; b=Xcr6fItjPYGJYf6Hz34MF2GRRJYdD8JzgtjjLRoF8tDsVzuSYBUNOKP8YmjFTEitON Lzk+1k6c/Pz0UdmLyledrJkaGkyiSbtACOHYvdwb/yXg2qgjpgIYizgHkeb4aEWbI8gL T+/XKZZM8UU/b/7sis5HLb2ivs/opwRepQJ0e/lxB8QNa6lOVTkJyGt6RT+DdtmqrmFL ANsdH0pvrzVXkZ2V9uaskfqvNHleidwdG1Flc4jRIxTXcyfSBea4e992AWKa47wAAsog WUHj6sDmHvxEU4Wm3ne9sIl6f1DUMwy2oAzCj9djCyCtkOclnkC18XweF5OQc9IqP8cV J0IQ== X-Gm-Message-State: ANhLgQ3yR00lmQ0a45KXc3GDbiO9oqzbsUjUiLr5/MHFl7w4f32dbdVx EWNqClWtJ88j5E4rA+nvfzraycXHodN6NeNZstHaYQ53JD3Dh4hyz0u3+J1W0YBCpIFQA2n5PVF zBiN+5JqoTuTgqVQ= X-Received: by 2002:a1c:2e92:: with SMTP id u140mr5622803wmu.84.1584543141476; Wed, 18 Mar 2020 07:52:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtKnJco+TcUaI3QTwe7pmpsdrvaNbGxtpa2G8FyQoAWX0/FBt4bIUhcBOSmkrUCPYYvbZ2nwQ== X-Received: by 2002:a1c:2e92:: with SMTP id u140mr5622776wmu.84.1584543141233; Wed, 18 Mar 2020 07:52:21 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id v10sm3912401wml.44.2020.03.18.07.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 07:52:20 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v4 2/5] vfio/pci: Use kvm_irqchip_add_irqfd_notifier_gsi() for irqfds Date: Wed, 18 Mar 2020 10:52:01 -0400 Message-Id: <20200318145204.74483-3-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200318145204.74483-1-peterx@redhat.com> References: <20200318145204.74483-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: 63.128.21.74 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. Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck Reviewed-by: Alex Williamson Acked-by: Alex Williamson Signed-off-by: Peter Xu --- 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 Mar 18 14:52:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11445409 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 3D45013B1 for ; Wed, 18 Mar 2020 14:53:21 +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 1011520714 for ; Wed, 18 Mar 2020 14:53:21 +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="dc+7hZfF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1011520714 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]:51872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa4O-0001yT-5u for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Mar 2020 10:53:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46388) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa3e-0000fk-RJ for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEa3d-0007Zb-NR for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:34 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:48602) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEa3d-0007UX-J2 for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584543153; 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=EQy/e/scga9zarPzuOAeT8d2PRLcnf5E3HLsv0u1yWU=; b=dc+7hZfFRaGac7wy3OogKhGxpmeH3J8PMpdIE22qmxkWcT3srxQ6KcSF2bMpZvwgcGg6sg r7oUl9cPOSunL1aWY+OiQQxLRbks71T8eh4r4xbokPIZOAviEv4HveXt/Q+3+C0ILTE6/m Npt0rpO3ClgYXVhWh7/DRMlA0Ga/1OM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-488-d2v0WfQ6MpCaiEpIWjLgpA-1; Wed, 18 Mar 2020 10:52:29 -0400 X-MC-Unique: d2v0WfQ6MpCaiEpIWjLgpA-1 Received: by mail-wr1-f72.google.com with SMTP id i18so1380992wrx.17 for ; Wed, 18 Mar 2020 07:52:29 -0700 (PDT) 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=lUfyl9yDAO9btjUhY+kMjw1YOH9kmybJnOGo9W8GzWE=; b=OMgPfxK0T8GM0fELatz6sjSO5OL8GTgmdtrl0ApSYiZyW/JVC2glKoAV7ZLndRyUfv 8ZTrK3gxzPPQRKjvdCOuBzfH+eK6BpKQ4IdGykLXGKal+IYh7SOWgRT07GaHWTKq4IS/ TXpSbKmWdtiwLbh8p428CH8V0hLLWjtcbtiBp6cd0KZWzFqCY+tk2d9Bru4ctXdfDn9a EoxFYvCFriqMyR5RUiRnGBFXwI1sO3FefY4kPVb4WJtZgU4mYpzLJWeOiUTbZEMocVvs yS/steZYrJulxIZMLLGdw2KJpUd/w2cIhKZkORWMY8SOanD6zpljOMI0zs0aWX2zIJO4 iCIA== X-Gm-Message-State: ANhLgQ3E8Fz9ubupKjT4pLsaJ1TDCXyyEldI9XiGhXA0e5ii45VIN5Rl XmZEi17AKjLY3nhqEDAyBFScRq/1jv1Q4JxuqYo+cf7aeaf2oa/66vLjU/eoNpTt930xIdyQT9a UeISm8kQw16mEWdk= X-Received: by 2002:adf:e891:: with SMTP id d17mr5988939wrm.348.1584543147798; Wed, 18 Mar 2020 07:52:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt2kNtRhQRcxxU3PGE7r91iXroMFrSugvywgZW/dGr6il3sc4NcLXadM2nlCSSBaMPKKLN7dQ== X-Received: by 2002:adf:e891:: with SMTP id d17mr5988923wrm.348.1584543147602; Wed, 18 Mar 2020 07:52:27 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id b80sm2246178wme.24.2020.03.18.07.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 07:52:26 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v4 3/5] KVM: Pass EventNotifier into kvm_irqchip_assign_irqfd Date: Wed, 18 Mar 2020 10:52:02 -0400 Message-Id: <20200318145204.74483-4-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200318145204.74483-1-peterx@redhat.com> References: <20200318145204.74483-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: 63.128.21.74 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" 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. Reviewed-by: Eric Auger Reviewed-by: Alex Williamson Signed-off-by: Peter Xu --- 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 Mar 18 14:52:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11445413 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 044F013B1 for ; Wed, 18 Mar 2020 14:54:45 +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 CE6B420757 for ; Wed, 18 Mar 2020 14:54: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="Q9vj5ocN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE6B420757 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]:51898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa5j-0004U8-Sd for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Mar 2020 10:54:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46443) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa3j-0000oo-NE for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEa3h-0008RR-U8 for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:39 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:31463) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEa3h-0008O5-PE for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584543157; 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=rEYKOJwzrph5RL5EzIbqa9app5q7N1QY21unZg89cSI=; b=Q9vj5ocNo1BEtgaqsJAMeVHNPercUfCERoHZJ2HblolHfqpihe3LVd7+HRPoha/6GesI/f WCBf99JvEwLexMNaohtjw2aNoDuMykg19J4t46UboQ0t3Z8a9CoiDihPcHw1U3sjJiYHiL Wz052uLEN085SLcgd4fP389iwwr+Wz0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-128-ZD6MtGpEMW6e7qGPhQY4jA-1; Wed, 18 Mar 2020 10:52:35 -0400 X-MC-Unique: ZD6MtGpEMW6e7qGPhQY4jA-1 Received: by mail-wm1-f72.google.com with SMTP id z16so1147263wmi.2 for ; Wed, 18 Mar 2020 07:52:35 -0700 (PDT) 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=dYyjXqlxd6o+AGz9f66cU6H8IpZBprTaTlkNnYlDx9g=; b=OOQCUQH9M/wVFaZqVuWUCy6hat8j5BT+619XT9zbxzRqmX+iWthePBOPXc3wCyHzhC Amu2KOF2//IptQQNR7KGA1bTNOZgicEFHrKS12odtVwj3pBcwtJNFYki/P+rqtz45FYx OD3cx7Np+OdY0nd5B5Qzvzk/oZc/xCl6KhqM6J55L698AKV9zRFrtCdAjXWUp68lOU2r HJFUl6LdNOQ35f6Y+ZN+2BvrYJduGOXipHBKQUCYdGe237MpGNPT/3R6sDrK9C/AYgVn fhgS8aHjYTL+6eO+agokRcvh4e+fRRcExtOjqXrD7JJ8ELnUI1J6R4dtdeMcEYrIKNDV mWkQ== X-Gm-Message-State: ANhLgQ2LdzNz1eceD4M7A8iz8KUGR6PJjEgX1TPkrR+oL7Z1aav11wPX Z2UAKQ45Uvd0ciwIgPYrXH81YW/I5Q0AH3jHMaGBF9s+1/mUrhTgeRDuMWuMslStkVGX1he4sYo VNrHY/7zYURPwehQ= X-Received: by 2002:adf:f9cd:: with SMTP id w13mr5939760wrr.406.1584543153462; Wed, 18 Mar 2020 07:52:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuUmz8/57Uw4aw1IQTwRRP/6nQMhyDB2w8+SLMXrLglpYQkR22PK+qh9rzEaeI4Xku2zmTPPw== X-Received: by 2002:adf:f9cd:: with SMTP id w13mr5939734wrr.406.1584543153168; Wed, 18 Mar 2020 07:52:33 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id u144sm2582331wmu.39.2020.03.18.07.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 07:52:32 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v4 4/5] KVM: Kick resamplefd for split kernel irqchip Date: Wed, 18 Mar 2020 10:52:03 -0400 Message-Id: <20200318145204.74483-5-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200318145204.74483-1-peterx@redhat.com> References: <20200318145204.74483-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: 63.128.21.74 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" 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 will 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. This is tricky because in this case the userspace ioapic irr & remote-irr will be bypassed. However such a change will greatly boost performance for assigned devices using INTx irqs (TCP_RR boosts 46% after this patch applied). When the userspace is responsible for the resamplefd kickup, don't register it on the kvm_irqfd anymore, because on newer kernels (after commit 654f1f13ea56, 5.2+) the KVM_IRQFD will fail if with both split irqchip and resamplefd. This will make sure that the fast path will work for all supported kernels. https://patchwork.kernel.org/patch/10738541/#22609933 Suggested-by: Paolo Bonzini Signed-off-by: Peter Xu --- accel/kvm/kvm-all.c | 79 ++++++++++++++++++++++++++++++++++++++++-- accel/kvm/trace-events | 1 + hw/intc/ioapic.c | 19 ++++++++++ include/sysemu/kvm.h | 4 +++ 4 files changed, 101 insertions(+), 2 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index d49b74512a..9a85fd1b8f 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -159,9 +159,59 @@ 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); + g_free(rfd); + 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; + + QLIST_FOREACH(rfd, &kvm_resample_fd_list, node) { + if (rfd->gsi == gsi) { + event_notifier_set(rfd->resample_event); + trace_kvm_resample_fd_notify(gsi); + return; + } + } +} + int kvm_get_max_memslots(void) { KVMState *s = KVM_STATE(current_accel()); @@ -1642,8 +1692,33 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, EventNotifier *event, }; if (rfd != -1) { - irqfd.flags |= KVM_IRQFD_FLAG_RESAMPLE; - irqfd.resamplefd = rfd; + assert(assign); + if (kvm_irqchip_is_split()) { + /* + * When the slow irqchip (e.g. IOAPIC) is in the + * userspace, KVM kernel resamplefd will not work because + * the EOI of the interrupt will be delivered to userspace + * instead, so the KVM kernel resamplefd kick will be + * skipped. The userspace here mimics what the kernel + * provides with resamplefd, remember the resamplefd and + * kick it when we receive EOI of this IRQ. + * + * This is hackery because IOAPIC is mostly bypassed + * (except EOI broadcasts) when irqfd is used. However + * this can bring much performance back for split irqchip + * with INTx IRQs (for VFIO, this gives 93% perf of the + * full fast path, which is 46% perf boost comparing to + * the INTx slow path). + */ + kvm_resample_fd_insert(virq, resample); + } else { + irqfd.flags |= KVM_IRQFD_FLAG_RESAMPLE; + irqfd.resamplefd = rfd; + } + } else if (!assign) { + if (kvm_irqchip_is_split()) { + 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..b9ec570c03 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -241,6 +241,25 @@ void ioapic_eoi_broadcast(int vector) continue; } +#ifdef CONFIG_KVM + /* + * When IOAPIC is in the userspace while APIC is still in + * the kernel (i.e., split irqchip), we have a trick to + * kick the resamplefd logic for registered irqfds from + * userspace to deactivate the IRQ. When that happens, it + * means the irq bypassed userspace IOAPIC (so the irr and + * remote-irr of the table entry should be bypassed too + * even if interrupt come). Still kick the resamplefds if + * they're bound to the IRQ, to make sure to EOI the + * interrupt for the hardware correctly. + * + * Note: We still need to go through the irr & remote-irr + * operations below because we don't know whether there're + * emulated devices that are using/sharing the same IRQ. + */ + kvm_resample_fd_notify(n); +#endif + if (!(entry & IOAPIC_LVT_REMOTE_IRR)) { continue; } diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 141342de98..583a976f8a 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 interrupts. */ +void kvm_resample_fd_notify(int gsi); + #endif From patchwork Wed Mar 18 14:52:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11445415 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 4538213B1 for ; Wed, 18 Mar 2020 14:55:00 +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 1B41720752 for ; Wed, 18 Mar 2020 14:55:00 +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="XVm3ArBC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B41720752 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]:51900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa5z-0004lJ-8y for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Mar 2020 10:54:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46484) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEa3p-00011e-K5 for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEa3o-0001V0-CC for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:45 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:44591) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEa3o-0001Ph-7i for qemu-devel@nongnu.org; Wed, 18 Mar 2020 10:52:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584543164; 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=b1oCVeZb++ei9QW/imFlLqu3DPHPBQd8uhwODtMq3p0=; b=XVm3ArBCmxADGEBRTjDfMgY5X+EUqv8Mv0vIuOqYmMRxRznyWlIAE05aVpe1OzkXsWcTMc FDx5lLKr8+Qpvm1TQykXdUGGpqRuM2w85hC/aV5wwWkT1bK9fj1E0OtqzGK4AxxuN2HpTo 5NXb7ZceFOQ3reQuj5XGUua/beBnhIc= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-YKd1cCIOMI25KgAS26AqAA-1; Wed, 18 Mar 2020 10:52:42 -0400 X-MC-Unique: YKd1cCIOMI25KgAS26AqAA-1 Received: by mail-wr1-f70.google.com with SMTP id i18so1381262wrx.17 for ; Wed, 18 Mar 2020 07:52:42 -0700 (PDT) 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=LHmsRV7ZmhvcUhHr2NAWuHWG1aMUUMRa55QpQL82/MA=; b=bXxPw7unoprC6yOuuPlmnUHfIqf7WM7vBxuL7qOQfERtBHRx19avwazQuWcK7pMlcx j9WLZ5bdEXhV7ju+veETsB1ZiXXhwCUNvYMTecG+AoO4HJUaKBnqXbZvX/MK10xDODoL VcrVb2wKm4RZTzX5o+1bbMZtILBsMgZyAJjonaamBkU6wIamMubEpXnDlaHcTKdWYqO5 QG2SHfLbgcee5cNjTZ9Z61bm3F52BKC2EfDqA4d6LI/qqMvTAfVFjHHvvbXA16BNiv2E x1MAtjayZhWPHfYFdVSmbGAy4g+WQWfaBBfMB0SHz5+MdqKLB+LGwKeWzm0fcuy7GG9T +NeQ== X-Gm-Message-State: ANhLgQ0NIQFOarluYP0FeMI9Uo1/HaibIUG1U6KfrwhMj+JND8JuH2Qn aiYFX3zXFRHozSsm7sPCS4fQ+IxR3PbI/KTEtRH3ro8jQ6EAGno8LsTXRF0F87O1HEJDy/EPRYI PwVIIO5CPkJhOZzc= X-Received: by 2002:a05:600c:298:: with SMTP id 24mr5654072wmk.70.1584543158118; Wed, 18 Mar 2020 07:52:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuuhoDMe3Dj7YmPnBNjuj0ZIW+mqZR9GgcG3sFIgixDMLhdnvvHk3AcJ4IzVse6RPUUgg7CGw== X-Received: by 2002:a05:600c:298:: with SMTP id 24mr5654060wmk.70.1584543157939; Wed, 18 Mar 2020 07:52:37 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id x17sm4215681wmi.28.2020.03.18.07.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 07:52:37 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v4 5/5] Revert "vfio/pci: Disable INTx fast path if using split irqchip" Date: Wed, 18 Mar 2020 10:52:04 -0400 Message-Id: <20200318145204.74483-6-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200318145204.74483-1-peterx@redhat.com> References: <20200318145204.74483-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] [fuzzy] X-Received-From: 216.205.24.74 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" 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. Reviewed-by: Eric Auger Reviewed-by: Alex Williamson Acked-by: Alex Williamson 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);