Skip to contentSkip to conversation

bitops: Fix incorrect value in comment

PATCH In review Ayan Kumar Halder 5 participants 8 messages Nov 30, 2021 – Dec 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bitops: Fix incorrect value in comment

GENMASK(30, 21) should be 0x7fe00000. Fixed this in the comment in bitops.h.

---
Changelog :-
v2 :- 1. Replaced the word "vector" with "value" in comment.
2. Changed 0x07fe00000 to 0x7fe00000.
3. Updated the commit message to make it meaningful. (All suggested by Jan Beulich)

 xen/include/xen/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/bitops.h +1 -1
index a64595f68e..dad4b5aa1e 100644
@@ -5,7 +5,7 @@
 /*
  * Create a contiguous bitmask starting at bit position @l and ending at
  * position @h. For example
- * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000.
+ * GENMASK(30, 21) gives us the 32bit value 0x7fe00000.
  */
 #define GENMASK(h, l) \
     (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#2 lore raw
In reply to Ayan Kumar Halder

Hi Ayan,

Quoted 6 lines · Ayan Kumar Halder

GENMASK(30, 21) should be 0x7fe00000. Fixed this in the comment in bitops.h.

Cheers
Bertrand

Quoted 26 lines

---
Changelog :-
v2 :- 1. Replaced the word "vector" with "value" in comment.
2. Changed 0x07fe00000 to 0x7fe00000.
3. Updated the commit message to make it meaningful. (All suggested by Jan Beulich)

xen/include/xen/bitops.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/bitops.h +1 -1
index a64595f68e..dad4b5aa1e 100644
@@ -5,7 +5,7 @@
 /*
 * Create a contiguous bitmask starting at bit position @l and ending at
 * position @h. For example
- * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000.
+ * GENMASK(30, 21) gives us the 32bit value 0x7fe00000.
 */
 #define GENMASK(h, l) \
    (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
Signature · 1 line
2.17.1
#3 lore raw
In reply to Ayan Kumar Halder

Hi,

Quoted 2 lines · Ayan Kumar Halder

GENMASK(30, 21) should be 0x7fe00000. Fixed this in the comment in bitops.h.

I am afraid this commit message is incomplete. You say you just corrected the bitmask returned but...

Quoted 17 lines

---
Changelog :-
v2 :- 1. Replaced the word "vector" with "value" in comment.
2. Changed 0x07fe00000 to 0x7fe00000.
3. Updated the commit message to make it meaningful. (All suggested by Jan Beulich)

  xen/include/xen/bitops.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/bitops.h +0 -0
index a64595f68e..dad4b5aa1e 100644

xen/include/xen/bitops.h line 8

Quoted 5 lines
xen/include/xen/bitops.h +1 -1
@@ -5,7 +5,7 @@
  /*
   * Create a contiguous bitmask starting at bit position @l and ending at
   * position @h. For example
- * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000.
+ * GENMASK(30, 21) gives us the 32bit value 0x7fe00000.

... there are two extra changes here:
1) The bitmask is now described with 8-characters (rather than 9)
2) 'vector' is replaced with 'value'

The former makes sense to me, but it is not clear to me why the latter should be changed.

Cheers,

Signature · 1 line
Julien Grall
#4 lore raw
Quoted 14 lines · Julien Grall

xen/include/xen/bitops.h line 8

Quoted 8 lines · Ayan Kumar Halder
xen/include/xen/bitops.h +1 -1
@@ -5,7 +5,7 @@
  /*
   * Create a contiguous bitmask starting at bit position @l and ending at
   * position @h. For example
- * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000.
+ * GENMASK(30, 21) gives us the 32bit value 0x7fe00000.

... there are two extra changes here:
1) The bitmask is now described with 8-characters (rather than 9)
2) 'vector' is replaced with 'value'

Quoted 2 lines

The former makes sense to me, but it is not clear to me why the latter should be changed.

Would you mind explaining to me in which way you see "vector" accurately describe the entity talked about?

I also think the commit message is quite fine as is.

Jan

#5 lore raw

Hi,

Quoted 15 lines · Jan Beulich
Quoted 14 lines · Julien Grall

xen/include/xen/bitops.h line 8

Quoted 8 lines · Ayan Kumar Halder
xen/include/xen/bitops.h +1 -1
@@ -5,7 +5,7 @@
   /*
    * Create a contiguous bitmask starting at bit position @l and ending at
    * position @h. For example
- * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000.
+ * GENMASK(30, 21) gives us the 32bit value 0x7fe00000.

... there are two extra changes here:
1) The bitmask is now described with 8-characters (rather than 9)
2) 'vector' is replaced with 'value'

Quoted 5 lines
Quoted 2 lines

The former makes sense to me, but it is not clear to me why the latter should be changed.

Would you mind explaining to me in which way you see "vector" accurately describe the entity talked about?

This can be seen as a vector of bit. I can see why people may think otherwise. However... if you think it doesn't describe it accurately, then I think this ought to be changed in Linux first (where the code and comment comes from).

Quoted 2 lines

I also think the commit message is quite fine as is.

IMHO, this is similar to when one do coding style change in a patch. They are unrelated but would be acceptable so long they are explained in the commit message.

What I request is something like:

"GENMASK(30, 21) should be 0x7fe00000 and only use 8-characters (it is a 32-bit comment). Fixed this in the comment.

Take the opportunity to replace 'vector' with 'value' because..."

This is simple enough and clarify what is the intent of the patch.

Cheers,

Signature · 1 line
Julien Grall
#6 lore raw
Quoted 36 lines · Julien Grall

Hi,

Quoted 16 lines · Jan Beulich
Quoted 15 lines · Julien Grall
Quoted 9 lines · Ayan Kumar Halder
xen/include/xen/bitops.h +0 -0
@@ -5,7 +5,7 @@
    /*
     * Create a contiguous bitmask starting at bit position @l and

ending at
    * position @h. For example
- * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000.
+ * GENMASK(30, 21) gives us the 32bit value 0x7fe00000.

... there are two extra changes here:
    1) The bitmask is now described with 8-characters (rather than 9)
    2) 'vector' is replaced with 'value'

Quoted 5 lines
Quoted 2 lines

The former makes sense to me, but it is not clear to me why the latter should be changed.

Would you mind explaining to me in which way you see "vector" accurately describe the entity talked about?

This can be seen as a vector of bit. I can see why people may think otherwise. However... if you think it doesn't describe it accurately, then I think this ought to be changed in Linux first (where the code and comment comes from).

Quoted 2 lines

I also think the commit message is quite fine as is.

IMHO, this is similar to when one do coding style change in a patch. They are unrelated but would be acceptable so long they are explained in the commit message.

Quoted 8 lines

What I request is something like:

"GENMASK(30, 21) should be 0x7fe00000 and only use 8-characters (it is a 32-bit comment). Fixed this in the comment.

Take the opportunity to replace 'vector' with 'value' because..."

This is simple enough and clarify what is the intent of the patch.

This is an unreasonable quantity of bikeshedding.  It's just a comment, and a commit message of "fix the comment" is perfectly fine. Furthermore, the intent of the text is clear.

However, "32bit $WHATEVER" is also wrong because GENMASK() yields a unsigned long constant.  Importantly, not 32 bits in an ARM64 build.

This trivial patch has lingered far too long.  I have committed it, along with an adjustment.  Further bikeshedding will be redirected to /dev/null.

~Andrew

#7 lore raw

Hi Andrew,

Quoted 39 lines · Andrew Cooper
Quoted 38 lines · Julien Grall

Hi,

Quoted 16 lines · Jan Beulich
Quoted 15 lines · Julien Grall
Quoted 9 lines · Ayan Kumar Halder
xen/include/xen/bitops.h +0 -0
@@ -5,7 +5,7 @@
    /*
     * Create a contiguous bitmask starting at bit position @l and

ending at
    * position @h. For example
- * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000.
+ * GENMASK(30, 21) gives us the 32bit value 0x7fe00000.

... there are two extra changes here:
    1) The bitmask is now described with 8-characters (rather than 9)
    2) 'vector' is replaced with 'value'

Quoted 5 lines
Quoted 2 lines

The former makes sense to me, but it is not clear to me why the latter should be changed.

Would you mind explaining to me in which way you see "vector" accurately describe the entity talked about?

This can be seen as a vector of bit. I can see why people may think otherwise. However... if you think it doesn't describe it accurately, then I think this ought to be changed in Linux first (where the code and comment comes from).

Quoted 2 lines

I also think the commit message is quite fine as is.

IMHO, this is similar to when one do coding style change in a patch. They are unrelated but would be acceptable so long they are explained in the commit message.

What I request is something like:

Quoted 8 lines
Quoted 6 lines

"GENMASK(30, 21) should be 0x7fe00000 and only use 8-characters (it is a 32-bit comment). Fixed this in the comment.

Take the opportunity to replace 'vector' with 'value' because..."

This is simple enough and clarify what is the intent of the patch.

This is an unreasonable quantity of bikeshedding.

I didn't realize that two emails were considered bikeshedding. I actually provided and worked towards a solution rather than unhelpfully saying just no.

Quoted 11 lines

It's just a comment,
and a commit message of "fix the comment" is perfectly fine. Furthermore, the intent of the text is clear.

However, "32bit $WHATEVER" is also wrong because GENMASK() yields a unsigned long constant.  Importantly, not 32 bits in an ARM64 build.

This trivial patch has lingered far too long.  I have committed it, along with an adjustment.  Further bikeshedding will be redirected to /dev/null.

It is an interesting approach. I could have committed this patch after updating the commit message like you did ;).

But, so far, I have refrained from blatantly ignoring comments and going ahead with committing ([1] is an example where this could be used) because I think we should try to have a consensus first.

Anyway, I am happy to accept that two maintainers have an opposite view from me and go with the tide. That said, there are probably better a way to express your view...

Cheers,

[1] https://lore.kernel.org/xen-devel/[email protected]/

Signature · 1 line
Julien Grall