[ids-check] Make the script CWD-independent (#223354)
PR #208780 removed the working directory from the ids-check workflow
step invoking the ids-check-helper script. This caused the script to run
from the workspace root rather than the repository root. It turns out
that the script was not resilient to being run from any arbitrary
directory, which caused idt to never be invoked. This made the workflow
silently succeed without checking anything.
These changes resolve repository-relative paths against the script's own
location instead, assuming it is in the `llvm/utils/git` directory.
This also fixes the script to use the right resource directory when
using a prebuilt idt.
The effort to build LLVM as a dylib is tracked in #109483.
Collect interface stats with a pynetif netdata collector
## Problem
Bonds, bridges and VLANs always reported a speed of 0 in realtime reporting (dashboard and TrueNAS Connect heartbeat). netdata's `/proc/net/dev` collector treats anything under `/sys/devices/virtual/net` as virtual and never creates a speed chart for it. In netdata 2.9 that path is hardcoded and the per-interface `virtual` override is read too late, so there is no config-only fix.
## Solution
- **New `truenas_net_stats` python.d collector**: it keeps its rtnetlink sockets open across ticks. Per tick it drains a non-blocking link-event socket (normally EAGAIN) and does a single `RTM_GETSTATS` dump for all interfaces. The link list and ethtool speeds are only refreshed when a link event arrives; bond, bridge and VLAN speed come from the kernel (sum of active slaves, fastest up port, parent device). Any error closes the sockets and the next tick starts over with a full resync.
- **Charts** `truenas_net_stats.{traffic,speed,operstate}.<iface>` keep kilobits/s traffic and the `received`/`sent` dimension names, so the interface graph and realtime conversions are unchanged apart from the chart ids.
- **`/proc/net/dev` is disabled** since nothing else reads it, which also cuts netdata's per-interface dimensions from roughly 30 to 4. The dbengine size approximation is updated to match.
Side effects worth calling out:
- Interface traffic history recorded before upgrade is no longer shown, since it is stored under the old `net.<iface>` chart ids.
- netdata's `system.net`, `net_packets`/`errors`/`drops`/`mtu`/`carrier`/`duplex` charts and the per-container `cgroup_*.net_*` charts are gone. Nothing in middleware or the UI reads them, but Graphite exporters will see different metric paths.
- Requires the pynetif build with `get_link_stats` and `netlink_route(groups=...)`.
LinuxKPI: skbuff: add initial page pool support
Add an internal flag which is set by skb_mark_for_recycle() and upon
"skb_free" then selects whether the skb is freed or returned to the
page pool.
There will likely be more details to figure out once the LinuxKPI page
work is done and we support more of the page pool than the bare minimum.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit e4795d3dbee71c463429e2901dad111fbc2d08fc)
LinuxKPI: skbuff: add support for frags in linuxkpi_skb_copy()
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1e4ec01603c4b1e0b0eb524f28f731eb5cb5f6dc)
LinuxKPI: skbuff: implement __skb_linearize()
skb_linearize() is used by mt7921, mt7925, and in the general mt76 tx dma
code. __skb_linearize() is used in the general iwlwifi TX code but given
the way we currently create TX skbs in LinuxKPI 802.11 we never hit that
case.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 9de11cc26ab61d7f80e8af84dbc55d8cbd6f832d)
LinuxKPI: skbuff: implement napi_build_skb()
Implement napi_build_skb() around linuxkpi_build_skb().
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b36460e5ec4659d0fa14b35c9342c5a154b3db7d)
LinuxKPI: skbuff: add skb_put_zero()
Add skb_put_zero() as a simple wrapper around __skb_put_zero().
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 32c983449a7c802bf47578d5304c6d505db7821a)
LinuxKPI: skbuff: improve debugging
Deal with SKB_TRACE_FMT optional arguments; while here properly indent.
Add KASSERT to __skb_unlink() to catch incorrect skbuffs encountered
while debugging a wireless driver (which had other pre-conditions failing).
Sponsored by: The FreeBSD Foundation
(cherry picked from commit e5bcf7b99fcbe06d381525ffdd5027b846cdc1d3)
LinuxKPI: 802.11: lkpi_80211_txq_tx_one() only pass sta if added to drv
If we are doing a direct (*tx) downcall, only pass sta as meta data
if it was added to the driver (via the state machine). This prevents
us passing a sta not known to the driver leading to possible follow-up
complications/errors. This will usually happen if (a) we are doing
software scanning, or (b) if net80211 decides to change the ni from
under us and sends a packet with the new ni.
Adjust a debug statement before to also have the added_to_drv field
in it to ease debugging.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c6e70c68d2ce5cfbcace251ef6ed2f1eae912a74)
LinuxKPI: pci detach: implement a proper detach (release) path
There are two paths in the LinuxKPI PCI code to instantiate a "pdev"
(LinuxKPI pci_dev). One is using the FreeBSD bus framework and the
pdev will be the softc.
This commit starts cleaning up the detach path for just that case
to the best possible.
So far we did a lot of the work in linux_pci_detach_device(), which is
the internal handler of the detach function and little in the
(*release) callback (devres cleanup only).
The problem with that is, that we tear down resources which later in the
devres cleanup are needed. With them not being there anymore we panic, e.g.,
in lkpi_dma_unmap < lkpi_dmam_free_coherent < lkpi_devres_release_free_list.
The solution is to migrate most of the cleanup work into the (*release)
callback, which will automatically be called when the device (kobj) reference
drops to zero. The only work which should be done immediately is to let the
dirver do its cleanup; this has to happen before we try to teardown the
resources, but also we do want this to happen when detach is called
[24 lines not shown]
LinuxKPI: fix lkpi_pci_get_device() reference counting on device
In case we are passed an "odev" (a device to start the search from),
that device would have an extra reference. The best way to illustrate
this is to look at for_each_pci_dev(), which will return one device
after the other. Upon first return we return a pdev with a reference.
That pdev is then passed in as odev on the next call. If we do not
clear the reference it will be leaked.
Sponsored by: The FreeBSD Foundation
Fixes: 910cf345d0ee9 ("LinuxKPI: pci: implement ...")
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D57428
(cherry picked from commit f9a37065b6948831f62a33fd0c68c96985b01a41)
[Github] Register Flang integration test check in issue comment workflow (#225500)
Allow issue-write.yml to consume comment artifacts from the Flang
integration test check. Landing this registration first enables testing
of the workflow in #221766.
LinuxKPI: add system_percpu_wq
In Linux v6.17 system_wq was replaced (renamed to) system_percpu_wq,
with the old name still present.
We just alias system_percpu_wq to linux_system_short_wq like we do
for system_wq to keep both around for the forseeable future.
Note: the original system_wq was a per-cpu queue upstream as well
based on my understanding but we never implemented it as such.
That means we are still lacking a per-cpu implementation for
system_percpu_wq but at least we do not change the status-quo
of the LinuxKPI implementation with this.
Note2: we should add a check somewhere for LINUXKPI_VESION >=
61700 to print a warning if anyone still uses the system_wq
to detect any possible sami-native or out-of-tree drivers
relying on this and not properly updating.
[5 lines not shown]
linuxkpi: Add pm_runtime_resume_and_get
pm_runtime_resume_and_get is used by new versions of amdgpu, and began
use between Linux kernel version 6.12, and 6.14.
Reviewed by: dumbbell
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57463
(cherry picked from commit 7e1245aafeece1a56af292c2652c6b835ccb6f10)
[clang] Fix crash on assigning to _Atomic vectors (#225125)
As described in the issue itself: d=c on _Atomic vector crashed during
the overflow check because isVectorType() doesn't look through _Atomic.
Strip _Atomic before checking operand types.
Fixes #225039
bt:
<img width="1908" height="825" alt="225039_crash_atomic_vector"
src="https://github.com/user-attachments/assets/c5d48ba5-fa9b-43f8-a555-8b9bbe558152"
/>
Co-authored-by: Timm Baeder <tbaeder at redhat.com>
pci: Add is_pci_device helper function
This returns true if a given device is a PCI device (child of a PCI
bus).
Reviewed by: bz, kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D56996
(cherry picked from commit ffcf5e356644252f2f6c89ba01057af45c216559)
bus: Document special ranges of IVARs
Some IVAR indices are special in that they have global meaning across
multiple buses where as other IVARs are always private to the local bus.
Try to document this a bit and add constants for the various ranges to
avoid future conflicts.
This is a no-op, but IVAR indices are now generally defined as enums
as that makes it easier to define them in terms of ranges.
Reviewed by: imp, royger, andrew
Differential Revision: https://reviews.freebsd.org/D54159
(cherry picked from commit 6cf4e30252fe48b230b9d76cac20576d5b3d2ffa)
pci: pci_host_generic: provide cleanup methods outside of detach
If device_attach() fails, we're expected to actually cleanup after
ourselves because device_detach() will not be called. Factor out the
cleanup bits that don't rely on attach having actually succeeded so
that we can cleanup properly in bcm2838_pci.
Reviewed by: andrew, imp
(cherry picked from commit 31a94ec32b53ebf6227bc868ce4f7aa07650680d)
pci: use uint32_t for eecp
eecp holds the extended capability offset. If that offset is larger
than 0xff, storing it in uint8_t truncates it, which can make the
early EHCI/XHCI capability walk read the wrong location and loop during
boot.
Seen on AMD device 1022:151e, where HCCPARAMS1 = 0x0118ffc5 and the
first xHCI extended capability offset is 0x460. Widen eecp to uint32_t
in xhci_early_takeover(), matching xhci_pci_take_controller().
Signed-off-by: Gisle Nes <gisle at gisle.net>
Reviewed by: zlei, aokblast
MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/2127
Closes: https://github.com/freebsd/freebsd-src/pull/2127
(cherry picked from commit 555ffd9022de0c497881bafc413e3e1d05af10d4)
[IR] Remove llvm.strip.invariant.group intrinsic (#225399)
This intrinsic was originally introduced to make sure that if we have a
dominating condition like `a == launder.invariant.group(a)`, we don't
end up replacing the latter with the former, as that would allow the
optimizer to assume that the memory stays invariant, despite going
through a launder operation. Wrapping both comparison operands in
strip.invariant.group avoids the issue, because replacing one stripped
pointer with another is safe.
The underlying issue was fixed in
https://github.com/llvm/llvm-project/pull/224281 (and prior work), which
ensures that the problematic replacement cannot happen in the first
place.
https://github.com/llvm/llvm-project/pull/225072 stopped emitting
llvm.strip.invariant.group on the clang side.
This PR now removes the intrinsic entirely. To be on the safe side, it
is upgraded to llvm.launder.invariant.group. For Clang's specific usage,
just dropping it would be fine.
pci: Preserve adjusted PCIe control state
The PCI bus changes live capability registers after the initial
configuration snapshot has been saved. A later driver reprobe restores
that snapshot and can silently undo the adjustment.
Update the cached Device Control and Root Control bits together with
pcie_adjust_config() writes. Route the persistent Maximum Read Request
setter and the bus-owned AER control changes through that helper as
well, so they share the same restore semantics as MPS reconciliation.
Document the persistent-write contract. Merge only explicitly adjusted
bits into the saved image so unrelated or transient bits observed during
the hardware read-modify-write cannot become persistent.
(cherry picked from commit a9752e9ac8a635f49ca058dd7268298840c7e915)
pci: Add is_pci_device helper function
This returns true if a given device is a PCI device (child of a PCI
bus).
Reviewed by: bz, kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D56996
(cherry picked from commit ffcf5e356644252f2f6c89ba01057af45c216559)