mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavan Kondeti <quic_pkondeti@quicinc.com>
To: Kassey Li <quic_yingangl@quicinc.com>
Cc: Peter Zijlstra <peterz@infradead.org>, <mingo@redhat.com>,
	<will@kernel.org>, <boqun.feng@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: seqlock:do_raw_write_seqcount_end smp_wmb
Date: Thu, 24 Aug 2023 11:43:02 +0530	[thread overview]
Message-ID: <52cc5910-af30-42d3-85a3-5eab06fea658@quicinc.com> (raw)
In-Reply-To: <3eedf328-d588-cbd2-ee99-55dc776bdf5b@quicinc.com>

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

      reply	other threads:[~2023-08-24  6:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24  1:07 Kassey Li
2023-08-24  6:13 ` Pavan Kondeti [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52cc5910-af30-42d3-85a3-5eab06fea658@quicinc.com \
    --to=quic_pkondeti@quicinc.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=quic_yingangl@quicinc.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®