From: Greg Kroah-Hartman Date: Thu, 13 Feb 2020 15:02:01 +0000 (-0800) Subject: 4.19-stable patches X-Git-Tag: v4.4.214~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b270f28a367e990e6c03f4713d18f57aae848a03;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch x86-stackframe-move-encode_frame_pointer-to-asm-frame.h.patch x86-stackframe-x86-ftrace-add-pt_regs-frame-annotations.patch --- diff --git a/queue-4.19/scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch b/queue-4.19/scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch new file mode 100644 index 00000000000..1dc3ed1d1e4 --- /dev/null +++ b/queue-4.19/scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch @@ -0,0 +1,71 @@ +From 6d7537270e3283b92f9b327da9d58a4de40fe8d0 Mon Sep 17 00:00:00 2001 +From: Anand Lodnoor +Date: Tue, 14 Jan 2020 16:51:19 +0530 +Subject: scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state + +From: Anand Lodnoor + +commit 6d7537270e3283b92f9b327da9d58a4de40fe8d0 upstream. + +Driver initiates OCR if a DCMD command times out. But there is a deadlock +if the driver attempts to invoke another OCR before the mutex lock +(reset_mutex) is released from the previous session of OCR. + +This patch takes care of the above scenario using new flag +MEGASAS_FUSION_OCR_NOT_POSSIBLE to indicate if OCR is possible. + +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/1579000882-20246-9-git-send-email-anand.lodnoor@broadcom.com +Signed-off-by: Shivasharan S +Signed-off-by: Anand Lodnoor +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + + +--- + drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- + drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 ++- + drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 + + 3 files changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -4177,7 +4177,8 @@ dcmd_timeout_ocr_possible(struct megasas + if (instance->adapter_type == MFI_SERIES) + return KILL_ADAPTER; + else if (instance->unload || +- test_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags)) ++ test_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, ++ &instance->reset_flags)) + return IGNORE_TIMEOUT; + else + return INITIATE_OCR; +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c +@@ -4558,6 +4558,7 @@ int megasas_reset_fusion(struct Scsi_Hos + if (instance->requestorId && !instance->skip_heartbeat_timer_del) + del_timer_sync(&instance->sriov_heartbeat_timer); + set_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); ++ set_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, &instance->reset_flags); + atomic_set(&instance->adprecovery, MEGASAS_ADPRESET_SM_POLLING); + instance->instancet->disable_intr(instance); + megasas_sync_irqs((unsigned long)instance); +@@ -4747,7 +4748,7 @@ fail_kill_adapter: + atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL); + } + out: +- clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); ++ clear_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, &instance->reset_flags); + mutex_unlock(&instance->reset_mutex); + return retval; + } +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h +@@ -102,6 +102,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { + + #define MEGASAS_FP_CMD_LEN 16 + #define MEGASAS_FUSION_IN_RESET 0 ++#define MEGASAS_FUSION_OCR_NOT_POSSIBLE 1 + #define THRESHOLD_REPLY_COUNT 50 + #define RAID_1_PEER_CMDS 2 + #define JBOD_MAPS_COUNT 2 diff --git a/queue-4.19/series b/queue-4.19/series index a9bad0f5388..a3d39e11777 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -47,3 +47,6 @@ mwifiex-fix-possible-buffer-overflows-in-mwifiex_ret.patch mwifiex-fix-possible-buffer-overflows-in-mwifiex_cmd.patch libertas-don-t-exit-from-lbs_ibss_join_existing-with.patch libertas-make-lbs_ibss_join_existing-return-error-co.patch +scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch +x86-stackframe-move-encode_frame_pointer-to-asm-frame.h.patch +x86-stackframe-x86-ftrace-add-pt_regs-frame-annotations.patch diff --git a/queue-4.19/x86-stackframe-move-encode_frame_pointer-to-asm-frame.h.patch b/queue-4.19/x86-stackframe-move-encode_frame_pointer-to-asm-frame.h.patch new file mode 100644 index 00000000000..ce3a55e3b68 --- /dev/null +++ b/queue-4.19/x86-stackframe-move-encode_frame_pointer-to-asm-frame.h.patch @@ -0,0 +1,150 @@ +From a9b3c6998d4a7d53a787cf4d0fd4a4c11239e517 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Wed, 8 May 2019 14:30:48 +0200 +Subject: x86/stackframe: Move ENCODE_FRAME_POINTER to asm/frame.h + +From: Peter Zijlstra + +commit a9b3c6998d4a7d53a787cf4d0fd4a4c11239e517 upstream. + +In preparation for wider use, move the ENCODE_FRAME_POINTER macros to +a common header and provide inline asm versions. + +These macros are used to encode a pt_regs frame for the unwinder; see +unwind_frame.c:decode_frame_pointer(). + +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Josh Poimboeuf +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Signed-off-by: Ingo Molnar +Signed-off-by: Dmitry Safonov +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/entry/calling.h | 15 ------------- + arch/x86/entry/entry_32.S | 16 -------------- + arch/x86/include/asm/frame.h | 49 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 49 insertions(+), 31 deletions(-) + +--- a/arch/x86/entry/calling.h ++++ b/arch/x86/entry/calling.h +@@ -172,21 +172,6 @@ For 32-bit we have the following convent + .endif + .endm + +-/* +- * This is a sneaky trick to help the unwinder find pt_regs on the stack. The +- * frame pointer is replaced with an encoded pointer to pt_regs. The encoding +- * is just setting the LSB, which makes it an invalid stack address and is also +- * a signal to the unwinder that it's a pt_regs pointer in disguise. +- * +- * NOTE: This macro must be used *after* PUSH_AND_CLEAR_REGS because it corrupts +- * the original rbp. +- */ +-.macro ENCODE_FRAME_POINTER ptregs_offset=0 +-#ifdef CONFIG_FRAME_POINTER +- leaq 1+\ptregs_offset(%rsp), %rbp +-#endif +-.endm +- + #ifdef CONFIG_PAGE_TABLE_ISOLATION + + /* +--- a/arch/x86/entry/entry_32.S ++++ b/arch/x86/entry/entry_32.S +@@ -245,22 +245,6 @@ + .Lend_\@: + .endm + +-/* +- * This is a sneaky trick to help the unwinder find pt_regs on the stack. The +- * frame pointer is replaced with an encoded pointer to pt_regs. The encoding +- * is just clearing the MSB, which makes it an invalid stack address and is also +- * a signal to the unwinder that it's a pt_regs pointer in disguise. +- * +- * NOTE: This macro must be used *after* SAVE_ALL because it corrupts the +- * original rbp. +- */ +-.macro ENCODE_FRAME_POINTER +-#ifdef CONFIG_FRAME_POINTER +- mov %esp, %ebp +- andl $0x7fffffff, %ebp +-#endif +-.endm +- + .macro RESTORE_INT_REGS + popl %ebx + popl %ecx +--- a/arch/x86/include/asm/frame.h ++++ b/arch/x86/include/asm/frame.h +@@ -22,6 +22,35 @@ + pop %_ASM_BP + .endm + ++#ifdef CONFIG_X86_64 ++/* ++ * This is a sneaky trick to help the unwinder find pt_regs on the stack. The ++ * frame pointer is replaced with an encoded pointer to pt_regs. The encoding ++ * is just setting the LSB, which makes it an invalid stack address and is also ++ * a signal to the unwinder that it's a pt_regs pointer in disguise. ++ * ++ * NOTE: This macro must be used *after* PUSH_AND_CLEAR_REGS because it corrupts ++ * the original rbp. ++ */ ++.macro ENCODE_FRAME_POINTER ptregs_offset=0 ++ leaq 1+\ptregs_offset(%rsp), %rbp ++.endm ++#else /* !CONFIG_X86_64 */ ++/* ++ * This is a sneaky trick to help the unwinder find pt_regs on the stack. The ++ * frame pointer is replaced with an encoded pointer to pt_regs. The encoding ++ * is just clearing the MSB, which makes it an invalid stack address and is also ++ * a signal to the unwinder that it's a pt_regs pointer in disguise. ++ * ++ * NOTE: This macro must be used *after* SAVE_ALL because it corrupts the ++ * original ebp. ++ */ ++.macro ENCODE_FRAME_POINTER ++ mov %esp, %ebp ++ andl $0x7fffffff, %ebp ++.endm ++#endif /* CONFIG_X86_64 */ ++ + #else /* !__ASSEMBLY__ */ + + #define FRAME_BEGIN \ +@@ -30,12 +59,32 @@ + + #define FRAME_END "pop %" _ASM_BP "\n" + ++#ifdef CONFIG_X86_64 ++#define ENCODE_FRAME_POINTER \ ++ "lea 1(%rsp), %rbp\n\t" ++#else /* !CONFIG_X86_64 */ ++#define ENCODE_FRAME_POINTER \ ++ "movl %esp, %ebp\n\t" \ ++ "andl $0x7fffffff, %ebp\n\t" ++#endif /* CONFIG_X86_64 */ ++ + #endif /* __ASSEMBLY__ */ + + #define FRAME_OFFSET __ASM_SEL(4, 8) + + #else /* !CONFIG_FRAME_POINTER */ + ++#ifdef __ASSEMBLY__ ++ ++.macro ENCODE_FRAME_POINTER ptregs_offset=0 ++.endm ++ ++#else /* !__ASSEMBLY */ ++ ++#define ENCODE_FRAME_POINTER ++ ++#endif ++ + #define FRAME_BEGIN + #define FRAME_END + #define FRAME_OFFSET 0 diff --git a/queue-4.19/x86-stackframe-x86-ftrace-add-pt_regs-frame-annotations.patch b/queue-4.19/x86-stackframe-x86-ftrace-add-pt_regs-frame-annotations.patch new file mode 100644 index 00000000000..72acd14d6f1 --- /dev/null +++ b/queue-4.19/x86-stackframe-x86-ftrace-add-pt_regs-frame-annotations.patch @@ -0,0 +1,64 @@ +From ea1ed38dba64b64a245ab8ca1406269d17b99485 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Tue, 7 May 2019 23:25:50 +0200 +Subject: x86/stackframe, x86/ftrace: Add pt_regs frame annotations + +From: Peter Zijlstra + +commit ea1ed38dba64b64a245ab8ca1406269d17b99485 upstream. + +When CONFIG_FRAME_POINTER, we should mark pt_regs frames. + +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Josh Poimboeuf +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Signed-off-by: Ingo Molnar +[4.19 backport; added user-visible changelog] +Signed-off-by: Dmitry Safonov +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/ftrace_32.S | 3 +++ + arch/x86/kernel/ftrace_64.S | 3 +++ + 2 files changed, 6 insertions(+) + +--- a/arch/x86/kernel/ftrace_32.S ++++ b/arch/x86/kernel/ftrace_32.S +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + #ifdef CC_USING_FENTRY + # define function_hook __fentry__ +@@ -131,6 +132,8 @@ ENTRY(ftrace_regs_caller) + pushl %ecx + pushl %ebx + ++ ENCODE_FRAME_POINTER ++ + movl 12*4(%esp), %eax /* Load ip (1st parameter) */ + subl $MCOUNT_INSN_SIZE, %eax /* Adjust ip */ + #ifdef CC_USING_FENTRY +--- a/arch/x86/kernel/ftrace_64.S ++++ b/arch/x86/kernel/ftrace_64.S +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + .code64 + .section .entry.text, "ax" +@@ -222,6 +223,8 @@ GLOBAL(ftrace_regs_caller_op_ptr) + leaq MCOUNT_REG_SIZE+8*2(%rsp), %rcx + movq %rcx, RSP(%rsp) + ++ ENCODE_FRAME_POINTER ++ + /* regs go into 4th parameter */ + leaq (%rsp), %rcx +