lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <52cc5910-af30-42d3-85a3-5eab06fea658@quicinc.com>
Date:   Thu, 24 Aug 2023 11:43:02 +0530
From:   Pavan Kondeti <quic_pkondeti@...cinc.com>
To:     Kassey Li <quic_yingangl@...cinc.com>
CC:     Peter Zijlstra <peterz@...radead.org>, <mingo@...hat.com>,
        <will@...nel.org>, <boqun.feng@...il.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: seqlock:do_raw_write_seqcount_end smp_wmb

On Thu, Aug 24, 2023 at 09:07:57AM +0800, Kassey Li wrote:
> hi, Peter:
> 	I not quit sure on this, but is that a type error in
> do_raw_write_seqcount_end here  ?
> is this change necessary to match with do_raw_write_seqcount_begin ?
> 		
> 	
> diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
> index 987a59d977c5..eb8807ed3a00 100644
> --- a/include/linux/seqlock.h
> +++ b/include/linux/seqlock.h
> @@ -486,8 +486,8 @@ do {                        \
> 
>  static inline void do_raw_write_seqcount_end(seqcount_t *s)
>  {
> -       smp_wmb();
>         s->sequence++;
> +       smp_wmb();
>         kcsan_nestable_atomic_end();
>  }
> 
> 
> to match with
> 
> static inline void do_raw_write_seqcount_begin(seqcount_t *s)
> {
> 	kcsan_nestable_atomic_begin();
> 	s->sequence++;
> 	smp_wmb();
> }
> 
> 
> 

I don't see anything wrong here. As per my understanding,
do_raw_write_seqcount_end() marks the end of the writer side critical
section. The data modified in the critical section should be visisble to
the *reader* before seqcount::sequence increment is visible. The 
smp_wmb() here pairs with the smp_rmb() in the read_seqcount_begin().
Pls see kernel/sched/cputime.c for an example.

Thanks,
Pavan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ