5.15.17-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 691/846 drm/etnaviv: limit submit sizes
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
commit 6dfa2fab8ddd46faa771a102672176bee7a065de upstream.
Currently we allow rediculous amounts of kernel memory being allocated via the etnaviv GEM_SUBMIT ioctl, which is a pretty easy DoS vector. Put some reasonable limits in to fix this.
The commandstream size is limited to 64KB, which was already a soft limit on older kernels after which the kernel only took submits on a best effort base, so there is no userspace that tries to submit commandstreams larger than this. Even if the whole commandstream is a single incrementing address load, the size limit also limits the number of potential relocs and referenced buffers to slightly under 64K, so use the same limit for those arguments. The performance monitoring infrastructure currently supports less than 50 performance counter signals, so limiting them to 128 on a single submit seems like a reasonably future-proof number for now. This number can be bumped if needed without breaking the interface.
--- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +6 -0
@@ -469,6 +469,12 @@ int etnaviv_ioctl_gem_submit(struct drm_return -EINVAL ; } +if (args->stream_size >SZ_64K || args->nr_relocs >SZ_64K || + args->nr_bos >SZ_64K || args->nr_pmrs >128 ) { +DRM_ERROR ("submit arguments out of size limits\n" ); +return -EINVAL ; + } +/* * Copy the command submission and bo array to kernel space in * one go, and do this outside of any locks.
Greg Kroah-Hartman
maintainerPATCH 692/846 drm/amd/display: Fix the uninitialized variable in enable_stream_features()
In reply to Greg Kroah-HartmanFrom: Yizhuo Zhai <[email protected]>
commit 0726ed3065eeb910f9cea0c933bc021a848e00b3 upstream.
In function enable_stream_features(), the variable "old_downspread.raw" could be uninitialized if core_link_read_dpcd() fails, however, it is used in the later if statement, and further, core_link_write_dpcd() may write random value, which is potentially unsafe.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2 -0
@@ -1696,6 +1696,8 @@ static void enable_stream_features(strucunion down_spread_ctrl old_downspread;union down_spread_ctrl new_downspread; +memset (&old_downspread,0 ,sizeof (old_downspread)); +core_link_read_dpcd (link,DP_DOWNSPREAD_CTRL , &old_downspread.raw,sizeof (old_downspread));
Greg Kroah-Hartman
maintainerPATCH 693/846 drm/nouveau/kms/nv04: use vzalloc for nv04_display
In reply to Greg Kroah-HartmanFrom: Ilia Mirkin <[email protected]>
commit bd6e07e72f37f34535bec7eebc807e5fcfe37b43 upstream.
The struct is giant, and triggers an order-7 allocation (512K). There is no reason for this to be kmalloc-type memory, so switch to vmalloc. This should help loading nouveau on low-memory and/or long-running systems.
--- drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/disp.c +2 -2
@@ -205,7 +205,7 @@ nv04_display_destroy(struct drm_device *nvif_notify_dtor (&disp->flip);nouveau_display (dev)->priv =NULL ; -kfree (disp); +vfree (disp);nvif_object_unmap (&drm->client.device.object); }
@@ -223,7 +223,7 @@ nv04_display_create(struct drm_device *dstruct nv04_display *disp;int i, ret; - disp =kzalloc (sizeof (*disp),GFP_KERNEL ); + disp =vzalloc (sizeof (*disp));if (!disp)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 694/846 drm/bridge: analogix_dp: Make PSR-exit block less
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
commit c4c6ef229593366ab593d4d424addc7025b54a76 upstream.
Prior to commit 6c836d965bad ("drm/rockchip: Use the helpers for PSR"), "PSR exit" used non-blocking analogix_dp_send_psr_spd(). The refactor started using the blocking variant, for a variety of reasons -- quoting Sean Paul's potentially-faulty memory:
"""
- To avoid racing a subsequent PSR entry (if exit takes a long time)
- To avoid racing disable/modeset
- We're not displaying new content while exiting PSR anyways, so there is minimal utility in allowing frames to be submitted
- We're lying to userspace telling them frames are on the screen when we're just dropping them on the floor
"""
However, I'm finding that this blocking transition is causing upwards of 60+ ms of unneeded latency on PSR-exit, to the point that initial cursor movements when leaving PSR are unbearably jumpy.
It turns out that we need to meet in the middle somewhere: Sean is right that we were "lying to userspace" with a non-blocking PSR-exit, but the new blocking behavior is also waiting too long:
According to the eDP specification, the sink device must support PSR entry transitions from both state 4 (ACTIVE_RESYNC) and state 0 (INACTIVE). It also states that in ACTIVE_RESYNC, "the Sink device must display the incoming active frames from the Source device with no visible glitches and/or artifacts."
Thus, for our purposes, we only need to wait for ACTIVE_RESYNC before moving on; we are ready to display video, and subsequent PSR-entry is safe.
Tested on a Samsung Chromebook Plus (i.e., Rockchip RK3399 Gru Kevin), where this saves about 60ms of latency, for PSR-exit that used to take about 80ms.
--- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +12 -2
@@ -998,11 +998,21 @@ int analogix_dp_send_psr_spd(struct analif (!blocking)return 0 ; +/* +* db[1]!=0: entering PSR, wait for fully active remote frame buffer. +* db[1]==0: exiting PSR, wait for either +* (a) ACTIVE_RESYNC - the sink "must display the +* incoming active frames from the Source device with no visible +* glitches and/or artifacts", even though timings may still be +* re-synchronizing; or +* (b) INACTIVE - the transition is fully complete. +*/ ret =readx_poll_timeout (analogix_dp_get_psr_status, dp, psr_status, psr_status >=0 && ((vsc->db[1 ] && psr_status ==DP_PSR_SINK_ACTIVE_RFB ) || - (!vsc->db[1 ] && psr_status ==DP_PSR_SINK_INACTIVE )),1500 , -DP_TIMEOUT_PSR_LOOP_MS *1000 ); + (!vsc->db[1 ] && (psr_status ==DP_PSR_SINK_ACTIVE_RESYNC || + psr_status ==DP_PSR_SINK_INACTIVE ))), +1500 ,DP_TIMEOUT_PSR_LOOP_MS *1000 );if (ret) {dev_warn (dp->dev,"Failed to apply PSR %d\n" , ret);return ret;
Greg Kroah-Hartman
maintainerPATCH 695/846 parisc: Fix lpa and lpa_user defines
In reply to Greg Kroah-HartmanFrom: John David Anglin <[email protected]>
commit db19c6f1a2a353cc8dec35b4789733a3cf6e2838 upstream.
While working on the rewrite to the light-weight syscall and futex code, I experimented with using a hash index based on the user physical address of atomic variable. This exposed two problems with the lpa and lpa_user defines.
Because of the copy instruction, the pa argument needs to be an early clobber argument. This prevents gcc from allocating the va and pa arguments to the same register.
Secondly, the lpa instruction can cause a page fault so we need to catch exceptions.
--- arch/parisc/include/asm/special_insns.h | 44 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-)
arch/parisc/include/asm/special_insns.h +24 -20
@@ -2,28 +2,32 @@#ifndef __PARISC_SPECIAL_INSNS_H#define __PARISC_SPECIAL_INSNS_H -#define lpa (va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%1),%0" \ - : "=r" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa (va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ }) -#define lpa_user (va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%%sr3,%1),%0" \ - : "=r" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa_user (va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%%sr3,%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ })#define mfctl (reg) ({ \
Greg Kroah-Hartman
maintainerPATCH 696/846 powerpc/64s/radix: Fix huge vmap false positive
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
commit 467ba14e1660b52a2f9338b484704c461bd23019 upstream.
pmd_huge() is defined to false when HUGETLB_PAGE is not configured, but the vmap code still installs huge PMDs. This leads to false bad PMD errors when vunmapping because it is not seen as a huge PTE, and the bad PMD check catches it. The end result may not be much more serious than some bad pmd warning messages, because the pmd_none_or_clear_bad() does what we wanted and clears the huge PTE anyway.
Fix this by checking pmd_is_leaf(), which checks for a PTE regardless of config options. The whole huge/large/leaf stuff is a tangled mess but that's kernel-wide and not something we can improve much in arch/powerpc code.
pmd_page(), pud_page(), etc., called by vmalloc_to_page() on huge vmaps can similarly trigger a false VM_BUG_ON when CONFIG_HUGETLB_PAGE=n, so those checks are adjusted. The checks were added by commit d6eacedd1f0e ("powerpc/book3s: Use config independent helpers for page table walk"), while implementing a similar fix for other page table walking functions.
--- arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++-- arch/powerpc/mm/pgtable_64.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-)
arch/powerpc/mm/book3s64/radix_pgtable.c +2 -2
@@ -1093,7 +1093,7 @@ int pud_set_huge(pud_t *pud, phys_addr_tint pud_clear_huge (pud_t *pud) { -if (pud_huge (*pud)) { +if (pud_is_leaf (*pud)) {pud_clear (pud);return 1 ; }
@@ -1140,7 +1140,7 @@ int pmd_set_huge(pmd_t *pmd, phys_addr_tint pmd_clear_huge (pmd_t *pmd) { -if (pmd_huge (*pmd)) { +if (pmd_is_leaf (*pmd)) {pmd_clear (pmd);return 1 ; }
arch/powerpc/mm/pgtable_64.c +11 -3
@@ -102,7 +102,8 @@ EXPORT_SYMBOL(__pte_frag_size_shift);struct page *p4d_page (p4d_t p4d) {if (p4d_is_leaf (p4d)) { -VM_WARN_ON (!p4d_huge (p4d)); +if (!IS_ENABLED (CONFIG_HAVE_ARCH_HUGE_VMAP )) +VM_WARN_ON (!p4d_huge (p4d));return pte_page (p4d_pte (p4d)); }return virt_to_page (p4d_pgtable (p4d));
@@ -112,7 +113,8 @@ struct page *p4d_page(p4d_t p4d)struct page *pud_page (pud_t pud) {if (pud_is_leaf (pud)) { -VM_WARN_ON (!pud_huge (pud)); +if (!IS_ENABLED (CONFIG_HAVE_ARCH_HUGE_VMAP )) +VM_WARN_ON (!pud_huge (pud));return pte_page (pud_pte (pud)); }return virt_to_page (pud_pgtable (pud));
@@ -125,7 +127,13 @@ struct page *pud_page(pud_t pud)struct page *pmd_page (pmd_t pmd) {if (pmd_is_leaf (pmd)) { -VM_WARN_ON (!(pmd_large (pmd) ||pmd_huge (pmd))); +/* +* vmalloc_to_page may be called on any vmap address (not only +* vmalloc), and it uses pmd_page() etc., when huge vmap is +* enabled so these checks can't be used. +*/ +if (!IS_ENABLED (CONFIG_HAVE_ARCH_HUGE_VMAP )) +VM_WARN_ON (!(pmd_large (pmd) ||pmd_huge (pmd)));return pte_page (pmd_pte (pmd)); }return virt_to_page (pmd_page_vaddr (pmd));
Greg Kroah-Hartman
maintainerPATCH 697/846 scsi: lpfc: Fix lpfc_force_rscn ndlp kref imbalance
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit 7576d48c64f36f6fea9df2882f710a474fa35f40 upstream.
Issuing lpfc_force_rscn twice results in an ndlp kref use-after-free call trace.
A prior patch reworked the get/put handling by ensuring nlp_get was done before WQE submission and a put was done in the completion path. Unfortunately, the issue_els_rscn path had a piece of legacy code that did a nlp_put, causing an imbalance on the ref counts.
Fixed by removing the unnecessary legacy code snippet.
--- drivers/scsi/lpfc/lpfc_els.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +0 -5
@@ -3531,11 +3531,6 @@ lpfc_issue_els_rscn(struct lpfc_vport *vreturn 1 ; } -/* This will cause the callback-function lpfc_cmpl_els_cmd to -* trigger the release of node. -*/ -if (!(vport->fc_flag &FC_PT2PT )) -lpfc_nlp_put (ndlp);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 698/846 drm/amdgpu: dont do resets on APUs which dont support it
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit e8309d50e97851ff135c4e33325d37b032666b94 upstream.
It can cause a hang. This is normally not enabled for GPU hangs on these asics, but was recently enabled for handling aborted suspends. This causes hangs on some platforms on suspend.
--- drivers/gpu/drm/amd/amdgpu/cik.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/vi.c | 4 ++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/cik.c +4 -0
@@ -1428,6 +1428,10 @@ static int cik_asic_reset(struct amdgpu_ {int r; +/* APUs don't have full asic reset */ +if (adev->flags &AMD_IS_APU ) +return 0 ; +if (cik_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) {dev_info (adev->dev,"BACO reset\n" ); r =amdgpu_dpm_baco_reset (adev);
drivers/gpu/drm/amd/amdgpu/vi.c +4 -0
@@ -956,6 +956,10 @@ static int vi_asic_reset(struct amdgpu_d {int r; +/* APUs don't have full asic reset */ +if (adev->flags &AMD_IS_APU ) +return 0 ; +if (vi_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) {dev_info (adev->dev,"BACO reset\n" ); r =amdgpu_dpm_baco_reset (adev);
Greg Kroah-Hartman
maintainerPATCH 699/846 drm/i915/display/ehl: Update voltage swing table
In reply to Greg Kroah-HartmanFrom: José Roberto de Souza <[email protected]>
commit ef3ac01564067a4337bb798b8eddc6ea7b78fd10 upstream.
EHL table was recently updated with some minor fixes.
BSpec: 21257
--- drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +5 -5
@@ -476,14 +476,14 @@ static const struct intel_ddi_buf_transstatic const union intel_ddi_buf_trans_entry _ehl_combo_phy_ddi_translations_dp[] = {/* NT mV Trans mV db */ { .icl = {0xA ,0x33 ,0x3F ,0x00 ,0x00 } },/* 350 350 0.0 */ - { .icl = {0xA ,0x47 ,0x36 ,0x00 ,0x09 } },/* 350 500 3.1 */ - { .icl = {0xC ,0x64 ,0x34 ,0x00 ,0x0B } },/* 350 700 6.0 */ - { .icl = {0x6 ,0x7F ,0x30 ,0x00 ,0x0F } },/* 350 900 8.2 */ + { .icl = {0xA ,0x47 ,0x38 ,0x00 ,0x07 } },/* 350 500 3.1 */ + { .icl = {0xC ,0x64 ,0x33 ,0x00 ,0x0C } },/* 350 700 6.0 */ + { .icl = {0x6 ,0x7F ,0x2F ,0x00 ,0x10 } },/* 350 900 8.2 */ { .icl = {0xA ,0x46 ,0x3F ,0x00 ,0x00 } },/* 500 500 0.0 */ - { .icl = {0xC ,0x64 ,0x38 ,0x00 ,0x07 } },/* 500 700 2.9 */ + { .icl = {0xC ,0x64 ,0x37 ,0x00 ,0x08 } },/* 500 700 2.9 */ { .icl = {0x6 ,0x7F ,0x32 ,0x00 ,0x0D } },/* 500 900 5.1 */ { .icl = {0xC ,0x61 ,0x3F ,0x00 ,0x00 } },/* 650 700 0.6 */ - { .icl = {0x6 ,0x7F ,0x38 ,0x00 ,0x07 } },/* 600 900 3.5 */ + { .icl = {0x6 ,0x7F ,0x37 ,0x00 ,0x08 } },/* 600 900 3.5 */ { .icl = {0x6 ,0x7F ,0x3F ,0x00 ,0x00 } },/* 900 900 0.0 */ };
Greg Kroah-Hartman
maintainerPATCH 700/846 PCI: xgene: Fix IB window setup
In reply to Greg Kroah-HartmanFrom: Rob Herring <[email protected]>
commit c7a75d07827a1f33d566e18e6098379cc2a0c2b2 upstream.
Commit 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup") broke PCI support on XGene. The cause is the IB resources are now sorted in address order instead of being in DT dma-ranges order. The result is which inbound registers are used for each region are swapped. I don't know the details about this h/w, but it appears that IB region 0 registers can't handle a size greater than 4GB. In any case, limiting the size for region 0 is enough to get back to the original assignment of dma-ranges to regions.
--- drivers/pci/controller/pci-xgene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-xgene.c +1 -1
@@ -466,7 +466,7 @@ static int xgene_pcie_select_ib_reg(u8 *return 1 ; } -if ((size >SZ_1K ) && (size <SZ_1T ) && !(*ib_reg_mask & (1 <<0 ))) { +if ((size >SZ_1K ) && (size <SZ_4G ) && !(*ib_reg_mask & (1 <<0 ))) { *ib_reg_mask |= (1 <<0 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 701/846 PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 085a9f43433f30cbe8a1ade62d9d7827c3217f4d upstream.
Use down_read_nested() and down_write_nested() when taking the ctrl->reset_lock rw-sem, passing the number of PCIe hotplug controllers in the path to the PCI root bus as lock subclass parameter.
This fixes the following false-positive lockdep report when unplugging a Lenovo X1C8 from a Lenovo 2nd gen TB3 dock:
pcieport 0000:06:01.0: pciehp: Slot(1): Link Down
pcieport 0000:06:01.0: pciehp: Slot(1): Card not present
============================================
WARNING: possible recursive locking detected
5.16.0-rc2+ #621 Not tainted
--------------------------------------------
irq/124-pciehp/86 is trying to acquire lock:
ffff8e5ac4299ef8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_check_presence+0x23/0x80
but task is already holding lock:
ffff8e5ac4298af8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_ist+0xf3/0x180
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&ctrl->reset_lock);
lock(&ctrl->reset_lock);*** DEADLOCK ***
May be due to missing lock nesting notation
3 locks held by irq/124-pciehp/86:
#0: ffff8e5ac4298af8 (&ctrl->reset_lock){.+.+}-{3:3}, at: pciehp_ist+0xf3/0x180 #1: ffffffffa3b024e8 (pci_rescan_remove_lock){+.+.}-{3:3}, at: pciehp_unconfigure_device+0x31/0x110 #2: ffff8e5ac1ee2248 (&dev->mutex){....}-{3:3}, at: device_release_driver+0x1c/0x40
stack backtrace: CPU: 4 PID: 86 Comm: irq/124-pciehp Not tainted 5.16.0-rc2+ #621 Hardware name: LENOVO 20U90SIT19/20U90SIT19, BIOS N2WET30W (1.20 ) 08/26/2021 Call Trace: <TASK> dump_stack_lvl+0x59/0x73 __lock_acquire.cold+0xc5/0x2c6 lock_acquire+0xb5/0x2b0 down_read+0x3e/0x50 pciehp_check_presence+0x23/0x80 pciehp_runtime_resume+0x5c/0xa0 device_for_each_child+0x45/0x70 pcie_port_device_runtime_resume+0x20/0x30 pci_pm_runtime_resume+0xa7/0xc0 __rpm_callback+0x41/0x110 rpm_callback+0x59/0x70 rpm_resume+0x512/0x7b0 __pm_runtime_resume+0x4a/0x90 __device_release_driver+0x28/0x240 device_release_driver+0x26/0x40 pci_stop_bus_device+0x68/0x90 pci_stop_bus_device+0x2c/0x90 pci_stop_and_remove_bus_device+0xe/0x20 pciehp_unconfigure_device+0x6c/0x110 pciehp_disable_slot+0x5b/0xe0 pciehp_handle_presence_or_link_change+0xc3/0x2f0 pciehp_ist+0x179/0x180
This lockdep warning is triggered because with Thunderbolt, hotplug ports are nested. When removing multiple devices in a daisy-chain, each hotplug port's reset_lock may be acquired recursively. It's never the same lock, so the lockdep splat is a false positive.
Because locks at the same hierarchy level are never acquired recursively, a per-level lockdep class is sufficient to fix the lockdep warning.
The choice to use one lockdep subclass per pcie-hotplug controller in the path to the root-bus was made to conserve class keys because their number is limited and the complexity grows quadratically with number of keys according to Documentation/locking/lockdep-design.rst.
--- drivers/pci/hotplug/pciehp.h | 3 +++ drivers/pci/hotplug/pciehp_core.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 21 ++++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-)
drivers/pci/hotplug/pciehp.h +3 -0
@@ -75,6 +75,8 @@ extern int pciehp_poll_time;* @reset_lock: prevents access to the Data Link Layer Link Active bit in the * Link Status register and to the Presence Detect State bit in the Slot * Status register during a slot reset which may cause them to flap +* @depth: Number of additional hotplug ports in the path to the root bus, +* used as lock subclass for @reset_lock * @ist_running: flag to keep user request waiting while IRQ thread is running * @request_result: result of last user request submitted to the IRQ thread * @requester: wait queue to wake up on completion of user request,
@@ -106,6 +108,7 @@ struct controller {struct hotplug_slot hotplug_slot;/* hotplug core interface */ struct rw_semaphore reset_lock; +unsigned int depth;unsigned int ist_running;int request_result;wait_queue_head_t requester;
drivers/pci/hotplug/pciehp_core.c +1 -1
@@ -166,7 +166,7 @@ static void pciehp_check_presence(struct {int occupied; -down_read (&ctrl->reset_lock); +down_read_nested (&ctrl->reset_lock, ctrl->depth);mutex_lock (&ctrl->state_lock); occupied =pciehp_card_present_or_link_active (ctrl);
drivers/pci/hotplug/pciehp_hpc.c +18 -3
@@ -583,7 +583,7 @@ static void pciehp_ignore_dpc_link_chang* the corresponding link change may have been ignored above. * Synthesize it to ensure that it is acted on. */ -down_read (&ctrl->reset_lock); +down_read_nested (&ctrl->reset_lock, ctrl->depth);if (!pciehp_check_link_active (ctrl))pciehp_request (ctrl,PCI_EXP_SLTSTA_DLLSC );up_read (&ctrl->reset_lock);
@@ -746,7 +746,7 @@ static irqreturn_t pciehp_ist(int irq, v* Disable requests have higher priority than Presence Detect Changed * or Data Link Layer State Changed events. */ -down_read (&ctrl->reset_lock); +down_read_nested (&ctrl->reset_lock, ctrl->depth);if (events &DISABLE_SLOT )pciehp_handle_disable_request (ctrl);else if (events & (PCI_EXP_SLTSTA_PDC |PCI_EXP_SLTSTA_DLLSC ))
@@ -880,7 +880,7 @@ int pciehp_reset_slot(struct hotplug_sloif (probe)return 0 ; -down_write (&ctrl->reset_lock); +down_write_nested (&ctrl->reset_lock, ctrl->depth);if (!ATTN_BUTTN (ctrl)) { ctrl_mask |=PCI_EXP_SLTCTL_PDCE ;
@@ -936,6 +936,20 @@ static inline void dbg_ctrl(struct contr#define FLAG (x, y) (((x) & (y)) ? '+' : '-') +static inline int pcie_hotplug_depth (struct pci_dev *dev) +{ +struct pci_bus *bus = dev->bus; +int depth =0 ; + +while (bus->parent) { + bus = bus->parent; +if (bus->self && bus->self->is_hotplug_bridge) + depth++; + } + +return depth; +} +struct controller *pcie_init (struct pcie_device *dev) {struct controller *ctrl;
@@ -949,6 +963,7 @@ struct controller *pcie_init(struct pciereturn NULL ; ctrl->pcie = dev; + ctrl->depth =pcie_hotplug_depth (dev->port);pcie_capability_read_dword (pdev,PCI_EXP_SLTCAP , &slot_cap);if (pdev->hotplug_user_indicators)
Greg Kroah-Hartman
maintainerPATCH 702/846 PCI: pciehp: Fix infinite loop in IRQ handler upon power fault
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 23584c1ed3e15a6f4bfab8dc5a88d94ab929ee12 upstream.
The Power Fault Detected bit in the Slot Status register differs from all other hotplug events in that it is sticky: It can only be cleared after turning off slot power. Per PCIe r5.0, sec. 6.7.1.8:
If a power controller detects a main power fault on the hot-plug slot, it must automatically set its internal main power fault latch [...]. The main power fault latch is cleared when software turns off power to the hot-plug slot.
The stickiness used to cause interrupt storms and infinite loops which were fixed in 2009 by commits 5651c48cfafe ("PCI pciehp: fix power fault interrupt storm problem") and 99f0169c17f3 ("PCI: pciehp: enable software notification on empty slots").
Unfortunately in 2020 the infinite loop issue was inadvertently reintroduced by commit 8edf5332c393 ("PCI: pciehp: Fix MSI interrupt race"): The hardirq handler pciehp_isr() clears the PFD bit until pciehp's power_fault_detected flag is set. That happens in the IRQ thread pciehp_ist(), which never learns of the event because the hardirq handler is stuck in an infinite loop. Fix by setting the power_fault_detected flag already in the hardirq handler.
--- drivers/pci/hotplug/pciehp_hpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/hotplug/pciehp_hpc.c +4 -3
@@ -642,6 +642,8 @@ read_status:*/ if (ctrl->power_fault_detected) status &= ~PCI_EXP_SLTSTA_PFD ; +else if (status &PCI_EXP_SLTSTA_PFD ) + ctrl->power_fault_detected = true; events |= status;if (!events) {
@@ -651,7 +653,7 @@ read_status: }if (status) { -pcie_capability_write_word (pdev,PCI_EXP_SLTSTA , events); +pcie_capability_write_word (pdev,PCI_EXP_SLTSTA , status);/* * In MSI mode, all event bits must be zero before the port
@@ -725,8 +727,7 @@ static irqreturn_t pciehp_ist(int irq, v }/* Check Power Fault Detected */ -if ((events &PCI_EXP_SLTSTA_PFD ) && !ctrl->power_fault_detected) { - ctrl->power_fault_detected =1 ; +if (events &PCI_EXP_SLTSTA_PFD ) {ctrl_err (ctrl,"Slot(%s): Power fault\n" ,slot_name (ctrl));pciehp_set_indicators (ctrl,PCI_EXP_SLTCTL_PWR_IND_OFF ,PCI_EXP_SLTCTL_ATTN_IND_ON );
Greg Kroah-Hartman
maintainerPATCH 703/846 PCI: pci-bridge-emul: Make expansion ROM Base Address register read-only
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 1c1a3b4d3e86b997a313ffb297c1129540882859 upstream.
If expansion ROM is unsupported (which is the case of pci-bridge-emul.c driver) then ROM Base Address register must be implemented as read-only register that return 0 when read, same as for unused Base Address registers.
--- drivers/pci/pci-bridge-emul.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pci/pci-bridge-emul.c +6 -1
@@ -139,8 +139,13 @@ struct pci_bridge_reg_behavior pci_regs_ .ro = GENMASK(7, 0), }, +/* +* If expansion ROM is unsupported then ROM Base Address register must +* be implemented as read-only register that return 0 when read, same +* as for unused Base Address registers. +*/ [PCI_ROM_ADDRESS1 / 4] = { - .rw = GENMASK(31, 11) | BIT(0), + .ro = ~0, },/*
Greg Kroah-Hartman
maintainerPATCH 704/846 PCI: pci-bridge-emul: Properly mark reserved PCIe bits in PCI config space
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 7b067ac63a5730d2fae18399fed7e45f23d36912 upstream.
Some bits in PCI config space are reserved when device is PCIe. Properly define behavior of PCI registers for PCIe emulated bridge and ensure that it would not be possible change these reserved bits.
--- drivers/pci/pci-bridge-emul.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/pci/pci-bridge-emul.c +21 -0
@@ -295,6 +295,27 @@ int pci_bridge_emul_init(struct pci_bridkfree (bridge->pci_regs_behavior);return -ENOMEM ; } +/* These bits are applicable only for PCI and reserved on PCIe */ + bridge->pci_regs_behavior[PCI_CACHE_LINE_SIZE /4 ].ro &= + ~GENMASK (15 ,8 ); + bridge->pci_regs_behavior[PCI_COMMAND /4 ].ro &= + ~((PCI_COMMAND_SPECIAL |PCI_COMMAND_INVALIDATE | +PCI_COMMAND_VGA_PALETTE |PCI_COMMAND_WAIT | +PCI_COMMAND_FAST_BACK ) | + (PCI_STATUS_66MHZ |PCI_STATUS_FAST_BACK | +PCI_STATUS_DEVSEL_MASK ) <<16 ); + bridge->pci_regs_behavior[PCI_PRIMARY_BUS /4 ].ro &= + ~GENMASK (31 ,24 ); + bridge->pci_regs_behavior[PCI_IO_BASE /4 ].ro &= + ~((PCI_STATUS_66MHZ |PCI_STATUS_FAST_BACK | +PCI_STATUS_DEVSEL_MASK ) <<16 ); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE /4 ].rw &= + ~((PCI_BRIDGE_CTL_MASTER_ABORT | +BIT (8 ) |BIT (9 ) |BIT (11 )) <<16 ); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE /4 ].ro &= + ~((PCI_BRIDGE_CTL_FAST_BACK ) <<16 ); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE /4 ].w1c &= + ~(BIT (10 ) <<16 ); }if (flags &PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR ) {
Greg Kroah-Hartman
maintainerPATCH 705/846 PCI: pci-bridge-emul: Fix definitions of reserved bits
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 12998087d9f48b66965b97412069c7826502cd7e upstream.
Some bits in PCI_EXP registers are reserved for non-root ports. Driver pci-bridge-emul.c implements PCIe Root Port device therefore it should not allow setting reserved bits of registers.
Properly define non-reserved bits for all PCI_EXP registers.
--- drivers/pci/pci-bridge-emul.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-)
drivers/pci/pci-bridge-emul.c +25 -11
@@ -176,41 +176,55 @@ struct pci_bridge_reg_behavior pcie_cap_ [PCI_CAP_LIST_ID / 4] = {/* * Capability ID, Next Capability Pointer and -* Capabilities register are all read-only. +* bits [14:0] of Capabilities register are all read-only. +* Bit 15 of Capabilities register is reserved. */ - .ro = ~0, + .ro = GENMASK(30, 0), }, [PCI_EXP_DEVCAP / 4] = { - .ro = ~0, +/* +* Bits [31:29] and [17:16] are reserved. +* Bits [27:18] are reserved for non-upstream ports. +* Bits 28 and [14:6] are reserved for non-endpoint devices. +* Other bits are read-only. +*/ + .ro = BIT(15) | GENMASK(5, 0), }, [PCI_EXP_DEVCTL / 4] = { -/* Device control register is RW */ - .rw = GENMASK(15, 0), +/* +* Device control register is RW, except bit 15 which is +* reserved for non-endpoints or non-PCIe-to-PCI/X bridges. +*/ + .rw = GENMASK(14, 0),/* * Device status register has bits 6 and [3:0] W1C, [5:4] RO, -* the rest is reserved +* the rest is reserved. Also bit 6 is reserved for non-upstream +* ports. */ - .w1c = (BIT(6) | GENMASK(3, 0)) << 16, + .w1c = GENMASK(3, 0) << 16, .ro = GENMASK(5, 4) << 16, }, [PCI_EXP_LNKCAP / 4] = { -/* All bits are RO, except bit 23 which is reserved */ - .ro = lower_32_bits(~BIT(23)), +/* +* All bits are RO, except bit 23 which is reserved and +* bit 18 which is reserved for non-upstream ports. +*/ + .ro = lower_32_bits(~(BIT(23) | PCI_EXP_LNKCAP_CLKPM)), }, [PCI_EXP_LNKCTL / 4] = {/* * Link control has bits [15:14], [11:3] and [1:0] RW, the -* rest is reserved. +* rest is reserved. Bit 8 is reserved for non-upstream ports. * * Link status has bits [13:0] RO, and bits [15:14] * W1C. */ - .rw = GENMASK(15, 14) | GENMASK(11, 3) | GENMASK(1, 0), + .rw = GENMASK(15, 14) | GENMASK(11, 9) | GENMASK(7, 3) | GENMASK(1, 0), .ro = GENMASK(13, 0) << 16, .w1c = GENMASK(15, 14) << 16, },
Greg Kroah-Hartman
maintainerPATCH 706/846 PCI: pci-bridge-emul: Correctly set PCIe capabilities
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 1f1050c5e1fefb34ac90a506b43e9da803b5f8f7 upstream.
Older mvebu hardware provides PCIe Capability structure only in version 1. New mvebu and aardvark hardware provides it in version 2. So do not force version to 2 in pci_bridge_emul_init() and rather allow drivers to set correct version. Drivers need to set version in pcie_conf.cap field without overwriting PCI_CAP_LIST_ID register. Both drivers (mvebu and aardvark) do not provide slot support yet, so do not set PCI_EXP_FLAGS_SLOT flag.
--- drivers/pci/controller/pci-aardvark.c | 4 +++- drivers/pci/controller/pci-mvebu.c | 8 ++++++++ drivers/pci/pci-bridge-emul.c | 5 +---- 3 files changed, 12 insertions(+), 5 deletions(-)
drivers/pci/controller/pci-aardvark.c +3 -1
@@ -872,7 +872,6 @@ advk_pci_bridge_emul_pcie_conf_read(strureturn PCI_BRIDGE_EMUL_HANDLED ; } -case PCI_CAP_LIST_ID :case PCI_EXP_DEVCAP :case PCI_EXP_DEVCTL : *value =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg);
@@ -953,6 +952,9 @@ static int advk_sw_pci_bridge_init(struc/* Support interrupt A for MSI feature */ bridge->conf.intpin =PCIE_CORE_INT_A_ASSERT_ENABLE ; +/* Aardvark HW provides PCIe Capability structure in version 2 */ + bridge->pcie_conf.cap =cpu_to_le16 (2 ); +/* Indicates supports for Completion Retry Status */ bridge->pcie_conf.rootcap =cpu_to_le16 (PCI_EXP_RTCAP_CRSVIS );
drivers/pci/controller/pci-mvebu.c +8 -0
@@ -573,6 +573,8 @@ static struct pci_bridge_emul_ops mvebu_static void mvebu_pci_bridge_emul_init (struct mvebu_pcie_port *port) {struct pci_bridge_emul *bridge = &port->bridge; +u32 pcie_cap =mvebu_readl (port,PCIE_CAP_PCIEXP ); +u8 pcie_cap_ver = ((pcie_cap >>16 ) &PCI_EXP_FLAGS_VERS ); bridge->conf.vendor =PCI_VENDOR_ID_MARVELL ; bridge->conf.device =mvebu_readl (port,PCIE_DEV_ID_OFF ) >>16 ;
@@ -585,6 +587,12 @@ static void mvebu_pci_bridge_emul_init(s bridge->conf.iolimit =PCI_IO_RANGE_TYPE_32 ; } +/* +* Older mvebu hardware provides PCIe Capability structure only in +* version 1. New hardware provides it in version 2. +*/ + bridge->pcie_conf.cap =cpu_to_le16 (pcie_cap_ver); + bridge->has_pcie = true; bridge->data = port; bridge->ops = &mvebu_pci_bridge_emul_ops;
drivers/pci/pci-bridge-emul.c +1 -4
@@ -297,10 +297,7 @@ int pci_bridge_emul_init(struct pci_bridif (bridge->has_pcie) { bridge->conf.capabilities_pointer =PCI_CAP_PCIE_START ; bridge->pcie_conf.cap_id =PCI_CAP_ID_EXP ; -/* Set PCIe v2, root port, slot support */ - bridge->pcie_conf.cap = -cpu_to_le16 (PCI_EXP_TYPE_ROOT_PORT <<4 |2 | -PCI_EXP_FLAGS_SLOT ); + bridge->pcie_conf.cap |=cpu_to_le16 (PCI_EXP_TYPE_ROOT_PORT <<4 ); bridge->pcie_cap_regs_behavior = kmemdup(pcie_cap_regs_behavior, sizeof(pcie_cap_regs_behavior),
Greg Kroah-Hartman
maintainerPATCH 707/846 PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 3be9d243b21724d49b65043d4520d688b6040b36 upstream.
Since all PCI Express device Functions are required to implement the PCI Express Capability structure, Capabilities List bit in PCI Status Register must be hardwired to 1b. Capabilities Pointer register (which is already set by pci-bride-emul.c driver) is valid only when Capabilities List is set to 1b.
--- drivers/pci/pci-bridge-emul.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/pci-bridge-emul.c +1 -0
@@ -296,6 +296,7 @@ int pci_bridge_emul_init(struct pci_bridif (bridge->has_pcie) { bridge->conf.capabilities_pointer =PCI_CAP_PCIE_START ; + bridge->conf.status |=cpu_to_le16 (PCI_STATUS_CAP_LIST ); bridge->pcie_conf.cap_id =PCI_CAP_ID_EXP ; bridge->pcie_conf.cap |=cpu_to_le16 (PCI_EXP_TYPE_ROOT_PORT <<4 ); bridge->pcie_cap_regs_behavior =
Greg Kroah-Hartman
maintainerPATCH 708/846 xfrm: fix policy lookup for ipv6 gre packets
In reply to Greg Kroah-HartmanFrom: Ghalem Boudour <[email protected]>
commit bcf141b2eb551b3477b24997ebc09c65f117a803 upstream.
On egress side, xfrm lookup is called from __gre6_xmit() with the fl6_gre_key field not initialized leading to policies selectors check failure. Consequently, gre packets are sent without encryption.
On ingress side, INET6_PROTO_NOPOLICY was set, thus packets were not checked against xfrm policies. Like for egress side, fl6_gre_key should be correctly set, this is now done in decode_session6().
--- net/ipv6/ip6_gre.c | 5 ++++- net/xfrm/xfrm_policy.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-)
net/ipv6/ip6_gre.c +4 -1
@@ -755,6 +755,7 @@ static netdev_tx_t __gre6_xmit(struct sk fl6->daddr = key->u.ipv6.dst; fl6->flowlabel = key->label; fl6->flowi6_uid =sock_net_uid (dev_net (dev),NULL ); + fl6->fl6_gre_key =tunnel_id_to_key32 (key->tun_id); dsfield = key->tos; flags = key->tun_flags &
@@ -990,6 +991,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit fl6.daddr = key->u.ipv6.dst; fl6.flowlabel = key->label; fl6.flowi6_uid =sock_net_uid (dev_net (dev),NULL ); + fl6.fl6_gre_key =tunnel_id_to_key32 (key->tun_id); dsfield = key->tos;if (!(tun_info->key.tun_flags &TUNNEL_ERSPAN_OPT ))
@@ -1098,6 +1100,7 @@ static void ip6gre_tnl_link_config_commo fl6->flowi6_oif = p->link; fl6->flowlabel =0 ; fl6->flowi6_proto =IPPROTO_GRE ; + fl6->fl6_gre_key = t->parms.o_key;if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS )) fl6->flowlabel |=IPV6_TCLASS_MASK & p->flowinfo;
@@ -1544,7 +1547,7 @@ static void ip6gre_fb_tunnel_init(structstatic struct inet6_protocol ip6gre_protocol__read_mostly = { .handler = gre_rcv, .err_handler = ip6gre_err, - .flags =INET6_PROTO_NOPOLICY |INET6_PROTO_FINAL , + .flags =INET6_PROTO_FINAL , };static void ip6gre_destroy_tunnels (struct net *net,struct list_head *head)
net/xfrm/xfrm_policy.c +21 -0
@@ -33,6 +33,7 @@#include <net/flow.h> #include <net/xfrm.h> #include <net/ip.h> +#include <net/gre.h> #if IS_ENABLED (CONFIG_IPV6_MIP6 )#include <net/mip6.h> #endif
@@ -3424,6 +3425,26 @@ decode_session6(struct sk_buff *skb, str } fl6->flowi6_proto = nexthdr;return ; +case IPPROTO_GRE : +if (!onlyproto && + (nh + offset +12 < skb->data || +pskb_may_pull (skb, nh + offset +12 - skb->data))) { +struct gre_base_hdr *gre_hdr; +__be32 *gre_key; + + nh =skb_network_header (skb); + gre_hdr = (struct gre_base_hdr *)(nh + offset); + gre_key = (__be32 *)(gre_hdr +1 ); + +if (gre_hdr->flags &GRE_KEY ) { +if (gre_hdr->flags &GRE_CSUM ) + gre_key++; + fl6->fl6_gre_key = *gre_key; + } + } + fl6->flowi6_proto = nexthdr; +return ; +#if IS_ENABLED (CONFIG_IPV6_MIP6 )case IPPROTO_MH : offset +=ipv6_optlen (exthdr);
Greg Kroah-Hartman
maintainerPATCH 709/846 xfrm: fix dflt policy check when there is no policy configured
In reply to Greg Kroah-HartmanFrom: Nicolas Dichtel <[email protected]>
commit ec3bb890817e4398f2d46e12e2e205495b116be9 upstream.
When there is no policy configured on the system, the default policy is checked in xfrm_route_forward. However, it was done with the wrong direction (XFRM_POLICY_FWD instead of XFRM_POLICY_OUT).
The default policy for XFRM_POLICY_FWD was checked just before, with a call to xfrm[46]_policy_check().
--- include/net/xfrm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/xfrm.h +1 -1
@@ -1167,7 +1167,7 @@ static inline int xfrm_route_forward(str {struct net *net =dev_net (skb->dev); -if (xfrm_default_allow (net,XFRM_POLICY_FWD )) +if (xfrm_default_allow (net,XFRM_POLICY_OUT ))return !net->xfrm.policy_count[XFRM_POLICY_OUT ] || (skb_dst (skb)->flags &DST_NOXFRM ) ||__xfrm_route_forward (skb, family);
Greg Kroah-Hartman
maintainerPATCH 710/846 btrfs: fix deadlock between quota enable and other quota operations
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 232796df8c1437c41d308d161007f0715bac0a54 upstream.
When enabling quotas, we attempt to commit a transaction while holding the mutex fs_info->qgroup_ioctl_lock. This can result on a deadlock with other quota operations such as:
- qgroup creation and deletion, ioctl BTRFS_IOC_QGROUP_CREATE;
- adding and removing qgroup relations, ioctl BTRFS_IOC_QGROUP_ASSIGN.
This is because these operations join a transaction and after that they attempt to lock the mutex fs_info->qgroup_ioctl_lock. Acquiring that mutex after joining or starting a transaction is a pattern followed everywhere in qgroups, so the quota enablement operation is the one at fault here, and should not commit a transaction while holding that mutex.
Fix this by making the transaction commit while not holding the mutex. We are safe from two concurrent tasks trying to enable quotas because we are serialized by the rw semaphore fs_info->subvol_sem at btrfs_ioctl_quota_ctl(), which is the only call site for enabling quotas.
When this deadlock happens, it produces a trace like the following:
INFO: task syz-executor:25604 blocked for more than 143 seconds. Not tainted 5.15.0-rc6 #4 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor state:D stack:24800 pid:25604 ppid: 24873 flags:0x00004004 Call Trace: context_switch kernel/sched/core.c:4940 [inline] __schedule+0xcd9/0x2530 kernel/sched/core.c:6287 schedule+0xd3/0x270 kernel/sched/core.c:6366 btrfs_commit_transaction+0x994/0x2e90 fs/btrfs/transaction.c:2201 btrfs_quota_enable+0x95c/0x1790 fs/btrfs/qgroup.c:1120 btrfs_ioctl_quota_ctl fs/btrfs/ioctl.c:4229 [inline] btrfs_ioctl+0x637e/0x7b70 fs/btrfs/ioctl.c:5010 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f86920b2c4d RSP: 002b:00007f868f61ac58 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f86921d90a0 RCX: 00007f86920b2c4d RDX: 0000000020005e40 RSI: 00000000c0109428 RDI: 0000000000000008 RBP: 00007f869212bd80 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f86921d90a0 R13: 00007fff6d233e4f R14: 00007fff6d233ff0 R15: 00007f868f61adc0 INFO: task syz-executor:25628 blocked for more than 143 seconds. Not tainted 5.15.0-rc6 #4 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor state:D stack:29080 pid:25628 ppid: 24873 flags:0x00004004 Call Trace: context_switch kernel/sched/core.c:4940 [inline] __schedule+0xcd9/0x2530 kernel/sched/core.c:6287 schedule+0xd3/0x270 kernel/sched/core.c:6366 schedule_preempt_disabled+0xf/0x20 kernel/sched/core.c:6425 __mutex_lock_common kernel/locking/mutex.c:669 [inline] __mutex_lock+0xc96/0x1680 kernel/locking/mutex.c:729 btrfs_remove_qgroup+0xb7/0x7d0 fs/btrfs/qgroup.c:1548 btrfs_ioctl_qgroup_create fs/btrfs/ioctl.c:4333 [inline] btrfs_ioctl+0x683c/0x7b70 fs/btrfs/ioctl.c:5014 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- fs/btrfs/qgroup.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
fs/btrfs/qgroup.c +19 -0
@@ -940,6 +940,14 @@ int btrfs_quota_enable(struct btrfs_fs_iint ret =0 ;int slot; +/* +* We need to have subvol_sem write locked, to prevent races between +* concurrent tasks trying to enable quotas, because we will unlock +* and relock qgroup_ioctl_lock before setting fs_info->quota_root +* and before setting BTRFS_FS_QUOTA_ENABLED. +*/ +lockdep_assert_held_write (&fs_info->subvol_sem); +mutex_lock (&fs_info->qgroup_ioctl_lock);if (fs_info->quota_root) goto out;
@@ -1117,8 +1125,19 @@ out_add_root: goto out_free_path; } +mutex_unlock (&fs_info->qgroup_ioctl_lock); +/* +* Commit the transaction while not holding qgroup_ioctl_lock, to avoid +* a deadlock with tasks concurrently doing other qgroup operations, such +* adding/removing qgroups or adding/deleting qgroup relations for example, +* because all qgroup operations first start or join a transaction and then +* lock the qgroup_ioctl_lock mutex. +* We are safe from a concurrent task trying to enable quotas, by calling +* this function, since we are serialized by fs_info->subvol_sem. +*/ ret =btrfs_commit_transaction (trans); trans =NULL ; +mutex_lock (&fs_info->qgroup_ioctl_lock);if (ret) goto out_free_path;
Greg Kroah-Hartman
maintainerPATCH 711/846 btrfs: check the root node for uptodate before returning it
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 120de408e4b97504a2d9b5ca534b383de2c73d49 upstream.
Now that we clear the extent buffer uptodate if we fail to write it out we need to check to see if our root node is uptodate before we search down it. Otherwise we could return stale data (or potentially corrupt data that was caught by the write verification step) and think that the path is OK to search down.
--- fs/btrfs/ctree.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
fs/btrfs/ctree.c +15 -4
@@ -1568,12 +1568,9 @@ static struct extent_buffer *btrfs_searc {struct btrfs_fs_info *fs_info = root->fs_info;struct extent_buffer *b; -int root_lock; +int root_lock =0 ;int level =0 ; -/* We try very hard to do read locks on the root */ - root_lock =BTRFS_READ_LOCK ; -if (p->search_commit_root) {/* * The commit roots are read only so we always do read locks,
@@ -1611,6 +1608,9 @@ static struct extent_buffer *btrfs_searc goto out; } +/* We try very hard to do read locks on the root */ + root_lock =BTRFS_READ_LOCK ; +/* * If the level is set to maximum, we can skip trying to get the read * lock.
@@ -1637,6 +1637,17 @@ static struct extent_buffer *btrfs_searc level =btrfs_header_level (b); out: +/* +* The root may have failed to write out at some point, and thus is no +* longer valid, return an error in this case. +*/ +if (!extent_buffer_uptodate (b)) { +if (root_lock) +btrfs_tree_unlock_rw (b, root_lock); +free_extent_buffer (b); +return ERR_PTR (-EIO ); + } + p->nodes[level] = b;if (!p->skip_locking) p->locks[level] = root_lock;
Greg Kroah-Hartman
maintainerPATCH 712/846 btrfs: respect the max size in the header when activating swap file
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit c2f822635df873c510bda6fb7fd1b10b7c31be2d upstream.
If we extended the size of a swapfile after its header was created (by the mkswap utility) and then try to activate it, we will map the entire file when activating the swap file, instead of limiting to the max size defined in the swap file's header.
Currently test case generic/643 from fstests fails because we do not respect that size limit defined in the swap file's header.
So fix this by not mapping file ranges beyond the max size defined in the swap header.
This is the same type of bug that iomap used to have, and was fixed in commit 36ca7943ac18ae ("mm/swap: consider max pages in iomap_swapfile_add_extent").
--- fs/btrfs/inode.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/btrfs/inode.c +11 -0
@@ -10586,9 +10586,19 @@ static int btrfs_add_swap_extent(struct struct btrfs_swap_info *bsi) {unsigned long nr_pages; +unsigned long max_pages;u64 first_ppage, first_ppage_reported, next_ppage;int ret; +/* +* Our swapfile may have had its size extended after the swap header was +* written. In that case activating the swapfile should not go beyond +* the max size set in the swap header. +*/ +if (bsi->nr_pages >= sis->max) +return 0 ; + + max_pages = sis->max - bsi->nr_pages; first_ppage =ALIGN (bsi->block_start,PAGE_SIZE ) >>PAGE_SHIFT ; next_ppage =ALIGN_DOWN (bsi->block_start + bsi->block_len,PAGE_SIZE ) >>PAGE_SHIFT ;
@@ -10596,6 +10606,7 @@ static int btrfs_add_swap_extent(structif (first_ppage >= next_ppage)return 0 ; nr_pages = next_ppage - first_ppage; + nr_pages =min (nr_pages, max_pages); first_ppage_reported = first_ppage;if (bsi->start ==0 )
Greg Kroah-Hartman
maintainerPATCH 713/846 ext4: make sure to reset inode lockdep class when quota enabling fails
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 4013d47a5307fdb5c13370b5392498b00fedd274 upstream.
When we succeed in enabling some quota type but fail to enable another one with quota feature, we correctly disable all enabled quota types. However we forget to reset i_data_sem lockdep class. When the inode gets freed and reused, it will inherit this lockdep class (i_data_sem is initialized only when a slab is created) and thus eventually lockdep barfs about possible deadlocks.
--- fs/ext4/super.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/ext4/super.c +12 -1
@@ -6352,8 +6352,19 @@ int ext4_enable_quotas(struct super_bloc"Failed to enable quota tracking " "(type=%d, err=%d). Please run " "e2fsck to fix.", type, err); -for (type--; type >=0 ; type--) +for (type--; type >=0 ; type--) { +struct inode *inode; + + inode =sb_dqopt (sb)->files[type]; +if (inode) + inode =igrab (inode);dquot_quota_off (sb, type); +if (inode) { +lockdep_set_quota_inode (inode, +I_DATA_SEM_NORMAL ); +iput (inode); + } + }return err; }
Greg Kroah-Hartman
maintainerPATCH 714/846 ext4: make sure quota gets properly shutdown on error
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 15fc69bbbbbc8c72e5f6cc4e1be0f51283c5448e upstream.
When we hit an error when enabling quotas and setting inode flags, we do not properly shutdown quota subsystem despite returning error from Q_QUOTAON quotactl. This can lead to some odd situations like kernel using quota file while it is still writeable for userspace. Make sure we properly cleanup the quota subsystem in case of error.
--- fs/ext4/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ext4/super.c +6 -4
@@ -6266,10 +6266,7 @@ static int ext4_quota_on(struct super_bllockdep_set_quota_inode (path->dentry->d_inode,I_DATA_SEM_QUOTA ); err =dquot_quota_on (sb, type, format_id, path); -if (err) { -lockdep_set_quota_inode (path->dentry->d_inode, -I_DATA_SEM_NORMAL ); - }else { +if (!err) {struct inode *inode =d_inode (path->dentry);handle_t *handle;
@@ -6289,7 +6286,12 @@ static int ext4_quota_on(struct super_blext4_journal_stop (handle); unlock_inode:inode_unlock (inode); +if (err) +dquot_quota_off (sb, type); } +if (err) +lockdep_set_quota_inode (path->dentry->d_inode, +I_DATA_SEM_NORMAL );return err; }
Greg Kroah-Hartman
maintainerPATCH 715/846 ext4: fix a possible ABBA deadlock due to busy PA
In reply to Greg Kroah-HartmanFrom: Chunguang Xu <[email protected]>
commit 8c80fb312d7abf8bcd66cca1d843a80318a2c522 upstream.
We found on older kernel (3.10) that in the scenario of insufficient disk space, system may trigger an ABBA deadlock problem, it seems that this problem still exists in latest kernel, try to fix it here. The main process triggered by this problem is that task A occupies the PA and waits for the jbd2 transaction finish, the jbd2 transaction waits for the completion of task B's IO (plug_list), but task B waits for the release of PA by task A to finish discard, which indirectly forms an ABBA deadlock. The related calltrace is as follows:
Task A
vfs_write
ext4_mb_new_blocks()
ext4_mb_mark_diskspace_used() JBD2
jbd2_journal_get_write_access() -> jbd2_journal_commit_transaction()
->schedule() filemap_fdatawait()
| |
| Task B |
| do_unlinkat() |
| ext4_evict_inode() |
| jbd2_journal_begin_ordered_truncate() |
| filemap_fdatawrite_range() |
| ext4_mb_new_blocks() |-ext4_mb_discard_group_preallocations() <-----
Here, try to cancel ext4_mb_discard_group_preallocations() internal retry due to PA busy, and do a limited number of retries inside ext4_mb_discard_preallocations(), which can circumvent the above problems, but also has some advantages:
1. Since the PA is in a busy state, if other groups have free PAs, keeping the current PA may help to reduce fragmentation.
2. Continue to traverse forward instead of waiting for the current group PA to be released. In most scenarios, the PA discard time can be reduced.
However, in the case of smaller free space, if only a few groups have space, then due to multiple traversals of the group, it may increase CPU overhead. But in contrast, I feel that the overall benefit is better than the cost.
--- fs/ext4/mballoc.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-)
fs/ext4/mballoc.c +18 -22
@@ -4814,7 +4814,7 @@ ext4_mb_release_group_pa(struct ext4_bud*/ static noinline_for_stack intext4_mb_discard_group_preallocations (struct super_block *sb, -ext4_group_t group,int needed) +ext4_group_t group,int *busy) {struct ext4_group_info *grp =ext4_get_group_info (sb, group);struct buffer_head *bitmap_bh =NULL ;
@@ -4822,8 +4822,7 @@ ext4_mb_discard_group_preallocations(strstruct list_head list;struct ext4_buddy e4b;int err; -int busy =0 ; -int free, free_total =0 ; +int free =0 ;mb_debug (sb,"discard preallocation for group %u\n" , group);if (list_empty (&grp->bb_prealloc_list))
@@ -4846,19 +4845,14 @@ ext4_mb_discard_group_preallocations(str goto out_dbg; } -if (needed ==0 ) - needed =EXT4_CLUSTERS_PER_GROUP (sb) +1 ; -INIT_LIST_HEAD (&list); -repeat: - free =0 ;ext4_lock_group (sb, group);list_for_each_entry_safe (pa, tmp, &grp->bb_prealloc_list, pa_group_list) {spin_lock (&pa->pa_lock);if (atomic_read (&pa->pa_count)) {spin_unlock (&pa->pa_lock); - busy =1 ; + *busy =1 ;continue ; }if (pa->pa_deleted) {
@@ -4898,22 +4892,13 @@ repeat:call_rcu (&(pa)->u.pa_rcu, ext4_mb_pa_callback); } - free_total += free; - -/* if we still need more blocks and some PAs were used, try again */ -if (free_total < needed && busy) { -ext4_unlock_group (sb, group); -cond_resched (); - busy =0 ; - goto repeat; - }ext4_unlock_group (sb, group);ext4_mb_unload_buddy (&e4b);put_bh (bitmap_bh); out_dbg:mb_debug (sb,"discarded (%d) blocks preallocated for group %u bb_free (%d)\n" , - free_total, group, grp->bb_free); -return free_total; + free, group, grp->bb_free); +return free; }/*
@@ -5455,13 +5440,24 @@ static int ext4_mb_discard_preallocation {ext4_group_t i, ngroups =ext4_get_groups_count (sb);int ret; -int freed =0 ; +int freed =0 , busy =0 ; +int retry =0 ;trace_ext4_mb_discard_preallocations (sb, needed); + +if (needed ==0 ) + needed =EXT4_CLUSTERS_PER_GROUP (sb) +1 ; + repeat:for (i =0 ; i < ngroups && needed >0 ; i++) { - ret =ext4_mb_discard_group_preallocations (sb, i, needed); + ret =ext4_mb_discard_group_preallocations (sb, i, &busy); freed += ret; needed -= ret; +cond_resched (); + } + +if (needed >0 && busy && ++retry <3 ) { + busy =0 ; + goto repeat; }return freed;
Greg Kroah-Hartman
maintainerPATCH 716/846 ext4: initialize err_blk before calling __ext4_get_inode_loc
In reply to Greg Kroah-HartmanFrom: Harshad Shirwadkar <[email protected]>
commit c27c29c6af4f3f4ce925a2111c256733c5a5b430 upstream.
It is not guaranteed that __ext4_get_inode_loc will definitely set err_blk pointer when it returns EIO. To avoid using uninitialized variables, let's first set err_blk to 0.
--- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/inode.c +2 -2
@@ -4371,7 +4371,7 @@ has_buffer:static int __ext4_get_inode_loc_noinmem (struct inode *inode,struct ext4_iloc *iloc) { -ext4_fsblk_t err_blk; +ext4_fsblk_t err_blk =0 ;int ret; ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, iloc, 0,
@@ -4386,7 +4386,7 @@ static int __ext4_get_inode_loc_noinmem(int ext4_get_inode_loc (struct inode *inode,struct ext4_iloc *iloc) { -ext4_fsblk_t err_blk; +ext4_fsblk_t err_blk =0 ;int ret;/* We have all inode data except xattrs in memory here. */
Greg Kroah-Hartman
maintainerPATCH 717/846 ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE
In reply to Greg Kroah-HartmanFrom: Xin Yin <[email protected]>
commit 5e4d0eba1ccaf19f93222abdeda5a368be141785 upstream.
when call falloc with FALLOC_FL_ZERO_RANGE, to set an range to unwritten, which has been already initialized. If the range is align to blocksize, fast commit will not track range for this change.
Also track range for unwritten range in ext4_map_blocks().
--- fs/ext4/extents.c | 2 -- fs/ext4/inode.c | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-)
fs/ext4/extents.c +0 -2
@@ -4645,8 +4645,6 @@ static long ext4_zero_range(struct file ret =ext4_mark_inode_dirty (handle, inode);if (unlikely (ret)) goto out_handle; -ext4_fc_track_range (handle, inode, offset >> inode->i_sb->s_blocksize_bits, - (offset + len -1 ) >> inode->i_sb->s_blocksize_bits);/* Zero out partial block at the edges of the range */ ret =ext4_zero_partial_blocks (handle, inode, offset, len);if (ret >=0 )
fs/ext4/inode.c +4 -3
@@ -741,10 +741,11 @@ out_sem:if (ret)return ret; } -ext4_fc_track_range (handle, inode, map->m_lblk, - map->m_lblk + map->m_len -1 ); } - +if (retval >0 && (map->m_flags &EXT4_MAP_UNWRITTEN || + map->m_flags &EXT4_MAP_MAPPED )) +ext4_fc_track_range (handle, inode, map->m_lblk, + map->m_lblk + map->m_len -1 );if (retval <0 )ext_debug (inode,"failed with err %d\n" , retval);return retval;
Greg Kroah-Hartman
maintainerPATCH 718/846 ext4: set csum seed in tmp inode while migrating to extents
In reply to Greg Kroah-HartmanFrom: Luís Henriques <[email protected]>
commit e81c9302a6c3c008f5c30beb73b38adb0170ff2d upstream.
When migrating to extents, the temporary inode will have it's own checksum seed. This means that, when swapping the inodes data, the inode checksums will be incorrect.
This can be fixed by recalculating the extents checksums again. Or simply by copying the seed into the temporary inode.
--- fs/ext4/migrate.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/ext4/migrate.c +11 -1
@@ -459,6 +459,17 @@ int ext4_ext_migrate(struct inode *inodeext4_journal_stop (handle); goto out_unlock; } +/* +* Use the correct seed for checksum (i.e. the seed from 'inode'). This +* is so that the metadata blocks will have the correct checksum after +* the migration. +* +* Note however that, if a crash occurs during the migration process, +* the recovery process is broken because the tmp_inode checksums will +* be wrong and the orphans cleanup will fail. +*/ + ei =EXT4_I (inode); +EXT4_I (tmp_inode)->i_csum_seed = ei->i_csum_seed;i_size_write (tmp_inode,i_size_read (inode));/* * Set the i_nlink to zero so it will be deleted later
@@ -502,7 +513,6 @@ int ext4_ext_migrate(struct inode *inode goto out_tmp_inode; } - ei =EXT4_I (inode); i_data = ei->i_data;memset (&lb,0 ,sizeof (lb));
Greg Kroah-Hartman
maintainerPATCH 719/846 ext4: Fix BUG_ON in ext4_bread when write quota data
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit 380a0091cab482489e9b19e07f2a166ad2b76d5c upstream.
We got issue as follows when run syzkaller:
[ 167.936972] EXT4-fs error (device loop0): __ext4_remount:6314: comm rep: Abort forced by user [ 167.938306] EXT4-fs (loop0): Remounting filesystem read-only [ 167.981637] Assertion failure in ext4_getblk() at fs/ext4/inode.c:847: '(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY) || handle != NULL || create == 0' [ 167.983601] ------------[ cut here ]------------ [ 167.984245] kernel BUG at fs/ext4/inode.c:847! [ 167.984882] invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI [ 167.985624] CPU: 7 PID: 2290 Comm: rep Tainted: G B 5.16.0-rc5-next-20211217+ #123 [ 167.986823] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014 [ 167.988590] RIP: 0010:ext4_getblk+0x17e/0x504 [ 167.989189] Code: c6 01 74 28 49 c7 c0 a0 a3 5c 9b b9 4f 03 00 00 48 c7 c2 80 9c 5c 9b 48 c7 c6 40 b6 5c 9b 48 c7 c7 20 a4 5c 9b e8 77 e3 fd ff <0f> 0b 8b 04 244 [ 167.991679] RSP: 0018:ffff8881736f7398 EFLAGS: 00010282 [ 167.992385] RAX: 0000000000000094 RBX: 1ffff1102e6dee75 RCX: 0000000000000000 [ 167.993337] RDX: 0000000000000001 RSI: ffffffff9b6e29e0 RDI: ffffed102e6dee66 [ 167.994292] RBP: ffff88816a076210 R08: 0000000000000094 R09: ffffed107363fa09 [ 167.995252] R10: ffff88839b1fd047 R11: ffffed107363fa08 R12: ffff88816a0761e8 [ 167.996205] R13: 0000000000000000 R14: 0000000000000021 R15: 0000000000000001 [ 167.997158] FS: 00007f6a1428c740(0000) GS:ffff88839b000000(0000) knlGS:0000000000000000 [ 167.998238] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 167.999025] CR2: 00007f6a140716c8 CR3: 0000000133216000 CR4: 00000000000006e0 [ 167.999987] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 168.000944] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 168.001899] Call Trace: [ 168.002235] <TASK> [ 168.007167] ext4_bread+0xd/0x53 [ 168.007612] ext4_quota_write+0x20c/0x5c0 [ 168.010457] write_blk+0x100/0x220 [ 168.010944] remove_free_dqentry+0x1c6/0x440 [ 168.011525] free_dqentry.isra.0+0x565/0x830 [ 168.012133] remove_tree+0x318/0x6d0 [ 168.014744] remove_tree+0x1eb/0x6d0 [ 168.017346] remove_tree+0x1eb/0x6d0 [ 168.019969] remove_tree+0x1eb/0x6d0 [ 168.022128] qtree_release_dquot+0x291/0x340 [ 168.023297] v2_release_dquot+0xce/0x120 [ 168.023847] dquot_release+0x197/0x3e0 [ 168.024358] ext4_release_dquot+0x22a/0x2d0 [ 168.024932] dqput.part.0+0x1c9/0x900 [ 168.025430] __dquot_drop+0x120/0x190 [ 168.025942] ext4_clear_inode+0x86/0x220 [ 168.026472] ext4_evict_inode+0x9e8/0xa22 [ 168.028200] evict+0x29e/0x4f0 [ 168.028625] dispose_list+0x102/0x1f0 [ 168.029148] evict_inodes+0x2c1/0x3e0 [ 168.030188] generic_shutdown_super+0xa4/0x3b0 [ 168.030817] kill_block_super+0x95/0xd0 [ 168.031360] deactivate_locked_super+0x85/0xd0 [ 168.031977] cleanup_mnt+0x2bc/0x480 [ 168.033062] task_work_run+0xd1/0x170 [ 168.033565] do_exit+0xa4f/0x2b50 [ 168.037155] do_group_exit+0xef/0x2d0 [ 168.037666] __x64_sys_exit_group+0x3a/0x50 [ 168.038237] do_syscall_64+0x3b/0x90 [ 168.038751] entry_SYSCALL_64_after_hwframe+0x44/0xae
In order to reproduce this problem, the following conditions need to be met:
1. Ext4 filesystem with no journal;
2. Filesystem image with incorrect quota data;
3. Abort filesystem forced by user;
4. umount filesystem;
As in ext4_quota_write:
...
if (EXT4_SB(sb)->s_journal && !handle) {
ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)"
" cancelled because transaction is not started",
(unsigned long long)off, (unsigned long long)len);
return -EIO;
}...
We only check handle if NULL when filesystem has journal. There is need check handle if NULL even when filesystem has no journal.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -6470,7 +6470,7 @@ static ssize_t ext4_quota_write(struct sstruct buffer_head *bh;handle_t *handle =journal_current_handle (); -if (EXT4_SB (sb)->s_journal && !handle) { +if (!handle) {ext4_msg (sb,KERN_WARNING ,"Quota write (off=%llu, len=%llu)" " cancelled because transaction is not started" , (unsigned long long )off, (unsigned long long )len);
Greg Kroah-Hartman
maintainerPATCH 720/846 ext4: use ext4_ext_remove_space() for fast commit replay delete range
In reply to Greg Kroah-HartmanFrom: Xin Yin <[email protected]>
commit 0b5b5a62b945a141e64011b2f90ee7e46f14be98 upstream.
For now ,we use ext4_punch_hole() during fast commit replay delete range procedure. But it will be affected by inode->i_size, which may not correct during fast commit replay procedure. The following test will failed.
-create & write foo (len 1000K)
-falloc FALLOC_FL_ZERO_RANGE foo (range 400K - 600K) -create & fsync bar
-falloc FALLOC_FL_PUNCH_HOLE foo (range 300K-500K) -fsync foo
-crash before a full commit
After the fast_commit reply procedure, the range 400K-500K will not be removed. Because in this case, when calling ext4_punch_hole() the inode->i_size is 0, and it just retruns with doing nothing.
Change to use ext4_ext_remove_space() instead of ext4_punch_hole() to remove blocks of inode directly.
--- fs/ext4/fast_commit.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
fs/ext4/fast_commit.c +8 -5
@@ -1809,11 +1809,14 @@ ext4_fc_replay_del_range(struct super_bl } } - ret =ext4_punch_hole (inode, -le32_to_cpu (lrange.fc_lblk) << sb->s_blocksize_bits, -le32_to_cpu (lrange.fc_len) << sb->s_blocksize_bits); -if (ret) -jbd_debug (1 ,"ext4_punch_hole returned %d" , ret); +down_write (&EXT4_I (inode)->i_data_sem); + ret =ext4_ext_remove_space (inode, lrange.fc_lblk, + lrange.fc_lblk + lrange.fc_len -1 ); +up_write (&EXT4_I (inode)->i_data_sem); +if (ret) { +iput (inode); +return 0 ; + }ext4_ext_replay_shrink_inode (inode,i_size_read (inode) >> sb->s_blocksize_bits);ext4_mark_inode_dirty (NULL , inode);
Greg Kroah-Hartman
maintainerPATCH 721/846 ext4: fast commit may miss tracking unwritten range during ftruncate
In reply to Greg Kroah-HartmanFrom: Xin Yin <[email protected]>
commit 9725958bb75cdfa10f2ec11526fdb23e7485e8e4 upstream.
If use FALLOC_FL_KEEP_SIZE to alloc unwritten range at bottom, the inode->i_size will not include the unwritten range. When call ftruncate with fast commit enabled, it will miss to track the unwritten range.
Change to trace the full range during ftruncate.
--- fs/ext4/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/inode.c +1 -2
@@ -5414,8 +5414,7 @@ int ext4_setattr(struct user_namespace *ext4_fc_track_range (handle, inode, (attr->ia_size >0 ? attr->ia_size -1 :0 ) >> inode->i_sb->s_blocksize_bits, - (oldsize >0 ? oldsize -1 :0 ) >> - inode->i_sb->s_blocksize_bits); +EXT_MAX_BLOCKS -1 ); else ext4_fc_track_range( handle, inode,
Greg Kroah-Hartman
maintainerPATCH 722/846 ext4: destroy ext4_fc_dentry_cachep kmemcache on module removal
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
commit ab047d516dea72f011c15c04a929851e4d053109 upstream.
The kmemcache for ext4_fc_dentry_cachep remains registered after module removal.
Destroy ext4_fc_dentry_cachep kmemcache on module removal.
--- fs/ext4/ext4.h | 1 + fs/ext4/fast_commit.c | 5 +++++ fs/ext4/super.c | 2 ++ 3 files changed, 8 insertions(+)
fs/ext4/ext4.h +1 -0
@@ -2934,6 +2934,7 @@ bool ext4_fc_replay_check_excluded(strucvoid ext4_fc_replay_cleanup (struct super_block *sb);int ext4_fc_commit (journal_t *journal,tid_t commit_tid);int __init ext4_fc_init_dentry_cache (void ); +void ext4_fc_destroy_dentry_cache (void );/* mballoc.c */ extern const struct seq_operations ext4_mb_seq_groups_ops;
fs/ext4/fast_commit.c +5 -0
@@ -2188,3 +2188,8 @@ int __init ext4_fc_init_dentry_cache(voireturn 0 ; } + +void ext4_fc_destroy_dentry_cache (void ) +{ +kmem_cache_destroy (ext4_fc_dentry_cachep); +}
fs/ext4/super.c +2 -0
@@ -6653,6 +6653,7 @@ static int __init ext4_init_fs(void) out:unregister_as_ext2 ();unregister_as_ext3 (); +ext4_fc_destroy_dentry_cache (); out05:destroy_inodecache (); out1:
@@ -6679,6 +6680,7 @@ static void __exit ext4_exit_fs(void)unregister_as_ext2 ();unregister_as_ext3 ();unregister_filesystem (&ext4_fs_type); +ext4_fc_destroy_dentry_cache ();destroy_inodecache ();ext4_exit_mballoc ();ext4_exit_sysfs ();
Greg Kroah-Hartman
maintainerPATCH 723/846 ext4: fix null-ptr-deref in __ext4_journal_ensure_credits
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit 298b5c521746d69c07beb2757292fb5ccc1b0f85 upstream.
We got issue as follows when run syzkaller test:
[ 1901.130043] EXT4-fs error (device vda): ext4_remount:5624: comm syz-executor.5: Abort forced by user [ 1901.130901] Aborting journal on device vda-8. [ 1901.131437] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.16: Detected aborted journal [ 1901.131566] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.11: Detected aborted journal [ 1901.132586] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.18: Detected aborted journal [ 1901.132751] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.9: Detected aborted journal [ 1901.136149] EXT4-fs error (device vda) in ext4_reserve_inode_write:6035: Journal has aborted [ 1901.136837] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-fuzzer: Detected aborted journal [ 1901.136915] ================================================================== [ 1901.138175] BUG: KASAN: null-ptr-deref in __ext4_journal_ensure_credits+0x74/0x140 [ext4] [ 1901.138343] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.13: Detected aborted journal [ 1901.138398] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.1: Detected aborted journal [ 1901.138808] Read of size 8 at addr 0000000000000000 by task syz-executor.17/968 [ 1901.138817] [ 1901.138852] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.30: Detected aborted journal [ 1901.144779] CPU: 1 PID: 968 Comm: syz-executor.17 Not tainted 4.19.90-vhulk2111.1.0.h893.eulerosv2r10.aarch64+ #1 [ 1901.146479] Hardware name: linux,dummy-virt (DT) [ 1901.147317] Call trace: [ 1901.147552] dump_backtrace+0x0/0x2d8 [ 1901.147898] show_stack+0x28/0x38 [ 1901.148215] dump_stack+0xec/0x15c [ 1901.148746] kasan_report+0x108/0x338 [ 1901.149207] __asan_load8+0x58/0xb0 [ 1901.149753] __ext4_journal_ensure_credits+0x74/0x140 [ext4] [ 1901.150579] ext4_xattr_delete_inode+0xe4/0x700 [ext4] [ 1901.151316] ext4_evict_inode+0x524/0xba8 [ext4] [ 1901.151985] evict+0x1a4/0x378 [ 1901.152353] iput+0x310/0x428 [ 1901.152733] do_unlinkat+0x260/0x428 [ 1901.153056] __arm64_sys_unlinkat+0x6c/0xc0 [ 1901.153455] el0_svc_common+0xc8/0x320 [ 1901.153799] el0_svc_handler+0xf8/0x160 [ 1901.154265] el0_svc+0x10/0x218 [ 1901.154682] ==================================================================
This issue may happens like this:
Process1 Process2ext4_evict_inode
ext4_journal_start
ext4_truncate
ext4_ind_truncate
ext4_free_branches
ext4_ind_truncate_ensure_credits
ext4_journal_ensure_credits_fn
ext4_journal_restart
handle->h_transaction = NULL;
mount -o remount,abort /mnt
-> trigger JBD abort
start_this_handle -> will return failed
ext4_xattr_delete_inode
ext4_journal_ensure_credits
ext4_journal_ensure_credits_fn
__ext4_journal_ensure_credits
jbd2_handle_buffer_credits
journal = handle->h_transaction->t_journal; ->null-ptr-derefNow, indirect truncate process didn't handle error. To solve this issue maybe simply add check handle is abort in '__ext4_journal_ensure_credits' is enough, and i also think this is necessary.
--- fs/ext4/ext4_jbd2.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/ext4_jbd2.c +2 -0
@@ -162,6 +162,8 @@ int __ext4_journal_ensure_credits(handle {if (!ext4_handle_valid (handle))return 0 ; +if (is_handle_aborted (handle)) +return -EROFS ;if (jbd2_handle_buffer_credits (handle) >= check_cred && handle->h_revoke_credits >= revoke_cred)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 724/846 ext4: fix an use-after-free issue about data=journal writeback mode
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit 5c48a7df91499e371ef725895b2e2d21a126e227 upstream.
Our syzkaller report an use-after-free issue that accessing the freed buffer_head on the writeback page in __ext4_journalled_writepage(). The problem is that if there was a truncate racing with the data=journalled writeback procedure, the writeback length could become zero and bget_one() refuse to get buffer_head's refcount, then the truncate procedure release buffer once we drop page lock, finally, the last ext4_walk_page_buffers() trigger the use-after-free problem.
sync truncateext4_sync_file()
file_write_and_wait_range()
ext4_setattr(0)
inode->i_size = 0 ext4_writepage()
len = 0
__ext4_journalled_writepage()
page_bufs = page_buffers(page) ext4_walk_page_buffers(bget_one) <- does not get refcount
do_invalidatepage()
free_buffer_head()
ext4_walk_page_buffers(page_bufs) <- trigger use-after-free
After commit bdf96838aea6 ("ext4: fix race between truncate and __ext4_journalled_writepage()"), we have already handled the racing case, so the bget_one() and bput_one() are not needed. So this patch simply remove these hunk, and recheck the i_size to make it safe.
--- fs/ext4/inode.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-)
fs/ext4/inode.c +10 -27
@@ -1845,30 +1845,16 @@ int ext4_da_get_block_prep(struct inodereturn 0 ; } -static int bget_one (handle_t *handle,struct inode *inode, -struct buffer_head *bh) -{ -get_bh (bh); -return 0 ; -} - -static int bput_one (handle_t *handle,struct inode *inode, -struct buffer_head *bh) -{ -put_bh (bh); -return 0 ; -} -static int __ext4_journalled_writepage (struct page *page,unsigned int len) {struct address_space *mapping = page->mapping;struct inode *inode = mapping->host; -struct buffer_head *page_bufs =NULL ;handle_t *handle =NULL ;int ret =0 , err =0 ;int inline_data =ext4_has_inline_data (inode);struct buffer_head *inode_bh =NULL ; +loff_t size;ClearPageChecked (page);
@@ -1878,14 +1864,6 @@ static int __ext4_journalled_writepage(s inode_bh =ext4_journalled_write_inline_data (inode, len, page);if (inode_bh ==NULL ) goto out; - }else { - page_bufs =page_buffers (page); -if (!page_bufs) { -BUG (); - goto out; - } -ext4_walk_page_buffers (handle, inode, page_bufs,0 , len, -NULL , bget_one); }/* * We need to release the page lock before we start the
@@ -1906,7 +1884,8 @@ static int __ext4_journalled_writepage(slock_page (page);put_page (page); -if (page->mapping != mapping) { + size =i_size_read (inode); +if (page->mapping != mapping ||page_offset (page) > size) {/* The page got truncated from under us */ ext4_journal_stop (handle); ret =0 ;
@@ -1916,6 +1895,13 @@ static int __ext4_journalled_writepage(sif (inline_data) { ret =ext4_mark_inode_dirty (handle, inode); }else { +struct buffer_head *page_bufs =page_buffers (page); + +if (page->index == size >>PAGE_SHIFT ) + len = size & ~PAGE_MASK ; +else + len =PAGE_SIZE ; + ret =ext4_walk_page_buffers (handle, inode, page_bufs,0 , len,NULL , do_journal_get_write_access);
@@ -1936,9 +1922,6 @@ static int __ext4_journalled_writepage(s out:unlock_page (page); out_no_pagelock: -if (!inline_data && page_bufs) -ext4_walk_page_buffers (NULL , inode, page_bufs,0 , len, -NULL , bput_one);brelse (inode_bh);return ret; }
Greg Kroah-Hartman
maintainerPATCH 725/846 ext4: dont use the orphan list when migrating an inode
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 6eeaf88fd586f05aaf1d48cb3a139d2a5c6eb055 upstream.
We probably want to remove the indirect block to extents migration feature after a deprecation window, but until then, let's fix a potential data loss problem caused by the fact that we put the tmp_inode on the orphan list. In the unlikely case where we crash and do a journal recovery, the data blocks belonging to the inode being migrated are also represented in the tmp_inode on the orphan list --- and so its data blocks will get marked unallocated, and available for reuse.
Instead, stop putting the tmp_inode on the oprhan list. So in the case where we crash while migrating the inode, we'll leak an inode, which is not a disaster. It will be easily fixed the next time we run fsck, and it's better than potentially having blocks getting claimed by two different files, and losing data as a result.
--- fs/ext4/migrate.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
fs/ext4/migrate.c +4 -15
@@ -437,12 +437,12 @@ int ext4_ext_migrate(struct inode *inodepercpu_down_write (&sbi->s_writepages_rwsem);/* -* Worst case we can touch the allocation bitmaps, a bgd -* block, and a block to link in the orphan list. We do need -* need to worry about credits for modifying the quota inode. +* Worst case we can touch the allocation bitmaps and a block +* group descriptor block. We do need need to worry about +* credits for modifying the quota inode. */ handle =ext4_journal_start (inode,EXT4_HT_MIGRATE , -4 +EXT4_MAXQUOTAS_TRANS_BLOCKS (inode->i_sb)); +3 +EXT4_MAXQUOTAS_TRANS_BLOCKS (inode->i_sb));if (IS_ERR (handle)) { retval =PTR_ERR (handle);
@@ -463,10 +463,6 @@ int ext4_ext_migrate(struct inode *inode* Use the correct seed for checksum (i.e. the seed from 'inode'). This * is so that the metadata blocks will have the correct checksum after * the migration. -* -* Note however that, if a crash occurs during the migration process, -* the recovery process is broken because the tmp_inode checksums will -* be wrong and the orphans cleanup will fail. */ ei =EXT4_I (inode);EXT4_I (tmp_inode)->i_csum_seed = ei->i_csum_seed;
@@ -478,7 +474,6 @@ int ext4_ext_migrate(struct inode *inodeclear_nlink (tmp_inode);ext4_ext_tree_init (handle, tmp_inode); -ext4_orphan_add (handle, tmp_inode);ext4_journal_stop (handle);/*
@@ -503,12 +498,6 @@ int ext4_ext_migrate(struct inode *inode handle =ext4_journal_start (inode,EXT4_HT_MIGRATE ,1 );if (IS_ERR (handle)) { -/* -* It is impossible to update on-disk structures without -* a handle, so just rollback in-core changes and live other -* work to orphan_list_cleanup() -*/ -ext4_orphan_del (NULL , tmp_inode); retval =PTR_ERR (handle); goto out_tmp_inode; }
Greg Kroah-Hartman
maintainerPATCH 726/846 tracing/osnoise: Properly unhook events if start_per_cpu_kthreads() fails
In reply to Greg Kroah-HartmanFrom: Nikita Yushchenko <[email protected]>
commit 0878355b51f5f26632e652c848a8e174bb02d22d upstream.
If start_per_cpu_kthreads() called from osnoise_workload_start() returns error, event hooks are left in broken state: unhook_irq_events() called but unhook_thread_events() and unhook_softirq_events() not called, and trace_osnoise_callback_enabled flag not cleared.
On the next tracer enable, hooks get not installed due to trace_osnoise_callback_enabled flag.
And on the further tracer disable an attempt to remove non-installed hooks happened, hitting a WARN_ON_ONCE() in tracepoint_remove_func().
Fix the error path by adding the missing part of cleanup. While at this, introduce osnoise_unhook_events() to avoid code duplication between this error path and normal tracer disable.
--- kernel/trace/trace_osnoise.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
kernel/trace/trace_osnoise.c +16 -4
@@ -1932,6 +1932,13 @@ out_unhook_irq:return -EINVAL ; } +static void osnoise_unhook_events (void ) +{ +unhook_thread_events (); +unhook_softirq_events (); +unhook_irq_events (); +} +static int __osnoise_tracer_start (struct trace_array *tr) {int retval;
@@ -1949,7 +1956,14 @@ static int __osnoise_tracer_start(struct retval =start_per_cpu_kthreads (tr);if (retval) { -unhook_irq_events (); + trace_osnoise_callback_enabled = false; +/* +* Make sure that ftrace_nmi_enter/exit() see +* trace_osnoise_callback_enabled as false before continuing. +*/ +barrier (); + +osnoise_unhook_events ();return retval; }
@@ -1981,9 +1995,7 @@ static void osnoise_tracer_stop(struct tstop_per_cpu_kthreads (); -unhook_irq_events (); -unhook_softirq_events (); -unhook_thread_events (); +osnoise_unhook_events (); osnoise_busy = false; }
Greg Kroah-Hartman
maintainerPATCH 727/846 ath11k: qmi: avoid error messages when dma allocation fails
In reply to Greg Kroah-HartmanFrom: Aaron Ma <[email protected]>
commit b9b5948cdd7bc8d9fa31c78cbbb04382c815587f upstream.
qmi tries to allocate a large contiguous dma memory at first, on the AMD Ryzen platform it fails, then retries with small slices. So set flag GFP_NOWARN to avoid flooding dmesg.
--- drivers/net/wireless/ath/ath11k/qmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/qmi.c +1 -1
@@ -1770,7 +1770,7 @@ static int ath11k_qmi_alloc_target_mem_c chunk->vaddr =dma_alloc_coherent (ab->dev, chunk->size, &chunk->paddr, -GFP_KERNEL ); +GFP_KERNEL | __GFP_NOWARN);if (!chunk->vaddr) {if (ab->qmi.mem_seg_count <=ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT ) { ath11k_dbg(ab, ATH11K_DBG_QMI,
Greg Kroah-Hartman
maintainerPATCH 728/846 Revert "drm/amdgpu: Dont inherit GEM object VMAs in child process"
In reply to Greg Kroah-HartmanFrom: Rajneesh Bhardwaj <[email protected]>
commit 8b5da5a458c95ad49571a6a6285800bf13409616 upstream.
This reverts commit fbcdbfde87509d523132b59f661a355c731139d0.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -3
@@ -264,9 +264,6 @@ static int amdgpu_gem_object_mmap(struct !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) vma->vm_flags &= ~VM_MAYWRITE; -if (bo->kfd_bo) - vma->vm_flags |=VM_DONTCOPY ; -return drm_gem_ttm_mmap (obj, vma); }
Greg Kroah-Hartman
maintainerPATCH 729/846 drm/radeon: fix error handling in radeon_driver_open_kms
In reply to Greg Kroah-HartmanFrom: Christian König <[email protected]>
commit 4722f463896cc0ef1a6f1c3cb2e171e949831249 upstream.
The return value was never initialized so the cleanup code executed when it isn't even necessary.
Just add proper error handling.
--- drivers/gpu/drm/radeon/radeon_kms.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/radeon/radeon_kms.c +12 -10
@@ -666,18 +666,18 @@ int radeon_driver_open_kms(struct drm_de fpriv =kzalloc (sizeof (*fpriv),GFP_KERNEL );if (unlikely (!fpriv)) { r = -ENOMEM ; - goto out_suspend; + goto err_suspend; }if (rdev->accel_working) { vm = &fpriv->vm; r =radeon_vm_init (rdev, vm);if (r) - goto out_fpriv; + goto err_fpriv; r =radeon_bo_reserve (rdev->ring_tmp_bo.bo, false);if (r) - goto out_vm_fini; + goto err_vm_fini;/* map the ib pool buffer read only into * virtual address space */
@@ -685,7 +685,7 @@ int radeon_driver_open_kms(struct drm_de rdev->ring_tmp_bo.bo);if (!vm->ib_bo_va) { r = -ENOMEM ; - goto out_vm_fini; + goto err_vm_fini; } r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va,
@@ -693,19 +693,21 @@ int radeon_driver_open_kms(struct drm_deRADEON_VM_PAGE_READABLE | RADEON_VM_PAGE_SNOOPED);if (r) - goto out_vm_fini; + goto err_vm_fini; } file_priv->driver_priv = fpriv; } -if (!r) - goto out_suspend; +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); +return 0 ; -out_vm_fini: +err_vm_fini:radeon_vm_fini (rdev, vm); -out_fpriv: +err_fpriv:kfree (fpriv); -out_suspend: + +err_suspend:pm_runtime_mark_last_busy (dev->dev);pm_runtime_put_autosuspend (dev->dev);return r;
Greg Kroah-Hartman
maintainerPATCH 730/846 of: base: Improve argument length mismatch error
In reply to Greg Kroah-HartmanFrom: Baruch Siach <[email protected]>
commit 5d05b811b5acb92fc581a7b328b36646c86f5ab9 upstream.
The cells_name field of of_phandle_iterator might be NULL. Use the phandle name instead. With this change instead of:
OF: /soc/pinctrl@1000000: (null) = 3 found 2
We get:
OF: /soc/pinctrl@1000000: phandle pinctrl@1000000 needs 3, found 2
Which is a more helpful messages making DT debugging easier.
In this particular example the phandle name looks like duplicate of the same node name. But note that the first node is the parent node (it->parent), while the second is the phandle target (it->node). They happen to be the same in the case that triggered this improvement. See commit 72cb4c48a46a ("arm64: dts: qcom: ipq6018: Fix gpio-ranges property").
--- drivers/of/base.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/of/base.c +8 -3
@@ -1327,9 +1327,14 @@ int of_phandle_iterator_next(struct of_p* property data length */ if (it->cur + count > it->list_end) { -pr_err ("%pOF: %s = %d found %td\n" , - it->parent, it->cells_name, - count, it->list_end - it->cur); +if (it->cells_name) +pr_err ("%pOF: %s = %d found %td\n" , + it->parent, it->cells_name, + count, it->list_end - it->cur); +else +pr_err ("%pOF: phandle %s needs %d, found %td\n" , + it->parent,of_node_full_name (it->node), + count, it->list_end - it->cur); goto err; } }
Greg Kroah-Hartman
maintainerPATCH 731/846 firmware: Update Kconfig help text for Google firmware
In reply to Greg Kroah-HartmanFrom: Ben Hutchings <[email protected]>
commit d185a3466f0cd5af8f1c5c782c53bc0e6f2e7136 upstream.
The help text for GOOGLE_FIRMWARE states that it should only be enabled when building a kernel for Google's own servers. However, many of the drivers dependent on it are also useful on Chromebooks or on any platform using coreboot.
Update the help text to reflect this double duty.
--- drivers/firmware/google/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/google/Kconfig +3 -3
@@ -3,9 +3,9 @@ menuconfig GOOGLE_FIRMWARE bool "Google Firmware Drivers" default n help - These firmware drivers are used by Google's servers. They are - only useful if you are working directly on one of their - proprietary servers. If in doubt, say "N". + These firmware drivers are used by Google servers, + Chromebooks and other devices using coreboot firmware. + If in doubt, say "N". if GOOGLE_FIRMWARE
Greg Kroah-Hartman
maintainerPATCH 732/846 can: mcp251xfd: mcp251xfd_tef_obj_read(): fix typo in error message
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
commit 99e7cc3b3f85d9a583ab83f386315c59443509ae upstream.
This patch fixes a typo in the error message in mcp251xfd_tef_obj_read(), if trying to read too many objects.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +1 -1
@@ -1336,7 +1336,7 @@ mcp251xfd_tef_obj_read(const struct mcp2 len > tx_ring->obj_num || offset + len > tx_ring->obj_num)) {netdev_err (priv->ndev, -"Trying to read to many TEF objects (max=%d, offset=%d, len=%d).\n" , +"Trying to read too many TEF objects (max=%d, offset=%d, len=%d).\n" , tx_ring->obj_num, offset, len);return -ERANGE ; }
Greg Kroah-Hartman
maintainerPATCH 733/846 media: rcar-csi2: Optimize the selection PHTW register
In reply to Greg Kroah-HartmanFrom: Suresh Udipi <[email protected]>
commit 549cc89cd09a85aaa16dc07ef3db811d5cf9bcb1 upstream.
PHTW register is selected based on default bit rate from Table[1]. for the bit rates less than or equal to 250. Currently first value of default bit rate which is greater than or equal to the caculated mbps is selected. This selection can be further improved by selecting the default bit rate which is nearest to the calculated value.
[1] specs r19uh0105ej0200-r-car-3rd-generation.pdf [Table 25.12]
--- drivers/media/platform/rcar-vin/rcar-csi2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/media/platform/rcar-vin/rcar-csi2.c +8 -1
@@ -989,10 +989,17 @@ static int rcsi2_phtw_write_mbps(struct const struct rcsi2_mbps_reg *values, u16 code) {const struct rcsi2_mbps_reg *value; +const struct rcsi2_mbps_reg *prev_value =NULL ; -for (value = values; value->mbps; value++) +for (value = values; value->mbps; value++) {if (value->mbps >= mbps)break ; + prev_value = value; + } + +if (prev_value && + ((mbps - prev_value->mbps) <= (value->mbps - mbps))) + value = prev_value;if (!value->mbps) {dev_err (priv->dev,"Unsupported PHY speed (%u Mbps)" , mbps);
Greg Kroah-Hartman
maintainerPATCH 734/846 drm/vc4: hdmi: Make sure the device is powered with CEC
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
commit 20b0dfa86bef0e80b41b0e5ac38b92f23b6f27f9 upstream.
Similarly to what we encountered with the detect hook with DRM, nothing actually prevents any of the CEC callback from being run while the HDMI output is disabled.
However, this is an issue since any register access to the controller when it's powered down will result in a silent hang.
Let's make sure we run the runtime_pm hooks when the CEC adapter is opened and closed by the userspace to avoid that issue.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +9 -1
@@ -1735,8 +1735,14 @@ static int vc4_hdmi_cec_adap_enable(strustruct vc4_hdmi *vc4_hdmi =cec_get_drvdata (adap);/* clock period in microseconds */ const u32 usecs =1000000 /CEC_CLOCK_FREQ ; -u32 val =HDMI_READ (HDMI_CEC_CNTRL_5 ); +u32 val; +int ret; + ret =pm_runtime_resume_and_get (&vc4_hdmi->pdev->dev); +if (ret) +return ret; + + val =HDMI_READ (HDMI_CEC_CNTRL_5 ); val &= ~(VC4_HDMI_CEC_TX_SW_RESET |VC4_HDMI_CEC_RX_SW_RESET |VC4_HDMI_CEC_CNT_TO_4700_US_MASK |VC4_HDMI_CEC_CNT_TO_4500_US_MASK );
@@ -1882,6 +1888,8 @@ static int vc4_hdmi_cec_init(struct vc4_if (ret <0 ) goto err_remove_handlers; +pm_runtime_put (&vc4_hdmi->pdev->dev); +return 0 ; err_remove_handlers:
Greg Kroah-Hartman
maintainerPATCH 735/846 media: correct MEDIA_TEST_SUPPORT help text
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 09f4d1513267d0ab712f5d29e7bd136535748709 upstream.
Fix grammar/wording in the help text for MEDIA_TEST_SUPPORT.
--- drivers/media/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/Kconfig +4 -4
@@ -141,10 +141,10 @@ config MEDIA_TEST_SUPPORT prompt "Test drivers" if MEDIA_SUPPORT_FILTER default y if !MEDIA_SUPPORT_FILTER help - Those drivers should not be used on production Kernels, but - can be useful on debug ones. It enables several dummy drivers - that simulate a real hardware. Very useful to test userspace - applications and to validate if the subsystem core is doesn't + These drivers should not be used on production kernels, but + can be useful on debug ones. This option enables several dummy drivers + that simulate real hardware. Very useful to test userspace + applications and to validate if the subsystem core doesn't have regressions. Say Y if you want to use some virtual test driver.
Greg Kroah-Hartman
maintainerPATCH 736/846 Documentation: coresight: Fix documentation issue
In reply to Greg Kroah-HartmanFrom: Mike Leach <[email protected]>
commit 66bd1333abd7fa191f13b929c9119d6cd3df27b0 upstream.
Fix the description of the directories and attributes used in cs_etm as used by perf.
Drop the references to the 'configurations' sub-directory which had been removed in an earlier version of the patchset.
--- Documentation/trace/coresight/coresight-config.rst | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
Documentation/trace/coresight/coresight-config.rst +5 -11
@@ -211,19 +211,13 @@ also declared in the perf 'cs_etm' event be selected when running trace under perf:: $ ls /sys/devices/cs_etm - configurations format perf_event_mux_interval_ms sinks type - events nr_addr_filters power + cpu0 cpu2 events nr_addr_filters power subsystem uevent + cpu1 cpu3 format perf_event_mux_interval_ms sinks type -Key directories here are 'configurations' - which lists the loaded -configurations, and 'events' - a generic perf directory which allows -selection on the perf command line.:: +The key directory here is 'events' - a generic perf directory which allows +selection on the perf command line. As with the sinks entries, this provides +a hash of the configuration name. - $ ls configurations/ - autofdo - $ cat configurations/autofdo - 0xa7c3dddd - -As with the sinks entries, this provides a hash of the configuration name. The entry in the 'events' directory uses perfs built in syntax generator to substitute the syntax for the name when evaluating the command::
Greg Kroah-Hartman
maintainerPATCH 737/846 Documentation: dmaengine: Correctly describe dmatest with channel unset
In reply to Greg Kroah-HartmanFrom: Daniel Thompson <[email protected]>
commit c61d7b2ef141abf81140756b45860a2306f395a2 upstream.
Currently the documentation states that channels must be configured before running the dmatest. This has not been true since commit 6b41030fdc79 ("dmaengine: dmatest: Restore default for channel"). Fix accordingly.
--- Documentation/driver-api/dmaengine/dmatest.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/driver-api/dmaengine/dmatest.rst +4 -3
@@ -143,13 +143,14 @@ Part 5 - Handling channel allocation Allocating Channels ------------------- -Channels are required to be configured prior to starting the test run. -Attempting to run the test without configuring the channels will fail. +Channels do not need to be configured prior to starting a test run. Attempting +to run the test without configuring the channels will result in testing any +channels that are available. Example:: % echo 1 > /sys/module/dmatest/parameters/run - dmatest: Could not start test, no channels configured + dmatest: No channels configured, continue with any Channels are registered using the "channel" parameter. Channels can be requested by their name, once requested, the channel is registered and a pending thread is added to the test list.
Greg Kroah-Hartman
maintainerPATCH 738/846 Documentation: ACPI: Fix data node reference documentation
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit a11174952205d082f1658fab4314f0caf706e0a8 upstream.
The data node reference documentation was missing a package that must contain the property values, instead property name and multiple values being present in a single package. This is not aligned with the _DSD spec.
Fix it by adding the package for the values.
Also add the missing "reg" properties to two numbered nodes.
--- Documentation/firmware-guide/acpi/dsd/data-node-references.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/firmware-guide/acpi/dsd/data-node-references.rst +8 -2
@@ -5,7 +5,7 @@ Referencing hierarchical data nodes =================================== -:Copyright: |copy| 2018 Intel Corporation +:Copyright: |copy| 2018, 2021 Intel Corporation :Author: Sakari Ailus <[email protected]> ACPI in general allows referring to device objects in the tree only.
@@ -52,12 +52,14 @@ the ANOD object which is also the final Name (NOD0, Package() { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { + Package () { "reg", 0 }, Package () { "random-property", 3 }, } }) Name (NOD1, Package() { ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package () { + Package () { "reg", 1 }, Package () { "anothernode", "ANOD" }, } })
@@ -74,7 +76,11 @@ the ANOD object which is also the final Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { - Package () { "reference", ^DEV0, "node@1", "anothernode" }, + Package () { + "reference", Package () { + ^DEV0, "node@1", "anothernode" + } + }, } }) }
Greg Kroah-Hartman
maintainerPATCH 739/846 Documentation, arch: Remove leftovers from raw device
In reply to Greg Kroah-HartmanFrom: Alexandre Ghiti <[email protected]>
commit 473dcf0ffc31ce1135cd10578e7e06698cf51f4a upstream.
Raw device interface was removed so remove all references to configs related to it.
--- Documentation/admin-guide/devices.txt | 8 +------- arch/arm/configs/spear13xx_defconfig | 1 - arch/arm/configs/spear3xx_defconfig | 1 - arch/arm/configs/spear6xx_defconfig | 1 - arch/powerpc/configs/pseries_defconfig | 1 - 5 files changed, 1 insertion(+), 11 deletions(-)
Documentation/admin-guide/devices.txt +1 -7
@@ -2339,13 +2339,7 @@ disks (see major number 3) except that the limit on partitions is 31. - 162 char Raw block device interface - 0 = /dev/rawctl Raw I/O control device - 1 = /dev/raw/raw1 First raw I/O device - 2 = /dev/raw/raw2 Second raw I/O device - ... - max minor number of raw device is set by kernel config - MAX_RAW_DEVS or raw module parameter 'max_raw_devs' + 162 char Used for (now removed) raw block device interface 163 char
arch/arm/configs/spear13xx_defconfig +0 -1
@@ -61,7 +61,6 @@ CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y # CONFIG_HW_RANDOM is not set CONFIG_RAW_DRIVER=y -CONFIG_MAX_RAW_DEVS=8192 CONFIG_I2C=y CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_SPI=y
arch/arm/configs/spear3xx_defconfig +0 -1
@@ -41,7 +41,6 @@ CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y # CONFIG_HW_RANDOM is not set CONFIG_RAW_DRIVER=y -CONFIG_MAX_RAW_DEVS=8192 CONFIG_I2C=y CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_SPI=y
arch/arm/configs/spear6xx_defconfig +0 -1
@@ -36,7 +36,6 @@ CONFIG_INPUT_FF_MEMLESS=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_RAW_DRIVER=y -CONFIG_MAX_RAW_DEVS=8192 CONFIG_I2C=y CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_SPI=y
arch/powerpc/configs/pseries_defconfig +0 -1
@@ -190,7 +190,6 @@ CONFIG_HVCS=m CONFIG_VIRTIO_CONSOLE=m CONFIG_IBM_BSR=m CONFIG_RAW_DRIVER=y -CONFIG_MAX_RAW_DEVS=1024 CONFIG_I2C_CHARDEV=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y
Greg Kroah-Hartman
maintainerPATCH 740/846 Documentation, arch: Remove leftovers from CIFS_WEAK_PW_HASH
In reply to Greg Kroah-HartmanFrom: Alexandre Ghiti <[email protected]>
commit 2ac7069ad7647cd1d9ca5b08765a1e116e13cdc4 upstream.
This config was removed so remove all references to it.
--- Documentation/admin-guide/cifs/usage.rst | 7 +++---- arch/arm/configs/cm_x300_defconfig | 1 - arch/arm/configs/ezx_defconfig | 1 - arch/arm/configs/imote2_defconfig | 1 - arch/arm/configs/nhk8815_defconfig | 1 - arch/arm/configs/pxa_defconfig | 1 - arch/mips/configs/fuloong2e_defconfig | 1 - arch/mips/configs/malta_qemu_32r6_defconfig | 1 - arch/mips/configs/maltaaprp_defconfig | 1 - arch/mips/configs/maltasmvp_defconfig | 1 - arch/mips/configs/maltasmvp_eva_defconfig | 1 - arch/mips/configs/maltaup_defconfig | 1 - arch/powerpc/configs/ppc6xx_defconfig | 1 - arch/sh/configs/titan_defconfig | 1 - 14 files changed, 3 insertions(+), 17 deletions(-)
Documentation/admin-guide/cifs/usage.rst +3 -4
@@ -734,10 +734,9 @@ SecurityFlags Flags which control secur using weaker password hashes is 0x37037 (lanman, plaintext, ntlm, ntlmv2, signing allowed). Some SecurityFlags require the corresponding menuconfig - options to be enabled (lanman and plaintext require - CONFIG_CIFS_WEAK_PW_HASH for example). Enabling - plaintext authentication currently requires also - enabling lanman authentication in the security flags + options to be enabled. Enabling plaintext + authentication currently requires also enabling + lanman authentication in the security flags because the cifs module only supports sending laintext passwords using the older lanman dialect form of the session setup SMB. (e.g. for authentication
arch/arm/configs/cm_x300_defconfig +0 -1
@@ -146,7 +146,6 @@ CONFIG_NFS_V3_ACL=y CONFIG_NFS_V4=y CONFIG_ROOT_NFS=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_PARTITION_ADVANCED=y CONFIG_NLS_CODEPAGE_437=m CONFIG_NLS_ISO8859_1=m
arch/arm/configs/ezx_defconfig +0 -1
@@ -314,7 +314,6 @@ CONFIG_NFSD_V3_ACL=y CONFIG_SMB_FS=m CONFIG_CIFS=m CONFIG_CIFS_STATS=y -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_CODEPAGE_437=m
arch/arm/configs/imote2_defconfig +0 -1
@@ -288,7 +288,6 @@ CONFIG_NFSD_V3_ACL=y CONFIG_SMB_FS=m CONFIG_CIFS=m CONFIG_CIFS_STATS=y -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_CODEPAGE_437=m
arch/arm/configs/nhk8815_defconfig +0 -1
@@ -127,7 +127,6 @@ CONFIG_NFS_FS=y CONFIG_NFS_V3_ACL=y CONFIG_ROOT_NFS=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y
arch/arm/configs/pxa_defconfig +0 -1
@@ -699,7 +699,6 @@ CONFIG_NFSD_V3_ACL=y CONFIG_NFSD_V4=y CONFIG_CIFS=m CONFIG_CIFS_STATS=y -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_DEFAULT="utf8"
arch/mips/configs/fuloong2e_defconfig +0 -1
@@ -206,7 +206,6 @@ CONFIG_NFSD_V3_ACL=y CONFIG_NFSD_V4=y CONFIG_CIFS=m CONFIG_CIFS_STATS2=y -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_CIFS_DEBUG2=y
arch/mips/configs/malta_qemu_32r6_defconfig +0 -1
@@ -165,7 +165,6 @@ CONFIG_TMPFS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_CODEPAGE_437=m
arch/mips/configs/maltaaprp_defconfig +0 -1
@@ -166,7 +166,6 @@ CONFIG_TMPFS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_CODEPAGE_437=m
arch/mips/configs/maltasmvp_defconfig +0 -1
@@ -167,7 +167,6 @@ CONFIG_TMPFS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_CODEPAGE_437=m
arch/mips/configs/maltasmvp_eva_defconfig +0 -1
@@ -169,7 +169,6 @@ CONFIG_TMPFS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_CODEPAGE_437=m
arch/mips/configs/maltaup_defconfig +0 -1
@@ -165,7 +165,6 @@ CONFIG_TMPFS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y CONFIG_NLS_CODEPAGE_437=m
arch/powerpc/configs/ppc6xx_defconfig +0 -1
@@ -1022,7 +1022,6 @@ CONFIG_NFSD=m CONFIG_NFSD_V3_ACL=y CONFIG_NFSD_V4=y CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_UPCALL=y CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y
arch/sh/configs/titan_defconfig +0 -1
@@ -242,7 +242,6 @@ CONFIG_NFSD=y CONFIG_NFSD_V3=y CONFIG_SMB_FS=m CONFIG_CIFS=m -CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_PARTITION_ADVANCED=y CONFIG_NLS_CODEPAGE_437=m CONFIG_NLS_ASCII=m
Greg Kroah-Hartman
maintainerPATCH 741/846 Documentation: refer to config RANDOMIZE_BASE for kernel address-space randomization
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
commit 82ca67321f55a8d1da6ac3ed611da3c32818bb37 upstream.
The config RANDOMIZE_SLAB does not exist, the authors probably intended to refer to the config RANDOMIZE_BASE, which provides kernel address-space randomization. They probably just confused SLAB with BASE (these two four-letter words coincidentally share three common letters), as they also point out the config SLAB_FREELIST_RANDOM as further randomization within the same sentence.
Fix the reference of the config for kernel address-space randomization to the config that provides that.
--- Documentation/admin-guide/hw-vuln/spectre.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/admin-guide/hw-vuln/spectre.rst +1 -1
@@ -468,7 +468,7 @@ Spectre variant 2 before invoking any firmware code to prevent Spectre variant 2 exploits using the firmware. - Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=y + Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=y and CONFIG_SLAB_FREELIST_RANDOM=y in the kernel configuration) makes attacks on the kernel generally more difficult.
Greg Kroah-Hartman
maintainerPATCH 742/846 Documentation: fix firewire.rst ABI file path error
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit b0ac702f3329cdc8a06dcaac73183d4b5a2b942d upstream.
Adjust the path of the ABI files for firewire.rst to prevent a documentation build error. Prevents this problem:
Sphinx parallel build error:
docutils.utils.SystemMessage: Documentation/driver-api/firewire.rst:22: (SEVERE/4) Problems with "include" directive path:
InputError: [Errno 2] No such file or directory: '../Documentation/driver-api/ABI/stable/firewire-cdev'.
--- Documentation/driver-api/firewire.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/driver-api/firewire.rst +2 -2
@@ -19,7 +19,7 @@ of kernel interfaces is available via ex Firewire char device data structures ==================================== -.. include:: /ABI/stable/firewire-cdev +.. include:: ../ABI/stable/firewire-cdev :literal: .. kernel-doc:: include/uapi/linux/firewire-cdev.h
@@ -28,7 +28,7 @@ Firewire char device data structures Firewire device probing and sysfs interfaces ============================================ -.. include:: /ABI/stable/sysfs-bus-firewire +.. include:: ../ABI/stable/sysfs-bus-firewire :literal: .. kernel-doc:: drivers/firewire/core-device.c
Greg Kroah-Hartman
maintainerPATCH 743/846 Bluetooth: btusb: Return error code when getting patch status failed
In reply to Greg Kroah-HartmanFrom: Mark Chen <[email protected]>
commit 995d948cf2e45834275f07afc1c9881a9902e73c upstream.
If there are failure cases in getting patch status, it should return the error code (-EIO).
--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -2561,6 +2561,7 @@ static int btusb_mtk_setup_firmware_79xx }else {bt_dev_err (hdev,"Failed wmt patch dwnld status (%d)" , status); + err = -EIO ; goto err_release_fw; } }
Greg Kroah-Hartman
maintainerPATCH 744/846 net: usb: Correct reset handling of smsc95xx
In reply to Greg Kroah-HartmanFrom: Markus Reichl <[email protected]>
commit 0bf3885324a8599e3af4c7379b8d4f621c9bbffa upstream.
On boards with LAN9514 and no preconfigured MAC address we don't get an ip address from DHCP after commit a049a30fc27c ("net: usb: Correct PHY handling of smsc95xx") anymore. Adding an explicit reset before starting the phy fixes the issue.
[1]
https://lore.kernel.org/netdev/[email protected]/
From: Gabriel Hojda <[email protected]>
--- drivers/net/usb/smsc95xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/usb/smsc95xx.c +2 -1
@@ -1961,7 +1961,8 @@ static const struct driver_info smsc95xx .bind = smsc95xx_bind, .unbind = smsc95xx_unbind, .link_reset = smsc95xx_link_reset, - .reset = smsc95xx_start_phy, + .reset = smsc95xx_reset, + .check_connect = smsc95xx_start_phy, .stop = smsc95xx_stop, .rx_fixup = smsc95xx_rx_fixup, .tx_fixup = smsc95xx_tx_fixup,
Greg Kroah-Hartman
maintainerPATCH 745/846 Bluetooth: hci_sync: Fix not setting adv set duration
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
commit f16a491c65d9eb19398b25aefc10c2d3313d17b3 upstream.
10bbffa3e88e attempted to fix the use of rotation duration as advertising duration but it didn't change the if condition which still uses the duration instead of the timeout.
--- net/bluetooth/hci_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_request.c +1 -1
@@ -2318,7 +2318,7 @@ int __hci_req_enable_ext_advertising(str/* Set duration per instance since controller is responsible for * scheduling it. */ -if (adv_instance && adv_instance->duration) { +if (adv_instance && adv_instance->timeout) {u16 duration = adv_instance->timeout *MSEC_PER_SEC ;/* Time = N * 10 ms */
Greg Kroah-Hartman
maintainerPATCH 746/846 scsi: core: Show SCMD_LAST in text form
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
commit 3369046e54ca8f82e0cb17740643da2d80d3cfa8 upstream.
The SCSI debugfs code supports showing information about pending commands, including translating SCSI command flags from numeric into text format. Also convert the SCMD_LAST flag from numeric into text form.
--- drivers/scsi/scsi_debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/scsi_debugfs.c +1 -0
@@ -9,6 +9,7 @@static const char *const scsi_cmd_flags[] = {SCSI_CMD_FLAG_NAME (TAGGED ),SCSI_CMD_FLAG_NAME (INITIALIZED ), +SCSI_CMD_FLAG_NAME (LAST ), };#undef SCSI_CMD_FLAG_NAME
Greg Kroah-Hartman
maintainerPATCH 747/846 scsi: ufs: ufs-mediatek: Fix error checking in ufs_mtk_init_va09_pwr_ctrl()
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 3ba880a12df5aa4488c18281701b5b1bc3d4531a upstream.
The function regulator_get() returns an error pointer. Use IS_ERR() to validate the return value.
--- drivers/scsi/ufs/ufs-mediatek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufs-mediatek.c +1 -1
@@ -501,7 +501,7 @@ static void ufs_mtk_init_va09_pwr_ctrl(sstruct ufs_mtk_host *host =ufshcd_get_variant (hba); host->reg_va09 =regulator_get (hba->dev,"va09" ); -if (!host->reg_va09) +if (IS_ERR (host->reg_va09))dev_info (hba->dev,"failed to get va09" );else host->caps |=UFS_MTK_CAP_VA09_PWR_CTRL ;
Greg Kroah-Hartman
maintainerPATCH 748/846 RDMA/cma: Remove open coding of overflow checking for private_data_len
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
commit 8d0d2b0f41b1b2add8a30dbd816051a964efa497 upstream.
The existing tests are a little hard to comprehend. Use check_add_overflow() instead.
--- drivers/infiniband/core/cma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/infiniband/core/cma.c +2 -4
@@ -4037,8 +4037,7 @@ static int cma_resolve_ib_udp(struct rdmmemset (&req,0 ,sizeof req); offset =cma_user_data_offset (id_priv); - req.private_data_len = offset + conn_param->private_data_len; -if (req.private_data_len < conn_param->private_data_len) +if (check_add_overflow (offset, conn_param->private_data_len, &req.private_data_len))return -EINVAL ;if (req.private_data_len) {
@@ -4097,8 +4096,7 @@ static int cma_connect_ib(struct rdma_idmemset (&req,0 ,sizeof req); offset =cma_user_data_offset (id_priv); - req.private_data_len = offset + conn_param->private_data_len; -if (req.private_data_len < conn_param->private_data_len) +if (check_add_overflow (offset, conn_param->private_data_len, &req.private_data_len))return -EINVAL ;if (req.private_data_len) {
Greg Kroah-Hartman
maintainerPATCH 749/846 dmaengine: uniphier-xdmac: Fix type of address variables
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
commit 105a8c525675bb7d4d64871f9b2edf39460de881 upstream.
The variables src_addr and dst_addr handle DMA addresses, so these should be declared as dma_addr_t.
--- drivers/dma/uniphier-xdmac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/dma/uniphier-xdmac.c +3 -2
@@ -131,8 +131,9 @@ uniphier_xdmac_next_desc(struct uniphierstatic void uniphier_xdmac_chan_start (struct uniphier_xdmac_chan *xc,struct uniphier_xdmac_desc *xd) { -u32 src_mode, src_addr, src_width; -u32 dst_mode, dst_addr, dst_width; +u32 src_mode, src_width; +u32 dst_mode, dst_width; +dma_addr_t src_addr, dst_addr;u32 val, its, tnum;enum dma_slave_buswidth buswidth;
Greg Kroah-Hartman
maintainerPATCH 750/846 dmaengine: idxd: fix wq settings post wq disable
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
commit 0f225705cf6536826318180831e18a74595efc8d upstream.
By the spec, wq size and group association is not changeable unless device is disabled. Exclude clearing the shadow copy on wq disable/reset. This allows wq type to be changed after disable to be re-enabled.
Move the size and group association to its own cleanup and only call it during device disable.
--- drivers/dma/idxd/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/dma/idxd/device.c +10 -2
@@ -394,8 +394,6 @@ static void idxd_wq_disable_cleanup(strulockdep_assert_held (&wq->wq_lock);memset (wq->wqcfg,0 , idxd->wqcfg_size); wq->type =IDXD_WQT_NONE ; - wq->size =0 ; - wq->group =NULL ; wq->threshold =0 ; wq->priority =0 ; wq->ats_dis =0 ;
@@ -404,6 +402,15 @@ static void idxd_wq_disable_cleanup(strumemset (wq->name,0 ,WQ_NAME_SIZE ); } +static void idxd_wq_device_reset_cleanup (struct idxd_wq *wq) +{ +lockdep_assert_held (&wq->wq_lock); + +idxd_wq_disable_cleanup (wq); + wq->size =0 ; + wq->group =NULL ; +} +static void idxd_wq_ref_release (struct percpu_ref *ref) { struct idxd_wq *wq = container_of(ref, struct idxd_wq, wq_active);
@@ -711,6 +718,7 @@ static void idxd_device_wqs_clear_state(if (wq->state ==IDXD_WQ_ENABLED ) {idxd_wq_disable_cleanup (wq); +idxd_wq_device_reset_cleanup (wq); wq->state =IDXD_WQ_DISABLED ; } }
Greg Kroah-Hartman
maintainerPATCH 751/846 RDMA/hns: Modify the mapping attribute of doorbell to device
In reply to Greg Kroah-HartmanFrom: Yixing Liu <[email protected]>
commit 39d5534b1302189c809e90641ffae8cbdc42a8fc upstream.
It is more general for ARM device drivers to use the device attribute to map PCI BAR spaces.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_main.c +1 -1
@@ -352,7 +352,7 @@ static int hns_roce_mmap(struct ib_ucontreturn rdma_user_mmap_io (context, vma,to_hr_ucontext (context)->uar.pfn,PAGE_SIZE , -pgprot_noncached (vma->vm_page_prot), +pgprot_device (vma->vm_page_prot),NULL );/* vm_pgoff: 1 -- TPTR */
Greg Kroah-Hartman
maintainerPATCH 752/846 RDMA/rxe: Fix a typo in opcode name
In reply to Greg Kroah-HartmanFrom: Chengguang Xu <[email protected]>
commit 8d1cfb884e881efd69a3be4ef10772c71cb22216 upstream.
There is a redundant ']' in the name of opcode IB_OPCODE_RC_SEND_MIDDLE, so just fix it.
--- drivers/infiniband/sw/rxe/rxe_opcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_opcode.c +1 -1
@@ -117,7 +117,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NU } }, [IB_OPCODE_RC_SEND_MIDDLE] = { - .name = "IB_OPCODE_RC_SEND_MIDDLE]", + .name = "IB_OPCODE_RC_SEND_MIDDLE", .mask =RXE_PAYLOAD_MASK |RXE_REQ_MASK |RXE_SEND_MASK | RXE_MIDDLE_MASK, .length = RXE_BTH_BYTES,
Greg Kroah-Hartman
maintainerPATCH 753/846 dmaengine: stm32-mdma: fix STM32_MDMA_CTBR_TSEL_MASK
In reply to Greg Kroah-HartmanFrom: Amelie Delaunay <[email protected]>
commit e7f110889a87307fb0fed408a5dee1707796ca04 upstream.
This patch fixes STM32_MDMA_CTBR_TSEL_MASK, which is [5:0], not [7:0].
--- drivers/dma/stm32-mdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/stm32-mdma.c +1 -1
@@ -184,7 +184,7 @@#define STM32_MDMA_CTBR (x) (0x68 + 0x40 * (x))#define STM32_MDMA_CTBR_DBUS BIT(17)#define STM32_MDMA_CTBR_SBUS BIT(16) -#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(7, 0) +#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(5, 0)#define STM32_MDMA_CTBR_TSEL (n) STM32_MDMA_SET(n, \ STM32_MDMA_CTBR_TSEL_MASK)
Greg Kroah-Hartman
maintainerPATCH 754/846 Revert "net/mlx5: Add retry mechanism to the command entry index allocation"
In reply to Greg Kroah-HartmanFrom: Moshe Shemesh <[email protected]>
commit 4f6626b0e140867fd6d5a2e9d4ceaef97f10f46a upstream.
This reverts commit 410bd754cd73c4a2ac3856d9a03d7b08f9c906bf.
The reverted commit had added a retry mechanism to the command entry index allocation. The previous patch ensures that there is a free command entry index once the command work handler holds the command semaphore. Thus the retry mechanism is not needed.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 -20
@@ -899,25 +899,6 @@ static bool opcode_allowed(struct mlx5_creturn cmd->allowed_opcode == opcode; } -static int cmd_alloc_index_retry (struct mlx5_cmd *cmd) -{ -unsigned long alloc_end = jiffies +msecs_to_jiffies (1000 ); -int idx; - -retry: - idx =cmd_alloc_index (cmd); -if (idx <0 &&time_before (jiffies, alloc_end)) { -/* Index allocation can fail on heavy load of commands. This is a temporary -* situation as the current command already holds the semaphore, meaning that -* another command completion is being handled and it is expected to release -* the entry index soon. -*/ -cpu_relax (); - goto retry; - } -return idx; -} -bool mlx5_cmd_is_down (struct mlx5_core_dev *dev) { return pci_channel_offline(dev->pdev) ||
@@ -942,7 +923,7 @@ static void cmd_work_handler(struct work sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;down (sem);if (!ent->page_queue) { - alloc_ret =cmd_alloc_index_retry (cmd); + alloc_ret =cmd_alloc_index (cmd);if (alloc_ret <0 ) {mlx5_core_err_rl (dev,"failed to allocate command entry\n" );if (ent->callback) {
Greg Kroah-Hartman
maintainerPATCH 755/846 powerpc/cell: Fix clang -Wimplicit-fallthrough warning
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
commit e89257e28e844f5d1d39081bb901d9f1183a7705 upstream.
Clang warns:
arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-through between switch labels
case SRR1_WAKEEE:
^
arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoid fall-through
case SRR1_WAKEEE:
^
break;1 error generated.
Clang is more pedantic than GCC, which does not warn when failing through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst. Add athe missing break to silence the warning.
--- arch/powerpc/platforms/cell/pervasive.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/cell/pervasive.c +1 -0
@@ -78,6 +78,7 @@ static int cbe_system_reset_exception(stswitch (regs->msr &SRR1_WAKEMASK ) {case SRR1_WAKEDEC :set_dec (1 ); +break ;case SRR1_WAKEEE :/* * Handle these when interrupts get re-enabled and we take
Greg Kroah-Hartman
maintainerPATCH 756/846 powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
commit 0d375d610fa96524e2ee2b46830a46a7bfa92a9f upstream.
This block is used in (at least) T1024 and T1040, including their variants like T1023 etc.
--- arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi +2 -0
@@ -79,6 +79,7 @@ fman0: fman@400000 { #size-cells = <0>; compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg = <0xfc000 0x1000>; + fsl,erratum-a009885; }; xmdio0: mdio@fd000 {
@@ -86,6 +87,7 @@ fman0: fman@400000 { #size-cells = <0>; compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg = <0xfd000 0x1000>; + fsl,erratum-a009885; }; };
Greg Kroah-Hartman
maintainerPATCH 757/846 block: fix async_depth sysfs interface for mq-deadline
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 46cdc45acb089c811d9a54fd50af33b96e5fae9d upstream.
A previous commit added this feature, but it inadvertently used the wrong variable to show/store the setting from/to, victimized by copy/paste. Fix it up so that the async_depth sysfs interface reads and writes from the right setting.
--- block/mq-deadline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/mq-deadline.c +2 -2
@@ -811,7 +811,7 @@ SHOW_JIFFIES(deadline_read_expire_show,SHOW_JIFFIES (deadline_write_expire_show, dd->fifo_expire[DD_WRITE ]);SHOW_INT (deadline_writes_starved_show, dd->writes_starved);SHOW_INT (deadline_front_merges_show, dd->front_merges); -SHOW_INT (deadline_async_depth_show, dd->front_merges); +SHOW_INT (deadline_async_depth_show, dd->async_depth);SHOW_INT (deadline_fifo_batch_show, dd->fifo_batch);#undef SHOW_INT#undef SHOW_JIFFIES
@@ -840,7 +840,7 @@ STORE_JIFFIES(deadline_read_expire_storeSTORE_JIFFIES (deadline_write_expire_store, &dd->fifo_expire[DD_WRITE ],0 ,INT_MAX );STORE_INT (deadline_writes_starved_store, &dd->writes_starved,INT_MIN ,INT_MAX );STORE_INT (deadline_front_merges_store, &dd->front_merges,0 ,1 ); -STORE_INT (deadline_async_depth_store, &dd->front_merges,1 ,INT_MAX ); +STORE_INT (deadline_async_depth_store, &dd->async_depth,1 ,INT_MAX );STORE_INT (deadline_fifo_batch_store, &dd->fifo_batch,0 ,INT_MAX );#undef STORE_FUNCTION#undef STORE_INT
Greg Kroah-Hartman
maintainerPATCH 758/846 block: Fix fsync always failed if once failed
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit 8a7518931baa8ea023700987f3db31cb0a80610b upstream.
We do test with inject error fault base on v4.19, after test some time we found sync /dev/sda always failed.
[root@localhost] sync /dev/sda
sync: error syncing '/dev/sda': Input/output error
scsi log as follows:
[19069.812296] sd 0:0:0:0: [sda] tag#64 Send: scmd 0x00000000d03a0b6b [19069.812302] sd 0:0:0:0: [sda] tag#64 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00 [19069.812533] sd 0:0:0:0: [sda] tag#64 Done: SUCCESS Result: hostbyte=DID_OK driverbyte=DRIVER_OK [19069.812536] sd 0:0:0:0: [sda] tag#64 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00 [19069.812539] sd 0:0:0:0: [sda] tag#64 scsi host busy 1 failed 0 [19069.812542] sd 0:0:0:0: Notifying upper driver of completion (result 0) [19069.812546] sd 0:0:0:0: [sda] tag#64 sd_done: completed 0 of 0 bytes [19069.812549] sd 0:0:0:0: [sda] tag#64 0 sectors total, 0 bytes done. [19069.812564] print_req_error: I/O error, dev sda, sector 0
ftrace log as follows:
rep-306069 [007] .... 19654.923315: block_bio_queue: 8,0 FWS 0 + 0 [rep] rep-306069 [007] .... 19654.923333: block_getrq: 8,0 FWS 0 + 0 [rep]
kworker/7:1H-250 [007] .... 19654.923352: block_rq_issue: 8,0 FF 0 () 0 + 0 [kworker/7:1H]
<idle>-0 [007] ..s. 19654.923562: block_rq_complete: 8,0 FF () 18446744073709551615 + 0 [0]
<idle>-0 [007] d.s. 19654.923576: block_rq_complete: 8,0 WS () 0 + 0 [-5]
As 8d6996630c03 introduce 'fq->rq_status', this data only update when 'flush_rq' reference count isn't zero. If flush request once failed and record error code in 'fq->rq_status'. If there is no chance to update 'fq->rq_status',then do fsync will always failed.
To address this issue reset 'fq->rq_status' after return error code to upper layer.
--- block/blk-flush.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/blk-flush.c +3 -1
@@ -235,8 +235,10 @@ static void flush_end_io(struct request* avoiding use-after-free. */ WRITE_ONCE (flush_rq->state,MQ_RQ_IDLE ); -if (fq->rq_status !=BLK_STS_OK ) +if (fq->rq_status !=BLK_STS_OK ) { error = fq->rq_status; + fq->rq_status =BLK_STS_OK ; + }if (!q->elevator) { flush_rq->tag =BLK_MQ_NO_TAG ;
Greg Kroah-Hartman
maintainerPATCH 759/846 drm/vc4: crtc: Drop feed_txp from state
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
commit a16c66401fd831f70a02d33e9bcaac585637c29f upstream.
Accessing the crtc->state pointer from outside the modesetting context is not allowed. We thus need to copy whatever we need from the KMS state to our structure in order to access it.
In VC4, a number of users of that pointers have crept in over the years, the first one being whether or not the downstream controller of the pixelvalve is our writeback controller.
Fortunately for us, Since commit 39fcb2808376 ("drm/vc4: txp: Turn the TXP into a CRTC of its own") this is no longer something that can change from one commit to the other and is hardcoded.
Let's set this flag in struct vc4_crtc if we happen to be the TXP, and drop the flag from our private state structure.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 3 +-- drivers/gpu/drm/vc4/vc4_drv.h | 6 +++++- drivers/gpu/drm/vc4/vc4_hvs.c | 7 +++---- drivers/gpu/drm/vc4/vc4_kms.c | 3 ++- drivers/gpu/drm/vc4/vc4_txp.c | 3 +-- 5 files changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +1 -2
@@ -715,7 +715,7 @@ static void vc4_crtc_handle_page_flip(stspin_lock_irqsave (&dev->event_lock, flags);if (vc4_crtc->event && (vc4_state->mm.start ==HVS_READ (SCALER_DISPLACTX (chan)) || - vc4_state->feed_txp)) { + vc4_crtc->feeds_txp)) {drm_crtc_send_vblank_event (crtc, vc4_crtc->event); vc4_crtc->event =NULL ;drm_crtc_vblank_put (crtc);
@@ -893,7 +893,6 @@ struct drm_crtc_state *vc4_crtc_duplicatreturn NULL ; old_vc4_state =to_vc4_crtc_state (crtc->state); - vc4_state->feed_txp = old_vc4_state->feed_txp; vc4_state->margins = old_vc4_state->margins; vc4_state->assigned_channel = old_vc4_state->assigned_channel;
drivers/gpu/drm/vc4/vc4_drv.h +5 -1
@@ -495,6 +495,11 @@ struct vc4_crtc {struct drm_pending_vblank_event *event;struct debugfs_regset32 regset; + +/** +* @feeds_txp: True if the CRTC feeds our writeback controller. +*/ +bool feeds_txp; }; static inline struct vc4_crtc *
@@ -521,7 +526,6 @@ struct vc4_crtc_state {struct drm_crtc_state base;/* Dlist area for this CRTC configuration. */ struct drm_mm_node mm; -bool feed_txp;bool txp_armed;unsigned int assigned_channel;
drivers/gpu/drm/vc4/vc4_hvs.c +3 -4
@@ -375,7 +375,7 @@ static void vc4_hvs_update_dlist(structspin_lock_irqsave (&dev->event_lock, flags); -if (!vc4_state->feed_txp || vc4_state->txp_armed) { +if (!vc4_crtc->feeds_txp || vc4_state->txp_armed) { vc4_crtc->event = crtc->state->event; crtc->state->event =NULL ; }
@@ -395,10 +395,9 @@ void vc4_hvs_atomic_enable(struct drm_cr {struct drm_device *dev = crtc->dev;struct vc4_dev *vc4 =to_vc4_dev (dev); -struct drm_crtc_state *new_crtc_state =drm_atomic_get_new_crtc_state (state, crtc); -struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (new_crtc_state);struct drm_display_mode *mode = &crtc->state->adjusted_mode; -bool oneshot = vc4_state->feed_txp; +struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc); +bool oneshot = vc4_crtc->feeds_txp;vc4_hvs_update_dlist (crtc);vc4_hvs_init_channel (vc4, crtc, mode, oneshot);
drivers/gpu/drm/vc4/vc4_kms.c +2 -1
@@ -233,6 +233,7 @@ static void vc4_hvs_pv_muxing_commit(strunsigned int i;for_each_new_crtc_in_state (state, crtc, crtc_state, i) { +struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc_state);u32 dispctrl;u32 dsp3_mux;
@@ -253,7 +254,7 @@ static void vc4_hvs_pv_muxing_commit(str* TXP IP, and we need to disable the FIFO2 -> pixelvalve1 * route. */ -if (vc4_state->feed_txp) +if (vc4_crtc->feeds_txp) dsp3_mux =VC4_SET_FIELD (3 ,SCALER_DISPCTRL_DSP3_MUX );else dsp3_mux =VC4_SET_FIELD (2 ,SCALER_DISPCTRL_DSP3_MUX );
drivers/gpu/drm/vc4/vc4_txp.c +1 -2
@@ -391,7 +391,6 @@ static int vc4_txp_atomic_check(struct d {struct drm_crtc_state *crtc_state =drm_atomic_get_new_crtc_state (state, crtc); -struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc_state);int ret; ret =vc4_hvs_atomic_check (crtc, state);
@@ -399,7 +398,6 @@ static int vc4_txp_atomic_check(struct dreturn ret; crtc_state->no_vblank = true; - vc4_state->feed_txp = true;return 0 ; }
@@ -482,6 +480,7 @@ static int vc4_txp_bind(struct device *d vc4_crtc->pdev = pdev; vc4_crtc->data = &vc4_txp_crtc_data; + vc4_crtc->feeds_txp = true; txp->pdev = pdev;
Greg Kroah-Hartman
maintainerPATCH 760/846 drm/vc4: Fix non-blocking commit getting stuck forever
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
commit 0c250c150c74a90db298bf2a8bcd0a1dabed2e2f upstream.
In some situation, we can end up being stuck on a non-blocking that went through properly.
The situation that seems to trigger it reliably is to first start a non-blocking commit, and then right after, and before we had any vblank interrupt), start a blocking commit.
This will lead to the first commit workqueue to be scheduled, setup the display, while the second commit is waiting for the first one to be completed.
The vblank interrupt will then be raised, vc4_crtc_handle_vblank() will run and will compare the active dlist in the HVS channel to the one associated with the crtc->state.
However, at that point, the second commit is waiting using drm_atomic_helper_wait_for_dependencies that occurs after drm_atomic_helper_swap_state has been called, so crtc->state points to the second commit state. vc4_crtc_handle_vblank() will compare the two dlist addresses and since they don't match will ignore the interrupt.
The vblank event will never be reported, and the first and second commit will wait for the first commit completion until they timeout.
The underlying reason is that it was never safe to do so. Indeed, accessing the ->state pointer access synchronization is based on ownership guarantees that can only occur within the functions and hooks defined as part of the KMS framework, and obviously the irq handler isn't one of them. The rework to move to generic helpers only uncovered the underlying issue.
However, since the code path between drm_atomic_helper_wait_for_dependencies() and drm_atomic_helper_wait_for_vblanks() is serialised and we can't get two commits in that path at the same time, we can work around this issue by setting a variable associated to struct drm_crtc to the dlist we expect, and then using it from the vc4_crtc_handle_vblank() function.
Since that state is shared with the modesetting path, we also need to introduce a spinlock to protect the code shared between the interrupt handler and the modesetting path, protecting only our new variable for now.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 5 ++++- drivers/gpu/drm/vc4/vc4_drv.h | 14 ++++++++++++++ drivers/gpu/drm/vc4/vc4_hvs.c | 7 +++++-- 3 files changed, 23 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +4 -1
@@ -713,8 +713,9 @@ static void vc4_crtc_handle_page_flip(stunsigned long flags;spin_lock_irqsave (&dev->event_lock, flags); +spin_lock (&vc4_crtc->irq_lock);if (vc4_crtc->event && - (vc4_state->mm.start ==HVS_READ (SCALER_DISPLACTX (chan)) || + (vc4_crtc->current_dlist ==HVS_READ (SCALER_DISPLACTX (chan)) || vc4_crtc->feeds_txp)) {drm_crtc_send_vblank_event (crtc, vc4_crtc->event); vc4_crtc->event =NULL ;
@@ -728,6 +729,7 @@ static void vc4_crtc_handle_page_flip(st*/ vc4_hvs_unmask_underrun (dev, chan); } +spin_unlock (&vc4_crtc->irq_lock);spin_unlock_irqrestore (&dev->event_lock, flags); }
@@ -1127,6 +1129,7 @@ int vc4_crtc_init(struct drm_device *drmreturn PTR_ERR (primary_plane); } +spin_lock_init (&vc4_crtc->irq_lock);drm_crtc_init_with_planes (drm, crtc, primary_plane,NULL , crtc_funcs,NULL );drm_crtc_helper_add (crtc, crtc_helper_funcs);
drivers/gpu/drm/vc4/vc4_drv.h +14 -0
@@ -500,6 +500,20 @@ struct vc4_crtc {* @feeds_txp: True if the CRTC feeds our writeback controller. */ bool feeds_txp; + +/** +* @irq_lock: Spinlock protecting the resources shared between +* the atomic code and our vblank handler. +*/ +spinlock_t irq_lock; + +/** +* @current_dlist: Start offset of the display list currently +* set in the HVS for that CRTC. Protected by @irq_lock, and +* copied in vc4_hvs_update_dlist() for the CRTC interrupt +* handler to have access to that value. +*/ +unsigned int current_dlist; }; static inline struct vc4_crtc *
drivers/gpu/drm/vc4/vc4_hvs.c +5 -2
@@ -365,10 +365,9 @@ static void vc4_hvs_update_dlist(structstruct vc4_dev *vc4 =to_vc4_dev (dev);struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc->state); +unsigned long flags;if (crtc->state->event) { -unsigned long flags; - crtc->state->event->pipe =drm_crtc_index (crtc);WARN_ON (drm_crtc_vblank_get (crtc) !=0 );
@@ -388,6 +387,10 @@ static void vc4_hvs_update_dlist(structHVS_WRITE (SCALER_DISPLISTX (vc4_state->assigned_channel), vc4_state->mm.start); } + +spin_lock_irqsave (&vc4_crtc->irq_lock, flags); + vc4_crtc->current_dlist = vc4_state->mm.start; +spin_unlock_irqrestore (&vc4_crtc->irq_lock, flags); } void vc4_hvs_atomic_enable(struct drm_crtc *crtc,
Greg Kroah-Hartman
maintainerPATCH 761/846 drm/vc4: crtc: Copy assigned channel to the CRTC
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
commit eeb6ab4639590130d25670204ab7b6011333d685 upstream.
Accessing the crtc->state pointer from outside the modesetting context is not allowed. We thus need to copy whatever we need from the KMS state to our structure in order to access it.
In VC4, a number of users of that pointers have crept in over the years, and the previous commits removed them all but the HVS channel a CRTC has been assigned.
Let's move this channel in struct vc4_crtc at atomic_begin() time, drop it from our private state structure, and remove our use of crtc->state from our vblank handler entirely.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 4 ++-- drivers/gpu/drm/vc4/vc4_drv.h | 9 +++++++++ drivers/gpu/drm/vc4/vc4_hvs.c | 12 ++++++++++++ drivers/gpu/drm/vc4/vc4_txp.c | 1 + 4 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +2 -2
@@ -708,8 +708,7 @@ static void vc4_crtc_handle_page_flip(ststruct drm_crtc *crtc = &vc4_crtc->base;struct drm_device *dev = crtc->dev;struct vc4_dev *vc4 =to_vc4_dev (dev); -struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc->state); -u32 chan = vc4_state->assigned_channel; +u32 chan = vc4_crtc->current_hvs_channel;unsigned long flags;spin_lock_irqsave (&dev->event_lock, flags);
@@ -955,6 +954,7 @@ static const struct drm_crtc_funcs vc4_cstatic const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { .mode_valid = vc4_crtc_mode_valid, .atomic_check = vc4_crtc_atomic_check, + .atomic_begin = vc4_hvs_atomic_begin, .atomic_flush = vc4_hvs_atomic_flush, .atomic_enable = vc4_crtc_atomic_enable, .atomic_disable = vc4_crtc_atomic_disable,
drivers/gpu/drm/vc4/vc4_drv.h +9 -0
@@ -514,6 +514,14 @@ struct vc4_crtc {* handler to have access to that value. */ unsigned int current_dlist; + +/** +* @current_hvs_channel: HVS channel currently assigned to the +* CRTC. Protected by @irq_lock, and copied in +* vc4_hvs_atomic_begin() for the CRTC interrupt handler to have +* access to that value. +*/ +unsigned int current_hvs_channel; }; static inline struct vc4_crtc *
@@ -926,6 +934,7 @@ extern struct platform_driver vc4_hvs_drvoid vc4_hvs_stop_channel (struct drm_device *dev,unsigned int output);int vc4_hvs_get_fifo_from_output (struct drm_device *dev,unsigned int output);int vc4_hvs_atomic_check (struct drm_crtc *crtc,struct drm_atomic_state *state); +void vc4_hvs_atomic_begin (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_disable (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_flush (struct drm_crtc *crtc,struct drm_atomic_state *state);
drivers/gpu/drm/vc4/vc4_hvs.c +12 -0
@@ -393,6 +393,18 @@ static void vc4_hvs_update_dlist(structspin_unlock_irqrestore (&vc4_crtc->irq_lock, flags); } +void vc4_hvs_atomic_begin (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc); +struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc->state); +unsigned long flags; + +spin_lock_irqsave (&vc4_crtc->irq_lock, flags); + vc4_crtc->current_hvs_channel = vc4_state->assigned_channel; +spin_unlock_irqrestore (&vc4_crtc->irq_lock, flags); +} +void vc4_hvs_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state) {
drivers/gpu/drm/vc4/vc4_txp.c +1 -0
@@ -435,6 +435,7 @@ static void vc4_txp_atomic_disable(strucstatic const struct drm_crtc_helper_funcs vc4_txp_crtc_helper_funcs = { .atomic_check = vc4_txp_atomic_check, + .atomic_begin = vc4_hvs_atomic_begin, .atomic_flush = vc4_hvs_atomic_flush, .atomic_enable = vc4_txp_atomic_enable, .atomic_disable = vc4_txp_atomic_disable,
Greg Kroah-Hartman
maintainerPATCH 762/846 arm64/bpf: Remove 128MB limit for BPF JIT programs
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
commit b89ddf4cca43f1269093942cf5c4e457fd45c335 upstream.
Commit 91fc957c9b1d ("arm64/bpf: don't allocate BPF JIT programs in module memory") restricts BPF JIT program allocation to a 128MB region to ensure BPF programs are still in branching range of each other. However this restriction should not apply to the aarch64 JIT, since BPF_JMP | BPF_CALL are implemented as a 64-bit move into a register and then a BLR instruction - which has the effect of being able to call anything without proximity limitation.
The practical reason to relax this restriction on JIT memory is that 128MB of JIT memory can be quickly exhausted, especially where PAGE_SIZE is 64KB - one page is needed per program. In cases where seccomp filters are applied to multiple VMs on VM launch - such filters are classic BPF but converted to BPF - this can severely limit the number of VMs that can be launched. In a world where we support BPF JIT always on, turning off the JIT isn't always an option either.
--- arch/arm64/include/asm/extable.h | 9 --------- arch/arm64/include/asm/memory.h | 5 +---- arch/arm64/kernel/traps.c | 2 +- arch/arm64/mm/ptdump.c | 2 -- arch/arm64/net/bpf_jit_comp.c | 7 ++----- 5 files changed, 4 insertions(+), 21 deletions(-)
arch/arm64/include/asm/extable.h +0 -9
@@ -22,15 +22,6 @@ struct exception_table_entry#define ARCH_HAS_RELATIVE_EXTABLE -static inline bool in_bpf_jit (struct pt_regs *regs) -{ -if (!IS_ENABLED (CONFIG_BPF_JIT )) -return false; - -return regs->pc >=BPF_JIT_REGION_START && - regs->pc <BPF_JIT_REGION_END ; -} -#ifdef CONFIG_BPF_JIT int arm64_bpf_fixup_exception (const struct exception_table_entry *ex,struct pt_regs *regs);
arch/arm64/include/asm/memory.h +1 -4
@@ -44,11 +44,8 @@#define _PAGE_OFFSET (va) (-(UL(1) << (va)))#define PAGE_OFFSET (_PAGE_OFFSET(VA_BITS))#define KIMAGE_VADDR (MODULES_END) -#define BPF_JIT_REGION_START (_PAGE_END(VA_BITS_MIN)) -#define BPF_JIT_REGION_SIZE (SZ_128M) -#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE)#define MODULES_END (MODULES_VADDR + MODULES_VSIZE) -#define MODULES_VADDR (BPF_JIT_REGION_END) +#define MODULES_VADDR (_PAGE_END(VA_BITS_MIN))#define MODULES_VSIZE (SZ_128M)#define VMEMMAP_START (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT)))#define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE)
arch/arm64/kernel/traps.c +1 -1
@@ -988,7 +988,7 @@ static struct break_hook bug_break_hookstatic int reserved_fault_handler (struct pt_regs *regs,unsigned int esr) {pr_err ("%s generated an invalid instruction at %pS!\n" , -in_bpf_jit (regs) ?"BPF JIT" :"Kernel text patching" , +"Kernel text patching" , (void *)instruction_pointer (regs));/* We cannot handle this */
arch/arm64/mm/ptdump.c +0 -2
@@ -41,8 +41,6 @@ static struct addr_marker address_marker { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, { KASAN_SHADOW_END, "Kasan shadow end" }, #endif - { BPF_JIT_REGION_START, "BPF start" }, - { BPF_JIT_REGION_END, "BPF end" }, { MODULES_VADDR, "Modules start" }, { MODULES_END, "Modules end" }, { VMALLOC_START, "vmalloc() area" },
arch/arm64/net/bpf_jit_comp.c +2 -5
@@ -1138,15 +1138,12 @@ out:u64 bpf_jit_alloc_exec_limit (void ) { -return BPF_JIT_REGION_SIZE ; +return VMALLOC_END -VMALLOC_START ; }void *bpf_jit_alloc_exec (unsigned long size) { -return __vmalloc_node_range (size,PAGE_SIZE ,BPF_JIT_REGION_START , -BPF_JIT_REGION_END ,GFP_KERNEL , -PAGE_KERNEL ,0 ,NUMA_NO_NODE , -__builtin_return_address (0 )); +return vmalloc (size); }void bpf_jit_free_exec (void *addr)
Greg Kroah-Hartman
maintainerPATCH 763/846 bpftool: Remove inclusion of utilities.mak from Makefiles
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
commit 48f5aef4c458c19ab337eed8c95a6486cc014aa3 upstream.
Bpftool's Makefile, and the Makefile for its documentation, both include scripts/utilities.mak, but they use none of the items defined in this file. Remove the includes.
--- tools/bpf/bpftool/Documentation/Makefile | 1 - tools/bpf/bpftool/Makefile | 1 - 2 files changed, 2 deletions(-)
tools/bpf/bpftool/Documentation/Makefile +0 -1
@@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../../scripts/Makefile.include -include ../../../scripts/utilities.mak INSTALL ?= install RM ?= rm -f
tools/bpf/bpftool/Makefile +0 -1
@@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../scripts/Makefile.include -include ../../scripts/utilities.mak ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR)))
Greg Kroah-Hartman
maintainerPATCH 764/846 bpftool: Fix indent in option lists in the documentation
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
commit 986dec18bbf41f50edc2e0aa4ac5ef8e0f64f328 upstream.
Mixed indentation levels in the lists of options in bpftool's documentation produces some unexpected results. For the "bpftool" man page, it prints a warning:
$ make -C bpftool.8
GEN bpftool.8
<stdin>:26: (ERROR/3) Unexpected indentation.For other pages, there is no warning, but it results in a line break appearing in the option lists in the generated man pages.
RST paragraphs should have a uniform indentation level. Let's fix it.
--- tools/bpf/bpftool/Documentation/bpftool-btf.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-cgroup.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-gen.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-link.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-map.rst | 6 +++--- tools/bpf/bpftool/Documentation/bpftool-prog.rst | 8 ++++---- tools/bpf/bpftool/Documentation/bpftool.rst | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-)
tools/bpf/bpftool/Documentation/bpftool-btf.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **btf** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | {**-d** | **--debug** } | - { **-B** | **--base-btf** } } + { **-B** | **--base-btf** } } *COMMANDS* := { **dump** | **help** }
tools/bpf/bpftool/Documentation/bpftool-cgroup.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **cgroup** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } } + { **-f** | **--bpffs** } } *COMMANDS* := { **show** | **list** | **tree** | **attach** | **detach** | **help** }
tools/bpf/bpftool/Documentation/bpftool-gen.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **gen** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-L** | **--use-loader** } } + { **-L** | **--use-loader** } } *COMMAND* := { **object** | **skeleton** | **help** }
tools/bpf/bpftool/Documentation/bpftool-link.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **link** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-n** | **--nomount** } } + { **-f** | **--bpffs** } | { **-n** | **--nomount** } } *COMMANDS* := { **show** | **list** | **pin** | **help** }
tools/bpf/bpftool/Documentation/bpftool-map.rst +3 -3
@@ -13,11 +13,11 @@ SYNOPSIS **bpftool** [*OPTIONS*] **map** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-n** | **--nomount** } } + { **-f** | **--bpffs** } | { **-n** | **--nomount** } } *COMMANDS* := - { **show** | **list** | **create** | **dump** | **update** | **lookup** | **getnext** - | **delete** | **pin** | **help** } + { **show** | **list** | **create** | **dump** | **update** | **lookup** | **getnext** | + **delete** | **pin** | **help** } MAP COMMANDS =============
tools/bpf/bpftool/Documentation/bpftool-prog.rst +4 -4
@@ -13,12 +13,12 @@ SYNOPSIS **bpftool** [*OPTIONS*] **prog** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-m** | **--mapcompat** } | { **-n** | **--nomount** } | - { **-L** | **--use-loader** } } + { **-f** | **--bpffs** } | { **-m** | **--mapcompat** } | { **-n** | **--nomount** } | + { **-L** | **--use-loader** } } *COMMANDS* := - { **show** | **list** | **dump xlated** | **dump jited** | **pin** | **load** - | **loadall** | **help** } + { **show** | **list** | **dump xlated** | **dump jited** | **pin** | **load** | + **loadall** | **help** } PROG COMMANDS =============
tools/bpf/bpftool/Documentation/bpftool.rst +3 -3
@@ -19,14 +19,14 @@ SYNOPSIS *OBJECT* := { **map** | **program** | **cgroup** | **perf** | **net** | **feature** } *OPTIONS* := { { **-V** | **--version** } | - { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } } + { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } } *MAP-COMMANDS* := { **show** | **list** | **create** | **dump** | **update** | **lookup** | **getnext** | - **delete** | **pin** | **event_pipe** | **help** } + **delete** | **pin** | **event_pipe** | **help** } *PROG-COMMANDS* := { **show** | **list** | **dump jited** | **dump xlated** | **pin** | - **load** | **attach** | **detach** | **help** } + **load** | **attach** | **detach** | **help** } *CGROUP-COMMANDS* := { **show** | **list** | **attach** | **detach** | **help** }
Greg Kroah-Hartman
maintainerPATCH 765/846 xdp: check prog type before updating BPF link
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
commit 382778edc8262b7535f00523e9eb22edba1b9816 upstream.
The bpf_xdp_link_update() function didn't check the program type before updating the program, which made it possible to install any program type as an XDP program, which is obviously not good. Syzbot managed to trigger this by swapping in an LWT program on the XDP hook which would crash in a helper call.
Fix this by adding a check and bailing out if the types don't match.
--- net/core/dev.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/core/dev.c +6 -0
@@ -9636,6 +9636,12 @@ static int bpf_xdp_link_update(struct bp goto out_unlock; } old_prog = link->prog; +if (old_prog->type != new_prog->type || + old_prog->expected_attach_type != new_prog->expected_attach_type) { + err = -EINVAL ; + goto out_unlock; + } +if (old_prog == new_prog) {/* no-op, don't disturb drivers */ bpf_prog_put (new_prog);
Greg Kroah-Hartman
maintainerPATCH 766/846 bpf: Fix mount source show for bpffs
In reply to Greg Kroah-HartmanFrom: Yafang Shao <[email protected]>
commit 1e9d74660d4df625b0889e77018f9e94727ceacd upstream.
We noticed our tc ebpf tools can't start after we upgrade our in-house kernel version from 4.19 to 5.10. That is because of the behaviour change in bpffs caused by commit d2935de7e4fd ("vfs: Convert bpf to use the new mount API").
In our tc ebpf tools, we do strict environment check. If the environment is not matched, we won't allow to start the ebpf progs. One of the check is whether bpffs is properly mounted. The mount information of bpffs in kernel-4.19 and kernel-5.10 are as follows:
- kernel 4.19
$ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf bpffs on /sys/fs/bpf type bpf (rw,relatime)
- kernel 5.10
$ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf none on /sys/fs/bpf type bpf (rw,relatime)
The device name in kernel-5.10 is displayed as none instead of bpffs, then our environment check fails. Currently we modify the tools to adopt to the kernel behaviour change, but I think we'd better change the kernel code to keep the behavior consistent.
After this change, the mount information will be displayed the same with the behavior in kernel-4.19, for example:
$ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf bpffs on /sys/fs/bpf type bpf (rw,relatime)
--- kernel/bpf/inode.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
kernel/bpf/inode.c +12 -2
@@ -648,12 +648,22 @@ static int bpf_parse_param(struct fs_conint opt; opt =fs_parse (fc, bpf_fs_parameters, param, &result); -if (opt <0 ) +if (opt <0 ) {/* We might like to report bad mount options here, but * traditionally we've ignored all mount options, so we'd * better continue to ignore non-existing options for bpf. */ -return opt == -ENOPARAM ?0 : opt; +if (opt == -ENOPARAM ) { + opt =vfs_parse_fs_param_source (fc, param); +if (opt != -ENOPARAM ) +return opt; + +return 0 ; + } + +if (opt <0 ) +return opt; + }switch (opt) {case OPT_MODE :
Greg Kroah-Hartman
maintainerPATCH 767/846 bpf: Mark PTR_TO_FUNC register initially with zero offset
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit d400a6cf1c8a57cdf10f35220ead3284320d85ff upstream.
Similar as with other pointer types where we use ldimm64, clear the register content to zero first, and then populate the PTR_TO_FUNC type and subprogno number. Currently this is not done, and leads to reuse of stale register tracking data.
Given for special ldimm64 cases we always clear the register offset, make it common for all cases, so it won't be forgotten in future.
--- kernel/bpf/verifier.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/verifier.c +6 -3
@@ -9199,9 +9199,13 @@ static int check_ld_imm(struct bpf_verifreturn 0 ; } -if (insn->src_reg ==BPF_PSEUDO_BTF_ID ) { -mark_reg_known_zero (env, regs, insn->dst_reg); +/* All special src_reg cases are listed below. From this point onwards +* we either succeed and assign a corresponding dst_reg->type after +* zeroing the offset, or fail and reject the program. +*/ +mark_reg_known_zero (env, regs, insn->dst_reg); +if (insn->src_reg ==BPF_PSEUDO_BTF_ID ) { dst_reg->type = aux->btf_var.reg_type;switch (dst_reg->type) {case PTR_TO_MEM :
@@ -9238,7 +9242,6 @@ static int check_ld_imm(struct bpf_verif } map = env->used_maps[aux->map_index]; -mark_reg_known_zero (env, regs, insn->dst_reg); dst_reg->map_ptr = map; if (insn->src_reg == BPF_PSEUDO_MAP_VALUE ||
Greg Kroah-Hartman
maintainerPATCH 768/846 perf evsel: Override attr->sample_period for non-libpfm4 events
In reply to Greg Kroah-HartmanFrom: German Gomez <[email protected]>
commit 3606c0e1a1050d397ad759a62607e419fd8b0ccb upstream.
A previous patch preventing "attr->sample_period" values from being overridden in pfm events changed a related behaviour in arm-spe.
Before said patch:
perf record -c 10000 -e arm_spe_0// -- sleep 1
Would yield an SPE event with period=10000. After the patch, the period in "-c 10000" was being ignored because the arm-spe code initializes sample_period to a non-zero value.
This patch restores the previous behaviour for non-libpfm4 events.
--- tools/perf/util/evsel.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
tools/perf/util/evsel.c +17 -8
@@ -1047,6 +1047,17 @@ void __weak arch_evsel__set_sample_weighevsel__set_sample_bit (evsel,WEIGHT ); } +static void evsel__set_default_freq_period (struct record_opts *opts, +struct perf_event_attr *attr) +{ +if (opts->freq) { + attr->freq =1 ; + attr->sample_freq = opts->freq; + }else { + attr->sample_period = opts->default_interval; + } +} +/* * The enable_on_exec/disabled value strategy: *
@@ -1113,14 +1124,12 @@ void evsel__config(struct evsel *evsel,* We default some events to have a default interval. But keep * it a weak assumption overridable by the user. */ -if (!attr->sample_period) { -if (opts->freq) { - attr->freq =1 ; - attr->sample_freq = opts->freq; - }else { - attr->sample_period = opts->default_interval; - } - } +if ((evsel->is_libpfm_event && !attr->sample_period) || + (!evsel->is_libpfm_event && (!attr->sample_period || + opts->user_freq !=UINT_MAX || + opts->user_interval !=ULLONG_MAX ))) +evsel__set_default_freq_period (opts, attr); +/* * If attr->freq was set (here or earlier), ask for period * to be sampled.
Greg Kroah-Hartman
maintainerPATCH 769/846 ipv4: update fib_info_cnt under spinlock protection
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 0a6e6b3c7db6c34e3d149f09cd714972f8753e3f upstream.
In the past, free_fib_info() was supposed to be called under RTNL protection.
This eventually was no longer the case.
Instead of enforcing RTNL it seems we simply can move fib_info_cnt changes to occur when fib_info_lock is held.
v2: David Laight suggested to update fib_info_cnt only when an entry is added/deleted to/from the hash table, as fib_info_cnt is used to make sure hash table size is optimal.
BUG: KCSAN: data-race in fib_create_info / free_fib_info
write to 0xffffffff86e243a0 of 4 bytes by task 26429 on cpu 0:
fib_create_info+0xe78/0x3440 net/ipv4/fib_semantics.c:1428 fib_table_insert+0x148/0x10c0 net/ipv4/fib_trie.c:1224 fib_magic+0x195/0x1e0 net/ipv4/fib_frontend.c:1087 fib_add_ifaddr+0xd0/0x2e0 net/ipv4/fib_frontend.c:1109 fib_netdev_event+0x178/0x510 net/ipv4/fib_frontend.c:1466 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x53/0xb0 kernel/notifier.c:391 __dev_notify_flags+0x1d3/0x3b0 dev_change_flags+0xa2/0xc0 net/core/dev.c:8872 do_setlink+0x810/0x2410 net/core/rtnetlink.c:2719 rtnl_group_changelink net/core/rtnetlink.c:3242 [inline] __rtnl_newlink net/core/rtnetlink.c:3396 [inline] rtnl_newlink+0xb10/0x13b0 net/core/rtnetlink.c:3506 rtnetlink_rcv_msg+0x745/0x7e0 net/core/rtnetlink.c:5571 netlink_rcv_skb+0x14e/0x250 net/netlink/af_netlink.c:2496 rtnetlink_rcv+0x18/0x20 net/core/rtnetlink.c:5589 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x5fc/0x6c0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x726/0x840 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmsg+0x195/0x230 net/socket.c:2492 __do_sys_sendmsg net/socket.c:2501 [inline] __se_sys_sendmsg net/socket.c:2499 [inline] __x64_sys_sendmsg+0x42/0x50 net/socket.c:2499 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffffffff86e243a0 of 4 bytes by task 31505 on cpu 1:
free_fib_info+0x35/0x80 net/ipv4/fib_semantics.c:252 fib_info_put include/net/ip_fib.h:575 [inline] nsim_fib4_rt_destroy drivers/net/netdevsim/fib.c:294 [inline] nsim_fib4_rt_replace drivers/net/netdevsim/fib.c:403 [inline] nsim_fib4_rt_insert drivers/net/netdevsim/fib.c:431 [inline] nsim_fib4_event drivers/net/netdevsim/fib.c:461 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:881 [inline] nsim_fib_event_work+0x15ca/0x2cf0 drivers/net/netdevsim/fib.c:1477 process_one_work+0x3fc/0x980 kernel/workqueue.c:2298 process_scheduled_works kernel/workqueue.c:2361 [inline] worker_thread+0x7df/0xa70 kernel/workqueue.c:2447 kthread+0x2c7/0x2e0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30
value changed: 0x00000d2d -> 0x00000d2e
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 31505 Comm: kworker/1:21 Not tainted 5.16.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events nsim_fib_event_work
--- net/ipv4/fib_semantics.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
net/ipv4/fib_semantics.c +8 -3
@@ -249,7 +249,6 @@ void free_fib_info(struct fib_info *fi)pr_warn ("Freeing alive fib_info %p\n" , fi);return ; } - fib_info_cnt--;call_rcu (&fi->rcu, free_fib_info_rcu); }
@@ -260,6 +259,10 @@ void fib_release_info(struct fib_info *fspin_lock_bh (&fib_info_lock);if (fi &&refcount_dec_and_test (&fi->fib_treeref)) {hlist_del (&fi->fib_hash); + +/* Paired with READ_ONCE() in fib_create_info(). */ +WRITE_ONCE (fib_info_cnt, fib_info_cnt -1 ); +if (fi->fib_prefsrc)hlist_del (&fi->fib_lhash);if (fi->nh) {
@@ -1430,7 +1433,9 @@ struct fib_info *fib_create_info(struct#endif err = -ENOBUFS ; -if (fib_info_cnt >= fib_info_hash_size) { + +/* Paired with WRITE_ONCE() in fib_release_info() */ +if (READ_ONCE (fib_info_cnt) >= fib_info_hash_size) {unsigned int new_size = fib_info_hash_size <<1 ;struct hlist_head *new_info_hash;struct hlist_head *new_laddrhash;
@@ -1462,7 +1467,6 @@ struct fib_info *fib_create_info(structreturn ERR_PTR (err); } - fib_info_cnt++; fi->fib_net = net; fi->fib_protocol = cfg->fc_protocol; fi->fib_scope = cfg->fc_scope;
@@ -1589,6 +1593,7 @@ link_it:refcount_set (&fi->fib_treeref,1 );refcount_set (&fi->fib_clntref,1 );spin_lock_bh (&fib_info_lock); + fib_info_cnt++;hlist_add_head (&fi->fib_hash, &fib_info_hash[fib_info_hashfn (fi)]);if (fi->fib_prefsrc) {
Greg Kroah-Hartman
maintainerPATCH 770/846 ipv4: avoid quadratic behavior in netns dismantle
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit d07418afea8f1d9896aaf9dc5ae47ac4f45b220c upstream.
net/ipv4/fib_semantics.c uses an hash table of 256 slots, keyed by device ifindexes: fib_info_devhash[DEVINDEX_HASHSIZE]
Problem is that with network namespaces, devices tend to use the same ifindex.
lo device for instance has a fixed ifindex of one, for all network namespaces.
This means that hosts with thousands of netns spend a lot of time looking at some hash buckets with thousands of elements, notably at netns dismantle.
Simply add a per netns perturbation (net_hash_mix()) to spread elements more uniformely.
Also change fib_devindex_hashfn() to use more entropy.
--- net/ipv4/fib_semantics.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-)
net/ipv4/fib_semantics.c +17 -19
@@ -29,6 +29,7 @@#include <linux/init.h> #include <linux/slab.h> #include <linux/netlink.h> +#include <linux/hash.h> #include <net/arp.h> #include <net/ip.h>
@@ -319,11 +320,15 @@ static inline int nh_comp(struct fib_infstatic inline unsigned int fib_devindex_hashfn (unsigned int val) { -unsigned int mask =DEVINDEX_HASHSIZE -1 ; +return hash_32 (val,DEVINDEX_HASHBITS ); +} + +static struct hlist_head * +fib_info_devhash_bucket (const struct net_device *dev) +{ +u32 val =net_hash_mix (dev_net (dev)) ^ dev->ifindex; -return (val ^ - (val >>DEVINDEX_HASHBITS ) ^ - (val >> (DEVINDEX_HASHBITS *2 ))) & mask; +return &fib_info_devhash[fib_devindex_hashfn (val)]; } static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope,
@@ -433,12 +438,11 @@ int ip_fib_check_default(__be32 gw, stru {struct hlist_head *head;struct fib_nh *nh; -unsigned int hash;spin_lock (&fib_info_lock); - hash =fib_devindex_hashfn (dev->ifindex); - head = &fib_info_devhash[hash]; + head =fib_info_devhash_bucket (dev); +hlist_for_each_entry (nh, head, nh_hash) { if (nh->fib_nh_dev == dev && nh->fib_nh_gw4 == gw &&
@@ -1607,12 +1611,10 @@ link_it: }else {change_nexthops (fi) {struct hlist_head *head; -unsigned int hash;if (!nexthop_nh->fib_nh_dev)continue ; - hash =fib_devindex_hashfn (nexthop_nh->fib_nh_dev->ifindex); - head = &fib_info_devhash[hash]; + head =fib_info_devhash_bucket (nexthop_nh->fib_nh_dev);hlist_add_head (&nexthop_nh->nh_hash, head); } endfor_nexthops(fi) }
@@ -1964,8 +1966,7 @@ void fib_nhc_update_mtu(struct fib_nh_covoid fib_sync_mtu (struct net_device *dev,u32 orig_mtu) { -unsigned int hash =fib_devindex_hashfn (dev->ifindex); -struct hlist_head *head = &fib_info_devhash[hash]; +struct hlist_head *head =fib_info_devhash_bucket (dev);struct fib_nh *nh;hlist_for_each_entry (nh, head, nh_hash) {
@@ -1984,12 +1985,11 @@ void fib_sync_mtu(struct net_device *dev*/ int fib_sync_down_dev (struct net_device *dev,unsigned long event,bool force) { -int ret =0 ; -int scope =RT_SCOPE_NOWHERE ; +struct hlist_head *head =fib_info_devhash_bucket (dev);struct fib_info *prev_fi =NULL ; -unsigned int hash =fib_devindex_hashfn (dev->ifindex); -struct hlist_head *head = &fib_info_devhash[hash]; +int scope =RT_SCOPE_NOWHERE ;struct fib_nh *nh; +int ret =0 ;if (force) scope =-1 ;
@@ -2134,7 +2134,6 @@ out:int fib_sync_up (struct net_device *dev,unsigned char nh_flags) {struct fib_info *prev_fi; -unsigned int hash;struct hlist_head *head;struct fib_nh *nh;int ret;
@@ -2150,8 +2149,7 @@ int fib_sync_up(struct net_device *dev, } prev_fi =NULL ; - hash =fib_devindex_hashfn (dev->ifindex); - head = &fib_info_devhash[hash]; + head =fib_info_devhash_bucket (dev); ret =0 ;hlist_for_each_entry (nh, head, nh_hash) {
Greg Kroah-Hartman
maintainerPATCH 771/846 mlx5: Dont accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit 48d67543e01d73292e0bb66d3f10fc422e79e031 upstream.
Mask the ECN bits before calling mlx5e_route_lookup_ipv4_get(). The tunnel key might have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope).
Found by code inspection, compile tested only.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +3 -2
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* Copyright (c) 2018 Mellanox Technologies. */ +#include <net/inet_ecn.h> #include <net/vxlan.h> #include <net/gre.h> #include <net/geneve.h>
@@ -229,7 +230,7 @@ int mlx5e_tc_tun_create_header_ipv4(struint err;/* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos; + attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK ; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl;
@@ -344,7 +345,7 @@ int mlx5e_tc_tun_update_header_ipv4(struint err;/* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos; + attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK ; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl;
Greg Kroah-Hartman
maintainerPATCH 772/846 net/fsl: xgmac_mdio: Add workaround for erratum A-009885
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
commit 6198c722019774d38018457a8bfb9ba3ed8c931e upstream.
Once an MDIO read transaction is initiated, we must read back the data register within 16 MDC cycles after the transaction completes. Outside of this window, reads may return corrupt data.
Therefore, disable local interrupts in the critical section, to maximize the probability that we can satisfy this requirement.
--- drivers/net/ethernet/freescale/xgmac_mdio.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/xgmac_mdio.c +19 -6
@@ -52,6 +52,7 @@ struct tgec_mdio_controller {struct mdio_fsl_priv {struct tgec_mdio_controller __iomem *mdio_base;bool is_little_endian; +bool has_a009885;bool has_a011043; };
@@ -187,10 +188,10 @@ static int xgmac_mdio_read(struct mii_bu {struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;struct tgec_mdio_controller __iomem *regs = priv->mdio_base; +unsigned long flags;uint16_t dev_addr;uint32_t mdio_stat;uint32_t mdio_ctl; -uint16_t value;int ret;bool endian = priv->is_little_endian;
@@ -222,12 +223,18 @@ static int xgmac_mdio_read(struct mii_bureturn ret; } +if (priv->has_a009885) +/* Once the operation completes, i.e. MDIO_STAT_BSY clears, we +* must read back the data register within 16 MDC cycles. +*/ +local_irq_save (flags); +/* Initiate the read */ xgmac_write32 (mdio_ctl |MDIO_CTL_READ , ®s->mdio_ctl, endian); ret =xgmac_wait_until_done (&bus->dev, regs, endian);if (ret) -return ret; + goto irq_restore;/* Return all Fs if nothing was there */ if ((xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) &&
@@ -235,13 +242,17 @@ static int xgmac_mdio_read(struct mii_budev_dbg (&bus->dev,"Error while reading PHY%d reg at %d.%hhu\n" , phy_id, dev_addr, regnum); -return 0xffff ; + ret =0xffff ; + }else { + ret =xgmac_read32 (®s->mdio_data, endian) &0xffff ; +dev_dbg (&bus->dev,"read %04x\n" , ret); } - value =xgmac_read32 (®s->mdio_data, endian) &0xffff ; -dev_dbg (&bus->dev,"read %04x\n" , value); +irq_restore: +if (priv->has_a009885) +local_irq_restore (flags); -return value; +return ret; }static int xgmac_mdio_probe (struct platform_device *pdev)
@@ -288,6 +299,8 @@ static int xgmac_mdio_probe(struct platf priv->is_little_endian =device_property_read_bool (&pdev->dev,"little-endian" ); + priv->has_a009885 =device_property_read_bool (&pdev->dev, +"fsl,erratum-a009885" ); priv->has_a011043 =device_property_read_bool (&pdev->dev,"fsl,erratum-a011043" );
Greg Kroah-Hartman
maintainerPATCH 773/846 net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
commit 3f7c239c7844d2044ed399399d97a5f1c6008e1b upstream.
As reported by sparse: In the remove path, the driver would attempt to unmap its own priv pointer - instead of the io memory that it mapped in probe.
--- drivers/net/ethernet/freescale/xgmac_mdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/xgmac_mdio.c +2 -1
@@ -332,9 +332,10 @@ err_ioremap:static int xgmac_mdio_remove (struct platform_device *pdev) {struct mii_bus *bus =platform_get_drvdata (pdev); +struct mdio_fsl_priv *priv = bus->priv;mdiobus_unregister (bus); -iounmap (bus->priv); +iounmap (priv->mdio_base);mdiobus_free (bus);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 774/846 parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit d24846a4246b6e61ecbd036880a4adf61681d241 upstream.
kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add():
If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.
Fix memory leak by calling kobject_put().
--- drivers/parisc/pdc_stable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/parisc/pdc_stable.c +3 -1
@@ -979,8 +979,10 @@ pdcs_register_pathentries(void) entry->kobj.kset = paths_kset; err =kobject_init_and_add (&entry->kobj, &ktype_pdcspath,NULL ,"%s" , entry->name); -if (err) +if (err) { +kobject_put (&entry->kobj);return err; + }/* kobject is now registered */ write_lock (&entry->rw_lock);
Greg Kroah-Hartman
maintainerPATCH 775/846 riscv: dts: microchip: mpfs: Drop empty chosen node
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
commit 53ef07326ad0d6ae7fefded22bc53b427d542761 upstream.
It does not make sense to have an (empty) chosen node in an SoC-specific .dtsi, as chosen is meant for system-specific configuration. It is already provided in microchip-mpfs-icicle-kit.dts anyway.
--- arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +0 -3
@@ -9,9 +9,6 @@ model = "Microchip PolarFire SoC"; compatible = "microchip,mpfs"; - chosen { - }; - cpus { #address-cells = <1>; #size-cells = <0>;
Greg Kroah-Hartman
maintainerPATCH 776/846 drm/vmwgfx: Remove explicit transparent hugepages support
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
commit bc701a28c74e78d7b5aa2b8628cb3608d4785d14 upstream.
Old versions of the svga device used to export virtual vram, handling of which was optimized on top of transparent hugepages support. Only very old devices (OpenGL 2.1 support and earlier) used this code and at this point performance differences are negligible.
Because the code requires very old hardware versions to run it has been largely untested and unused for a long time.
Furthermore removal of the ttm hugepages support in:
commit 0d979509539e ("drm/ttm: remove ttm_bo_vm_insert_huge()") broke the coherency mode in vmwgfx when running with hugepages.
--- drivers/gpu/drm/vmwgfx/Makefile | 1 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 drivers/gpu/drm/vmwgfx/vmwgfx_thp.c | 184 ------------------------------------ 4 files changed, 198 deletions(-) delete mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
drivers/gpu/drm/vmwgfx/Makefile +0 -1
@@ -12,6 +12,5 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr. vmwgfx_devcaps.o ttm_object.o ttm_memory.o vmwgfx_system_manager.o vmwgfx-$(CONFIG_DRM_FBDEV_EMULATION) += vmwgfx_fb.o -vmwgfx-$(CONFIG_TRANSPARENT_HUGEPAGE) += vmwgfx_thp.o obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0 -8
@@ -707,23 +707,15 @@ static int vmw_dma_masks(struct vmw_privstatic int vmw_vram_manager_init (struct vmw_private *dev_priv) {int ret; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - ret =vmw_thp_init (dev_priv); -#else ret =ttm_range_man_init (&dev_priv->bdev,TTM_PL_VRAM , false, dev_priv->vram_size >>PAGE_SHIFT ); -#endif ttm_resource_manager_set_used (ttm_manager_type (&dev_priv->bdev,TTM_PL_VRAM ), false);return ret; }static void vmw_vram_manager_fini (struct vmw_private *dev_priv) { -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -vmw_thp_fini (dev_priv); -#else ttm_range_man_fini (&dev_priv->bdev,TTM_PL_VRAM ); -#endif } static int vmw_setup_pci_resources(struct vmw_private *dev,
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +0 -5
@@ -1557,11 +1557,6 @@ void vmw_bo_dirty_unmap(struct vmw_buffevm_fault_t vmw_bo_vm_fault (struct vm_fault *vmf);vm_fault_t vmw_bo_vm_mkwrite (struct vm_fault *vmf); -/* Transparent hugepage support - vmwgfx_thp.c */ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -extern int vmw_thp_init (struct vmw_private *dev_priv); -void vmw_thp_fini (struct vmw_private *dev_priv); -#endif /** * VMW_DEBUG_KMS - Debug output for kernel mode-setting
drivers/gpu/drm/vmwgfx/vmwgfx_thp.c deleted +0 -184
184 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 777/846 drm/vmwgfx: Remove unused compile options
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
commit 50ca8cc7c0fdd9ab16b8b66ffb301fface101fac upstream.
Before the driver had screen targets support we had to disable explicit bringup of its infrastructure because it was breaking screen objects support.
Since the implementation of screen targets landed there hasn't been a reason to explicitly disable it and the options were never used. Remove of all that unused code.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 12 +++--------- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- 3 files changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +0 -3
@@ -59,11 +59,8 @@#define VMWGFX_DRIVER_MINOR 19#define VMWGFX_DRIVER_PATCHLEVEL 0#define VMWGFX_FIFO_STATIC_SIZE (1024*1024) -#define VMWGFX_MAX_RELOCATIONS 2048 -#define VMWGFX_MAX_VALIDATIONS 2048#define VMWGFX_MAX_DISPLAYS 16#define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 -#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1#define VMWGFX_PCI_ID_SVGA2 0x0405#define VMWGFX_PCI_ID_SVGA3 0x0406
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +3 -9
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 OR MIT /************************************************************************** * -* Copyright 2012-2015 VMware, Inc., Palo Alto, CA., USA +* Copyright 2012-2021 VMware, Inc., Palo Alto, CA., USA * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the
@@ -29,12 +29,6 @@#include "vmwgfx_drv.h" -/* -* If we set up the screen target otable, screen objects stop working. -*/ - -#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE ? 0 : 1)) -#ifdef CONFIG_64BIT #define VMW_PPN_SIZE 8#define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PT64_0
@@ -75,7 +69,7 @@ static const struct vmw_otable pre_dx_ta {VMWGFX_NUM_GB_CONTEXT * sizeof(SVGAOTableContextEntry), NULL, true}, {VMWGFX_NUM_GB_SHADER * sizeof(SVGAOTableShaderEntry), NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * sizeof(SVGAOTableScreenTargetEntry), - NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE} + NULL, true} }; static const struct vmw_otable dx_tables[] = {
@@ -84,7 +78,7 @@ static const struct vmw_otable dx_tables {VMWGFX_NUM_GB_CONTEXT * sizeof(SVGAOTableContextEntry), NULL, true}, {VMWGFX_NUM_GB_SHADER * sizeof(SVGAOTableShaderEntry), NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * sizeof(SVGAOTableScreenTargetEntry), - NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE}, + NULL, true}, {VMWGFX_NUM_DXCONTEXT * sizeof(SVGAOTableDXContextEntry), NULL, true}, };
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +2 -2
@@ -1872,8 +1872,8 @@ int vmw_kms_stdu_init_display(struct vmwint i, ret; -/* Do nothing if Screen Target support is turned off */ -if (!VMWGFX_ENABLE_SCREEN_TARGET_OTABLE || !dev_priv->has_mob) +/* Do nothing if there's no support for MOBs */ +if (!dev_priv->has_mob)return -ENOSYS ;if (!(dev_priv->capabilities &SVGA_CAP_GBOBJECTS ))
Greg Kroah-Hartman
maintainerPATCH 778/846 f2fs: fix remove page failed in invalidate compress pages
In reply to Greg Kroah-HartmanFrom: Fengnan Chang <[email protected]>
commit d1917865a7906baf6b687e15e8e6195a295a3992 upstream.
Since compress inode not a regular file, generic_error_remove_page in f2fs_invalidate_compress_pages will always be failed, set compress inode as a regular file to fix it.
--- fs/f2fs/inode.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/f2fs/inode.c +5 -0
@@ -516,6 +516,11 @@ make_now: }else if (ino ==F2FS_COMPRESS_INO (sbi)) {#ifdef CONFIG_F2FS_FS_COMPRESSION inode->i_mapping->a_ops = &f2fs_compress_aops; +/* +* generic_error_remove_page only truncates pages of regular +* inode +*/ + inode->i_mode |=S_IFREG ;#endif mapping_set_gfp_mask (inode->i_mapping,GFP_NOFS | __GFP_HIGHMEM | __GFP_MOVABLE);
Greg Kroah-Hartman
maintainerPATCH 779/846 f2fs: fix to avoid panic in is_alive() if metadata is inconsistent
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit f6db43076d190d9bf75559dec28e18b9d12e4ce5 upstream.
As report by Wenqing Liu in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=215231
If we enable CONFIG_F2FS_CHECK_FS config, and with fuzzed image attached in above link, we will encounter panic when executing below script:
1. mkdir mnt
2. mount -t f2fs tmp1.img mnt
3. touch tmp
F2FS-fs (loop11): mismatched blkaddr 5765 (source_blkaddr 1) in seg 3 kernel BUG at fs/f2fs/gc.c:1042!
do_garbage_collect+0x90f/0xa80 [f2fs] f2fs_gc+0x294/0x12a0 [f2fs] f2fs_balance_fs+0x2c5/0x7d0 [f2fs] f2fs_create+0x239/0xd90 [f2fs] lookup_open+0x45e/0xa90 open_last_lookups+0x203/0x670 path_openat+0xae/0x490 do_filp_open+0xbc/0x160 do_sys_openat2+0x2f1/0x500 do_sys_open+0x5e/0xa0 __x64_sys_openat+0x28/0x40
Previously, f2fs tries to catch data inconcistency exception in between SSA and SIT table during GC, however once the exception is caught, it will call f2fs_bug_on to hang kernel, it's not needed, instead, let's set SBI_NEED_FSCK flag and skip migrating current block.
--- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
@@ -1039,7 +1039,7 @@ static bool is_alive(struct f2fs_sb_infoif (!test_and_set_bit (segno,SIT_I (sbi)->invalid_segmap)) {f2fs_err (sbi,"mismatched blkaddr %u (source_blkaddr %u) in seg %u" , blkaddr, source_blkaddr, segno); -f2fs_bug_on (sbi,1 ); +set_sbi_flag (sbi,SBI_NEED_FSCK ); } }#endif
Greg Kroah-Hartman
maintainerPATCH 780/846 f2fs: compress: fix potential deadlock of compress file
In reply to Greg Kroah-HartmanFrom: Hyeong-Jun Kim <[email protected]>
commit 7377e853967ba45bf409e3b5536624d2cbc99f21 upstream.
There is a potential deadlock between writeback process and a process performing write_begin() or write_cache_pages() while trying to write same compress file, but not compressable, as below:
[Process A] - doing checkpoint
[Process B] [Process C]f2fs_write_cache_pages()
- lock_page() [all pages in cluster, 0-31]
- f2fs_write_multi_pages()
- f2fs_write_raw_pages()
- f2fs_write_single_data_page()
- f2fs_do_write_data_page()
- return -EAGAIN [f2fs_trylock_op() failed]
- unlock_page(page) [e.g., page 0]
- generic_perform_write()
- f2fs_write_begin()
- f2fs_prepare_compress_overwrite()
- prepare_compress_overwrite()
- lock_page() [e.g., page 0]
- lock_page() [e.g., page 1]
- lock_page(page) [e.g., page 0]
Since there is no compress process, it is no longer necessary to hold locks on every pages in cluster within f2fs_write_raw_pages().
This patch changes f2fs_write_raw_pages() to release all locks first and then perform write same as the non-compress file in f2fs_write_cache_pages().
--- fs/f2fs/compress.c | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-)
fs/f2fs/compress.c +22 -28
@@ -1448,25 +1448,38 @@ static int f2fs_write_raw_pages(struct c enum iostat_type io_type) {struct address_space *mapping = cc->inode->i_mapping; -int _submitted, compr_blocks, ret; -int i =-1 , err =0 ; +int _submitted, compr_blocks, ret, i; compr_blocks =f2fs_compressed_blocks (cc); -if (compr_blocks <0 ) { - err = compr_blocks; - goto out_err; + +for (i =0 ; i < cc->cluster_size; i++) { +if (!cc->rpages[i]) +continue ; + +redirty_page_for_writepage (wbc, cc->rpages[i]); +unlock_page (cc->rpages[i]); } +if (compr_blocks <0 ) +return compr_blocks; +for (i =0 ; i < cc->cluster_size; i++) {if (!cc->rpages[i])continue ; retry_write: +lock_page (cc->rpages[i]); +if (cc->rpages[i]->mapping != mapping) { +continue_unlock:unlock_page (cc->rpages[i]);continue ; } -BUG_ON (!PageLocked (cc->rpages[i])); +if (!PageDirty (cc->rpages[i])) + goto continue_unlock; + +if (!clear_page_dirty_for_io (cc->rpages[i])) + goto continue_unlock; ret = f2fs_write_single_data_page(cc->rpages[i], &_submitted, NULL, NULL, wbc, io_type,
@@ -1481,26 +1494,15 @@ retry_write:* avoid deadlock caused by cluster update race * from foreground operation. */ -if (IS_NOQUOTA (cc->inode)) { - err =0 ; - goto out_err; - } +if (IS_NOQUOTA (cc->inode)) +return 0 ; ret =0 ;cond_resched ();congestion_wait (BLK_RW_ASYNC ,DEFAULT_IO_TIMEOUT ); -lock_page (cc->rpages[i]); - -if (!PageDirty (cc->rpages[i])) { -unlock_page (cc->rpages[i]); -continue ; - } - -clear_page_dirty_for_io (cc->rpages[i]); goto retry_write; } - err = ret; - goto out_err; +return ret; } *submitted += _submitted;
@@ -1509,14 +1511,6 @@ retry_write:f2fs_balance_fs (F2FS_M_SB (mapping), true);return 0 ; -out_err: -for (++i; i < cc->cluster_size; i++) { -if (!cc->rpages[i]) -continue ; -redirty_page_for_writepage (wbc, cc->rpages[i]); -unlock_page (cc->rpages[i]); - } -return err; } int f2fs_write_multi_pages(struct compress_ctx *cc,
Greg Kroah-Hartman
maintainerPATCH 781/846 f2fs: fix to reserve space for IO align feature
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 300a842937fbcfb5a189cea9ba15374fdb0b5c6b upstream.
https://bugzilla.kernel.org/show_bug.cgi?id=204137
With below script, we will hit panic during new segment allocation:
DISK=bingo.img
MOUNT_DIR=/mnt/f2fs
dd if=/dev/zero of=$DISK bs=1M count=105
mkfs.f2fe -a 1 -o 19 -t 1 -z 1 -f -q $DISK
mount -t f2fs $DISK $MOUNT_DIR -o "noinline_dentry,flush_merge,noextent_cache,mode=lfs,io_bits=7,fsync_mode=strict"
for (( i = 0; i < 4096; i++ )); do
name=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10` mkdir $MOUNT_DIR/$name
done
umount $MOUNT_DIR
rm $DISK
--- fs/f2fs/f2fs.h | 11 +++++++++++ fs/f2fs/segment.h | 3 ++- fs/f2fs/super.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ fs/f2fs/sysfs.c | 4 +++- 4 files changed, 60 insertions(+), 2 deletions(-)
fs/f2fs/f2fs.h +11 -0
@@ -1012,6 +1012,7 @@ struct f2fs_sm_info {unsigned int segment_count;/* total # of segments */ unsigned int main_segments;/* # of segments in main area */ unsigned int reserved_segments;/* # of reserved segments */ +unsigned int additional_reserved_segments;/* reserved segs for IO align feature */ unsigned int ovp_segments;/* # of overprovision segments */ /* a threshold to reclaim prefree segments */
@@ -2184,6 +2185,11 @@ static inline int inc_valid_block_count(if (!__allow_reserved_blocks (sbi, inode, true)) avail_user_block_count -=F2FS_OPTION (sbi).root_reserved_blocks; + +if (F2FS_IO_ALIGNED (sbi)) + avail_user_block_count -= sbi->blocks_per_seg * +SM_I (sbi)->additional_reserved_segments; +if (unlikely (is_sbi_flag_set (sbi,SBI_CP_DISABLED ))) {if (avail_user_block_count > sbi->unusable_block_count) avail_user_block_count -= sbi->unusable_block_count;
@@ -2430,6 +2436,11 @@ static inline int inc_valid_node_count(sif (!__allow_reserved_blocks (sbi, inode, false)) valid_block_count +=F2FS_OPTION (sbi).root_reserved_blocks; + +if (F2FS_IO_ALIGNED (sbi)) + valid_block_count += sbi->blocks_per_seg * +SM_I (sbi)->additional_reserved_segments; + user_block_count = sbi->user_block_count;if (unlikely (is_sbi_flag_set (sbi,SBI_CP_DISABLED ))) user_block_count -= sbi->unusable_block_count;
fs/f2fs/segment.h +2 -1
@@ -537,7 +537,8 @@ static inline unsigned int free_segmentsstatic inline unsigned int reserved_segments (struct f2fs_sb_info *sbi) { -return SM_I (sbi)->reserved_segments; +return SM_I (sbi)->reserved_segments + +SM_I (sbi)->additional_reserved_segments; }static inline unsigned int free_sections (struct f2fs_sb_info *sbi)
fs/f2fs/super.c +44 -0
56 lines not on this page · raw message
fs/f2fs/sysfs.c +3 -1
@@ -415,7 +415,9 @@ out:if (a->struct_type ==RESERVED_BLOCKS ) {spin_lock (&sbi->stat_lock);if (t > (unsigned long )(sbi->user_block_count - -F2FS_OPTION (sbi).root_reserved_blocks)) { +F2FS_OPTION (sbi).root_reserved_blocks - + sbi->blocks_per_seg * +SM_I (sbi)->additional_reserved_segments)) {spin_unlock (&sbi->stat_lock);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 782/846 f2fs: fix to check available space of CP area correctly in update_ckpt_flags()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit b702c83e2eaa2fa2d72e957c55c0321535cc8b9f upstream.
Otherwise, nat_bit area may be persisted across boundary of CP area during nat_bit rebuilding.
--- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/checkpoint.c +2 -2
@@ -1305,8 +1305,8 @@ static void update_ckpt_flags(struct f2funsigned long flags;if (cpc->reason &CP_UMOUNT ) { -if (le32_to_cpu (ckpt->cp_pack_total_block_count) > - sbi->blocks_per_seg -NM_I (sbi)->nat_bits_blocks) { +if (le32_to_cpu (ckpt->cp_pack_total_block_count) + +NM_I (sbi)->nat_bits_blocks > sbi->blocks_per_seg) {clear_ckpt_flags (sbi,CP_NAT_BITS_FLAG );f2fs_notice (sbi,"Disable nat_bits due to no space" ); } else if (!is_set_ckpt_flags(sbi, CP_NAT_BITS_FLAG) &&
Greg Kroah-Hartman
maintainerPATCH 783/846 crypto: octeontx2 - uninitialized variable in kvf_limits_store()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 0ea275df84c389e910a3575a9233075118c173ee upstream.
If kstrtoint() fails then "lfs_num" is uninitialized and the warning doesn't make any sense. Just delete it.
--- drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +4 -5
@@ -494,12 +494,11 @@ static ssize_t kvf_limits_store(struct d {struct otx2_cptpf_dev *cptpf =dev_get_drvdata (dev);int lfs_num; +int ret; -if (kstrtoint (buf,0 , &lfs_num)) { -dev_err (dev,"lfs count %d must be in range [1 - %d]\n" , - lfs_num,num_online_cpus ()); -return -EINVAL ; - } + ret =kstrtoint (buf,0 , &lfs_num); +if (ret) +return ret;if (lfs_num <1 || lfs_num >num_online_cpus ()) {dev_err (dev,"lfs count %d must be in range [1 - %d]\n" , lfs_num,num_online_cpus ());
Greg Kroah-Hartman
maintainerPATCH 784/846 af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 9d6d7f1cb67cdee15f1a0e85aacfb924e0e02435 upstream.
wait_for_unix_gc() reads unix_tot_inflight & gc_in_progress without synchronization.
Adds READ_ONCE()/WRITE_ONCE() and their associated comments to better document the intent.
BUG: KCSAN: data-race in unix_inflight / wait_for_unix_gc
write to 0xffffffff86e2b7c0 of 4 bytes by task 9380 on cpu 0:
unix_inflight+0x1e8/0x260 net/unix/scm.c:63 unix_attach_fds+0x10c/0x1e0 net/unix/scm.c:121 unix_scm_to_skb net/unix/af_unix.c:1674 [inline] unix_dgram_sendmsg+0x679/0x16b0 net/unix/af_unix.c:1817 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffffffff86e2b7c0 of 4 bytes by task 9375 on cpu 1:
wait_for_unix_gc+0x24/0x160 net/unix/garbage.c:196 unix_dgram_sendmsg+0x8e/0x16b0 net/unix/af_unix.c:1772 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x00000002 -> 0x00000004
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 9375 Comm: syz-executor.1 Not tainted 5.16.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/unix/garbage.c | 14 +++++++++++--- net/unix/scm.c | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-)
net/unix/garbage.c +11 -3
@@ -192,8 +192,11 @@ void wait_for_unix_gc(void) {/* If number of inflight sockets is insane, * force a garbage collect right now. +* Paired with the WRITE_ONCE() in unix_inflight(), +* unix_notinflight() and gc_in_progress(). */ -if (unix_tot_inflight >UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) +if (READ_ONCE (unix_tot_inflight) >UNIX_INFLIGHT_TRIGGER_GC && + !READ_ONCE (gc_in_progress))unix_gc ();wait_event (unix_gc_wait, gc_in_progress == false); }
@@ -213,7 +216,9 @@ void unix_gc(void)if (gc_in_progress) goto out; - gc_in_progress = true; +/* Paired with READ_ONCE() in wait_for_unix_gc(). */ +WRITE_ONCE (gc_in_progress, true); +/* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones * which don't have any external reference.
@@ -299,7 +304,10 @@ void unix_gc(void)/* All candidates should have been detached by now. */ BUG_ON (!list_empty (&gc_candidates)); - gc_in_progress = false; + +/* Paired with READ_ONCE() in wait_for_unix_gc(). */ +WRITE_ONCE (gc_in_progress, false); +wake_up (&unix_gc_wait); out:
net/unix/scm.c +4 -2
@@ -60,7 +60,8 @@ void unix_inflight(struct user_struct *u }else {BUG_ON (list_empty (&u->link)); } - unix_tot_inflight++; +/* Paired with READ_ONCE() in wait_for_unix_gc() */ +WRITE_ONCE (unix_tot_inflight, unix_tot_inflight +1 ); } user->unix_inflight++;spin_unlock (&unix_gc_lock);
@@ -80,7 +81,8 @@ void unix_notinflight(struct user_structif (atomic_long_dec_and_test (&u->inflight))list_del_init (&u->link); - unix_tot_inflight--; +/* Paired with READ_ONCE() in wait_for_unix_gc() */ +WRITE_ONCE (unix_tot_inflight, unix_tot_inflight -1 ); } user->unix_inflight--;spin_unlock (&unix_gc_lock);
Greg Kroah-Hartman
maintainerPATCH 785/846 clk: Emit a stern warning with writable debugfs enabled
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
commit 489a71964f9d74e697a12cd0ace20ed829eb1f93 upstream.
We don't want vendors to be enabling this part of the clk code and shipping it to customers. Exposing the ability to change clk frequencies and parents via debugfs is potentially damaging to the system if folks don't know what they're doing. Emit a strong warning so that the message is clear: don't enable this outside of development systems.
--- drivers/clk/clk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/clk/clk.c +18 -0
@@ -3340,6 +3340,24 @@ static int __init clk_debug_init(void) {struct clk_core *core; +#ifdef CLOCK_ALLOW_WRITE_DEBUGFS +pr_warn ("\n" ); +pr_warn ("********************************************************************\n" ); +pr_warn ("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** This means that this kernel is built to expose clk operations **\n" ); +pr_warn ("** such as parent or rate setting, enabling, disabling, etc. **\n" ); +pr_warn ("** to userspace, which may compromise security on your system. **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** If you see this message and you are not debugging the **\n" ); +pr_warn ("** kernel, report this immediately to your vendor! **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n" ); +pr_warn ("********************************************************************\n" ); +#endif + rootdir =debugfs_create_dir ("clk" ,NULL ); debugfs_create_file("clk_summary", 0444, rootdir, &all_lists,
Greg Kroah-Hartman
maintainerPATCH 786/846 clk: si5341: Fix clock HW provider cleanup
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 49a8f2bc8d88702783c7e163ec84374e9a022f71 upstream.
The call to of_clk_add_hw_provider was not undone on remove or on probe failure, which could cause an oops on a subsequent attempt to retrieve clocks for the removed device. Switch to the devm version of the function to avoid this issue.
--- drivers/clk/clk-si5341.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-si5341.c +1 -1
@@ -1740,7 +1740,7 @@ static int si5341_probe(struct i2c_clienclk_prepare (data->clk[i].hw.clk); } - err =of_clk_add_hw_provider (client->dev.of_node, of_clk_si5341_get, + err =devm_of_clk_add_hw_provider (&client->dev, of_clk_si5341_get, data);if (err) {dev_err (&client->dev,"unable to add clk provider\n" );
Greg Kroah-Hartman
maintainerPATCH 787/846 pinctrl/rockchip: fix gpio device creation
In reply to Greg Kroah-HartmanFrom: John Keeping <[email protected]>
commit bceb6732f3fd2a55d8f2e518cced1c7555e216b6 upstream.
GPIO nodes are not themselves busses, so passing rockchip_bank_match here is wrong. Passing NULL instead uses the standard bus match table which is more appropriate.
devm_of_platform_populate() shows that this is the normal way to call of_platform_populate() from a device driver, so in order to match that more closely also add the pinctrl device as the parent for the newly created GPIO controllers.
Specifically, using the wrong match here can break dynamic GPIO hogs as marking the GPIO bank as a bus means that of_platform_notify() will set OF_POPULATED on new child nodes and if this happens before of_gpio_notify() is called then the new hog will be skipped as OF_POPULATED is already set.
--- drivers/pinctrl/pinctrl-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-rockchip.c +1 -1
@@ -2748,7 +2748,7 @@ static int rockchip_pinctrl_probe(structplatform_set_drvdata (pdev, info); - ret =of_platform_populate (np, rockchip_bank_match,NULL ,NULL ); + ret =of_platform_populate (np,NULL ,NULL , &pdev->dev);if (ret) {dev_err (&pdev->dev,"failed to register gpio device\n" );return ret;
Greg Kroah-Hartman
maintainerPATCH 788/846 gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 0b39536cc699db6850c426db7f9cb45923de40c5 upstream.
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/gpio/gpio-mpc8xxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mpc8xxx.c +2 -2
@@ -388,8 +388,8 @@ static int mpc8xxx_probe(struct platform } mpc8xxx_gc->irqn =platform_get_irq (pdev,0 ); -if (!mpc8xxx_gc->irqn) -return 0 ; +if (mpc8xxx_gc->irqn <0 ) +return mpc8xxx_gc->irqn; mpc8xxx_gc->irq = irq_domain_create_linear(fwnode, MPC8XXX_GPIO_PINS,
Greg Kroah-Hartman
maintainerPATCH 789/846 gpio: idt3243x: Fix IRQ check in idt_gpio_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 30fee1d7462a446ade399c0819717a830cbdca69 upstream.
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/gpio/gpio-idt3243x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-idt3243x.c +2 -2
@@ -164,8 +164,8 @@ static int idt_gpio_probe(struct platforreturn PTR_ERR (ctrl->pic); parent_irq =platform_get_irq (pdev,0 ); -if (!parent_irq) -return -EINVAL ; +if (parent_irq <0 ) +return parent_irq; girq = &ctrl->gc.irq; girq->chip = &idt_gpio_irqchip;
Greg Kroah-Hartman
maintainerPATCH 790/846 net/smc: Fix hung_task when removing SMC-R devices
In reply to Greg Kroah-HartmanFrom: Wen Gu <[email protected]>
commit 56d99e81ecbc997a5f984684d0eeb583992b2072 upstream.
A hung_task is observed when removing SMC-R devices. Suppose that a link group has two active links(lnk_A, lnk_B) associated with two different SMC-R devices(dev_A, dev_B). When dev_A is removed, the link group will be removed from smc_lgr_list and added into lgr_linkdown_list. lnk_A will be cleared and smcibdev(A)->lnk_cnt will reach to zero. However, when dev_B is removed then, the link group can't be found in smc_lgr_list and lnk_B won't be cleared, making smcibdev->lnk_cnt never reaches zero, which causes a hung_task.
This patch fixes this issue by restoring the implementation of smc_smcr_terminate_all() to what it was before commit 349d43127dac ("net/smc: fix kernel panic caused by race of smc_sock"). The original implementation also satisfies the intention that make sure QP destroy earlier than CQ destroy because we will always wait for smcibdev->lnk_cnt reaches zero, which guarantees QP has been destroyed.
--- net/smc/smc_core.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
net/smc/smc_core.c +1 -16
@@ -1387,16 +1387,11 @@ void smc_smcd_terminate_all(struct smcd_/* Called when an SMCR device is removed or the smc module is unloaded. * If smcibdev is given, all SMCR link groups using this device are terminated. * If smcibdev is NULL, all SMCR link groups are terminated. -* -* We must wait here for QPs been destroyed before we destroy the CQs, -* or we won't received any CQEs and cdc_pend_tx_wr cannot reach 0 thus -* smc_sock cannot be released. */ void smc_smcr_terminate_all (struct smc_ib_device *smcibdev) {struct smc_link_group *lgr, *lg;LIST_HEAD (lgr_free_list); -LIST_HEAD (lgr_linkdown_list);int i;spin_lock_bh (&smc_lgr_list.lock);
@@ -1408,7 +1403,7 @@ void smc_smcr_terminate_all(struct smc_ilist_for_each_entry_safe (lgr, lg, &smc_lgr_list.list, list) {for (i =0 ; i <SMC_LINKS_PER_LGR_MAX ; i++) {if (lgr->lnk[i].smcibdev == smcibdev) -list_move_tail (&lgr->list, &lgr_linkdown_list); +smcr_link_down_cond_sched (&lgr->lnk[i]); } } }
@@ -1420,16 +1415,6 @@ void smc_smcr_terminate_all(struct smc_i__smc_lgr_terminate (lgr, false); } -list_for_each_entry_safe (lgr, lg, &lgr_linkdown_list, list) { -for (i =0 ; i <SMC_LINKS_PER_LGR_MAX ; i++) { -if (lgr->lnk[i].smcibdev == smcibdev) { -mutex_lock (&lgr->llc_conf_mutex); -smcr_link_down_cond (&lgr->lnk[i]); -mutex_unlock (&lgr->llc_conf_mutex); - } - } - } -if (smcibdev) {if (atomic_read (&smcibdev->lnk_cnt)) wait_event(smcibdev->lnks_deleted,
Greg Kroah-Hartman
maintainerPATCH 791/846 net: axienet: increase reset timeout
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 2e5644b1bab2ccea9cfc7a9520af95b94eb0dbf1 upstream.
The previous timeout of 1ms was too short to handle some cases where the core is reset just after the input clocks were started, which will be introduced in an upcoming patch. Increase the timeout to 50ms. Also simplify the reset timeout checking to use read_poll_timeout.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +9 -10
@@ -496,7 +496,8 @@ static void axienet_setoptions(struct nestatic int __axienet_device_reset (struct axienet_local *lp) { -u32 timeout; +u32 value; +int ret;/* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset * process of Axi DMA takes a while to complete as all pending
@@ -506,15 +507,13 @@ static int __axienet_device_reset(struct* they both reset the entire DMA core, so only one needs to be used. */ axienet_dma_out32 (lp,XAXIDMA_TX_CR_OFFSET ,XAXIDMA_CR_RESET_MASK ); - timeout =DELAY_OF_ONE_MILLISEC ; -while (axienet_dma_in32 (lp,XAXIDMA_TX_CR_OFFSET ) & -XAXIDMA_CR_RESET_MASK ) { -udelay (1 ); -if (--timeout ==0 ) { -netdev_err (lp->ndev,"%s: DMA reset timeout!\n" , - __func__); -return -ETIMEDOUT ; - } + ret =read_poll_timeout (axienet_dma_in32, value, + !(value &XAXIDMA_CR_RESET_MASK ), +DELAY_OF_ONE_MILLISEC ,50000 , false, lp, +XAXIDMA_TX_CR_OFFSET ); +if (ret) { +dev_err (lp->dev,"%s: DMA reset timeout!\n" , __func__); +return ret; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 792/846 net: axienet: Wait for PhyRstCmplt after core reset
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit b400c2f4f4c53c86594dd57098970d97d488bfde upstream.
When resetting the device, wait for the PhyRstCmplt bit to be set in the interrupt status register before continuing initialization, to ensure that the core is actually ready. When using an external PHY, this also ensures we do not start trying to access the PHY while it is still in reset. The PHY reset is initiated by the core reset which is triggered just above, but remains asserted for 5ms after the core is reset according to the documentation.
The MgtRdy bit could also be waited for, but unfortunately when using 7-series devices, the bit does not appear to work as documented (it seems to behave as some sort of link state indication and not just an indication the transceiver is ready) so it can't really be relied on for this purpose.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +10 -0
@@ -516,6 +516,16 @@ static int __axienet_device_reset(structreturn ret; } +/* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ + ret =read_poll_timeout (axienet_ior, value, + value &XAE_INT_PHYRSTCMPLT_MASK , +DELAY_OF_ONE_MILLISEC ,50000 , false, lp, +XAE_IS_OFFSET ); +if (ret) { +dev_err (lp->dev,"%s: timeout waiting for PhyRstCmplt\n" , __func__); +return ret; + } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 793/846 net: axienet: reset core on initialization prior to MDIO access
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 04cc2da39698efd7eb2e30c112538922d26f848e upstream.
In some cases where the Xilinx Ethernet core was used in 1000Base-X or SGMII modes, which use the internal PCS/PMA PHY, and the MGT transceiver clock source for the PCS was not running at the time the FPGA logic was loaded, the core would come up in a state where the PCS could not be found on the MDIO bus. To fix this, the Ethernet core (including the PCS) should be reset after enabling the clocks, prior to attempting to access the PCS using of_mdio_find_device.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +5 -0
@@ -2091,6 +2091,11 @@ static int axienet_probe(struct platform lp->coalesce_count_rx =XAXIDMA_DFT_RX_THRESHOLD ; lp->coalesce_count_tx =XAXIDMA_DFT_TX_THRESHOLD ; +/* Reset core now that clocks are enabled, prior to accessing MDIO */ + ret =__axienet_device_reset (lp); +if (ret) + goto cleanup_clk; + lp->phy_node =of_parse_phandle (pdev->dev.of_node,"phy-handle" ,0 );if (lp->phy_node) { ret =axienet_mdio_setup (lp);
Greg Kroah-Hartman
maintainerPATCH 794/846 net: axienet: add missing memory barriers
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 95978df6fa328df619c15312e65ece469c2be2d2 upstream.
This driver was missing some required memory barriers:
Use dma_rmb to ensure we see all updates to the descriptor after we see that an entry has been completed.
Use wmb and rmb to avoid stale descriptor status between the TX path and TX complete IRQ path.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +10 -1
@@ -632,6 +632,8 @@ static int axienet_free_tx_chain(structif (nr_bds ==-1 && !(status &XAXIDMA_BD_STS_COMPLETE_MASK ))break ; +/* Ensure we see complete descriptor update */ +dma_rmb (); phys =desc_get_phys_addr (lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, (cur_p->cntrl & XAXIDMA_BD_CTRL_LENGTH_MASK),
@@ -645,8 +647,10 @@ static int axienet_free_tx_chain(struct cur_p->app1 =0 ; cur_p->app2 =0 ; cur_p->app4 =0 ; - cur_p->status =0 ; cur_p->skb =NULL ; +/* ensure our transmit path and device don't prematurely see status cleared */ +wmb (); + cur_p->status =0 ;if (sizep) *sizep += status &XAXIDMA_BD_STS_ACTUAL_LEN_MASK ;
@@ -704,6 +708,9 @@ static inline int axienet_check_tx_bd_sp int num_frag) {struct axidma_bd *cur_p; + +/* Ensure we see all descriptor updates from device or TX IRQ path */ +rmb (); cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num];if (cur_p->status &XAXIDMA_BD_STS_ALL_MASK )return NETDEV_TX_BUSY ;
@@ -843,6 +850,8 @@ static void axienet_recv(struct net_devi tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; +/* Ensure we see complete descriptor update */ +dma_rmb (); phys =desc_get_phys_addr (lp, cur_p);dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size,DMA_FROM_DEVICE );
Greg Kroah-Hartman
maintainerPATCH 795/846 net: axienet: limit minimum TX ring size
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 70f5817deddbc6ef3faa35841cab83c280cc653a upstream.
The driver will not work properly if the TX ring size is set to below MAX_SKB_FRAGS + 1 since it needs to hold at least one full maximally fragmented packet in the TX ring. Limit setting the ring size to below this value.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +3 -1
@@ -43,6 +43,7 @@/* Descriptors defines for Tx and Rx DMA */ #define TX_BD_NUM_DEFAULT 64#define RX_BD_NUM_DEFAULT 1024 +#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1)#define TX_BD_NUM_MAX 4096#define RX_BD_NUM_MAX 4096
@@ -1364,7 +1365,8 @@ static int axienet_ethtools_set_ringparaif (ering->rx_pending >RX_BD_NUM_MAX || ering->rx_mini_pending || ering->rx_jumbo_pending || - ering->rx_pending >TX_BD_NUM_MAX ) + ering->tx_pending <TX_BD_NUM_MIN || + ering->tx_pending >TX_BD_NUM_MAX )return -EINVAL ;if (netif_running (ndev))
Greg Kroah-Hartman
maintainerPATCH 796/846 net: axienet: Fix TX ring slot available check
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 996defd7f8b5dafc1d480b7585c7c62437f80c3c upstream.
The check for whether a TX ring slot was available was incorrect, since a slot which had been loaded with transmit data but the device had not started transmitting would be treated as available, potentially causing non-transmitted slots to be overwritten. The control field in the descriptor should be checked, rather than the status field (which may only be updated when the device completes the entry).
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 -2
@@ -643,7 +643,6 @@ static int axienet_free_tx_chain(structif (cur_p->skb && (status &XAXIDMA_BD_STS_COMPLETE_MASK ))dev_consume_skb_irq (cur_p->skb); - cur_p->cntrl =0 ; cur_p->app0 =0 ; cur_p->app1 =0 ; cur_p->app2 =0 ;
@@ -651,6 +650,7 @@ static int axienet_free_tx_chain(struct cur_p->skb =NULL ;/* ensure our transmit path and device don't prematurely see status cleared */ wmb (); + cur_p->cntrl =0 ; cur_p->status =0 ;if (sizep)
@@ -713,7 +713,7 @@ static inline int axienet_check_tx_bd_sp/* Ensure we see all descriptor updates from device or TX IRQ path */ rmb (); cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; -if (cur_p->status &XAXIDMA_BD_STS_ALL_MASK ) +if (cur_p->cntrl)return NETDEV_TX_BUSY ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 797/846 net: axienet: fix number of TX ring slots for available check
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit aba57a823d2985a2cc8c74a2535f3a88e68d9424 upstream.
The check for the number of available TX ring slots was off by 1 since a slot is required for the skb header as well as each fragment. This could result in overwriting a TX ring slot that was still in use.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 -2
@@ -747,7 +747,7 @@ axienet_start_xmit(struct sk_buff *skb, num_frag =skb_shinfo (skb)->nr_frags; cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; -if (axienet_check_tx_bd_space (lp, num_frag)) { +if (axienet_check_tx_bd_space (lp, num_frag +1 )) {if (netif_queue_stopped (ndev))return NETDEV_TX_BUSY ;
@@ -757,7 +757,7 @@ axienet_start_xmit(struct sk_buff *skb,smp_mb ();/* Space might have just been freed - check again */ -if (axienet_check_tx_bd_space (lp, num_frag)) +if (axienet_check_tx_bd_space (lp, num_frag +1 ))return NETDEV_TX_BUSY ;netif_wake_queue (ndev);
Greg Kroah-Hartman
maintainerPATCH 798/846 net: axienet: fix for TX busy handling
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit bb193e3db8b86a63f26889c99e14fd30c9ebd72a upstream.
Network driver documentation indicates we should be avoiding returning NETDEV_TX_BUSY from ndo_start_xmit in normal cases, since it requires the packets to be requeued. Instead the queue should be stopped after a packet is added to the TX ring when there may not be enough room for an additional one. Also, when TX ring entries are completed, we should only wake the queue if we know there is room for another full maximally fragmented packet.
Print a warning if there is insufficient space at the start of start_xmit, since this should no longer happen.
Combined with increasing the default TX ring size (in a subsequent patch), this appears to recover the TX performance lost by previous changes to actually manage the TX ring state properly.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 86 ++++++++++++---------- 1 file changed, 47 insertions(+), 39 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +47 -39
@@ -661,6 +661,32 @@ static int axienet_free_tx_chain(struct }/** +* axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy +* @lp: Pointer to the axienet_local structure +* @num_frag: The number of BDs to check for +* +* Return: 0, on success +* NETDEV_TX_BUSY, if any of the descriptors are not free +* +* This function is invoked before BDs are allocated and transmission starts. +* This function returns 0 if a BD or group of BDs can be allocated for +* transmission. If the BD or any of the BDs are not free the function +* returns a busy status. This is invoked from axienet_start_xmit. +*/ +static inline int axienet_check_tx_bd_space (struct axienet_local *lp, +int num_frag) +{ +struct axidma_bd *cur_p; + +/* Ensure we see all descriptor updates from device or TX IRQ path */ +rmb (); + cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; +if (cur_p->cntrl) +return NETDEV_TX_BUSY ; +return 0 ; +} + +/** * axienet_start_xmit_done - Invoked once a transmit is completed by the * Axi DMA Tx channel. * @ndev: Pointer to the net_device structure
@@ -689,33 +715,8 @@ static void axienet_start_xmit_done(stru/* Matches barrier in axienet_start_xmit */ smp_mb (); -netif_wake_queue (ndev); -} - -/** -* axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy -* @lp: Pointer to the axienet_local structure -* @num_frag: The number of BDs to check for -* -* Return: 0, on success -* NETDEV_TX_BUSY, if any of the descriptors are not free -* -* This function is invoked before BDs are allocated and transmission starts. -* This function returns 0 if a BD or group of BDs can be allocated for -* transmission. If the BD or any of the BDs are not free the function -* returns a busy status. This is invoked from axienet_start_xmit. -*/ -static inline int axienet_check_tx_bd_space (struct axienet_local *lp, -int num_frag) -{ -struct axidma_bd *cur_p; - -/* Ensure we see all descriptor updates from device or TX IRQ path */ -rmb (); - cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; -if (cur_p->cntrl) -return NETDEV_TX_BUSY ; -return 0 ; +if (!axienet_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) +netif_wake_queue (ndev); }/**
@@ -748,19 +749,14 @@ axienet_start_xmit(struct sk_buff *skb, cur_p = &lp->tx_bd_v[lp->tx_bd_tail];if (axienet_check_tx_bd_space (lp, num_frag +1 )) { -if (netif_queue_stopped (ndev)) -return NETDEV_TX_BUSY ; - +/* Should not happen as last start_xmit call should have +* checked for sufficient space and queue should only be +* woken when sufficient space is available. +*/ netif_stop_queue (ndev); - -/* Matches barrier in axienet_start_xmit_done */ -smp_mb (); - -/* Space might have just been freed - check again */ -if (axienet_check_tx_bd_space (lp, num_frag +1 )) -return NETDEV_TX_BUSY ; - -netif_wake_queue (ndev); +if (net_ratelimit ()) +netdev_warn (ndev,"TX ring unexpectedly full\n" ); +return NETDEV_TX_BUSY ; }if (skb->ip_summed ==CHECKSUM_PARTIAL ) {
@@ -821,6 +817,18 @@ axienet_start_xmit(struct sk_buff *skb,if (++lp->tx_bd_tail >= lp->tx_bd_num) lp->tx_bd_tail =0 ; +/* Stop queue if next transmit may not have space */ +if (axienet_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) { +netif_stop_queue (ndev); + +/* Matches barrier in axienet_start_xmit_done */ +smp_mb (); + +/* Space might have just been freed - check again */ +if (!axienet_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) +netif_wake_queue (ndev); + } +return NETDEV_TX_OK ; }
Greg Kroah-Hartman
maintainerPATCH 799/846 net: axienet: increase default TX ring size to 128
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 2d19c3fd80178160dd505ccd7fed1643831227a5 upstream.
With previous changes to make the driver handle the TX ring size more correctly, the default TX ring size of 64 appears to significantly bottleneck TX performance to around 600 Mbps on a 1 Gbps link on ZynqMP. Increasing this to 128 seems to bring performance up to near line rate and shouldn't cause excess bufferbloat (this driver doesn't yet support modern byte-based queue management).
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
@@ -41,7 +41,7 @@#include "xilinx_axienet.h" /* Descriptors defines for Tx and Rx DMA */ -#define TX_BD_NUM_DEFAULT 64 +#define TX_BD_NUM_DEFAULT 128#define RX_BD_NUM_DEFAULT 1024#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1)#define TX_BD_NUM_MAX 4096
Greg Kroah-Hartman
maintainerPATCH 800/846 bitops: protect find_first_{,zero}_bit properly
In reply to Greg Kroah-HartmanFrom: Yury Norov <[email protected]>
commit b7ec62d7ee0f0b8af6ba190501dff7f9ee6545ca upstream.
find_first_bit() and find_first_zero_bit() are not protected with ifdefs as other functions in find.h. It causes build errors on some platforms if CONFIG_GENERIC_FIND_FIRST_BIT is enabled.
--- include/asm-generic/bitops/find.h | 5 +++++ 1 file changed, 5 insertions(+)
include/asm-generic/bitops/find.h +5 -0
@@ -97,6 +97,7 @@ unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,#ifdef CONFIG_GENERIC_FIND_FIRST_BIT +#ifndef find_first_bit/** * find_first_bit - find the first set bit in a memory region * @addr: The address to start the search at
@@ -116,7 +117,9 @@ unsigned long find_first_bit(const unsigned long *addr, unsigned long size) return _find_first_bit(addr, size); } +#endif +#ifndef find_first_zero_bit/** * find_first_zero_bit - find the first cleared bit in a memory region * @addr: The address to start the search at
@@ -136,6 +139,8 @@ unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size) return _find_first_zero_bit(addr, size); } +#endif +#else /* CONFIG_GENERIC_FIND_FIRST_BIT */ #ifndef find_first_bit
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 801/846 um: gitignore: Add kernel/capflags.c
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 4b86366fdfbedec42f8f7ee037775f2839921d34 upstream.
This file is generated, we should ignore it.
--- arch/um/.gitignore | 1 + 1 file changed, 1 insertion(+)
arch/um/.gitignore +1 -0
@@ -2,3 +2,4 @@ kernel/config.c kernel/config.tmp kernel/vmlinux.lds +kernel/capflags.c
Greg Kroah-Hartman
maintainerPATCH 802/846 HID: vivaldi: fix handling devices not using numbered reports
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
commit 3fe6acd4dc922237b30e55473c9349c6ce0690f3 upstream.
Unfortunately details of USB HID transport bled into HID core and handling of numbered/unnumbered reports is quite a mess, with hid_report_len() calculating the length according to USB rules, and hid_hw_raw_request() adding report ID to the buffer for both numbered and unnumbered reports.
Untangling it all requres a lot of changes in HID, so for now let's handle this in the driver.
--- drivers/hid/hid-vivaldi.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/hid/hid-vivaldi.c +28 -6
@@ -74,10 +74,11 @@ static void vivaldi_feature_mapping(stru struct hid_usage *usage) {struct vivaldi_data *drvdata =hid_get_drvdata (hdev); +struct hid_report *report = field->report;int fn_key;int ret;u32 report_len; -u8 *buf; +u8 *report_data, *buf;if (field->logical !=HID_USAGE_FN_ROW_PHYSMAP || (usage->hid &HID_USAGE_PAGE ) !=HID_UP_ORDINAL )
@@ -89,12 +90,24 @@ static void vivaldi_feature_mapping(struif (fn_key > drvdata->max_function_row_key) drvdata->max_function_row_key = fn_key; - buf =hid_alloc_report_buf (field->report,GFP_KERNEL ); -if (!buf) + report_data = buf =hid_alloc_report_buf (report,GFP_KERNEL ); +if (!report_data)return ; - report_len =hid_report_len (field->report); - ret =hid_hw_raw_request (hdev, field->report->id, buf, + report_len =hid_report_len (report); +if (!report->id) { +/* +* hid_hw_raw_request() will stuff report ID (which will be 0) +* into the first byte of the buffer even for unnumbered +* reports, so we need to account for this to avoid getting +* -EOVERFLOW in return. +* Note that hid_alloc_report_buf() adds 7 bytes to the size +* so we can safely say that we have space for an extra byte. +*/ + report_len++; + } + + ret =hid_hw_raw_request (hdev, report->id, report_data, report_len,HID_FEATURE_REPORT ,HID_REQ_GET_REPORT );if (ret <0 ) {
@@ -103,7 +116,16 @@ static void vivaldi_feature_mapping(stru goto out; } - ret =hid_report_raw_event (hdev,HID_FEATURE_REPORT , buf, +if (!report->id) { +/* +* Undo the damage from hid_hw_raw_request() for unnumbered +* reports. +*/ + report_data++; + report_len--; + } + + ret =hid_report_raw_event (hdev,HID_FEATURE_REPORT , report_data, report_len,0 );if (ret) { dev_warn(&hdev->dev, "failed to report feature %d\n",
Greg Kroah-Hartman
maintainerPATCH 803/846 rtc: pxa: fix null pointer dereference
In reply to Greg Kroah-HartmanFrom: Laurence de Bruxelles <[email protected]>
commit 34127b3632b21e5c391756e724b1198eb9917981 upstream.
With the latest stable kernel versions the rtc on the PXA based Zaurus does not work, when booting I see the following kernel messages:
pxa-rtc pxa-rtc: failed to find rtc clock source pxa-rtc pxa-rtc: Unable to init SA1100 RTC sub-device
pxa-rtc: probe of pxa-rtc failed with error -2
hctosys: unable to open rtc device (rtc0)
I think this is because commit f2997775b111 ("rtc: sa1100: fix possible race condition") moved the allocation of the rtc_device struct out of sa1100_rtc_init and into sa1100_rtc_probe. This means that pxa_rtc_probe also needs to do allocation for the rtc_device struct, otherwise sa1100_rtc_init will try to dereference a null pointer. This patch adds that allocation by copying how sa1100_rtc_probe in drivers/rtc/rtc-sa1100.c does it; after the IRQs are set up a managed rtc_device is allocated.
I've tested this patch with qemu-system-arm -machine akita and with a real Zaurus SL-C1000 applied to 4.19, 5.4, and 5.10.
--- drivers/rtc/rtc-pxa.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rtc/rtc-pxa.c +4 -0
@@ -330,6 +330,10 @@ static int __init pxa_rtc_probe(struct pif (sa1100_rtc->irq_alarm <0 )return -ENXIO ; + sa1100_rtc->rtc =devm_rtc_allocate_device (&pdev->dev); +if (IS_ERR (sa1100_rtc->rtc)) +return PTR_ERR (sa1100_rtc->rtc); + pxa_rtc->base =devm_ioremap (dev, pxa_rtc->ress->start,resource_size (pxa_rtc->ress));if (!pxa_rtc->base) {
Greg Kroah-Hartman
maintainerPATCH 804/846 vdpa/mlx5: Fix wrong configuration of virtio_version_1_0
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
commit 97143b70aa847f2b0a1f959dde126b76ff7b5376 upstream.
Remove overriding of virtio_version_1_0 which forced the virtqueue object to version 1.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 -- 1 file changed, 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -2
@@ -873,8 +873,6 @@ static int create_virtqueue(struct mlx5_MLX5_SET (virtio_q, vq_ctx, umem_3_id, mvq->umem3.id);MLX5_SET (virtio_q, vq_ctx, umem_3_size, mvq->umem3.size);MLX5_SET (virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); -if (MLX5_CAP_DEV_VDPA_EMULATION (ndev->mvdev.mdev, eth_frame_offload_type)) -MLX5_SET (virtio_q, vq_ctx, virtio_version_1_0,1 ); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));if (err)
Greg Kroah-Hartman
maintainerPATCH 805/846 virtio_ring: mark ring unused on error
In reply to Greg Kroah-HartmanFrom: Michael S. Tsirkin <[email protected]>
commit 1861ba626ae9b98136f3e504208cdef6b29cd3ec upstream.
A recently added error path does not mark ring unused when exiting on OOM, which will lead to BUG on the next entry in debug builds.
TODO: refactor code so we have START_USE and END_USE in the same function.
--- drivers/virtio/virtio_ring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +3 -1
@@ -1197,8 +1197,10 @@ static inline int virtqueue_add_packed(sif (virtqueue_use_indirect (_vq, total_sg)) { err =virtqueue_add_indirect_packed (vq, sgs, total_sg, out_sgs, in_sgs, data, gfp); -if (err != -ENOMEM ) +if (err != -ENOMEM ) { +END_USE (vq);return err; + }/* fall back on direct */ }
Greg Kroah-Hartman
maintainerPATCH 806/846 taskstats: Cleanup the use of task->exit_code
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 1b5a42d9c85f0e731f01c8d1129001fd8531a8a0 upstream.
In the function bacct_add_task the code reading task->exit_code was introduced in commit f3cef7a99469 ("[PATCH] csa: basic accounting over taskstats"), and it is not entirely clear what the taskstats interface is trying to return as only returning the exit_code of the first task in a process doesn't make a lot of sense.
As best as I can figure the intent is to return task->exit_code after a task exits. The field is returned with per task fields, so the exit_code of the entire process is not wanted. Only the value of the first task is returned so this is not a useful way to get the per task ptrace stop code. The ordinary case of returning this value is returning after a task exits, which also precludes use for getting a ptrace value.
It is common to for the first task of a process to also be the last task of a process so this field may have done something reasonable by accident in testing.
Make ac_exitcode a reliable per task value by always returning it for every exited task.
Setting ac_exitcode in a sensible mannter makes it possible to continue to provide this value going forward.
--- kernel/tsacct.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/tsacct.c +3 -4
@@ -38,11 +38,10 @@ void bacct_add_tsk(struct user_namespace stats->ac_btime =clamp_t (time64_t, btime,0 ,U32_MAX ); stats->ac_btime64 = btime; -if (thread_group_leader (tsk)) { +if (tsk->flags &PF_EXITING ) stats->ac_exitcode = tsk->exit_code; -if (tsk->flags &PF_FORKNOEXEC ) - stats->ac_flag |=AFORK ; - } +if (thread_group_leader (tsk) && (tsk->flags &PF_FORKNOEXEC )) + stats->ac_flag |=AFORK ;if (tsk->flags &PF_SUPERPRIV ) stats->ac_flag |=ASU ;if (tsk->flags &PF_DUMPCORE )
Greg Kroah-Hartman
maintainerPATCH 807/846 inet: frags: annotate races around fqdir->dead and fqdir->high_thresh
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 91341fa0003befd097e190ec2a4bf63ad957c49a upstream.
Both fields can be read/written without synchronization, add proper accessors and documentation.
--- include/net/inet_frag.h | 11 +++++++++-- include/net/ipv6_frag.h | 3 ++- net/ipv4/inet_fragment.c | 8 +++++--- net/ipv4/ip_fragment.c | 3 ++- 4 files changed, 18 insertions(+), 7 deletions(-)
include/net/inet_frag.h +9 -2
@@ -117,8 +117,15 @@ int fqdir_init(struct fqdir **fqdirp, ststatic inline void fqdir_pre_exit (struct fqdir *fqdir) { - fqdir->high_thresh =0 ;/* prevent creation of new frags */ - fqdir->dead = true; +/* Prevent creation of new frags. +* Pairs with READ_ONCE() in inet_frag_find(). +*/ +WRITE_ONCE (fqdir->high_thresh,0 ); + +/* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() +* and ip6frag_expire_frag_queue(). +*/ +WRITE_ONCE (fqdir->dead, true); }void fqdir_exit (struct fqdir *fqdir);
include/net/ipv6_frag.h +2 -1
@@ -67,7 +67,8 @@ ip6frag_expire_frag_queue(struct net *nestruct sk_buff *head;rcu_read_lock (); -if (fq->q.fqdir->dead) +/* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ +if (READ_ONCE (fq->q.fqdir->dead)) goto out_rcu_unlock;spin_lock (&fq->q.lock);
net/ipv4/inet_fragment.c +5 -3
@@ -235,9 +235,9 @@ void inet_frag_kill(struct inet_frag_que/* The RCU read lock provides a memory barrier * guaranteeing that if fqdir->dead is false then * the hash table destruction will not start until -* after we unlock. Paired with inet_frags_exit_net(). +* after we unlock. Paired with fqdir_pre_exit(). */ -if (!fqdir->dead) { +if (!READ_ONCE (fqdir->dead)) {rhashtable_remove_fast (&fqdir->rhashtable, &fq->node, fqdir->f->rhash_params);refcount_dec (&fq->refcnt);
@@ -352,9 +352,11 @@ static struct inet_frag_queue *inet_frag/* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */ struct inet_frag_queue *inet_frag_find (struct fqdir *fqdir,void *key) { +/* This pairs with WRITE_ONCE() in fqdir_pre_exit(). */ +long high_thresh =READ_ONCE (fqdir->high_thresh);struct inet_frag_queue *fq =NULL , *prev; -if (!fqdir->high_thresh ||frag_mem_limit (fqdir) > fqdir->high_thresh) +if (!high_thresh ||frag_mem_limit (fqdir) > high_thresh)return NULL ;rcu_read_lock ();
net/ipv4/ip_fragment.c +2 -1
@@ -144,7 +144,8 @@ static void ip_expire(struct timer_listrcu_read_lock (); -if (qp->q.fqdir->dead) +/* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ +if (READ_ONCE (qp->q.fqdir->dead)) goto out_rcu_unlock;spin_lock (&qp->q.lock);
Greg Kroah-Hartman
maintainerPATCH 808/846 netns: add schedule point in ops_exit_list()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 2836615aa22de55b8fca5e32fe1b27a67cda625e upstream.
When under stress, cleanup_net() can have to dismantle netns in big numbers. ops_exit_list() currently calls many helpers [1] that have no schedule point, and we can end up with soft lockups, particularly on hosts with many cpus.
Even for moderate amount of netns processed by cleanup_net() this patch avoids latency spikes.
[1] Some of these helpers like fib_sync_up() and fib_sync_down_dev() are very slow because net/ipv4/fib_semantics.c uses host-wide hash tables, and ifindex is used as the only input of two hash functions. ifindexes tend to be the same for all netns (lo.ifindex==1 per instance) This will be fixed in a separate patch.
--- net/core/net_namespace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/net_namespace.c +3 -1
@@ -164,8 +164,10 @@ static void ops_exit_list(const struct p {struct net *net;if (ops->exit) { -list_for_each_entry (net, net_exit_list, exit_list) +list_for_each_entry (net, net_exit_list, exit_list) { ops->exit (net); +cond_resched (); + } }if (ops->exit_batch) ops->exit_batch (net_exit_list);
Greg Kroah-Hartman
maintainerPATCH 809/846 iwlwifi: fix Bz NMI behaviour
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit fdfde0cb79264f88992e72b5a056a3a3284fcaad upstream.
Contrary to what was stated before, the hardware hasn't changed the bits here yet. In any case, the new CSR is also directly (lower 16 bits) connected to UREG_DOORBELL_TO_ISR6, so if it still changes the changes would be there. Adjust the code and comments accordingly.
--- drivers/net/wireless/intel/iwlwifi/iwl-csr.h | 5 +++-- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-csr.h +3 -2
@@ -104,9 +104,10 @@/* GIO Chicken Bits (PCI Express bus link power management) */ #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) -/* Doorbell NMI (since Bz) */ +/* Doorbell - since Bz +* connected to UREG_DOORBELL_TO_ISR6 (lower 16 bits only) +*/ #define CSR_DOORBELL_VECTOR (CSR_BASE + 0x130) -#define CSR_DOORBELL_VECTOR_NMI BIT(1)/* host chicken bits */ #define CSR_HOST_CHICKEN (CSR_BASE + 0x204)
drivers/net/wireless/intel/iwlwifi/iwl-io.c +1 -1
@@ -218,7 +218,7 @@ void iwl_force_nmi(struct iwl_trans *tra UREG_DOORBELL_TO_ISR6_NMI_BIT); elseiwl_write32 (trans ,CSR_DOORBELL_VECTOR , -CSR_DOORBELL_VECTOR_NMI ); +UREG_DOORBELL_TO_ISR6_NMI_BIT ); }IWL_EXPORT_SYMBOL (iwl_force_nmi);
Greg Kroah-Hartman
maintainerPATCH 810/846 xfrm: Dont accidentally set RTO_ONLINK in decode_session4()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit 23e7b1bfed61e301853b5e35472820d919498278 upstream.
Similar to commit 94e2238969e8 ("xfrm4: strip ECN bits from tos field"), clear the ECN bits from iph->tos when setting ->flowi4_tos. This ensures that the last bit of ->flowi4_tos is cleared, so ip_route_output_key_hash() isn't going to restrict the scope of the route lookup.
Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason to clear the high order bits.
Found by code inspection, compile tested only.
--- net/xfrm/xfrm_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +2 -1
@@ -31,6 +31,7 @@#include <linux/if_tunnel.h> #include <net/dst.h> #include <net/flow.h> +#include <net/inet_ecn.h> #include <net/xfrm.h> #include <net/ip.h> #include <net/gre.h>
@@ -3297,7 +3298,7 @@ decode_session4(struct sk_buff *skb, str fl4->flowi4_proto = iph->protocol; fl4->daddr = reverse ? iph->saddr : iph->daddr; fl4->saddr = reverse ? iph->daddr : iph->saddr; - fl4->flowi4_tos = iph->tos; + fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK ;if (!ip_is_fragment (iph)) {switch (iph->protocol) {
Greg Kroah-Hartman
maintainerPATCH 811/846 vdpa/mlx5: Restore cur_num_vqs in case of failure in change_num_qps()
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
commit 37e07e705888e4c3502f204e9c6785c9c2d6d86a upstream.
Restore ndev->cur_num_vqs to the original value in case change_num_qps() fails.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +3 -1
@@ -1510,9 +1510,11 @@ static int change_num_qps(struct mlx5_vdreturn 0 ; clean_added: -for (--i; i >= cur_qps; --i) +for (--i; i >=2 * cur_qps; --i)teardown_vq (ndev, &ndev->vqs[i]); + ndev->cur_num_vqs =2 * cur_qps; +return err; }
Greg Kroah-Hartman
maintainerPATCH 812/846 gre: Dont accidentally set RTO_ONLINK in gre_fill_metadata_dst()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit f7716b318568b22fbf0e3be99279a979e217cf71 upstream.
Mask the ECN bits before initialising ->flowi4_tos. The tunnel key may have the last ECN bit set, which will interfere with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope).
Found by code inspection, compile tested only.
--- net/ipv4/ip_gre.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +3 -2
@@ -604,8 +604,9 @@ static int gre_fill_metadata_dst(struct key = &info->key;ip_tunnel_init_flow (&fl4,IPPROTO_GRE , key->u.ipv4.dst, key->u.ipv4.src, -tunnel_id_to_key32 (key->tun_id), key->tos,0 , - skb->mark,skb_get_hash (skb)); +tunnel_id_to_key32 (key->tun_id), + key->tos & ~INET_ECN_MASK ,0 , skb->mark, +skb_get_hash (skb)); rt =ip_route_output_key (dev_net (dev), &fl4);if (IS_ERR (rt))return PTR_ERR (rt);
Greg Kroah-Hartman
maintainerPATCH 813/846 libcxgb: Dont accidentally set RTO_ONLINK in cxgb_find_route()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit a915deaa9abe4fb3a440312c954253a6a733608e upstream.
Mask the ECN bits before calling ip_route_output_ports(). The tos variable might be passed directly from an IPv4 header, so it may have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope).
Found by code inspection, compile tested only.
--- drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c +2 -1
@@ -32,6 +32,7 @@#include <linux/tcp.h> #include <linux/ipv6.h> +#include <net/inet_ecn.h> #include <net/route.h> #include <net/ip6_route.h>
@@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *l rt =ip_route_output_ports (&init_net, &fl4,NULL , peer_ip, local_ip, peer_port, local_port,IPPROTO_TCP , - tos,0 ); + tos & ~INET_ECN_MASK ,0 );if (IS_ERR (rt))return NULL ; n =dst_neigh_lookup (&rt->dst, &peer_ip);
Greg Kroah-Hartman
maintainerPATCH 814/846 perf script: Fix hex dump character output
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 62942e9fda9fd1def10ffcbd5e1c025b3c9eec17 upstream.
Using grep -C with perf script -D can give erroneous results as grep loses lines due to non-printable characters, for example, below the 0020, 0060 and 0070 lines are missing:
$ perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........
0 0 0x450 [0x98]: PERF_RECORD_AUXTRACE_INFO type: 1
PMU Type 8
Time Shift 31
perf's isprint() is a custom implementation from the kernel, but the kernel's _ctype appears to include characters from Latin-1 Supplement which is not compatible with, for example, UTF-8. Fix by checking also isascii().
After:
$ tools/perf/perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0020: 03 84 32 2f 00 00 00 00 63 7c 4f d2 fa ff ff ff ..2/....c|O..... . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0060: 00 02 00 00 00 00 00 00 00 c0 03 00 00 00 00 00 ................ . 0070: e2 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........
--- tools/perf/util/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/debug.c +1 -1
@@ -179,7 +179,7 @@ static int trace_event_printer(enum binabreak ;case BINARY_PRINT_CHAR_DATA : printed +=color_fprintf (fp, color,"%c" , -isprint (ch) ? ch :'.' ); +isprint (ch) &&isascii (ch) ? ch :'.' );break ;case BINARY_PRINT_CHAR_PAD : printed +=color_fprintf (fp, color," " );
Greg Kroah-Hartman
maintainerPATCH 815/846 dmaengine: at_xdmac: Dont start transactions at tx_submit level
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit bccfb96b59179d4f96cbbd1ddff8fac6d335eae4 upstream.
tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending() to be called. issue_pending() must start the transfer, not tx_submit(), thus remove at_xdmac_start_xfer() from at_xdmac_tx_submit(). Clients of at_xdmac that assume that tx_submit() starts the transfer must be updated and call dma_async_issue_pending() if they miss to call it (one example is atmel_serial).
As the at_xdmac_start_xfer() is now called only from at_xdmac_advance_work() when !at_xdmac_chan_is_enabled(), the at_xdmac_chan_is_enabled() check is no longer needed in at_xdmac_start_xfer(), thus remove it.
--- drivers/dma/at_xdmac.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/dma/at_xdmac.c +0 -6
@@ -385,9 +385,6 @@ static void at_xdmac_start_xfer(struct adev_vdbg (chan2dev (&atchan->chan),"%s: desc 0x%p\n" , __func__, first); -if (at_xdmac_chan_is_enabled (atchan)) -return ; -/* Set transfer as active to not try to start it again. */ first->active_xfer = true;
@@ -479,9 +476,6 @@ static dma_cookie_t at_xdmac_tx_submit(sdev_vdbg (chan2dev (tx->chan),"%s: atchan 0x%p, add desc 0x%p to xfers_list\n" , __func__, atchan, desc);list_add_tail (&desc->xfer_node, &atchan->xfers_list); -if (list_is_singular (&atchan->xfers_list)) -at_xdmac_start_xfer (atchan, desc); -spin_unlock_irqrestore (&atchan->lock, irqflags);return cookie; }
Greg Kroah-Hartman
maintainerPATCH 816/846 dmaengine: at_xdmac: Start transfer for cyclic channels in issue_pending
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit e6af9b05bec63cd4d1de2a33968cd0be2a91282a upstream.
Cyclic channels must too call issue_pending in order to start a transfer. Start the transfer in issue_pending regardless of the type of channel. This wrongly worked before, because in the past the transfer was started at tx_submit level when only a desc in the transfer list.
--- drivers/dma/at_xdmac.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/at_xdmac.c +3 -5
@@ -1778,11 +1778,9 @@ static void at_xdmac_issue_pending(strucdev_dbg (chan2dev (&atchan->chan),"%s\n" , __func__); -if (!at_xdmac_chan_is_cyclic (atchan)) { -spin_lock_irqsave (&atchan->lock, flags); -at_xdmac_advance_work (atchan); -spin_unlock_irqrestore (&atchan->lock, flags); - } +spin_lock_irqsave (&atchan->lock, flags); +at_xdmac_advance_work (atchan); +spin_unlock_irqrestore (&atchan->lock, flags);return ; }
Greg Kroah-Hartman
maintainerPATCH 817/846 dmaengine: at_xdmac: Print debug message after realeasing the lock
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 5edc24ac876a928f36f407a0fcdb33b94a3a210f upstream.
It is desirable to do the prints without the lock held if possible, so move the print after the lock is released.
--- drivers/dma/at_xdmac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/at_xdmac.c +4 -2
@@ -473,10 +473,12 @@ static dma_cookie_t at_xdmac_tx_submit(sspin_lock_irqsave (&atchan->lock, irqflags); cookie =dma_cookie_assign (tx); -dev_vdbg (chan2dev (tx->chan),"%s: atchan 0x%p, add desc 0x%p to xfers_list\n" , - __func__, atchan, desc);list_add_tail (&desc->xfer_node, &atchan->xfers_list);spin_unlock_irqrestore (&atchan->lock, irqflags); + +dev_vdbg (chan2dev (tx->chan),"%s: atchan 0x%p, add desc 0x%p to xfers_list\n" , + __func__, atchan, desc); +return cookie; }
Greg Kroah-Hartman
maintainerPATCH 818/846 dmaengine: at_xdmac: Fix concurrency over xfers_list
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 18deddea9184b62941395889ff7659529c877326 upstream.
Since tx_submit can be called from a hard IRQ, xfers_list must be protected with a lock to avoid concurency on the list's elements. Since at_xdmac_handle_cyclic() is called from a tasklet, spin_lock_irq is enough to protect from a hard IRQ.
--- drivers/dma/at_xdmac.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/dma/at_xdmac.c +10 -7
@@ -1619,14 +1619,17 @@ static void at_xdmac_handle_cyclic(strucstruct at_xdmac_desc *desc;struct dma_async_tx_descriptor *txd; -if (!list_empty (&atchan->xfers_list)) { - desc =list_first_entry (&atchan->xfers_list, - struct at_xdmac_desc, xfer_node); - txd = &desc->tx_dma_desc; - -if (txd->flags &DMA_PREP_INTERRUPT ) -dmaengine_desc_get_callback_invoke (txd,NULL ); +spin_lock_irq (&atchan->lock); +if (list_empty (&atchan->xfers_list)) { +spin_unlock_irq (&atchan->lock); +return ; } + desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, + xfer_node); +spin_unlock_irq (&atchan->lock); + txd = &desc->tx_dma_desc; +if (txd->flags &DMA_PREP_INTERRUPT ) +dmaengine_desc_get_callback_invoke (txd,NULL ); }static void at_xdmac_handle_error (struct at_xdmac_chan *atchan)
Greg Kroah-Hartman
maintainerPATCH 819/846 dmaengine: at_xdmac: Fix lld view setting
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 1385eb4d14d447cc5d744bc2ac34f43be66c9963 upstream.
AT_XDMAC_CNDC_NDVIEW_NDV3 was set even for AT_XDMAC_MBR_UBC_NDV2, because of the wrong bit handling. Fix it.
--- drivers/dma/at_xdmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/at_xdmac.c +3 -1
@@ -99,6 +99,7 @@#define AT_XDMAC_CNDC_NDE (0x1 << 0)/* Channel x Next Descriptor Enable */ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1)/* Channel x Next Descriptor Source Update */ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2)/* Channel x Next Descriptor Destination Update */ +#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27)#define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3)/* Channel x Next Descriptor View 0 */ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3)/* Channel x Next Descriptor View 1 */ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3)/* Channel x Next Descriptor View 2 */
@@ -402,7 +403,8 @@ static void at_xdmac_start_xfer(struct a*/ if (at_xdmac_chan_is_cyclic (atchan)) reg =AT_XDMAC_CNDC_NDVIEW_NDV1 ; -else if (first->lld.mbr_ubc &AT_XDMAC_MBR_UBC_NDV3 ) +else if ((first->lld.mbr_ubc & +AT_XDMAC_CNDC_NDVIEW_MASK ) ==AT_XDMAC_MBR_UBC_NDV3 ) reg =AT_XDMAC_CNDC_NDVIEW_NDV3 ;else reg =AT_XDMAC_CNDC_NDVIEW_NDV2 ;
Greg Kroah-Hartman
maintainerPATCH 820/846 dmaengine: at_xdmac: Fix at_xdmac_lld struct definition
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 912f7c6f7fac273f40e621447cf17d14b50d6e5b upstream.
The hardware channel next descriptor view structure contains just fields of 32 bits, while dma_addr_t can be of type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to comply with what the hardware expects.
--- drivers/dma/at_xdmac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/dma/at_xdmac.c +9 -9
@@ -253,15 +253,15 @@ struct at_xdmac {/* Linked List Descriptor */ struct at_xdmac_lld { -dma_addr_t mbr_nda;/* Next Descriptor Member */ -u32 mbr_ubc;/* Microblock Control Member */ -dma_addr_t mbr_sa;/* Source Address Member */ -dma_addr_t mbr_da;/* Destination Address Member */ -u32 mbr_cfg;/* Configuration Register */ -u32 mbr_bc;/* Block Control Register */ -u32 mbr_ds;/* Data Stride Register */ -u32 mbr_sus;/* Source Microblock Stride Register */ -u32 mbr_dus;/* Destination Microblock Stride Register */ +u32 mbr_nda;/* Next Descriptor Member */ +u32 mbr_ubc;/* Microblock Control Member */ +u32 mbr_sa;/* Source Address Member */ +u32 mbr_da;/* Destination Address Member */ +u32 mbr_cfg;/* Configuration Register */ +u32 mbr_bc;/* Block Control Register */ +u32 mbr_ds;/* Data Stride Register */ +u32 mbr_sus;/* Source Microblock Stride Register */ +u32 mbr_dus;/* Destination Microblock Stride Register */ };/* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */
Greg Kroah-Hartman
maintainerPATCH 821/846 perf tools: Drop requirement for libstdc++.so for libopencsd check
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
commit ed17b1914978eddb2b01f2d34577f1c82518c650 upstream.
It's possible to link against libopencsd_c_api without having libstdc++.so available, only libstdc++.so.6.0.28 (or whatever version is in use) needs to be available. The same holds true for libopencsd.so. When -lstdc++ (or -lopencsd) is explicitly passed to the linker however the .so file must be available.
So wrap adding the dependencies into a check for static linking that actually requires adding them all. The same construct is already used for some other tests in the same file to reduce dependencies in the dynamic linking case.
--- tools/perf/Makefile.config | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +4 -1
@@ -143,7 +143,10 @@ FEATURE_CHECK_LDFLAGS-libcrypto = -lcryp ifdef CSINCLUDES LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) endif -OPENCSDLIBS := -lopencsd_c_api -lopencsd -lstdc++ +OPENCSDLIBS := -lopencsd_c_api +ifeq ($(findstring -static,${LDFLAGS}),-static) + OPENCSDLIBS += -lopencsd -lstdc++ +endif ifdef CSLIBS LIBOPENCSD_LDFLAGS := -L$(CSLIBS) endif
Greg Kroah-Hartman
maintainerPATCH 822/846 perf probe: Fix ppc64 perf probe add events failed case
In reply to Greg Kroah-HartmanFrom: Zechuan Chen <[email protected]>
commit 4624f199327a704dd1069aca1c3cadb8f2a28c6f upstream.
Because of commit bf794bf52a80c627 ("powerpc/kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2"), in ppc64 ABIv1, our perf command eliminates the need to use the prefix "." at the symbol name.
But when the command "perf probe -a schedule" is executed on ppc64 ABIv1, it obtains two symbol address information through /proc/kallsyms, for example:
cat /proc/kallsyms | grep -w schedule
c000000000657020 T .schedule
c000000000d4fdb8 D schedule
The symbol "D schedule" is not a function symbol, and perf will print:
"p:probe/schedule _text+13958584"Failed to write event: Invalid argument
Therefore, when searching symbols from map and adding probe point for them, a symbol type check is added. If the type of symbol is not a function, skip it.
--- tools/perf/util/probe-event.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/probe-event.c +3 -0
@@ -3083,6 +3083,9 @@ static int find_probe_trace_events_from_for (j =0 ; j < num_matched_functions; j++) { sym = syms[j]; +if (sym->type !=STT_FUNC ) +continue ; +/* There can be duplicated symbols in the map */ for (i =0 ; i < j; i++)if (sym->start == syms[i]->start) {
Greg Kroah-Hartman
maintainerPATCH 823/846 devlink: Remove misleading internal_flags from health reporter dump
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
commit e9538f8270db24d272659e15841854c7ea11119e upstream.
DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET command doesn't have .doit callback and has no use in internal_flags at all. Remove this misleading assignment.
--- net/core/devlink.c | 2 -- 1 file changed, 2 deletions(-)
net/core/devlink.c +0 -2
@@ -8795,8 +8795,6 @@ static const struct genl_small_ops devli GENL_DONT_VALIDATE_DUMP_STRICT, .dumpit = devlink_nl_cmd_health_reporter_dump_get_dumpit, .flags = GENL_ADMIN_PERM, - .internal_flags =DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT | - DEVLINK_NL_FLAG_NO_LOCK, }, { .cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
Greg Kroah-Hartman
maintainerPATCH 824/846 arm64: dts: qcom: msm8996: drop not documented adreno properties
In reply to Greg Kroah-HartmanFrom: David Heidelberg <[email protected]>
commit c41910f257a22dc406c60d8826b4a3b5398003a3 upstream.
These properties aren't documented nor implemented in the driver. Drop them.
Fixes warnings as:
$ make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/msm/gpu.yaml ... arch/arm64/boot/dts/qcom/msm8996-mtp.dt.yaml: gpu@b00000: 'qcom,gpu-quirk-fault-detect-mask', 'qcom,gpu-quirk-two-pass-use-wfi' do not match any of the regexes: 'pinctrl-[0-9]+' From schema: Documentation/devicetree/bindings/display/msm/gpu.yaml ...
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/qcom/msm8996.dtsi +0 -3
@@ -965,9 +965,6 @@ nvmem-cells = <&speedbin_efuse>; nvmem-cell-names = "speed_bin"; - qcom,gpu-quirk-two-pass-use-wfi; - qcom,gpu-quirk-fault-detect-mask; - operating-points-v2 = <&gpu_opp_table>; status = "disabled";
Greg Kroah-Hartman
maintainerPATCH 825/846 net: fix sock_timestamping_bind_phc() to release device
In reply to Greg Kroah-HartmanFrom: Miroslav Lichvar <[email protected]>
commit 2a4d75bfe41232608f5596a6d1369f92ccb20817 upstream.
Don't forget to release the device in sock_timestamping_bind_phc() after it was used to get the vclock indices.
--- net/core/sock.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/sock.c +2 -0
@@ -830,6 +830,8 @@ static int sock_timestamping_bind_phc(st } num =ethtool_get_phc_vclocks (dev, &vclock_index); +dev_put (dev); +for (i =0 ; i < num; i++) {if (*(vclock_index + i) == phc_index) { match = true;
Greg Kroah-Hartman
maintainerPATCH 826/846 net: bonding: fix bond_xmit_broadcast return value error bug
In reply to Greg Kroah-HartmanFrom: Jie Wang <[email protected]>
commit 4e5bd03ae34652cd932ab4c91c71c511793df75c upstream.
In Linux bonding scenario, one packet is copied to several copies and sent by all slave device of bond0 in mode 3(broadcast mode). The mode 3 xmit function bond_xmit_broadcast() only ueses the last slave device's tx result as the final result. In this case, if the last slave device is down, then it always return NET_XMIT_DROP, even though the other slave devices xmit success. It may cause the tx statistics error, and cause the application (e.g. scp) consider the network is unreachable.
For example, use the following command to configure server A.
echo 3 > /sys/class/net/bond0/bonding/mode
ifconfig bond0 up
ifenslave bond0 eth0 eth1
ifconfig bond0 192.168.1.125
ifconfig eth0 up
ifconfig eth1 down
The slave device eth0 and eth1 are connected to server B(192.168.1.107). Run the ping 192.168.1.107 -c 3 -i 0.2 command, the following information is displayed.
PING 192.168.1.107 (192.168.1.107) 56(84) bytes of data. 64 bytes from 192.168.1.107: icmp_seq=1 ttl=64 time=0.077 ms 64 bytes from 192.168.1.107: icmp_seq=2 ttl=64 time=0.056 ms 64 bytes from 192.168.1.107: icmp_seq=3 ttl=64 time=0.051 ms
192.168.1.107 ping statistics
0 packets transmitted, 3 received
Actually, the slave device eth0 of the bond successfully sends three ICMP packets, but the result shows that 0 packets are transmitted.
Also if we use scp command to get remote files, the command end with the following printings.
ssh_exchange_identification: read: Connection timed out
So this patch modifies the bond_xmit_broadcast to return NET_XMIT_SUCCESS if one slave device in the bond sends packets successfully. If all slave devices send packets fail, the discarded packets stats is increased. The skb is released when there is no slave device in the bond or the last slave device is down.
--- drivers/net/bonding/bond_main.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/bonding/bond_main.c +22 -8
@@ -4843,25 +4843,39 @@ static netdev_tx_t bond_xmit_broadcast(sstruct bonding *bond =netdev_priv (bond_dev);struct slave *slave =NULL ;struct list_head *iter; +bool xmit_suc = false; +bool skb_used = false;bond_for_each_slave_rcu (bond, slave, iter) { -if (bond_is_last_slave (bond, slave)) -break ; -if (bond_slave_is_up (slave) && slave->link ==BOND_LINK_UP ) { -struct sk_buff *skb2 =skb_clone (skb,GFP_ATOMIC ); +struct sk_buff *skb2; +if (!(bond_slave_is_up (slave) && slave->link ==BOND_LINK_UP )) +continue ; + +if (bond_is_last_slave (bond, slave)) { + skb2 = skb; + skb_used = true; + }else { + skb2 =skb_clone (skb,GFP_ATOMIC );if (!skb2) {net_err_ratelimited ("%s: Error: %s: skb_clone() failed\n" , bond_dev->name, __func__);continue ; } -bond_dev_queue_xmit (bond, skb2, slave->dev); } + +if (bond_dev_queue_xmit (bond, skb2, slave->dev) ==NETDEV_TX_OK ) + xmit_suc = true; } -if (slave &&bond_slave_is_up (slave) && slave->link ==BOND_LINK_UP ) -return bond_dev_queue_xmit (bond, skb, slave->dev); -return bond_tx_drop (bond_dev, skb); +if (!skb_used) +dev_kfree_skb_any (skb); + +if (xmit_suc) +return NETDEV_TX_OK ; + +atomic_long_inc (&bond_dev->tx_dropped); +return NET_XMIT_DROP ; }/*------------------------- Device initialization ---------------------------*/
Greg Kroah-Hartman
maintainerPATCH 827/846 net: ipa: fix atomic update in ipa_endpoint_replenish()
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
commit 6c0e3b5ce94947b311348c367db9e11dcb2ccc93 upstream.
In ipa_endpoint_replenish(), if an error occurs when attempting to replenish a receive buffer, we just quit and try again later. In that case we increment the backlog count to reflect that the attempt was unsuccessful. Then, if the add_one flag was true we increment the backlog again.
This second increment is not included in the backlog local variable though, and its value determines whether delayed work should be scheduled. This is a bug.
Fix this by determining whether 1 or 2 should be added to the backlog before adding it in a atomic_add_return() call.
--- drivers/net/ipa/ipa_endpoint.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ipa/ipa_endpoint.c +3 -4
@@ -1067,6 +1067,7 @@ static void ipa_endpoint_replenish(struc {struct gsi *gsi;u32 backlog; +int delta;if (!endpoint->replenish_enabled) {if (add_one)
@@ -1084,10 +1085,8 @@ static void ipa_endpoint_replenish(struc try_again_later:/* The last one didn't succeed, so fix the backlog */ - backlog =atomic_inc_return (&endpoint->replenish_backlog); - -if (add_one) -atomic_inc (&endpoint->replenish_backlog); + delta = add_one ?2 :1 ; + backlog =atomic_add_return (delta, &endpoint->replenish_backlog);/* Whenever a receive buffer transaction completes we'll try to * replenish again. It's unlikely, but if we fail to supply even
Greg Kroah-Hartman
maintainerPATCH 828/846 net_sched: restore "mpu xxx" handling
In reply to Greg Kroah-HartmanFrom: Kevin Bracey <[email protected]>
commit fb80445c438c78b40b547d12b8d56596ce4ccfeb upstream.
commit 56b765b79e9a ("htb: improved accuracy at high rates") broke "overhead X", "linklayer atm" and "mpu X" attributes.
"overhead X" and "linklayer atm" have already been fixed. This restores the "mpu X" handling, as might be used by DOCSIS or Ethernet shaping:
tc class add ... htb rate X overhead 4 mpu 64
The code being fixed is used by htb, tbf and act_police. Cake has its own mpu handling. qdisc_calculate_pkt_len still uses the size table containing values adjusted for mpu by user space.
iproute2 tc has always passed mpu into the kernel via a tc_ratespec structure, but the kernel never directly acted on it, merely stored it so that it could be read back by tc class show.
Rather, tc would generate length-to-time tables that included the mpu (and linklayer) in their construction, and the kernel used those tables.
Since v3.7, the tables were no longer used. Along with "mpu", this also broke "overhead" and "linklayer" which were fixed in 01cb71d2d47b ("net_sched: restore "overhead xxx" handling", v3.10) and 8a8e3d84b171 ("net_sched: restore "linklayer atm" handling", v3.11).
"overhead" was fixed by simply restoring use of tc_ratespec::overhead - this had originally been used by the kernel but was initially omitted from the new non-table-based calculations.
"linklayer" had been handled in the table like "mpu", but the mode was not originally passed in tc_ratespec. The new implementation was made to handle it by getting new versions of tc to pass the mode in an extended tc_ratespec, and for older versions of tc the table contents were analysed at load time to deduce linklayer.
As "mpu" has always been given to the kernel in tc_ratespec, accompanying the mpu-based table, we can restore system functionality with no userspace change by making the kernel act on the tc_ratespec value.
--- include/net/sch_generic.h | 5 +++++ net/sched/sch_generic.c | 1 + 2 files changed, 6 insertions(+)
include/net/sch_generic.h +5 -0
@@ -1260,6 +1260,7 @@ struct psched_ratecfg {u64 rate_bytes_ps;/* bytes per second */ u32 mult;u16 overhead; +u16 mpu;u8 linklayer;u8 shift; };
@@ -1269,6 +1270,9 @@ static inline u64 psched_l2t_ns(const st { len += r->overhead; +if (len < r->mpu) + len = r->mpu; +if (unlikely (r->linklayer ==TC_LINKLAYER_ATM ))return ((u64)(DIV_ROUND_UP (len,48 )*53 ) * r->mult) >> r->shift;
@@ -1291,6 +1295,7 @@ static inline void psched_ratecfg_getrat res->rate =min_t (u64, r->rate_bytes_ps, ~0U ); res->overhead = r->overhead; + res->mpu = r->mpu; res->linklayer = (r->linklayer &TC_LINKLAYER_MASK ); }
net/sched/sch_generic.c +1 -0
@@ -1455,6 +1455,7 @@ void psched_ratecfg_precompute(struct ps {memset (r,0 ,sizeof (*r)); r->overhead = conf->overhead; + r->mpu = conf->mpu; r->rate_bytes_ps =max_t (u64, conf->rate, rate64); r->linklayer = (conf->linklayer &TC_LINKLAYER_MASK );psched_ratecfg_precompute__ (r->rate_bytes_ps, &r->mult, &r->shift);
Greg Kroah-Hartman
maintainerPATCH 829/846 net: mscc: ocelot: dont let phylink re-enable TX PAUSE on the NPI port
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit 33cb0ff30cff104e753f7882c99e54cf67ea7903 upstream.
Since commit b39648079db4 ("net: mscc: ocelot: disable flow control on NPI interface"), flow control should be disabled on the DSA CPU port when used in NPI mode.
However, the commit blamed in the Fixes: tag below broke this, because it allowed felix_phylink_mac_link_up() to overwrite SYS_PAUSE_CFG_PAUSE_ENA for the DSA CPU port.
This issue became noticeable since the device tree update from commit 8fcea7be5736 ("arm64: dts: ls1028a: mark internal links between Felix and ENETC as capable of flow control").
The solution is to check whether this is the currently configured NPI port from ocelot_phylink_mac_link_up(), and to not modify the statically disabled PAUSE frame transmission if it is.
When the port is configured for lossless mode as opposed to tail drop mode, but the link partner (DSA master) doesn't observe the transmitted PAUSE frames, the switch termination throughput is much worse, as can be seen below.
Before:
root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 37504 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 28.4 MBytes 238 Mbits/sec 357 22.6 KBytes [ 5] 1.00-2.00 sec 33.6 MBytes 282 Mbits/sec 426 19.8 KBytes [ 5] 2.00-3.00 sec 34.0 MBytes 285 Mbits/sec 343 21.2 KBytes [ 5] 3.00-4.00 sec 32.9 MBytes 276 Mbits/sec 354 22.6 KBytes [ 5] 4.00-5.00 sec 32.3 MBytes 271 Mbits/sec 297 18.4 KBytes ^C[ 5] 5.00-5.06 sec 2.05 MBytes 270 Mbits/sec 45 19.8 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.06 sec 163 MBytes 271 Mbits/sec 1822 sender [ 5] 0.00-5.06 sec 0.00 Bytes 0.00 bits/sec receiver
After:
root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 49470 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 112 MBytes 941 Mbits/sec 259 143 KBytes [ 5] 1.00-2.00 sec 110 MBytes 920 Mbits/sec 329 144 KBytes [ 5] 2.00-3.00 sec 112 MBytes 936 Mbits/sec 255 144 KBytes [ 5] 3.00-4.00 sec 110 MBytes 927 Mbits/sec 355 105 KBytes [ 5] 4.00-5.00 sec 110 MBytes 926 Mbits/sec 350 156 KBytes [ 5] 5.00-6.00 sec 110 MBytes 925 Mbits/sec 305 148 KBytes [ 5] 6.00-7.00 sec 110 MBytes 924 Mbits/sec 320 143 KBytes [ 5] 7.00-8.00 sec 110 MBytes 925 Mbits/sec 273 97.6 KBytes [ 5] 8.00-9.00 sec 109 MBytes 913 Mbits/sec 299 141 KBytes [ 5] 9.00-10.00 sec 110 MBytes 922 Mbits/sec 287 146 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1.08 GBytes 926 Mbits/sec 3032 sender [ 5] 0.00-10.00 sec 1.08 GBytes 925 Mbits/sec receiver
--- drivers/net/ethernet/mscc/ocelot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mscc/ocelot.c +4 -1
@@ -555,7 +555,10 @@ void ocelot_phylink_mac_link_up(struct oocelot_write_rix (ocelot,0 ,ANA_POL_FLOWC , port); -ocelot_fields_write (ocelot, port,SYS_PAUSE_CFG_PAUSE_ENA , tx_pause); +/* Don't attempt to send PAUSE frames on the NPI port, it's broken */ +if (port != ocelot->npi) +ocelot_fields_write (ocelot, port,SYS_PAUSE_CFG_PAUSE_ENA , + tx_pause);/* Undo the effects of ocelot_phylink_mac_link_down: * enable MAC module
Greg Kroah-Hartman
maintainerPATCH 830/846 bcmgenet: add WOL IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
commit 9deb48b53e7f4056c2eaa2dc2ee3338df619e4f6 upstream.
The driver neglects to check the result of platform_get_irq_optional()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL. Stop calling devm_request_irq() with the invalid IRQ #s.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +6 -4
@@ -3966,10 +3966,12 @@ static int bcmgenet_probe(struct platfor/* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled = true; - err =devm_request_irq (&pdev->dev, priv->wol_irq, bcmgenet_wol_isr,0 , - dev->name, priv); -if (!err) -device_set_wakeup_capable (&pdev->dev,1 ); +if (priv->wol_irq >0 ) { + err =devm_request_irq (&pdev->dev, priv->wol_irq, + bcmgenet_wol_isr,0 , dev->name, priv); +if (!err) +device_set_wakeup_capable (&pdev->dev,1 ); + }/* Set the needed headroom to account for any possible * features enabling/disabling at runtime
Greg Kroah-Hartman
maintainerPATCH 831/846 net: wwan: Fix MRU mismatch issue which may lead to data connection lost
In reply to Greg Kroah-HartmanFrom: Slark Xiao <[email protected]>
commit f542cdfa3083a309e3caafbbdf41490c4935492a upstream.
In pci_generic.c there is a 'mru_default' in struct mhi_pci_dev_info.
This value shall be used for whole mhi if it's given a value for a specific product. But in function mhi_net_rx_refill_work(), it's still using hard code value MHI_DEFAULT_MRU. 'mru_default' shall have higher priority than MHI_DEFAULT_MRU.
And after checking, this change could help fix a data connection lost issue.
--- drivers/net/wwan/mhi_wwan_mbim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wwan/mhi_wwan_mbim.c +2 -2
@@ -385,13 +385,13 @@ static void mhi_net_rx_refill_work(struct work_struct *work)int err;while (!mhi_queue_is_full (mdev,DMA_FROM_DEVICE )) { -struct sk_buff *skb =alloc_skb (MHI_DEFAULT_MRU ,GFP_KERNEL ); +struct sk_buff *skb =alloc_skb (mbim->mru,GFP_KERNEL );if (unlikely (!skb))break ; err =mhi_queue_skb (mdev,DMA_FROM_DEVICE , skb, -MHI_DEFAULT_MRU ,MHI_EOT ); + mbim->mru,MHI_EOT );if (unlikely (err)) {kfree_skb (skb);break ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 832/846 net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config()
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit 214b3369ab9b0a6f28d6c970220c209417edbc65 upstream.
Clang static analysis reports this problem mtk_eth_soc.c:394:7: warning: Branch condition evaluates
to a garbage value
if (err)
^~~err is not initialized and only conditionally set. So intitialize err.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +1 -1
@@ -224,7 +224,7 @@ static void mtk_mac_config(struct phylin phylink_config);struct mtk_eth *eth = mac->hw;u32 mcr_cur, mcr_new, sid, i; -int val, ge_mode, err; +int val, ge_mode, err =0 ;/* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
Greg Kroah-Hartman
maintainerPATCH 833/846 net: ocelot: Fix the call to switchdev_bridge_port_offload
In reply to Greg Kroah-HartmanFrom: Horatiu Vultur <[email protected]>
commit c0b7f7d7e0ad44f35745c01964b3fa2833e298cb upstream.
In the blamed commit, the call to the function switchdev_bridge_port_offload was passing the wrong argument for atomic_nb. It was ocelot_netdevice_nb instead of ocelot_swtchdev_nb. This patch fixes this issue.
--- drivers/net/ethernet/mscc/ocelot_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mscc/ocelot_net.c +3 -3
@@ -1168,7 +1168,7 @@ static int ocelot_netdevice_bridge_join(ocelot_port_bridge_join (ocelot, port, bridge); err =switchdev_bridge_port_offload (brport_dev, dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb, false, extack);if (err)
@@ -1182,7 +1182,7 @@ static int ocelot_netdevice_bridge_join( err_switchdev_sync:switchdev_bridge_port_unoffload (brport_dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb); err_switchdev_offload:ocelot_port_bridge_leave (ocelot, port, bridge);
@@ -1195,7 +1195,7 @@ static void ocelot_netdevice_pre_bridge_struct ocelot_port_private *priv =netdev_priv (dev);switchdev_bridge_port_unoffload (brport_dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb); }
Greg Kroah-Hartman
maintainerPATCH 834/846 net: sfp: fix high power modules without diagnostic monitoring
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
commit 5765cee119bf5a36c94d20eceb37c445508934be upstream.
Commit 7cfa9c92d0a3 ("net: sfp: avoid power switch on address-change modules") unintetionally changed the semantics for high power modules without the digital diagnostics monitoring. We repeatedly attempt to read the power status from the non-existing 0xa2 address in a futile hope this failure is temporary:
[ 8.856051] sfp sfp-eth3: module NTT 0000000000000000 rev 0000 sn 0000000000000000 dc 160408 [ 8.865843] mvpp2 f4000000.ethernet eth3: switched to inband/1000base-x link mode [ 8.873469] sfp sfp-eth3: Failed to read EEPROM: -5 [ 8.983251] sfp sfp-eth3: Failed to read EEPROM: -5 [ 9.103250] sfp sfp-eth3: Failed to read EEPROM: -5
We previosuly assumed such modules were powered up in the correct mode, continuing without further configuration as long as the required power class was supported by the host.
Restore this behaviour, while preserving the intent of subsequent patches to avoid the "Address Change Sequence not supported" warning if we are not going to be accessing the DDM address.
--- drivers/net/phy/sfp.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/net/phy/sfp.c +21 -4
@@ -1641,17 +1641,20 @@ static int sfp_sm_probe_for_phy(struct sstatic int sfp_module_parse_power (struct sfp *sfp) {u32 power_mW =1000 ; +bool supports_a2;if (sfp->id.ext.options &cpu_to_be16 (SFP_OPTIONS_POWER_DECL )) power_mW =1500 ;if (sfp->id.ext.options &cpu_to_be16 (SFP_OPTIONS_HIGH_POWER_LEVEL )) power_mW =2000 ; + supports_a2 = sfp->id.ext.sff8472_compliance != +SFP_SFF8472_COMPLIANCE_NONE || + sfp->id.ext.diagmon &SFP_DIAGMON_DDM ; +if (power_mW > sfp->max_power_mW) {/* Module power specification exceeds the allowed maximum. */ -if (sfp->id.ext.sff8472_compliance == -SFP_SFF8472_COMPLIANCE_NONE && - !(sfp->id.ext.diagmon &SFP_DIAGMON_DDM )) { +if (!supports_a2) {/* The module appears not to implement bus address * 0xa2, so assume that the module powers up in the * indicated mode.
@@ -1668,11 +1671,25 @@ static int sfp_module_parse_power(struct } } +if (power_mW <=1000 ) { +/* Modules below 1W do not require a power change sequence */ + sfp->module_power_mW = power_mW; +return 0 ; + } + +if (!supports_a2) { +/* The module power level is below the host maximum and the +* module appears not to implement bus address 0xa2, so assume +* that the module powers up in the indicated mode. +*/ +return 0 ; + } +/* If the module requires a higher power mode, but also requires * an address change sequence, warn the user that the module may * not be functional. */ -if (sfp->id.ext.diagmon &SFP_DIAGMON_ADDRMODE && power_mW >1000 ) { +if (sfp->id.ext.diagmon &SFP_DIAGMON_ADDRMODE ) {dev_warn (sfp->dev,"Address Change Sequence not supported but module requires %u.%uW, module may not be functional\n" , power_mW /1000 , (power_mW /100 ) %10 );
Greg Kroah-Hartman
maintainerPATCH 835/846 net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit 1771afd47430f5e95c9c3a2e3a8a63e67402d3fe upstream.
Both versions of the CPSW driver declare a CPSW_HEADROOM_NA macro that takes NET_IP_ALIGN into account, but fail to use it appropriately when storing incoming packets in memory. This results in the IPv4 source and destination addresses to appear misaligned in memory, which causes aligment faults that need to be fixed up in software.
So let's switch from CPSW_HEADROOM to CPSW_HEADROOM_NA where needed. This gets rid of any alignment faults on the RX path on a Beaglebone White.
--- drivers/net/ethernet/ti/cpsw.c | 6 +++--- drivers/net/ethernet/ti/cpsw_new.c | 6 +++--- drivers/net/ethernet/ti/cpsw_priv.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/ti/cpsw.c +3 -3
@@ -349,7 +349,7 @@ static void cpsw_rx_handler(void *token,struct cpsw_common *cpsw =ndev_to_cpsw (xmeta->ndev);int pkt_size = cpsw->rx_packet_max;int ret =0 , port, ch = xmeta->ch; -int headroom =CPSW_HEADROOM ; +int headroom =CPSW_HEADROOM_NA ;struct net_device *ndev = xmeta->ndev;struct cpsw_priv *priv;struct page_pool *pool;
@@ -392,7 +392,7 @@ static void cpsw_rx_handler(void *token, }if (priv->xdp_prog) { -int headroom =CPSW_HEADROOM , size = len; +int size = len;xdp_init_buff (&xdp,PAGE_SIZE , &priv->xdp_rxq[ch]);if (status &CPDMA_RX_VLAN_ENCAP ) {
@@ -442,7 +442,7 @@ requeue: xmeta->ndev = ndev; xmeta->ch = ch; - dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM ; + dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM_NA ; ret =cpdma_chan_submit_mapped (cpsw->rxv[ch].ch, new_page, dma, pkt_size,0 );if (ret <0 ) {
drivers/net/ethernet/ti/cpsw_new.c +3 -3
@@ -283,7 +283,7 @@ static void cpsw_rx_handler(void *token, {struct page *new_page, *page = token;void *pa =page_address (page); -int headroom =CPSW_HEADROOM ; +int headroom =CPSW_HEADROOM_NA ;struct cpsw_meta_xdp *xmeta;struct cpsw_common *cpsw;struct net_device *ndev;
@@ -336,7 +336,7 @@ static void cpsw_rx_handler(void *token, }if (priv->xdp_prog) { -int headroom =CPSW_HEADROOM , size = len; +int size = len;xdp_init_buff (&xdp,PAGE_SIZE , &priv->xdp_rxq[ch]);if (status &CPDMA_RX_VLAN_ENCAP ) {
@@ -386,7 +386,7 @@ requeue: xmeta->ndev = ndev; xmeta->ch = ch; - dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM ; + dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM_NA ; ret =cpdma_chan_submit_mapped (cpsw->rxv[ch].ch, new_page, dma, pkt_size,0 );if (ret <0 ) {
drivers/net/ethernet/ti/cpsw_priv.c +1 -1
@@ -1120,7 +1120,7 @@ int cpsw_fill_rx_channels(struct cpsw_pr xmeta->ndev = priv->ndev; xmeta->ch = ch; - dma =page_pool_get_dma_addr (page) +CPSW_HEADROOM ; + dma =page_pool_get_dma_addr (page) +CPSW_HEADROOM_NA ; ret = cpdma_chan_idle_submit_mapped(cpsw->rxv[ch].ch, page, dma, cpsw->rx_packet_max,
Greg Kroah-Hartman
maintainerPATCH 836/846 net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
commit f1131b9c23fb4a3540a774828ff49f421619f902 upstream.
On a setup with KSZ9131 and MACB drivers it happens on suspend path, from time to time, that the PHY interrupt arrives after PHY and MACB were suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this case the phy_read() at the beginning of kszphy_handle_interrupt() will fail (as MACB driver is suspended at this time) leading to phy_error() being called and a stack trace being displayed on console. To solve this .suspend/.resume functions for all KSZ devices implementing .handle_interrupt were replaced with kszphy_suspend()/kszphy_resume() which disable/enable interrupt before/after calling genphy_suspend()/genphy_resume().
The fix has been adapted for all KSZ devices which implements .handle_interrupt but it has been tested only on KSZ9131.
--- drivers/net/phy/micrel.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/net/phy/micrel.c +18 -18
@@ -1547,8 +1547,8 @@ static struct phy_driver ksphy_driver[] .config_init = kszphy_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8021, .phy_id_mask = 0x00ffffff,
@@ -1562,8 +1562,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8031, .phy_id_mask = 0x00ffffff,
@@ -1577,8 +1577,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8041, .phy_id_mask = MICREL_PHY_ID_MASK,
@@ -1609,8 +1609,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .name = "Micrel KSZ8051", /* PHY_BASIC_FEATURES */
@@ -1623,8 +1623,8 @@ static struct phy_driver ksphy_driver[] .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, .match_phy_device = ksz8051_match_phy_device, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8001, .name = "Micrel KSZ8001 or KS8721",
@@ -1638,8 +1638,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8081, .name = "Micrel KSZ8081 or KSZ8091",
@@ -1669,8 +1669,8 @@ static struct phy_driver ksphy_driver[] .config_init = ksz8061_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ9021, .phy_id_mask = 0x000ffffe,
@@ -1685,8 +1685,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, }, {
@@ -1704,7 +1704,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, + .suspend = kszphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_LAN8814,
@@ -1732,7 +1732,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, + .suspend = kszphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8873MLL,
Greg Kroah-Hartman
maintainerPATCH 837/846 net: mscc: ocelot: fix using match before it is set
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit baa59504c1cd0cca7d41954a45ee0b3dc78e41a0 upstream.
Clang static analysis reports this issue ocelot_flower.c:563:8: warning: 1st function call argument
is an uninitialized value
!is_zero_ether_addr(match.mask->dst)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The variable match is used before it is set. So move the block.
--- drivers/net/ethernet/mscc/ocelot_flower.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/ethernet/mscc/ocelot_flower.c +8 -7
@@ -467,13 +467,6 @@ ocelot_flower_parse_key(struct ocelot *oreturn -EOPNOTSUPP ; } -if (filter->block_id ==VCAP_IS1 && - !is_zero_ether_addr (match.mask->dst)) { -NL_SET_ERR_MSG_MOD (extack, -"Key type S1_NORMAL cannot match on destination MAC" ); -return -EOPNOTSUPP ; - } -/* The hw support mac matches only for MAC_ETYPE key, * therefore if other matches(port, tcp flags, etc) are added * then just bail out
@@ -488,6 +481,14 @@ ocelot_flower_parse_key(struct ocelot *oreturn -EOPNOTSUPP ;flow_rule_match_eth_addrs (rule, &match); + +if (filter->block_id ==VCAP_IS1 && + !is_zero_ether_addr (match.mask->dst)) { +NL_SET_ERR_MSG_MOD (extack, +"Key type S1_NORMAL cannot match on destination MAC" ); +return -EOPNOTSUPP ; + } + filter->key_type =OCELOT_VCAP_KEY_ETYPE ;ether_addr_copy (filter->key.etype.dmac.value, match.key->dst);
Greg Kroah-Hartman
maintainerPATCH 838/846 dt-bindings: display: meson-dw-hdmi: add missing sound-name-prefix property
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
commit 22bf4047d26980807611b7e2030803db375afd87 upstream.
This is used in meson-gx and meson-g12. Add the property to the binding. This fixes the dtschema warning:
hdmi-tx@c883a000: 'sound-name-prefix' does not match any of the
regexes: 'pinctrl-[0-9]+'
--- Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml +5 -0
@@ -10,6 +10,9 @@ title: Amlogic specific extensions to th maintainers: - Neil Armstrong <[email protected]> +allOf: + - $ref: /schemas/sound/name-prefix.yaml# + description: | The Amlogic Meson Synopsys Designware Integration is composed of - A Synopsys DesignWare HDMI Controller IP
@@ -99,6 +102,8 @@ properties: "#sound-dai-cells": const: 0 + sound-name-prefix: true + required: - compatible - reg
Greg Kroah-Hartman
maintainerPATCH 839/846 dt-bindings: display: meson-vpu: Add missing amlogic,canvas property
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
commit 640f35b871d29cd685ce0ea0762636381beeb98a upstream.
This property was already mentioned in the old textual bindings amlogic,meson-vpu.txt, but got dropped during conversion. Adding it back similar to amlogic,gx-vdec.yaml.
--- Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +6 -0
@@ -78,6 +78,10 @@ properties: interrupts: maxItems: 1 + amlogic,canvas: + description: should point to a canvas provider node + $ref: /schemas/types.yaml#/definitions/phandle + power-domains: maxItems: 1 description: phandle to the associated power domain
@@ -106,6 +110,7 @@ required: - port@1 - "#address-cells" - "#size-cells" + - amlogic,canvas additionalProperties: false
@@ -118,6 +123,7 @@ examples: interrupts = <3>; #address-cells = <1>; #size-cells = <0>; + amlogic,canvas = <&canvas>; /* CVBS VDAC output port */ port@0 {
Greg Kroah-Hartman
maintainerPATCH 840/846 dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7
In reply to Greg Kroah-HartmanFrom: Sam Protsenko <[email protected]>
commit 33950f9a36aca55c2b1e6062d9b29f3e97f91c40 upstream.
Exynos7 watchdog driver is clearly indicating that its dts node must define syscon phandle property. That was probably forgotten, so add it.
--- Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml +3 -2
@@ -39,8 +39,8 @@ properties: samsung,syscon-phandle: $ref: /schemas/types.yaml#/definitions/phandle description: - Phandle to the PMU system controller node (in case of Exynos5250 - and Exynos5420). + Phandle to the PMU system controller node (in case of Exynos5250, + Exynos5420 and Exynos7). required: - compatible
@@ -58,6 +58,7 @@ allOf: enum: - samsung,exynos5250-wdt - samsung,exynos5420-wdt + - samsung,exynos7-wdt then: required: - samsung,syscon-phandle
Greg Kroah-Hartman
maintainerPATCH 841/846 sch_api: Dont skip qdisc attach on ingress
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
commit de2d807b294d3d2ce5e59043ae2634016765d076 upstream.
The attach callback of struct Qdisc_ops is used by only a few qdiscs:
mq, mqprio and htb. qdisc_graft() contains the following logic (pseudocode):
if (!qdisc->ops->attach) {
if (ingress)
do ingress stuff;
else
do egress stuff;
}
if (!ingress) {
...
if (qdisc->ops->attach)
qdisc->ops->attach(qdisc);
} else {
...
}As we see, the attach callback is not called if the qdisc is being attached to ingress (TC_H_INGRESS). That wasn't a problem for mq and mqprio, since they contain a check that they are attached to TC_H_ROOT, and they can't be attached to TC_H_INGRESS anyway.
However, the commit cited below added the attach callback to htb. It is needed for the hardware offload, but in the non-offload mode it simulates the "do egress stuff" part of the pseudocode above. The problem is that when htb is attached to ingress, neither "do ingress stuff" nor attach() is called. It results in an inconsistency, and the following message is printed to dmesg:
unregister_netdevice: waiting for lo to become free. Usage count = 2
This commit addresses the issue by running "do ingress stuff" in the ingress flow even in the attach callback is present, which is fine, because attach isn't going to be called afterwards.
The bug was found by syzbot and reported by Eric.
--- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_api.c +1 -1
@@ -1062,7 +1062,7 @@ static int qdisc_graft(struct net_deviceqdisc_offload_graft_root (dev, new, old, extack); -if (new && new->ops->attach) +if (new && new->ops->attach && !ingress) goto skip;for (i =0 ; i < num_q; i++) {
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.17 release. There are 846 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.17-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerPATCH 842/846 scripts/dtc: dtx_diff: remove broken example from help text
In reply to Greg Kroah-HartmanFrom: Matthias Schiffer <[email protected]>
commit d8adf5b92a9d2205620874d498c39923ecea8749 upstream.
dtx_diff suggests to use <(...) syntax to pipe two inputs into it, but this has never worked: The /proc/self/fds/... paths passed by the shell will fail the [ -f "${dtx}" ] && [ -r "${dtx}" ] check in compile_to_dts, but even with this check removed, the function cannot work: hexdump will eat up the DTB magic, making the subsequent dtc call fail, as a pipe cannot be rewound.
Simply remove this broken example, as there is already an alternative one that works fine.
--- scripts/dtc/dtx_diff | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
scripts/dtc/dtx_diff +2 -6
@@ -59,12 +59,8 @@ Otherwise DTx is treated as a dts source or '/include/' to be processed. If DTx_1 and DTx_2 are in different architectures, then this script - may not work since \${ARCH} is part of the include path. Two possible - workarounds: - - `basename $0` \\ - <(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\ - <(ARCH=arch_of_dtx_2 `basename $0` DTx_2) + may not work since \${ARCH} is part of the include path. The following + workaround can be used: `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts
Greg Kroah-Hartman
maintainerPATCH 843/846 lib82596: Fix IRQ check in sni_82596_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 99218cbf81bf21355a3de61cd46a706d36e900e6 upstream.
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/net/ethernet/i825xx/sni_82596.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/i825xx/sni_82596.c +2 -1
@@ -117,9 +117,10 @@ static int sni_82596_probe(struct platfo netdevice->dev_addr[5 ] =readb (eth_addr +0x06 );iounmap (eth_addr); -if (!netdevice->irq) { +if (netdevice->irq <0 ) {printk (KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n" , __FILE__, netdevice->base_addr); + retval = netdevice->irq; goto probe_failed; }
Greg Kroah-Hartman
maintainerPATCH 844/846 mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault
In reply to Greg Kroah-HartmanFrom: Alistair Popple <[email protected]>
commit 87c01d57fa23de82fff593a7d070933d08755801 upstream.
hmm_range_fault() can be used instead of get_user_pages() for devices which allow faulting however unlike get_user_pages() it will return an error when used on a VM_MIXEDMAP range.
To make hmm_range_fault() more closely match get_user_pages() remove this restriction. This requires dealing with the !ARCH_HAS_PTE_SPECIAL case in hmm_vma_handle_pte(). Rather than replicating the logic of vm_normal_page() call it directly and do a check for the zero pfn similar to what get_user_pages() currently does.
Also add a test to hmm selftest to verify functionality.
--- lib/test_hmm.c | 24 ++++++++++++++++++ mm/hmm.c | 5 ++- tools/testing/selftests/vm/hmm-tests.c | 42 +++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-)
lib/test_hmm.c +24 -0
@@ -1087,9 +1087,33 @@ static long dmirror_fops_unlocked_ioctl(return 0 ; } +static int dmirror_fops_mmap (struct file *file,struct vm_area_struct *vma) +{ +unsigned long addr; + +for (addr = vma->vm_start; addr < vma->vm_end; addr +=PAGE_SIZE ) { +struct page *page; +int ret; + + page =alloc_page (GFP_KERNEL | __GFP_ZERO); +if (!page) +return -ENOMEM ; + + ret =vm_insert_page (vma, addr, page); +if (ret) { +__free_page (page); +return ret; + } +put_page (page); + } + +return 0 ; +} +static const struct file_operations dmirror_fops = { .open = dmirror_fops_open, .release = dmirror_fops_release, + .mmap = dmirror_fops_mmap, .unlocked_ioctl = dmirror_fops_unlocked_ioctl, .llseek = default_llseek, .owner =THIS_MODULE ,
mm/hmm.c +3 -2
@@ -300,7 +300,8 @@ static int hmm_vma_handle_pte(struct mm_* Since each architecture defines a struct page for the zero page, just * fall through and treat it like a normal page. */ -if (pte_special (pte) && !pte_devmap (pte) && +if (!vm_normal_page (walk->vma, addr, pte) && + !pte_devmap (pte) && !is_zero_pfn (pte_pfn (pte))) {if (hmm_pte_need_fault (hmm_vma_walk, pfn_req_flags,0 )) {pte_unmap (ptep);
@@ -518,7 +519,7 @@ static int hmm_vma_walk_test(unsigned lostruct hmm_range *range = hmm_vma_walk->range;struct vm_area_struct *vma = walk->vma; -if (!(vma->vm_flags & (VM_IO |VM_PFNMAP |VM_MIXEDMAP )) && +if (!(vma->vm_flags & (VM_IO |VM_PFNMAP )) && vma->vm_flags &VM_READ )return 0 ;
tools/testing/selftests/vm/hmm-tests.c +42 -0
48 lines not on this page · raw message
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.17 release. There are 846 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.17-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Regressions detected on arm, arm64, i386, x86.
This is one from arm64:
/builds/linux/arch/arm64/mm/extable.c: In function 'fixup_exception':
/builds/linux/arch/arm64/mm/extable.c:17:13: error: implicit declaration of function 'in_bpf_jit' [-Werror=implicit-function-declaration]
17 | if (in_bpf_jit(regs))
| ^~~~~~~~~~ cc1: some warnings being treated as errors
make[3]: *** [/builds/linux/scripts/Makefile.build:277: arch/arm64/mm/extable.o] Error 1
This is another one, in Perf (arm, arm64, i386, x86):
libbpf.c: In function 'bpf_object__elf_collect':
libbpf.c:3038:31: error: invalid type argument of '->' (have 'GElf_Shdr' {aka 'Elf64_Shdr'})
3038 | if (sh->sh_type != SHT_PROGBITS)
| ^~
libbpf.c:3042:31: error: invalid type argument of '->' (have 'GElf_Shdr' {aka 'Elf64_Shdr'})
3042 | if (sh->sh_type != SHT_PROGBITS)
| ^~
make[4]: *** [/builds/linux/tools/build/Makefile.build:97: /home/tuxbuild/.cache/tuxmake/builds/current/staticobjs/libbpf.o] Error 1
Greetings!
Daniel Díaz
[email protected]
Hello!
Quoted 23 lines · Daniel Díaz
Hello!
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.17 release. There are 846 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.17-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y and the diffstat can be found below.Quoted 3 lines
thanks,
greg k-h
Regressions detected on arm, arm64, i386, x86.
Quoted 7 lines
This is one from arm64:
/builds/linux/arch/arm64/mm/extable.c: In function 'fixup_exception':
/builds/linux/arch/arm64/mm/extable.c:17:13: error: implicit declaration of function 'in_bpf_jit' [-Werror=implicit-function-declaration] 17 | if (in_bpf_jit(regs))
| ^~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [/builds/linux/scripts/Makefile.build:277:arch/arm64/mm/extable.o] Error 1
Bisection here pointed to "arm64/bpf: Remove 128MB limit for BPF JIT programs". Reverting made the build succeed.
Greetings!
Daniel Díaz
[email protected]
Quoted 25 lines · Daniel Díaz
Hello!
Quoted 21 lines · Daniel Díaz
Hello!
Quoted 17 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.17 release. There are 846 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.17-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Regressions detected on arm, arm64, i386, x86 on 5.15 and 5.10
Quoted 10 lines
Quoted 8 lines
This is one from arm64:
/builds/linux/arch/arm64/mm/extable.c: In function 'fixup_exception':/builds/linux/arch/arm64/mm/extable.c:17:13: error: implicit declaration of function 'in_bpf_jit' [-Werror=implicit-function-declaration] 17 | if (in_bpf_jit(regs)) | ^~~~~~~~~~ cc1: some warnings being treated as errors make[3]: *** [/builds/linux/scripts/Makefile.build:277: arch/arm64/mm/extable.o] Error 1Bisection here pointed to "arm64/bpf: Remove 128MB limit for BPF JIT programs". Reverting made the build succeed.
arm64/bpf: Remove 128MB limit for BPF JIT programs commit b89ddf4cca43f1269093942cf5c4e457fd45c335 upstream.
Quoted 5 lines
Greetings!
Daniel Díaz
[email protected]