Skip to content

Commit 6768da8

Browse files
author
Mamatha Inamdar
committed
powerpc/pseries: Wakeup hvpipe FD when the payload is pending
JIRA: https://issues.redhat.com/browse/RHEL-101849 commit da24fb9 Author: Haren Myneni <haren@linux.ibm.com> Date: Tue Sep 9 01:43:58 2025 -0700 powerpc/pseries: Wakeup hvpipe FD when the payload is pending 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> Tested-by: Shashank MS <shashank.gowda@in.ibm.com> Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com> Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20250909084402.1488456-7-haren@linux.ibm.com Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
1 parent cfdd96c commit 6768da8

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

arch/powerpc/platforms/pseries/papr-hvpipe.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,21 @@ static __poll_t papr_hvpipe_handle_poll(struct file *filp,
396396
if (!src_info)
397397
return POLLNVAL;
398398

399+
/*
400+
* If hvpipe already has pending payload, return so that
401+
* the user space can issue read().
402+
*/
403+
if (src_info->hvpipe_status)
404+
return POLLIN | POLLRDNORM;
405+
406+
/*
407+
* Wait for the message event
408+
* hvpipe_event_interrupt() wakes up this wait_queue
409+
*/
410+
poll_wait(filp, &src_info->recv_wqh, wait);
411+
if (src_info->hvpipe_status)
412+
return POLLIN | POLLRDNORM;
413+
399414
return 0;
400415
}
401416

@@ -413,7 +428,18 @@ static int papr_hvpipe_handle_release(struct inode *inode,
413428
src_info = file->private_data;
414429
list_del(&src_info->list);
415430
file->private_data = NULL;
416-
spin_unlock(&hvpipe_src_list_lock);
431+
/*
432+
* If the pipe for this specific source has any pending
433+
* payload, issue recv HVPIPE RTAS so that pipe will not
434+
* be blocked.
435+
*/
436+
if (src_info->hvpipe_status & HVPIPE_MSG_AVAILABLE) {
437+
src_info->hvpipe_status = 0;
438+
spin_unlock(&hvpipe_src_list_lock);
439+
hvpipe_rtas_recv_msg(NULL, 0);
440+
} else
441+
spin_unlock(&hvpipe_src_list_lock);
442+
417443
kfree(src_info);
418444
return 0;
419445
}

0 commit comments

Comments
 (0)