Skip to content

Loongarch dev#54

Open
zhangyanyue01 wants to merge 128 commits into
kernelslacker:masterfrom
zhangyanyue01:loongarch-dev
Open

Loongarch dev#54
zhangyanyue01 wants to merge 128 commits into
kernelslacker:masterfrom
zhangyanyue01:loongarch-dev

Conversation

@zhangyanyue01

Copy link
Copy Markdown
  1. Add Loongarch support for trinity.
  2. Fix some errors which may cause SEGV.
  3. This code has been tested in 6.6 version kernel.

kernelslacker and others added 30 commits September 18, 2017 20:13
Still needs some cleanup, but this is a braindump of my private TODO
that has a mix of old/new stuff.
These are usually only seen by libc, and never passed on to apps,
but Trinity is doing raw syscalls, so we have to worry about these.
This patch brings perf_event_open() support up to date as of 4.14-rc6.

Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
In file included from ioctls/autofs.c:4:0:
ioctls/autofs.c:241:8: error: 'AUTOFS_IOC_EXPIRE_INDIRECT' undeclared here (not in a function); did you mean 'AUTOFS_IOC_EXPIRE_CMD'?
  IOCTL(AUTOFS_IOC_EXPIRE_INDIRECT),
        ^
include/ioctls.h:53:15: note: in definition of macro 'IOCTL'
  { .request = _request, .name = #_request, }
               ^~~~~~~~
ioctls/autofs.c:242:8: error: 'AUTOFS_IOC_EXPIRE_DIRECT' undeclared here (not in a function); did you mean 'AUTOFS_IOC_EXPIRE_INDIRECT'?
  IOCTL(AUTOFS_IOC_EXPIRE_DIRECT),
        ^
include/ioctls.h:53:15: note: in definition of macro 'IOCTL'
  { .request = _request, .name = #_request, }
               ^~~~~~~~

Define them as AUTOFS_IOC_EXPIRE_MULTI as they used to be.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Commit 1f28c5d055032e7e8ee5e48198dca7e125d0eec6
("autofs: remove unused AUTOFS_IOC_EXPIRE_DIRECT/INDIRECT")

in the linux kernel removed the 2 defines
AUTOFS_IOC_EXPIRE_INDIRECT
AUTOFS_IOC_EXPIRE_DIRECT

Since they are used unconditionally the build fails.
To fix this add #ifdef/#endif around it.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Update and add some comments on the system call
tables for s390x (64bit) and s390 (31bit).

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for s390x (64 bit) and s390 (31 bit)
support for system calls preadv2 and pwritev2.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for s390x (64 bit) and s390 (31 bit)
support for system call statx.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for s390x (64 bit) and s390 (31 bit)
support for system call mlock2.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for s390x (64 bit) and s390 (31 bit)
support for system call copy_file_range.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for system call readdir on s390 (31 bit).

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
This patch adds support for the s390 specific system
call runtime_instr() for 31 and 64 bit.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for s390 specific system calls
s390_pci_mmio_read and 390_pci_mmio_write
for 31 bit and 64 bit.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for s390 specific system call s390_guarded_storage
for 31 bit and 64 bit.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Add support for s390 specific system call s390_sthyi
for 31 bit and 64 bit.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
	modified:   ioctls/sgx.c
kernelslacker and others added 29 commits October 11, 2021 15:30
When a child process tests timer_create interface with sigev->sigev_signo
equal to SIGINT, and then timer_settime let the timer go.When the timer
has expired, a SIGINT would send to our child process. But SIGINT signal
means ctrl-c is pressed,and then trinity-main will exit.

To Avoid it, do not let timer_create create a timer with
sigev->sigev_signo equal to SIGINT.

Change-Id: I3aa1b99ff447a4a0a8bc2a9d33cf91f7e48cd275
Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
This only adds support for riscv64, riscv32 is not included. The riscv64
syscall table is very close to aarch64 with small difference.

Signed-off-by: Changbin Du <changbin.du@gmail.com>
fds/drm.c: In function ‘drmfd_dump’:
fds/drm.c:31:49: warning: unused parameter ‘global’ [-Wunused-parameter]
   31 | static void drmfd_dump(struct object *obj, bool global)
      |                                            ~~~~~^~~~~~

Print 'global' to fix warning.
Trinity on cpus which have many cores may open large number of
child->pidstatfile, and may be reach the limition(1024 on most
platforms), so just panic and warn user to increase the limition.
nukes those warnings like..

main.c:467:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

because it isn't 1990 any more.
this needs >10000 threads, but gcc has started warning, so this shuts it up
Both sockaddr_pn and sockaddr_pppox are defined as "packed"
on x86-64, unlike struct sockaddr, which generates warnings
like this:

net/proto-phonet.c: In function ‘phonet_gen_sockaddr’:
net/proto-phonet.c:22:18: warning: converting a packed ‘struct sockaddr_pn’ pointer (alignment 1) to a ‘struct sockaddr’ pointer (alignment 2) may result in an unaligned pointer value [-Waddress-of-packed-member]
   22 |  *addr = (struct sockaddr *) pn;
      |                  ^~~~~~~~
In file included from net/proto-phonet.c:5:
/usr/include/linux/phonet.h:102:8: note: defined here
  102 | struct sockaddr_pn {
      |        ^~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:33,
                 from net/proto-phonet.c:2:
/usr/include/x86_64-linux-gnu/bits/socket.h:178:8: note: defined here
  178 | struct sockaddr
      |        ^~~~~~~~

I'm pretty sure the alignment is fine as other things would
be broken if they weren't, so just ignore the warnings in
these two files.
Drop decnet as it has been removed since kernel 6.1 and
torvalds/linux@1202cdd
resulting in the following build failure:

net/proto-decnet.c:5:10: fatal error: linux/dn.h: No such file or directory
    5 | #include <linux/dn.h>
      |          ^~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/47e0a5e0b6fcf33ab4f9848d5d8c2be9e5283950

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
It was dropped in upstream in commit 61e15f871241 (KVM: Delete all
references to removed KVM_SET_MEMORY_REGION ioctl).

Co-authored-by: Jiri Slaby <jslaby@suse.cz>
…viders. (kernelslacker#43)

Signed-off-by: Weisson <hanxiaobupt@bupt.cn>
Co-authored-by: Weisson <wenshu.hx@alibaba-inc.com>
kernel v6.3-rc1 removed some drm drivers, so add the extra check to make
the compile succeed.

7872bc2cb13e drm: Remove the obsolete driver-savage
28483b8666bf drm: Remove the obsolete driver-r128
96ed7db55bef drm: Remove the obsolete driver-mga
cab18866fead drm: Remove the obsolete driver-i810

Signed-off-by: Chunyu Hu <chuhu@redhat.com>
Some IOCTL_NOUVEAU tests are checked under USE_DRM_MGA macro, this is
not correct, correct it.

Fixes: 6823bac (ioctls/drm: check i810,mga,r128 and savage support (kernelslacker#44))

Signed-off-by: Chunyu Hu <chuhu@redhat.com>
* compat: add deprecated KVM IOCTL definitions

They were dropped in 6.8 by commit a5d3df8ae13f (KVM: remove deprecated
UAPIs).

* compat: add removed KVM structures

They were dropped in 6.9 in c0a411904e15 (KVM: remove more traces of
device assignment UAPI).

* ioctls/kvm: make s390 ioctls s390-only

They are now s390-only since commit 71cd774ad2f9 (KVM: s390: move
s390-specific structs to uapi/asm/kvm.h).

* ioctls/kvm: make powerpc ioctls powerpc-only

They are now powerpc-only since commit d750951c9ed7 (KVM: powerpc: move
powerpc-specific structs to uapi/asm/kvm.h).

---------

Co-authored-by: Jiri Slaby <jslaby@suse.cz>
from man page, it requires _GNU_SOURCE, and it requires two parameters,
so it would not be able to pass the configure check. It works with older gcc
as old gcc allows conflict on 'static' keyword.

But it would hit copmile broken if not fixed on fedora 40. Because gcc
version would check the declaration conflict on static function. In header
it's not static, but in trinity, it's declared as static.

The 'ifndef memfd_create' don't work because memfd_create is not a macro,
so remove it.

Before the fix:

[trinity.git]$ cat /etc/redhat-release
Fedora release 40 (Forty)
[trinity.git]$ ./configure | grep memfd_create
[*] Checking if glibc provides memfd_create.. [NO]
[chuhu@dell-per7425-02 trinity.git]$ make -j8
  CC    arg-decoder.o
  CC    blockdevs.o
  CC    child.o
  CC    debug.o
  CC    devices.o
  CC    ftrace.o
  CC    generate-args.o
  CC    kcov.o
  CC    locks.o
  CC    log-files.o
  CC    log.o
  CC    main.o
  CC    objects.o
  CC    output.o
  CC    params.o
  CC    pathnames.o
  CC    pids.o
  CC    post-mortem.o
  CC    random-syscall.o
  CC    results.o
  CC    shm.o
  CC    signals.o
  CC    stats.o
  CC    syscall.o
  CC    sysv-shm.o
  CC    tables-biarch.o
  CC    tables-uniarch.o
  CC    tables.o
  CC    taint.o
  CC    trinity.o
  CC    uid.o
  CC    utils.o
  CC    fds/bpf.o
  CC    fds/drm.o
  CC    fds/epoll.o
  CC    fds/eventfd.o
  CC    fds/fanotify_init.o
  CC    fds/fds.o
  CC    fds/files.o
  CC    fds/inotify.o
  CC    fds/memfd.o
  CC    fds/perf.o
  CC    fds/pipes.o
  CC    fds/sockets.o
  CC    fds/testfiles.o
fds/memfd.c:22:12: error: static declaration of ‘memfd_create’ follows non-static declaration
   22 | static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag)
      |            ^~~~~~~~~~~~
In file included from /usr/include/bits/mman-linux.h:116,
                 from /usr/include/bits/mman.h:38,
                 from /usr/include/sys/mman.h:41,
                 from fds/memfd.c:8:
/usr/include/bits/mman-shared.h:55:5: note: previous declaration of ‘memfd_create’ with type ‘int(const char *, unsigned int)’
   55 | int memfd_create (const char *__name, unsigned int __flags) __THROW;
      |     ^~~~~~~~~~~~
make: *** [Makefile:113: fds/memfd.o] Error 1
make: *** Waiting for unfinished jobs....

After the fix:
[trinity]$ ./configure | grep memfd_create
[*] Checking if glibc provides memfd_create.. [YES]

[trinity]$ make -j8 | grep memfd_create
  CC    syscalls/memfd_create.o

Signed-off-by: Chunyu Hu <chuhu@redhat.com>
I'm never realistically going to spend a huge amount of time on this
tool again, so remove this list of stuff that isn't going to happen.
This was never implemented, and is aparently broken on 32bit
(kernelslacker#52)
since 460be1d527a8 ("drm/nouveau: move more missing UAPI bits") in
v6.10-rc1, the two structs are moved to the uapi in
include/drm/drm_nouveau.h (drm_nouveau_notifierobj_alloc and
drm_nouveau_gpuobj_free), so the definition of the macros and the
structs are not in the same place any more, so can't use the macros
to determine if the two structs are defined. So change to compile in
configure to determine that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.