clk: rockchip: rk3568: Add PLL rate for 292.5MHz
Subsystems (13)
Sasha Levin
maintainerPATCH 1/18 clk: rockchip: rk3568: Add PLL rate for 292.5MHz
From: Chris Morgan <[email protected]>
[ Upstream commit 1af27671f62ce919f1fb76082ed81f71cb090989 ]
Add support for a PLL rate of 292.5MHz so that the Powkiddy RGB30 panel can run at a requested 60hz (59.96, close enough).
I have confirmed this rate fits with all the constraints listed in the TRM for the VPLL (as an integer PLL) in Part 1 "Chapter 2 Clock & Reset Unit (CRU)."
--- drivers/clk/rockchip/clk-rk3568.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/rockchip/clk-rk3568.c +1 -0
@@ -72,6 +72,7 @@ static struct rockchip_pll_rate_table rk3568_pll_rates[] = {RK3036_PLL_RATE (408000000 ,1 ,68 ,2 ,2 ,1 ,0 ),RK3036_PLL_RATE (312000000 ,1 ,78 ,6 ,1 ,1 ,0 ),RK3036_PLL_RATE (297000000 ,2 ,99 ,4 ,1 ,1 ,0 ), +RK3036_PLL_RATE (292500000 ,1 ,195 ,4 ,4 ,1 ,0 ),RK3036_PLL_RATE (241500000 ,2 ,161 ,4 ,2 ,1 ,0 ),RK3036_PLL_RATE (216000000 ,1 ,72 ,4 ,2 ,1 ,0 ), RK3036_PLL_RATE(200000000, 1, 100, 3, 4, 1, 0),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/18 clk: rockchip: rk3128: Fix HCLK_OTG gate register
From: Weihao Li <[email protected]>
[ Upstream commit c6c5a5580dcb6631aa6369dabe12ef3ce784d1d2 ]
The HCLK_OTG gate control is in CRU_CLKGATE5_CON, not CRU_CLKGATE3_CON.
--- drivers/clk/rockchip/clk-rk3128.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3128.c +1 -1
@@ -490,7 +490,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {GATE (HCLK_I2S_2CH ,"hclk_i2s_2ch" ,"hclk_peri" ,0 ,RK2928_CLKGATE_CON (7 ),2 ,GFLAGS ),GATE (0 ,"hclk_usb_peri" ,"hclk_peri" ,CLK_IGNORE_UNUSED ,RK2928_CLKGATE_CON (9 ),13 ,GFLAGS ),GATE (HCLK_HOST2 ,"hclk_host2" ,"hclk_peri" ,0 ,RK2928_CLKGATE_CON (7 ),3 ,GFLAGS ), -GATE (HCLK_OTG ,"hclk_otg" ,"hclk_peri" ,0 ,RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), +GATE (HCLK_OTG ,"hclk_otg" ,"hclk_peri" ,0 ,RK2928_CLKGATE_CON (5 ),13 ,GFLAGS ),GATE (0 ,"hclk_peri_ahb" ,"hclk_peri" ,CLK_IGNORE_UNUSED ,RK2928_CLKGATE_CON (9 ),14 ,GFLAGS ),GATE (HCLK_SPDIF ,"hclk_spdif" ,"hclk_peri" ,0 ,RK2928_CLKGATE_CON (10 ),9 ,GFLAGS ), GATE(HCLK_TSP, "hclk_tsp", "hclk_peri", 0, RK2928_CLKGATE_CON(10), 12, GFLAGS),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/18 soundwire: intel_ace2x: fix AC timing setting for ACE2.x
In reply to Sasha LevinFrom: Chao Song <[email protected]>
[ Upstream commit 393cae5f32d640b9798903702018a48c7a45e59f ]
Start from ACE1.x, DOAISE is added to AC timing control register bit 5, it combines with DOAIS to get effective timing, and has the default value 1.
The current code fills DOAIS, DACTQE and DODS bits to a variable initialized to zero, and updates the variable to AC timing control register. With this operation, We change DOAISE to 0, and force a much more aggressive timing. The timing is even unable to form a working waveform on SDA pin.
This patch uses read-modify-write operation for the AC timing control register access, thus makes sure those bits not supposed and intended to change are not touched.
--- drivers/soundwire/intel_ace2x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soundwire/intel_ace2x.c +2 -1
@@ -23,8 +23,9 @@static void intel_shim_vs_init (struct sdw_intel *sdw) {void __iomem *shim_vs = sdw->link_res->shim_vs; -u16 act =0 ; +u16 act; + act =intel_readw (shim_vs,SDW_SHIM2_INTEL_VS_ACTMCTL );u16p_replace_bits (&act,0x1 ,SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS ); act |=SDW_SHIM2_INTEL_VS_ACTMCTL_DACTQE ; act |=SDW_SHIM2_INTEL_VS_ACTMCTL_DODS ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/18 jbd2: correct the printing of write_flags in jbd2_write_superblock()
In reply to Sasha LevinFrom: Zhang Yi <[email protected]>
[ Upstream commit 85559227211020b270728104c3b89918f7af27ac ]
The write_flags print in the trace of jbd2_write_superblock() is not real, so move the modification before the trace.
--- fs/jbd2/journal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/jbd2/journal.c +3 -1
@@ -1791,9 +1791,11 @@ static int jbd2_write_superblock(journal_t *journal, blk_opf_t write_flags)return -EIO ; } -trace_jbd2_write_superblock (journal, write_flags);if (!(journal->j_flags &JBD2_BARRIER )) write_flags &= ~(REQ_FUA |REQ_PREFLUSH ); + +trace_jbd2_write_superblock (journal, write_flags); +if (buffer_write_io_error (bh)) {/* * Oh, dear. A previous attempt to write the journal
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/18 jbd2: increase the journal IO's priority
In reply to Sasha LevinFrom: Zhang Yi <[email protected]>
[ Upstream commit 6a3afb6ac6dfab158ebdd4b87941178f58c8939f ]
Current jbd2 only add REQ_SYNC for descriptor block, metadata log buffer, commit buffer and superblock buffer, the submitted IO could be throttled by writeback throttle in block layer, that could lead to priority inversion in some cases. The log IO looks like a kind of high priority metadata IO, so it should not be throttled by WBT like QOS policies in block layer, let's add REQ_SYNC | REQ_IDLE to exempt from writeback throttle, and also add REQ_META together indicates it's a metadata IO.
--- fs/jbd2/commit.c | 9 +++++---- fs/jbd2/journal.c | 20 +++++++++++--------- include/linux/jbd2.h | 3 +++ 3 files changed, 19 insertions(+), 13 deletions(-)
fs/jbd2/commit.c +5 -4
@@ -119,7 +119,7 @@ static int journal_submit_commit_record(journal_t *journal,struct commit_header *tmp;struct buffer_head *bh;struct timespec64 now; -blk_opf_t write_flags =REQ_OP_WRITE |REQ_SYNC ; +blk_opf_t write_flags =REQ_OP_WRITE |JBD2_JOURNAL_REQ_FLAGS ; *cbh =NULL ;
@@ -395,8 +395,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)*/ jbd2_journal_update_sb_log_tail (journal, journal->j_tail_sequence, - journal->j_tail, -REQ_SYNC ); + journal->j_tail,0 );mutex_unlock (&journal->j_checkpoint_mutex); }else {jbd2_debug (3 ,"superblock not updated\n" );
@@ -715,6 +714,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)for (i =0 ; i < bufs; i++) {struct buffer_head *bh = wbuf[i]; +/* * Compute checksum. */
@@ -727,7 +727,8 @@ void jbd2_journal_commit_transaction(journal_t *journal)clear_buffer_dirty (bh);set_buffer_uptodate (bh); bh->b_end_io = journal_end_buffer_io_sync; -submit_bh (REQ_OP_WRITE |REQ_SYNC , bh); +submit_bh (REQ_OP_WRITE |JBD2_JOURNAL_REQ_FLAGS , + bh); }cond_resched ();
fs/jbd2/journal.c +11 -9
@@ -1100,8 +1100,7 @@ int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)* space and if we lose sb update during power failure we'd replay * old transaction with possibly newly overwritten data. */ - ret =jbd2_journal_update_sb_log_tail (journal, tid, block, -REQ_SYNC |REQ_FUA ); + ret =jbd2_journal_update_sb_log_tail (journal, tid, block,REQ_FUA );if (ret) goto out;
@@ -1768,8 +1767,7 @@ static int journal_reset(journal_t *journal)*/ jbd2_journal_update_sb_log_tail (journal, journal->j_tail_sequence, - journal->j_tail, -REQ_SYNC |REQ_FUA ); + journal->j_tail,REQ_FUA );mutex_unlock (&journal->j_checkpoint_mutex); }return jbd2_journal_start_thread (journal);
@@ -1791,6 +1789,11 @@ static int jbd2_write_superblock(journal_t *journal, blk_opf_t write_flags)return -EIO ; } +/* +* Always set high priority flags to exempt from block layer's +* QOS policies, e.g. writeback throttle. +*/ + write_flags |=JBD2_JOURNAL_REQ_FLAGS ;if (!(journal->j_flags &JBD2_BARRIER )) write_flags &= ~(REQ_FUA |REQ_PREFLUSH );
@@ -2045,7 +2048,7 @@ void jbd2_journal_update_sb_errno(journal_t *journal)jbd2_debug (1 ,"JBD2: updating superblock error (errno %d)\n" , errcode); sb->s_errno =cpu_to_be32 (errcode); -jbd2_write_superblock (journal,REQ_SYNC |REQ_FUA ); +jbd2_write_superblock (journal,REQ_FUA ); }EXPORT_SYMBOL (jbd2_journal_update_sb_errno);
@@ -2166,8 +2169,7 @@ int jbd2_journal_destroy(journal_t *journal) ++journal->j_transaction_sequence;write_unlock (&journal->j_state_lock); -jbd2_mark_journal_empty (journal, -REQ_SYNC |REQ_PREFLUSH |REQ_FUA ); +jbd2_mark_journal_empty (journal,REQ_PREFLUSH |REQ_FUA );mutex_unlock (&journal->j_checkpoint_mutex); }else err = -EIO ;
@@ -2468,7 +2470,7 @@ int jbd2_journal_flush(journal_t *journal, unsigned int flags)* the magic code for a fully-recovered superblock. Any future * commits of data to the journal will restore the current * s_start value. */ -jbd2_mark_journal_empty (journal,REQ_SYNC |REQ_FUA ); +jbd2_mark_journal_empty (journal,REQ_FUA );if (flags) err =__jbd2_journal_erase (journal, flags);
@@ -2514,7 +2516,7 @@ int jbd2_journal_wipe(journal_t *journal, int write)if (write) {/* Lock to make assertions happy... */ mutex_lock_io (&journal->j_checkpoint_mutex); -jbd2_mark_journal_empty (journal,REQ_SYNC |REQ_FUA ); +jbd2_mark_journal_empty (journal,REQ_FUA );mutex_unlock (&journal->j_checkpoint_mutex); }
include/linux/jbd2.h +3 -0
@@ -1374,6 +1374,9 @@ JBD2_FEATURE_INCOMPAT_FUNCS(csum2, CSUM_V2) JBD2_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3)JBD2_FEATURE_INCOMPAT_FUNCS (fast_commit,FAST_COMMIT ) +/* Journal high priority write IO operation flags */ +#define JBD2_JOURNAL_REQ_FLAGS (REQ_META | REQ_SYNC | REQ_IDLE) +/* * Journal flag definitions */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/18 HID: Add quirk for Labtec/ODDOR/aikeec handbrake
In reply to Sasha LevinFrom: Sebastian Parschauer <[email protected]>
[ Upstream commit 31e52523267faab5ed8569b9d5c22c9a2283872f ]
This device needs ALWAYS_POLL quirk, otherwise it keeps reconnecting indefinitely. It is a handbrake for sim racing detected as joystick. Reported and tested by GitHub user N0th1ngM4tt3rs.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -744,6 +744,7 @@#define USB_VENDOR_ID_LABTEC 0x1020#define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 +#define USB_DEVICE_ID_LABTEC_ODDOR_HANDBRAKE 0x8888#define USB_VENDOR_ID_LCPOWER 0x1241#define USB_DEVICE_ID_LCPOWER_LC1000 0xf767
drivers/hid/hid-quirks.c +1 -0
@@ -120,6 +120,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_T609A), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_ODDOR_HANDBRAKE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_OPTICAL_USB_MOUSE_600E), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019), HID_QUIRK_ALWAYS_POLL },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/18 drm/crtc: Fix uninit-value bug in drm_mode_setcrtc
In reply to Sasha LevinFrom: Ziqi Zhao <[email protected]>
[ Upstream commit 3823119b9c2b5f9e9b760336f75bc989b805cde6 ]
The connector_set contains uninitialized values when allocated with kmalloc_array. However, in the "out" branch, the logic assumes that any element in connector_set would be equal to NULL if failed to initialize, which causes the bug reported by Syzbot. The fix is to use an extra variable to keep track of how many connectors are initialized indeed, and use that variable to decrease any refcounts in the "out" branch.
--- drivers/gpu/drm/drm_crtc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_crtc.c +5 -4
@@ -715,8 +715,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,struct drm_mode_set set;uint32_t __user *set_connectors_ptr;struct drm_modeset_acquire_ctx ctx; -int ret; -int i; +int ret, i, num_connectors;if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EOPNOTSUPP ;
@@ -851,6 +850,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, goto out; } + num_connectors =0 ;for (i =0 ; i < crtc_req->count_connectors; i++) { connector_set[i] =NULL ; set_connectors_ptr = (uint32_t __user *)(unsigned long )crtc_req->set_connectors_ptr;
@@ -871,6 +871,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, connector->name); connector_set[i] = connector; + num_connectors++; } }
@@ -879,7 +880,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, set.y = crtc_req->y; set.mode = mode; set.connectors = connector_set; - set.num_connectors = crtc_req->count_connectors; + set.num_connectors = num_connectors; set.fb = fb;if (drm_drv_uses_atomic_modeset (dev))
@@ -892,7 +893,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,drm_framebuffer_put (fb);if (connector_set) { -for (i =0 ; i < crtc_req->count_connectors; i++) { +for (i =0 ; i < num_connectors; i++) {if (connector_set[i])drm_connector_put (connector_set[i]); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/18 neighbour: Don't let neigh_forced_gc() disable preemption for long
In reply to Sasha LevinFrom: Judy Hsiao <[email protected]>
[ Upstream commit e5dc5afff62f3e97e86c3643ec9fcad23de4f2d3 ]
We are seeing cases where neigh_cleanup_and_release() is called by neigh_forced_gc() many times in a row with preemption turned off. When running on a low powered CPU at a low CPU frequency, this has been measured to keep preemption off for ~10 ms. That's not great on a system with HZ=1000 which expects tasks to be able to schedule in with ~1ms latency.
--- net/core/neighbour.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/core/neighbour.c +8 -1
@@ -253,9 +253,11 @@ static int neigh_forced_gc(struct neigh_table *tbl) {int max_clean =atomic_read (&tbl->gc_entries) -READ_ONCE (tbl->gc_thresh2); +u64 tmax =ktime_get_ns () +NSEC_PER_MSEC ;unsigned long tref = jiffies -5 *HZ ;struct neighbour *n, *tmp;int shrunk =0 ; +int loop =0 ;NEIGH_CACHE_STAT_INC (tbl, forced_gc_runs);
@@ -278,11 +280,16 @@ static int neigh_forced_gc(struct neigh_table *tbl) shrunk++;if (shrunk >= max_clean)break ; +if (++loop ==16 ) { +if (ktime_get_ns () > tmax) + goto unlock; + loop =0 ; + } } }WRITE_ONCE (tbl->last_flush, jiffies); - +unlock:write_unlock_bh (&tbl->lock);return shrunk;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/18 platform/x86: intel-vbtn: Fix missing tablet-mode-switch events
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 14c200b7ca46b9a9f4af9e81d258a58274320b6f ]
2 issues have been reported on the Dell Inspiron 7352:
1. Sometimes the tablet-mode-switch stops reporting tablet-mode change events.
Add a "VBDL" call to notify_handler() to work around this.
2. Sometimes the tablet-mode is incorrect after suspend/resume
Add a detect_tablet_mode() to resume() to fix this.
--- drivers/platform/x86/intel/vbtn.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/platform/x86/intel/vbtn.c +15 -4
@@ -73,10 +73,10 @@ struct intel_vbtn_priv {bool wakeup_mode; }; -static void detect_tablet_mode (struct platform_device *device) +static void detect_tablet_mode (struct device *dev) { -struct intel_vbtn_priv *priv =dev_get_drvdata (&device->dev); -acpi_handle handle =ACPI_HANDLE (&device->dev); +struct intel_vbtn_priv *priv =dev_get_drvdata (dev); +acpi_handle handle =ACPI_HANDLE (dev);unsigned long long vgbs;acpi_status status;int m;
@@ -89,6 +89,8 @@ static void detect_tablet_mode(struct platform_device *device)input_report_switch (priv->switches_dev,SW_TABLET_MODE , m); m = (vgbs &VGBS_DOCK_MODE_FLAG ) ?1 :0 ;input_report_switch (priv->switches_dev,SW_DOCK , m); + +input_sync (priv->switches_dev); }/*
@@ -134,7 +136,7 @@ static int intel_vbtn_input_setup(struct platform_device *device) priv->switches_dev->id.bustype =BUS_HOST ;if (priv->has_switches) { -detect_tablet_mode (device); +detect_tablet_mode (&device->dev); ret =input_register_device (priv->switches_dev);if (ret)
@@ -198,6 +200,9 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) autorelease = val && (!ke_rel || ke_rel->type ==KE_IGNORE );sparse_keymap_report_event (input_dev, event, val, autorelease); + +/* Some devices need this to report further events */ +acpi_evaluate_object (handle,"VBDL" ,NULL ,NULL ); }/*
@@ -352,7 +357,13 @@ static void intel_vbtn_pm_complete(struct device *dev)static int intel_vbtn_pm_resume (struct device *dev) { +struct intel_vbtn_priv *priv =dev_get_drvdata (dev); +intel_vbtn_pm_complete (dev); + +if (priv->has_switches) +detect_tablet_mode (dev); +return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/18 ksmbd: avoid duplicate opinfo_put() call on error of smb21_lease_break_ack()
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit 658609d9a618d8881bf549b5893c0ba8fcff4526 ]
opinfo_put() could be called twice on error of smb21_lease_break_ack(). It will cause UAF issue if opinfo is referenced on other places.
--- fs/smb/server/smb2pdu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/smb/server/smb2pdu.c +5 -5
@@ -8205,6 +8205,11 @@ static void smb21_lease_break_ack(struct ksmbd_work *work) le32_to_cpu(req->LeaseState)); } +if (ret <0 ) { + rsp->hdr.Status = err; + goto err_out; + } + lease_state = lease->state; opinfo->op_state =OPLOCK_STATE_NONE ;wake_up_interruptible_all (&opinfo->oplock_q);
@@ -8212,11 +8217,6 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)wake_up_interruptible_all (&opinfo->oplock_brk);opinfo_put (opinfo); -if (ret <0 ) { - rsp->hdr.Status = err; - goto err_out; - } - rsp->StructureSize =cpu_to_le16 (36 ); rsp->Reserved =0 ; rsp->Flags =0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/18 efi/loongarch: Use load address to calculate kernel entry address
In reply to Sasha LevinFrom: Wang Yao <[email protected]>
[ Upstream commit 271f2a4a9576b87ed1f8584909d6d270039e52ea ]
The efi_relocate_kernel() may load the PIE kernel to anywhere, the loaded address may not be equal to link address or EFI_KIMG_PREFERRED_ADDRESS.
--- arch/loongarch/include/asm/efi.h | 2 +- drivers/firmware/efi/libstub/loongarch-stub.c | 4 ++-- drivers/firmware/efi/libstub/loongarch.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/loongarch/include/asm/efi.h +1 -1
@@ -32,6 +32,6 @@ static inline unsigned long efi_get_kimg_min_align(void)#define EFI_KIMG_PREFERRED_ADDRESS PHYSADDR(VMLINUX_LOAD_ADDRESS) -unsigned long kernel_entry_address (void ); +unsigned long kernel_entry_address (unsigned long kernel_addr);#endif /* _ASM_LOONGARCH_EFI_H */
drivers/firmware/efi/libstub/loongarch-stub.c +2 -2
@@ -35,9 +35,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,return status; } -unsigned long kernel_entry_address (void ) +unsigned long kernel_entry_address (unsigned long kernel_addr) {unsigned long base = (unsigned long )&kernel_offset - kernel_offset; -return (unsigned long )&kernel_entry - base +VMLINUX_LOAD_ADDRESS ; +return (unsigned long )&kernel_entry - base + kernel_addr; }
drivers/firmware/efi/libstub/loongarch.c +3 -3
@@ -37,9 +37,9 @@ static efi_status_t exit_boot_func(struct efi_boot_memmap *map, void *priv)return EFI_SUCCESS ; } -unsigned long __weak kernel_entry_address (void ) +unsigned long __weak kernel_entry_address (unsigned long kernel_addr) { -return *(unsigned long *)(PHYSADDR (VMLINUX_LOAD_ADDRESS ) +8 ); +return *(unsigned long *)(kernel_addr +8 ) -VMLINUX_LOAD_ADDRESS + kernel_addr; } efi_status_t efi_boot_kernel(void *handle, efi_loaded_image_t *image,
@@ -73,7 +73,7 @@ efi_status_t efi_boot_kernel(void *handle, efi_loaded_image_t *image,csr_write64 (CSR_DMW0_INIT ,LOONGARCH_CSR_DMWIN0 );csr_write64 (CSR_DMW1_INIT ,LOONGARCH_CSR_DMWIN1 ); - real_kernel_entry = (void *)kernel_entry_address (); + real_kernel_entry = (void *)kernel_entry_address (kernel_addr);real_kernel_entry (true, (unsigned long )cmdline_ptr, (unsigned long )efi_system_table);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/18 jbd2: fix soft lockup in journal_finish_inode_data_buffers()
In reply to Sasha LevinFrom: Ye Bin <[email protected]>
[ Upstream commit 6c02757c936063f0631b4e43fe156f8c8f1f351f ]
There's issue when do io test:
WARN: soft lockup - CPU#45 stuck for 11s! [jbd2/dm-2-8:4170]
CPU: 45 PID: 4170 Comm: jbd2/dm-2-8 Kdump: loaded Tainted: G OE Call trace: dump_backtrace+0x0/0x1a0 show_stack+0x24/0x30 dump_stack+0xb0/0x100 watchdog_timer_fn+0x254/0x3f8 __hrtimer_run_queues+0x11c/0x380 hrtimer_interrupt+0xfc/0x2f8 arch_timer_handler_phys+0x38/0x58 handle_percpu_devid_irq+0x90/0x248 generic_handle_irq+0x3c/0x58 __handle_domain_irq+0x68/0xc0 gic_handle_irq+0x90/0x320 el1_irq+0xcc/0x180 queued_spin_lock_slowpath+0x1d8/0x320 jbd2_journal_commit_transaction+0x10f4/0x1c78 [jbd2] kjournald2+0xec/0x2f0 [jbd2] kthread+0x134/0x138 ret_from_fork+0x10/0x18
Analyzed informations from vmcore as follows:
(1) There are about 5k+ jbd2_inode in 'commit_transaction->t_inode_list';
(2) Now is processing the 855th jbd2_inode;
(3) JBD2 task has TIF_NEED_RESCHED flag;
(4) There's no pags in address_space around the 855th jbd2_inode;
(5) There are some process is doing drop caches;
(6) Mounted with 'nodioread_nolock' option;
(7) 128 CPUs;
According to informations from vmcore we know 'journal->j_list_lock' spin lock competition is fierce. So journal_finish_inode_data_buffers() maybe process slowly. Theoretically, there is scheduling point in the filemap_fdatawait_range_keep_errors(). However, if inode's address_space has no pages which taged with PAGECACHE_TAG_WRITEBACK, will not call cond_resched(). So may lead to soft lockup. journal_finish_inode_data_buffers
filemap_fdatawait_range_keep_errors
__filemap_fdatawait_range
while (index <= end)
nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, PAGECACHE_TAG_WRITEBACK);
if (!nr_pages)
break; --> If 'nr_pages' is equal zero will break, then will not call cond_resched()
for (i = 0; i < nr_pages; i++)
wait_on_page_writeback(page);
cond_resched();To solve above issue, add scheduling point in the journal_finish_inode_data_buffers();
--- fs/jbd2/commit.c | 1 + 1 file changed, 1 insertion(+)
fs/jbd2/commit.c +1 -0
@@ -270,6 +270,7 @@ static int journal_finish_inode_data_buffers(journal_t *journal,if (!ret) ret = err; } +cond_resched ();spin_lock (&journal->j_list_lock); jinode->i_flags &= ~JI_COMMIT_RUNNING ;smp_mb ();
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/18 tracing: Have large events show up as '[LINE TOO BIG]' instead of nothing
In reply to Sasha LevinFrom: "Steven Rostedt (Google)" <[email protected]>
[ Upstream commit b55b0a0d7c4aa2dac3579aa7e6802d1f57445096 ]
If a large event was added to the ring buffer that is larger than what the trace_seq can handle, it just drops the output:
~# cat /sys/kernel/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2 #P:8
#
# _-----=> irqs-off/BH-disabled
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / _-=> migrate-disable
# |||| / delay
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
<...>-859 [001] ..... 141.118951: tracing_mark_write <...>-859 [001] ..... 141.148201: tracing_mark_write: 78901234Instead, catch this case and add some context:
~# cat /sys/kernel/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2 #P:8
#
# _-----=> irqs-off/BH-disabled
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / _-=> migrate-disable
# |||| / delay
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
<...>-852 [001] ..... 121.550551: tracing_mark_write[LINE TOO BIG]
<...>-852 [001] ..... 121.550581: tracing_mark_write: 78901234This now emulates the same output as trace_pipe.
--- kernel/trace/trace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/trace/trace.c +5 -1
@@ -4730,7 +4730,11 @@ static int s_show(struct seq_file *m, void *v) iter->leftover = ret; }else { -print_trace_line (iter); + ret =print_trace_line (iter); +if (ret ==TRACE_TYPE_PARTIAL_LINE ) { + iter->seq.full =0 ; +trace_seq_puts (&iter->seq,"[LINE TOO BIG]\n" ); + } ret =trace_print_seq (m, &iter->seq);/* * If we overflow the seq_file buffer, then it will
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/18 tracing: Add size check when printing trace_marker output
In reply to Sasha LevinFrom: "Steven Rostedt (Google)" <[email protected]>
[ Upstream commit 60be76eeabb3d83858cc6577fc65c7d0f36ffd42 ]
If for some reason the trace_marker write does not have a nul byte for the string, it will overflow the print:
trace_seq_printf(s, ": %s", field->buf);
The field->buf could be missing the nul byte. To prevent overflow, add the max size that the buf can be by using the event size and the field location.
int max = iter->ent_size - offsetof(struct print_entry, buf); trace_seq_printf(s, ": %*.s", max, field->buf);
--- kernel/trace/trace_output.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace_output.c +4 -2
@@ -1587,11 +1587,12 @@ static enum print_line_t trace_print_print(struct trace_iterator *iter, {struct print_entry *field;struct trace_seq *s = &iter->seq; +int max = iter->ent_size - offsetof(struct print_entry , buf);trace_assign_type (field, iter->ent);seq_print_ip_sym (s, field->ip, flags); -trace_seq_printf (s,": %s" , field->buf); +trace_seq_printf (s,": %.*s" , max, field->buf);return trace_handle_return (s); }
@@ -1600,10 +1601,11 @@ static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags, struct trace_event *event) {struct print_entry *field; +int max = iter->ent_size - offsetof(struct print_entry , buf);trace_assign_type (field, iter->ent); -trace_seq_printf (&iter->seq,"# %lx %s" , field->ip, field->buf); +trace_seq_printf (&iter->seq,"# %lx %.*s" , field->ip, max, field->buf);return trace_handle_return (&iter->seq); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/18 stmmac: dwmac-loongson: drop useless check for compatible fallback
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 31fea092c6f9f8fb2c40a08137907f5fbeae55dd ]
Device binds to proper PCI ID (LOONGSON, 0x7a03), already listed in DTS, so checking for some other compatible does not make sense. It cannot be bound to unsupported platform.
Drop useless, incorrect (space in between) and undocumented compatible.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +0 -5
@@ -59,11 +59,6 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_idreturn -ENODEV ; } -if (!of_device_is_compatible (np,"loongson, pci-gmac" )) { -pr_info ("dwmac_loongson_pci: Incompatible OF node\n" ); -return -ENODEV ; - } - plat =devm_kzalloc (&pdev->dev,sizeof (*plat),GFP_KERNEL );if (!plat)return -ENOMEM ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/18 MIPS: dts: loongson: drop incorrect dwmac fallback compatible
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 4907a3f54b12b8209864572a312cf967befcae80 ]
Device binds to proper PCI ID (LOONGSON, 0x7a03), already listed in DTS, so checking for some other compatible does not make sense. It cannot be bound to unsupported platform.
Drop useless, incorrect (space in between) and undocumented compatible.
--- arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi | 3 +-- arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi +1 -2
@@ -130,8 +130,7 @@ gmac@3,0 { compatible = "pci0014,7a03.0", "pci0014,7a03", "pciclass0c0320", - "pciclass0c03", - "loongson, pci-gmac"; + "pciclass0c03"; reg = <0x1800 0x0 0x0 0x0 0x0>; interrupts = <12 IRQ_TYPE_LEVEL_LOW>,
arch/mips/boot/dts/loongson/ls7a-pch.dtsi +1 -2
@@ -193,8 +193,7 @@ gmac@3,0 { compatible = "pci0014,7a03.0", "pci0014,7a03", "pciclass020000", - "pciclass0200", - "loongson, pci-gmac"; + "pciclass0200"; reg = <0x1800 0x0 0x0 0x0 0x0>; interrupts = <12 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/18 tracing: Fix uaf issue when open the hist or hist_debug file
In reply to Sasha LevinFrom: Zheng Yejian <[email protected]>
[ Upstream commit 1cc111b9cddc71ce161cd388f11f0e9048edffdb ]
KASAN report following issue. The root cause is when opening 'hist' file of an instance and accessing 'trace_event_file' in hist_show(), but 'trace_event_file' has been freed due to the instance being removed. 'hist_debug' file has the same problem. To fix it, call tracing_{open,release}_file_tr() in file_operations callback to have the ref count and avoid 'trace_event_file' being freed.
BUG: KASAN: slab-use-after-free in hist_show+0x11e0/0x1278 Read of size 8 at addr ffff242541e336b8 by task head/190 CPU: 4 PID: 190 Comm: head Not tainted 6.7.0-rc5-g26aff849438c #133 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x98/0xf8 show_stack+0x1c/0x30 dump_stack_lvl+0x44/0x58 print_report+0xf0/0x5a0 kasan_report+0x80/0xc0 __asan_report_load8_noabort+0x1c/0x28 hist_show+0x11e0/0x1278 seq_read_iter+0x344/0xd78 seq_read+0x128/0x1c0 vfs_read+0x198/0x6c8 ksys_read+0xf4/0x1e0 __arm64_sys_read+0x70/0xa8 invoke_syscall+0x70/0x260 el0_svc_common.constprop.0+0xb0/0x280 do_el0_svc+0x44/0x60 el0_svc+0x34/0x68 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x168/0x170 Allocated by task 188: kasan_save_stack+0x28/0x50 kasan_set_track+0x28/0x38 kasan_save_alloc_info+0x20/0x30 __kasan_slab_alloc+0x6c/0x80 kmem_cache_alloc+0x15c/0x4a8 trace_create_new_event+0x84/0x348 __trace_add_new_event+0x18/0x88 event_trace_add_tracer+0xc4/0x1a0 trace_array_create_dir+0x6c/0x100 trace_array_create+0x2e8/0x568 instance_mkdir+0x48/0x80 tracefs_syscall_mkdir+0x90/0xe8 vfs_mkdir+0x3c4/0x610 do_mkdirat+0x144/0x200 __arm64_sys_mkdirat+0x8c/0xc0 invoke_syscall+0x70/0x260 el0_svc_common.constprop.0+0xb0/0x280 do_el0_svc+0x44/0x60 el0_svc+0x34/0x68 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x168/0x170 Freed by task 191: kasan_save_stack+0x28/0x50 kasan_set_track+0x28/0x38 kasan_save_free_info+0x34/0x58 __kasan_slab_free+0xe4/0x158 kmem_cache_free+0x19c/0x508 event_file_put+0xa0/0x120 remove_event_file_dir+0x180/0x320 event_trace_del_tracer+0xb0/0x180 __remove_instance+0x224/0x508 instance_rmdir+0x44/0x78 tracefs_syscall_rmdir+0xbc/0x140 vfs_rmdir+0x1cc/0x4c8 do_rmdir+0x220/0x2b8 __arm64_sys_unlinkat+0xc0/0x100 invoke_syscall+0x70/0x260 el0_svc_common.constprop.0+0xb0/0x280 do_el0_svc+0x44/0x60 el0_svc+0x34/0x68 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x168/0x170
--- kernel/trace/trace.c | 6 ++++++ kernel/trace/trace.h | 1 + kernel/trace/trace_events_hist.c | 12 ++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-)
kernel/trace/trace.c +6 -0
@@ -4976,6 +4976,12 @@ int tracing_release_file_tr(struct inode *inode, struct file *filp)return 0 ; } +int tracing_single_release_file_tr (struct inode *inode,struct file *filp) +{ +tracing_release_file_tr (inode, filp); +return single_release (inode, filp); +} +static int tracing_mark_open (struct inode *inode,struct file *filp) {stream_open (inode, filp);
kernel/trace/trace.h +1 -0
@@ -612,6 +612,7 @@ int tracing_open_generic(struct inode *inode, struct file *filp);int tracing_open_generic_tr (struct inode *inode,struct file *filp);int tracing_open_file_tr (struct inode *inode,struct file *filp);int tracing_release_file_tr (struct inode *inode,struct file *filp); +int tracing_single_release_file_tr (struct inode *inode,struct file *filp);bool tracing_is_disabled (void );bool tracer_tracing_is_on (struct trace_array *tr);void tracer_tracing_on (struct trace_array *tr);
kernel/trace/trace_events_hist.c +8 -4
@@ -5630,10 +5630,12 @@ static int event_hist_open(struct inode *inode, struct file *file) {int ret; - ret =security_locked_down (LOCKDOWN_TRACEFS ); + ret =tracing_open_file_tr (inode, file);if (ret)return ret; +/* Clear private_data to avoid warning in single_open() */ + file->private_data =NULL ;return single_open (file, hist_show, file); }
@@ -5641,7 +5643,7 @@ const struct file_operations event_hist_fops = { .open = event_hist_open, .read = seq_read, .llseek = seq_lseek, - .release = single_release, + .release = tracing_single_release_file_tr, };#ifdef CONFIG_HIST_TRIGGERS_DEBUG
@@ -5907,10 +5909,12 @@ static int event_hist_debug_open(struct inode *inode, struct file *file) {int ret; - ret =security_locked_down (LOCKDOWN_TRACEFS ); + ret =tracing_open_file_tr (inode, file);if (ret)return ret; +/* Clear private_data to avoid warning in single_open() */ + file->private_data =NULL ;return single_open (file, hist_debug_show, file); }
@@ -5918,7 +5922,7 @@ const struct file_operations event_hist_debug_fops = { .open = event_hist_debug_open, .read = seq_read, .llseek = seq_lseek, - .release = single_release, + .release = tracing_single_release_file_tr, };#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/18 ring-buffer: Do not record in NMI if the arch does not support cmpxchg in NMI
In reply to Sasha LevinFrom: "Steven Rostedt (Google)" <[email protected]>
[ Upstream commit 712292308af2265cd9b126aedfa987f10f452a33 ]
As the ring buffer recording requires cmpxchg() to work, if the architecture does not support cmpxchg in NMI, then do not do any recording within an NMI.
--- kernel/trace/ring_buffer.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/trace/ring_buffer.c +6 -0
@@ -3714,6 +3714,12 @@ rb_reserve_next_event(struct trace_buffer *buffer,int nr_loops =0 ;int add_ts_default; +/* ring buffer does cmpxchg, make sure it is safe in NMI context */ +if (!IS_ENABLED (CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG ) && + (unlikely (in_nmi ()))) { +return NULL ; + } +rb_start_commit (cpu_buffer);/* The commit page can not change after this */
Signature · 1 line
2.43.0