From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "David Windsor" <dwindsor@gmail.com>
Cc: <bpf@vger.kernel.org>, <daniel@iogearbox.net>,
<andrii@kernel.org>, <eddyz87@gmail.com>, <memxor@gmail.com>,
<a.s.protopopov@gmail.com>
Subject: Re: [PATCH v3 bpf-next 05/11] resolve_btfids: Tag the functions that return errors
Date: Sat, 14 Nov 2026 20:00:31 +0000 [thread overview]
Message-ID: <DMV78SSW0U92.LH9TAXR0MZ5O@gmail.com> (raw)
In-Reply-To: <CAEXv5_i17dJmGp3y_0U_f_xK9-SyC9M4GkLCx=pT=4VoXJ4abg@mail.gmail.com>
On Sat, Nov 14, 2026 at 11:37 AM David Windsor <dwindsor@gmail.com> wrote:
> Do we also need -EBUSY here as an exception? crypto_enqueue_request
> uses it to mean the request was queued on the backlog (not that it
> failed)
Good point. -EBUSY is not a failure there, -ENOSPC is.
A prog that returns -EBUSY skips the list_add_tail().
crypto_wait_req() then waits for a completion that never comes.
In most other functions -EBUSY is a plain failure, so means_failure()
can't drop it for all.
ccp_enqueue_cmd() and qat_alg_send_message_maybacklog() have such
a backlog too. All three also return -EINPROGRESS.
So drop -EBUSY only if the function returns -EINPROGRESS too.
crypto_enqueue_request() stays a target with -ENOSPC.
Here is proposed follow up... other ideas?
diff --git a/tools/bpf/resolve_btfids/fmodret.c b/tools/bpf/resolve_btfids/fmodret.c
index 0751519..e1afdb6 100644
--- a/tools/bpf/resolve_btfids/fmodret.c
+++ b/tools/bpf/resolve_btfids/fmodret.c
@@ -61,9 +61,15 @@ static bool fits_trampoline(const struct btf *btf, const struct btf_type *func)
* -EAGAIN, -EMSGSIZE and -EINPROGRESS tell the caller to retry, to go on or to
* wait, not that the function failed. Their numbers are those of the kernel, in
* asm-generic/errno.h. The errno.h of the build host can have other numbers.
+ *
+ * ASYNC: the function returns -EINPROGRESS too. Then its -EBUSY is no failure
+ * either. In the crypto API it says that the request is queued on the backlog:
+ * crypto_wait_req() waits after both.
*/
-static bool means_failure(int error)
+static bool means_failure(int error, bool async)
{
+ if (async && error == -16)
+ return false;
return error > -512 && error != -11 && error != -90 && error != -115;
}
@@ -82,13 +88,16 @@ static int cmp_error(const void *va, const void *vb)
*/
static bool format_tag(char *tag, const int64_t *values, size_t nr, __u32 size)
{
+ bool async = false;
size_t i, n = 0;
int errors[nr];
+ for (i = 0; i < nr; i++)
+ async |= (int)values[i] == -115;
for (i = 0; i < nr; i++) {
int error = values[i];
- if ((size == 4 || values[i] == error) && means_failure(error))
+ if ((size == 4 || values[i] == error) && means_failure(error, async))
errors[n++] = error;
}
qsort(errors, n, sizeof(*errors), cmp_error);
diff --git a/tools/testing/selftests/bpf/prog_tests/fmodret_retval.c b/tools/testing/selftests/bpf/prog_tests/fmodret_retval.c
index 1db55d8..281c619 100644
--- a/tools/testing/selftests/bpf/prog_tests/fmodret_retval.c
+++ b/tools/testing/selftests/bpf/prog_tests/fmodret_retval.c
@@ -17,6 +17,7 @@ static const struct {
{ "bpf_testmod_retval_minus_one", "" },
{ "bpf_testmod_retval_eperm", "-2,-1" },
{ "bpf_testmod_retval_denied", "-13" },
+ { "bpf_testmod_retval_backlog", "-28" },
{ "bpf_testmod_retval_effect", "-22" },
{ "bpf_testmod_retval_effect_late", "-22" },
{ "bpf_testmod_retval_effect_two_regs", "-22" },
diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod_retval.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod_retval.c
index c6263d7..85722e4 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod_retval.c
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod_retval.c
@@ -51,6 +51,14 @@ static __used noinline int bpf_testmod_retval_denied(int a, int b, int c, int d)
return d ? -ERESTARTSYS : -EIOCBQUEUED;
}
+/* As crypto_enqueue_request(): next to -EINPROGRESS, -EBUSY is "queued on the backlog" */
+static __used noinline int bpf_testmod_retval_backlog(int free, int may_backlog)
+{
+ if (free)
+ return -EINPROGRESS;
+ return may_backlog ? -EBUSY : -ENOSPC;
+}
+
/* A caller which gets -EBUSY relies on the unlock */
static __used noinline int bpf_testmod_retval_effect(struct mutex *lock, int value)
{
next prev parent reply other threads:[~2026-11-14 20:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 5:17 [PATCH v3 bpf-next 00/11] bpf: fmod_ret for each function that returns errors Alexei Starovoitov
2026-11-14 5:17 ` [PATCH v3 bpf-next 01/11] selftests/bpf: Don't depend on the width of a BTF id in verifier_live_stack Alexei Starovoitov
2026-11-14 5:17 ` [PATCH v3 bpf-next 02/11] resolve_btfids: Read the code of an ELF file by address Alexei Starovoitov
2026-11-14 5:17 ` [PATCH v3 bpf-next 03/11] resolve_btfids: Describe machine instructions with LLVM's MC layer Alexei Starovoitov
2026-11-14 5:17 ` [PATCH v3 bpf-next 04/11] resolve_btfids: Find the definitions that reach the return value Alexei Starovoitov
2026-11-14 5:17 ` [PATCH v3 bpf-next 05/11] resolve_btfids: Tag the functions that return errors Alexei Starovoitov
2026-11-14 6:05 ` bot+bpf-ci
2026-11-14 19:37 ` David Windsor
2026-11-14 20:00 ` Alexei Starovoitov [this message]
2026-11-14 5:18 ` [PATCH v3 bpf-next 06/11] resolve_btfids: Fold the constants of a select without a branch Alexei Starovoitov
2026-11-14 5:18 ` [PATCH v3 bpf-next 07/11] resolve_btfids: Say which registers an instruction reads Alexei Starovoitov
2026-11-14 5:18 ` [PATCH v3 bpf-next 08/11] resolve_btfids: Don't list an error that follows work on an argument Alexei Starovoitov
2026-11-14 6:05 ` bot+bpf-ci
2026-11-14 5:18 ` [PATCH v3 bpf-next 09/11] bpf: Allow fmod_ret on tagged functions and check the return value Alexei Starovoitov
2026-11-14 5:18 ` [PATCH v3 bpf-next 10/11] bpf: Require the JIT for fmod_ret programs on tagged 64-bit targets Alexei Starovoitov
2026-11-14 5:18 ` [PATCH v3 bpf-next 11/11] selftests/bpf: Test fmod_ret on tagged functions Alexei Starovoitov
2026-11-14 18:30 ` [PATCH v3 bpf-next 00/11] bpf: fmod_ret for each function that returns errors patchwork-bot+netdevbpf
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=DMV78SSW0U92.LH9TAXR0MZ5O@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=a.s.protopopov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dwindsor@gmail.com \
--cc=eddyz87@gmail.com \
--cc=memxor@gmail.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 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.