CodeSamples/defer: Fix hazard torture
PATCH 1/1 CodeSamples/defer: Fix hazard torture
This patch fixes hazard torture.
--- CodeSamples/defer/hazptr.h | 2 +- CodeSamples/defer/hazptrtorture.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
CodeSamples/defer/hazptr.h +1 -1
@@ -87,7 +87,7 @@ static inline void *hp_record(void **p, //\lnlbl{hr:b}void *tmp;do { - tmp =hp_try_record (*p, hp); + tmp =hp_try_record (p, hp); }while (tmp == (void *)HAZPTR_POISON );return tmp; }//\lnlbl{hr:e}
CodeSamples/defer/hazptrtorture.h +1 -2
@@ -241,8 +241,7 @@ DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count);void *hazptr_read_stress_test (void *arg) { -int me = (int )(long )arg; -int base = me *K ; +int base =smp_thread_id () *K ;struct hazptr_stress *p;int pc;
Signature · 1 line
2.34.1
Hi Alan,
Quoted 1 line · Alan Huang
This patch fixes hazard torture.
Please describe what bug you are fixing.
Quoted 12 lines
Signed-off-by Alan Huang <[email protected]>--- CodeSamples/defer/hazptr.h | 2 +- CodeSamples/defer/hazptrtorture.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)CodeSamples/defer/hazptr.h +0
-0
CodeSamples/defer/hazptr.h static inline void *hp_record(void **p, //\lnlbl{hr:b} · line 90
Quoted 5 lines
CodeSamples/defer/hazptr.h +1
-1@@ -87,7 +87,7 @@ static inline void *hp_record(void **p, //\lnlbl{hr:b}void *tmp; do { - tmp = hp_try_record(*p, hp); + tmp = hp_try_record(p, hp);
This looks to me fixes the regression introduced by commit a082aba85ce0 ("defer/hazptr: Checkpoint for text/code update") made back on Apr 1, 2019.
Was it an April fool? I don't know, but Paul planted this bug to see if there is somebody who would catch it. ;-)
Quoted 8 lines
CodeSamples/defer/hazptr.h +0
-0}while (tmp == (void *)HAZPTR_POISON );return tmp; }//\lnlbl{hr:e} CodeSamples/defer/hazptrtorture.h +0
-0
CodeSamples/defer/hazptrtorture.h DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count); · line 244
Quoted 6 lines
CodeSamples/defer/hazptrtorture.h +1
-2@@ -241,8 +241,7 @@ DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count);void *hazptr_read_stress_test (void *arg) { -int me = (int )(long )arg; -int base = me *K ; +int base =smp_thread_id () *K ;
I'm not sure if this change is related to the fix above.
Or are you fixing an independent issue? If so, can you make this part a follow-up patch, with the other patch squashed?
Thanks, Akira
Quoted 3 lines
CodeSamples/defer/hazptrtorture.h +0
-0struct hazptr_stress *p;int pc;
Hi Akira,
I have sent out the patch v2 with a more clear commit message.
Thanks,
Alan
Quoted 58 lines
2023年4月22日 16:28,Akira Yokosawa <[email protected]> 写道:
Hi Alan,
Quoted 1 line · Alan Huang
This patch fixes hazard torture.
Please describe what bug you are fixing.
Quoted 12 lines
Signed-off-by Alan Huang <[email protected]>---
CodeSamples/defer/hazptr.h| 2 +-CodeSamples/defer/hazptrtorture.h| 3 +--2 files changed, 2 insertions(+), 3 deletions(-)CodeSamples/defer/hazptr.h +0
-0CodeSamples/defer/hazptr.h static inline void *hp_record(void **p, //\lnlbl{hr:b} · line 90
Quoted 5 lines
CodeSamples/defer/hazptr.h +1
-1@@ -87,7 +87,7 @@ static inline void *hp_record(void **p, //\lnlbl{hr:b}void *tmp; do { - tmp = hp_try_record(*p, hp); + tmp = hp_try_record(p, hp);This looks to me fixes the regression introduced by commit
a082aba85ce0("defer/hazptr: Checkpoint for text/code update") made back on Apr 1, 2019.Was it an April fool? I don't know, but Paul planted this bug to see if there is somebody who would catch it. ;-)
Quoted 8 lines
CodeSamples/defer/hazptr.h +0
-0}while (tmp == (void *)HAZPTR_POISON );return tmp; }//\lnlbl{hr:e} CodeSamples/defer/hazptrtorture.h +0
-0CodeSamples/defer/hazptrtorture.h DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count); · line 244
Quoted 6 lines
CodeSamples/defer/hazptrtorture.h +1
-2@@ -241,8 +241,7 @@ DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count);void *hazptr_read_stress_test (void *arg) { -int me = (int )(long )arg; -int base = me *K ; +int base =smp_thread_id () *K ;I'm not sure if this change is related to the fix above.
Or are you fixing an independent issue? If so, can you make this part a follow-up patch, with the other patch squashed?
Thanks, Akira
Quoted 2 lines
CodeSamples/defer/hazptrtorture.h +0
-0struct hazptr_stress *p;int pc;
Hi Akira,
I have sent patch v2 with a more clear commit message.
Thanks,
Alan
Quoted 58 lines
2023年4月22日 16:28,Akira Yokosawa <[email protected]> 写道:
Hi Alan,
Quoted 1 line · Alan Huang
This patch fixes hazard torture.
Please describe what bug you are fixing.
Quoted 12 lines
Signed-off-by Alan Huang <[email protected]>---
CodeSamples/defer/hazptr.h| 2 +-CodeSamples/defer/hazptrtorture.h| 3 +--2 files changed, 2 insertions(+), 3 deletions(-)CodeSamples/defer/hazptr.h +0
-0CodeSamples/defer/hazptr.h static inline void *hp_record(void **p, //\lnlbl{hr:b} · line 90
Quoted 5 lines
CodeSamples/defer/hazptr.h +1
-1@@ -87,7 +87,7 @@ static inline void *hp_record(void **p, //\lnlbl{hr:b}void *tmp; do { - tmp = hp_try_record(*p, hp); + tmp = hp_try_record(p, hp);This looks to me fixes the regression introduced by commit
a082aba85ce0("defer/hazptr: Checkpoint for text/code update") made back on Apr 1, 2019.Was it an April fool? I don't know, but Paul planted this bug to see if there is somebody who would catch it. ;-)
Quoted 8 lines
CodeSamples/defer/hazptr.h +0
-0}while (tmp == (void *)HAZPTR_POISON );return tmp; }//\lnlbl{hr:e} CodeSamples/defer/hazptrtorture.h +0
-0CodeSamples/defer/hazptrtorture.h DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count); · line 244
Quoted 6 lines
CodeSamples/defer/hazptrtorture.h +1
-2@@ -241,8 +241,7 @@ DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count);void *hazptr_read_stress_test (void *arg) { -int me = (int )(long )arg; -int base = me *K ; +int base =smp_thread_id () *K ;I'm not sure if this change is related to the fix above.
Or are you fixing an independent issue? If so, can you make this part a follow-up patch, with the other patch squashed?
Thanks, Akira
Quoted 2 lines
CodeSamples/defer/hazptrtorture.h +0
-0struct hazptr_stress *p;int pc;