Brain fart alert
Hi,
with current git version 1.10 (79536f4f9587703c7136d2654824630689880f5c):
struct btrfs_path {
struct extent_buffer * nodes[8]; /* 0 64 */
/* --- cacheline 1 boundary (64 bytes) --- */
int slots[8]; /* 64 32 */
int locks[8]; /* 96 32 */
/* --- cacheline 2 boundary (128 bytes) --- */
u8 reada; /* 128 1 */
u8 lowest_level; /* 129 1 */
/* Bitfield combined with previous fields */
unsigned int search_for_split:1; /* 128:15 4 */
unsigned int keep_locks:1; /* 128:14 4 */
unsigned int skip_locking:1; /* 128:13 4 */
unsigned int leave_spinning:1; /* 128:12 4 */
unsigned int search_commit_root:1; /* 128:11 4 */
unsigned int need_commit_sem:1; /* 128:10 4 */
unsigned int skip_release_on_error:1; /* 128: 9 4 */
/* size: 136, cachelines: 3, members: 12 */ /* padding: 4 */
/* bit_padding: 25 bits */
/* last cacheline: 8 bytes */
/* BRAIN FART ALERT! 136 != 136 + 0(holes), diff = 0 */
};
Looks like it's the bitfield combining.
$ gcc --version gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
binutils-2.23.2
Let me know if you need more information.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Em Wed, Nov 11, 2015 at 07:26:18PM +0100, David Sterba escreveu:
Quoted 30 lines
Hi,
with current git version 1.10 (
79536f4f9587703c7136d2654824630689880f5c):struct
btrfs_path{
structextent_buffer* nodes[8]; /* 0 64 */
/* --- cacheline 1 boundary (64 bytes) --- */
int slots[8]; /* 64 32 */
int locks[8]; /* 96 32 */
/* --- cacheline 2 boundary (128 bytes) --- */
u8 reada; /* 128 1 */
u8lowest_level; /* 129 1 *//* Bitfield combined with previous fields */
unsigned int search_for_split:1; /* 128:15 4 */
unsigned int keep_locks:1; /* 128:14 4 */
unsigned int skip_locking:1; /* 128:13 4 */
unsigned int leave_spinning:1; /* 128:12 4 */
unsigned int search_commit_root:1; /* 128:11 4 */
unsigned int need_commit_sem:1; /* 128:10 4 */
unsigned int skip_release_on_error:1; /* 128: 9 4 *//* size: 136, cachelines: 3, members: 12 */ /* padding: 4 */
/*bit_padding: 25 bits */
/* last cacheline: 8 bytes */
/* BRAIN FART ALERT! 136 != 136 + 0(holes), diff = 0 */
};
Quoted 8 lines
Looks like it's the bitfield combining.
$ gcc --version gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]binutils-2.23.2
Let me know if you need more information.
Ok, so with:
[acme@zoo linux]$ pahole -C btrfs_path ../build/v4.3.0+/fs/btrfs/btrfs.odie__process_function: tag not supported 0x4109 (GNU_call_site)! struct btrfs_path {
struct extent_buffer * nodes[8]; /* 0 64 */
/* --- cacheline 1 boundary (64 bytes) --- */
int slots[8]; /* 64 32 */
int locks[8]; /* 96 32 */
/* --- cacheline 2 boundary (128 bytes) --- */
int reada; /* 128 4 */
int lowest_level; /* 132 4 */
unsigned int search_for_split:1; /* 136:31 4 */
unsigned int keep_locks:1; /* 136:30 4 */
unsigned int skip_locking:1; /* 136:29 4 */
unsigned int leave_spinning:1; /* 136:28 4 */
unsigned int search_commit_root:1; /* 136:27 4 */
unsigned int need_commit_sem:1; /* 136:26 4 */
unsigned int skip_release_on_error:1; /* 136:25 4 */
/* size: 144, cachelines: 3, members: 12 */ /* padding: 4 */
/* bit_padding: 25 bits */
/* last cacheline: 16 bytes */
};
[acme@zoo linux]$
Ok, but then 'reada' and 'lowest_level' are both int in my file, lemme try converting it and rebuilding...
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Arnaldo Carvalho de Melo
Quoted 1 line
struct
btrfs_path{
...
Quoted 2 lines
Quoted 2 lines
u8 reada; /* 128 1 */ u8 lowest_level; /* 129 1 */
...
Quoted 27 lines
Quoted 1 line
};
[acme@zoo linux]$ pahole -C
btrfs_path../build/v4.3.0+/fs/btrfs/btrfs.odie__process_function: tag not supported0x4109(GNU_call_site)! structbtrfs_path{
structextent_buffer* nodes[8]; /* 0 64 */
/* --- cacheline 1 boundary (64 bytes) --- */
int slots[8]; /* 64 32 */
int locks[8]; /* 96 32 */
/* --- cacheline 2 boundary (128 bytes) --- */
int reada; /* 128 4 */
intlowest_level; /* 132 4 */
unsigned int search_for_split:1; /* 136:31 4 */
unsigned int keep_locks:1; /* 136:30 4 */
unsigned int skip_locking:1; /* 136:29 4 */
unsigned int leave_spinning:1; /* 136:28 4 */
unsigned int search_commit_root:1; /* 136:27 4 */
unsigned int need_commit_sem:1; /* 136:26 4 */
unsigned int skip_release_on_error:1; /* 136:25 4 *//* size: 144, cachelines: 3, members: 12 */ /* padding: 4 */
/*bit_padding: 25 bits */
/* last cacheline: 16 bytes */
};
[acme@zoo linux]$
Quoted 2 lines
Ok, but then 'reada' and '
lowest_level' are both int in my file, lemme try converting it and rebuilding...
Yes, they're both 'int' in current git versions, I'm trying to reduce size of the structure and using pahole to see the result. When both members were switched to u8 the warning appeared. Sorry for confusion. --
To unsubscribe from this list: send the line "unsubscribe dwarves" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Em Wed, Nov 11, 2015 at 10:05:19PM +0100, David Sterba escreveu:
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 1 line
Quoted 1 line
struct
btrfs_path{...
Quoted 2 lines
Quoted 2 lines
u8 reada; /* 128 1 */ u8 lowest_level; /* 129 1 */...
Quoted 1 line
Quoted 1 line
};
...
Quoted 4 lines
Quoted 4 lines
int reada; /* 128 4 */ int lowest_level; /* 132 4 */ unsigned int search_for_split:1; /* 136:31 4 */ unsigned int keep_locks:1; /* 136:30 4 */
...
Quoted 6 lines
Quoted 2 lines
Ok, but then 'reada' and '
lowest_level' are both int in my file, lemme try converting it and rebuilding...Yes, they're both 'int' in current git versions, I'm trying to reduce size of the structure and using pahole to see the result. When both members were switched to u8 the warning appeared. Sorry for confusion.
So, I did the change and got the same BFA, with:
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)
I'm trying to figure out how this can make sense:
u8 reada; /* 128 1 */ u8 lowest_level; /* 129 1 */
/* Bitfield combined with previous fields */ unsigned int search_for_split:1; /* 128:15 4 */ unsigned int keep_locks:1; /* 128:14 4 */ unsigned int skip_locking:1; /* 128:13 4 */ unsigned int leave_spinning:1; /* 128:12 4 */ unsigned int search_commit_root:1; /* 128:11 4 */ unsigned int need_commit_sem:1; /* 128:10 4 */ unsigned int skip_release_on_error:1; /* 128: 9 4 */
I.e. it is like skip_release_on_error uses the first bit of 'lowest_level', i.e. the ninth bit starting at byte offset 128... I was expecting it to be:
u8 reada; /* 128 1 */ u8 lowest_level; /* 129 1 */
/* Bitfield combined with previous fields */ unsigned int search_for_split:1; /* 128:22 4 */ unsigned int keep_locks:1; /* 128:21 4 */ unsigned int skip_locking:1; /* 128:20 4 */ unsigned int leave_spinning:1; /* 128:19 4 */ unsigned int search_commit_root:1; /* 128:18 4 */ unsigned int need_commit_sem:1; /* 128:17 4 */ unsigned int skip_release_on_error:1; /* 128:16 4 */
Because by combining the bitfield with the two u8 before it, it would read as:
unsigned int reada:8; /* 128:0 4 */ unsigned int lowest_level:8; /* 128:8 4 */
:-\
Looking at the readelf output now...
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Em Wed, Nov 11, 2015 at 07:13:40PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 58 lines
Em Wed, Nov 11, 2015 at 10:05:19PM +0100, David Sterba escreveu:
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 1 line
Quoted 1 line
struct
btrfs_path{...
Quoted 2 lines
Quoted 2 lines
u8 reada; /* 128 1 */ u8 lowest_level; /* 129 1 */...
Quoted 1 line
Quoted 1 line
};
...
Quoted 4 lines
Quoted 4 lines
int reada; /* 128 4 */ int lowest_level; /* 132 4 */ unsigned int search_for_split:1; /* 136:31 4 */ unsigned int keep_locks:1; /* 136:30 4 */...
Quoted 6 lines
Quoted 2 lines
Ok, but then 'reada' and '
lowest_level' are both int in my file, lemme try converting it and rebuilding...Yes, they're both 'int' in current git versions, I'm trying to reduce size of the structure and using pahole to see the result. When both members were switched to u8 the warning appeared. Sorry for confusion.
So, I did the change and got the same BFA, with:
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)
I'm trying to figure out how this can make sense:
u8 reada; /* 128 1 */ u8 lowest_level; /* 129 1 *//* Bitfield combined with previous fields */ unsigned int search_for_split:1; /* 128:15 4 */ unsigned int keep_locks:1; /* 128:14 4 */ unsigned int skip_locking:1; /* 128:13 4 */ unsigned int leave_spinning:1; /* 128:12 4 */ unsigned int search_commit_root:1; /* 128:11 4 */ unsigned int need_commit_sem:1; /* 128:10 4 */ unsigned int skip_release_on_error:1; /* 128: 9 4 */I.e. it is like
skip_release_on_erroruses the first bit of 'lowest_level', i.e. the ninth bit starting at byte offset 128... I was expecting it to be:u8 reada; /* 128 1 */ u8 lowest_level; /* 129 1 *//* Bitfield combined with previous fields */ unsigned int search_for_split:1; /* 128:22 4 */ unsigned int keep_locks:1; /* 128:21 4 */ unsigned int skip_locking:1; /* 128:20 4 */ unsigned int leave_spinning:1; /* 128:19 4 */ unsigned int search_commit_root:1; /* 128:18 4 */ unsigned int need_commit_sem:1; /* 128:17 4 */ unsigned int skip_release_on_error:1; /* 128:16 4 */Because by combining the bitfield with the two u8 before it, it would read as:
Quoted 7 lines
unsigned int reada:8; /* 128:0 4 */ unsigned int lowest_level:8; /* 128:8 4 */:-\
Looking at the readelf output now...
So, it seems to be a BFA, but on gcc's part, I'll try to cook a test...
<2><10cb7>: Abbrev Number: 34 (DW_TAG_member)
<10cb8> DW_AT_name : (indirect string, offset: 0x10d67): reada
<10cbf> DW_AT_type : <0xad>
<10cc3> DW_AT_data_member_location: 128
<2><10cc4>: Abbrev Number: 34 (DW_TAG_member)
<10cc5> DW_AT_name : (indirect string, offset: 0xfbc0): lowest_level
<10ccc> DW_AT_type : <0xad>
<10cd0> DW_AT_data_member_location: 129
<2><10cd1>: Abbrev Number: 55 (DW_TAG_member)
<10cd2> DW_AT_name : (indirect string, offset: 0xff9a): search_for_split
<10cd9> DW_AT_type : <0x78>
<10cdd> DW_AT_byte_size : 4
<10cde> DW_AT_bit_size : 1
<10cdf> DW_AT_bit_offset : 15
<10ce0> DW_AT_data_member_location: 128
<2><10ce1>: Abbrev Number: 55 (DW_TAG_member)
<10ce2> DW_AT_name : (indirect string, offset: 0x7278): keep_locks
<10ce9> DW_AT_type : <0x78>
<10ced> DW_AT_byte_size : 4
<10cee> DW_AT_bit_size : 1
<10cef> DW_AT_bit_offset : 14
<10cf0> DW_AT_data_member_location: 128
<2><10cf1>: Abbrev Number: 55 (DW_TAG_member)
<10cf2> DW_AT_name : (indirect string, offset: 0x8d9a): skip_locking
<10cf9> DW_AT_type : <0x78>
<10cfd> DW_AT_byte_size : 4
<10cfe> DW_AT_bit_size : 1
<10cff> DW_AT_bit_offset : 13
<10d00> DW_AT_data_member_location: 128
<2><10d01>: Abbrev Number: 55 (DW_TAG_member)
<10d02> DW_AT_name : (indirect string, offset: 0x1297b): leave_spinning
<10d09> DW_AT_type : <0x78>
<10d0d> DW_AT_byte_size : 4
<10d0e> DW_AT_bit_size : 1
<10d0f> DW_AT_bit_offset : 12
<10d10> DW_AT_data_member_location: 128
<2><10d11>: Abbrev Number: 55 (DW_TAG_member)
<10d12> DW_AT_name : (indirect string, offset: 0x1837): search_commit_root
<10d19> DW_AT_type : <0x78>
<10d1d> DW_AT_byte_size : 4
<10d1e> DW_AT_bit_size : 1
<10d1f> DW_AT_bit_offset : 11
<10d20> DW_AT_data_member_location: 128
<2><10d21>: Abbrev Number: 55 (DW_TAG_member)
<10d22> DW_AT_name : (indirect string, offset: 0x1205c): need_commit_sem
<10d29> DW_AT_type : <0x78>
<10d2d> DW_AT_byte_size : 4
<10d2e> DW_AT_bit_size : 1
<10d2f> DW_AT_bit_offset : 10
<10d30> DW_AT_data_member_location: 128
<2><10d31>: Abbrev Number: 55 (DW_TAG_member)
<10d32> DW_AT_name : (indirect string, offset: 0xcc1e): skip_release_on_error
<10d39> DW_AT_type : <0x78>
<10d3d> DW_AT_byte_size : 4
<10d3e> DW_AT_bit_size : 1
<10d3f> DW_AT_bit_offset : 9
<10d40> DW_AT_data_member_location: 128 --
To unsubscribe from this list: send the line "unsubscribe dwarves" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
ok, so its pahole that is getting this wrong, i.e. the offset is from the end, so, if all would be represented as bitfields, it would be:
unsigned int reada:8; /* 128:24 4 */ unsigned int lowest_level:8; /* 128:16 4 */
/* Bitfield combined with previous fields */
unsigned int search_for_split:1; /* 128:15 4 */ unsigned int keep_locks:1; /* 128:14 4 */ unsigned int skip_locking:1; /* 128:13 4 */ unsigned int leave_spinning:1; /* 128:12 4 */ unsigned int search_commit_root:1; /* 128:11 4 */ unsigned int need_commit_sem:1; /* 128:10 4 */ unsigned int skip_release_on_error:1; /* 128: 9 4 */
And the bits from 0 to 8, 9 bits, would be the bit hole, well, in this case, as it is at the end, bit padding, would be of just 9 bits, since we're using 23 bits, I'll try fixing this.
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html