From nobody Mon Apr 29 01:45:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543187117972730.1238949702672; Sun, 25 Nov 2018 15:05:17 -0800 (PST) Received: from localhost ([::1]:33398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gR3Sc-0007Yo-Av for importer@patchew.org; Sun, 25 Nov 2018 18:05:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gR3Re-0007FK-3k for qemu-devel@nongnu.org; Sun, 25 Nov 2018 18:04:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gR3Rc-0001zu-Uo for qemu-devel@nongnu.org; Sun, 25 Nov 2018 18:04:06 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:39129) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gR3Ra-0001yV-5c; Sun, 25 Nov 2018 18:04:02 -0500 Received: by mail-pl1-x643.google.com with SMTP id 101so6635295pld.6; Sun, 25 Nov 2018 15:03:59 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id l16sm59364967pfg.161.2018.11.25.15.03.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 15:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=CJweXxiKgoQ8l5NrOBq3FAZ8bG9yUbfcRILellV7qVw=; b=LKDIefFkUDYNcLCIVHKqUSTUlViddv4ZYoOd+LFgvdbIiOH/z4hQPao5U2H4jeUECw Wo14EMWkNUsxwohfP8gGCcnHEBnyfYrgVjf0pUdRfNlmYqhngH7yHvGX5qKbFtjOtjxT 7smD5dfVTkklDV+ETVlj8NQnUIoH0RAn0kuk0Zja6HaosrkbQqo8NKY9sOVi8m5VReYZ kfXriyb0DatPtm9QoEmE12rB5xlEJnNNf6nZDE52FaE7yXG0YpJKYrHfAtaIiz7Mdsf7 oNtGh5JmQycD5ODkR+B7hhOdm4W51zXfSb3q004/Mg0U1ehyB13sHa76jIEJueoZ5qAz VNUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=CJweXxiKgoQ8l5NrOBq3FAZ8bG9yUbfcRILellV7qVw=; b=ZyRClQz9rXRv2nIuficvvKxGHcjt1vNc0f2vVDxGbeiW1nZHVWO//bkb1eTtnyXJDt iPg8SNPWt1N/J6BJ1YrEr3KHGa4EJVn7SNjd+zQWfVDql/Ic8io+fvnVs8+spc/UIEjH THKof0Yjgp7/7DdT2HCffw4anJX7HoJ6lJjxigXbWEhllnqggOejTFvuxPxEcMm92OKd GJ/1U9CvKSgu5V967EI5z49IIo7w+hjrO8QY1pmEqNzBGhEqlXFVlTBrk2hAnxMbbB3Y tv2CD6XIJDV0AwJkbSteN7MqptWIRBhqjWWa+N8DCAChxng39zxrV2OG/pb9EDqvO2EA WmSw== X-Gm-Message-State: AA+aEWZQReq8GJ3MmBAHgKAdUY+WvYgwwSmKPFyddvcTvj2MwELD3bll EHCTSDN7xOc4WHxpJO/rnkU= X-Google-Smtp-Source: AFSGD/WP5J+yXN9Z9hqkWzh7G8S6VduDfzm/jMFySdzphl4oOGh5YWnfMIpeqHfO1Rxu66it1UR4kQ== X-Received: by 2002:a17:902:b112:: with SMTP id q18mr8439844plr.255.1543187038257; Sun, 25 Nov 2018 15:03:58 -0800 (PST) From: Guenter Roeck To: Keith Busch Date: Sun, 25 Nov 2018 15:03:55 -0800 Message-Id: <1543187035-32757-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH] nvme: Only generate interupt if warranted 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: Kevin Wolf , Guenter Roeck , qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" So far the code generates interrupts even if it doesn't pass any new information to the user. This can result in spurious interrupts as sometimes observed with Linux. Only generate interrupts if warranted, ie if anything new is passed to the emulated code. Signed-off-by: Guenter Roeck --- hw/block/nvme.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 9fbe567..c543c01 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -252,6 +252,7 @@ static void nvme_post_cqes(void *opaque) NvmeCQueue *cq =3D opaque; NvmeCtrl *n =3D cq->ctrl; NvmeRequest *req, *next; + bool assert_irq =3D false; =20 QTAILQ_FOREACH_SAFE(req, &cq->req_list, entry, next) { NvmeSQueue *sq; @@ -271,8 +272,11 @@ static void nvme_post_cqes(void *opaque) pci_dma_write(&n->parent_obj, addr, (void *)&req->cqe, sizeof(req->cqe)); QTAILQ_INSERT_TAIL(&sq->req_list, req, entry); + assert_irq =3D true; + } + if (assert_irq) { + nvme_irq_assert(n, cq); } - nvme_irq_assert(n, cq); } =20 static void nvme_enqueue_req_completion(NvmeCQueue *cq, NvmeRequest *req) --=20 2.7.4