Skip to contentSkip to conversation

x86/bpf: Clean up non-standard comments, to make the code more readable

tip:x86/cleanups Daniel Borkmann 2 participants 3 messages Apr 27, 2018 – May 2, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Daniel Borkmann

author Acked-by
#1 lore raw

Hi Ingo,

Quoted 60 lines · tip-bot for Ingo Molnar
Commit-ID:  5f26c50143f58f256535bee8d93a105f36d4d2da
Gitweb:     https://git.kernel.org/tip/5f26c50143f58f256535bee8d93a105f36d4d2da
Author:     Ingo Molnar <[email protected]>
AuthorDate: Fri, 27 Apr 2018 11:54:40 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 27 Apr 2018 12:42:04 +0200

x86/bpf: Clean up non-standard comments, to make the code more readable

So by chance I looked into x86 assembly in arch/x86/net/bpf_jit_comp.c and noticed the weird and inconsistent comment style it mistakenly learned from the networking code:

/* Multi-line comment ...
* ... looks like this.
*/

Fix this to use the standard comment style specified in Documentation/CodingStyle and used in arch/x86/ as well:

/*
* Multi-line comment ...
* ... looks like this.
*/

Also, to quote Linus's ... more explicit views about this:

http://article.gmane.org/gmane.linux.kernel.cryptoapi/21066

Quoted 9 lines

But no, the networking code picked *none* of the above sane formats. Instead, it picked these two models that are just half-arsed shit-for-brains:

(no)

     /* This is disgusting drug-induced
       * crap, and should die
       */
Quoted 8 lines

(no-no-no)
/* This is also very nasty
* and visually unbalanced */

Please. The networking code actually has the *worst* possible comment style. You can literally find that (no-no-no) style, which is just really horribly disgusting and worse than the otherwise fairly similar
(d) in pretty much every way.

Also improve the comments and some other details while at it:

- Don't mix same-line and previous-line comment style on otherwise identical code patterns within the same function,

- capitalize 'BPF' and x86 register names consistently,

- capitalize sentences consistently,

- instead of 'x64' use 'x86-64': x64 is a Microsoft specific term,

- use more consistent punctuation,

Quoted 7 lines

- use standard coding style in macros as well,

- fix typos and a few other minor details.

Consistent coding style is not optional, at least in arch/x86/.

No change in functionality.

Thanks for the cleanup, looks fine to me!

Quoted 2 lines

( In case this commit causes conflicts with pending development code
I'll be glad to help resolve any conflicts! )

Any objections if we would simply route this via bpf-next tree, otherwise this will indeed cause really ugly merge conflicts throughout the JIT with pending work.

Quoted 5 lines
Cc Peter Zijlstra <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Linus Torvalds <[email protected]>
Quoted 8 lines
Cc David S. Miller <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Daniel Borkmann <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Hideaki YOSHIFUJI <[email protected]>

Thanks,
Daniel

#2 lore raw

arch/x86/net/bpf_jit_comp conflicts. was: [tip:x86/cleanups] x86/bpf: Clean up non-standard comments, to make the code more readable

Quoted 64 lines · Daniel Borkmann

Hi Ingo,

Quoted 61 lines · tip-bot for Ingo Molnar
Commit-ID:  5f26c50143f58f256535bee8d93a105f36d4d2da
Gitweb:     https://git.kernel.org/tip/5f26c50143f58f256535bee8d93a105f36d4d2da
Author:     Ingo Molnar <[email protected]>
AuthorDate: Fri, 27 Apr 2018 11:54:40 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 27 Apr 2018 12:42:04 +0200

x86/bpf: Clean up non-standard comments, to make the code more readable

So by chance I looked into x86 assembly in arch/x86/net/bpf_jit_comp.c and noticed the weird and inconsistent comment style it mistakenly learned from the networking code:

/* Multi-line comment ...
* ... looks like this.
*/

Fix this to use the standard comment style specified in Documentation/CodingStyle and used in arch/x86/ as well:

/*
* Multi-line comment ...
* ... looks like this.
*/

Also, to quote Linus's ... more explicit views about this:

Quoted 9 lines

But no, the networking code picked *none* of the above sane formats. Instead, it picked these two models that are just half-arsed shit-for-brains:

(no)

     /* This is disgusting drug-induced
       * crap, and should die
       */
Quoted 8 lines

(no-no-no)
/* This is also very nasty
* and visually unbalanced */

Please. The networking code actually has the *worst* possible comment style. You can literally find that (no-no-no) style, which is just really horribly disgusting and worse than the otherwise fairly similar
(d) in pretty much every way.

Also improve the comments and some other details while at it:

- Don't mix same-line and previous-line comment style on otherwise identical code patterns within the same function,

- capitalize 'BPF' and x86 register names consistently,

- capitalize sentences consistently,

- instead of 'x64' use 'x86-64': x64 is a Microsoft specific term,

- use more consistent punctuation,

- use standard coding style in macros as well,

Quoted 7 lines
Quoted 5 lines

- fix typos and a few other minor details.

Consistent coding style is not optional, at least in arch/x86/.

No change in functionality.

Thanks for the cleanup, looks fine to me!

same here. thanks for the cleanup!

Quoted 6 lines
Quoted 2 lines

( In case this commit causes conflicts with pending development code
I'll be glad to help resolve any conflicts! )

Any objections if we would simply route this via bpf-next tree, otherwise this will indeed cause really ugly merge conflicts throughout the JIT with pending work.

right. would be much better to route this patch via bpf-next. Though all the changes are cleanups in comments I'm pretty sure they will conflict with other changes we're doing.

Ingo,
could you please drop this patch from tip tree and resend it to us? I cannot find the original patch in any public mailing list. Only in tip-bot notification.

Personally I don't care whether bpf jit code uses networking or non-networking style of comments, but will be happy to enforce non-networking for this file in the future, since that seems to be the preference.

Thanks

#3 lore raw

Re: arch/x86/net/bpf_jit_comp conflicts. was: [tip:x86/cleanups] x86/bpf: Clean up non-standard comments, to make the code more readable

Quoted 19 lines · Alexei Starovoitov
Quoted 18 lines · Daniel Borkmann
Quoted 17 lines · tip-bot for Ingo Molnar

Commit-ID:  5f26c50143f58f256535bee8d93a105f36d4d2da
Gitweb:     https://git.kernel.org/tip/5f26c50143f58f256535bee8d93a105f36d4d2da
Author:     Ingo Molnar <[email protected]>
AuthorDate: Fri, 27 Apr 2018 11:54:40 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 27 Apr 2018 12:42:04 +0200

x86/bpf: Clean up non-standard comments, to make the code more readable

So by chance I looked into x86 assembly in arch/x86/net/bpf_jit_comp.c and noticed the weird and inconsistent comment style it mistakenly learned from the networking code:

 /* Multi-line comment ...
  * ... looks like this.
  */

[...]

Quoted 12 lines
Quoted 3 lines
Quoted 1 line

No change in functionality.

Thanks for the cleanup, looks fine to me!

same here. thanks for the cleanup!

Quoted 6 lines
Quoted 2 lines

( In case this commit causes conflicts with pending development code I'll be glad to help resolve any conflicts! )

Any objections if we would simply route this via bpf-next tree, otherwise this will indeed cause really ugly merge conflicts throughout the JIT with pending work.

Since no one hollered I've cherry picked this into bpf-next tree so that upcoming BPF work can be rebased on top of this, thanks Ingo!

Quoted 15 lines

right. would be much better to route this patch via bpf-next. Though all the changes are cleanups in comments I'm pretty sure they will conflict with other changes we're doing.

Ingo,
could you please drop this patch from tip tree and resend it to us? I cannot find the original patch in any public mailing list. Only in tip-bot notification.

Personally I don't care whether bpf jit code uses networking or non-networking style of comments, but will be happy to enforce non-networking for this file in the future, since that seems to be the preference.

Thanks