LKMM: Add litmus test for RCU GP guarantee where updater frees object
PATCH 1/3 LKMM: Add litmus test for RCU GP guarantee where updater frees object
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
--- .../litmus-tests/RCU+sync+free.litmus | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+free.litmus
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +40 -0
@@ -0,0 +1,40 @@ +C RCU+sync+free + +(* + * Result: Never + * + * This litmus test demonstrates that an RCU reader can never see a write after + * the grace period, if it saw writes that happen before the grace period. This + * is a typical pattern of RCU usage, where the write before the grace period + * assigns a pointer, and the writes after destroy the object that the pointer + * points to. + * + * This guarantee also implies, an RCU reader can never span a grace period and + * is an important RCU grace period memory ordering guarantee. + *) + +{ +x = 1; +y = x; +z = 1; +} + +P0(int *x, int *z, int **y) +{ + int r0; + int r1; + + rcu_read_lock(); + r0 = rcu_dereference(*y); + r1 = READ_ONCE(*r0); + rcu_read_unlock(); +} + +P1(int *x, int *z, int **y) +{ + rcu_assign_pointer(*y, z); + synchronize_rcu(); + WRITE_ONCE(*x, 0); +} + +exists (0:r0=x /\ 0:r1=0)
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH 2/3 LKMM: Add litmus test for RCU GP guarantee where reader stores
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
--- .../litmus-tests/RCU+sync+read.litmus | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+read.litmus
tools/memory-model/litmus-tests/RCU+sync+read.litmus new file +37 -0
@@ -0,0 +1,37 @@ +C RCU+sync+read + +(* + * Result: Never + * + * This litmus test demonstrates that after a grace period, an RCU updater always + * sees all stores done in prior RCU read-side critical sections. Such + * read-side critical sections would have ended before the grace period ended. + * + * This guarantee also implies, an RCU reader can never span a grace period and + * is an important RCU grace period memory ordering guarantee. + *) + +{ +x = 0; +y = 0; +} + +P0(int *x, int *y) +{ + rcu_read_lock(); + WRITE_ONCE(*x, 1); + WRITE_ONCE(*y, 1); + rcu_read_unlock(); +} + +P1(int *x, int *y) +{ + int r0; + int r1; + + r0 = READ_ONCE(*x); + synchronize_rcu(); + r1 = READ_ONCE(*y); +} + +exists (1:r0=1 /\ 1:r1=0)
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
Alan Stern
maintainerRe: [PATCH 2/3] LKMM: Add litmus test for RCU GP guarantee where reader stores
tools/memory-model/litmus-tests/RCU+sync+read.litmus
Quoted 14 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+read.litmus | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+read.litmustools/memory-model/litmus-tests/RCU+sync+read.litmus new file +0
-0
Do these new tests really belong here? I thought we were adding a new directory under Documentation/ for litmus tests that illustrate parts of the LKMM or memory-barriers.txt.
By contrast, the tests under tools/memory-model are merely to show people what litmus tests look like and how they should be written.
Alan
Re: [PATCH 2/3] LKMM: Add litmus test for RCU GP guarantee where reader stores
Quoted 21 lines · Alan Stern
tools/memory-model/litmus-tests/RCU+sync+read.litmus
Quoted 14 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+read.litmus | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+read.litmustools/memory-model/litmus-tests/RCU+sync+read.litmus new file +0
-0Do these new tests really belong here? I thought we were adding a new directory under
Documentation/for litmus tests that illustrate parts of the LKMM or memory-barriers.txt.
Quoted 2 lines
By contrast, the tests under
tools/memory-modelare merely to show people what litmus tests look like and how they should be written.
I could add it to tools/memory-model/Documentation/ under a new 'examples' directory there. We could also create an 'rcu' directory in tools/memory-model/litmus-tests/ and add these there. Thoughts?
thanks,
- Joel
Alan Stern
maintainerRe: [PATCH 2/3] LKMM: Add litmus test for RCU GP guarantee where reader stores
Quoted 22 lines · Joel Fernandes
Quoted 21 lines · Alan Stern
tools/memory-model/litmus-tests/RCU+sync+read.litmus
Quoted 14 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+read.litmus | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+read.litmustools/memory-model/litmus-tests/RCU+sync+read.litmus new file +0
-0Do these new tests really belong here? I thought we were adding a new directory under
Documentation/for litmus tests that illustrate parts of the LKMM or memory-barriers.txt.
Quoted 6 lines
Quoted 2 lines
By contrast, the tests under
tools/memory-modelare merely to show people what litmus tests look like and how they should be written.I could add it to
tools/memory-model/Documentation/under a new 'examples' directory there. We could also create an 'rcu' directory intools/memory-model/litmus-tests/and add these there. Thoughts?
What happened was that about a month ago, Boqun Feng added Documentation/atomic-tests for litmus tests related to handling of atomic_t types (see
<https://marc.info/?l=linux-kernel&m=158276408609029&w=2>.) Should we interpose an extra directory level, making it Documentation/litmus-tests/atomic? Or Documentation/LKMM-litmus-tests/atomic?
Then the new tests added here could go intoDocumentation/litmus-tests/rcu, or whatever.
Alan
Re: [PATCH 2/3] LKMM: Add litmus test for RCU GP guarantee where reader stores
Quoted 39 lines · Alan Stern
Quoted 22 lines · Joel Fernandes
Quoted 21 lines · Alan Stern
tools/memory-model/litmus-tests/RCU+sync+read.litmus
Quoted 14 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+read.litmus | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+read.litmustools/memory-model/litmus-tests/RCU+sync+read.litmus new file +0
-0Do these new tests really belong here? I thought we were adding a new directory under
Documentation/for litmus tests that illustrate parts of the LKMM or memory-barriers.txt.Quoted 6 lines
Quoted 2 lines
By contrast, the tests under
tools/memory-modelare merely to show people what litmus tests look like and how they should be written.I could add it to
tools/memory-model/Documentation/under a new 'examples' directory there. We could also create an 'rcu' directory intools/memory-model/litmus-tests/and add these there. Thoughts?What happened was that about a month ago, Boqun Feng added
Documentation/atomic-testsfor litmus tests related to handling ofatomic_ttypes (see
<https://marc.info/?l=linux-kernel&m=158276408609029&w=2>.) Should we interpose an extra directory level, making itDocumentation/litmus-tests/atomic? OrDocumentation/LKMM-litmus-tests/atomic?
Quoted 2 lines
Then the new tests added here could go into
Documentation/litmus-tests/rcu, or whatever.
That's fine with me. Unless anyone objects, I will add to Documentation/litmus-tests/rcu and resend.
thanks,
- Joel
Re: [PATCH 2/3] LKMM: Add litmus test for RCU GP guarantee where reader stores
Quoted 40 lines · Joel Fernandes
Quoted 39 lines · Alan Stern
Quoted 22 lines · Joel Fernandes
Quoted 21 lines · Alan Stern
tools/memory-model/litmus-tests/RCU+sync+read.litmus
Quoted 14 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+read.litmus | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+read.litmustools/memory-model/litmus-tests/RCU+sync+read.litmus new file +0
-0Do these new tests really belong here? I thought we were adding a new directory under
Documentation/for litmus tests that illustrate parts of the LKMM or memory-barriers.txt.Quoted 6 lines
Quoted 2 lines
By contrast, the tests under
tools/memory-modelare merely to show people what litmus tests look like and how they should be written.I could add it to
tools/memory-model/Documentation/under a new 'examples' directory there. We could also create an 'rcu' directory intools/memory-model/litmus-tests/and add these there. Thoughts?What happened was that about a month ago, Boqun Feng added
Documentation/atomic-testsfor litmus tests related to handling ofatomic_ttypes (see
<https://marc.info/?l=linux-kernel&m=158276408609029&w=2>.) Should we interpose an extra directory level, making itDocumentation/litmus-tests/atomic? OrDocumentation/LKMM-litmus-tests/atomic?
Quoted 6 lines
Quoted 2 lines
Then the new tests added here could go into
Documentation/litmus-tests/rcu, or whatever.That's fine with me. Unless anyone objects, I will add to
Documentation/litmus-tests/rcuand resend.
Seems good to me, I will resend my patchset with the new directory. And I assume in your patchset you will include the MAINTAINERS part for adding Documentation/litmus-tests/ as a diretory watched by LKMM group? In that case, I won't need to add any change to MAINTAINERS file in mine and we won't have any conflict. ;-)
Regards,
Boqun
Quoted 4 lines
thanks,
- Joel
Re: [PATCH 2/3] LKMM: Add litmus test for RCU GP guarantee where reader stores
Quoted 48 lines · Boqun Feng
Quoted 40 lines · Joel Fernandes
Quoted 39 lines · Alan Stern
Quoted 22 lines · Joel Fernandes
Quoted 21 lines · Alan Stern
tools/memory-model/litmus-tests/RCU+sync+read.litmus
Quoted 14 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+read.litmus | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+read.litmustools/memory-model/litmus-tests/RCU+sync+read.litmus new file +0
-0Do these new tests really belong here? I thought we were adding a new directory under
Documentation/for litmus tests that illustrate parts of the LKMM or memory-barriers.txt.Quoted 6 lines
Quoted 2 lines
By contrast, the tests under
tools/memory-modelare merely to show people what litmus tests look like and how they should be written.I could add it to
tools/memory-model/Documentation/under a new 'examples' directory there. We could also create an 'rcu' directory intools/memory-model/litmus-tests/and add these there. Thoughts?What happened was that about a month ago, Boqun Feng added
Documentation/atomic-testsfor litmus tests related to handling ofatomic_ttypes (see
<https://marc.info/?l=linux-kernel&m=158276408609029&w=2>.) Should we interpose an extra directory level, making itDocumentation/litmus-tests/atomic? OrDocumentation/LKMM-litmus-tests/atomic?Quoted 6 lines
Quoted 2 lines
Then the new tests added here could go into
Documentation/litmus-tests/rcu, or whatever.That's fine with me. Unless anyone objects, I will add to
Documentation/litmus-tests/rcuand resend.
Quoted 5 lines
Seems good to me, I will resend my patchset with the new directory. And I assume in your patchset you will include the
MAINTAINERSpart for addingDocumentation/litmus-tests/as a diretory watched by LKMM group? In that case, I won't need to add any change toMAINTAINERSfile in mine and we won't have any conflict. ;-)
Yes, will add to MAINTAINERS so that you don't have to :) About to send my queue now.
thanks,
- Joel
PATCH 3/3 LKMM: Rename MP+onceassign+derefonce for better clarity
In reply to Joel Fernandes (Google)For better consistency with RCU examples, rename MP+onceassign+derefonce to RCU+MP+onceassign+derefonce.
I plan to add more RCU related litmus tests, so we could use this convention if that's Ok.
---
...sign+derefonce.litmus => RCU+MP+onceassign+derefonce.litmus} | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename tools/memory-model/litmus-tests/{MP+onceassign+derefonce.litmus => RCU+MP+onceassign+derefonce.litmus} (94%)tools/memory-model/litmus-tests/RCU+MP+onceassign+derefonce.litmus renamed from tools/memory-model/litmus-tests/MP+onceassign+derefonce.litmus +1 -1
@@ -1,4 +1,4 @@ -C MP+onceassign+derefonce +C RCU+MP+onceassign+derefonce (* * Result: Never
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
Andrea Parri
maintainerQuoted 24 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+free.litmus | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+free.litmustools/memory-model/litmus-tests/RCU+sync+free.litmus new file +9
-0@@ -0,0 +1,40 @@ +C RCU+sync+free + +(* + * Result: Never + * + * This litmus test demonstrates that an RCU reader can never see a write after + * the grace period, if it saw writes that happen before the grace period. This + * is a typical pattern of RCU usage, where the write before the grace period + * assigns a pointer, and the writes after destroy the object that the pointer
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 19
Quoted 10 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +10
-0+ * points to. + * + * This guarantee also implies, an RCU reader can never span a grace period and + * is an important RCU grace period memory ordering guarantee. + *) + +{ +x = 1; +y = x; +z = 1;
FYI, this could become a little more readable if we wrote it as follows:
int x = 1;
int *y = &x;
int z = 1;
The LKMM tools are happy either way, just a matter of style/preference; and yes, MP+onceassign+derefonce isn't currently following mine... ;-/
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 24
Quoted 5 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +5
-0+} + +P0(int *x, int *z, int **y) +{ + int r0;
This would need to be "int *r0;" in order to make klitmus7(+gcc) happy.
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 35
Quoted 11 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +11
-0+ int r1; + + rcu_read_lock(); + r0 = rcu_dereference(*y); + r1 = READ_ONCE(*r0); + rcu_read_unlock(); +} + +P1(int *x, int *z, int **y) +{ + rcu_assign_pointer(*y, z);
AFAICT, you don't need this "RELEASE"; e.g., compare this test with the example in:
What am I missing?
Thanks,
Andrea
Quoted 8 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +5
-0+ synchronize_rcu(); + WRITE_ONCE(*x, 0); +} + +exists (0:r0=x /\ 0:r1=0)Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
Alan Stern
maintainerQuoted 38 lines · Andrea Parri
Quoted 24 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+free.litmus | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+free.litmustools/memory-model/litmus-tests/RCU+sync+free.litmus new file +9
-0@@ -0,0 +1,40 @@ +C RCU+sync+free + +(* + * Result: Never + * + * This litmus test demonstrates that an RCU reader can never see a write after + * the grace period, if it saw writes that happen before the grace period. This + * is a typical pattern of RCU usage, where the write before the grace period + * assigns a pointer, and the writes after destroy the object that the pointertools/memory-model/litmus-tests/RCU+sync+free.litmus line 19
Quoted 10 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +10
-0+ * points to. + * + * This guarantee also implies, an RCU reader can never span a grace period and + * is an important RCU grace period memory ordering guarantee. + *) + +{ +x = 1; +y = x; +z = 1;FYI, this could become a little more readable if we wrote it as follows:
Quoted 3 lines
int x = 1;
int *y = &x;
int z = 1;
Also, the test won't work with klitmus7 unless you do this.
Quoted 28 lines
The LKMM tools are happy either way, just a matter of style/preference; and yes, MP+onceassign+derefonce isn't currently following mine... ;-/
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 24
Quoted 5 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +5
-0+} + +P0(int *x, int *z, int **y) +{ + int r0;This would need to be "int *r0;" in order to make klitmus7(+gcc) happy.
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 35
Quoted 11 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +11
-0+ int r1; + + rcu_read_lock(); + r0 = rcu_dereference(*y); + r1 = READ_ONCE(*r0); + rcu_read_unlock(); +} + +P1(int *x, int *z, int **y) +{ + rcu_assign_pointer(*y, z);AFAICT, you don't need this "RELEASE"; e.g., compare this test with the example in:
Quoted 3 lines
What am I missing?
If z were not a simple variable but a more complicated structure, the RELEASE would be necessary to ensure that all P1's prior changes to z became visible before the write to y.
Besides, it's good form always to match rcu_dereference() with rcu_assign_pointer(), for code documentation if nothing else.
Alan
Quoted 40 lines · Alan Stern
Quoted 38 lines · Andrea Parri
Quoted 24 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+free.litmus | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+free.litmustools/memory-model/litmus-tests/RCU+sync+free.litmus new file +9
-0@@ -0,0 +1,40 @@ +C RCU+sync+free + +(* + * Result: Never + * + * This litmus test demonstrates that an RCU reader can never see a write after + * the grace period, if it saw writes that happen before the grace period. This + * is a typical pattern of RCU usage, where the write before the grace period + * assigns a pointer, and the writes after destroy the object that the pointertools/memory-model/litmus-tests/RCU+sync+free.litmus line 19
Quoted 10 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +10
-0+ * points to. + * + * This guarantee also implies, an RCU reader can never span a grace period and + * is an important RCU grace period memory ordering guarantee. + *) + +{ +x = 1; +y = x; +z = 1;FYI, this could become a little more readable if we wrote it as follows:
Quoted 5 lines
Quoted 3 lines
int x = 1;
int *y = &x;
int z = 1;Also, the test won't work with klitmus7 unless you do this.
Will do.
Quoted 11 lines
Quoted 11 lines
The LKMM tools are happy either way, just a matter of style/preference; and yes, MP+onceassign+derefonce isn't currently following mine... ;-/
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 24
Quoted 5 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +5
-0+} + +P0(int *x, int *z, int **y) +{ + int r0;This would need to be "int *r0;" in order to make klitmus7(+gcc) happy.
Sorry fixed it now, my version of herd did not complain on this so I missed it.
Quoted 17 lines
Quoted 17 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 35
Quoted 11 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +11
-0+ int r1; + + rcu_read_lock(); + r0 = rcu_dereference(*y); + r1 = READ_ONCE(*r0); + rcu_read_unlock(); +} + +P1(int *x, int *z, int **y) +{ + rcu_assign_pointer(*y, z);AFAICT, you don't need this "RELEASE"; e.g., compare this test with the example in:
Quoted 8 lines
Quoted 1 line
What am I missing?
If z were not a simple variable but a more complicated structure, the RELEASE would be necessary to ensure that all P1's prior changes to z became visible before the write to y.
Besides, it's good form always to match
rcu_dereference()withrcu_assign_pointer(), for code documentation if nothing else.
Yes, adding to what Alan said, you can see the effect of not using rcu_assign_pointer() in: MP+onceassign+derefonce.litmus
Alan and Andrea, may I add your Reviewed-by or Acked-by tags on the v2?
thanks,
- Joel
Andrea Parri
maintainerQuoted 6 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+free.litmus | 40 +++++++++++++++++++
I forgot to mention: this should probably come with an update of the list of tests reported in tools/memory-model/litmus-tests/README and similarly for patches #2 and #3; #2, #3 looked otherwise fine to me.
Thanks,
Andrea
Quoted 52 lines
1 file changed, 40 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+free.litmustools/memory-model/litmus-tests/RCU+sync+free.litmus new file +40
-0@@ -0,0 +1,40 @@ +C RCU+sync+free + +(* + * Result: Never + * + * This litmus test demonstrates that an RCU reader can never see a write after + * the grace period, if it saw writes that happen before the grace period. This + * is a typical pattern of RCU usage, where the write before the grace period + * assigns a pointer, and the writes after destroy the object that the pointer + * points to. + * + * This guarantee also implies, an RCU reader can never span a grace period and + * is an important RCU grace period memory ordering guarantee. + *) + +{ +x = 1; +y = x; +z = 1; +} + +P0(int *x, int *z, int **y) +{ + int r0; + int r1; + + rcu_read_lock(); + r0 = rcu_dereference(*y); + r1 = READ_ONCE(*r0); + rcu_read_unlock(); +} + +P1(int *x, int *z, int **y) +{ + rcu_assign_pointer(*y, z); + synchronize_rcu(); + WRITE_ONCE(*x, 0); +} + +exists (0:r0=x /\ 0:r1=0)Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
Alan Stern
maintainerQuoted 15 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+free.litmus | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+free.litmustools/memory-model/litmus-tests/RCU+sync+free.litmus new file +0
-0
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 5
Quoted 5 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +5
-0@@ -0,0 +1,40 @@ +C RCU+sync+free + +(* + * Result: Never + *
The following comment needs some rewriting. The grammar is somewhat awkward and a very important "not" is missing.
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 7
Quoted 2 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +2
-0+ * This litmus test demonstrates that an RCU reader can never see a write after + * the grace period, if it saw writes that happen before the grace period.
An RCU reader can never see a write that follows a grace period if it did _not_ see writes that precede the grace period.
Quoted 4 lines
This
+ * is a typical pattern of RCU usage, where the write before the grace period
+ * assigns a pointer, and the writes after destroy the object that the pointer
+ * points to.
... that the pointer used to point to.
Quoted 3 lines
+ *
+ * This guarantee also implies, an RCU reader can never span a grace period and
+ * is an important RCU grace period memory ordering guarantee.
Unnecessary comma, and it is not clear what "This" refers to. The whole sentence should be phrased differently:
This is one implication of the RCU grace-period guarantee, which says (among other things) that an RCU reader cannot span a grace period.
Alan
Quoted 26 lines · Alan Stern
Quoted 15 lines · Joel Fernandes (Google)
This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period.
Signed-off-by Joel Fernandes (Google) <[email protected]>--- .../litmus-tests/RCU+sync+free.litmus | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/memory-model/litmus-tests/RCU+sync+free.litmustools/memory-model/litmus-tests/RCU+sync+free.litmus new file +0
-0tools/memory-model/litmus-tests/RCU+sync+free.litmus line 5
Quoted 5 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +5
-0@@ -0,0 +1,40 @@ +C RCU+sync+free + +(* + * Result: Never + *The following comment needs some rewriting. The grammar is somewhat awkward and a very important "not" is missing.
Quoted 5 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus line 7
Quoted 2 lines
tools/memory-model/litmus-tests/RCU+sync+free.litmus new file +2
-0+ * This litmus test demonstrates that an RCU reader can never see a write after + * the grace period, if it saw writes that happen before the grace period.An RCU reader can never see a write that follows a grace period if it did _not_ see writes that precede the grace period.
Yes, you are right. I will change your wording to 'did not see *all* writes that precede'.
Quoted 6 lines
Quoted 4 lines
This
+ * is a typical pattern of RCU usage, where the write before the grace period
+ * assigns a pointer, and the writes after destroy the object that the pointer
+ * points to.... that the pointer used to point to.
Will fix.
Quoted 10 lines
Quoted 3 lines
+ *
+ * This guarantee also implies, an RCU reader can never span a grace period and
+ * is an important RCU grace period memory ordering guarantee.Unnecessary comma, and it is not clear what "This" refers to. The whole sentence should be phrased differently:
This is one implication of the RCU grace-period guarantee, which says (among other things) that an RCU reader cannot span a grace period.
Your wording is better, will use that.
thanks,
- Joel