From nobody Fri May 3 21:27:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.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=1658323292; cv=none; d=zohomail.com; s=zohoarc; b=CClc2dWxXy2kW8KsHlIp6e97GIJqzzKbohT9TXCLblTHM/oNSxVgw/JjObhDm6IB1dtbnDQ9yv3jYUn18gAvcdtZfM1SxaMYCrVZ9flQHS/ywKcjmWgQ8yYVJzXYLDgpe44d/GKfOQg9MwkmEsVRCIHDf7bbBXrVS348ju5JG3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658323292; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=WB7AjBFpxbPyIt68k2WOGFm/ddCuQ7C7mlAeuukxxgE=; b=QJ+e4dV/bBK6VW75oMlCn3lhvKvkqZTxzby8+CWBhLMY07a2dZVEb5lcB1GcjY4v1yQmqrCtWr7J8Gvl40fuuLSb8z/B6I+zq/uPDE1l+f657WOpWOvJhuQN60PUuh/XdBELmhD/UvKEY9A2lMqzAUtJtE3bm5Zt/t+yhwJQyfU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658323292028682.3527319665335; Wed, 20 Jul 2022 06:21:32 -0700 (PDT) Received: from localhost ([::1]:46192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oE9dq-0008VX-UJ for importer@patchew.org; Wed, 20 Jul 2022 09:21:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oE7eO-0002GG-9b for qemu-devel@nongnu.org; Wed, 20 Jul 2022 07:13:56 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:37820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oE7eL-0007ji-H7 for qemu-devel@nongnu.org; Wed, 20 Jul 2022 07:13:55 -0400 Received: by mail-pj1-x1032.google.com with SMTP id s18-20020a17090aa11200b001f1e9e2438cso1729838pjp.2 for ; Wed, 20 Jul 2022 04:13:52 -0700 (PDT) Received: from ake-x260.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id a16-20020a170902ecd000b0016c20d40ee7sm13757800plh.174.2022.07.20.04.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 04:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WB7AjBFpxbPyIt68k2WOGFm/ddCuQ7C7mlAeuukxxgE=; b=1zEszvBv4N43Apc7fo9vf3ArMnrvEOyHvQqZ/c9/wiRezJFWQl8YcWPCWaqKbjXBCv gywiuHui36mY6aNnIx1A7Dh+tqcghsKQQgrqKH+cRyEx+/F7dCDnEPRvjA3eJ7Qwce6M 3DSglhWQEMByilQvOVaOHo/3N5aeKoxFhwwkYspRzTWhcNv5OYL604E7msdfhPJl7jTE KQf8x/Cz0aMADHYcr8sFsv6fa5g/jyp09sGex9jT7iuk8p0hWNVkTgQJbyF/GmREqdVP IcRGSNRrzVP6PAMOL9WzORfiKhCm0N+nl04+UnYhsXvki7zlxoKngkPtxMTkdaZiRkwY Yx6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WB7AjBFpxbPyIt68k2WOGFm/ddCuQ7C7mlAeuukxxgE=; b=sWsv0KQUNAFR8np3Z8Z3lqxAwUfVPE+3gfdzc372ZV3mKyU2GGLBjkClimm+qiSzYx hxcpQ1t8/mIqCAtwJK8rDrD3eE62zRfysttW/M9Gpf0qXD7wCyLSawg5YQ0/Kb/X2gjv QkDFBfiJ0ycqLJHDL3rx69TnFJe+hS7vZhiZpKvpRgvR3YEdMeI8EUR1oV+Ea+JkqOBj KSUU+Mi67sovxjCmlTlAch2BnDnvxmXwae506OUGdPwlmsMADA5duRFsH8grxU65vrCt 3vDLrqwO2r7Z0bTwlk7OzyAkg4P7Hj7sVO9qg9+RzQjJJa6gIr2Nn5NwHus4Rhx2aoT5 I3tw== X-Gm-Message-State: AJIora/nolkbpXMXdOopJl++Df/YdN/rKcJqYxbUrwUa73Rk9skvWaa7 E14bI0sqwzqMfsotFyd+kgYrWBEDoCBgK/T9 X-Google-Smtp-Source: AGRyM1tRAoEk4dyBuqJ42n6gXvqFc2Bgbm9PSQWgrcCXvjyalOs4CzmXAO4MWTi2kNqWz1JaQZm0/w== X-Received: by 2002:a17:90b:1b48:b0:1ef:a90d:eae1 with SMTP id nv8-20020a17090b1b4800b001efa90deae1mr4828436pjb.68.1658315631281; Wed, 20 Jul 2022 04:13:51 -0700 (PDT) From: Ake Koomsin To: qemu-devel@nongnu.org Cc: Dmitry Fleytman , Jason Wang , Ake Koomsin Subject: [PATCH] e1000e: Fix possible interrupt loss when using MSI Date: Wed, 20 Jul 2022 20:13:03 +0900 Message-Id: <20220720111303.10628-1-ake@igel.co.jp> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=ake@igel.co.jp; helo=mail-pj1-x1032.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 20 Jul 2022 09:17:32 -0400 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @igel-co-jp.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1658323293917100001 Content-Type: text/plain; charset="utf-8" Commit "e1000e: Prevent MSI/MSI-X storms" introduced msi_causes_pending to prevent interrupt storms problem. It was tested with MSI-X. In case of MSI, the guest can rely solely on interrupts to clear ICR. Upon clearing all pending interrupts, msi_causes_pending gets cleared. However, when e1000e_itr_should_postpone() in e1000e_send_msi() returns true, MSI never gets fired by e1000e_intrmgr_on_throttling_timer() because msi_causes_pending is still set. This results in interrupt loss. To prevent this, we need to clear msi_causes_pending when MSI is going to get fired by the throttling timer. The guest can then receive interrupts eventually. Signed-off-by: Ake Koomsin --- hw/net/e1000e_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 2c51089a82..208e3e0d79 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -159,6 +159,8 @@ e1000e_intrmgr_on_throttling_timer(void *opaque) =20 if (msi_enabled(timer->core->owner)) { trace_e1000e_irq_msi_notify_postponed(); + /* Clear msi_causes_pending to fire MSI eventually */ + timer->core->msi_causes_pending =3D 0; e1000e_set_interrupt_cause(timer->core, 0); } else { trace_e1000e_irq_legacy_notify_postponed(); --=20 2.25.1