v1/v2:
There is only the first patch: RISC-V: Enable cbo.clean/flush in usermode,
which mainly removes the enabling of cbo.inval in user mode.
v3:
Add the functionality of Expose Zicbom and selftests for Zicbom.
v4:
Modify the order of macros, The test_no_cbo_inval function is added
separately.
v5:
1. Modify the order of RISCV_HWPROBE_KEY_ZICBOM_BLOCK_SIZE in hwprobe.rst
2. "TEST_NO_ZICBOINVAL" -> "TEST_NO_CBO_INVAL"
v6:
Change hwprobe_ext0_has's second param to u64.
Yunhui Cui (3):
RISC-V: Enable cbo.clean/flush in usermode
RISC-V: hwprobe: Expose Zicbom extension and its block size
RISC-V: selftests: Add TEST_ZICBOM into CBO tests
Documentation/arch/riscv/hwprobe.rst | 6 ++
arch/riscv/include/asm/hwprobe.h | 2 +-
arch/riscv/include/uapi/asm/hwprobe.h | 2 +
arch/riscv/kernel/cpufeature.c | 8 +++
arch/riscv/kernel/sys_hwprobe.c | 8 ++-
tools/testing/selftests/riscv/hwprobe/cbo.c | 66 +++++++++++++++++----
6 files changed, 79 insertions(+), 13 deletions(-)
--
2.39.2
v1/v2:
There is only the first patch: RISC-V: Enable cbo.clean/flush in usermode,
which mainly removes the enabling of cbo.inval in user mode.
v3:
Add the functionality of Expose Zicbom and selftests for Zicbom.
v4:
Modify the order of macros, The test_no_cbo_inval function is added
separately.
v5:
1. Modify the order of RISCV_HWPROBE_KEY_ZICBOM_BLOCK_SIZE in hwprobe.rst
2. "TEST_NO_ZICBOINVAL" -> "TEST_NO_CBO_INVAL"
Yunhui Cui (3):
RISC-V: Enable cbo.clean/flush in usermode
RISC-V: hwprobe: Expose Zicbom extension and its block size
RISC-V: selftests: Add TEST_ZICBOM into CBO tests
Documentation/arch/riscv/hwprobe.rst | 6 ++
arch/riscv/include/asm/hwprobe.h | 2 +-
arch/riscv/include/uapi/asm/hwprobe.h | 2 +
arch/riscv/kernel/cpufeature.c | 8 +++
arch/riscv/kernel/sys_hwprobe.c | 6 ++
tools/testing/selftests/riscv/hwprobe/cbo.c | 66 +++++++++++++++++----
6 files changed, 78 insertions(+), 12 deletions(-)
--
2.39.2
Create the init.c as a temporary init-tmp.c file, even if init already
exists. Ensure the existing init.c matches this. If init.c doesn't
exist in initrd/ then skip the check and assume init-tmp.c as the new
init.c. After that, check if init binary already exists as we did
before and skip the build if it does.
This does mean we keep a copy of init.c around in the initrd but this is
a small file and it is useful to see for debugging anyway.
Signed-off-by: Joel Fernandes (Google) <joel(a)joelfernandes.org>
---
.../selftests/rcutorture/bin/mkinitrd.sh | 34 +++++++++++++------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
index 4ba5e962e3cf..d9fbfa205384 100755
--- a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
+++ b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
@@ -17,10 +17,6 @@ if [ ! -d "$D" ]; then
echo >&2 "$D does not exist: Malformed kernel source tree?"
exit 1
fi
-if [ -s "$D/initrd/init" ]; then
- echo "$D/initrd/init already exists, no need to create it"
- exit 0
-fi
# Create a C-language initrd/init infinite-loop program and statically
# link it. This results in a very small initrd.
@@ -29,8 +25,10 @@ cd $D
mkdir -p initrd
cd initrd
-# Generate the init.c with optional command
-cat > init.c << 'EOF_HEAD'
+# Generate an init-tmp.c with optional command. This will then be compared
+# with any existing init.c. The reason for this is, we want to force a
+# rebuild if the optional command or command line arguments have changed.
+cat > init-tmp.c << 'EOF_HEAD'
#ifndef NOLIBC
#include <unistd.h>
#include <sys/time.h>
@@ -45,7 +43,7 @@ if [ $# -gt 0 ]; then
# If command provided, generate run_optional_command() with the specified command.
# We use printf to generate the command and args.
# Example: echo $(printf '"%s", ' cmd a1 a2) gives: "cmd", "a1", "a2",
- cat >> init.c << EOF
+ cat >> init-tmp.c << EOF
pid_t pid = fork();
if (pid == 0) {
char *args[] = {$(printf '"%s", ' "$@")NULL};
@@ -54,11 +52,11 @@ if [ $# -gt 0 ]; then
EOF
else
# If no command provided, function will be empty
- echo " /* No command specified */" >> init.c
+ echo " /* No command specified */" >> init-tmp.c
fi
# Add the rest of the program
-cat >> init.c << 'EOF_TAIL'
+cat >> init-tmp.c << 'EOF_TAIL'
}
int main(int argc, char *argv[])
@@ -95,6 +93,23 @@ int main(int argc, char *argv[])
}
EOF_TAIL
+# Check if init.c exists and compare with init-tmp.c
+if [ -f "init.c" ]; then
+ if ! cmp -s "init.c" "init-tmp.c"; then
+ mv "init-tmp.c" "init.c"
+ else
+ rm "init-tmp.c"
+ fi
+else
+ mv "init-tmp.c" "init.c"
+fi
+
+# Now check if init binary exists and is up to date
+if [ -s "init" ] && [ "init" -nt "init.c" ]; then
+ echo "$D/initrd/init already exists and is up to date"
+ exit 0
+fi
+
# build using nolibc on supported archs (smaller executable) and fall
# back to regular glibc on other ones.
if echo -e "#if __x86_64__||__i386__||__i486__||__i586__||__i686__" \
@@ -120,7 +135,6 @@ then
exit "$ret"
fi
-rm init.c
echo "Done creating a statically linked C-language initrd"
exit 0
--
2.34.1
The else block is unnecessary and we can simply clarify the if condition
to remove the else clause. It is more readable.
Signed-off-by: Joel Fernandes (Google) <joel(a)joelfernandes.org>
---
tools/testing/selftests/rcutorture/bin/kvm.sh | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 42e5e8597a1a..4766c3023fed 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -275,10 +275,7 @@ do
shift
done
-if test -n "$dryrun" || test -z "$TORTURE_INITRD" || tools/testing/selftests/rcutorture/bin/mkinitrd.sh
-then
- :
-else
+if test -z "$dryrun" && test -n "$TORTURE_INITRD" && !tools/testing/selftests/rcutorture/bin/mkinitrd.sh
echo No initrd and unable to create one, aborting test >&2
exit 1
fi
--
2.34.1