dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: David Sterba <dsterba-AlSwsSmVLrQ@public.gmane.org>
Cc: dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Brain fart alert
Date: Wed, 11 Nov 2015 19:17:47 -0300	[thread overview]
Message-ID: <20151111221747.GC12579@kernel.org> (raw)
In-Reply-To: <20151111221340.GB12579-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Em Wed, Nov 11, 2015 at 07:13:40PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Nov 11, 2015 at 10:05:19PM +0100, David Sterba escreveu:
> > On Wed, Nov 11, 2015 at 05:11:51PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > struct btrfs_path {
> > ...
> > > >         u8                         reada;                /*   128     1 */
> > > >         u8                         lowest_level;         /*   129     1 */
> > ...
> > > > };
> ...
> > > 	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 */
> ...
> > > 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...

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-11-11 22:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 18:26 Brain fart alert David Sterba
     [not found] ` <20151111182618.GF6445-AlSwsSmVLrQ@public.gmane.org>
2015-11-11 20:11   ` Arnaldo Carvalho de Melo
     [not found]     ` <20151111201151.GA6712-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-11-11 21:05       ` David Sterba
     [not found]         ` <20151111210519.GG6445-AlSwsSmVLrQ@public.gmane.org>
2015-11-11 22:13           ` Arnaldo Carvalho de Melo
     [not found]             ` <20151111221340.GB12579-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-11-11 22:17               ` Arnaldo Carvalho de Melo [this message]
     [not found]                 ` <20151111221747.GC12579-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-11-11 22:48                   ` Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2012-07-21 18:22 Nicolas
     [not found] ` <CACHCVZ6oDyFwGbC4EwF_wsR9tCkoych5N6buLhRRLcyaL6iifw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-15 17:56   ` Arnaldo Carvalho de Melo
     [not found]     ` <20120815175647.GK2370-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2012-08-16 19:52       ` Arnaldo Carvalho de Melo
     [not found]         ` <20120816195224.GC10277-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2012-08-19 22:16           ` Mark Wielaard
2012-08-20 13:45         ` Dodji Seketeli
     [not found]           ` <m3obm5fzhs.fsf-fIDRvF7C5exg9hUCZPvPmw@public.gmane.org>
2012-08-20 17:35             ` Arnaldo Carvalho de Melo
2012-08-20 18:02   ` Arnaldo Carvalho de Melo
     [not found]     ` <20120820180216.GE3046-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2012-08-20 18:28       ` Arnaldo Carvalho de Melo
2012-08-30 16:35       ` Nicolas
     [not found]         ` <CACHCVZ5EJadxOTJ0T4phSfAcm1FK7wfeDTp9QcSa1V1JCpa8SA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-03 12:22           ` Mark Wielaard
     [not found]             ` <1346674948.3090.40.camel-OO0OHOuVXW89n/EXqpbZ8ns8WZQLr0HW@public.gmane.org>
2012-09-24 22:19               ` Nicolas
     [not found]                 ` <5060DC56.4080609-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-26  1:50                   ` Nicolas
     [not found]                     ` <CACHCVZ6uvDW1CpyxXio3P17EL6bE=FKGDNm11RNZTceR-dWLjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-26 10:56                       ` Mark Wielaard
     [not found]                         ` <1361876163.4930.4.camel-Et2QWsRS+g7yukXOleVwRPp4M6BF03vq@public.gmane.org>
2013-03-20 13:37                           ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151111221747.GC12579@kernel.org \
    --to=acme-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dsterba-AlSwsSmVLrQ@public.gmane.org \
    --cc=dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).