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


Groups > linux.kernel > #1300652 > unrolled thread

[PATCH 0/3] checkpatch: handling of memory barriers

Started by"Michael S. Tsirkin" <mst@redhat.com>
First post2016-01-04 12:40 +0100
Last post2016-01-08 11:20 +0100
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] checkpatch: handling of memory barriers "Michael S. Tsirkin" <mst@redhat.com> - 2016-01-04 12:40 +0100
    [PATCH 2/3] checkpatch: check for __smp outside barrier.h "Michael S. Tsirkin" <mst@redhat.com> - 2016-01-04 12:40 +0100
    [PATCH 3/3] checkpatch: add virt barriers "Michael S. Tsirkin" <mst@redhat.com> - 2016-01-04 12:40 +0100
      Re: [PATCH 3/3] checkpatch: add virt barriers Joe Perches <joe@perches.com> - 2016-01-04 17:50 +0100
        Re: [PATCH 3/3] checkpatch: add virt barriers "Michael S. Tsirkin" <mst@redhat.com> - 2016-01-04 22:10 +0100
          Re: [PATCH 3/3] checkpatch: add virt barriers Joe Perches <joe@perches.com> - 2016-01-04 23:20 +0100
            Re: [PATCH 3/3] checkpatch: add virt barriers "Michael S. Tsirkin" <mst@redhat.com> - 2016-01-08 11:20 +0100

#1300652 — [PATCH 0/3] checkpatch: handling of memory barriers

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-01-04 12:40 +0100
Subject[PATCH 0/3] checkpatch: handling of memory barriers
Message-ID<qNbEt-2Rt-3@gated-at.bofh.it>
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

--
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]


#1300654 — [PATCH 2/3] checkpatch: check for __smp outside barrier.h

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-01-04 12:40 +0100
Subject[PATCH 2/3] checkpatch: check for __smp outside barrier.h
Message-ID<qNbEu-2Rt-35@gated-at.bofh.it>
In reply to#1300652
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

--
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]


#1300657 — [PATCH 3/3] checkpatch: add virt barriers

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-01-04 12:40 +0100
Subject[PATCH 3/3] checkpatch: add virt barriers
Message-ID<qNbEv-2Rt-39@gated-at.bofh.it>
In reply to#1300652
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

--
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]


#1300881 — Re: [PATCH 3/3] checkpatch: add virt barriers

FromJoe Perches <joe@perches.com>
Date2016-01-04 17:50 +0100
SubjectRe: [PATCH 3/3] checkpatch: add virt barriers
Message-ID<qNguu-5WH-17@gated-at.bofh.it>
In reply to#1300657
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.

--
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]


#1301097 — Re: [PATCH 3/3] checkpatch: add virt barriers

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-01-04 22:10 +0100
SubjectRe: [PATCH 3/3] checkpatch: add virt barriers
Message-ID<qNky7-oU-27@gated-at.bofh.it>
In reply to#1300881
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
--
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]


#1301145 — Re: [PATCH 3/3] checkpatch: add virt barriers

FromJoe Perches <joe@perches.com>
Date2016-01-04 23:20 +0100
SubjectRe: [PATCH 3/3] checkpatch: add virt barriers
Message-ID<qNlDP-14y-7@gated-at.bofh.it>
In reply to#1301097
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.
--
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]


#1304336 — Re: [PATCH 3/3] checkpatch: add virt barriers

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-01-08 11:20 +0100
SubjectRe: [PATCH 3/3] checkpatch: add virt barriers
Message-ID<qOCjh-5hH-27@gated-at.bofh.it>
In reply to#1301145
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web