{"id":2235288,"url":"http://patchwork.ozlabs.org/api/patches/2235288/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260509024539.90998-3-guobin@linux.alibaba.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260509024539.90998-3-guobin@linux.alibaba.com>","list_archive_url":null,"date":"2026-05-09T02:45:39","name":"[2/2] kvm: fix kvm_irqchip_release_virq loop after swap-remove","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c714bc21a3e98d1bbb002fab5152ce88937be254","submitter":{"id":91693,"url":"http://patchwork.ozlabs.org/api/people/91693/?format=json","name":"Bin Guo","email":"guobin@linux.alibaba.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260509024539.90998-3-guobin@linux.alibaba.com/mbox/","series":[{"id":503478,"url":"http://patchwork.ozlabs.org/api/series/503478/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=503478","date":"2026-05-09T02:45:38","name":"kvm: minor cleanups in kvm_close and kvm_irqchip_release_virq","version":1,"mbox":"http://patchwork.ozlabs.org/series/503478/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2235288/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2235288/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com\n header.a=rsa-sha256 header.s=default header.b=mhlyFTt7;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gC9PP6vl6z1yMt\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 09 May 2026 12:47:04 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wLXi6-0007ti-9F; Fri, 08 May 2026 22:46:34 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <guobin@linux.alibaba.com>)\n id 1wLXhj-0007sW-R8\n for qemu-devel@nongnu.org; Fri, 08 May 2026 22:46:16 -0400","from out30-97.freemail.mail.aliyun.com ([115.124.30.97])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <guobin@linux.alibaba.com>)\n id 1wLXhg-0003Cp-T7\n for qemu-devel@nongnu.org; Fri, 08 May 2026 22:46:11 -0400","from localhost(mailfrom:guobin@linux.alibaba.com\n fp:SMTPD_---0X2Z4CJH_1778294755 cluster:ay36) by smtp.aliyun-inc.com;\n Sat, 09 May 2026 10:46:01 +0800"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linux.alibaba.com; s=default;\n t=1778294761; h=From:To:Subject:Date:Message-ID:MIME-Version;\n bh=bOHocsDjBbGwePHYMHf0XP/MmULd8FxzUFtMETBjpTg=;\n b=mhlyFTt7mQJTflIDK6VsjxnLBHECPgoegRyHOayuazip2kIf2i01YWdl0gByYce3xJSdgbRigkPwCdNGXVPBJQxR2YGNsZWr68kNQqHhTXZGpeMBrF9pSKywddCB0wxivLblgzWFS7Ce4lf/NwVEREIvpBejhPAruqr0JEoZn/4=","X-Alimail-AntiSpam":"AC=PASS; BC=-1|-1; BR=01201311R101e4; CH=green;\n DM=||false|;\n DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=maildocker-contentspam033037033178;\n MF=guobin@linux.alibaba.com; NM=1; PH=DS; RN=3; SR=0;\n TI=SMTPD_---0X2Z4CJH_1778294755;","From":"Bin Guo <guobin@linux.alibaba.com>","To":"qemu-devel@nongnu.org","Cc":"pbonzini@redhat.com,\n\tkvm@vger.kernel.org","Subject":"[PATCH 2/2] kvm: fix kvm_irqchip_release_virq loop after swap-remove","Date":"Sat,  9 May 2026 10:45:39 +0800","Message-ID":"<20260509024539.90998-3-guobin@linux.alibaba.com>","X-Mailer":"git-send-email 2.50.1","In-Reply-To":"<20260509024539.90998-1-guobin@linux.alibaba.com>","References":"<20260509024539.90998-1-guobin@linux.alibaba.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=115.124.30.97;\n envelope-from=guobin@linux.alibaba.com;\n helo=out30-97.freemail.mail.aliyun.com","X-Spam_score_int":"-174","X-Spam_score":"-17.5","X-Spam_bar":"-----------------","X-Spam_report":"(-17.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,\n UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5,\n USER_IN_DEF_SPF_WL=-7.5 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":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"In kvm_irqchip_release_virq(), when an entry matching the target GSI is\nfound, the code removes it by swapping in the last entry:\n\n    s->irq_routes->nr--;\n    *e = s->irq_routes->entries[s->irq_routes->nr];\n\nHowever, the loop then increments `i` unconditionally, which means the\nnewly-swapped entry at position `i` is never re-checked. If that entry\nalso has `gsi == virq`, it will be skipped and left in the routing\ntable.\n\nFix this by decrementing `i` after the swap, so the same index is\nre-examined in the next iteration.\n\nSigned-off-by: Bin Guo <guobin@linux.alibaba.com>\n---\n accel/kvm/kvm-all.c | 1 +\n 1 file changed, 1 insertion(+)","diff":"diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c\nindex 70bc2c86a2..3c5b62c97e 100644\n--- a/accel/kvm/kvm-all.c\n+++ b/accel/kvm/kvm-all.c\n@@ -2278,6 +2278,7 @@ void kvm_irqchip_release_virq(KVMState *s, int virq)\n         if (e->gsi == virq) {\n             s->irq_routes->nr--;\n             *e = s->irq_routes->entries[s->irq_routes->nr];\n+            i--;\n         }\n     }\n     clear_gsi(s, virq);\n","prefixes":["2/2"]}