[libc][thread] detect self-join and mutual-join deadlock (#194891)
Fix #194034.
Detect the deadlock cases of mutual thread joining.
Required by
`libcxx/test/std/thread/thread.jthread/join.deadlock.pass.cpp`
Assisted-by: Codex with gpt-5.5 high fast
[dsymutil] Fix ODR type uniquing for -gsimple-template-names (#194501)
With -gsimple-template-names (now the default on macOS with deployment
target >= 26), template types like vector<int> and vector<float> both
get DW_AT_name("vector") in DWARF, with template parameters encoded only
as DW_TAG_template_type_parameter children.
Previously, dsymutil used only DW_AT_name for ODR type uniquing, causing
different template specializations to collide. This PR fixes that by
reconstructing template parameter information from child DIEs when the
type name does not already contain template parameters.
The reconstructed name is used only for uniquing and not emitted into
the output DWARF. The parallel DWARF linker already handled this
correctly via SyntheticTypeNameBuilder.
rdar://175115639
[llvm-dwp] Replace MCStreamer with direct ELF writer for zero-copy output (#192112)
Replace the MCStreamer-based output pipeline with a lightweight direct
ELF writer (DWPWriter). Section data is stored as zero-copy StringRef
chunks pointing to the mmap'd input files, and written as a minimal
ELF64 relocatable object directly to disk.
## Rationale
The MCStreamer pipeline copies all section data into 16KB MCDataFragment
blocks, accumulates them in memory, then writes everything out during
MCAssembler::Finish(). This can be cause lots of memory pressure and
slow down llvm-dwp.
For instance, on a 3.3GB DWP file, this translates to rougly ~3.3GB of
heap allocation and two full copies of the data.
The new DWPWriter avoids this via:
- emitBytes() stores a StringRef chunk (zero-copy, no allocation)
- emitIntValue() writes to a small per-section buffer (index tables)
[16 lines not shown]
[clang-tidy] Fix some false positive in bugprone-move-forwarding-reference (#191435)
In the following case:
template <typename T, typename U>
void shocase(U&& SomeU) {
[SomeU] () { T SomeT(std::move(SomeU)); };
}
We use to flag the move as a forward, while the lambda captures SomeU by
copy, which makes the move valid.
[LangRef] asm clobber constrains: '~memory' allows reads and synchronization (#150191)
I was not sure what the best way is for talking about "synchronization effects".
linuxkpi: Implement __GFP_THISNODE in alloc_pages()
It indicates to `alloc_pages()` to allocate the pages from the current
NUMA domain. If it couldn't, it should not retry elsewhere and return
failure.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 06a51a510a60ca29193b2cdb8120b630ea9ef18c)
linuxkpi: Define `GFP_KERNEL_ACCOUNT` flag
This flag combines `GFP_KERNEL` and `__GFP_ACCOUNT`. The latter is also
defined in this commit. It is defined as a no-op flag as it is not
implemented.
The DRM generic code started to use it in Linux 6.12.x.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit af01ffbfb1c0a0104d3a4c7dd1342ed7c81c6c54)
linuxkpi: Move `GENMASK()` to <linux/bits.h>
... from <linux/bitops.h>.
This matches the location on Linux.
<linux/bits.h> is also included from <linux/bitops.h>. Therefore it will
not break anything.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 47e1ca7f3720c76fdc729e03034fa53c798b9318)
linuxkpi: Add `pci_dev_is_disconnected()`
For now, it is an empty stub that always return false. On Linux, it
looks at an internal error state of the device to determine if it is
disconnected.
The amdgpu DRM driver started this in Linux 6.12.x.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 43b47418e769df02f43f2b4636dd5c7516fa51f8)
linuxkpi: Define `min_array()` and `max_array()`
They are macros that return the minimum or maximum values of an array of
integers. They assume that the array contains elements.
The i915 DRM driver started to use `min_array()` in Linux 6.12.x.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 9a2de1d2042d1c2730dd3049c26d481813b5f2bd)
linuxkpi: Add `memdup_array_user()`
The amdgpu DRM driver started this in Linux 6.12.x.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 5dfbc6593cdacd5b4e4939e09d595b3a9c8e47da)
[flang][OpenMP] Check conflicts between predetermined/explicit DSA
Improve checks for loop iteration variables with predetermined DSA
appearing in DSA clauses. Show both the location of the variable
in the offending clause, and in the loop.
Make the checks a bit more accurate as well: only allow LINEAR clause
on SIMD construct with a single affected loop.
linuxkpi: Move `ARRAY_SIZE` to <linux/array_size.h>
The DRM generic code started to import this header directly in Linux
6.12.x. Let's move the definition of `ARRAY_SIZE()` (the only thing that
<linux/array_size.h> defines) to this header.
Also, include <linux/array_size.h> from the same headers as Linux. This
includes <linux/kernel.h>, so the change should not break anything.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1c641d0436e377c57a767e37f56ce65253817d67)
linuxkpi: Add Linux 6.12 variant of `kvrealloc()`
In Linux 6.12, the API changed to be closer to `krealloc()`:
* The function does not take the old size anymore
* The function becomes a wrapper around `krealloc()` with a fallback
mechanism.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit d74fa49d0c0476353af137d22b5ef8711c67b854)
linuxkpi: Move {lower,upper}_32_bits macros to <linux/wordpart.h>
... from <linux/compiler.h>.
<linux/wordpart.h> is the header defining them on Linux 6.12 (I didn't
check older versions).
<linux/wordpart.h> is also included from <linux/kernel.h>.
The DRM generic code started to depend on <linux/wordpart.h> in Linux
6.12.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 0a2f3b8ef16786a44fc88afd8862920df4527a3c)
linuxkpi: Add `rb_add()`
It is the same as `rb_add_cached()` but it works on `struct rb_root`, not
a `struc rb_root_cached`. It also does not return anything.
The DRM generic code started to use this in Linux 6.12.x.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit cff716c2854c167ef7ff3a4785f5faed9b0a4f98)