* [PATCH 0/3] checkpatch: handling of memory barriers
@ 2016-01-04 11:36 Michael S. Tsirkin
2016-01-04 11:36 ` [PATCH 1/3] checkpatch.pl: add missing " Michael S. Tsirkin
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-04 11:36 UTC (permalink / raw)
To: linux-kernel
Cc: Cc : Andy Whitcroft, Joe Perches, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
As part of memory barrier cleanup, this patchset
extends checkpatch to make it easier to stop
incorrect memory barrier usage.
This applies on top of my series
arch: barrier cleanup + barriers for virt
and will be included in the next version of the series.
Michael S. Tsirkin (3):
checkpatch.pl: add missing memory barriers
checkpatch: check for __smp outside barrier.h
checkpatch: add virt barriers
scripts/checkpatch.pl | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
--
MST
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/3] checkpatch.pl: add missing memory barriers
2016-01-04 11:36 [PATCH 0/3] checkpatch: handling of memory barriers Michael S. Tsirkin
@ 2016-01-04 11:36 ` Michael S. Tsirkin
2016-01-04 16:07 ` Joe Perches
2016-01-04 11:37 ` [PATCH 2/3] checkpatch: check for __smp outside barrier.h Michael S. Tsirkin
2016-01-04 11:37 ` [PATCH 3/3] checkpatch: add virt barriers Michael S. Tsirkin
2 siblings, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-04 11:36 UTC (permalink / raw)
To: linux-kernel
Cc: Cc : Andy Whitcroft, Joe Perches, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
SMP-only barriers were missing in checkpatch.pl
Refactor code slightly to make adding more variants easier.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
scripts/checkpatch.pl | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2b3c228..0245bbe 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5116,7 +5116,14 @@ sub process {
}
}
# check for memory barriers without a comment.
- if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) {
+
+ my @barriers = ('mb', 'rmb', 'wmb', 'read_barrier_depends');
+ my @smp_barriers = ('smp_store_release', 'smp_load_acquire', 'smp_store_mb');
+
+ @smp_barriers = (@smp_barriers, map {"smp_" . $_} @barriers);
+ my $all_barriers = join('|', (@barriers, @smp_barriers));
+
+ if ($line =~ /\b($all_barriers)\(/) {
if (!ctx_has_comment($first_line, $linenr)) {
WARN("MEMORY_BARRIER",
"memory barrier without comment\n" . $herecurr);
--
MST
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/3] checkpatch: check for __smp outside barrier.h
2016-01-04 11:36 [PATCH 0/3] checkpatch: handling of memory barriers Michael S. Tsirkin
2016-01-04 11:36 ` [PATCH 1/3] checkpatch.pl: add missing " Michael S. Tsirkin
@ 2016-01-04 11:37 ` Michael S. Tsirkin
2016-01-04 11:37 ` [PATCH 3/3] checkpatch: add virt barriers Michael S. Tsirkin
2 siblings, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-04 11:37 UTC (permalink / raw)
To: linux-kernel
Cc: Cc : Andy Whitcroft, Joe Perches, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
Introduction of __smp barriers cleans up a bunch of duplicate code, but
it gives people an additional handle onto a "new" set of barriers - just
because they're prefixed with __* unfortunately doesn't stop anyone from
using it (as happened with other arch stuff before.)
Add a checkpatch test so it will trigger a warning.
Reported-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
scripts/checkpatch.pl | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0245bbe..e3f9ad9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5130,6 +5130,17 @@ sub process {
}
}
+ my @underscore_smp_barriers = map {"__" . $_} @smp_barriers;
+ my $underscore_all_barriers = join('|', @underscore_smp_barriers);
+
+ if ($realfile !~ m@^include/asm-generic/@ &&
+ $realfile !~ m@/barrier\.h$@ &&
+ $line =~ m/\b($underscore_all_barriers)\(/ &&
+ $line !~ m/^.\s*\#\s*define\s+($underscore_all_barriers)\(/) {
+ WARN("MEMORY_BARRIER",
+ "__smp memory barriers shouldn't be used outside barrier.h and asm-generic\n" . $herecurr);
+ }
+
# check for waitqueue_active without a comment.
if ($line =~ /\bwaitqueue_active\s*\(/) {
if (!ctx_has_comment($first_line, $linenr)) {
--
MST
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/3] checkpatch: add virt barriers
2016-01-04 11:36 [PATCH 0/3] checkpatch: handling of memory barriers Michael S. Tsirkin
2016-01-04 11:36 ` [PATCH 1/3] checkpatch.pl: add missing " Michael S. Tsirkin
2016-01-04 11:37 ` [PATCH 2/3] checkpatch: check for __smp outside barrier.h Michael S. Tsirkin
@ 2016-01-04 11:37 ` Michael S. Tsirkin
2016-01-04 16:47 ` Joe Perches
2 siblings, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-04 11:37 UTC (permalink / raw)
To: linux-kernel
Cc: Cc : Andy Whitcroft, Joe Perches, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
Add virt_ barriers to list of barriers to check for
presence of a comment.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3f9ad9..5fb6ef7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5121,7 +5121,8 @@ sub process {
my @smp_barriers = ('smp_store_release', 'smp_load_acquire', 'smp_store_mb');
@smp_barriers = (@smp_barriers, map {"smp_" . $_} @barriers);
- my $all_barriers = join('|', (@barriers, @smp_barriers));
+ my @virt_barriers = map {my $l = $_; $l =~ s/smp_/virt_/; $l} @smp_barriers;
+ my $all_barriers = join('|', (@barriers, @smp_barriers, @virt_barriers));
if ($line =~ /\b($all_barriers)\(/) {
if (!ctx_has_comment($first_line, $linenr)) {
--
MST
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] checkpatch.pl: add missing memory barriers
2016-01-04 11:36 ` [PATCH 1/3] checkpatch.pl: add missing " Michael S. Tsirkin
@ 2016-01-04 16:07 ` Joe Perches
2016-01-04 16:11 ` Russell King - ARM Linux
2016-01-04 20:45 ` Michael S. Tsirkin
0 siblings, 2 replies; 14+ messages in thread
From: Joe Perches @ 2016-01-04 16:07 UTC (permalink / raw)
To: Michael S. Tsirkin, linux-kernel
Cc: Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann, linux-arch,
Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, 2016-01-04 at 13:36 +0200, Michael S. Tsirkin wrote:
> SMP-only barriers were missing in checkpatch.pl
>
> Refactor code slightly to make adding more variants easier.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> scripts/checkpatch.pl | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2b3c228..0245bbe 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5116,7 +5116,14 @@ sub process {
> }
> }
> # check for memory barriers without a comment.
> - if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) {
> +
> + my @barriers = ('mb', 'rmb', 'wmb', 'read_barrier_depends');
> + my @smp_barriers = ('smp_store_release', 'smp_load_acquire', 'smp_store_mb');
> +
> + @smp_barriers = (@smp_barriers, map {"smp_" . $_} @barriers);
I think using map, which so far checkpatch doesn't use,
makes smp_barriers harder to understand and it'd be
better to enumerate them.
> + my $all_barriers = join('|', (@barriers, @smp_barriers));
> +
> + if ($line =~ /\b($all_barriers)\(/) {
It would be better to use /\b$all_barriers\s*\(/
as there's no reason for the capture and there
could be a space between the function and the
open parenthesis.
> if (!ctx_has_comment($first_line, $linenr)) {
> WARN("MEMORY_BARRIER",
> "memory barrier without comment\n" . $herecurr);
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] checkpatch.pl: add missing memory barriers
2016-01-04 16:07 ` Joe Perches
@ 2016-01-04 16:11 ` Russell King - ARM Linux
2016-01-04 16:15 ` Joe Perches
2016-01-04 20:45 ` Michael S. Tsirkin
1 sibling, 1 reply; 14+ messages in thread
From: Russell King - ARM Linux @ 2016-01-04 16:11 UTC (permalink / raw)
To: Joe Perches
Cc: Michael S. Tsirkin, linux-kernel, Cc : Andy Whitcroft,
Peter Zijlstra, Arnd Bergmann, linux-arch, Andrew Cooper,
virtualization, Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, David Miller, linux-ia64, linuxppc-dev,
linux-s390, sparclinux, linux-arm-kernel, linux-metag,
linux-mips, x86, user-mode-linux-devel, adi-buildroot-devel,
linux-sh, linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov
On Mon, Jan 04, 2016 at 08:07:40AM -0800, Joe Perches wrote:
> On Mon, 2016-01-04 at 13:36 +0200, Michael S. Tsirkin wrote:
> > + my $all_barriers = join('|', (@barriers, @smp_barriers));
> > +
> > + if ($line =~ /\b($all_barriers)\(/) {
>
> It would be better to use /\b$all_barriers\s*\(/
> as there's no reason for the capture and there
> could be a space between the function and the
> open parenthesis.
I think you mean
/\b(?:$all_barriers)\s*\(/
as 'all_barriers' will be:
mb|wmb|rmb|smp_mb|smp_wmb|smp_rmb
and putting that into your suggestion results in:
/\bmb|wmb|rmb|smp_mb|smp_wmb|smp_rmb\s*\(/
which is clearly wrong - the \b only applies to 'mb' and the \s*\( only
applies to smp_rmb.
--
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] checkpatch.pl: add missing memory barriers
2016-01-04 16:11 ` Russell King - ARM Linux
@ 2016-01-04 16:15 ` Joe Perches
0 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2016-01-04 16:15 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Michael S. Tsirkin, linux-kernel, Cc : Andy Whitcroft,
Peter Zijlstra, Arnd Bergmann, linux-arch, Andrew Cooper,
virtualization, Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, David Miller, linux-ia64, linuxppc-dev,
linux-s390, sparclinux, linux-arm-kernel, linux-metag,
linux-mips, x86, user-mode-linux-devel, adi-buildroot-devel,
linux-sh, linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov
On Mon, 2016-01-04 at 16:11 +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 04, 2016 at 08:07:40AM -0800, Joe Perches wrote:
> > On Mon, 2016-01-04 at 13:36 +0200, Michael S. Tsirkin wrote:
> > > + my $all_barriers = join('|', (@barriers, @smp_barriers));
> > > +
> > > + if ($line =~ /\b($all_barriers)\(/) {
> >
> > It would be better to use /\b$all_barriers\s*\(/
> > as there's no reason for the capture and there
> > could be a space between the function and the
> > open parenthesis.
>
> I think you mean
>
> /\b(?:$all_barriers)\s*\(/
>
> as 'all_barriers' will be:
>
> mb|wmb|rmb|smp_mb|smp_wmb|smp_rmb
>
> and putting that into your suggestion results in:
>
> /\bmb|wmb|rmb|smp_mb|smp_wmb|smp_rmb\s*\(/
>
> which is clearly wrong - the \b only applies to 'mb' and the \s*\( only
> applies to smp_rmb.
right, thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] checkpatch: add virt barriers
2016-01-04 11:37 ` [PATCH 3/3] checkpatch: add virt barriers Michael S. Tsirkin
@ 2016-01-04 16:47 ` Joe Perches
2016-01-04 21:07 ` Michael S. Tsirkin
0 siblings, 1 reply; 14+ messages in thread
From: Joe Perches @ 2016-01-04 16:47 UTC (permalink / raw)
To: Michael S. Tsirkin, linux-kernel
Cc: Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann, linux-arch,
Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, 2016-01-04 at 13:37 +0200, Michael S. Tsirkin wrote:
> Add virt_ barriers to list of barriers to check for
> presence of a comment.
Are these virt_ barriers used anywhere?
I see some virtio_ barrier like uses.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] checkpatch.pl: add missing memory barriers
2016-01-04 16:07 ` Joe Perches
2016-01-04 16:11 ` Russell King - ARM Linux
@ 2016-01-04 20:45 ` Michael S. Tsirkin
2016-01-04 22:15 ` Joe Perches
1 sibling, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-04 20:45 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, Jan 04, 2016 at 08:07:40AM -0800, Joe Perches wrote:
> On Mon, 2016-01-04 at 13:36 +0200, Michael S. Tsirkin wrote:
> > SMP-only barriers were missing in checkpatch.pl
> >
> > Refactor code slightly to make adding more variants easier.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > scripts/checkpatch.pl | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 2b3c228..0245bbe 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -5116,7 +5116,14 @@ sub process {
> > }
> > }
> > # check for memory barriers without a comment.
> > - if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) {
> > +
> > + my @barriers = ('mb', 'rmb', 'wmb', 'read_barrier_depends');
> > + my @smp_barriers = ('smp_store_release', 'smp_load_acquire', 'smp_store_mb');
> > +
> > + @smp_barriers = (@smp_barriers, map {"smp_" . $_} @barriers);
>
> I think using map, which so far checkpatch doesn't use,
> makes smp_barriers harder to understand and it'd be
> better to enumerate them.
Okay - I'll rewrite using foreach.
> > + my $all_barriers = join('|', (@barriers, @smp_barriers));
> > +
> > + if ($line =~ /\b($all_barriers)\(/) {
>
> It would be better to use /\b$all_barriers\s*\(/
> as there's no reason for the capture and there
> could be a space between the function and the
> open parenthesis.
That's the way it was - space before ( will trigger other
warnings. But sure, ok.
>
> > if (!ctx_has_comment($first_line, $linenr)) {
> > WARN("MEMORY_BARRIER",
> > "memory barrier without comment\n" . $herecurr);
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] checkpatch: add virt barriers
2016-01-04 16:47 ` Joe Perches
@ 2016-01-04 21:07 ` Michael S. Tsirkin
2016-01-04 22:11 ` Joe Perches
0 siblings, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-04 21:07 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, Jan 04, 2016 at 08:47:53AM -0800, Joe Perches wrote:
> On Mon, 2016-01-04 at 13:37 +0200, Michael S. Tsirkin wrote:
> > Add virt_ barriers to list of barriers to check for
> > presence of a comment.
>
> Are these virt_ barriers used anywhere?
>
> I see some virtio_ barrier like uses.
They will be :) They are added and used by patchset
arch: barrier cleanup + barriers for virt
See
http://article.gmane.org/gmane.linux.kernel.virtualization/26555
--
MST
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] checkpatch: add virt barriers
2016-01-04 21:07 ` Michael S. Tsirkin
@ 2016-01-04 22:11 ` Joe Perches
2016-01-08 10:14 ` Michael S. Tsirkin
0 siblings, 1 reply; 14+ messages in thread
From: Joe Perches @ 2016-01-04 22:11 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, 2016-01-04 at 23:07 +0200, Michael S. Tsirkin wrote:
> On Mon, Jan 04, 2016 at 08:47:53AM -0800, Joe Perches wrote:
> > On Mon, 2016-01-04 at 13:37 +0200, Michael S. Tsirkin wrote:
> > > Add virt_ barriers to list of barriers to check for
> > > presence of a comment.
> >
> > Are these virt_ barriers used anywhere?
> >
> > I see some virtio_ barrier like uses.
>
> They will be :) They are added and used by patchset
> arch: barrier cleanup + barriers for virt
>
> See
> http://article.gmane.org/gmane.linux.kernel.virtualization/26555
Ah, OK, thanks.
Are the virtio_ barriers going away?
If not, maybe those should be added too.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] checkpatch.pl: add missing memory barriers
2016-01-04 20:45 ` Michael S. Tsirkin
@ 2016-01-04 22:15 ` Joe Perches
2016-01-10 11:42 ` Michael S. Tsirkin
0 siblings, 1 reply; 14+ messages in thread
From: Joe Perches @ 2016-01-04 22:15 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, 2016-01-04 at 22:45 +0200, Michael S. Tsirkin wrote:
> On Mon, Jan 04, 2016 at 08:07:40AM -0800, Joe Perches wrote:
> > On Mon, 2016-01-04 at 13:36 +0200, Michael S. Tsirkin wrote:
> > > SMP-only barriers were missing in checkpatch.pl
> > >
> > > Refactor code slightly to make adding more variants easier.
> > >
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > > scripts/checkpatch.pl | 9 ++++++++-
> > > 1 file changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index 2b3c228..0245bbe 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -5116,7 +5116,14 @@ sub process {
> > > }
> > > }
> > > # check for memory barriers without a comment.
> > > - if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) {
> > > +
> > > + my @barriers = ('mb', 'rmb', 'wmb', 'read_barrier_depends');
> > > + my @smp_barriers = ('smp_store_release', 'smp_load_acquire', 'smp_store_mb');
> > > +
> > > + @smp_barriers = (@smp_barriers, map {"smp_" . $_} @barriers);
> >
> > I think using map, which so far checkpatch doesn't use,
> > makes smp_barriers harder to understand and it'd be
> > better to enumerate them.
>
> Okay - I'll rewrite using foreach.
>
I think using the qr form (like 'our $Attribute' and
a bunch of others) is the general style that should
be used for checkpatch.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] checkpatch: add virt barriers
2016-01-04 22:11 ` Joe Perches
@ 2016-01-08 10:14 ` Michael S. Tsirkin
0 siblings, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-08 10:14 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, Jan 04, 2016 at 02:11:37PM -0800, Joe Perches wrote:
> On Mon, 2016-01-04 at 23:07 +0200, Michael S. Tsirkin wrote:
> > On Mon, Jan 04, 2016 at 08:47:53AM -0800, Joe Perches wrote:
> > > On Mon, 2016-01-04 at 13:37 +0200, Michael S. Tsirkin wrote:
> > > > Add virt_ barriers to list of barriers to check for
> > > > presence of a comment.
> > >
> > > Are these virt_ barriers used anywhere?
> > >
> > > I see some virtio_ barrier like uses.
> >
> > They will be :) They are added and used by patchset
> > arch: barrier cleanup + barriers for virt
> >
> > See
> > http://article.gmane.org/gmane.linux.kernel.virtualization/26555
>
> Ah, OK, thanks.
>
> Are the virtio_ barriers going away?
> If not, maybe those should be added too.
I don't mind. I'll queue a patch like that.
--
MST
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] checkpatch.pl: add missing memory barriers
2016-01-04 22:15 ` Joe Perches
@ 2016-01-10 11:42 ` Michael S. Tsirkin
0 siblings, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-01-10 11:42 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Cc : Andy Whitcroft, Peter Zijlstra, Arnd Bergmann,
linux-arch, Andrew Cooper, virtualization, Stefano Stabellini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, David Miller,
linux-ia64, linuxppc-dev, linux-s390, sparclinux,
linux-arm-kernel, linux-metag, linux-mips, x86,
user-mode-linux-devel, adi-buildroot-devel, linux-sh,
linux-xtensa, xen-devel, Ingo Molnar, Tony Lindgren,
Andrey Konovalov, Russell King - ARM Linux
On Mon, Jan 04, 2016 at 02:15:50PM -0800, Joe Perches wrote:
> On Mon, 2016-01-04 at 22:45 +0200, Michael S. Tsirkin wrote:
> > On Mon, Jan 04, 2016 at 08:07:40AM -0800, Joe Perches wrote:
> > > On Mon, 2016-01-04 at 13:36 +0200, Michael S. Tsirkin wrote:
> > > > SMP-only barriers were missing in checkpatch.pl
> > > >
> > > > Refactor code slightly to make adding more variants easier.
> > > >
> > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > ---
> > > > scripts/checkpatch.pl | 9 ++++++++-
> > > > 1 file changed, 8 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > > index 2b3c228..0245bbe 100755
> > > > --- a/scripts/checkpatch.pl
> > > > +++ b/scripts/checkpatch.pl
> > > > @@ -5116,7 +5116,14 @@ sub process {
> > > > }
> > > > }
> > > > # check for memory barriers without a comment.
> > > > - if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) {
> > > > +
> > > > + my @barriers = ('mb', 'rmb', 'wmb', 'read_barrier_depends');
> > > > + my @smp_barriers = ('smp_store_release', 'smp_load_acquire', 'smp_store_mb');
> > > > +
> > > > + @smp_barriers = (@smp_barriers, map {"smp_" . $_} @barriers);
> > >
> > > I think using map, which so far checkpatch doesn't use,
> > > makes smp_barriers harder to understand and it'd be
> > > better to enumerate them.
> >
> > Okay - I'll rewrite using foreach.
> >
>
> I think using the qr form (like 'our $Attribute' and
> a bunch of others) is the general style that should
> be used for checkpatch.
Thanks - that's what I did in the new version (included in
v3 of the arch cleanup patchset now).
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-01-10 11:42 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 11:36 [PATCH 0/3] checkpatch: handling of memory barriers Michael S. Tsirkin
2016-01-04 11:36 ` [PATCH 1/3] checkpatch.pl: add missing " Michael S. Tsirkin
2016-01-04 16:07 ` Joe Perches
2016-01-04 16:11 ` Russell King - ARM Linux
2016-01-04 16:15 ` Joe Perches
2016-01-04 20:45 ` Michael S. Tsirkin
2016-01-04 22:15 ` Joe Perches
2016-01-10 11:42 ` Michael S. Tsirkin
2016-01-04 11:37 ` [PATCH 2/3] checkpatch: check for __smp outside barrier.h Michael S. Tsirkin
2016-01-04 11:37 ` [PATCH 3/3] checkpatch: add virt barriers Michael S. Tsirkin
2016-01-04 16:47 ` Joe Perches
2016-01-04 21:07 ` Michael S. Tsirkin
2016-01-04 22:11 ` Joe Perches
2016-01-08 10:14 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).