[RISCV] Cleanup RISCVGatherScatterLoweringPass (#217762)
Rename the createPass function to have a legacy suffix, and also move
the class definition for the NewPM version into RISCV.h to be consistent
with other passes.
[mlir][Shard] Compare all-reduce properties when simplifying (#217783)
Compare the generated properties structs instead of listing each
inherent attribute individually. This preserves the original equality
semantics when new properties are added.
Follow-up to #217233
Assisted-by: Codex
[Support] Check the key position in getTypeName() and guard the MSVC path (#216528)
In `getTypeName()` the check for the template parameter is in the wrong
place:
```cpp
LLVM_GET_TYPE_NAME_CONSTEXPR std::string_view TemplateParamsStart =
Name.substr(Name.find(Key));
static_assert(!TemplateParamsStart.empty(),
"Unable to find the template parameter!");
```
If `find` fails it returns `npos`, and `substr(npos)` throws
`out_of_range` — so in the constexpr configuration the compile has
already failed on the line above the assertion, and the message never
appears.
Checking the position before using it fixes all of that, and makes the
check the one the message describes:
[28 lines not shown]
[Clang][OpenMP] Keep OMPLoopScope alive while computing target trip count (#217193)
The SizeEmitter lambda in emitCommonOMPTargetDirective constructed
OMPLoopScope as an unnamed temporary, so it was destroyed at the end of
its own statement rather than at the end of the enclosing block.
OMPLoopScope is a RunCleanupsScope, and destroying it emits the cleanups
for the '.capture_expr.' variables that hold the loop bounds, including
their llvm.lifetime.end calls. Those cleanups therefore ran before
EmitScalarExpr(D.getNumIterations()) loaded the bounds, so Clang emitted
a load from an alloca whose lifetime had already ended:
store i32 %sub, ptr %.capture_expr.1
call void @llvm.lifetime.end.p0(ptr %.capture_expr.1)
%0 = load i32, ptr %.capture_expr.1 ; read after lifetime ended
This was harmless while PromoteMemToReg simply discarded lifetime
intrinsics. Since #191909, promotion inserts a 'store undef' in place of
each marker, so the load now correctly resolves to undef and the trip
[15 lines not shown]
[NewPM] Port CFIInstrInserter to the new pass manager (#217494)
Adds a newPM pass for CFIInstrInserter (cfi-instr-inserter).
- Extracts the pass's working state (MBBVector, CSRLocMap) and logic
into a CFIInstrInserterImpl class with a run method, called by both the
legacy pass and the new pass manager pass.
- Renames the old pass with the "Legacy" suffix.
- Adds the new pass manager pass CFIInstrInserterPass, using
RequiredPassInfoMixin: the legacy pass's runOnMachineFunction never
calls skipFunction, so it always runs unconditionally and should not be
skippable in the new PM either. run() unconditionally returns
PreservedAnalyses::all(), matching the legacy pass's own
AU.setPreservesAll() declaration -- the same shape CFIFixupPass (an
already-ported sibling CFI pass) already uses.
- Updates MachinePassRegistry.def, PassBuilder, and CodeGenPassBuilder.
- Wires the pass into X86's and RISC-V's newPM pipelines, matching their
existing legacy-PM gating conditions:
- X86 replaces an existing TODO inside an already-correct conditional in
[12 lines not shown]
[lit] Use functools.lru_cache instead of lit.util.memoize (#217757)
lit.util.memoize builds a (args, tuple(kwargs.items())) key and does two
dict lookups per call. functools.lru_cache has a faster path that uses a
single positional argument directly as the key, so it does one lookup
instead of two and skips the tuple construction.
Profiling lit with Scalene and comparing the two implementations on
test suites showed the lru_cache version is faster for
_caching_re_compile.
runCommandCached takes multiple positional and keyword arguments, so it
does not hit lru_cache's single-argument fast path, but the swap removes
one more caller of the hand-rolled memoize implementation. memoize
itself is now unused and will be removed in a follow-up.
Merge tag 'printk-for-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek:
- Prevent a possible out-of-bound access and a use-after-free in rather
theoretical situations
- Make no_hash_pointers take effect early
- Some fixes and clean up of the ratelimit KUnit test
* tag 'printk-for-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
printk: Handle pre-enabled consoles in the top-level register_console()
printk: Fix possible console use-after-free
lib/tests: test_ratelimit: fix stress test thread lifecycle and leak
lib/vsprintf: Make no_hash_pointers take effect early
[MLIR][SCFToAffine] Validate inlined affine bound operands (#217473)
Validate affine.max and affine.min operands before inlining their maps
into affine.for bounds. This defers nested loops until enclosing
induction variables become valid affine dimensions and keeps the
exported pattern independent of greedy traversal order.
Assisted-by: Codex
[mlir][SPIR-V][Shard] Migrate to explicit attribute APIs (#217233)
Use explicit discardable and inherent attribute access throughout the
SPIR-V ecosystem and Shard simplification. Add typed discardable-attribute
query helpers used by this and the follow-up migration branches.
Assisted-by: Codex
bhyve: Keep passthrough PCI power state virtual
The passthrough Command register is emulated, but PMCSR writes were
sent directly to the physical function. A guest D3hot-to-D0 transition
can perform an internal reset and clear physical Command while its
emulated copy remains enabled.
Cache the Power Management capability and keep the physical D-state
host-owned. Emulate the guest D-state and advertise No_Soft_Reset so
the guest is not promised a function reset by a virtual power cycle.
Restore the assignment-time virtual state after a managed FLR.
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: BBOX.io
bhyve: Manage passthrough devices across guest FLR
bhyve emulates the guest PCI Command register so BAR sizing does not
disable physical decoding. However, PCIe Device Control was passed
through. A guest VFIO reset therefore performed a physical FLR, which
cleared physical Command, while the guest restored only its emulated
copy. The device remained assigned with bus mastering disabled and
could not fetch DMA descriptors.
Intercept guest FLR writes and issue a PPT-managed reset. Stop all
vCPUs, verify ownership, quiesce the function, perform only an FLR, and
restore the host-owned PCI configuration, decode, and bus-master state.
Keep the IOMMU domain in place. bhyve removes guest BAR mappings before
this ioctl; a later guest MEMEN write recreates them. Never escalate a
guest FLR to a power reset.
Reset the guest-owned Command, MSI, MSI-X, MSI-X table, INTx, and MRRS
state. PCIe 6.2 section 6.6.2 explicitly preserves MPS across FLR.
Virtualize MPS, MRRS, and Completion Timeout. Keep physical MPS and
[26 lines not shown]
Merge tag 'probes-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull probes updates from Masami Hiramatsu:
"BTF typecasting and variable fetch enhancements:
- Typecast support across probe events: Extended BTF typecasting
syntax (e.g., (STRUCT)PARAM->MEMBER) to kprobes, uprobes, and
fprobes on function entry and return
- Nested typecasts: Added support for chaining and nesting typecasts
up to 3 levels, including casting registers and stack variables
- Field specifier option: Added (STRUCT,FIELD) syntax to emulate
container_of(), allowing retrieval of parent structures from member
pointers
- $current variable support: Introduced $current special variable to
access the running task_struct via BTF dereferencing
[81 lines not shown]
[llvm][DebugInfo][DWARF] Use DW_AT_APPLE_optimized to indicate optimized code in non-Apple builds. (#214261)
Use the Apple extension DW_AT_APPLE_optimized to mark code as optimized
(in DWARF), even if the build was did not use Apple build flags.
ZTS: Add FIDEDUPERANGE tests
Cover the new ioctl in the block_cloning group: whole-file dedupe,
files that differ, partial and sub-block requests, the path taken when
the feature is disabled, mtime and ctime staying put, a trailing block
only partly covered by the request, mismatched block sizes, identical
data stored with different compression, a truncated file's grown tail,
sparse files, an intent log replay of a dedupe, and a request whose
destination range runs past the destination EOF.
The last one needs the covered bytes to be identical, so that a range
trimmed to EOF rather than refused would compare equal and be reported
as a successful dedupe. That is the shape xfstests generic/158 uses
and the one a random-data test would miss, since the comparison would
report DIFFERS before the length was ever examined. The differs and
subblock tests insist on the DIFFERS report itself rather than
accepting any failure.
stat_blksz and stat_blocks join the stat helpers, so no test needs a
[8 lines not shown]
Implement FIDEDUPERANGE via block cloning
Linux's FIDEDUPERANGE ioctl lets out-of-band dedupe tools such as
duperemove and bees ask a filesystem to share byte-identical file
ranges. ZFS returned EOPNOTSUPP for it. Implement it on top of block
cloning, so matching ranges share storage without the memory cost of
the dedup table.
zfs_clone_range() is split into a precheck and a locked helper so the
dedupe path can reuse the clone loop. zfs_dedupe_range() compares the
two ranges and, only if they are byte-for-byte identical, clones the
source blocks over the destination, all under a single RL_READER and
RL_WRITER hold, so the bytes that get cloned are exactly the bytes
that were compared. Source and destination must share a block size,
which the clone step requires anyway.
The comparison settles a block from its block pointers when it can:
equal strong checksums prove it identical, and, for blocks stored
verbatim, unequal checksums prove it different. Two embedded blocks
[58 lines not shown]
Merge tag 'cxl-for-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull CXL updates from Dave Jiang:
"This includes the remaining patches to complete the basic support for
CXL type2 (accelerators) drivers by the CXL core. A set of unit
testing support to catch regressions for the CXL core type2 exported
functions has also been added. The actual CXL type 2 driver support
for the AMD Solarflare NIC driver has been picked up by net-dev.
A set of preparatory patches has been picked up from the CXL port
error handling series in order to reduce the number of patches in that
series for review. The rest of that series is getting close to be
merged but was not ready for the 7.3 merge window.
There are also a number of misc patches and a large number of bug
fixes against pre-existing issues flagged by sashiko reviews as
contributors post new patches on the mailing list. We will continue to
work through the sashiko raised issues as they show up."
[22 lines not shown]
libzfs: derive the fromds pointer where the buffer is filled
dump_snapshot() fills fromds under one test of sdd->prevsnap[0], then
evaluates the same condition a second time to choose between fromds
and NULL. The two cannot disagree today, but nothing ties them
together, and cppcheck flags the argument:
libzfs_sendrecv.c:1250:26: error: Uninitialized variable: fromds
Set a pointer where the buffer is filled and pass that instead, so
the condition is written once.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Alek Pinchuk <Alek.Pinchuk at connectwise.com>
Closes #18950
zed: suppress cppcheck memleak false positive in zed_strings
_zed_strings_node_create() returns a node that owns its two strdup()ed
strings; zed_strings_add() puts it in an AVL tree and
_zed_strings_node_destroy() frees it later. cppcheck does not model
ownership passing to the caller through a returned struct, and reports
both allocations as leaked at the return:
zed_strings.c:121:2: error: Memory leak: np.key [memleak]
Removing the np->key = np->val aliasing does not change the verdict,
so suppress it inline as other sites in the tree already do.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Alek Pinchuk <Alek.Pinchuk at connectwise.com>
Closes #18949
build: only cppcheck module/ when the kernel side is configured
CPPCHECKDIRS picked up module/ unconditionally, but module/Makefile's
cppcheck rule resolves the kernel headers through @LINUX_OBJ@, which is
only set once ZFS_AC_CONFIG_KERNEL has run. With --with-config=user it
expands empty, so cppcheck is handed an unopenable include path and
make lint fails before it checks anything:
nofile:0:0: error: Can not open include file
'/include/generated/autoconf.h' that is explicitly included.
Move it inside CONFIG_KERNEL, next to the SUBDIRS entry it belongs
with.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Richard Yao <richard at ryao.dev>
Signed-off-by: Alek Pinchuk <Alek.Pinchuk at connectwise.com>
Closes #18951
[NFC][SLP] Refactor so that CostKind is a property of BoUpSLP (#217463)
Track in just one place so we can adjust as needed.
Precursor to #217398.
AI Usage: Assisted by Codex
AMDGPU: Remove remaining uses of old manual bitset of target features. (#217748)
Use new feature bitset for sgpr-init-bug checks, and remove the
remaining llvm uses of getArchAttrAMDGCN in favor of the new feature
bitset.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>