data dependency naming inconsistency
Hello Paul, all!
I've been reading with interest Paul's posts about Rust interactions with LKMM
https://paulmck.livejournal.com/63316.html
and in particular it states:
A data dependency involves a load whose return value directly or
indirectly determine the value stored by a later store, which results in the load being ordered before the store.
This matches the perf book:
A data dependency occurs when the value returned by a load instruction is used to compute the data stored by a later store instruction.
however, memory-barriers.txt states:
A data dependency barrier is a partial ordering on interdependent loads only; it is not required to have any effect on stores, independent loads or overlapping loads.
It also says:
A data-dependency barrier is not required to order dependent writes because the CPUs that the Linux kernel supports don't do writes until they are certain (1) that the write will actually happen, (2) of the location of the write, and (3) of the value to be written.
so the result it the same: writes are ordered without a barrier, reads are ordered by a barrier.
However, it would seem that a bit more consistency in naming won't hurt.
Thanks,
Signature · 1 line
MST
Quoted 1 line · Michael S. Tsirkin
Hello Paul, all!
Hello Michael,
I thought Paul would respond soon, but looks like he has not done so.
So, I'm trying to give some hint to your findings.
Quoted 11 lines
I've been reading with interest Paul's posts about Rust interactions with LKMM
https://paulmck.livejournal.com/63316.html
and in particular it states:
A data dependency involves a load whose return value directly or
indirectly determine the value stored by a later store, which results in the load being ordered before the store.This matches the perf book:
A data dependency occurs when the value returned by a load instruction is used to compute the data stored by a later store instruction.
You might likely be aware, but these concern "data dependency", not a _barrier_.
Quoted 7 lines
however, memory-barriers.txt states:
A data dependency barrier is a partial ordering on interdependent loads only; it is not required to have any effect on stores, independent loads or overlapping loads.
Quoted 5 lines
It also says:
A data-dependency barrier is not required to order dependent writes because the CPUs that the Linux kernel supports don't do writes until they are certain (1) that the write will actually happen, (2) of the location of the write, and (3) of the value to be written.
These concern the historic "data-dependency barrier", or [smp_]read_barrier_depends(), which existed until Linux kernel v4.14.
Quoted 6 lines
so the result it the same: writes are ordered without a barrier, reads are ordered by a barrier.
However, it would seem that a bit more consistency in naming won't hurt.
So, I don't think the historic term of "data-dependency barrier" can be changed.
I guess the right approach would be to further de-emphasize "data-dependency barrier"/"data dependency barrier" in memory-barriers.txt.
Rewrite by commit 8ca924aeb4f2 ("Documentation/barriers: Remove references to [smp_]read_barrier_depends()") did some of such changes, but it failed to update the introductory section of "VARIETIES OF MEMORY BARRIER".
The part Michael quoted above belongs to it.
I don't think it has any merit keeping it around.
Also, there remain a couple of ascii-art diagrams concerning <data dependency barrier> in the first part of "EXAMPLES OF MEMORY BARRIER SEQUENCES" section, which, I think, can be removed as well.
Hope this helps clarify the circumstances.
Paul, what is your take on the naming of "data dependency"/ "data dependency barrier"?
Thanks, Akira
Quoted 5 lines
Thanks,
Signature · 1 line
MST
Quoted 61 lines · Akira Yokosawa
Quoted 1 line · Michael S. Tsirkin
Hello Paul, all!
Hello Michael,
I thought Paul would respond soon, but looks like he has not done so.
So, I'm trying to give some hint to your findings.Quoted 11 lines
I've been reading with interest Paul's posts about Rust interactions with LKMM
https://paulmck.livejournal.com/63316.html
and in particular it states:
A data dependency involves a load whose return value directly or
indirectly determine the value stored by a later store, which results in the load being ordered before the store.This matches the perf book:
A data dependency occurs when the value returned by a load instruction is used to compute the data stored by a later store instruction.You might likely be aware, but these concern "data dependency", not a _barrier_.
Quoted 7 lines
however, memory-barriers.txt states:
A data dependency barrier is a partial ordering on interdependent loads only; it is not required to have any effect on stores, independent loads or overlapping loads.
Quoted 5 lines
It also says:
A data-dependency barrier is not required to order dependent writes because the CPUs that the Linux kernel supports don't do writes until they are certain (1) that the write will actually happen, (2) of the location of the write, and (3) of the value to be written.These concern the historic "data-dependency barrier", or [smp_]read_barrier_depends(), which existed until Linux kernel v4.14.
Quoted 6 lines
so the result it the same: writes are ordered without a barrier, reads are ordered by a barrier.
However, it would seem that a bit more consistency in naming won't hurt.
So, I don't think the historic term of "data-dependency barrier" can be changed.
I guess the right approach would be to further de-emphasize "data-dependency barrier"/"data dependency barrier" in memory-barriers.txt.
Rewrite by commit
8ca924aeb4f2("Documentation/barriers: Remove references to [smp_]read_barrier_depends()") did some of such changes, but it failed to update the introductory section of "VARIETIES OF MEMORY BARRIER".
The part Michael quoted above belongs to it.
I don't think it has any merit keeping it around.
Quoted 5 lines
Also, there remain a couple of ascii-art diagrams concerning <data dependency barrier> in the first part of "EXAMPLES OF MEMORY BARRIER SEQUENCES" section, which, I think, can be removed as well.
Hope this helps clarify the circumstances.
It does, thanks! It might be worth adding a sentence along the lines of
"NB: a data dependency barrier is distinct from a data dependency: it's a barrier that used to be required in the presence of a data dependency. Since v4.14 Linux no longer offers an API for a data dependency barrier. Instead, using READ_ONCE is sufficient for ordering in the presence of a data dependency".
Quoted 10 lines
Paul, what is your take on the naming of "data dependency"/ "data dependency barrier"?
Thanks, Akira
Quoted 5 lines
Thanks,
Signature · 1 line
MST
[-CC akys: my 2nd address]
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Akira Yokosawa
Quoted 1 line · Michael S. Tsirkin
Hello Paul, all!
Hello Michael,
I thought Paul would respond soon, but looks like he has not done so.
So, I'm trying to give some hint to your findings.Quoted 11 lines
I've been reading with interest Paul's posts about Rust interactions with LKMM
https://paulmck.livejournal.com/63316.html
and in particular it states:
A data dependency involves a load whose return value directly or
indirectly determine the value stored by a later store, which results in the load being ordered before the store.This matches the perf book:
A data dependency occurs when the value returned by a load instruction is used to compute the data stored by a later store instruction.You might likely be aware, but these concern "data dependency", not a _barrier_.
Quoted 7 lines
however, memory-barriers.txt states:
A data dependency barrier is a partial ordering on interdependent loads only; it is not required to have any effect on stores, independent loads or overlapping loads.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
It also says:
A data-dependency barrier is not required to order dependent writes because the CPUs that the Linux kernel supports don't do writes until they are certain (1) that the write will actually happen, (2) of the location of the write, and (3) of the value to be written.These concern the historic "data-dependency barrier", or [smp_]read_barrier_depends(), which existed until Linux kernel v4.14.
Ah... I should have said ", which existed prior to Linux kernel v4.15". This invited off-by-one error below...
Quoted 26 lines
Quoted 26 lines
Quoted 7 lines
so the result it the same: writes are ordered without a barrier, reads are ordered by a barrier.
However, it would seem that a bit more consistency in naming won't hurt.
So, I don't think the historic term of "data-dependency barrier" can be changed.
I guess the right approach would be to further de-emphasize "data-dependency barrier"/"data dependency barrier" in memory-barriers.txt.
Rewrite by commit
8ca924aeb4f2("Documentation/barriers: Remove references to [smp_]read_barrier_depends()") did some of such changes, but it failed to update the introductory section of "VARIETIES OF MEMORY BARRIER".
The part Michael quoted above belongs to it.
I don't think it has any merit keeping it around.Also, there remain a couple of ascii-art diagrams concerning <data dependency barrier> in the first part of "EXAMPLES OF MEMORY BARRIER SEQUENCES" section, which, I think, can be removed as well.
Quoted 7 lines
Quoted 1 line
Hope this helps clarify the circumstances.
It does, thanks! It might be worth adding a sentence along the lines of
"NB: a data dependency barrier is distinct from a data dependency: it's a barrier that used to be required in the presence of a data dependency. Since v4.14 Linux no longer offers an API for a data dependency barrier.
Since v4.15
Quoted 2 lines
Instead, using
READ_ONCEis sufficient for ordering in the presence of a data dependency".
Maybe.
But I'm more inclined to get rid of remaining contents related to the "data dependency barrier".
Thanks, Akira
Quoted 13 lines
Quoted 12 lines
Paul, what is your take on the naming of "data dependency"/ "data dependency barrier"?
Thanks, Akira
Quoted 5 lines
Thanks,
Signature · 1 line
MST
Quoted 4 lines
But I'm more inclined to get rid of remaining contents related to the "data dependency barrier".
Thanks, Akira
That's an option, too.
Signature · 1 line
MST
Quoted 10 lines · Akira Yokosawa
[-CC akys: my 2nd address]
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Akira Yokosawa
Quoted 1 line · Michael S. Tsirkin
Hello Paul, all!
Hello Michael,
I thought Paul would respond soon, but looks like he has not done so.
This is because Michael used Paul's old email address.
Forwarding to his current address.
Paul, you can see the thread at the lore archive:
https://lore.kernel.org/lkml/[email protected]/T/
Thanks, Akira
Quoted 96 lines
Quoted 24 lines
Quoted 24 lines
So, I'm trying to give some hint to your findings.
Quoted 11 lines
I've been reading with interest Paul's posts about Rust interactions with LKMM
https://paulmck.livejournal.com/63316.html
and in particular it states:
A data dependency involves a load whose return value directly or
indirectly determine the value stored by a later store, which results in the load being ordered before the store.This matches the perf book:
A data dependency occurs when the value returned by a load instruction is used to compute the data stored by a later store instruction.You might likely be aware, but these concern "data dependency", not a _barrier_.
Quoted 7 lines
however, memory-barriers.txt states:
A data dependency barrier is a partial ordering on interdependent loads only; it is not required to have any effect on stores, independent loads or overlapping loads.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
It also says:
A data-dependency barrier is not required to order dependent writes because the CPUs that the Linux kernel supports don't do writes until they are certain (1) that the write will actually happen, (2) of the location of the write, and (3) of the value to be written.These concern the historic "data-dependency barrier", or [smp_]read_barrier_depends(), which existed until Linux kernel v4.14.
Ah... I should have said ", which existed prior to Linux kernel v4.15". This invited off-by-one error below...
Quoted 26 lines
Quoted 26 lines
Quoted 7 lines
so the result it the same: writes are ordered without a barrier, reads are ordered by a barrier.
However, it would seem that a bit more consistency in naming won't hurt.
So, I don't think the historic term of "data-dependency barrier" can be changed.
I guess the right approach would be to further de-emphasize "data-dependency barrier"/"data dependency barrier" in memory-barriers.txt.
Rewrite by commit
8ca924aeb4f2("Documentation/barriers: Remove references to [smp_]read_barrier_depends()") did some of such changes, but it failed to update the introductory section of "VARIETIES OF MEMORY BARRIER".
The part Michael quoted above belongs to it.
I don't think it has any merit keeping it around.Also, there remain a couple of ascii-art diagrams concerning <data dependency barrier> in the first part of "EXAMPLES OF MEMORY BARRIER SEQUENCES" section, which, I think, can be removed as well.
Quoted 7 lines
Quoted 1 line
Hope this helps clarify the circumstances.
It does, thanks! It might be worth adding a sentence along the lines of
"NB: a data dependency barrier is distinct from a data dependency: it's a barrier that used to be required in the presence of a data dependency. Since v4.14 Linux no longer offers an API for a data dependency barrier.
Since v4.15
Quoted 2 lines
Instead, using
READ_ONCEis sufficient for ordering in the presence of a data dependency".Maybe.
But I'm more inclined to get rid of remaining contents related to the "data dependency barrier".
Thanks, Akira
Quoted 13 lines
Quoted 12 lines
Paul, what is your take on the naming of "data dependency"/ "data dependency barrier"?
Thanks, Akira
Quoted 5 lines
Thanks,
Signature · 1 line
MST
Quoted 5 lines · Akira Yokosawa
Quoted 4 lines · Akira Yokosawa
[-CC akys: my 2nd address]
Quoted 2 lines · Michael S. Tsirkin
Quoted 1 line · Akira Yokosawa
On Mon, 11 Oct 2021 07:07:08 -0400, Michael S. Tsirkin wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Hello Paul, all!
Hello Michael,
I thought Paul would respond soon, but looks like he has not done so.
This is because Michael used Paul's old email address.
Indeed, my ibm.com email addresses died about two years ago.
Quoted 4 lines
Forwarding to his current address.
Paul, you can see the thread at the lore archive:
https://lore.kernel.org/lkml/[email protected]/T/
And thank you for forwarding this.
Quoted 25 lines
Thanks, Akira
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
So, I'm trying to give some hint to your findings.
Quoted 11 lines
I've been reading with interest Paul's posts about Rust interactions with LKMM
https://paulmck.livejournal.com/63316.html
and in particular it states:
A data dependency involves a load whose return value directly or
indirectly determine the value stored by a later store, which results in the load being ordered before the store.This matches the perf book:
A data dependency occurs when the value returned by a load instruction is used to compute the data stored by a later store instruction.You might likely be aware, but these concern "data dependency", not a _barrier_.
Quoted 6 lines
however, memory-barriers.txt states:
A data dependency barrier is a partial ordering on interdependent loads only; it is not required to have any effect on stores, independent loads or overlapping loads.
As noted by others, the difference is that the first two are about a data dependency, that is a prior load affecting the value stored by a later store. In contrast, the last one is about a data-dependency barrier, which need only affect trailing loads. Trailing stores are already covered by control dependencies. But clearer wording might be good. Suggestions?
Quoted 48 lines
Quoted 48 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
It also says:
A data-dependency barrier is not required to order dependent writes because the CPUs that the Linux kernel supports don't do writes until they are certain (1) that the write will actually happen, (2) of the location of the write, and (3) of the value to be written.These concern the historic "data-dependency barrier", or [smp_]read_barrier_depends(), which existed until Linux kernel v4.14.
Ah... I should have said ", which existed prior to Linux kernel v4.15". This invited off-by-one error below...
Quoted 26 lines
Quoted 26 lines
Quoted 7 lines
so the result it the same: writes are ordered without a barrier, reads are ordered by a barrier.
However, it would seem that a bit more consistency in naming won't hurt.
So, I don't think the historic term of "data-dependency barrier" can be changed.
I guess the right approach would be to further de-emphasize "data-dependency barrier"/"data dependency barrier" in memory-barriers.txt.
Rewrite by commit
8ca924aeb4f2("Documentation/barriers: Remove references to [smp_]read_barrier_depends()") did some of such changes, but it failed to update the introductory section of "VARIETIES OF MEMORY BARRIER".
The part Michael quoted above belongs to it.
I don't think it has any merit keeping it around.Also, there remain a couple of ascii-art diagrams concerning <data dependency barrier> in the first part of "EXAMPLES OF MEMORY BARRIER SEQUENCES" section, which, I think, can be removed as well.
Quoted 7 lines
Quoted 1 line
Hope this helps clarify the circumstances.
It does, thanks! It might be worth adding a sentence along the lines of
"NB: a data dependency barrier is distinct from a data dependency: it's a barrier that used to be required in the presence of a data dependency. Since v4.14 Linux no longer offers an API for a data dependency barrier.
Since v4.15
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Instead, using
READ_ONCEis sufficient for ordering in the presence of a data dependency".Maybe.
But I'm more inclined to get rid of remaining contents related to the "data dependency barrier".
Given that we don't seem to have any more data-dependency barriers, so getting rid of remaining mentions makes a lot of sense to me.
Thanx, Paul
Quoted 15 lines
Quoted 15 lines
Thanks, Akira
Quoted 13 lines
Quoted 12 lines
Paul, what is your take on the naming of "data dependency"/ "data dependency barrier"?
Thanks, Akira
Quoted 5 lines
Thanks,
Signature · 1 line
MST