From nobody Wed May 8 01:33:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1554819477; cv=none; d=zoho.com; s=zohoarc; b=U0iaWl2vS93pA5hcdldHxYIg6mdQUYc+9rUY9B7N2yMvKhJMmIJlsDEXyhKCgDZTePknhVdreQH3i1+p7Xp1GJwsMyOqtNfz8NOwDorrncoY3w48ONLIgPXFqpczkmPVbpePVtXbw9wwA/AKTkoyk1BQGytcNokQ0IYFfc44V1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554819477; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=MsZEZUW0rRarU3zg/hdNbmy1SXjNCqVojgILaJS0ttM=; b=CmUPWWQdVH5Z3uXS9zkUFcfPkzdcyxmCjpuHh9D5pt+QQjZgTSkd2kv0sKIAQCUmx2Q73MPow+KtiaxEXouvaLk2+aZ8f/v5NbIIfEUmCg5TPt1gWsiO7aRFbPlmDDGZaeZCTv8f8Y1RUj7gnsQEOGWA9PIlGrSfEl7pg0gSWmk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=null header.from= header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554819477776862.3679855558336; Tue, 9 Apr 2019 07:17:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:42377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDrZI-00075x-JG for importer@patchew.org; Tue, 09 Apr 2019 10:17:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDrY1-0006Tu-DV for qemu-devel@nongnu.org; Tue, 09 Apr 2019 10:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDrY0-0001iN-A9 for qemu-devel@nongnu.org; Tue, 09 Apr 2019 10:16:25 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33392 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDrXz-0001Zk-NF for qemu-devel@nongnu.org; Tue, 09 Apr 2019 10:16:24 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6E8EC8F02F61C763DB8E; Tue, 9 Apr 2019 22:16:16 +0800 (CST) Received: from localhost (10.177.21.2) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Tue, 9 Apr 2019 22:16:08 +0800 From: Zhuangyanying To: , Date: Tue, 9 Apr 2019 14:14:56 +0000 Message-ID: <1554819296-14960-1-git-send-email-ann.zhuangyanying@huawei.com> X-Mailer: git-send-email 2.6.4.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.21.2] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 45.249.212.32 Subject: [Qemu-devel] [PATCH] msix: fix interrupt aggregation problem at the passthrough of NVMe SSD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arei.gonglei@huawei.com, qemu-devel@nongnu.org, Zhuang Yanying Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhuang Yanying Recently I tested the performance of NVMe SSD passthrough and found that in= terrupts were aggregated on vcpu0(or the first vcpu of each numa) by /proc/interrupt= s,when GuestOS was upgraded to sles12sp3 (or redhat7.6). But /proc/irq/X/smp_affin= ity_list shows that the interrupt is spread out, such as 0-10, 11-21,.... and so on. This problem cannot be resolved by "echo X > /proc/irq/X/smp_affinity_list"= , because the NVMe SSD interrupt is requested by the API pci_alloc_irq_vectors(), so = the interrupt has the IRQD_AFFINITY_MANAGED flag. GuestOS sles12sp3 backport "automatic interrupt affinity for MSI/MSI-X capa= ble devices", but the implementation of __setup_irq has no corresponding modification. It= is still irq_startup(), then setup_affinity(), that is sending an affinity message w= hen the interrupt is unmasked. The bare metal configuration is successful, but qemu= will not trigger the msix update, and the affinity configuration fails. The affinity is configured by /proc/irq/X/smp_affinity_list, implemented at apic_ack_edge(), the bitmap is stored in pending_mask, mask->__pci_write_msi_msg()->unmask, and the timing is guaranteed, and the configuration takes effect. The GuestOS linux-master incorporates the "genirq/cpuhotplug: Enforce affin= ity setting on startup of managed irqs" to ensure that the affinity is first is= sued and then __irq_startup(), for the managerred interrupt. So configuration is successful. It now looks like sles12sp3 (up to sles15sp1, linux-4.12.x), redhat7.6 (3.10.0-957.10.1) does not have backport the patch yet. "if (is_masked =3D=3D was_masked) return;" can it be removed at qemu? What is the reason for this check? Signed-off-by: Zhuang Yanying --- hw/pci/msix.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/pci/msix.c b/hw/pci/msix.c index 4e33641..e1ff533 100644 --- a/hw/pci/msix.c +++ b/hw/pci/msix.c @@ -119,10 +119,6 @@ static void msix_handle_mask_update(PCIDevice *dev, in= t vector, bool was_masked) { bool is_masked =3D msix_is_masked(dev, vector); =20 - if (is_masked =3D=3D was_masked) { - return; - } - msix_fire_vector_notifier(dev, vector, is_masked); =20 if (!is_masked && msix_is_pending(dev, vector)) { --=20 1.8.3.1