All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	eddyz87@gmail.com, kernel-team@fb.com, martin.lau@kernel.org,
	clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v5 09/11] selftests/bpf: Add C tests for 16-byte returns in R0:R2
Date: Sun, 16 Aug 2026 20:50:34 -0700	[thread overview]
Message-ID: <20ceb335-905d-4301-9e72-ea59d596ea06@linux.dev> (raw)
In-Reply-To: <2435b43ae3c7dfdfac13b28256ec34050ed7a7d6b358337263b2c52003476ece@mail.kernel.org>



On 8/13/26 2:11 PM, bot+bpf-ci@kernel.org wrote:
>> diff --git a/tools/testing/selftests/bpf/progs/aggregate_ret_struct_c.c b/tools/testing/selftests/bpf/progs/aggregate_ret_struct_c.c
>> new file mode 100644
>> index 000000000000..83b1a3751988
>> --- /dev/null
>> +++ b/tools/testing/selftests/bpf/progs/aggregate_ret_struct_c.c
> [ ... ]
>
>> +struct pair {
>> +	__u64 hi;	/* R0 */
>> +	__u64 lo;	/* R2 */
>> +};
>> +
>> +union upair {
>> +	__u64 halves[2];
>> +	struct {
>> +		__u64 lo;	/* R0 */
>> +		__u64 hi;	/* R2 */
>> +	} parts;
>> +};
> This isn't a bug, but struct pair puts hi in R0 while union upair's
> parts puts lo in R0 - was the inverted naming in the union deliberate,
> or would matching the struct's order (or first/second) make the R0:R2
> mapping easier to follow?

Thanks. This is an oversight. Will fix 'struct pair' with proper ordering.

>
>> +
>> +static __noinline struct pair make_pair(__u64 a, __u64 b)
>> +{
>> +	struct pair p = { .hi = a + b, .lo = a - b };
>> +
>> +	return p;
>> +}
>> +
>> +SEC("tc")
>> +__load_if_JITed()
>> +__success __retval(0)
>> +int aggregate_ret_struct_c_test(struct __sk_buff *skb)
>> +{
>> +	__u64 a = skb->len ^ MIX_A;
>> +	__u64 b = skb->len ^ MIX_B;
>> +	struct pair p;
>> +
>> +	p = make_pair(a, b);
>> +	if (p.hi != a + b)
>> +		return 1;
>> +	if (p.lo != a - b)
>> +		return 2;
>> +
>> +	return 0;
>> +}
> [ ... ]
>
>> +static __noinline union upair make_upair(__u64 a, __u64 b)
>> +{
>> +	union upair p;
>> +
>> +	p.halves[0] = a + b;
>> +	p.halves[1] = a - b;
>> +	return p;
>> +}
>> +
>> +SEC("tc")
>> +__load_if_JITed()
>> +__success __retval(0)
>> +int aggregate_ret_union_c_test(struct __sk_buff *skb)
>> +{
>> +	__u64 a = skb->len ^ MIX_A;
>> +	__u64 b = skb->len ^ MIX_B;
>> +	union upair p;
>> +
>> +	p = make_upair(a, b);
>> +	if (p.parts.lo != a + b)
>> +		return 1;
>> +	if (p.parts.hi != a - b)
>> +		return 2;
>> +
>> +	return 0;
>> +}
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/31740414277


  reply	other threads:[~2026-08-17  3:50 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 20:02 [PATCH bpf-next v5 00/11] bpf: Support aggregate return values up to 16 bytes Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 01/11] bpf: Factor check_global_ret_scalar_reg() out of the global return check Yonghong Song
2026-08-14 22:24   ` Eduard Zingerman
2026-08-13 20:02 ` [PATCH bpf-next v5 02/11] bpf: Add helpers to describe the R0:R2 return register pair Yonghong Song
2026-08-13 21:11   ` bot+bpf-ci
2026-08-17  3:25     ` Yonghong Song
2026-08-14 22:43   ` Eduard Zingerman
2026-08-17  3:28     ` Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 03/11] bpf: Wire up JIT support for 16-byte kfunc returns Yonghong Song
2026-08-14  1:20   ` sashiko-bot
2026-08-17  3:30     ` Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 04/11] bpf: Track R2 of register-pair returns in precision backtracking Yonghong Song
2026-08-13 20:49   ` bot+bpf-ci
2026-08-17  3:32     ` Yonghong Song
2026-08-14 23:37   ` Eduard Zingerman
2026-08-17  3:33     ` Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 05/11] bpf: Account R2 of register-pair returns in live register analysis Yonghong Song
2026-08-14  1:50   ` sashiko-bot
2026-08-17  3:35     ` Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 06/11] bpf: Add verifier support for 16-byte returns in R0:R2 Yonghong Song
2026-08-13 21:11   ` bot+bpf-ci
2026-08-17  3:43     ` Yonghong Song
2026-08-14  2:26   ` sashiko-bot
2026-08-17  3:44     ` Yonghong Song
2026-08-14 23:53   ` Eduard Zingerman
2026-08-17  3:44     ` Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 07/11] bpf: Enable aggregate return types up to 16 bytes Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 08/11] bpf: Reject register-pair returns when the subprog BTF is unreliable Yonghong Song
2026-08-13 20:49   ` bot+bpf-ci
2026-08-17  3:47     ` Yonghong Song
2026-08-14  3:02   ` sashiko-bot
2026-08-17  3:49     ` Yonghong Song
2026-08-13 20:02 ` [PATCH bpf-next v5 09/11] selftests/bpf: Add C tests for 16-byte returns in R0:R2 Yonghong Song
2026-08-13 21:11   ` bot+bpf-ci
2026-08-17  3:50     ` Yonghong Song [this message]
2026-08-15  0:47   ` Eduard Zingerman
2026-08-17  3:53     ` Yonghong Song
2026-08-13 20:03 ` [PATCH bpf-next v5 10/11] selftests/bpf: Add inline-asm and subprog tests for R0:R2 returns Yonghong Song
2026-08-13 21:11   ` bot+bpf-ci
2026-08-17  3:59     ` Yonghong Song
2026-08-15  1:03   ` Eduard Zingerman
2026-08-17  4:00     ` Yonghong Song
2026-08-13 20:03 ` [PATCH bpf-next v5 11/11] Documentation/bpf: Document up to 16-byte kfunc return values in R0:R2 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=20ceb335-905d-4301-9e72-ea59d596ea06@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.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 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.