Re: [PATCH] CodeSamples/defer: Fix hazard torture

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alan,

On Thu, 20 Apr 2023 07:29:23 +0000, Alan Huang wrote:
> This patch fixes hazard torture.

Please describe what bug you are fixing.

> 
> Signed-off-by: Alan Huang <mmpgouride@xxxxxxxxx>
> ---
>  CodeSamples/defer/hazptr.h        | 2 +-
>  CodeSamples/defer/hazptrtorture.h | 3 +--
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/CodeSamples/defer/hazptr.h b/CodeSamples/defer/hazptr.h
> index 759ab53d..e061303d 100644
> --- a/CodeSamples/defer/hazptr.h
> +++ b/CodeSamples/defer/hazptr.h
> @@ -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.  ;-)

>  	} while (tmp == (void *)HAZPTR_POISON);
>  	return tmp;
>  }							//\lnlbl{hr:e}
> diff --git a/CodeSamples/defer/hazptrtorture.h b/CodeSamples/defer/hazptrtorture.h
> index 53efa259..29761e3d 100644
> --- a/CodeSamples/defer/hazptrtorture.h
> +++ b/CodeSamples/defer/hazptrtorture.h
> @@ -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

>  	struct hazptr_stress *p;
>  	int pc;
>  



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux