From: Marat Khalili <marat.khalili@huawei.com>
To: Konstantin Ananyev <konstantin.ananyev@huawei.com>
Cc: <dev@dpdk.org>
Subject: [PATCH v2 2/7] bpf/validate: refactor internal step function
Date: Mon, 14 Sep 2026 15:54:12 +0100 [thread overview]
Message-ID: <20260914145418.37353-3-marat.khalili@huawei.com> (raw)
In-Reply-To: <20260914145418.37353-1-marat.khalili@huawei.com>
Rename `__rte_bpf_validate_debug_evaluate_step` to
`__rte_bpf_validate_debug_evaluate_update` to better reflect planned
usage, and make it accept a bitmask of events instead of a single event.
Step event is still implicitly triggered for now.
No functional changes.
Signed-off-by: Marat Khalili <marat.khalili@huawei.com>
---
lib/bpf/bpf_validate.c | 17 ++++++++---------
lib/bpf/bpf_validate_debug.c | 20 +++++++++++---------
lib/bpf/bpf_validate_debug.h | 11 ++++++-----
3 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c
index f9960088a285..b317abb81172 100644
--- a/lib/bpf/bpf_validate.c
+++ b/lib/bpf/bpf_validate.c
@@ -2989,10 +2989,9 @@ evaluate(struct bpf_verifier *bvf)
break;
}
- rc = __rte_bpf_validate_debug_evaluate_step(debug, idx,
+ rc = __rte_bpf_validate_debug_evaluate_update(debug, idx,
prev_nb_edge > 1 ?
- RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_ENTER :
- RTE_BPF_VALIDATE_DEBUG_EVENT_STEP);
+ RTE_BIT64(RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_ENTER) : 0);
if (rc < 0)
break;
@@ -3024,9 +3023,9 @@ evaluate(struct bpf_verifier *bvf)
}
if (bvf->evst->unreachable) {
- rc = __rte_bpf_validate_debug_evaluate_step(
+ rc = __rte_bpf_validate_debug_evaluate_update(
debug, get_node_idx(bvf, next),
- RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_UNREACHABLE);
+ RTE_BIT64(RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_UNREACHABLE));
if (rc < 0)
break;
@@ -3038,9 +3037,9 @@ evaluate(struct bpf_verifier *bvf)
*/
} else if (node->nb_edge > 1 &&
prune_eval_state(bvf, node, next) == 0) {
- rc = __rte_bpf_validate_debug_evaluate_step(
+ rc = __rte_bpf_validate_debug_evaluate_update(
debug, get_node_idx(bvf, next),
- RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_PRUNE);
+ RTE_BIT64(RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_PRUNE));
if (rc < 0)
break;
@@ -3059,9 +3058,9 @@ evaluate(struct bpf_verifier *bvf)
*/
if (prev_nb_edge != 0) {
- rc = __rte_bpf_validate_debug_evaluate_step(
+ rc = __rte_bpf_validate_debug_evaluate_update(
debug, get_node_idx(bvf, node) + 1,
- RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_RETURN);
+ RTE_BIT64(RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_RETURN));
if (rc < 0)
break;
}
diff --git a/lib/bpf/bpf_validate_debug.c b/lib/bpf/bpf_validate_debug.c
index 9a039766322c..f76303a7fd2a 100644
--- a/lib/bpf/bpf_validate_debug.c
+++ b/lib/bpf/bpf_validate_debug.c
@@ -582,8 +582,8 @@ __rte_bpf_validate_debug_evaluate_start(struct rte_bpf_validate_debug *debug,
}
int
-__rte_bpf_validate_debug_evaluate_step(struct rte_bpf_validate_debug *debug,
- uint32_t pc, debug_event_t event)
+__rte_bpf_validate_debug_evaluate_update(struct rte_bpf_validate_debug *debug,
+ uint32_t pc, uint64_t events)
{
int rc;
@@ -595,8 +595,7 @@ __rte_bpf_validate_debug_evaluate_step(struct rte_bpf_validate_debug *debug,
return -ECHILD;
}
- if (pc > debug->bpf_prm->raw.nb_ins || event < 0 ||
- event >= RTE_BPF_VALIDATE_DEBUG_EVENT_END)
+ if (pc > debug->bpf_prm->raw.nb_ins)
return -EINVAL;
debug->pc = pc;
@@ -606,11 +605,13 @@ __rte_bpf_validate_debug_evaluate_step(struct rte_bpf_validate_debug *debug,
rc = debug_send_event(debug,
RTE_BPF_VALIDATE_DEBUG_EVENT_INVALID_STATE);
- if (event != RTE_BPF_VALIDATE_DEBUG_EVENT_STEP)
- rc = rc < 0 ? rc : debug_send_event(debug, event);
+ for (enum rte_bpf_validate_debug_event event = 0;
+ event != RTE_BPF_VALIDATE_DEBUG_EVENT_END; ++event)
+ if (events & RTE_BIT64(event))
+ rc = rc < 0 ? rc : debug_send_event(debug, event);
- if (event == RTE_BPF_VALIDATE_DEBUG_EVENT_STEP ||
- event == RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_ENTER)
+ if (events == 0 || events == RTE_BIT64(
+ RTE_BPF_VALIDATE_DEBUG_EVENT_BRANCH_ENTER))
/* Stepping into a real instruction to execute. */
rc = rc < 0 ? rc : debug_points_call_back(debug,
&debug->breakpoint_lists[pc]);
@@ -651,7 +652,8 @@ __rte_bpf_validate_debug_evaluate_finish(struct rte_bpf_validate_debug *debug,
event = RTE_BPF_VALIDATE_DEBUG_EVENT_VALIDATION_SUCCESS;
}
- rc = __rte_bpf_validate_debug_evaluate_step(debug, pc, event);
+ rc = __rte_bpf_validate_debug_evaluate_update(debug, pc,
+ RTE_BIT64(event));
}
debug_evaluate_close(debug);
diff --git a/lib/bpf/bpf_validate_debug.h b/lib/bpf/bpf_validate_debug.h
index a91f3e9c48b2..2b0c3bb646a7 100644
--- a/lib/bpf/bpf_validate_debug.h
+++ b/lib/bpf/bpf_validate_debug.h
@@ -46,7 +46,7 @@ __rte_bpf_validate_debug_evaluate_start(struct rte_bpf_validate_debug *debug,
const struct bpf_verifier *verifier, const struct rte_bpf_prm_ex *bpf_prm);
/*
- * Signal each instruction, branch end, or evaluation end.
+ * Signal evaluation events.
*
* Immediately return 0 if debug is NULL.
*
@@ -54,16 +54,17 @@ __rte_bpf_validate_debug_evaluate_start(struct rte_bpf_validate_debug *debug,
* Validate debug instance configured by user, can be NULL.
* @param pc
* Current value of the program counter, or next after last instruction.
- * @param event
- * Specific evaluation event if any, or RTE_BPF_VALIDATE_DEBUG_EVENT_STEP.
+ * @param events
+ * Bitmask of events.
+ * Step bit is always implied and should not be set.
* @return
* Non-negative value: evaluation should continue;
* -ECANCELED: evaluation should fail without calling this API again;
* Other negative value: evaluation should fail signalling failure;
*/
int
-__rte_bpf_validate_debug_evaluate_step(struct rte_bpf_validate_debug *debug,
- uint32_t pc, debug_event_t event);
+__rte_bpf_validate_debug_evaluate_update(struct rte_bpf_validate_debug *debug,
+ uint32_t pc, uint64_t events);
/*
* Signal end of evaluation process.
--
2.43.0
next prev parent reply other threads:[~2026-09-14 14:56 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 10:39 [PATCH 0/7] validate-bpf: add standalone validation debug tool Marat Khalili
2026-09-11 10:39 ` [PATCH 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-11 10:40 ` [PATCH 2/7] bpf/validate: refactor internal step function Marat Khalili
2026-09-11 10:40 ` [PATCH 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-11 10:40 ` [PATCH 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-11 10:40 ` [PATCH 5/7] bpf/validate: add get current event API Marat Khalili
2026-09-11 10:40 ` [PATCH 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-11 10:40 ` [PATCH 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-14 14:54 ` [PATCH v2 0/7] validate-bpf: add standalone validation debug tool Marat Khalili
2026-09-14 14:54 ` [PATCH v2 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-14 14:54 ` Marat Khalili [this message]
2026-09-14 14:54 ` [PATCH v2 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-14 14:54 ` [PATCH v2 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-14 14:54 ` [PATCH v2 5/7] bpf/validate: add get current event API Marat Khalili
2026-09-14 14:54 ` [PATCH v2 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-14 14:54 ` [PATCH v2 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-14 18:41 ` Stephen Hemminger
2026-09-15 13:13 ` Stephen Hemminger
2026-09-14 18:42 ` [PATCH v2 0/7] validate-bpf: add standalone validation debug tool Stephen Hemminger
2026-09-15 19:27 ` Marat Khalili
2026-09-15 19:26 ` [PATCH v3 " Marat Khalili
2026-09-15 19:26 ` [PATCH v3 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-15 19:26 ` [PATCH v3 2/7] bpf/validate: refactor internal step function Marat Khalili
2026-09-15 19:26 ` [PATCH v3 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-15 19:26 ` [PATCH v3 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-15 19:26 ` [PATCH v3 5/7] bpf/validate: add get current event API Marat Khalili
2026-09-15 19:26 ` [PATCH v3 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-15 19:26 ` [PATCH v3 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-16 16:36 ` Konstantin Ananyev
2026-09-17 14:35 ` [PATCH v4 0/7] validate-bpf: add standalone validation debug tool Marat Khalili
2026-09-17 14:35 ` [PATCH v4 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-17 14:35 ` [PATCH v4 2/7] bpf/validate: refactor internal step function Marat Khalili
2026-09-17 14:35 ` [PATCH v4 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-17 14:35 ` [PATCH v4 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-17 14:35 ` [PATCH v4 5/7] bpf/validate: add get current event API Marat Khalili
2026-09-17 14:35 ` [PATCH v4 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-17 14:35 ` [PATCH v4 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-17 16:16 ` [PATCH v4 0/7] validate-bpf: add standalone validation debug tool Konstantin Ananyev
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=20260914145418.37353-3-marat.khalili@huawei.com \
--to=marat.khalili@huawei.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
/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