Extend existing vector tests to be compatible with the xtheadvector
instruction set.
Signed-off-by: Charlie Jenkins
---
.../selftests/riscv/vector/v_exec_initval_nolibc.c | 23 --
tools/testing/selftests/riscv/vector/v_helpers.c | 17 +++-
tools/testing/selftests/riscv/vector/v_helpers.h
Overhaul the riscv vector tests to use kselftest_harness to help the
test cases correctly report the results and decouple the individual test
cases from each other. With this refactoring, only run the test cases is
vector is reported and properly report the test case as skipped
otherwise. The v_ini
Document support for thead vendor extensions using the key
RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0 and xtheadvector extension using the key
RISCV_HWPROBE_VENDOR_EXT_XTHEADVECTOR.
Signed-off-by: Charlie Jenkins
---
Documentation/arch/riscv/hwprobe.rst | 10 ++
1 file changed, 10 insertions(+
Add a new hwprobe key "RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0" which
allows userspace to probe for the new RISCV_ISA_VENDOR_EXT_XTHEADVECTOR
vendor extension.
This new key will allow userspace code to probe for which thead vendor
extensions are supported. This API is modeled to be consistent with
RI
Use alternatives to add support for xtheadvector vector save/restore
routines.
Signed-off-by: Charlie Jenkins
---
arch/riscv/Kconfig.vendor | 13 ++
arch/riscv/include/asm/csr.h | 6 +
arch/riscv/include/asm/switch_to.h | 2 +-
arch/riscv/include/asm/vector.h
The VXRM vector csr for xtheadvector has an encoding of 0xa and VXSAT
has an encoding of 0x9.
Co-developed-by: Heiko Stuebner
Signed-off-by: Charlie Jenkins
---
arch/riscv/include/asm/csr.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/a
From: Heiko Stuebner
The VCSR CSR contains two elements VXRM[2:1] and VXSAT[0].
Define constants for those to access the elements in a readable way.
Acked-by: Guo Ren
Reviewed-by: Conor Dooley
Signed-off-by: Heiko Stuebner
Signed-off-by: Charlie Jenkins
---
arch/riscv/include/asm/csr.h | 5
Migrate xandespmu out of riscv_isa_ext and into a new Andes-specific
vendor namespace.
Signed-off-by: Charlie Jenkins
---
arch/riscv/Kconfig.vendor| 10 +++
arch/riscv/include/asm/hwcap.h | 1 -
arch/riscv/include/asm/vendor_extensions/andes.h | 19
Vendor extensions are maintained in per-vendor structs (separate from
standard extensions which live in riscv_isa). Create vendor variants for
the existing extension helpers to interface with the riscv_isa_vendor
bitmaps. There is a good amount of overlap between these functions, so
the alternative
Separate vendor extensions out into one struct per vendor
instead of adding vendor extensions onto riscv_isa_ext.
Signed-off-by: Charlie Jenkins
---
arch/riscv/Kconfig | 2 +
arch/riscv/Kconfig.vendor| 9 +++
arch/riscv/include/asm/cpufeatu
This loop is supposed to check if ext->subset_ext_ids[j] is valid, rather
than if ext->subset_ext_ids[i] is valid, before setting the extension
id ext->subset_ext_ids[j] in isainfo->isa.
Signed-off-by: Charlie Jenkins
Reviewed-by: Conor Dooley
Fixes: 0d8295ed975b ("riscv: add ISA extension parsi
The D1/D1s SoCs support xtheadvector so it can be included in the
devicetree. Also include vlenb for the cpu.
Signed-off-by: Charlie Jenkins
---
arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/boot/dts/allwinner/sun20
If vlenb is provided in the device tree, prefer that over reading the
vlenb csr.
Signed-off-by: Charlie Jenkins
---
arch/riscv/include/asm/cpufeature.h | 2 ++
arch/riscv/kernel/cpufeature.c | 26 ++
arch/riscv/kernel/vector.c | 13 +
3 files ch
From: Conor Dooley
Add a property analogous to the vlenb CSR so that software can detect
the vector length of each CPU prior to it being brought online.
Currently software has to assume that the vector length read from the
boot CPU applies to all possible CPUs. On T-Head CPUs implementing
pre-rat
The xtheadvector ISA extension is described on the T-Head extension spec
Github page [1] at commit 95358cb2cca9.
Link:
https://github.com/T-head-Semi/thead-extension-spec/blob/95358cb2cca9489361c61d335e03d3134b14133f/xtheadvector.adoc
[1]
Signed-off-by: Charlie Jenkins
Reviewed-by: Conor Doole
The riscv_cpuinfo struct that contains mvendorid and marchid is not
populated until all harts are booted which happens after the DT parsing.
Use the vendorid/archid values from the DT if available or assume all
harts have the same values as the boot hart as a fallback.
Fixes: d82f32202e0d ("RISC-V
This patch series ended up much larger than expected, please bear with
me! The goal here is to support vendor extensions, starting at probing
the device tree and ending with reporting to userspace.
The main design objective was to allow vendors to operate independently
of each other. This has been
On 4/19/24 8:35 PM, Jakub Kicinski wrote:
> Note that when this commit message refers to netlink dump
> it only means the actual dumping part, the parsing / dump
> start is handled by the same code as "doit".
>
> Commit 4a19edb60d02 ("netlink: Pass extack to dump handlers")
> added support for ret
On 4/19/24 8:35 PM, Jakub Kicinski wrote:
> Next change will need them in netlink_dump_done(), pure move.
>
> Signed-off-by: Jakub Kicinski
> ---
> net/netlink/af_netlink.c | 126 +++
> 1 file changed, 63 insertions(+), 63 deletions(-)
>
Reviewed-by: David A
On 4/19/24 8:35 PM, Jakub Kicinski wrote:
> Having to filter the right ifindex in the tests is a bit tedious.
> Add support for dumping qstats for a single ifindex.
>
> Signed-off-by: Jakub Kicinski
> ---
> Documentation/netlink/specs/netdev.yaml | 1 +
> net/core/netdev-genl-gen.c
add 'static' keyword to 'sys_mprotect()' to link properly, otherwise
the test won't build.
gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
/usr/bin/ld: /tmp/cc7yeABp.o: in function `test_seal_elf':
seal_elf.c:(.text+0x7af): undefined reference to `sys_mprotect'
/usr/bin/ld: seal_elf.c:(.text+0x82c): un
On Fri, 2024-04-19 at 16:54 -0700, Chen, Zide wrote:
>
> However, the selftest hangs:
>
> [Apr19 16:15] kselftest: Running tests in kvm
> [Apr19 16:16] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
> [ +0.000628] rcu: 78-...0: (1 GPs behind)
> idle=3c8c/1/0x4000 softirq
Add a testcase for the ring_buffer__consume_n() API.
The test produces multiple samples in a ring buffer, using a
sys_getpid() fentry prog, and consumes them from user-space in batches,
rather than consuming all of them greedily, like ring_buffer__consume()
does.
Link:
https://lore.kernel.org/lk
On 4/19/24 18:45, Muhammad Usama Anjum wrote:
> On 4/17/24 9:16 PM, Amer Al Shanawany wrote:
>> fix compiler warning and errors when compiling statmount test.
> The error description or the compiler with version is required to reproduce
> the error easily. I'm unable to reproduce the error by gcc 1
From: Geliang Tang
This patch uses public helper make_sockaddr() exported in network_helpers.h
instead of the local defined function mk_sockaddr() in test_sock_addr.c.
This can avoid duplicate code.
Signed-off-by: Geliang Tang
---
tools/testing/selftests/bpf/test_sock_addr.c | 62 -
From: Geliang Tang
This patch uses public network helper connect_to_addr() exported in
network_helpers.h instead of the local defined function connect_to_server()
in test_sock_addr.c. This can avoid duplicate code.
Signed-off-by: Geliang Tang
---
tools/testing/selftests/bpf/test_sock_addr.c |
From: Geliang Tang
Include network_helpers.h in test_sock_addr.c, use the newly added public
helper start_server_addr() instead of the local defined function
start_server(). This can avoid duplicate code.
In order to use functions defined in network_helpers.c in test_sock_addr.c,
Makefile needs
From: Geliang Tang
ASSERT helpers defined in test_progs.h shouldn't be used in public
functions like open_netns() and close_netns(). Since they depend on
test__fail() which defined in test_progs.c. Public functions may be
used not only in test_progs.c, but in other tests like test_sock_addr.c
in
From: Geliang Tang
This patchset uses more network helpers in test_sock_addr.c, but
first of all, patch 2 is needed to make network_helpers.c independent
of test_progs.c. Then network_helpers.h can be included into
test_sock_addr.c without compile errors.
Patch 1 and patch 2 address Martin's com
From: Geliang Tang
As Martin mentioned in review comment, there is an existing bug that
orig_netns_fd will be leaked in the later "goto fail;" case after
open("/proc/self/ns/net") in open_netns() in network_helpers.c. This
patch adds "close(token->orig_netns_fd);" before "free(token);" to
fix it.
On 20 April 2024 00:54:05 BST, "Chen, Zide" wrote:
>
>
>On 4/19/2024 11:43 AM, David Woodhouse wrote:
>> On 19 April 2024 19:40:06 BST, David Woodhouse wrote:
>>> On 19 April 2024 18:13:16 BST, "Chen, Zide" wrote:
I'm wondering what's the underling theory that we definitely can achieve
Allows to test if allocation/free works
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- remove #define CLOCK_MONOTONIC 1 leftover
---
tools/testing/selftests/bpf/bpf_experimental.h | 1 +
tools/testing/selftests/bpf/prog_tests/wq.c| 22 ++
tools/testing/selftest
again, copy/paste from bpf_timer_start().
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- dropped spinlock and use READ_ONCE() instead
---
kernel/bpf/helpers.c | 18 ++
1 file changed, 18 insertions(+)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 85d3f
We assign the callback and set everything up.
The actual tests of these callbacks will be done when bpf_wq_start() is
available.
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- removed mark_precise checks
- adapted without BPF_F_WQ_SLEEPABLE
---
tools/testing/selftests/bpf/bpf_experimen
To support sleepable async callbacks, we need to tell push_async_cb()
whether the cb is sleepable or not.
The verifier now detects that we are in bpf_wq_set_callback_impl and
can allow a sleepable callback to happen.
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- dropped flags check fo
Allows to test if allocation/free works
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- dropped mark_precise checks
---
tools/testing/selftests/bpf/bpf_experimental.h | 1 +
tools/testing/selftests/bpf/prog_tests/wq.c | 8 +++
tools/testing/selftests/bpf/progs/wq.c | 10
We need to teach the verifier about the second argument which is declared
as void * but which is of type KF_ARG_PTR_TO_MAP. We could have dropped
this extra case if we declared the second argument as struct bpf_map *,
but that means users will have to do extra casting to have their program
compile.
We simply try in all supported map types if we can store/load a bpf_wq.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
tools/testing/selftests/bpf/prog_tests/wq.c | 11 +++
tools/testing/selftests/bpf/progs/wq.c | 135
2 files changed, 146 inserti
Currently bpf_wq_cancel_and_free() is just a placeholder as there is
no memory allocation for bpf_wq just yet.
Again, duplication of the bpf_timer approach
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- removed extra fallthrough
---
include/linux/bpf.h | 2 ++
kernel/bpf/arraymap.c
Introduce support for KF_ARG_PTR_TO_WORKQUEUE. The kfuncs will use bpf_wq
as argument and that will be recognized as workqueue argument by verifier.
bpf_wq_kern casting can happen inside kfunc, but using bpf_wq in
argument makes life easier for users who work with non-kern type in BPF
progs.
Dupli
When a kfunc is declared with a KF_ARG_PTR_TO_MAP, we should have
reg->map_ptr set to a non NULL value, otherwise, that means that the
underlying type is not a map.
Signed-off-by: Benjamin Tissoires
---
new in v2
---
kernel/bpf/verifier.c | 5 +
1 file changed, 5 insertions(+)
diff --git
cp include/uapi/linux/bpf.h tools/include/uapi/linux/bpf.h
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
tools/include/uapi/linux/bpf.h | 4
1 file changed, 4 insertions(+)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index cee0a7915c08..e4ae8
Mostly a copy/paste from the bpf_timer API, without the initialization
and free, as they will be done in a separate patch.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
include/linux/bpf.h | 11 ++-
include/uapi/linux/bpf.h | 4
kernel/bpf/btf.c | 17 +++
Same reason than most bpf_timer* functions, we need almost the same for
workqueues.
So extract the generic part out of it so bpf_wq_cancel_and_free can reuse
it.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/helpers.c | 42 +-
1 f
In the same way we have a generic __bpf_async_init(), we also need
to share code between timer and workqueue for the set_callback call.
We just add an unused flags parameter, as it will be used for workqueues.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/helpers.c | 2
No code change except for the new flags argument being stored in the
local data struct.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/helpers.c | 91
1 file changed, 63 insertions(+), 28 deletions(-)
diff --git a/ker
To be able to add workqueues and reuse most of the timer code, we need
to make bpf_hrtimer more generic.
There is no code change except that the new struct gets a new u64 flags
attribute. We are still below 2 cache lines, so this shouldn't impact
the current running codes.
The ordering is also ch
This is a followup of sleepable bpf_timer[0].
When discussing sleepable bpf_timer, it was thought that we should give
a try to bpf_wq, as the 2 APIs are similar but distinct enough to
justify a new one.
So here it is.
I tried to keep as much as possible common code in kernel/bpf/helpers.c
but I
On 4/20/2024 7:00 AM, Eduard Zingerman wrote:
On Thu, 2024-04-11 at 20:27 +0800, Xu Kuohai wrote:
From: Xu Kuohai
With lsm return value check, the no-alu32 version test_libbpf_get_fd_by_id_opts
is rejected by the verifier, and the log says:
0: R1=ctx() R10=fp0
; int BPF_PROG(check_acces
49 matches
Mail list logo