Dwarves Archive on lore.kernel.org
 help / color / Atom feed
* pahole BRAIN FART ALERT on F12
@ 2009-11-23 22:17 Mike Snitzer
       [not found] ` <20091123221703.GA10860-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Snitzer @ 2009-11-23 22:17 UTC (permalink / raw)
  To: Arnaldo de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Hi,

I just found out about pahole today.  I'm looking to audit lvm2's data
structures and pahole is perfect for helping me do so.

Unfortunately, when I run pahole against lvm2 I'm getting many BRAIN
FART ALERTs on F12 x86_64 (dwarves-1.7-5.x86_64).  I had a look at your
OLS 2007 "7 dwarves" paper and figured I'd try your minimalist
swiss_cheese example, this is what I get:

$ pahole swiss_cheese
struct cheese {
        char                       name[17];             /*     0    17 */
        short int                  age;                  /*     0     2 */
        char                       type;                 /*     0     1 */
        int                        calories;             /*     0     4 */
        short int                  price;                /*     0     2 */
        int                        barcode[4];           /*     0    16 */

        /* size: 48, cachelines: 1, members: 6 */
        /* padding: 32 */
        /* last cacheline: 48 bytes */

        /* BRAIN FART ALERT! 48 != 17 + 0(holes), diff = 31 */

};

When I compare the above to the output listed in your paper it is clear
pahole is pretty unhappy on F12.  If I do the same on F11 (x86_64) all
works fine.

Should I open a fedora (F12) bug?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: pahole BRAIN FART ALERT on F12
       [not found] ` <20091123221703.GA10860-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-23 22:49   ` Arnaldo de Melo
       [not found]     ` <20091123224921.GA9654-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo de Melo @ 2009-11-23 22:49 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Em Mon, Nov 23, 2009 at 05:17:03PM -0500, Mike Snitzer escreveu:
> Hi,
> 
> I just found out about pahole today.  I'm looking to audit lvm2's data
> structures and pahole is perfect for helping me do so.
> 
> Unfortunately, when I run pahole against lvm2 I'm getting many BRAIN
> FART ALERTs on F12 x86_64 (dwarves-1.7-5.x86_64).  I had a look at your
> OLS 2007 "7 dwarves" paper and figured I'd try your minimalist
> swiss_cheese example, this is what I get:
> 
> $ pahole swiss_cheese
> struct cheese {
>         char                       name[17];             /*     0    17 */
>         short int                  age;                  /*     0     2 */
>         char                       type;                 /*     0     1 */
>         int                        calories;             /*     0     4 */
>         short int                  price;                /*     0     2 */
>         int                        barcode[4];           /*     0    16 */
> 
>         /* size: 48, cachelines: 1, members: 6 */
>         /* padding: 32 */
>         /* last cacheline: 48 bytes */
> 
>         /* BRAIN FART ALERT! 48 != 17 + 0(holes), diff = 31 */
> 
> };
> 
> When I compare the above to the output listed in your paper it is clear
> pahole is pretty unhappy on F12.  If I do the same on F11 (x86_64) all
> works fine.
> 
> Should I open a fedora (F12) bug?

You should, I think this is related to some recent elfutils changes that
Mark Wieelard warned me about it but I hadn't time yet to act upon, will
do so tomorrow, thanks for the report!

Some milliseconds ago I was almost going to suggest you using the git
version, but then I realized this is too strange to seem like something
I could have fixed in the git repository :-\

That also should be another reason for me to do the f11->f12 step :-)

Thanks!

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: pahole BRAIN FART ALERT on F12
       [not found]     ` <20091123224921.GA9654-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
@ 2009-11-23 22:56       ` Mike Snitzer
       [not found]         ` <20091123225615.GD10860-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Snitzer @ 2009-11-23 22:56 UTC (permalink / raw)
  To: Arnaldo de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

On Mon, Nov 23 2009 at  5:49pm -0500,
Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:

> Em Mon, Nov 23, 2009 at 05:17:03PM -0500, Mike Snitzer escreveu:
> > Hi,
> > 
> > I just found out about pahole today.  I'm looking to audit lvm2's data
> > structures and pahole is perfect for helping me do so.
> > 
> > Unfortunately, when I run pahole against lvm2 I'm getting many BRAIN
> > FART ALERTs on F12 x86_64 (dwarves-1.7-5.x86_64).  I had a look at your
> > OLS 2007 "7 dwarves" paper and figured I'd try your minimalist
> > swiss_cheese example, this is what I get:
> > 
> > $ pahole swiss_cheese
> > struct cheese {
> >         char                       name[17];             /*     0    17 */
> >         short int                  age;                  /*     0     2 */
> >         char                       type;                 /*     0     1 */
> >         int                        calories;             /*     0     4 */
> >         short int                  price;                /*     0     2 */
> >         int                        barcode[4];           /*     0    16 */
> > 
> >         /* size: 48, cachelines: 1, members: 6 */
> >         /* padding: 32 */
> >         /* last cacheline: 48 bytes */
> > 
> >         /* BRAIN FART ALERT! 48 != 17 + 0(holes), diff = 31 */
> > 
> > };
> > 
> > When I compare the above to the output listed in your paper it is clear
> > pahole is pretty unhappy on F12.  If I do the same on F11 (x86_64) all
> > works fine.
> > 
> > Should I open a fedora (F12) bug?
> 
> You should, I think this is related to some recent elfutils changes that
> Mark Wieelard warned me about it but I hadn't time yet to act upon, will
> do so tomorrow, thanks for the report!
> 
> Some milliseconds ago I was almost going to suggest you using the git
> version, but then I realized this is too strange to seem like something
> I could have fixed in the git repository :-\
> 
> That also should be another reason for me to do the f11->f12 step :-)

Yes... embrace F12... :)

BTW, I did try the latest git version from:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/pahole.git

It didn't work either.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: pahole BRAIN FART ALERT on F12
       [not found]         ` <20091123225615.GD10860-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-24  0:10           ` Arnaldo de Melo
       [not found]             ` <20091124001047.GF15547-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo de Melo @ 2009-11-24  0:10 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA


[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

Em Mon, Nov 23, 2009 at 05:56:15PM -0500, Mike Snitzer escreveu:
> On Mon, Nov 23 2009 at  5:49pm -0500,
> Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > Em Mon, Nov 23, 2009 at 05:17:03PM -0500, Mike Snitzer escreveu:
> > > Unfortunately, when I run pahole against lvm2 I'm getting many BRAIN
> > > FART ALERTs on F12 x86_64 (dwarves-1.7-5.x86_64).  I had a look at your
> > > OLS 2007 "7 dwarves" paper and figured I'd try your minimalist
> > > swiss_cheese example, this is what I get:
> > > $ pahole swiss_cheese
> > > struct cheese {
> > >         char                       name[17];             /*     0    17 */
> > >         short int                  age;                  /*     0     2 */
> > >         char                       type;                 /*     0     1 */
<SNIP>
> > >         /* BRAIN FART ALERT! 48 != 17 + 0(holes), diff = 31 */
> > > };
> > You should, I think this is related to some recent elfutils changes that
> > Mark Wieelard warned me about it but I hadn't time yet to act upon, will
> > do so tomorrow, thanks for the report!
 
> BTW, I did try the latest git version from:
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/pahole.git
> It didn't work either.

Can you try with the attached patch applied against the git repo
version?

Best Regards,

- Arnaldo

[-- Attachment #2: attr_offset.patch --]
[-- Type: text/plain, Size: 794 bytes --]

diff --git a/dwarf_loader.c b/dwarf_loader.c
index 44605a8..3b58ecb 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -242,9 +242,23 @@ static Dwarf_Off attr_offset(Dwarf_Die *die, const uint32_t name)
 	Dwarf_Attribute attr;
 	Dwarf_Block block;
 
-	if (dwarf_attr(die, name, &attr) != NULL &&
-	    dwarf_formblock(&attr, &block) == 0)
-		return dwarf_expr(block.data, block.length);
+	if (dwarf_attr(die, name, &attr) == NULL)
+		return 0;
+
+	switch (dwarf_whatform(&attr)) {
+	case DW_FORM_data1:
+	case DW_FORM_data2:
+	case DW_FORM_sdata:
+	case DW_FORM_udata: {
+		Dwarf_Word value;
+		if (dwarf_formudata(&attr, &value) == 0)
+			return value;
+		break;
+	}
+	default:
+		if (dwarf_formblock(&attr, &block) == 0)
+			return dwarf_expr(block.data, block.length);
+	}
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: pahole BRAIN FART ALERT on F12
       [not found]             ` <20091124001047.GF15547-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
@ 2009-11-24 13:28               ` Mike Snitzer
       [not found]                 ` <20091124132831.GA31662-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Snitzer @ 2009-11-24 13:28 UTC (permalink / raw)
  To: Arnaldo de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

On Mon, Nov 23 2009 at  7:10pm -0500,
Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:

> Em Mon, Nov 23, 2009 at 05:56:15PM -0500, Mike Snitzer escreveu:
> > On Mon, Nov 23 2009 at  5:49pm -0500,
> > Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > > Em Mon, Nov 23, 2009 at 05:17:03PM -0500, Mike Snitzer escreveu:
> > > > Unfortunately, when I run pahole against lvm2 I'm getting many BRAIN
> > > > FART ALERTs on F12 x86_64 (dwarves-1.7-5.x86_64).  I had a look at your
> > > > OLS 2007 "7 dwarves" paper and figured I'd try your minimalist
> > > > swiss_cheese example, this is what I get:
> > > > $ pahole swiss_cheese
> > > > struct cheese {
> > > >         char                       name[17];             /*     0    17 */
> > > >         short int                  age;                  /*     0     2 */
> > > >         char                       type;                 /*     0     1 */
> <SNIP>
> > > >         /* BRAIN FART ALERT! 48 != 17 + 0(holes), diff = 31 */
> > > > };
> > > You should, I think this is related to some recent elfutils changes that
> > > Mark Wieelard warned me about it but I hadn't time yet to act upon, will
> > > do so tomorrow, thanks for the report!
>  
> > BTW, I did try the latest git version from:
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/pahole.git
> > It didn't work either.
> 
> Can you try with the attached patch applied against the git repo
> version?

Works great, thanks!

Would you still like me to file an F12 bug?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: pahole BRAIN FART ALERT on F12
       [not found]                 ` <20091124132831.GA31662-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-24 14:52                   ` Arnaldo de Melo
       [not found]                     ` <20091124145212.GC9654-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo de Melo @ 2009-11-24 14:52 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Em Tue, Nov 24, 2009 at 08:28:31AM -0500, Mike Snitzer escreveu:
> On Mon, Nov 23 2009 at  7:10pm -0500,
> Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > Em Mon, Nov 23, 2009 at 05:56:15PM -0500, Mike Snitzer escreveu:
> > > On Mon, Nov 23 2009 at  5:49pm -0500,
> > > Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > > > Em Mon, Nov 23, 2009 at 05:17:03PM -0500, Mike Snitzer escreveu:
> > > > > Unfortunately, when I run pahole against lvm2 I'm getting many BRAIN
> > > > > FART ALERTs on F12 x86_64 (dwarves-1.7-5.x86_64).  I had a look at your
> > > > > OLS 2007 "7 dwarves" paper and figured I'd try your minimalist
> > > > > swiss_cheese example, this is what I get:
> > > > > $ pahole swiss_cheese
> > > > > struct cheese {
> > > > >         char                       name[17];             /*     0    17 */
> > > > >         short int                  age;                  /*     0     2 */
> > > > >         char                       type;                 /*     0     1 */
> > <SNIP>
> > > > >         /* BRAIN FART ALERT! 48 != 17 + 0(holes), diff = 31 */
> > > > > };
> > > > You should, I think this is related to some recent elfutils changes that
> > > > Mark Wieelard warned me about it but I hadn't time yet to act upon, will
> > > > do so tomorrow, thanks for the report!
> >  
> > > BTW, I did try the latest git version from:
> > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/pahole.git
> > > It didn't work either.
> > 
> > Can you try with the attached patch applied against the git repo
> > version?
> 
> Works great, thanks!
> 
> Would you still like me to file an F12 bug?

Please, as I'll have to go the process for updating the package... :-)

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: pahole BRAIN FART ALERT on F12
       [not found]                     ` <20091124145212.GC9654-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
@ 2009-11-24 15:18                       ` Mike Snitzer
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Snitzer @ 2009-11-24 15:18 UTC (permalink / raw)
  To: Arnaldo de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

On Tue, Nov 24 2009 at  9:52am -0500,
Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:

> Em Tue, Nov 24, 2009 at 08:28:31AM -0500, Mike Snitzer escreveu:
> > On Mon, Nov 23 2009 at  7:10pm -0500,
> > Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > > Em Mon, Nov 23, 2009 at 05:56:15PM -0500, Mike Snitzer escreveu:
> > > > On Mon, Nov 23 2009 at  5:49pm -0500,
> > > > Arnaldo de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > > > > Em Mon, Nov 23, 2009 at 05:17:03PM -0500, Mike Snitzer escreveu:
> > > > > > Unfortunately, when I run pahole against lvm2 I'm getting many BRAIN
> > > > > > FART ALERTs on F12 x86_64 (dwarves-1.7-5.x86_64).  I had a look at your
> > > > > > OLS 2007 "7 dwarves" paper and figured I'd try your minimalist
> > > > > > swiss_cheese example, this is what I get:
> > > > > > $ pahole swiss_cheese
> > > > > > struct cheese {
> > > > > >         char                       name[17];             /*     0    17 */
> > > > > >         short int                  age;                  /*     0     2 */
> > > > > >         char                       type;                 /*     0     1 */
> > > <SNIP>
> > > > > >         /* BRAIN FART ALERT! 48 != 17 + 0(holes), diff = 31 */
> > > > > > };
> > > > > You should, I think this is related to some recent elfutils changes that
> > > > > Mark Wieelard warned me about it but I hadn't time yet to act upon, will
> > > > > do so tomorrow, thanks for the report!
> > >  
> > > > BTW, I did try the latest git version from:
> > > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/pahole.git
> > > > It didn't work either.
> > > 
> > > Can you try with the attached patch applied against the git repo
> > > version?
> > 
> > Works great, thanks!
> > 
> > Would you still like me to file an F12 bug?
> 
> Please, as I'll have to go the process for updating the package... :-)

Done, please see RH bz # 540955
--
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-23 22:17 pahole BRAIN FART ALERT on F12 Mike Snitzer
     [not found] ` <20091123221703.GA10860-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-23 22:49   ` Arnaldo de Melo
     [not found]     ` <20091123224921.GA9654-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-11-23 22:56       ` Mike Snitzer
     [not found]         ` <20091123225615.GD10860-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-24  0:10           ` Arnaldo de Melo
     [not found]             ` <20091124001047.GF15547-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-11-24 13:28               ` Mike Snitzer
     [not found]                 ` <20091124132831.GA31662-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-24 14:52                   ` Arnaldo de Melo
     [not found]                     ` <20091124145212.GC9654-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-11-24 15:18                       ` Mike Snitzer

Dwarves Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dwarves/0 dwarves/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dwarves dwarves/ https://lore.kernel.org/dwarves \
		dwarves@vger.kernel.org
	public-inbox-index dwarves

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dwarves


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git