rtas_log_poll() sleeps the poller on rtas_log_wait, which the blocking
read sleeps on as well. procfs owns the queue poll() uses now, so leave
the poll_wait() to it and wake its pollers along with the readers.

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 arch/powerpc/kernel/rtasd.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
index 360ed2e30fd5..fa9574131f40 100644
--- a/arch/powerpc/kernel/rtasd.c
+++ b/arch/powerpc/kernel/rtasd.c
@@ -33,6 +33,7 @@
 static DEFINE_SPINLOCK(rtasd_log_lock);
 
 static DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait);
+static struct proc_dir_entry *rtas_log_entry;
 
 static char *rtas_log_buf;
 static unsigned long rtas_log_start;
@@ -259,6 +260,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, 
int fatal)
                WARN_ON_ONCE(!irqs_disabled()); /* @@@ DEBUG @@@ */
                spin_unlock_irqrestore(&rtasd_log_lock, s);
                wake_up_interruptible(&rtas_log_wait);
+               proc_poll_notify(rtas_log_entry);
                break;
        case ERR_TYPE_KERNEL_PANIC:
        default:
@@ -343,7 +345,6 @@ out:
 
 static __poll_t rtas_log_poll(struct file *file, poll_table * wait)
 {
-       poll_wait(file, &rtas_log_wait, wait);
        if (rtas_log_size)
                return EPOLLIN | EPOLLRDNORM;
        return 0;
@@ -529,17 +530,15 @@ arch_initcall(rtas_event_scan_init);
 
 static int __init rtas_init(void)
 {
-       struct proc_dir_entry *entry;
-
        if (!machine_is(pseries) && !machine_is(chrp))
                return 0;
 
        if (!rtas_log_buf)
                return -ENODEV;
 
-       entry = proc_create("powerpc/rtas/error_log", 0400, NULL,
-                           &rtas_log_proc_ops);
-       if (!entry)
+       rtas_log_entry = proc_create("powerpc/rtas/error_log", 0400, NULL,
+                                    &rtas_log_proc_ops);
+       if (!rtas_log_entry)
                printk(KERN_ERR "Failed to create error_log proc entry\n");
 
        return 0;

-- 
2.53.0


Reply via email to