diff options
author | Hao Luo <haoluo@google.com> | 2021-12-16 16:31:44 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-12-18 12:46:40 -0800 |
commit | d639b9d13a39cf15639cbe6e8b2c43eb60148a73 (patch) | |
tree | d0782fea2ab3165596294f29d223e1aa90474863 /kernel/async.c | |
parent | e967a20a8fabc6442a78e2e2059e63a4bb6aed08 (diff) | |
download | linux-d639b9d13a39cf15639cbe6e8b2c43eb60148a73.tar.gz linux-d639b9d13a39cf15639cbe6e8b2c43eb60148a73.tar.bz2 linux-d639b9d13a39cf15639cbe6e8b2c43eb60148a73.zip |
bpf: Introduce composable reg, ret and arg types.
There are some common properties shared between bpf reg, ret and arg
values. For instance, a value may be a NULL pointer, or a pointer to
a read-only memory. Previously, to express these properties, enumeration
was used. For example, in order to test whether a reg value can be NULL,
reg_type_may_be_null() simply enumerates all types that are possibly
NULL. The problem of this approach is that it's not scalable and causes
a lot of duplication. These properties can be combined, for example, a
type could be either MAYBE_NULL or RDONLY, or both.
This patch series rewrites the layout of reg_type, arg_type and
ret_type, so that common properties can be extracted and represented as
composable flag. For example, one can write
ARG_PTR_TO_MEM | PTR_MAYBE_NULL
which is equivalent to the previous
ARG_PTR_TO_MEM_OR_NULL
The type ARG_PTR_TO_MEM are called "base type" in this patch. Base
types can be extended with flags. A flag occupies the higher bits while
base types sits in the lower bits.
This patch in particular sets up a set of macro for this purpose. The
following patches will rewrite arg_types, ret_types and reg_types
respectively.
Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211217003152.48334-2-haoluo@google.com
Diffstat (limited to 'kernel/async.c')
0 files changed, 0 insertions, 0 deletions