From patchwork Thu Aug 11 15:37:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinhao Fan X-Patchwork-Id: 12941564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C8008C19F2A for ; Thu, 11 Aug 2022 15:40:45 +0000 (UTC) Received: from localhost ([::1]:41434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMAIe-0005L5-Am for qemu-devel@archiver.kernel.org; Thu, 11 Aug 2022 11:40:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMAGJ-00033C-2l for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:38:19 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:49800 helo=cstnet.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMAGF-00023L-Pr for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:38:18 -0400 Received: from localhost.localdomain (unknown [159.226.43.62]) by APP-01 (Coremail) with SMTP id qwCowAA3GFlSIvViGUPiBw--.35837S2; Thu, 11 Aug 2022 23:38:00 +0800 (CST) From: Jinhao Fan To: qemu-devel@nongnu.org Cc: its@irrelevant.dk, kbusch@kernel.org, stefanha@gmail.com, Jinhao Fan Subject: [PATCH 0/4] hw/nvme: add irqfd support Date: Thu, 11 Aug 2022 23:37:35 +0800 Message-Id: <20220811153739.3079672-1-fanjinhao21s@ict.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: qwCowAA3GFlSIvViGUPiBw--.35837S2 X-Coremail-Antispam: 1UD129KBjvdXoW7XF4xJFyxZw45GF4DZFyrZwb_yoWDWFgE9F 10y34rC3WUXanayFyDWF17XryUKayrGw1Ut3WqqFy2qr409r98Wr1vyr1UZF48ZFW5Xr13 XryDJryrury2gjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbz8FF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Jr0_ Gr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWxJVW8Jr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxG rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26c xKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x02 67AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUoT5lUUUUU X-Originating-IP: [159.226.43.62] X-CM-SenderInfo: xidqyxpqkd0j0rv6xunwoduhdfq/ Received-SPF: pass client-ip=159.226.251.21; envelope-from=fanjinhao21s@ict.ac.cn; helo=cstnet.cn X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patch series changes qemu-nvme's interrupt emulation to use event notifiers, which can ensure thread-safe interrupt delivery when iothread is used. In the first two patches, I convert qemu-nvme's IO emulation logic to send irq via eventfd, so that the actual assertion and deassertion is always done in the main loop thread with BQL held. In the third patch, support is added to send irq via KVM irqfd, bypassing qemu's MSI-x emulation. In the last patch, I add MSI-x mask handlers when irqfd is enabled so that qemu-nvme knows which vector is masked even when qemu's MSI-x emulation is bypassed. Jinhao Fan (4): hw/nvme: avoid unnecessary call to irq (de)assertion functions hw/nvme: add option to (de)assert irq with eventfd hw/nvme: use irqfd to send interrupts hw/nvme: add MSI-x mask handlers for irqfd hw/nvme/ctrl.c | 251 +++++++++++++++++++++++++++++++++++++++---- hw/nvme/nvme.h | 7 ++ hw/nvme/trace-events | 3 + 3 files changed, 243 insertions(+), 18 deletions(-)