Re: [PATCH 06/14] powerpc/vas: Setup fault handler per VAS instance
From: Christoph Hellwig <hch@infradead.org>
Date: 2019-11-27 08:34:49
Also in:
linux-devicetree
From: Christoph Hellwig <hch@infradead.org>
Date: 2019-11-27 08:34:49
Also in:
linux-devicetree
+struct task_struct *fault_handler;
+
+void vas_wakeup_fault_handler(int virq, void *arg)
+{
+ struct vas_instance *vinst = arg;
+
+ atomic_inc(&vinst->pending_fault);
+ wake_up(&vinst->fault_wq);
+}
+
+/*
+ * Fault handler thread for each VAS instance and process fault CRBs.
+ */
+static int fault_handler_func(void *arg)
+{
+ struct vas_instance *vinst = (struct vas_instance *)arg;
+
+ do {
+ if (signal_pending(current))
+ flush_signals(current);
+
+ wait_event_interruptible(vinst->fault_wq,
+ atomic_read(&vinst->pending_fault) ||
+ kthread_should_stop());
+
+ if (kthread_should_stop())
+ break;
+
+ atomic_dec(&vinst->pending_fault);
+ } while (!kthread_should_stop());
+
+ return 0;
+}Pleae use threaded interrupts instead of reinventing them badly.