Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1299360 > unrolled thread

[PATCH 08/34] asm-generic: smp_store_mb should use smp_mb

Started by"Michael S. Tsirkin" <mst@redhat.com>
First post2015-12-30 14:30 +0100
Last post2015-12-30 23:50 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 08/34] asm-generic: smp_store_mb should use smp_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 14:30 +0100
    Re: [PATCH 08/34] asm-generic: smp_store_mb should use smp_mb Arnd Bergmann <arnd@arndb.de> - 2015-12-30 14:50 +0100
      Re: [PATCH 08/34] asm-generic: smp_store_mb should use smp_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 21:40 +0100
        Re: [PATCH 08/34] asm-generic: smp_store_mb should use smp_mb Arnd Bergmann <arnd@arndb.de> - 2015-12-30 23:50 +0100

#1299360 — [PATCH 08/34] asm-generic: smp_store_mb should use smp_mb

From"Michael S. Tsirkin" <mst@redhat.com>
Date2015-12-30 14:30 +0100
Subject[PATCH 08/34] asm-generic: smp_store_mb should use smp_mb
Message-ID<qLoZd-79S-33@gated-at.bofh.it>
asm-generic variant of smp_store_mb() calls mb() which is stronger
than implied by both the name and the documentation.

smp_store_mb is only used by core kernel code at the moment, so
we know no one mis-uses it for an MMIO barrier.
Make it call smp_mb consistently before some arch-specific
code uses it as such by mistake.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/asm-generic/barrier.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
index 538f8d1..987b2e0 100644
--- a/include/asm-generic/barrier.h
+++ b/include/asm-generic/barrier.h
@@ -93,7 +93,7 @@
 #endif	/* CONFIG_SMP */
 
 #ifndef smp_store_mb
-#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); mb(); } while (0)
+#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); smp_mb(); } while (0)
 #endif
 
 #ifndef smp_mb__before_atomic
-- 
MST

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1299369

FromArnd Bergmann <arnd@arndb.de>
Date2015-12-30 14:50 +0100
Message-ID<qLpiz-7ib-19@gated-at.bofh.it>
In reply to#1299360
On Wednesday 30 December 2015 15:24:47 Michael S. Tsirkin wrote:
> asm-generic variant of smp_store_mb() calls mb() which is stronger
> than implied by both the name and the documentation.
> 
> smp_store_mb is only used by core kernel code at the moment, so
> we know no one mis-uses it for an MMIO barrier.
> Make it call smp_mb consistently before some arch-specific
> code uses it as such by mistake.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/asm-generic/barrier.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
> index 538f8d1..987b2e0 100644
> --- a/include/asm-generic/barrier.h
> +++ b/include/asm-generic/barrier.h
> @@ -93,7 +93,7 @@
>  #endif	/* CONFIG_SMP */
>  
>  #ifndef smp_store_mb
> -#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); mb(); } while (0)
> +#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); smp_mb(); } while (0)
>  #endif
>  
>  #ifndef smp_mb__before_atomic
> 

The same patch is already in the tip tree scheduled for 4.5 as d5a73cadf3fd
("lcoking/barriers, arch: Use smp barriers in smp_store_release()").

I think you can drop your version.

	arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299484

From"Michael S. Tsirkin" <mst@redhat.com>
Date2015-12-30 21:40 +0100
Message-ID<qLvHk-2WR-17@gated-at.bofh.it>
In reply to#1299369
On Wed, Dec 30, 2015 at 02:44:21PM +0100, Arnd Bergmann wrote:
> On Wednesday 30 December 2015 15:24:47 Michael S. Tsirkin wrote:
> > asm-generic variant of smp_store_mb() calls mb() which is stronger
> > than implied by both the name and the documentation.
> > 
> > smp_store_mb is only used by core kernel code at the moment, so
> > we know no one mis-uses it for an MMIO barrier.
> > Make it call smp_mb consistently before some arch-specific
> > code uses it as such by mistake.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  include/asm-generic/barrier.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
> > index 538f8d1..987b2e0 100644
> > --- a/include/asm-generic/barrier.h
> > +++ b/include/asm-generic/barrier.h
> > @@ -93,7 +93,7 @@
> >  #endif	/* CONFIG_SMP */
> >  
> >  #ifndef smp_store_mb
> > -#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); mb(); } while (0)
> > +#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); smp_mb(); } while (0)
> >  #endif
> >  
> >  #ifndef smp_mb__before_atomic
> > 
> 
> The same patch is already in the tip tree scheduled for 4.5 as d5a73cadf3fd
> ("lcoking/barriers, arch: Use smp barriers in smp_store_release()").

Sorry which tree do you mean exactly?

> I think you can drop your version.
> 
> 	arnd

Will drop mine, thanks.
I kind of dislike that if I just drop it, some arches will temporarily
regress to a slower implementation.
I think I can just cherry-pick d5a73cadf3fd into my tree: git
normally figures such duplicates out nicely.
Does this sound good?

-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299529

FromArnd Bergmann <arnd@arndb.de>
Date2015-12-30 23:50 +0100
Message-ID<qLxJ7-4cl-9@gated-at.bofh.it>
In reply to#1299484
On Wednesday 30 December 2015 22:30:38 Michael S. Tsirkin wrote:
> On Wed, Dec 30, 2015 at 02:44:21PM +0100, Arnd Bergmann wrote:
> > On Wednesday 30 December 2015 15:24:47 Michael S. Tsirkin wrote:

> > >  #ifndef smp_store_mb
> > > -#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); mb(); } while (0)
> > > +#define smp_store_mb(var, value)  do { WRITE_ONCE(var, value); smp_mb(); } while (0)
> > >  #endif
> > >  
> > >  #ifndef smp_mb__before_atomic
> > > 
> > 
> > The same patch is already in the tip tree scheduled for 4.5 as d5a73cadf3fd
> > ("lcoking/barriers, arch: Use smp barriers in smp_store_release()").
> 
> Sorry which tree do you mean exactly?

$ git log --ancestry-path --oneline --merges d5a73cadf3fd..next/master | tail -n 17
cb17a685bed6 Merge remote-tracking branch 'tip/auto-latest'
f29c2e03f0b3 Merge branch 'x86/urgent'
8cd6990bf71d Merge branch 'x86/platform'
0541d92a5eb4 Merge branch 'x86/mm'
aa7c8013c8c0 Merge branch 'x86/fpu'
fcc9a1bd013c Merge branch 'x86/efi'
e74ef3f60886 Merge branch 'x86/cpu'
44a4f0063508 Merge branch 'x86/cleanups'
28c814578fcf Merge branch 'x86/cache'
d74ff99dada8 Merge branch 'x86/boot'
db3c55380b10 Merge branch 'x86/asm'
7cd91b91da20 Merge branch 'x86/apic'
7bfc343947e6 Merge branch 'timers/core'
1720bbcb66d1 Merge branch 'sched/core'
af9a59f26764 Merge branch 'ras/core'
984b85eca78d Merge branch 'perf/core'
d2b22d438aab Merge branch 'locking/core'

$ grep auto-latest Next/Trees 
tip             git     git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git#auto-latest

So locking/core of tip.git has the patch and gets merged into linux-next
through auto-latest in tip.git.

> > I think you can drop your version.
> > 
> >       arnd
> 
> Will drop mine, thanks.
> I kind of dislike that if I just drop it, some arches will temporarily
> regress to a slower implementation.
> I think I can just cherry-pick d5a73cadf3fd into my tree: git
> normally figures such duplicates out nicely.
> Does this sound good?

I don't think there is a perfect solution, you can either cherry-pick
it and get a duplicate commit in the git history, or you merge in the
whole locking/core branch from tip.

I'd say ask Ingo/PeterZ/Davidlohr which way they prefer.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web