From: Haren Myneni <haren@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
msuchanek@suse.de, mahesh@linux.ibm.com, tyreld@linux.ibm.com,
hbabu@us.ibm.com, haren@linux.ibm.com, shashank.gowda@in.ibm.com,
bjking1@linux.ibm.com
Subject: [PATCH v7 6/9] powerpc/pseries: Wakeup hvpipe FD when the payload is pending
Date: Tue, 9 Sep 2025 01:43:58 -0700 [thread overview]
Message-ID: <20250909084402.1488456-7-haren@linux.ibm.com> (raw)
In-Reply-To: <20250909084402.1488456-1-haren@linux.ibm.com>
The user space polls on the wait_queue for the payload from the
specific source. The hypervisor interrupts the OS when the pipe
status for the specific source is changed such as payload is
available for the partition or pipe to the source is closed. The
OS retrieves the HVPIPE event message with check-exception RTAS
and event message contains the source ID and the pipe status.
Then wakes up all FDs waiting on the wait_queue so that the user
space can read the payload or close the FD if the pipe to source
in the hypervisor is closed.
The hypervisor assigns one pipe per partition for all sources.
Hence issue ibm,receive-hvpipe-msg() to read the pending
payload during release() before closing FD so that pipe to the
partition will not be blocked.
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Tested-by: Shashank MS <shashank.gowda@in.ibm.com>
---
arch/powerpc/platforms/pseries/papr-hvpipe.c | 28 +++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c
index 87deb429b331..4a1444a0d331 100644
--- a/arch/powerpc/platforms/pseries/papr-hvpipe.c
+++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c
@@ -396,6 +396,21 @@ static __poll_t papr_hvpipe_handle_poll(struct file *filp,
if (!src_info)
return POLLNVAL;
+ /*
+ * If hvpipe already has pending payload, return so that
+ * the user space can issue read().
+ */
+ if (src_info->hvpipe_status)
+ return POLLIN | POLLRDNORM;
+
+ /*
+ * Wait for the message event
+ * hvpipe_event_interrupt() wakes up this wait_queue
+ */
+ poll_wait(filp, &src_info->recv_wqh, wait);
+ if (src_info->hvpipe_status)
+ return POLLIN | POLLRDNORM;
+
return 0;
}
@@ -413,7 +428,18 @@ static int papr_hvpipe_handle_release(struct inode *inode,
src_info = file->private_data;
list_del(&src_info->list);
file->private_data = NULL;
- spin_unlock(&hvpipe_src_list_lock);
+ /*
+ * If the pipe for this specific source has any pending
+ * payload, issue recv HVPIPE RTAS so that pipe will not
+ * be blocked.
+ */
+ if (src_info->hvpipe_status & HVPIPE_MSG_AVAILABLE) {
+ src_info->hvpipe_status = 0;
+ spin_unlock(&hvpipe_src_list_lock);
+ hvpipe_rtas_recv_msg(NULL, 0);
+ } else
+ spin_unlock(&hvpipe_src_list_lock);
+
kfree(src_info);
return 0;
}
--
2.50.1
next prev parent reply other threads:[~2025-09-09 8:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 8:43 [PATCH v7 0/9] powerpc/pseries: Add hypervisor pipe (HVPIPE) suport Haren Myneni
2025-09-09 8:43 ` [PATCH v7 1/9] powerpc/pseries: Define papr-hvpipe ioctl Haren Myneni
2025-09-09 8:43 ` [PATCH v7 2/9] powerpc/pseries: Define HVPIPE specific macros Haren Myneni
2025-09-09 8:43 ` [PATCH v7 3/9] powerpc/pseries: Add papr-hvpipe char driver for HVPIPE interfaces Haren Myneni
2025-09-09 8:43 ` [PATCH v7 4/9] powerpc/pseries: Send payload with ibm,send-hvpipe-msg RTAS Haren Myneni
2025-09-09 8:43 ` [PATCH v7 5/9] powerpc/pseries: Receive payload with ibm,receive-hvpipe-msg RTAS Haren Myneni
2025-09-09 8:43 ` Haren Myneni [this message]
2025-09-09 8:43 ` [PATCH v7 7/9] powerpc/pseries: Enable HVPIPE event message interrupt Haren Myneni
2025-09-09 8:44 ` [PATCH v7 8/9] powerpc/pseries: Enable hvpipe with ibm,set-system-parameter RTAS Haren Myneni
2025-09-09 8:44 ` [PATCH v7 9/9] powerpc/pseries: HVPIPE changes to support migration Haren Myneni
2025-09-22 5:43 ` [PATCH v7 0/9] powerpc/pseries: Add hypervisor pipe (HVPIPE) suport Madhavan Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250909084402.1488456-7-haren@linux.ibm.com \
--to=haren@linux.ibm.com \
--cc=bjking1@linux.ibm.com \
--cc=hbabu@us.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mahesh@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=msuchanek@suse.de \
--cc=npiggin@gmail.com \
--cc=shashank.gowda@in.ibm.com \
--cc=tyreld@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).