2019-08-21 14:39:46

by Paul E. McKenney

[permalink] [raw]
Subject: Re: memory-barriers.txt questions

On Wed, Aug 21, 2019 at 04:24:42PM +0200, Bj?rn T?pel wrote:
> Paul,
>
> Reaching out directly, hope that's OK!

Adding LKML on CC, hope that's OK!

> >From memory-barriers.txt (what an excellent document. I've read it
> over and over, and never get all the details. :-)):
> --8<--
> MISCELLANEOUS FUNCTIONS
> -----------------------
>
> Other functions that imply barriers:
>
> (*) schedule() and similar imply full memory barriers.
> -->8--
>
> The "and similar" part puzzles me. IPI is a a full barrier on all
> platforms (I think). Are interrupts in general full barriers? What
> more?

Functions similar to schedule() include schedule_user(),
schedule_preempt_disabled(), preempt_schedule(), preempt_schedule_irq(),
and so on. Plus any function that calls one of these functions.

Interrupts are quite architecture specific, and on many architectures an
interrupt does not imply any sort of cross-CPU ordering in and of itself.
So you would need to inspect the interrupt-entry/-exit code to see if
the needed full memory-barrier instructions were in place to answer
this question.

But what are you trying to achieve?

Thanx, Paul