[PATCH 06/14] powerpc/vas: Setup fault handler per VAS instance

Christoph Hellwig hch at infradead.org
Wed Nov 27 19:34:47 AEDT 2019


>  
> +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.


More information about the Linuxppc-dev mailing list