From c9e4049c50f30fb946c4981ca6c21bc585935d8f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 30 Jul 2024 11:35:23 +0200 Subject: [PATCH] 4.19-stable patches added patches: perf-x86-intel-pt-fix-topa_entry-base-length.patch scsi-qla2xxx-during-vport-delete-send-async-logout-explicitly.patch scsi-qla2xxx-validate-nvme_local_port-correctly.patch watchdog-perf-properly-initialize-the-turbo-mode-timestamp-and-rearm-counter.patch --- ...-intel-pt-fix-topa_entry-base-length.patch | 44 +++++++++++ ...-delete-send-async-logout-explicitly.patch | 73 +++++++++++++++++++ ...x-validate-nvme_local_port-correctly.patch | 60 +++++++++++++++ queue-4.19/series | 4 + ...rbo-mode-timestamp-and-rearm-counter.patch | 68 +++++++++++++++++ 5 files changed, 249 insertions(+) create mode 100644 queue-4.19/perf-x86-intel-pt-fix-topa_entry-base-length.patch create mode 100644 queue-4.19/scsi-qla2xxx-during-vport-delete-send-async-logout-explicitly.patch create mode 100644 queue-4.19/scsi-qla2xxx-validate-nvme_local_port-correctly.patch create mode 100644 queue-4.19/watchdog-perf-properly-initialize-the-turbo-mode-timestamp-and-rearm-counter.patch diff --git a/queue-4.19/perf-x86-intel-pt-fix-topa_entry-base-length.patch b/queue-4.19/perf-x86-intel-pt-fix-topa_entry-base-length.patch new file mode 100644 index 00000000000..adde45268aa --- /dev/null +++ b/queue-4.19/perf-x86-intel-pt-fix-topa_entry-base-length.patch @@ -0,0 +1,44 @@ +From 5638bd722a44bbe97c1a7b3fae5b9efddb3e70ff Mon Sep 17 00:00:00 2001 +From: Marco Cavenati +Date: Mon, 24 Jun 2024 23:10:55 +0300 +Subject: perf/x86/intel/pt: Fix topa_entry base length + +From: Marco Cavenati + +commit 5638bd722a44bbe97c1a7b3fae5b9efddb3e70ff upstream. + +topa_entry->base needs to store a pfn. It obviously needs to be +large enough to store the largest possible x86 pfn which is +MAXPHYADDR-PAGE_SIZE (52-12). So it is 4 bits too small. + +Increase the size of topa_entry->base from 36 bits to 40 bits. + +Note, systems where physical addresses can be 256TiB or more are affected. + +[ Adrian: Amend commit message as suggested by Dave Hansen ] + +Fixes: 52ca9ced3f70 ("perf/x86/intel/pt: Add Intel PT PMU driver") +Signed-off-by: Marco Cavenati +Signed-off-by: Adrian Hunter +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240624201101.60186-2-adrian.hunter@intel.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/events/intel/pt.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/x86/events/intel/pt.h ++++ b/arch/x86/events/intel/pt.h +@@ -78,8 +78,8 @@ struct topa_entry { + u64 rsvd2 : 1; + u64 size : 4; + u64 rsvd3 : 2; +- u64 base : 36; +- u64 rsvd4 : 16; ++ u64 base : 40; ++ u64 rsvd4 : 12; + }; + + #define PT_CPUID_LEAVES 2 diff --git a/queue-4.19/scsi-qla2xxx-during-vport-delete-send-async-logout-explicitly.patch b/queue-4.19/scsi-qla2xxx-during-vport-delete-send-async-logout-explicitly.patch new file mode 100644 index 00000000000..53f603a1099 --- /dev/null +++ b/queue-4.19/scsi-qla2xxx-during-vport-delete-send-async-logout-explicitly.patch @@ -0,0 +1,73 @@ +From 76f480d7c717368f29a3870f7d64471ce0ff8fb2 Mon Sep 17 00:00:00 2001 +From: Manish Rangankar +Date: Wed, 10 Jul 2024 22:40:53 +0530 +Subject: scsi: qla2xxx: During vport delete send async logout explicitly + +From: Manish Rangankar + +commit 76f480d7c717368f29a3870f7d64471ce0ff8fb2 upstream. + +During vport delete, it is observed that during unload we hit a crash +because of stale entries in outstanding command array. For all these stale +I/O entries, eh_abort was issued and aborted (fast_fail_io = 2009h) but +I/Os could not complete while vport delete is in process of deleting. + + BUG: kernel NULL pointer dereference, address: 000000000000001c + #PF: supervisor read access in kernel mode + #PF: error_code(0x0000) - not-present page + PGD 0 P4D 0 + Oops: 0000 [#1] PREEMPT SMP NOPTI + Workqueue: qla2xxx_wq qla_do_work [qla2xxx] + RIP: 0010:dma_direct_unmap_sg+0x51/0x1e0 + RSP: 0018:ffffa1e1e150fc68 EFLAGS: 00010046 + RAX: 0000000000000000 RBX: 0000000000000021 RCX: 0000000000000001 + RDX: 0000000000000021 RSI: 0000000000000000 RDI: ffff8ce208a7a0d0 + RBP: ffff8ce208a7a0d0 R08: 0000000000000000 R09: ffff8ce378aac9c8 + R10: ffff8ce378aac8a0 R11: ffffa1e1e150f9d8 R12: 0000000000000000 + R13: 0000000000000000 R14: ffff8ce378aac9c8 R15: 0000000000000000 + FS: 0000000000000000(0000) GS:ffff8d217f000000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 000000000000001c CR3: 0000002089acc000 CR4: 0000000000350ee0 + Call Trace: + + qla2xxx_qpair_sp_free_dma+0x417/0x4e0 + ? qla2xxx_qpair_sp_compl+0x10d/0x1a0 + ? qla2x00_status_entry+0x768/0x2830 + ? newidle_balance+0x2f0/0x430 + ? dequeue_entity+0x100/0x3c0 + ? qla24xx_process_response_queue+0x6a1/0x19e0 + ? __schedule+0x2d5/0x1140 + ? qla_do_work+0x47/0x60 + ? process_one_work+0x267/0x440 + ? process_one_work+0x440/0x440 + ? worker_thread+0x2d/0x3d0 + ? process_one_work+0x440/0x440 + ? kthread+0x156/0x180 + ? set_kthread_struct+0x50/0x50 + ? ret_from_fork+0x22/0x30 + + +Send out async logout explicitly for all the ports during vport delete. + +Cc: stable@vger.kernel.org +Signed-off-by: Manish Rangankar +Signed-off-by: Nilesh Javali +Link: https://lore.kernel.org/r/20240710171057.35066-8-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_mid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_mid.c ++++ b/drivers/scsi/qla2xxx/qla_mid.c +@@ -161,7 +161,7 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) + atomic_set(&vha->loop_state, LOOP_DOWN); + atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); + list_for_each_entry(fcport, &vha->vp_fcports, list) +- fcport->logout_on_delete = 0; ++ fcport->logout_on_delete = 1; + + qla2x00_mark_all_devices_lost(vha, 0); + diff --git a/queue-4.19/scsi-qla2xxx-validate-nvme_local_port-correctly.patch b/queue-4.19/scsi-qla2xxx-validate-nvme_local_port-correctly.patch new file mode 100644 index 00000000000..4f84f45e5a0 --- /dev/null +++ b/queue-4.19/scsi-qla2xxx-validate-nvme_local_port-correctly.patch @@ -0,0 +1,60 @@ +From eb1d4ce2609584eeb7694866f34d4b213caa3af9 Mon Sep 17 00:00:00 2001 +From: Nilesh Javali +Date: Wed, 10 Jul 2024 22:40:48 +0530 +Subject: scsi: qla2xxx: validate nvme_local_port correctly + +From: Nilesh Javali + +commit eb1d4ce2609584eeb7694866f34d4b213caa3af9 upstream. + +The driver load failed with error message, + +qla2xxx [0000:04:00.0]-ffff:0: register_localport failed: ret=ffffffef + +and with a kernel crash, + + BUG: unable to handle kernel NULL pointer dereference at 0000000000000070 + Workqueue: events_unbound qla_register_fcport_fn [qla2xxx] + RIP: 0010:nvme_fc_register_remoteport+0x16/0x430 [nvme_fc] + RSP: 0018:ffffaaa040eb3d98 EFLAGS: 00010282 + RAX: 0000000000000000 RBX: ffff9dfb46b78c00 RCX: 0000000000000000 + RDX: ffff9dfb46b78da8 RSI: ffffaaa040eb3e08 RDI: 0000000000000000 + RBP: ffff9dfb612a0a58 R08: ffffffffaf1d6270 R09: 3a34303a30303030 + R10: 34303a303030305b R11: 2078787832616c71 R12: ffff9dfb46b78dd4 + R13: ffff9dfb46b78c24 R14: ffff9dfb41525300 R15: ffff9dfb46b78da8 + FS: 0000000000000000(0000) GS:ffff9dfc67c00000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 0000000000000070 CR3: 000000018da10004 CR4: 00000000000206f0 + Call Trace: + qla_nvme_register_remote+0xeb/0x1f0 [qla2xxx] + ? qla2x00_dfs_create_rport+0x231/0x270 [qla2xxx] + qla2x00_update_fcport+0x2a1/0x3c0 [qla2xxx] + qla_register_fcport_fn+0x54/0xc0 [qla2xxx] + +Exit the qla_nvme_register_remote() function when qla_nvme_register_hba() +fails and correctly validate nvme_local_port. + +Cc: stable@vger.kernel.org +Signed-off-by: Nilesh Javali +Link: https://lore.kernel.org/r/20240710171057.35066-3-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_nvme.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c +@@ -30,7 +30,10 @@ int qla_nvme_register_remote(struct scsi + return 0; + } + +- if (!vha->nvme_local_port && qla_nvme_register_hba(vha)) ++ if (qla_nvme_register_hba(vha)) ++ return 0; ++ ++ if (!vha->nvme_local_port) + return 0; + + if (!(fcport->nvme_prli_service_param & diff --git a/queue-4.19/series b/queue-4.19/series index 8762b9f5b11..96709606969 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -84,3 +84,7 @@ ubi-eba-properly-rollback-inside-self_check_eba.patch decompress_bunzip2-fix-rare-decompression-failure.patch kobject_uevent-fix-oob-access-within-zap_modalias_env.patch rtc-cmos-fix-return-value-of-nvmem-callbacks.patch +scsi-qla2xxx-during-vport-delete-send-async-logout-explicitly.patch +scsi-qla2xxx-validate-nvme_local_port-correctly.patch +perf-x86-intel-pt-fix-topa_entry-base-length.patch +watchdog-perf-properly-initialize-the-turbo-mode-timestamp-and-rearm-counter.patch diff --git a/queue-4.19/watchdog-perf-properly-initialize-the-turbo-mode-timestamp-and-rearm-counter.patch b/queue-4.19/watchdog-perf-properly-initialize-the-turbo-mode-timestamp-and-rearm-counter.patch new file mode 100644 index 00000000000..c19538cf01a --- /dev/null +++ b/queue-4.19/watchdog-perf-properly-initialize-the-turbo-mode-timestamp-and-rearm-counter.patch @@ -0,0 +1,68 @@ +From f944ffcbc2e1c759764850261670586ddf3bdabb Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Thu, 11 Jul 2024 22:25:21 +0200 +Subject: watchdog/perf: properly initialize the turbo mode timestamp and rearm counter + +From: Thomas Gleixner + +commit f944ffcbc2e1c759764850261670586ddf3bdabb upstream. + +For systems on which the performance counter can expire early due to turbo +modes the watchdog handler has a safety net in place which validates that +since the last watchdog event there has at least 4/5th of the watchdog +period elapsed. + +This works reliably only after the first watchdog event because the per +CPU variable which holds the timestamp of the last event is never +initialized. + +So a first spurious event will validate against a timestamp of 0 which +results in a delta which is likely to be way over the 4/5 threshold of the +period. As this might happen before the first watchdog hrtimer event +increments the watchdog counter, this can lead to false positives. + +Fix this by initializing the timestamp before enabling the hardware event. +Reset the rearm counter as well, as that might be non zero after the +watchdog was disabled and reenabled. + +Link: https://lkml.kernel.org/r/87frsfu15a.ffs@tglx +Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with turbo modes") +Signed-off-by: Thomas Gleixner +Cc: Arjan van de Ven +Cc: Peter Zijlstra +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + kernel/watchdog_hld.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/kernel/watchdog_hld.c ++++ b/kernel/watchdog_hld.c +@@ -91,11 +91,15 @@ static bool watchdog_check_timestamp(voi + __this_cpu_write(last_timestamp, now); + return true; + } +-#else +-static inline bool watchdog_check_timestamp(void) ++ ++static void watchdog_init_timestamp(void) + { +- return true; ++ __this_cpu_write(nmi_rearmed, 0); ++ __this_cpu_write(last_timestamp, ktime_get_mono_fast_ns()); + } ++#else ++static inline bool watchdog_check_timestamp(void) { return true; } ++static inline void watchdog_init_timestamp(void) { } + #endif + + static struct perf_event_attr wd_hw_attr = { +@@ -195,6 +199,7 @@ void hardlockup_detector_perf_enable(voi + if (!atomic_fetch_inc(&watchdog_cpus)) + pr_info("Enabled. Permanently consumes one hw-PMU counter.\n"); + ++ watchdog_init_timestamp(); + perf_event_enable(this_cpu_read(watchdog_ev)); + } + -- 2.47.3