Repository navigation
7.3: PCI: vmd: Flush DMA writes before handling MSI on Meteor Lake (MTL016) - #14
Open
not-varram wants to merge 16 commits into
Open
not-varram wants to merge 16 commits into
not-varram wants to merge 16 commits into
Conversation
It seems that even after 6 months there still exists a system that hasn't updated their microcode to fix this. Instead of removing the detection altogether, keep the warning but don't clear the cpuid bit so that we can spread awareness and have people update their microcode revision. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
…Pro Gen8" Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
By default BT starts up but doesn't show any devices when you try to pair. Adding the device id in block list, fixes that.
Signed-off-by: Eric Naim <dnaim@cachyos.org>
detach_tasks() uses struct lb_env.loop_max as an env.src_rq->cfs_tasks
iteration count limit. It is however set without the source RQ lock held.
This means that env.loop_max and the actual length of env.src_rq->cfs_tasks
as observed within detach_tasks() can differ. This can cause some tasks to
be unnecessarily iterated over more than once, for instance:
env.loop_max := 4
detach_tasks()
// Here env.src->cfs_tasks only contains two tasks which can't be
// migrated anywhere, so they're put back in the list each time.
env.src->cfs_tasks := [p1, p0]
// The iteration goes:
p0; cfs_tasks := [p0, p1]
p1; cfs_tasks := [p1, p0]
p0; cfs_tasks := [p0, p1]
p1; cfs_tasks := [p1, p0]
// IOW we iterate over each task twice
In the Specjbb test, the similar issues can be caught many times.
(Over 330,000 times in a 30-minites Specjbb test)
This patch sets env.loop_max only once RQ lock is taken,
and uses busiest->cfs.h_nr_queued for setting the env.loop_max.
After this patch, I cannot catch any above issue in the Specjbb test.
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
finish_task_switch() is not inlined even in the O2 level optimization, performance testing indicates that this could lead to a significant performance degradation when certain Spectre vulnerability mitigations are enabled. In switch_mm_irq_off(), some mitigations may clear branch prediction history, or the instruction cache, like arm64_apply_bp_hardening() on arm64, BPIALL/ICIALLU on arm, and indirect_branch_prediction_barrier() on x86. finish_task_switch() is right after switch_mm_irqs_off(), the performance is greatly affected by function calls and branch jumps. __schedule() has a __sched attribute, which makes it be placed in '.sched.text' section, while finish_task_switch() does not. This makes they "far away from each other" in vmlinux, which aggravating the performance degradation. Make finish_task_switch() and its subfunctions always inline to optimize the performance. Performance test - time spent on calling finish_task_switch(): 1. x86-64: Intel i5-8300h@4Ghz, DDR4@2666mhz; unit: x86's tsc | test scenario | old | new | delta | | gcc 15.2 | 27.50 | 25.45 | -2.05 ( -7.5%) | | gcc 15.2 + spectre_v2_user=on | 46.75 | 25.96 | -20.79 (-44.5%) | | clang 21.1.7 | 27.25 | 25.45 | -1.80 ( -6.6%) | | clang 21.1.7 + spectre_v2_user=on | 39.50 | 26.00 | -13.50 (-34.2%) | 2. x86-64: AMD 9600x@5.45Ghz, DDR5@4800mhz; unit: x86's tsc | test scenario | old | new | delta | | gcc 15.2 | 27.51 | 27.51 | 0 ( 0%) | | gcc 15.2 + spectre_v2_user=on | 105.21 | 67.89 | -37.32 (-35.5%) | | clang 21.1.7 | 27.51 | 27.51 | 0 ( 0%) | | clang 21.1.7 + spectre_v2_user=on | 104.15 | 67.52 | -36.63 (-35.2%) | 3. arm64: Raspberry Pi 3b Rev 1.2, Cortex-A53@1.2Ghz; unit: cntvct_el0 | test scenario | old | new | delta | | gcc 15.2 | 1.453 | 1.115 | -0.338 (-23.3%) | | clang 21.1.7 | 1.532 | 1.123 | -0.409 (-26.7%) | 4. arm32: Raspberry Pi 3b Rev 1.2, Cortex-A53@1.2Ghz; unit: cntvct_el0 | test scenario | old | new | delta | | gcc 15.2 | 1.421 | 1.187 | -0.234 (-16.5%) | | clang 21.1.7 | 1.437 | 1.200 | -0.237 (-16.5%) | Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@kernel.org> Cc: Rik van Riel <riel@surriel.com> Cc: Segher Boessenkool <segher@kernel.crashing.org> Cc: David Hildenbrand (Arm) <david@kernel.org> Cc: H. Peter Anvin (Intel) <hpa@zytor.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Xie Yuanbin <qq570070308@gmail.com>
Some USB devices report string descriptors with a declared length greater than the actual string, leaving uninitialized firmware memory - often including C0 control characters such as 0x18 - appended to the returned string. This has been observed on the ASUS ROG Azoth 2.4GHz dongle (USB ID 0b05:1a85), where the trailing bytes make their way into hid->uniq and then /sys/class/input/inputN/uniq. Downstream userspace components then reject the device. systemd's sd-device property_is_valid() treats any string property containing control characters as invalid and refuses to set ID_SERIAL_SHORT, which in turn prevents the device from being tagged with seat. On GNOME Wayland, mutter silently declines to open input devices that are missing this tagging, leaving the keyboard visible and producing keycodes at the kernel layer but dead to the user in a graphical session. Truncate the returned UTF-8 string at the first C0 control character (0x00..0x1F) or DEL (0x7F). Printable Unicode beyond ASCII is left intact, so legitimate non-ASCII serials (e.g. European manufacturers) continue to work. Callers that previously received a string with trailing garbage now receive the clean leading portion, which is well-formed UTF-8 and safe for all downstream consumers. Signed-off-by: Taylor Hewetson <taylor@exponent.digital>
A user reported random 300-500ms input delays for this touchpad on a ASUS ZenBook UX3404 / Q410VA. Force it to run on 100khz instead to get rid of those random delays. Signed-off-by: Eric Naim <dnaim@cachyos.org>
When firmware encounters an error, STATUS_FW_ERROR is set but the mac80211 TX path continues pulling frames from TXQs. Each frame fails at iwl_trans_tx() which checks STATUS_FW_ERROR and returns -EIO, but iwl_mld_tx_from_txq() keeps looping over every queued frame. This burns CPU in a tight loop on dead firmware and can cause soft lockups during firmware error recovery. Add a STATUS_FW_ERROR check at the top of iwl_mld_tx_from_txq() to stop pulling frames from mac80211 TXQs when firmware is dead. Also guard iwl_mld_mac80211_tx() which bypasses the TXQ path entirely and would otherwise continue feeding frames to dead firmware. Once STATUS_FW_ERROR is cleared during firmware restart, TX resumes naturally with no explicit wake needed. Fixes: d1e879e ("wifi: iwlwifi: add iwlmld sub-driver") Signed-off-by: Cole Leavitt <cole@unwrap.rs>
LLM yap: The two CS35L63 amps are SPI sidecar amps hanging off the CS42L43 (they enumerate as spi-cs35l56-left/-right, driven by the cs35l56 driver, part 0x3563) — not SoundWire devices. The kernel only creates the cs42l43-cs35l56 bridge DAI that routes audio into these amps when the SOC_SDW_SIDECAR_AMPS quirk is set. That quirk is applied per-machine by the DMI table in sound/soc/intel/boards/sof_sdw.c, keyed on Dell DMI_PRODUCT_SKU. This machine's SKU 0E53 was missing from the table, so the quirk stayed off → bridge DAI never created → external amps silent → only the CS42L43 internal amp plays Signed-off-by: Eric Naim <dnaim@cachyos.org>
This reverts commit da1ea35. This commit breaks compiling with clang 22.1.8 -O3. Since the prior commit already mitigates the issue, reverting this should be fine until clang gets updated in Arch Linux/CachyOS. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Currently, when the prefill API refills a non-full sheaf, it takes the objects from partial slabs and never from the full sheaves in the barn, so once the barn's full list becomes saturated, it stays saturated. For objects freed via kfree_rcu(), every RCU sheaf then has to be flushed to slabs because the barn's full list has no room. To fix this, let the sheaf refill from the barn first, and introduce a partial sheaf in the barn, which holds the leftover objects [1]. Only the prefill path needs the partial sheaf. The generic allocation path (__pcs_replace_empty_main()) exchanges an empty sheaf for a full one from the barn, so nothing is left over. The prefill path refills a sheaf that is not necessarily empty, so taking objects from the barn usually leaves leftovers, and the partial sheaf is where they are kept. refill_sheaf() only takes objects from partial slabs and never involves the partial sheaf. The sheaf is refilled by copying objects from the partial sheaf, and then from a full sheaf taken from the barn if it is still not full. A sheaf that objects were copied from stays in the barn as the partial sheaf if it still holds objects, or goes on the empty list if it is empty. The sheaf being refilled is never replaced. The gain comes from two sides: every full sheaf taken out makes room on the barn's full list for a future RCU sheaf, and refilling from the barn is cheaper than refilling from partial slabs under list_lock. Note that putting the sheaf with the leftover objects on the full list instead would not work: it would occupy room on the full list, so the list would stay saturated and rcu_free_sheaf() would still keep flushing. An earlier version of this patch swapped sheaves instead, to minimize the memcpy overhead. As Harry Yoo pointed out [2], replacing the caller's sheaf loses cache affinity, filling it directly is more straightforward, and testing showed no measurable difference between the two approaches, so the approach he suggested is used. Tested with will-it-scale mmap1 (192 processes, one-minute runs) on the maple_node cache. throughput: 27778727 -> 34500556 (+24.2%) metric baseline patched change ===================================================================== alloc_fastpath 54,124 56,696 +4.75% alloc_slab 7,100,651 159,739 -97.75% barn_get 849 194,460,392 +22904539.81% barn_get_fail 2 217 +10750.00% barn_put 851 182,306,701 +21422544.07% barn_put_fail 260,400,484 145,522,675 -44.12% cmpxchg_double_fail 1,029,204 334,228 -67.53% free_add_partial 326,694,687 181,935,790 -44.31% free_fastpath 13,297 15,611 +17.40% free_rcu_sheaf 8,332,839,104 10,490,535,227 +25.89% free_remove_partial 7,099,788 158,297 -97.77% free_slab 7,099,788 158,297 -97.77% free_slowpath 10,969,156 782,851 -92.86% objects 15,295 14,849 -2.92% objects_partial 15,295 14,849 -2.92% partial 1,604 2,336 +45.64% sheaf_alloc 137,757,895 141,208,076 +2.50% sheaf_flush 8,332,823,922 4,656,725,764 -44.12% sheaf_free 137,757,883 141,208,072 +2.50% sheaf_prefill_fast 3,337,502,163 4,196,506,116 +25.74% sheaf_prefill_slow 685 400 -41.61% sheaf_refill 8,343,794,364 4,657,509,724 -44.18% sheaf_return_fast 3,337,502,411 4,196,506,382 +25.74% sheaf_return_slow 437 134 -69.34% slabs 1,604 2,336 +45.64% total_objects 102,656 149,504 +45.64% Here is what the important metric changes mean. barn_get and barn_put: refills now take full sheaves out of the barn, and RCU sheaves are put into the barn again. Before, the barn's full list was saturated once and hardly ever consumed. barn_put_fail: more than half of the RCU sheaves are now put into the barn instead of being flushed. The rest are still flushed because they arrive while the barn's full list is at its limit. sheaf_refill and free_add_partial: fewer objects are taken from partial slabs to refill sheaves, and fewer slabs are added to the partial list, by the same percentage. alloc_slab and free_slab: the partial list is almost never empty when a refill looks at it, so slabs are almost never allocated and freed again only to serve refills. After the test, the maple_node cache holds 1604 slabs without the patch and 2336 with it. After a manual shrink (echo 1 > /sys/kernel/slab/maple_node/shrink), it holds 485 without the patch and 563 with it. So most of the extra slabs are held only by objects sitting in sheaves and are returned by a shrink, and what remains is a small difference, because objects handed out from the barn come from many more slabs than a refill from partial slabs would use. Link: https://lore.kernel.org/linux-mm/aqPlMzUIw-4g2iOX@fedora/ [1] Link: https://lore.kernel.org/linux-mm/aq0ylDidEHa2kg4X@thinkstation/ [2] Signed-off-by: Hao Li <hao.li@linux.dev> Reviewed-by: Harry Yoo (Meta) <harry@kernel.org> Link: https://patch.msgid.link/20260921094521.141665-1-hao.li@linux.dev Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
Sending traffic through a wireguard tunnel on a host using the fq qdisc fills the log with: fq: likely mono tstamp with tstamp_type 0 An skb carries a timestamp in skb->tstamp and, separately, a skb->tstamp_type field recording which clock that timestamp came from. The two have to agree. When wireguard encapsulates a packet it calls wg_reset_packet(), which clears the fields that must not leak from the inner packet into the tunnel packet. It does so in two steps: skb_scrub_packet(skb, true); memset(&skb->headers, 0, sizeof(skb->headers)); skb_scrub_packet() deliberately keeps skb->tstamp when it holds a monotonic timestamp: that value is the time the packet is scheduled to be sent, and the qdisc still needs it. The memset then zeroes skb->tstamp_type, because that field sits inside the headers group while skb->tstamp does not. The packet therefore leaves wireguard carrying a monotonic timestamp labelled as a realtime one. Nothing noticed until commit c4f796c ("net_sched: sch_fq: convert skb->tstamp if not monotonic"): fq used to assume every timestamp was monotonic. It now consults tstamp_type, spots the mismatch, warns, and falls back to treating the value as monotonic. Pacing still ends up correct, so the log spam is the actual problem. Save tstamp_type before the memset and restore it when encapsulating, next to the hash fields that are already carried over this way. When decapsulating it stays zeroed, which is right: an incoming packet's timestamp is a realtime receive timestamp. Fixes: de79910 ("net: Add skb_clear_tstamp() to keep the mono delivery_time") Signed-off-by: Ramses de Norre <ramses@well-founded.dev> Reviewed-by: Toke Høiland-Jørgensen <toke@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Cc: stable@vger.kernel.org Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Cherry-picked-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/work_items/212
Its observed that on AUX_CH failure, even if the retry is increased to
1000, it does not succeed. Either the command might be wrong or sink in
an unknown/sleep state can cause this. So try waking the sink device.
Before reading the DPCD caps wake the sink for eDP.
v2: Use poll_timeout_us (Jani N)
Add the reason, why this change is required (Ville)
v3: Wake sink only for eDP
Remove the dpcd probe set to true/false in wake_sink (Imre)
v4: make edp_wake_sinc() static and dpcd_readb -> dpcd_reab_byte (Suraj)
v5: Drop poll_timeout_us. drm_dp_dpcd_read_byte() already retries the AUX
transaction internally (up to ~16ms), so the outer 6ms poll could
never iterate and only added a pre-read delay on the hot path; read
DP_SET_POWER once instead. Wake the sink before reading the DPCD
caps, otherwise a sleeping sink fails the caps read and returns
early before the wake ever runs. (Suraj, Jani, Sashiko)
v6: Mask and write DP_SET_POWER (Sashiko)
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4391
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/16654
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patch.msgid.link/20260915042300.2201757-1-arun.r.murthy@intel.com
Cherry-picked-for: zen-kernel#422
4 tasks done
Per the Intel Core Ultra Processor Specification Update
(ID 792254 of 9/1/2026), the Meteor Lake VMD (8086:7d0b) is affected by an
MSI erratum:
MTL016: MSI from VMD-Owned Device May Pass Memory Write
Problem When the storage subsystem is configured to operate in RAID
0 or 1 mode, a Message Signaled Interrupt (MSI) from an
Intel® Volume Management Device (Intel® VMD) owned device
may interrupt a core before a previous write from the device
is completed.
Workaround None identified. The VMD MSI interrupt-handler should
initially perform a dummy register read to the MSI initiator
device prior to any writes to ensure proper PCIe ordering.
The VMD can signal its MSI before the posted writes carrying a child
device's DMA data have landed in memory. vmd_irq() then demuxes to the
child handler while the child's completion queue is not yet coherent, so
the handler observes no completion and returns without consuming it. The
I/O is only recovered when the block layer timeout expires and polls the
queue:
nvme nvme0: I/O tag 253 (50fd) QID 1 timeout, completion polled
The practical effect is therefore not a lost I/O but a 30 second stall
of the entire storage stack, repeated under any sustained read load.
This was originally diagnosed and fixed by Kai-Heng Feng in September
2024 [1]. That patch used udelay(4); Keith Busch objected that the delay
is merely a side effect of the read, and that flushing the pending
device-to-host writes is what the erratum actually requires. Kai-Heng
agreed to respin with a dummy register read. The thread then stalled on
an open question from Manivannan Sadhasivam [2]: whether the read must
target the child device (the "MSI initiator" named by the erratum)
rather than the VMD, and whether the workaround belongs in the NVMe
driver instead. No revision followed, and the erratum has remained
unmitigated in mainline since.
This implements the flush read Keith asked for, and answers the open
question empirically: the read MUST complete at the initiating child
device. A read of the VMD's own config BAR was tried first and does not
help - it terminates at the VMD and never traverses the downstream
link, so it does not order against the child's posted writes (measured:
timeout rate unchanged). Reading the initiator's config space does
order correctly: per PCIe ordering rules the read completion cannot
pass the device's earlier posted writes, so returning from the read
guarantees the completion queue entry is visible.
The initiator's config address is captured per-IRQ at MSI allocation
time from the requesting device, so the hot path adds one config read
only on affected parts, and only for vectors owned by a child device.
The read is serialized with cfg_lock like all other VMD config access.
No NVMe driver change is needed.
Measured on a Dell Pro Max 14 MC14250 (Meteor Lake, VMD 8086:7d0b,
KIOXIA BG6 512GB, 7.0.0-30-generic). The drive is healthy (46C, 0 media
errors, 2% used) and ASPM is disabled on the link with all L1 substates
off, so neither ASPM nor APST is involved.
Dropping caches and reading 3000 shared libraries, measuring
/proc/pressure/io "full" (every task on the system blocked on I/O),
with nvme_core.io_timeout=5:
unpatched: round 1 wall 37.4s full I/O stall 32.6s timeouts 0
round 2 wall 30.6s full I/O stall 28.7s timeouts 1
round 3 wall 30.3s full I/O stall 27.4s timeouts 1
VMD-BAR read: round 1 wall 44.8s full I/O stall 38.6s timeouts 8
(insufficient) round 2 wall 234.8s full I/O stall 207.9s timeouts 37
round 3 wall 3.6s full I/O stall 0.8s timeouts 0
this patch: round 1 wall 3.6s full I/O stall 1.3s timeouts 0
round 2 wall 3.6s full I/O stall 1.3s timeouts 0
round 3 wall 3.6s full I/O stall 1.4s timeouts 0
Before any workaround, 208 seconds of total-system I/O stall
accumulated in the first 13 minutes of uptime, roughly 27% of wall
clock. Userspace experiences this as GUI applications taking 30-60+
seconds to start while throughput between stalls looks entirely normal
(1.9 GB/s QD1) - which is what makes the fault easy to misattribute to
ASPM or to the drive.
[1] https://lore.kernel.org/20240903025544.286223-1-kai.heng.feng@canonical.com/
[2] https://lore.kernel.org/20240913111142.4cgrmirofhhgrbqm@thinkpad/
Reported-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Suggested-by: Keith Busch <kbusch@kernel.org>
Assisted-by: LLM
Signed-off-by: Rickey Bartlett <subtexel@gmail.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
[bhelgaas: include erratum source and text, update URLs]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260825043220.9047-1-subtexel@gmail.com
(cherry picked from commit b437504)
Assisted-by: LLM
Signed-off-by: Varsh Satti <varsh@varram.me>
not-varram
force-pushed
the
vmd-mtl016-7.3
branch
from
October 12, 2026 19:28
a239ff8 to
4dfe051
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean cherry-pick of upstream commit
b43750456515("PCI: vmd: Flush DMA writes before handling MSI on Meteor Lake") from the PCI tree. Authored by Rickey Bartlett; authorship is preserved.Refs CachyOS/linux-cachyos#1076. This is the 7.3 counterpart to #13, which has the full description and before/after numbers.
Summary: Meteor Lake VMD (
8086:7d0b) is affected by Intel erratum MTL016. An MSI can arrive before the NVMe completion reaches memory, causingnvme nvme0: I/O tag ... timeout, completion polledand system-wide stalls of up to 30 s. Upstream fixes it with a dummy config read from the child device before demuxing the IRQ.Status
drivers/pci/controller/vmd.con7.3/fixesis blob241023e, which is exactly the pre-image of the upstream diff.Cc: stabletag, so 7.3.x stable won't pick it up on its own.