aboutsummaryrefslogtreecommitdiff
path: root/opcodes/disassemble.c
diff options
context:
space:
mode:
authorLancelot Six <lancelot.six@amd.com>2023-07-20 10:15:50 +0000
committerLancelot SIX <lancelot.six@amd.com>2023-07-21 09:21:07 +0100
commit1c850ca80dc53ffa2bfadabbacda231c941dee76 (patch)
tree3acb857db22435fc4bd00f3188ae2c93f1610f54 /opcodes/disassemble.c
parent178e197078e105ba4fc1b40a0bb6d7384098128e (diff)
downloadgdb-1c850ca80dc53ffa2bfadabbacda231c941dee76.zip
gdb-1c850ca80dc53ffa2bfadabbacda231c941dee76.tar.gz
gdb-1c850ca80dc53ffa2bfadabbacda231c941dee76.tar.bz2
gdb/solib-rocm: limit the number of opened file descriptors
ROCm programs can load a high number of compute kernels on GPU devices, especially if lazy code-object loading have been disabled. Each code object containing such program is loaded once for each device available, and each instance is reported by GDB as an individual shared library. We came across situations where the number of shared libraries opened by GDB gets higher than the allowed number of opened files for the process. Increasing the opened files limit works around the problem, but there is a better way this patch proposes to follow. Under the hood, the GPU code objects are embedded inside the host application binary and shared library binaries. GDB currently opens the underlying file once for each shared library it sees. That means that the same file is re-opened every time a code object is loaded on a GPU. This patch proposes to only open each underlying file once. This is done by implementing a reference counting mechanism so the underlying file is opened when the underlying file first needs to be opened, and closed when the last BFD using the underlying file is closed. On a program where GDB used to open about 1500 files to load all shared libraries, this patch makes it so only 54 opened file descriptors are needed. I have tested this patch on downstream ROCgdb's full testsuite and upstream GDB testsuite with no regression. Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'opcodes/disassemble.c')
0 files changed, 0 insertions, 0 deletions