mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: chenyuan_fl@163.com,bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,linux-kselftest@vger.kernel.org,mykyta.yatsenko5@gmail.com,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,martin.lau@linux.dev,emil@etsalapatis.com,ihor.solodrai@linux.dev,shuah@kernel.org,gnq25@mails.tsinghua.edu.cn,chenyuan@kylinos.cn,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v3 3/4] selftests/bpf: Test rhtab kptr recycle from NMI context
Date: Tue,  1 Sep 2026 07:37:32 +0000 (UTC)	[thread overview]
Message-ID: <06a2dd01e897308215bde044bd80409b99491e61a646671383c8301738caac22@mail.kernel.org> (raw)
In-Reply-To: <20260901062845.1379760-4-chenyuan_fl@163.com>

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

> diff --git a/tools/testing/selftests/bpf/progs/rhtab_kptr.c b/tools/testing/selftests/bpf/progs/rhtab_kptr.c
> new file mode 100644
> index 0000000000000..c96cf7f2d799b
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/rhtab_kptr.c
> @@ -0,0 +1,146 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2026 KylinSoft Co., Ltd. */
> +
> +/*
> + * Verify that the rhtab update/delete recycle paths do not eagerly destroy
> + * referenced kptrs. rhtab must match the hash map semantics introduced by
> + * commit a3a81d247651 ("bpf: Cancel special fields on map value recycle"):
> + * only NMI-safe fields (timer, workqueue, task_work) are cancelled on
> + * update/delete, while kptrs stay attached to the recycled element until it
> + * is eventually freed.

[ ... ]

> +#include <vmlinux.h>
> +#include <bpf/bpf_helpers.h>
> +#include "rhtab_kptr_common.h"

[ ... ]

> diff --git a/tools/testing/selftests/bpf/rhtab_kptr_common.h b/tools/testing/selftests/bpf/rhtab_kptr_common.h
> new file mode 100644
> index 0000000000000..1b629fcb6742d
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/rhtab_kptr_common.h
> @@ -0,0 +1,6 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright (c) 2026 KylinSoft Co., Ltd. */
> +#pragma once
> +
> +/* Magic value stored in the plain bytes of rhtab values ("RHAS"). */
> +#define RHTAB_MAGIC 0x52484153

This isn't a bug, but since only progs/rhtab_kptr.c uses RHTAB_MAGIC,
could the define live in that file instead of a separate _common.h
header?

The *_common.h idiom at the selftests root is for constants that
genuinely have to be identical on both the BPF and the userspace side.
Here the userspace side never includes the header and never uses
RHTAB_MAGIC. Moving the define into progs/rhtab_kptr.c next to struct
val_t would avoid relying on the root directory being on the include
path for .bpf.o builds, and root-level headers are not listed in the
.bpf.o prerequisites, so edits to the header do not trigger a rebuild.


---
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/33478386254

  reply	other threads:[~2026-09-01  7:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DKM6K95EN9OF.3O9XNYWVLYHDE@gmail.com>
2026-08-24 14:36 ` [PATCH bpf-next v2 0/4] bpf: Cancel special fields in resizable hashtab on recycle chenyuan_fl
2026-08-24 14:36   ` [PATCH 1/4] " chenyuan_fl
2026-08-24 15:42     ` bot+bpf-ci
2026-08-24 16:15     ` Mykyta Yatsenko
2026-09-01  6:28       ` [PATCH bpf-next v3 0/4] " chenyuan_fl
2026-09-01  6:28         ` [PATCH bpf-next v3 1/4] " chenyuan_fl
2026-09-01  7:37           ` bot+bpf-ci
2026-09-01 16:57           ` Mykyta Yatsenko
2026-09-01  6:28         ` [PATCH bpf-next v3 2/4] bpf: Fix use-after-free of program BTF in mem-alloc destructor chenyuan_fl
2026-09-01 17:10           ` Mykyta Yatsenko
2026-09-01  6:28         ` [PATCH bpf-next v3 3/4] selftests/bpf: Test rhtab kptr recycle from NMI context chenyuan_fl
2026-09-01  7:37           ` bot+bpf-ci [this message]
2026-09-01  6:28         ` [PATCH bpf-next v3 4/4] selftests/bpf: Test rhtab special-field combinations chenyuan_fl
2026-09-01  7:37           ` bot+bpf-ci
2026-09-04 10:49         ` [PATCH bpf-next v3 0/4] bpf: Cancel special fields in resizable hashtab on recycle Kumar Kartikeya Dwivedi
2026-08-24 14:36   ` [PATCH 2/4] bpf: Fix use-after-free of program BTF in mem-alloc destructor chenyuan_fl
2026-08-24 15:42     ` bot+bpf-ci
2026-08-24 14:36   ` [PATCH 3/4] selftests/bpf: Test rhtab kptr recycle from NMI context chenyuan_fl
2026-08-24 15:42     ` bot+bpf-ci
2026-08-24 14:36   ` [PATCH 4/4] selftests/bpf: Test rhtab special-field combinations chenyuan_fl
2026-08-24 15:42     ` bot+bpf-ci

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=06a2dd01e897308215bde044bd80409b99491e61a646671383c8301738caac22@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenyuan@kylinos.cn \
    --cc=chenyuan_fl@163.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=gnq25@mails.tsinghua.edu.cn \
    --cc=ihor.solodrai@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=shuah@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

all inboxes | Powered by JetHome®