BPF List
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Yonghong Song" <yonghong.song@linux.dev>,
	"Alan Maguire" <alan.maguire@oracle.com>,
	"Arnaldo Carvalho de Melo" <arnaldo.melo@gmail.com>,
	<dwarves@vger.kernel.org>
Cc: "Andrii Nakryiko" <andrii@kernel.org>, <bpf@vger.kernel.org>,
	<kernel-team@fb.com>, "Tejun Heo" <tj@kernel.org>
Subject: Re: [PATCH dwarves 1/2] dwarf_loader: Trust the entry value register over the first location entry
Date: Sat, 26 Sep 2026 07:45:02 +0000	[thread overview]
Message-ID: <DLP2WZASF7LP.18SWCONJDR4LV@gmail.com> (raw)
In-Reply-To: <20260925213619.2187751-1-yonghong.song@linux.dev>

On Fri, Sep 25, 2026 at 02:36 PM Yonghong Song <yonghong.song@linux.dev> wrote:
> DW_OP_entry_value(DW_OP_regN) says the parameter still holds the value regN
> had on entry to the function, so regN is by definition the register the
> parameter was passed in.  That is better evidence than the first location
> list entry, so prefer it.

my bot is saying that this is not quite the case.

gcc 13 -O2 for

long f6(long a, long b)
{
	b = a;
	ext();
	ext();
	return 0;
}

describes 'b' as:
  [0x40, 0x44): DW_OP_reg4 RSI
  [0x44, 0x4c): DW_OP_reg5 RDI
  [0x4c, 0x59): DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value

pahole encodes f6() today. With this patch loc_reg of 'b' becomes RDI,
RSI is expected, and f6() is dropped.

> +	if (entry_value_reg != PARAMETER_UNKNOWN_REG && !parameter__has_piece_info(parm))
> +		parm->loc_reg = entry_value_reg;

This fixes only the functions where clang happened to emit
an entry value. clang -O2 for

bool g_lazy(struct task *p, bool lazy)
{
	rcu_lock();
	__atomic_store_n(&p->lazy, lazy, __ATOMIC_RELAXED);
	rcu_unlock();
	return lazy;
}

describes 'lazy' as:
  [0x09, 0x1e): DW_OP_reg3 RBX
  [0x1e, 0x21): DW_OP_reg0 RAX

low_pc is 0. There is no entry value, so g_lazy() is still dropped.
With 'int lazy' the list starts at low_pc with RSI.
Looks like clang loses the entry range for every bool arg.


  parent reply	other threads:[~2026-09-26  7:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 21:36 [PATCH dwarves 1/2] dwarf_loader: Trust the entry value register over the first location entry Yonghong Song
2026-09-25 21:36 ` [PATCH dwarves 2/2] tests: Add test for parameters described by entry values Yonghong Song
2026-09-26  7:45 ` Alexei Starovoitov [this message]
2026-09-27  5:49   ` [PATCH dwarves 1/2] dwarf_loader: Trust the entry value register over the first location entry Yonghong Song
2026-09-27  8:37     ` Tejun Heo
2026-09-29  6:11     ` Alexei Starovoitov
2026-09-29 17:59       ` Yonghong Song

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=DLP2WZASF7LP.18SWCONJDR4LV@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=tj@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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