[PATCH v9 0/4] linux-user: generate syscall_nr.sh for RISC-V

Alistair Francis posted 4 patches 4 years, 1 month ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test checkpatch failed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1584571250.git.alistair.francis@wdc.com
Maintainers: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
linux-user/riscv/syscall32_nr.h | 295 +++++++++++++++++++++++++++++++
linux-user/riscv/syscall64_nr.h | 301 ++++++++++++++++++++++++++++++++
linux-user/riscv/syscall_nr.h   | 294 +------------------------------
linux-user/strace.c             |   2 +
linux-user/syscall.c            | 247 ++++++++++++++++++++++++--
5 files changed, 834 insertions(+), 305 deletions(-)
create mode 100644 linux-user/riscv/syscall32_nr.h
create mode 100644 linux-user/riscv/syscall64_nr.h
[PATCH v9 0/4] linux-user: generate syscall_nr.sh for RISC-V
Posted by Alistair Francis 4 years, 1 month ago
This series updates the RISC-V syscall_nr.sh based on the 5.5 kernel.

There are two parts to this. One is just adding the new syscalls, the
other part is updating the RV32 syscalls to match the fact that RV32 is
a 64-bit time_t architectures (y2038) safe.
We need to make some changes to syscall.c to avoid warnings/errors
during compliling with the new syscall.

I did some RV32 user space testing after applying these patches. I ran the
glibc testsuite in userspace and I don't see any regressions.

v9:
 - Fix futex patch compile error
v8:
 - Add a g_assert_not_reached() in do_sys_futex
v7:
 - Update futuex_time64 support to work correctly
v6:
 - Split out futex patch and make it more robust
v5:
 - Addres comments raised on v4
   - Don't require 64-bit host for * _time64 functions

Alistair Francis (4):
  linux-user: Protect more syscalls
  linux-user/syscall: Add support for clock_gettime64/clock_settime64
  linux-user: Support futex_time64
  linux-user/riscv: Update the syscall_nr's to the 5.5 kernel

 linux-user/riscv/syscall32_nr.h | 295 +++++++++++++++++++++++++++++++
 linux-user/riscv/syscall64_nr.h | 301 ++++++++++++++++++++++++++++++++
 linux-user/riscv/syscall_nr.h   | 294 +------------------------------
 linux-user/strace.c             |   2 +
 linux-user/syscall.c            | 247 ++++++++++++++++++++++++--
 5 files changed, 834 insertions(+), 305 deletions(-)
 create mode 100644 linux-user/riscv/syscall32_nr.h
 create mode 100644 linux-user/riscv/syscall64_nr.h

-- 
2.25.1


Re: [PATCH v9 0/4] linux-user: generate syscall_nr.sh for RISC-V
Posted by no-reply@patchew.org 4 years, 1 month ago
Patchew URL: https://patchew.org/QEMU/cover.1584571250.git.alistair.francis@wdc.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [PATCH v9 0/4]  linux-user: generate syscall_nr.sh for RISC-V
Message-id: cover.1584571250.git.alistair.francis@wdc.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
1d09c6a linux-user/riscv: Update the syscall_nr's to the 5.5 kernel
9d49c03 linux-user: Support futex_time64
d25d933 linux-user/syscall: Add support for clock_gettime64/clock_settime64
df4b9e6 linux-user: Protect more syscalls

=== OUTPUT BEGIN ===
1/4 Checking commit df4b9e6b1f0f (linux-user: Protect more syscalls)
2/4 Checking commit d25d933726c3 (linux-user/syscall: Add support for clock_gettime64/clock_settime64)
3/4 Checking commit 9d49c030a0f2 (linux-user: Support futex_time64)
WARNING: architecture specific defines should be avoided
#23: FILE: linux-user/syscall.c:248:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#26: FILE: linux-user/syscall.c:251:
+#if defined(__NR_futex_time64)

WARNING: architecture specific defines should be avoided
#37: FILE: linux-user/syscall.c:303:
+#if (defined(TARGET_NR_futex) && defined(__NR_futex)) || \

WARNING: architecture specific defines should be avoided
#43: FILE: linux-user/syscall.c:309:
+#if defined(__NR_futex_time64)

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
              ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                               ^

ERROR: space required after that ',' (ctx:OxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                     ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                           ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                               ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                                  ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                                      ^

ERROR: space required after that ',' (ctx:OxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                  ^

ERROR: space required after that ',' (ctx:VxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                          ^

ERROR: space required after that ',' (ctx:OxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                ^

ERROR: space required after that ',' (ctx:VxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                       ^

ERROR: space required after that ',' (ctx:VxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                           ^

WARNING: architecture specific defines should be avoided
#55: FILE: linux-user/syscall.c:776:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#59: FILE: linux-user/syscall.c:780:
+#if defined(__NR_futex_time64)

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                  ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                               ^

ERROR: space required after that ',' (ctx:OxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                     ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                           ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                               ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                                  ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                                      ^

ERROR: space required after that ',' (ctx:OxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                      ^

ERROR: space required after that ',' (ctx:VxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                              ^

ERROR: space required after that ',' (ctx:OxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                    ^

ERROR: space required after that ',' (ctx:VxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                           ^

ERROR: space required after that ',' (ctx:VxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                               ^

WARNING: architecture specific defines should be avoided
#84: FILE: linux-user/syscall.c:6913:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#90: FILE: linux-user/syscall.c:6919:
+#if defined(__NR_futex_time64)

WARNING: architecture specific defines should be avoided
#96: FILE: linux-user/syscall.c:6925:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#109: FILE: linux-user/syscall.c:6938:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#114: FILE: linux-user/syscall.c:6943:
+#if defined(__NR_futex_time64)

WARNING: architecture specific defines should be avoided
#121: FILE: linux-user/syscall.c:6950:
+#if defined(__NR_futex)

WARNING: line over 80 characters
#168: FILE: linux-user/syscall.c:7013:
+static int do_futex_time64(target_ulong uaddr, int op, int val, target_ulong timeout,

WARNING: Block comments use a leading /* on a separate line
#174: FILE: linux-user/syscall.c:7019:
+    /* ??? We assume FUTEX_* constants are the same on both host

WARNING: Block comments use * on subsequent lines
#175: FILE: linux-user/syscall.c:7020:
+    /* ??? We assume FUTEX_* constants are the same on both host
+       and target.  */

WARNING: Block comments use a trailing */ on a separate line
#175: FILE: linux-user/syscall.c:7020:
+       and target.  */

WARNING: Block comments use a leading /* on a separate line
#199: FILE: linux-user/syscall.c:7044:
+        /* For FUTEX_REQUEUE, FUTEX_CMP_REQUEUE, and FUTEX_WAKE_OP, the

WARNING: Block comments use * on subsequent lines
#200: FILE: linux-user/syscall.c:7045:
+        /* For FUTEX_REQUEUE, FUTEX_CMP_REQUEUE, and FUTEX_WAKE_OP, the
+           TIMEOUT parameter is interpreted as a uint32_t by the kernel.

WARNING: Block comments use a trailing */ on a separate line
#203: FILE: linux-user/syscall.c:7048:
+           since it's not compared to guest memory.  */

total: 24 errors, 19 warnings, 212 lines checked

Patch 3/4 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

4/4 Checking commit 1d09c6ad0308 (linux-user/riscv: Update the syscall_nr's to the 5.5 kernel)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#12: 
new file mode 100644

total: 0 errors, 1 warnings, 898 lines checked

Patch 4/4 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/cover.1584571250.git.alistair.francis@wdc.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH v9 0/4] linux-user: generate syscall_nr.sh for RISC-V
Posted by no-reply@patchew.org 4 years, 1 month ago
Patchew URL: https://patchew.org/QEMU/cover.1584571250.git.alistair.francis@wdc.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [PATCH v9 0/4]  linux-user: generate syscall_nr.sh for RISC-V
Message-id: cover.1584571250.git.alistair.francis@wdc.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Switched to a new branch 'test'
cd20a33 linux-user/riscv: Update the syscall_nr's to the 5.5 kernel
e06767d linux-user: Support futex_time64
965d406 linux-user/syscall: Add support for clock_gettime64/clock_settime64
21e4b07 linux-user: Protect more syscalls

=== OUTPUT BEGIN ===
1/4 Checking commit 21e4b07f78b8 (linux-user: Protect more syscalls)
2/4 Checking commit 965d40690148 (linux-user/syscall: Add support for clock_gettime64/clock_settime64)
3/4 Checking commit e06767d54c9c (linux-user: Support futex_time64)
WARNING: architecture specific defines should be avoided
#23: FILE: linux-user/syscall.c:248:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#26: FILE: linux-user/syscall.c:251:
+#if defined(__NR_futex_time64)

WARNING: architecture specific defines should be avoided
#37: FILE: linux-user/syscall.c:303:
+#if (defined(TARGET_NR_futex) && defined(__NR_futex)) || \

WARNING: architecture specific defines should be avoided
#43: FILE: linux-user/syscall.c:309:
+#if defined(__NR_futex_time64)

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
              ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                               ^

ERROR: space required after that ',' (ctx:OxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                     ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                           ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                               ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                                  ^

ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/syscall.c:310:
+_syscall6(int,sys_futex_time64,int *,uaddr,int,op,int,val,
                                                      ^

ERROR: space required after that ',' (ctx:OxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                  ^

ERROR: space required after that ',' (ctx:VxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                          ^

ERROR: space required after that ',' (ctx:OxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                ^

ERROR: space required after that ',' (ctx:VxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                       ^

ERROR: space required after that ',' (ctx:VxV)
#45: FILE: linux-user/syscall.c:311:
+          const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                           ^

WARNING: architecture specific defines should be avoided
#55: FILE: linux-user/syscall.c:776:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#59: FILE: linux-user/syscall.c:780:
+#if defined(__NR_futex_time64)

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                  ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                               ^

ERROR: space required after that ',' (ctx:OxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                     ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                           ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                               ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                                  ^

ERROR: space required after that ',' (ctx:VxV)
#60: FILE: linux-user/syscall.c:781:
+safe_syscall6(int,futex_time64,int *,uaddr,int,op,int,val, \
                                                      ^

ERROR: space required after that ',' (ctx:OxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                      ^

ERROR: space required after that ',' (ctx:VxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                              ^

ERROR: space required after that ',' (ctx:OxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                    ^

ERROR: space required after that ',' (ctx:VxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                           ^

ERROR: space required after that ',' (ctx:VxV)
#61: FILE: linux-user/syscall.c:782:
+              const struct timespec *,timeout,int *,uaddr2,int,val3)
                                                               ^

WARNING: architecture specific defines should be avoided
#84: FILE: linux-user/syscall.c:6913:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#90: FILE: linux-user/syscall.c:6919:
+#if defined(__NR_futex_time64)

WARNING: architecture specific defines should be avoided
#96: FILE: linux-user/syscall.c:6925:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#109: FILE: linux-user/syscall.c:6938:
+#if defined(__NR_futex)

WARNING: architecture specific defines should be avoided
#114: FILE: linux-user/syscall.c:6943:
+#if defined(__NR_futex_time64)

WARNING: architecture specific defines should be avoided
#121: FILE: linux-user/syscall.c:6950:
+#if defined(__NR_futex)

WARNING: line over 80 characters
#168: FILE: linux-user/syscall.c:7013:
+static int do_futex_time64(target_ulong uaddr, int op, int val, target_ulong timeout,

WARNING: Block comments use a leading /* on a separate line
#174: FILE: linux-user/syscall.c:7019:
+    /* ??? We assume FUTEX_* constants are the same on both host

WARNING: Block comments use * on subsequent lines
#175: FILE: linux-user/syscall.c:7020:
+    /* ??? We assume FUTEX_* constants are the same on both host
+       and target.  */

WARNING: Block comments use a trailing */ on a separate line
#175: FILE: linux-user/syscall.c:7020:
+       and target.  */

WARNING: Block comments use a leading /* on a separate line
#199: FILE: linux-user/syscall.c:7044:
+        /* For FUTEX_REQUEUE, FUTEX_CMP_REQUEUE, and FUTEX_WAKE_OP, the

WARNING: Block comments use * on subsequent lines
#200: FILE: linux-user/syscall.c:7045:
+        /* For FUTEX_REQUEUE, FUTEX_CMP_REQUEUE, and FUTEX_WAKE_OP, the
+           TIMEOUT parameter is interpreted as a uint32_t by the kernel.

WARNING: Block comments use a trailing */ on a separate line
#203: FILE: linux-user/syscall.c:7048:
+           since it's not compared to guest memory.  */

total: 24 errors, 19 warnings, 212 lines checked

Patch 3/4 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

4/4 Checking commit cd20a33c33e3 (linux-user/riscv: Update the syscall_nr's to the 5.5 kernel)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#12: 
new file mode 100644

total: 0 errors, 1 warnings, 898 lines checked

Patch 4/4 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/cover.1584571250.git.alistair.francis@wdc.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com