LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: PPC: Book3S HV: Free the queue pages in error path
@ 2026-09-17  7:28 Gautam Menghani
  2026-10-12  3:31 ` Madhavan Srinivasan
  0 siblings, 1 reply; 2+ messages in thread
From: Gautam Menghani @ 2026-09-17  7:28 UTC (permalink / raw)
  To: maddy, npiggin, mpe, chleroy, ritesh.list, sshegde
  Cc: linuxppc-dev, kvm, linux-kernel, Amit Machhiwal

If the xive_native_configure_queue() call fails, the qpage allocated is
not freed, which results in wasted memory. Fix this by freeing the qpage
in the error path.

Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
Reviewed-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
---
v2:
1. Move call to free_pages() after error message. (Amit)

 arch/powerpc/kvm/book3s_xive.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index 89a1b8c21ab4..0f8f851a3f8f 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -961,9 +961,11 @@ static int xive_provision_queue(struct kvm_vcpu *vcpu, u8 prio)
 	 */
 	rc = xive_native_configure_queue(xc->vp_id, q, prio, qpage,
 					 xive->q_order, true);
-	if (rc)
+	if (rc) {
 		pr_err("Failed to configure queue %d for VCPU %d\n",
 		       prio, xc->server_num);
+		free_pages((unsigned long)qpage, xive->q_page_order);
+	}
 	return rc;
 }
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] KVM: PPC: Book3S HV: Free the queue pages in error path
  2026-09-17  7:28 [PATCH v2] KVM: PPC: Book3S HV: Free the queue pages in error path Gautam Menghani
@ 2026-10-12  3:31 ` Madhavan Srinivasan
  0 siblings, 0 replies; 2+ messages in thread
From: Madhavan Srinivasan @ 2026-10-12  3:31 UTC (permalink / raw)
  To: npiggin, mpe, chleroy, ritesh.list, sshegde, Gautam Menghani
  Cc: linuxppc-dev, kvm, linux-kernel, Amit Machhiwal

On Thu, 17 Sep 2026 12:58:38 +0530, Gautam Menghani wrote:
> If the xive_native_configure_queue() call fails, the qpage allocated is
> not freed, which results in wasted memory. Fix this by freeing the qpage
> in the error path.
> 
> 

Applied to powerpc/next.

[1/1] KVM: PPC: Book3S HV: Free the queue pages in error path
      https://git.kernel.org/powerpc/c/daf5a5a82ca37ccf5b03c103ca44717b0b2f3e0b

cheers


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-12  3:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17  7:28 [PATCH v2] KVM: PPC: Book3S HV: Free the queue pages in error path Gautam Menghani
2026-10-12  3:31 ` Madhavan Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox