Re: [RFC][PATCH v2 10/10] irq_work: Add a few comments

From: Randy Dunlap
Date: Tue Aug 18 2020 - 11:53:40 EST


Hi Peter,

a few typos below...

On 8/18/20 3:51 AM, Peter Zijlstra wrote:
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> include/linux/irq_work.h | 80 +++++++++++++++++++++++++++++++++++++++++------
> kernel/irq_work.c | 10 +++++
> 2 files changed, 80 insertions(+), 10 deletions(-)
>
> --- a/include/linux/irq_work.h
> +++ b/include/linux/irq_work.h


> @@ -48,12 +47,45 @@ static inline bool irq_work_is_busy(stru
>
> #ifdef CONFIG_IRQ_WORK
>
> +/*
> + * irq_work_queue(): run @work in IRQ context on this CPU
> + * @work: work to run
> + *
> + * Self-IPI, NMI-safe
> + *
> + * When the function returns false; @work is already queued and
> + * any eventual execution of it's func() is guaranteed to see

its

> + * any state before the failing enqueue.
> + */
> bool irq_work_queue(struct irq_work *work);
> +
> +/*
> + * irq_work_queue_on(): run @work in IRQ context on @cpu
> + * @work: work to run
> + * @cpu: cpu to run @work on
> + *
> + * *NOT* NMI-safe
> + *
> + * When the function returns false; @work is already queued and

false,

> + * any eventual execution of it's func() is guaranteed to see

its

> + * any state before the failing enqueue.
> + */

> @@ -67,8 +99,36 @@ static inline bool irq_work_needs_cpu(vo

> +/*
> + * irq_work_queue_remote_state(): like irq_work_queue_remote() except dangerous
> + * @cpu:
> + * @work:
> + *
> + * DO NOT USE, this function is horrible/dangerous.
> + *
> + * The test-and-set-PENDING is not atomic, it also doesn't set
> + * the BUSY bit and with that breaks irq_work_sync().
> + *
> + * This means that the caller needs external serialization; life-time,
> + * where relevant, also needs to be externally orchestated.

orchestrated.

> + *
> + * There is no validation/debugging to help you if you get it wrong.
> + */
> extern int irq_work_queue_remote_static(int cpu, struct irq_work *work);
> +
> extern void irq_work_single(void *arg);
> #endif
>


--
~Randy