bib/hw: Improve looks of WilliamGWong2019CCIX-CXL's title
PATCH 1/3 bib/hw: Improve looks of WilliamGWong2019CCIX-CXL's title
Also avoid the UTF-8 encoded symbol of "…". \ldots looks close enough to the title of the web page.
--- bib/hw.bib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bib/hw.bib +1 -1
@@ -1025,7 +1025,7 @@ Luis Stevens and Anoop Gupta and John Hennessy", @unpublished{WilliamGWong2019CCIX-CXL, Author="William G. Wong", - Title="VHS or Betamax…CCIX or CXL…So Many Choices", + Title="{VHS} or {Betamax} \ldots\ {CCIX} or {CXL} \ldots\ So Many Choices", month="March", day="14", year="2019",
Signature · 1 line
2.17.1
PATCH 2/3 together/refcnt: Adjust tense with 'have released'
---
Paul,
This is in your recent update.
The former part of "or" says "both CPUs have released ...", so the latter part should say "(both CPUs have) exited ...", I suppose.
"or have exited" might be the right fix, but it sounds redundant to me. Up to you!
Thanks, Akira
--
together/refcnt.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
together/refcnt.tex +1 -1
@@ -257,7 +257,7 @@ and any needed memory barriers or disabling of compiler optimizations will be provided by the hazard-pointers or RCU infrastructure. Therefore, if two CPUs release the final two references concurrently, the actual cleanup will be deferred until both CPUs have released their hazard -pointers or exits their RCU read-side critical sections, respectively. +pointers or exited their RCU read-side critical sections, respectively. \QuickQuiz{ Why isn't it necessary to guard against cases where one CPU
Signature · 1 line
2.17.1
Re: [PATCH 2/3 -perfbook] together/refcnt: Adjust tense with 'have released'
Quoted 10 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>---
Paul,This is in your recent update.
The former part of "or" says "both CPUs have released ...", so the latter part should say "(both CPUs have) exited ...", I suppose."or have exited" might be the right fix, but it sounds redundant to me. Up to you!
In this case, what you have works fine. The reason that it works is because there is only the four words "released their hazard pointers" between "both CPUs have" and "exited their...". If there was instead a long run of text instead of just four words, repeating the "both CPUs have" would be a good way of helping the reader to make the connection across that long run of text.
I took all three patches, all good catches! My eyes apparently are not as young as they once were, so thank you very much!!!
Thanx, Paul
Quoted 22 lines
Thanks, Akira
--together/refcnt.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)together/refcnt.tex +1
-1@@ -257,7 +257,7 @@ and any needed memory barriers or disabling of compiler optimizations will be provided by the hazard-pointers or RCU infrastructure. Therefore, if two CPUs release the final two references concurrently, the actual cleanup will be deferred until both CPUs have released their hazard -pointers or exits their RCU read-side critical sections, respectively. +pointers or exited their RCU read-side critical sections, respectively. \QuickQuiz{ Why isn't it necessary to guard against cases where one CPUSignature · 1 line
2.17.1
PATCH 3/3 debugging: Fix typo
In reply to Akira Yokosawa--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
debugging/debugging.tex +1 -1
@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgive
Signature · 1 line
2.17.1
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0
debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgive
Paul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
Thanks, Akira
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
Quoted 29 lines · Akira Yokosawa
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgivePaul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
Quoted 5 lines
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
How about like the following?
Thanx, Paul
------------------------------------------------------------------------
commit da6dcf306cf2eb05324c306bbed230cc543fc426
Author: Paul E. McKenney <[email protected]> Date: Sat Mar 20 12:21:07 2021 -0700
toolsoftrade,glossary: Explain data races
While in the area, make the cases of index entries consistent, fixing my copy-pasta from the glossary entry.
glossary.tex +33 -12
@@ -38,13 +38,13 @@ is atomic, because other CPUs will see either the old value or the new value, but are guaranteed not to see some mixed value containing some pieces of the new and old values. -\item[Atomic Read-Modify-Write Operation:]\index{Atomic Read-Modify-Write Operation} +\item[Atomic Read-Modify-Write Operation:]\index{Atomic read-modify-write operation} An atomic operation that both reads and writes memory is considered an atomic read-modify-write operation, or atomic RMW operation for short. Although the value written usually depends on the value read, \co{atomic_xchg()} is the exception that proves this rule. -\item[Bounded Wait Free:]\index{Bounded Wait Free} +\item[Bounded Wait Free:]\index{Bounded wait free} A forward-progress guarantee in which every thread makes progress within a specific finite period of time, the specific time being the bound.
@@ -126,7 +126,7 @@ \item[Capacity Miss:]\index{Capacity miss} A cache miss incurred because the corresponding CPU has recently accessed more data than will fit into the cache. -\item[Clash Free:]\index{Clash Free} +\item[Clash Free:]\index{Clash free} A forward-progress guarantee in which, in the absence of contention, at least one thread makes progress within a finite period of time.
@@ -170,7 +170,16 @@ increasing numbers of CPUs as the number of instances of data grows. Contrast with ``code locking''. -\item[Deadlock Free:]\index{Deadlock Free} +\item[Data Race:]\index{Data race} + A race condition in which several CPUs or threads access + a variable concurrently, and in which at least one of those + accesses is a store and at least one of those accesses + is unmarked. + It is important to note that while the presence of data races + often indicates the presence of bugs, the absence of data races + in no way implies the absence of bugs. + (See ``Marked access''.) +\item[Deadlock Free:]\index{Deadlock free} A forward-progress guarantee in which, in the absence of failures, at least one thread makes progress within a finite period of time.
@@ -226,7 +235,7 @@ Since RCU read-side critical sections by definition cannot contain quiescent states, these two definitions are almost always interchangeable. -\item[Hazard Pointer:]\index{Hazard Pointer} +\item[Hazard Pointer:]\index{Hazard pointer} A scalable counterpart to a reference counter in which an object's reference count is represented implicitly by a count of the number of special hazard pointers referencing that object.
@@ -284,9 +293,21 @@ used so heavily that there is often a CPU waiting on it. Reducing lock contention is often a concern when designing parallel algorithms and when implementing parallel programs. -\item[Lock Free:]\index{Lock Free} +\item[Lock Free:]\index{Lock free} A forward-progress guarantee in which at least one thread makes progress within a finite period of time. +\item[Marked Access:]\index{Marked access} + A source-code memory access that uses a special function or + macro, such as \co{READ_ONCE()}, \co{WRITE_ONCE()}, + \co{atomic_inc()}, and so on, in order to protect that access + from compiler and/or hardware optimizations. + In contrast, an unmarked access simply mentions the name of + the object being accessed, so that in the following, line~2 + is the unmarked equivalent of line~1: + \begin{VerbatimN} + WRITE_ONCE(a, READ_ONCE(b) + READ_ONCE(c)); + a = b + c; + \end{VerbatimN} \item[Memory:]\index{Memory} From the viewpoint of memory models, the main memory, caches, and store buffers in which values might be stored.
@@ -345,7 +366,7 @@ \item[NUMA Node:]\index{NUMA node} A group of closely placed CPUs and associated memory within a larger NUMA machines. -\item[Obstruction Free:]\index{Obstruction Free} +\item[Obstruction Free:]\index{Obstruction free} A forward-progress guarantee in which, in the absence of contention, every thread makes progress within a finite period of time.
@@ -428,7 +449,7 @@ wait for the writer to release the lock. A key concern for reader-writer locks is ``fairness'': can an unending stream of readers starve a writer or vice versa. -\item[Real Time:]\index{Real Time} +\item[Real Time:]\index{Real time} A situation in which getting the correct result is not sufficient, but where this result must also be obtained within a given amount of time.
@@ -437,7 +458,7 @@ additional resources. For parallel computing, the additional resources are usually additional CPUs. -\item[Sequence Lock:]\index{Sequence Lock} +\item[Sequence Lock:]\index{Sequence lock} A reader-writer synchronization mechanism in which readers retry their operations if a writer was present. \item[Sequential Consistency:]\index{Sequential consistency}
@@ -445,7 +466,7 @@ in an order consistent with a single global order, and where each CPU's memory references appear to all CPUs to occur in program order. -\item[Starvation Free:]\index{Starvation Free} +\item[Starvation Free:]\index{Starvation free} A forward-progress guarantee in which, in the absence of failures, every thread makes progress within a finite period of time.
@@ -483,7 +504,7 @@ they understand completely and are therefore comfortable teaching. \item[Throughput:]\index{Throughput} A performance metric featuring work items completed per unit time. -\item[Transactional Lock Elision (TLE):]\index{Transactional Lock Elision (TLE)} +\item[Transactional Lock Elision (TLE):]\index{Transactional lock elision (TLE)} The use of transactional memory to emulate locking. Synchronization is instead carried out by conflicting accesses to the data to be protected by the lock.
@@ -503,7 +524,7 @@ In the 1960s through the 1980s, only supercomputers had vector capabilities, but the advent of MMX in x86 CPUs and VMX in PowerPC CPUs brought vector processing to the masses. -\item[Wait Free:]\index{Wait Free} +\item[Wait Free:]\index{Wait free} A forward-progress guarantee in which every thread makes progress within a finite period of time. \item[Write Miss:]\index{Write miss}
toolsoftrade/toolsoftrade.tex +9 -1
@@ -397,12 +397,20 @@ Note that this program carefully makes sure that only one of the threads stores a value to variable \co{x} at a time. Any situation in which one thread might be storing a value to a given variable while some other thread either loads from or stores to that -same variable is termed a ``data race''. +same variable is termed a \emph{data race}. Because the C language makes no guarantee that the results of a data race will be in any way reasonable, we need some way of safely accessing and modifying data concurrently, such as the locking primitives discussed in the following section. +But your data races are benign, you say? +Well, maybe they are. +But please do everyone (yourself included) a big favor and read +\cref{sec:toolsoftrade:Shared-Variable Shenanigans} +very carefully. +As compilers optimize more and more aggressively, there are fewer and +fewer truly benign data races. + \QuickQuiz{ If the C language makes no guarantees in presence of a data race, then why does the Linux kernel have so many data races?
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
Quoted 30 lines · Paul E. McKenney
Quoted 29 lines · Akira Yokosawa
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgivePaul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
Quoted 7 lines
Quoted 5 lines
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
How about like the following?
Looks good to me!
Note on the index entry:
My experiment on the way to annotate index entries can manage automatic capitalization of only the first letter in indexed words/terms. So you won't need to take care of them.
And I'll get rid of direct uses of \index{} macro.
Will start rebasing those experiment soon after the release of second edition.
Thanks, Akira
Quoted 177 lines
Thanx, Paul
------------------------------------------------------------------------
commit
da6dcf306cf2eb05324c306bbed230cc543fc426Author: Paul E. McKenney <[email protected]> Date: Sat Mar 20 12:21:07 2021 -0700toolsoftrade,glossary: Explain data races
While in the area, make the cases of index entries consistent, fixing my copy-pasta from the glossary entry.
Reported-by Akira Yokosawa <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>glossary.tex +33
-12@@ -38,13 +38,13 @@ is atomic, because other CPUs will see either the old value or the new value, but are guaranteed not to see some mixed value containing some pieces of the new and old values. -\item[Atomic Read-Modify-Write Operation:]\index{Atomic Read-Modify-Write Operation} +\item[Atomic Read-Modify-Write Operation:]\index{Atomic read-modify-write operation} An atomic operation that both reads and writes memory is considered an atomic read-modify-write operation, or atomic RMW operation for short. Although the value written usually depends on the value read, \co{atomic_xchg()} is the exception that proves this rule. -\item[Bounded Wait Free:]\index{Bounded Wait Free} +\item[Bounded Wait Free:]\index{Bounded wait free} A forward-progress guarantee in which every thread makes progress within a specific finite period of time, the specific time being the bound.@@ -126,7 +126,7 @@ \item[Capacity Miss:]\index{Capacity miss} A cache miss incurred because the corresponding CPU has recently accessed more data than will fit into the cache. -\item[Clash Free:]\index{Clash Free} +\item[Clash Free:]\index{Clash free} A forward-progress guarantee in which, in the absence of contention, at least one thread makes progress within a finite period of time.@@ -170,7 +170,16 @@ increasing numbers of CPUs as the number of instances of data grows. Contrast with ``code locking''. -\item[Deadlock Free:]\index{Deadlock Free} +\item[Data Race:]\index{Data race} + A race condition in which several CPUs or threads access + a variable concurrently, and in which at least one of those + accesses is a store and at least one of those accesses + is unmarked. + It is important to note that while the presence of data races + often indicates the presence of bugs, the absence of data races + in no way implies the absence of bugs. + (See ``Marked access''.) +\item[Deadlock Free:]\index{Deadlock free} A forward-progress guarantee in which, in the absence of failures, at least one thread makes progress within a finite period of time.@@ -226,7 +235,7 @@ Since RCU read-side critical sections by definition cannot contain quiescent states, these two definitions are almost always interchangeable. -\item[Hazard Pointer:]\index{Hazard Pointer} +\item[Hazard Pointer:]\index{Hazard pointer} A scalable counterpart to a reference counter in which an object's reference count is represented implicitly by a count of the number of special hazard pointers referencing that object.@@ -284,9 +293,21 @@ used so heavily that there is often a CPU waiting on it. Reducing lock contention is often a concern when designing parallel algorithms and when implementing parallel programs. -\item[Lock Free:]\index{Lock Free} +\item[Lock Free:]\index{Lock free} A forward-progress guarantee in which at least one thread makes progress within a finite period of time. +\item[Marked Access:]\index{Marked access} + A source-code memory access that uses a special function or + macro, such as \co{READ_ONCE()}, \co{WRITE_ONCE()}, + \co{atomic_inc()}, and so on, in order to protect that access + from compiler and/or hardware optimizations. + In contrast, an unmarked access simply mentions the name of + the object being accessed, so that in the following, line~2 + is the unmarked equivalent of line~1: + \begin{VerbatimN} + WRITE_ONCE(a, READ_ONCE(b) + READ_ONCE(c)); + a = b + c; + \end{VerbatimN} \item[Memory:]\index{Memory} From the viewpoint of memory models, the main memory, caches, and store buffers in which values might be stored.@@ -345,7 +366,7 @@ \item[NUMA Node:]\index{NUMA node} A group of closely placed CPUs and associated memory within a larger NUMA machines. -\item[Obstruction Free:]\index{Obstruction Free} +\item[Obstruction Free:]\index{Obstruction free} A forward-progress guarantee in which, in the absence of contention, every thread makes progress within a finite period of time.@@ -428,7 +449,7 @@ wait for the writer to release the lock. A key concern for reader-writer locks is ``fairness'': can an unending stream of readers starve a writer or vice versa. -\item[Real Time:]\index{Real Time} +\item[Real Time:]\index{Real time} A situation in which getting the correct result is not sufficient, but where this result must also be obtained within a given amount of time.@@ -437,7 +458,7 @@ additional resources. For parallel computing, the additional resources are usually additional CPUs. -\item[Sequence Lock:]\index{Sequence Lock} +\item[Sequence Lock:]\index{Sequence lock} A reader-writer synchronization mechanism in which readers retry their operations if a writer was present. \item[Sequential Consistency:]\index{Sequential consistency}@@ -445,7 +466,7 @@ in an order consistent with a single global order, and where each CPU's memory references appear to all CPUs to occur in program order. -\item[Starvation Free:]\index{Starvation Free} +\item[Starvation Free:]\index{Starvation free} A forward-progress guarantee in which, in the absence of failures, every thread makes progress within a finite period of time.@@ -483,7 +504,7 @@ they understand completely and are therefore comfortable teaching. \item[Throughput:]\index{Throughput} A performance metric featuring work items completed per unit time. -\item[Transactional Lock Elision (TLE):]\index{Transactional Lock Elision (TLE)} +\item[Transactional Lock Elision (TLE):]\index{Transactional lock elision (TLE)} The use of transactional memory to emulate locking. Synchronization is instead carried out by conflicting accesses to the data to be protected by the lock.@@ -503,7 +524,7 @@ In the 1960s through the 1980s, only supercomputers had vector capabilities, but the advent of MMX in x86 CPUs and VMX in PowerPC CPUs brought vector processing to the masses. -\item[Wait Free:]\index{Wait Free} +\item[Wait Free:]\index{Wait free} A forward-progress guarantee in which every thread makes progress within a finite period of time. \item[Write Miss:]\index{Write miss}toolsoftrade/toolsoftrade.tex +9
-1@@ -397,12 +397,20 @@ Note that this program carefully makes sure that only one of the threads stores a value to variable \co{x} at a time. Any situation in which one thread might be storing a value to a given variable while some other thread either loads from or stores to that -same variable is termed a ``data race''. +same variable is termed a \emph{data race}. Because the C language makes no guarantee that the results of a data race will be in any way reasonable, we need some way of safely accessing and modifying data concurrently, such as the locking primitives discussed in the following section. +But your data races are benign, you say? +Well, maybe they are. +But please do everyone (yourself included) a big favor and read +\cref{sec:toolsoftrade:Shared-Variable Shenanigans} +very carefully. +As compilers optimize more and more aggressively, there are fewer and +fewer truly benign data races. + \QuickQuiz{ If the C language makes no guarantees in presence of a data race, then why does the Linux kernel have so many data races?
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
Quoted 34 lines · Akira Yokosawa
Quoted 33 lines · Paul E. McKenney
Quoted 32 lines · Akira Yokosawa
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgivePaul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
How about like the following?
Looks good to me!
Very good, and I have pushed it out.
Quoted 10 lines
Note on the index entry:
My experiment on the way to annotate index entries can manage automatic capitalization of only the first letter in indexed words/terms. So you won't need to take care of them.
And I'll get rid of direct uses of \index{} macro.
Will start rebasing those experiment soon after the release of second edition.
Sounds very good!
Thanx, Paul
Quoted 179 lines
Thanks, Akira
Quoted 177 lines
Thanx, Paul
------------------------------------------------------------------------
commit
da6dcf306cf2eb05324c306bbed230cc543fc426Author: Paul E. McKenney <[email protected]> Date: Sat Mar 20 12:21:07 2021 -0700toolsoftrade,glossary: Explain data races
While in the area, make the cases of index entries consistent, fixing my copy-pasta from the glossary entry.
Reported-by Akira Yokosawa <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>glossary.tex +33
-12@@ -38,13 +38,13 @@ is atomic, because other CPUs will see either the old value or the new value, but are guaranteed not to see some mixed value containing some pieces of the new and old values. -\item[Atomic Read-Modify-Write Operation:]\index{Atomic Read-Modify-Write Operation} +\item[Atomic Read-Modify-Write Operation:]\index{Atomic read-modify-write operation} An atomic operation that both reads and writes memory is considered an atomic read-modify-write operation, or atomic RMW operation for short. Although the value written usually depends on the value read, \co{atomic_xchg()} is the exception that proves this rule. -\item[Bounded Wait Free:]\index{Bounded Wait Free} +\item[Bounded Wait Free:]\index{Bounded wait free} A forward-progress guarantee in which every thread makes progress within a specific finite period of time, the specific time being the bound.@@ -126,7 +126,7 @@ \item[Capacity Miss:]\index{Capacity miss} A cache miss incurred because the corresponding CPU has recently accessed more data than will fit into the cache. -\item[Clash Free:]\index{Clash Free} +\item[Clash Free:]\index{Clash free} A forward-progress guarantee in which, in the absence of contention, at least one thread makes progress within a finite period of time.@@ -170,7 +170,16 @@ increasing numbers of CPUs as the number of instances of data grows. Contrast with ``code locking''. -\item[Deadlock Free:]\index{Deadlock Free} +\item[Data Race:]\index{Data race} + A race condition in which several CPUs or threads access + a variable concurrently, and in which at least one of those + accesses is a store and at least one of those accesses + is unmarked. + It is important to note that while the presence of data races + often indicates the presence of bugs, the absence of data races + in no way implies the absence of bugs. + (See ``Marked access''.) +\item[Deadlock Free:]\index{Deadlock free} A forward-progress guarantee in which, in the absence of failures, at least one thread makes progress within a finite period of time.@@ -226,7 +235,7 @@ Since RCU read-side critical sections by definition cannot contain quiescent states, these two definitions are almost always interchangeable. -\item[Hazard Pointer:]\index{Hazard Pointer} +\item[Hazard Pointer:]\index{Hazard pointer} A scalable counterpart to a reference counter in which an object's reference count is represented implicitly by a count of the number of special hazard pointers referencing that object.@@ -284,9 +293,21 @@ used so heavily that there is often a CPU waiting on it. Reducing lock contention is often a concern when designing parallel algorithms and when implementing parallel programs. -\item[Lock Free:]\index{Lock Free} +\item[Lock Free:]\index{Lock free} A forward-progress guarantee in which at least one thread makes progress within a finite period of time. +\item[Marked Access:]\index{Marked access} + A source-code memory access that uses a special function or + macro, such as \co{READ_ONCE()}, \co{WRITE_ONCE()}, + \co{atomic_inc()}, and so on, in order to protect that access + from compiler and/or hardware optimizations. + In contrast, an unmarked access simply mentions the name of + the object being accessed, so that in the following, line~2 + is the unmarked equivalent of line~1: + \begin{VerbatimN} + WRITE_ONCE(a, READ_ONCE(b) + READ_ONCE(c)); + a = b + c; + \end{VerbatimN} \item[Memory:]\index{Memory} From the viewpoint of memory models, the main memory, caches, and store buffers in which values might be stored.@@ -345,7 +366,7 @@ \item[NUMA Node:]\index{NUMA node} A group of closely placed CPUs and associated memory within a larger NUMA machines. -\item[Obstruction Free:]\index{Obstruction Free} +\item[Obstruction Free:]\index{Obstruction free} A forward-progress guarantee in which, in the absence of contention, every thread makes progress within a finite period of time.@@ -428,7 +449,7 @@ wait for the writer to release the lock. A key concern for reader-writer locks is ``fairness'': can an unending stream of readers starve a writer or vice versa. -\item[Real Time:]\index{Real Time} +\item[Real Time:]\index{Real time} A situation in which getting the correct result is not sufficient, but where this result must also be obtained within a given amount of time.@@ -437,7 +458,7 @@ additional resources. For parallel computing, the additional resources are usually additional CPUs. -\item[Sequence Lock:]\index{Sequence Lock} +\item[Sequence Lock:]\index{Sequence lock} A reader-writer synchronization mechanism in which readers retry their operations if a writer was present. \item[Sequential Consistency:]\index{Sequential consistency}@@ -445,7 +466,7 @@ in an order consistent with a single global order, and where each CPU's memory references appear to all CPUs to occur in program order. -\item[Starvation Free:]\index{Starvation Free} +\item[Starvation Free:]\index{Starvation free} A forward-progress guarantee in which, in the absence of failures, every thread makes progress within a finite period of time.@@ -483,7 +504,7 @@ they understand completely and are therefore comfortable teaching. \item[Throughput:]\index{Throughput} A performance metric featuring work items completed per unit time. -\item[Transactional Lock Elision (TLE):]\index{Transactional Lock Elision (TLE)} +\item[Transactional Lock Elision (TLE):]\index{Transactional lock elision (TLE)} The use of transactional memory to emulate locking. Synchronization is instead carried out by conflicting accesses to the data to be protected by the lock.@@ -503,7 +524,7 @@ In the 1960s through the 1980s, only supercomputers had vector capabilities, but the advent of MMX in x86 CPUs and VMX in PowerPC CPUs brought vector processing to the masses. -\item[Wait Free:]\index{Wait Free} +\item[Wait Free:]\index{Wait free} A forward-progress guarantee in which every thread makes progress within a finite period of time. \item[Write Miss:]\index{Write miss}toolsoftrade/toolsoftrade.tex +9
-1@@ -397,12 +397,20 @@ Note that this program carefully makes sure that only one of the threads stores a value to variable \co{x} at a time. Any situation in which one thread might be storing a value to a given variable while some other thread either loads from or stores to that -same variable is termed a ``data race''. +same variable is termed a \emph{data race}. Because the C language makes no guarantee that the results of a data race will be in any way reasonable, we need some way of safely accessing and modifying data concurrently, such as the locking primitives discussed in the following section. +But your data races are benign, you say? +Well, maybe they are. +But please do everyone (yourself included) a big favor and read +\cref{sec:toolsoftrade:Shared-Variable Shenanigans} +very carefully. +As compilers optimize more and more aggressively, there are fewer and +fewer truly benign data races. + \QuickQuiz{ If the C language makes no guarantees in presence of a data race, then why does the Linux kernel have so many data races?
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
In reply to Akira YokosawaQuoted 34 lines · Akira Yokosawa
Quoted 33 lines · Paul E. McKenney
Quoted 32 lines · Akira Yokosawa
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgivePaul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
How about like the following?
Looks good to me!
It looked good, but I've found that there is no mention of "marked access" in the whole text (except for Glossaries) in perfbook at the moment.
"Marked access", "unmarked load", and so on are used in ordering.txt to be added to LKMM documentation. They are going to appear in perfbook, I suppose.
How about adding "Plain Access" to the Glossaries as well and amend the definition of "Data Race" using "plain access".
Thanks, Akira
Quoted 18 lines
Note on the index entry:
My experiment on the way to annotate index entries can manage automatic capitalization of only the first letter in indexed words/terms. So you won't need to take care of them.
And I'll get rid of direct uses of \index{} macro.
Will start rebasing those experiment soon after the release of second edition.
Thanks, Akira
Quoted 4 lines
Thanx, Paul
------------------------------------------------------------------------
[...]
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
Quoted 45 lines · Akira Yokosawa
Quoted 34 lines · Akira Yokosawa
Quoted 33 lines · Paul E. McKenney
Quoted 32 lines · Akira Yokosawa
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgivePaul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
How about like the following?
Looks good to me!
It looked good, but I've found that there is no mention of "marked access" in the whole text (except for Glossaries) in perfbook at the moment.
Quoted 6 lines
"Marked access", "unmarked load", and so on are used in ordering.txt to be added to LKMM documentation. They are going to appear in perfbook, I suppose.
How about adding "Plain Access" to the Glossaries as well and amend the definition of "Data Race" using "plain access".
Good point! Like this?
Thanx, Paul
------------------------------------------------------------------------
commit b91c52cd1a93777ba91300d739e498bae9c49aea
Author: Paul E. McKenney <[email protected]> Date: Mon Mar 22 08:13:24 2021 -0700
Glossary: Add an entry for "Plain Access"
The book uses "plain access", so it deserves a glossary entry. And of course "marked access" is its antonym, more or less.
glossary.tex +8 -4
@@ -174,11 +174,11 @@ A race condition in which several CPUs or threads access a variable concurrently, and in which at least one of those accesses is a store and at least one of those accesses - is unmarked. + is a plain access. It is important to note that while the presence of data races often indicates the presence of bugs, the absence of data races in no way implies the absence of bugs. - (See ``Marked access''.) + (See ``Plain access''.) \item[Deadlock Free:]\index{Deadlock free} A forward-progress guarantee in which, in the absence of failures, at least one thread makes progress within a finite
@@ -301,9 +301,9 @@ macro, such as \co{READ_ONCE()}, \co{WRITE_ONCE()}, \co{atomic_inc()}, and so on, in order to protect that access from compiler and/or hardware optimizations. - In contrast, an unmarked access simply mentions the name of + In contrast, a plain access simply mentions the name of the object being accessed, so that in the following, line~2 - is the unmarked equivalent of line~1: + is the plain-access equivalent of line~1: \begin{VerbatimN} WRITE_ONCE(a, READ_ONCE(b) + READ_ONCE(c)); a = b + c;
@@ -393,6 +393,10 @@ In the 1960s through the early 1980s, pipelined CPUs were the province of supercomputers, but started appearing in microprocessors (such as the 80486) in the late 1980s. +\item[Plain Access:]\index{Plain access} + A source-code memory access that simply mentions the name of + the object being accessed. + (See ``Marked access''.) \item[Process Consistency:]\index{Process consistency} A memory-consistency model in which each CPU's stores appear to occur in program order, but in which different CPUs might see
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
Quoted 46 lines · Paul E. McKenney
Quoted 45 lines · Akira Yokosawa
Quoted 34 lines · Akira Yokosawa
Quoted 33 lines · Paul E. McKenney
Quoted 32 lines · Akira Yokosawa
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgivePaul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
How about like the following?
Looks good to me!
It looked good, but I've found that there is no mention of "marked access" in the whole text (except for Glossaries) in perfbook at the moment.
Quoted 8 lines
Quoted 6 lines
"Marked access", "unmarked load", and so on are used in ordering.txt to be added to LKMM documentation. They are going to appear in perfbook, I suppose.
How about adding "Plain Access" to the Glossaries as well and amend the definition of "Data Race" using "plain access".
Good point! Like this?
Thank you!
However, this patch conflicts with the removal of \index{} in glossary.tex on my WIP branch.
Do you mind if I cherry pick it & rebase on the WIP branch, and send you a pull request containing it later (maybe in a week or so)?
Thanks, Akira
Quoted 59 lines
Thanx, Paul
------------------------------------------------------------------------
commit
b91c52cd1a93777ba91300d739e498bae9c49aeaAuthor: Paul E. McKenney <[email protected]> Date: Mon Mar 22 08:13:24 2021 -0700Glossary: Add an entry for "Plain Access"
The book uses "plain access", so it deserves a glossary entry. And of course "marked access" is its antonym, more or less.
Reported-by Akira Yokosawa <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>glossary.tex +8
-4@@ -174,11 +174,11 @@ A race condition in which several CPUs or threads access a variable concurrently, and in which at least one of those accesses is a store and at least one of those accesses - is unmarked. + is a plain access. It is important to note that while the presence of data races often indicates the presence of bugs, the absence of data races in no way implies the absence of bugs. - (See ``Marked access''.) + (See ``Plain access''.) \item[Deadlock Free:]\index{Deadlock free} A forward-progress guarantee in which, in the absence of failures, at least one thread makes progress within a finite@@ -301,9 +301,9 @@ macro, such as \co{READ_ONCE()}, \co{WRITE_ONCE()}, \co{atomic_inc()}, and so on, in order to protect that access from compiler and/or hardware optimizations. - In contrast, an unmarked access simply mentions the name of + In contrast, a plain access simply mentions the name of the object being accessed, so that in the following, line~2 - is the unmarked equivalent of line~1: + is the plain-access equivalent of line~1: \begin{VerbatimN} WRITE_ONCE(a, READ_ONCE(b) + READ_ONCE(c)); a = b + c;@@ -393,6 +393,10 @@ In the 1960s through the early 1980s, pipelined CPUs were the province of supercomputers, but started appearing in microprocessors (such as the 80486) in the late 1980s. +\item[Plain Access:]\index{Plain access} + A source-code memory access that simply mentions the name of + the object being accessed. + (See ``Marked access''.) \item[Process Consistency:]\index{Process consistency} A memory-consistency model in which each CPU's stores appear to occur in program order, but in which different CPUs might see
Re: [PATCH 3/3 -perfbook] debugging: Fix typo
Quoted 54 lines · Akira Yokosawa
Quoted 53 lines · Paul E. McKenney
Quoted 51 lines · Akira Yokosawa
Quoted 34 lines · Akira Yokosawa
Quoted 33 lines · Paul E. McKenney
Quoted 32 lines · Akira Yokosawa
Quoted 11 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>--- debugging/debugging.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)debugging/debugging.tex +0
-0debugging/debugging.tex access to data. · line 761
Quoted 8 lines
debugging/debugging.tex +1
-1@@ -755,7 +755,7 @@ access to data. The Kernel Concurrency Sanitizer (KCSAN)~\cite{JonathanCorbet2019KCSAN} uses existing markings such as \co{READ_ONCE()} and \co{WRITE_ONCE()} to determine which concurrent accesses deserve warning messages. -KCSAN has a significant false-positive rate, especially in from the +KCSAN has a significant false-positive rate, especially from the viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgivePaul,
I caught this one while searching the usage of "data race" in perfbook. I thought "data race" also deserves an entry in Glossaries, especially because our use of "data race" is heavily related to compiler optimizations and somewhat stricter than the common definition found on the web.
The first of data race in Section 4.2.2 (just before QQ4.8) does not (explicitly) talk about optimizations.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Would it be possible for you to come up with some concise definition of data race which will fit as an entry in the Glossaries?
How about like the following?
Looks good to me!
It looked good, but I've found that there is no mention of "marked access" in the whole text (except for Glossaries) in perfbook at the moment.
"Marked access", "unmarked load", and so on are used in ordering.txt to be added to LKMM documentation. They are going to appear in perfbook, I suppose.
How about adding "Plain Access" to the Glossaries as well and amend the definition of "Data Race" using "plain access".
Quoted 8 lines
Quoted 1 line
Good point! Like this?
Thank you!
However, this patch conflicts with the removal of \index{} in glossary.tex on my WIP branch.
Do you mind if I cherry pick it & rebase on the WIP branch, and send you a pull request containing it later (maybe in a week or so)?
Works for me!
Thanx, Paul
Quoted 61 lines
Thanks, Akira
Quoted 59 lines
Thanx, Paul
------------------------------------------------------------------------
commit
b91c52cd1a93777ba91300d739e498bae9c49aeaAuthor: Paul E. McKenney <[email protected]> Date: Mon Mar 22 08:13:24 2021 -0700Glossary: Add an entry for "Plain Access"
The book uses "plain access", so it deserves a glossary entry. And of course "marked access" is its antonym, more or less.
Reported-by Akira Yokosawa <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>glossary.tex +8
-4@@ -174,11 +174,11 @@ A race condition in which several CPUs or threads access a variable concurrently, and in which at least one of those accesses is a store and at least one of those accesses - is unmarked. + is a plain access. It is important to note that while the presence of data races often indicates the presence of bugs, the absence of data races in no way implies the absence of bugs. - (See ``Marked access''.) + (See ``Plain access''.) \item[Deadlock Free:]\index{Deadlock free} A forward-progress guarantee in which, in the absence of failures, at least one thread makes progress within a finite@@ -301,9 +301,9 @@ macro, such as \co{READ_ONCE()}, \co{WRITE_ONCE()}, \co{atomic_inc()}, and so on, in order to protect that access from compiler and/or hardware optimizations. - In contrast, an unmarked access simply mentions the name of + In contrast, a plain access simply mentions the name of the object being accessed, so that in the following, line~2 - is the unmarked equivalent of line~1: + is the plain-access equivalent of line~1: \begin{VerbatimN} WRITE_ONCE(a, READ_ONCE(b) + READ_ONCE(c)); a = b + c;@@ -393,6 +393,10 @@ In the 1960s through the early 1980s, pipelined CPUs were the province of supercomputers, but started appearing in microprocessors (such as the 80486) in the late 1980s. +\item[Plain Access:]\index{Plain access} + A source-code memory access that simply mentions the name of + the object being accessed. + (See ``Marked access''.) \item[Process Consistency:]\index{Process consistency} A memory-consistency model in which each CPU's stores appear to occur in program order, but in which different CPUs might see