linuxkpi: Do not wait for a disabled tasklet in tasklet_unlock_wait()
tasklet_unlock_wait() waited for the tasklet state to become idle. Linux
only waits for TASKLET_STATE_RUN, i.e. for a tasklet that is currently
executing. A tasklet which is scheduled but disabled does not run until
it is enabled again, so in LinuxKPI it stays in the BUSY (queued) state and
the waiter never returns.
This is what happens when unloading i915: execlists_reset_prepare()
disables the engine tasklet with __tasklet_disable_sync_once() while the
tasklet is queued and kldunload loops forever in pause().
Do not wait if the tasklet is only queued and disabled.
Reviewed by: bz
Sponsored by: Beckhoff Automation GmbH & Co. KG
linuxkpi: Fix lkpi_i2c_del_adapter() leaving the devices behind
lkpi_i2c_del_adapter() looked for the lkpi_iic or lkpi_iicbb device to
delete with device_find_child() on increasing unit numbers, and stopped at
the first unit that does not exist. Units are allocated globally per
devclass, so as soon as one adapter was removed (leaving a hole) or when the
units of a parent do not start at 0, the adapter was not found and its
device was never deleted. The i2c devices of a driver such as i915 then
accumulate, with a new set of unit numbers, each time it is loaded.
Walk the children of the parent instead and match on the adapter.
Sponsored by: Beckhoff Automation GmbH & Co. KG
linuxkpi: Release devres on PCI driver detach
linux_pci_detach_device() called the driver remove method and then only
dropped its reference on the device, expecting the devres list to be
released from lkpi_pci_dev_release() once the last reference is gone.
That never happens when a devres action itself holds a reference on the
device. The typical case is devm_drm_dev_alloc(): the drm_device takes a
reference on its parent and the matching drm_dev_put() is a devres
action. The device is thus never released, drm_dev_release() is never
called and the DRM device and everything it owns is leaked, which makes
unloading drm-kmod drivers fail ("failed due to N other pending
references on the LinuxKPI device") and leaves the module unloadable or
crashing.
Linux releases the devres resources when a driver is unbound, so do the
same: call lkpi_devres_release_free_list() right after the remove method.
The list is empty when lkpi_pci_dev_release() runs later.
[2 lines not shown]
linuxkpi: Fix sysfs_remove_group() for groups without a name
sysfs_create_group() handles a group with a NULL name by creating its
attributes directly under the object node, but sysfs_remove_group() passed
the NULL name to sysctl_remove_name(), which then panics in strcmp().
Mirror the creation path: for an unnamed group, remove each attribute and
binary attribute individually.
This was not hit before because the devres actions of a PCI device
(e.g. the one registered by devm_device_add_group()) were not run when
the driver was detached.
Sponsored by: Beckhoff Automation Gmbh & Co. KG
CodeGen: Remove -verify-machineinstrs from partial llc pipelines (#238664)
llc verifies the MIR output by default when the pipeline stops before
code emission. Remove the flag from tests using -run-pass with
multiple passes or -stop-before/-stop-after with MIR or IR inputs. The
final machine code is still verified, but the verifier no longer runs
after every pass. It's very expensive to run the verifier and it's
unlikely to catch a transient error which is fixed by a later
pass. The full verification is still performed in EXPENSIVE_CHECKS
builds by default.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
AMDGPU: Remove kill flags on virtual registers from MIR tests
Soon the verifier will disallow this. Delete redundant tests which
only differed from others by kill flag uses. twoaddr-bundle.mir relied
on the input kill flags in TwoAddressInstruction, so compute
LiveIntervals first as the real pipeline does.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][Math] Handle wide exponents in powi strength reduction (#237513)
This fixes https://github.com/llvm/llvm-project/issues/237494.
PowIStrengthReduction converts constant exponents to int64_t before
checking the reduction threshold, triggering assertions for out-of-range
values. Match scalar and splat constants as APInt and check their signed
range before conversion, preserving simplification of small values in
wide types.
Assisted-by: OpenAI Codex
[ELF] Reject out-of-range .llvm_addrsig symbol indices (#237749)
With --icf=all or --icf=safe, findKeepUniqueSections indexes the symbol
table with each .llvm_addrsig entry without a bounds check, so an
out-of-range index crashes lld. Report an error instead.
Fix #235198
Co-authored-by: Fangrui Song <i at maskray.me>
compiler-rt: Use int for the AMDGPU soft float comparison result
We wouldn't want to use the pointer size as the word size.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
CodeGen: Remove -verify-machineinstrs from verifier tests (#238668)
These tests check machine verifier errors on invalid MIR input. The
MIR parser verifies its input, so the error is reported before any
pass runs and the verifier does not need to run after every pass.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>