Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217563/?format=api
{ "id": 2217563, "url": "http://patchwork.ozlabs.org/api/patches/2217563/?format=api", "web_url": "http://patchwork.ozlabs.org/project/kvm-riscv/patch/202603301610527120YZ-pAJY6x9SBpSRo1Wg4@zte.com.cn/", "project": { "id": 70, "url": "http://patchwork.ozlabs.org/api/projects/70/?format=api", "name": "Linux KVM RISC-V", "link_name": "kvm-riscv", "list_id": "kvm-riscv.lists.infradead.org", "list_email": "kvm-riscv@lists.infradead.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "http://lists.infradead.org/pipermail/kvm-riscv/", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<202603301610527120YZ-pAJY6x9SBpSRo1Wg4@zte.com.cn>", "list_archive_url": null, "date": "2026-03-30T08:10:52", "name": "[v4,1/2] RISC-V: KVM: Fix lost write protection on huge pages during dirty logging", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "631434764d9afb1c82276ca84cfe95d0736ac8e9", "submitter": { "id": 91800, "url": "http://patchwork.ozlabs.org/api/people/91800/?format=api", "name": "", "email": "wang.yechao255@zte.com.cn" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/kvm-riscv/patch/202603301610527120YZ-pAJY6x9SBpSRo1Wg4@zte.com.cn/mbox/", "series": [ { "id": 497970, "url": "http://patchwork.ozlabs.org/api/series/497970/?format=api", "web_url": "http://patchwork.ozlabs.org/project/kvm-riscv/list/?series=497970", "date": "2026-03-30T08:08:17", "name": "RISC-V: KVM: Fix hugepage mapping handling during dirty logging", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/497970/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217563/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217563/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=tAHvIT0/;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fkkV11FNBz1xrn\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 19:11:21 +1100 (AEDT)", "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w77iR-0000000Ap46-2W5y;\n\tMon, 30 Mar 2026 08:11:19 +0000", "from mxct.zte.com.cn ([183.62.165.209])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w77iO-0000000Ap3d-0I1P;\n\tMon, 30 Mar 2026 08:11:17 +0000", "from mse-fl1.zte.com.cn (unknown [10.5.228.132])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby mxct.zte.com.cn (FangMail) with ESMTPS id 4fkkTZ4XM2z4xQXF;\n\tMon, 30 Mar 2026 16:10:58 +0800 (CST)", "from szxlzmapp03.zte.com.cn ([10.5.231.207])\n\tby mse-fl1.zte.com.cn with SMTP id 62U8AoVV052344;\n\tMon, 30 Mar 2026 16:10:50 +0800 (+08)\n\t(envelope-from wang.yechao255@zte.com.cn)", "from mapi (szxlzmapp03[null])\n\tby mapi (Zmail) with MAPI id mid12;\n\tMon, 30 Mar 2026 16:10:52 +0800 (CST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Mime-Version:Date:\n\tReferences:In-Reply-To:Message-ID:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=f/AFahk29Dwg3ocbPjTu4DEPALl7SAUIDefXtELIIKs=; b=tAHvIT0/Wfeiwz\n\tDthfj7kjYNhdFEBQFEQOJ0XCYBnuQ24AjE8zyMSRHqfWagdxtRoncQLSDzYpHcGcDsqIMuU9R2R6j\n\tc7w/YGCtBbr3emHI8hAb4zR+YNQvH/dOZhojROIX3yEoFUgFVy5Dio2vlkCW+zE8Ejst7dMDfmspx\n\tqsi04Jm0uQYBY2HD1MJrAxRcYWFmkkQxY1EjwGTaZcuqs35cQQCnQnbFWsTimjloaCQBHny8aQ7oM\n\tAtpCp7829K4ZFw6EH/vA7Rzl5Bm9WkPmRsIg8EFQ5NalslAelKwWYHFlmlQFKzfv8F7mWMEOVWMfs\n\tjQ8jOrxzAORoU+RMzsaA==;", "X-Zmail-TransId": "2b0569ca300cccd-3bc1a", "X-Mailer": "Zmail v1.0", "Message-ID": "<202603301610527120YZ-pAJY6x9SBpSRo1Wg4@zte.com.cn>", "In-Reply-To": "<202603301608170032mtkGKX7wRcAkPKDQ5I-F@zte.com.cn>", "References": "202603301608170032mtkGKX7wRcAkPKDQ5I-F@zte.com.cn", "Date": "Mon, 30 Mar 2026 16:10:52 +0800 (CST)", "Mime-Version": "1.0", "From": "<wang.yechao255@zte.com.cn>", "To": "<anup@brainfault.org>, <atish.patra@linux.dev>, <pjw@kernel.org>,\n <palmer@dabbelt.com>, <aou@eecs.berkeley.edu>, <alex@ghiti.fr>", "Cc": "<kvm@vger.kernel.org>, <kvm-riscv@lists.infradead.org>,\n <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,\n <wang.yechao255@zte.com.cn>", "Subject": "=?utf-8?q?=5BPATCH_v4_1/2=5D_RISC-V=3A_KVM=3A_Fix_lost_write_protec?=\n\t=?utf-8?q?tion_on_huge_pages_during_dirty_logging?=", "X-MAIL": "mse-fl1.zte.com.cn 62U8AoVV052344", "X-TLS": "YES", "X-SPF-DOMAIN": "zte.com.cn", "X-ENVELOPE-SENDER": "wang.yechao255@zte.com.cn", "X-SPF": "None", "X-SOURCE-IP": "10.5.228.132 unknown Mon, 30 Mar 2026 16:10:58 +0800", "X-Fangmail-Anti-Spam-Filtered": "true", "X-Fangmail-MID-QID": "69CA3012.001/4fkkTZ4XM2z4xQXF", "X-Bad-Reply": "References and In-Reply-To but no 'Re:' in Subject.", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20260330_011116_665347_A6B0CA02 ", "X-CRM114-Status": "UNSURE ( 9.97 )", "X-CRM114-Notice": "Please train this message.", "X-Spam-Score": "-2.2 (--)", "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam. The original\n message has been attached to this so you can view it or label\n similar future email. If you have any questions, see\n the administrator of that system for details.\n Content preview: From: Wang Yechao <wang.yechao255@zte.com.cn> When enabling\n dirty log in small chunks (e.g., QEMU default chunk size of 256K),\n the chunk\n size is always smaller than the page size of huge pages (1G or 2M) used in\n the gstage page tables. This cause [...]\n Content analysis details: (-2.2 points, 5.0 required)\n pts rule name description\n ---- ----------------------\n --------------------------------------------------\n -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/,\n medium trust\n [183.62.165.209 listed in list.dnswl.org]\n 1.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The\n query to Validity was blocked. See\n https://knowledge.validity.com/hc/en-us/articles/20961730681243\n for more information.\n [183.62.165.209 listed in\n sa-trusted.bondedsender.org]\n 1.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n Validity was blocked. See\n https://knowledge.validity.com/hc/en-us/articles/20961730681243\n for more information.\n [183.62.165.209 listed in sa-accredit.habeas.com]\n 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record\n -0.0 SPF_PASS SPF: sender matches SPF record\n -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n [score: 0.0000]\n -1.0 RCVD_IN_MSPIKE_H5 RBL: Excellent reputation (+5)\n [183.62.165.209 listed in wl.mailspike.net]\n 1.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n Validity was blocked. See\n https://knowledge.validity.com/hc/en-us/articles/20961730681243\n for more information.\n [183.62.165.209 listed in\n bl.score.senderscore.com]\n -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders\n 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay\n lines", "X-BeenThere": "kvm-riscv@lists.infradead.org", "X-Mailman-Version": "2.1.34", "Precedence": "list", "List-Id": "<kvm-riscv.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/kvm-riscv/>", "List-Post": "<mailto:kvm-riscv@lists.infradead.org>", "List-Help": "<mailto:kvm-riscv-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"kvm-riscv\" <kvm-riscv-bounces@lists.infradead.org>", "Errors-To": "kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "From: Wang Yechao <wang.yechao255@zte.com.cn>\n\nWhen enabling dirty log in small chunks (e.g., QEMU default chunk\nsize of 256K), the chunk size is always smaller than the page size\nof huge pages (1G or 2M) used in the gstage page tables. This caused\nthe write protection to be incorrectly skipped for huge PTEs because\nthe condition `(end - addr) >= page_size` was not satisfied.\n\nRemove the size check in `kvm_riscv_gstage_wp_range()` to ensure huge\nPTEs are always write-protected regardless of the chunk size. Additionally,\nexplicitly align the address down to the page size before invoking\n`kvm_riscv_gstage_op_pte()` to guarantee that the address passed to the\noperation function is page-aligned.\n\nThis fixes the issue where dirty pages might not be tracked correctly\nwhen using huge pages.\n\nFixes: 9d05c1fee837 (\"RISC-V: KVM: Implement stage2 page table programming\")\nSigned-off-by: Wang Yechao <wang.yechao255@zte.com.cn>\nReviewed-by: Nutty Liu <nutty.liu@hotmail.com>\nReviewed-by: Anup Patel <anup@brainfault.org>\n---\n arch/riscv/kvm/gstage.c | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)", "diff": "diff --git a/arch/riscv/kvm/gstage.c b/arch/riscv/kvm/gstage.c\nindex b67d60d722c2..d2001d508046 100644\n--- a/arch/riscv/kvm/gstage.c\n+++ b/arch/riscv/kvm/gstage.c\n@@ -304,10 +304,9 @@ void kvm_riscv_gstage_wp_range(struct kvm_gstage *gstage, gpa_t start, gpa_t end\n \t\tif (!found_leaf)\n \t\t\tgoto next;\n\n-\t\tif (!(addr & (page_size - 1)) && ((end - addr) >= page_size))\n-\t\t\tkvm_riscv_gstage_op_pte(gstage, addr, ptep,\n-\t\t\t\t\t\tptep_level, GSTAGE_OP_WP);\n-\n+\t\taddr = ALIGN_DOWN(addr, page_size);\n+\t\tkvm_riscv_gstage_op_pte(gstage, addr, ptep,\n+\t\t\t\t\tptep_level, GSTAGE_OP_WP);\n next:\n \t\taddr += page_size;\n \t}\n", "prefixes": [ "v4", "1/2" ] }