All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: dwarves@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: Encoding BTF information from DWARF causes "has void type" error.
Date: Tue, 6 Feb 2024 10:42:37 -0300	[thread overview]
Message-ID: <ZcI3TVlOYuQfCWv2@x1> (raw)
In-Reply-To: <20240206120226.6r7n4vQ3@linutronix.de>

On Tue, Feb 06, 2024 at 01:02:26PM +0100, Sebastian Andrzej Siewior wrote:
> with linux kernel v6.8-rc2-RT and the following file as testcase
> 
> ----->8--------
> 
> #include <linux/spinlock.h>
> #include <linux/local_lock.h>
> 
> struct per_cpu_struct {
>         local_lock_t lock;
>         unsigned int something;
> };
> 
> static DEFINE_PER_CPU(struct per_cpu_struct, per_cpu_struct) = {
>         .lock = INIT_LOCAL_LOCK(lock),
> };
> 
> DEFINE_GUARD(ll_lock, local_lock_t __percpu*,
>              local_lock(_T),
>              local_unlock(_T))
> 
> void function(void);
> void function(void)
> {
>         struct per_cpu_struct *pcs = this_cpu_ptr(&per_cpu_struct);
> 
>         guard(ll_lock)(&per_cpu_struct.lock);
>         pcs->something++;
> }
> 
> -----8<--------
> 
> compiling and running pahole afterwards:
> | make kernel/pahole-tc.o && pahole -J --btf_gen_floats -j --lang_exclude=rust  kernel/pahole-tc.o
> |   CC      kernel/pahole-tc.o
> | error: found variable 'per_cpu_struct' in CU 'kernel/pahole-tc.c' that has void type
> 
> This doesn't look good. If I swap the order of "lock" and "something"
> within per_cpu_struct then it goes away.
> The dwarf/die object it complains about has only DW_AT_abstract_origin
> and DW_AT_location set.
> At this point I am not sure if gcc wrongly created the dwarf information
> or of pahole accidentally matches the internal local_lock_t member as
> per_cpu_struct because it starts the same address.
> 
> >From dumpwarf the problematic entry is:
> | 0x0000085b:       DW_TAG_variable
> |                     DW_AT_abstract_origin       (0x0000099e "t")
> |                     DW_AT_location      (DW_OP_addr 0x0, DW_OP_stack_value)
> 
> which looks slightly different in the good case:
> | 0x00000852:         DW_TAG_variable
> |                       DW_AT_abstract_origin     (0x00000980 "t")
> |                       DW_AT_location    (0x00000040: 
> |                          [0x0000000000000046, 0x000000000000005b): DW_OP_reg3 RBX
> |                          [0x000000000000005b, 0x0000000000000061): DW_OP_addr 0x0, DW_OP_stack_value)
> |                       DW_AT_GNU_locviews        (0x0000003c)
> 
> I made an archive with c file, the compiled version in bad and good case
> (swapped the first two members), the dumpwarf output and uploaded to
> 	https://breakpoint.cc/pahole-tc.tar.xz

Lots of great info, I'm on it.

- Arnaldo

  reply	other threads:[~2024-02-06 13:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 12:02 Encoding BTF information from DWARF causes "has void type" error Sebastian Andrzej Siewior
2024-02-06 13:42 ` Arnaldo Carvalho de Melo [this message]
2024-02-06 14:23   ` Arnaldo Carvalho de Melo
2024-02-06 14:40     ` Sebastian Andrzej Siewior
2024-02-07 10:01     ` Alan Maguire
2024-02-07 11:03       ` Alan Maguire
2024-02-07 12:30         ` Sebastian Andrzej Siewior
2024-02-13 18:33           ` Alan Maguire

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=ZcI3TVlOYuQfCWv2@x1 \
    --to=acme@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=dwarves@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.