From ed5ae8b71bdef43ba9f51695b3cb2e30ed23cb8a Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 5 Feb 2021 07:39:47 -0500 Subject: [PATCH] Fixes for 4.19 Signed-off-by: Sasha Levin --- .../kthread-extract-kthread_is_per_cpu.patch | 111 ++++++++++++++++++ ...ac80211-fix-fast-rx-encryption-check.patch | 36 ++++++ ...l-don-t-fail-on-missing-symbol-table.patch | 51 ++++++++ ...x-warning-for-missing-regulator_disa.patch | 82 +++++++++++++ ...el-vbtn-support-for-tablet-mode-on-d.patch | 41 +++++++ ...chscreen_dmi-add-swap-x-y-quirk-for-.patch | 85 ++++++++++++++ ...default-timeout-to-avoid-crash-durin.patch | 85 ++++++++++++++ ...-invoking-response-handler-twice-if-.patch | 95 +++++++++++++++ ...ort_srp-don-t-block-target-in-failfa.patch | 45 +++++++ ...rpc-only-test-lwm-stmw-on-big-endian.patch | 61 ++++++++++ queue-4.19/series | 12 ++ ...-restrict-affinity-change-to-rescuer.patch | 58 +++++++++ .../x86-__always_inline-__-rd-wr-msr.patch | 48 ++++++++ 13 files changed, 810 insertions(+) create mode 100644 queue-4.19/kthread-extract-kthread_is_per_cpu.patch create mode 100644 queue-4.19/mac80211-fix-fast-rx-encryption-check.patch create mode 100644 queue-4.19/objtool-don-t-fail-on-missing-symbol-table.patch create mode 100644 queue-4.19/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch create mode 100644 queue-4.19/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch create mode 100644 queue-4.19/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch create mode 100644 queue-4.19/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch create mode 100644 queue-4.19/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch create mode 100644 queue-4.19/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch create mode 100644 queue-4.19/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch create mode 100644 queue-4.19/workqueue-restrict-affinity-change-to-rescuer.patch create mode 100644 queue-4.19/x86-__always_inline-__-rd-wr-msr.patch diff --git a/queue-4.19/kthread-extract-kthread_is_per_cpu.patch b/queue-4.19/kthread-extract-kthread_is_per_cpu.patch new file mode 100644 index 00000000000..55921973de3 --- /dev/null +++ b/queue-4.19/kthread-extract-kthread_is_per_cpu.patch @@ -0,0 +1,111 @@ +From b5628582dda685590b312a2550b2d7ff91ff297c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jan 2021 11:24:04 +0100 +Subject: kthread: Extract KTHREAD_IS_PER_CPU + +From: Peter Zijlstra + +[ Upstream commit ac687e6e8c26181a33270efd1a2e2241377924b0 ] + +There is a need to distinguish geniune per-cpu kthreads from kthreads +that happen to have a single CPU affinity. + +Geniune per-cpu kthreads are kthreads that are CPU affine for +correctness, these will obviously have PF_KTHREAD set, but must also +have PF_NO_SETAFFINITY set, lest userspace modify their affinity and +ruins things. + +However, these two things are not sufficient, PF_NO_SETAFFINITY is +also set on other tasks that have their affinities controlled through +other means, like for instance workqueues. + +Therefore another bit is needed; it turns out kthread_create_per_cpu() +already has such a bit: KTHREAD_IS_PER_CPU, which is used to make +kthread_park()/kthread_unpark() work correctly. + +Expose this flag and remove the implicit setting of it from +kthread_create_on_cpu(); the io_uring usage of it seems dubious at +best. + +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Valentin Schneider +Tested-by: Valentin Schneider +Link: https://lkml.kernel.org/r/20210121103506.557620262@infradead.org +Signed-off-by: Sasha Levin +--- + include/linux/kthread.h | 3 +++ + kernel/kthread.c | 27 ++++++++++++++++++++++++++- + kernel/smpboot.c | 1 + + 3 files changed, 30 insertions(+), 1 deletion(-) + +diff --git a/include/linux/kthread.h b/include/linux/kthread.h +index c1961761311db..72308c38e06c4 100644 +--- a/include/linux/kthread.h ++++ b/include/linux/kthread.h +@@ -32,6 +32,9 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data), + unsigned int cpu, + const char *namefmt); + ++void kthread_set_per_cpu(struct task_struct *k, int cpu); ++bool kthread_is_per_cpu(struct task_struct *k); ++ + /** + * kthread_run - create and wake a thread. + * @threadfn: the function to run until signal_pending(current). +diff --git a/kernel/kthread.c b/kernel/kthread.c +index 2eed853ab9cc5..81abfac351272 100644 +--- a/kernel/kthread.c ++++ b/kernel/kthread.c +@@ -460,11 +460,36 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data), + return p; + kthread_bind(p, cpu); + /* CPU hotplug need to bind once again when unparking the thread. */ +- set_bit(KTHREAD_IS_PER_CPU, &to_kthread(p)->flags); + to_kthread(p)->cpu = cpu; + return p; + } + ++void kthread_set_per_cpu(struct task_struct *k, int cpu) ++{ ++ struct kthread *kthread = to_kthread(k); ++ if (!kthread) ++ return; ++ ++ WARN_ON_ONCE(!(k->flags & PF_NO_SETAFFINITY)); ++ ++ if (cpu < 0) { ++ clear_bit(KTHREAD_IS_PER_CPU, &kthread->flags); ++ return; ++ } ++ ++ kthread->cpu = cpu; ++ set_bit(KTHREAD_IS_PER_CPU, &kthread->flags); ++} ++ ++bool kthread_is_per_cpu(struct task_struct *k) ++{ ++ struct kthread *kthread = to_kthread(k); ++ if (!kthread) ++ return false; ++ ++ return test_bit(KTHREAD_IS_PER_CPU, &kthread->flags); ++} ++ + /** + * kthread_unpark - unpark a thread created by kthread_create(). + * @k: thread created by kthread_create(). +diff --git a/kernel/smpboot.c b/kernel/smpboot.c +index c230c2dd48e19..84c16654d8598 100644 +--- a/kernel/smpboot.c ++++ b/kernel/smpboot.c +@@ -187,6 +187,7 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu) + kfree(td); + return PTR_ERR(tsk); + } ++ kthread_set_per_cpu(tsk, cpu); + /* + * Park the thread so that it could start right on the CPU + * when it is available. +-- +2.27.0 + diff --git a/queue-4.19/mac80211-fix-fast-rx-encryption-check.patch b/queue-4.19/mac80211-fix-fast-rx-encryption-check.patch new file mode 100644 index 00000000000..da12731f2f6 --- /dev/null +++ b/queue-4.19/mac80211-fix-fast-rx-encryption-check.patch @@ -0,0 +1,36 @@ +From fbd03ca0ac6f85c2c1eef4ce6bdd69d3b463a660 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Dec 2020 19:47:17 +0100 +Subject: mac80211: fix fast-rx encryption check + +From: Felix Fietkau + +[ Upstream commit 622d3b4e39381262da7b18ca1ed1311df227de86 ] + +When using WEP, the default unicast key needs to be selected, instead of +the STA PTK. + +Signed-off-by: Felix Fietkau +Link: https://lore.kernel.org/r/20201218184718.93650-5-nbd@nbd.name +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/rx.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 5e56719f999c4..9e92e5e2336be 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -4003,6 +4003,8 @@ void ieee80211_check_fast_rx(struct sta_info *sta) + + rcu_read_lock(); + key = rcu_dereference(sta->ptk[sta->ptk_idx]); ++ if (!key) ++ key = rcu_dereference(sdata->default_unicast_key); + if (key) { + switch (key->conf.cipher) { + case WLAN_CIPHER_SUITE_TKIP: +-- +2.27.0 + diff --git a/queue-4.19/objtool-don-t-fail-on-missing-symbol-table.patch b/queue-4.19/objtool-don-t-fail-on-missing-symbol-table.patch new file mode 100644 index 00000000000..80a7c844acf --- /dev/null +++ b/queue-4.19/objtool-don-t-fail-on-missing-symbol-table.patch @@ -0,0 +1,51 @@ +From afd61578a06c6d0fec7170310fc39f70080bbf7f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Jan 2021 16:14:01 -0600 +Subject: objtool: Don't fail on missing symbol table + +From: Josh Poimboeuf + +[ Upstream commit 1d489151e9f9d1647110277ff77282fe4d96d09b ] + +Thanks to a recent binutils change which doesn't generate unused +symbols, it's now possible for thunk_64.o be completely empty without +CONFIG_PREEMPTION: no text, no data, no symbols. + +We could edit the Makefile to only build that file when +CONFIG_PREEMPTION is enabled, but that will likely create confusion +if/when the thunks end up getting used by some other code again. + +Just ignore it and move on. + +Reported-by: Nathan Chancellor +Reviewed-by: Nathan Chancellor +Reviewed-by: Miroslav Benes +Tested-by: Nathan Chancellor +Link: https://github.com/ClangBuiltLinux/linux/issues/1254 +Signed-off-by: Josh Poimboeuf +Signed-off-by: Sasha Levin +--- + tools/objtool/elf.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c +index b8f3cca8e58b4..264d49fea8142 100644 +--- a/tools/objtool/elf.c ++++ b/tools/objtool/elf.c +@@ -226,8 +226,11 @@ static int read_symbols(struct elf *elf) + + symtab = find_section_by_name(elf, ".symtab"); + if (!symtab) { +- WARN("missing symbol table"); +- return -1; ++ /* ++ * A missing symbol table is actually possible if it's an empty ++ * .o file. This can happen for thunk_64.o. ++ */ ++ return 0; + } + + symbols_nr = symtab->sh.sh_size / symtab->sh.sh_entsize; +-- +2.27.0 + diff --git a/queue-4.19/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch b/queue-4.19/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch new file mode 100644 index 00000000000..e6f6e8115ac --- /dev/null +++ b/queue-4.19/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch @@ -0,0 +1,82 @@ +From fbb2eb12cdc70dc607235d72cd732509cf6fd81f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Dec 2020 12:21:05 +0200 +Subject: phy: cpcap-usb: Fix warning for missing regulator_disable + +From: Tony Lindgren + +[ Upstream commit 764257d9069a9c19758b626cc1ba4ae079335d9e ] + +On deferred probe, we will get the following splat: + +cpcap-usb-phy cpcap-usb-phy.0: could not initialize VBUS or ID IIO: -517 +WARNING: CPU: 0 PID: 21 at drivers/regulator/core.c:2123 regulator_put+0x68/0x78 +... +(regulator_put) from [] (release_nodes+0x1b4/0x1fc) +(release_nodes) from [] (really_probe+0x104/0x4a0) +(really_probe) from [] (driver_probe_device+0x58/0xb4) + +Signed-off-by: Tony Lindgren +Link: https://lore.kernel.org/r/20201230102105.11826-1-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/motorola/phy-cpcap-usb.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c +index 593c77dbde2eb..106f53f333242 100644 +--- a/drivers/phy/motorola/phy-cpcap-usb.c ++++ b/drivers/phy/motorola/phy-cpcap-usb.c +@@ -623,35 +623,42 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev) + generic_phy = devm_phy_create(ddata->dev, NULL, &ops); + if (IS_ERR(generic_phy)) { + error = PTR_ERR(generic_phy); +- return PTR_ERR(generic_phy); ++ goto out_reg_disable; + } + + phy_set_drvdata(generic_phy, ddata); + + phy_provider = devm_of_phy_provider_register(ddata->dev, + of_phy_simple_xlate); +- if (IS_ERR(phy_provider)) +- return PTR_ERR(phy_provider); ++ if (IS_ERR(phy_provider)) { ++ error = PTR_ERR(phy_provider); ++ goto out_reg_disable; ++ } + + error = cpcap_usb_init_optional_pins(ddata); + if (error) +- return error; ++ goto out_reg_disable; + + cpcap_usb_init_optional_gpios(ddata); + + error = cpcap_usb_init_iio(ddata); + if (error) +- return error; ++ goto out_reg_disable; + + error = cpcap_usb_init_interrupts(pdev, ddata); + if (error) +- return error; ++ goto out_reg_disable; + + usb_add_phy_dev(&ddata->phy); + atomic_set(&ddata->active, 1); + schedule_delayed_work(&ddata->detect_work, msecs_to_jiffies(1)); + + return 0; ++ ++out_reg_disable: ++ regulator_disable(ddata->vusb); ++ ++ return error; + } + + static int cpcap_usb_phy_remove(struct platform_device *pdev) +-- +2.27.0 + diff --git a/queue-4.19/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch b/queue-4.19/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch new file mode 100644 index 00000000000..64a9379e1d5 --- /dev/null +++ b/queue-4.19/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch @@ -0,0 +1,41 @@ +From ab2d30635207f5294296e7df5b8e2b6df9c1a8f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Dec 2020 15:53:06 -0500 +Subject: platform/x86: intel-vbtn: Support for tablet mode on Dell Inspiron + 7352 + +From: Arnold Gozum + +[ Upstream commit fcd38f178b785623c0325958225744f0d8a075c0 ] + +The Dell Inspiron 7352 is a 2-in-1 model that has chassis-type "Notebook". +Add this model to the dmi_switches_allow_list. + +Signed-off-by: Arnold Gozum +Link: https://lore.kernel.org/r/20201226205307.249659-1-arngozum@gmail.com +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/intel-vbtn.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c +index f5774372c3871..cf8587f96fc45 100644 +--- a/drivers/platform/x86/intel-vbtn.c ++++ b/drivers/platform/x86/intel-vbtn.c +@@ -203,6 +203,12 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Switch SA5-271"), + }, + }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7352"), ++ }, ++ }, + {} /* Array terminator */ + }; + +-- +2.27.0 + diff --git a/queue-4.19/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch b/queue-4.19/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch new file mode 100644 index 00000000000..7df8b584e95 --- /dev/null +++ b/queue-4.19/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch @@ -0,0 +1,85 @@ +From 44800140ebc62fdbe1ce9be847bded1655e3cfc4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 24 Dec 2020 14:51:58 +0100 +Subject: platform/x86: touchscreen_dmi: Add swap-x-y quirk for Goodix + touchscreen on Estar Beauty HD tablet + +From: Hans de Goede + +[ Upstream commit 46c54cf2706122c37497896d56d67b0c0aca2ede ] + +The Estar Beauty HD (MID 7316R) tablet uses a Goodix touchscreen, +with the X and Y coordinates swapped compared to the LCD panel. + +Add a touchscreen_dmi entry for this adding a "touchscreen-swapped-x-y" +device-property to the i2c-client instantiated for this device before +the driver binds. + +This is the first entry of a Goodix touchscreen to touchscreen_dmi.c, +so far DMI quirks for Goodix touchscreen's have been added directly +to drivers/input/touchscreen/goodix.c. Currently there are 3 +DMI tables in goodix.c: +1. rotated_screen[] for devices where the touchscreen is rotated + 180 degrees vs the LCD panel +2. inverted_x_screen[] for devices where the X axis is inverted +3. nine_bytes_report[] for devices which use a non standard touch + report size + +Arguably only 3. really needs to be inside the driver and the other +2 cases are better handled through the generic touchscreen DMI quirk +mechanism from touchscreen_dmi.c, which allows adding device-props to +any i2c-client. Esp. now that goodix.c is using the generic +touchscreen_properties code. + +Alternative to the approach from this patch we could add a 4th +dmi_system_id table for devices with swapped-x-y axis to goodix.c, +but that seems undesirable. + +Cc: Bastien Nocera +Cc: Dmitry Torokhov +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201224135158.10976-1-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/touchscreen_dmi.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c +index cb204f9734913..f122a0263a1ba 100644 +--- a/drivers/platform/x86/touchscreen_dmi.c ++++ b/drivers/platform/x86/touchscreen_dmi.c +@@ -163,6 +163,16 @@ static const struct ts_dmi_data digma_citi_e200_data = { + .properties = digma_citi_e200_props, + }; + ++static const struct property_entry estar_beauty_hd_props[] = { ++ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), ++ { } ++}; ++ ++static const struct ts_dmi_data estar_beauty_hd_data = { ++ .acpi_name = "GDIX1001:00", ++ .properties = estar_beauty_hd_props, ++}; ++ + static const struct property_entry gp_electronic_t701_props[] = { + PROPERTY_ENTRY_U32("touchscreen-size-x", 960), + PROPERTY_ENTRY_U32("touchscreen-size-y", 640), +@@ -501,6 +511,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = { + DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), + }, + }, ++ { ++ /* Estar Beauty HD (MID 7316R) */ ++ .driver_data = (void *)&estar_beauty_hd_data, ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Estar"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "eSTAR BEAUTY HD Intel Quad core"), ++ }, ++ }, + { + /* GP-electronic T701 */ + .driver_data = (void *)&gp_electronic_t701_data, +-- +2.27.0 + diff --git a/queue-4.19/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch b/queue-4.19/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch new file mode 100644 index 00000000000..b40652c7df9 --- /dev/null +++ b/queue-4.19/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch @@ -0,0 +1,85 @@ +From 7a5865f2befdc4e76140b687470067272f4f713c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jan 2021 09:06:38 -0600 +Subject: scsi: ibmvfc: Set default timeout to avoid crash during migration + +From: Brian King + +[ Upstream commit 764907293edc1af7ac857389af9dc858944f53dc ] + +While testing live partition mobility, we have observed occasional crashes +of the Linux partition. What we've seen is that during the live migration, +for specific configurations with large amounts of memory, slow network +links, and workloads that are changing memory a lot, the partition can end +up being suspended for 30 seconds or longer. This resulted in the following +scenario: + +CPU 0 CPU 1 +------------------------------- ---------------------------------- +scsi_queue_rq migration_store + -> blk_mq_start_request -> rtas_ibm_suspend_me + -> blk_add_timer -> on_each_cpu(rtas_percpu_suspend_me + _______________________________________V + | + V + -> IPI from CPU 1 + -> rtas_percpu_suspend_me + -> __rtas_suspend_last_cpu + +-- Linux partition suspended for > 30 seconds -- + -> for_each_online_cpu(cpu) + plpar_hcall_norets(H_PROD + -> scsi_dispatch_cmd + -> scsi_times_out + -> scsi_abort_command + -> queue_delayed_work + -> ibmvfc_queuecommand_lck + -> ibmvfc_send_event + -> ibmvfc_send_crq + - returns H_CLOSED + <- returns SCSI_MLQUEUE_HOST_BUSY +-> __blk_mq_requeue_request + + -> scmd_eh_abort_handler + -> scsi_try_to_abort_cmd + - returns SUCCESS + -> scsi_queue_insert + +Normally, the SCMD_STATE_COMPLETE bit would protect against the command +completion and the timeout, but that doesn't work here, since we don't +check that at all in the SCSI_MLQUEUE_HOST_BUSY path. + +In this case we end up calling scsi_queue_insert on a request that has +already been queued, or possibly even freed, and we crash. + +The patch below simply increases the default I/O timeout to avoid this race +condition. This is also the timeout value that nearly all IBM SAN storage +recommends setting as the default value. + +Link: https://lore.kernel.org/r/1610463998-19791-1-git-send-email-brking@linux.vnet.ibm.com +Signed-off-by: Brian King +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/ibmvscsi/ibmvfc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c +index 090ab377f65e5..50078a199fea0 100644 +--- a/drivers/scsi/ibmvscsi/ibmvfc.c ++++ b/drivers/scsi/ibmvscsi/ibmvfc.c +@@ -2890,8 +2890,10 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev) + unsigned long flags = 0; + + spin_lock_irqsave(shost->host_lock, flags); +- if (sdev->type == TYPE_DISK) ++ if (sdev->type == TYPE_DISK) { + sdev->allow_restart = 1; ++ blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); ++ } + spin_unlock_irqrestore(shost->host_lock, flags); + return 0; + } +-- +2.27.0 + diff --git a/queue-4.19/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch b/queue-4.19/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch new file mode 100644 index 00000000000..4a858d3354a --- /dev/null +++ b/queue-4.19/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch @@ -0,0 +1,95 @@ +From cd49e670814aeb515f90da356061f50f472f2d61 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Dec 2020 11:47:31 -0800 +Subject: scsi: libfc: Avoid invoking response handler twice if ep is already + completed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Javed Hasan + +[ Upstream commit b2b0f16fa65e910a3ec8771206bb49ee87a54ac5 ] + +A race condition exists between the response handler getting called because +of exchange_mgr_reset() (which clears out all the active XIDs) and the +response we get via an interrupt. + +Sequence of events: + + rport ba0200: Port timeout, state PLOGI + rport ba0200: Port entered PLOGI state from PLOGI state + xid 1052: Exchange timer armed : 20000 msecs  xid timer armed here + rport ba0200: Received LOGO request while in state PLOGI + rport ba0200: Delete port + rport ba0200: work event 3 + rport ba0200: lld callback ev 3 + bnx2fc: rport_event_hdlr: event = 3, port_id = 0xba0200 + bnx2fc: ba0200 - rport not created Yet!! + /* Here we reset any outstanding exchanges before + freeing rport using the exch_mgr_reset() */ + xid 1052: Exchange timer canceled + /* Here we got two responses for one xid */ + xid 1052: invoking resp(), esb 20000000 state 3 + xid 1052: invoking resp(), esb 20000000 state 3 + xid 1052: fc_rport_plogi_resp() : ep->resp_active 2 + xid 1052: fc_rport_plogi_resp() : ep->resp_active 2 + +Skip the response if the exchange is already completed. + +Link: https://lore.kernel.org/r/20201215194731.2326-1-jhasan@marvell.com +Signed-off-by: Javed Hasan +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/libfc/fc_exch.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c +index 6ba257cbc6d94..384458d1f73c3 100644 +--- a/drivers/scsi/libfc/fc_exch.c ++++ b/drivers/scsi/libfc/fc_exch.c +@@ -1631,8 +1631,13 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) + rc = fc_exch_done_locked(ep); + WARN_ON(fc_seq_exch(sp) != ep); + spin_unlock_bh(&ep->ex_lock); +- if (!rc) ++ if (!rc) { + fc_exch_delete(ep); ++ } else { ++ FC_EXCH_DBG(ep, "ep is completed already," ++ "hence skip calling the resp\n"); ++ goto skip_resp; ++ } + } + + /* +@@ -1651,6 +1656,7 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) + if (!fc_invoke_resp(ep, sp, fp)) + fc_frame_free(fp); + ++skip_resp: + fc_exch_release(ep); + return; + rel: +@@ -1907,10 +1913,16 @@ static void fc_exch_reset(struct fc_exch *ep) + + fc_exch_hold(ep); + +- if (!rc) ++ if (!rc) { + fc_exch_delete(ep); ++ } else { ++ FC_EXCH_DBG(ep, "ep is completed already," ++ "hence skip calling the resp\n"); ++ goto skip_resp; ++ } + + fc_invoke_resp(ep, sp, ERR_PTR(-FC_EX_CLOSED)); ++skip_resp: + fc_seq_set_resp(sp, NULL, ep->arg); + fc_exch_release(ep); + } +-- +2.27.0 + diff --git a/queue-4.19/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch b/queue-4.19/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch new file mode 100644 index 00000000000..c895604d586 --- /dev/null +++ b/queue-4.19/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch @@ -0,0 +1,45 @@ +From 7824e93a27258d9ab10f4b1c05e6909680d1dac2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Jan 2021 15:25:41 +0100 +Subject: scsi: scsi_transport_srp: Don't block target in failfast state + +From: Martin Wilck + +[ Upstream commit 72eeb7c7151302ef007f1acd018cbf6f30e50321 ] + +If the port is in SRP_RPORT_FAIL_FAST state when srp_reconnect_rport() is +entered, a transition to SDEV_BLOCK would be illegal, and a kernel WARNING +would be triggered. Skip scsi_target_block() in this case. + +Link: https://lore.kernel.org/r/20210111142541.21534-1-mwilck@suse.com +Reviewed-by: Bart Van Assche +Signed-off-by: Martin Wilck +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_transport_srp.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c +index 4e46fdb2d7c99..2aaf1b7103981 100644 +--- a/drivers/scsi/scsi_transport_srp.c ++++ b/drivers/scsi/scsi_transport_srp.c +@@ -555,7 +555,14 @@ int srp_reconnect_rport(struct srp_rport *rport) + res = mutex_lock_interruptible(&rport->mutex); + if (res) + goto out; +- scsi_target_block(&shost->shost_gendev); ++ if (rport->state != SRP_RPORT_FAIL_FAST) ++ /* ++ * sdev state must be SDEV_TRANSPORT_OFFLINE, transition ++ * to SDEV_BLOCK is illegal. Calling scsi_target_unblock() ++ * later is ok though, scsi_internal_device_unblock_nowait() ++ * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK. ++ */ ++ scsi_target_block(&shost->shost_gendev); + res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; + pr_debug("%s (state %d): transport.reconnect() returned %d\n", + dev_name(&shost->shost_gendev), rport->state, res); +-- +2.27.0 + diff --git a/queue-4.19/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch b/queue-4.19/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch new file mode 100644 index 00000000000..315cf890900 --- /dev/null +++ b/queue-4.19/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch @@ -0,0 +1,61 @@ +From 07a254d89cc7de45dd0edaf688ccbfa31f79e4e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Jan 2021 15:18:00 +1100 +Subject: selftests/powerpc: Only test lwm/stmw on big endian + +From: Michael Ellerman + +[ Upstream commit dd3a44c06f7b4f14e90065bf05d62c255b20005f ] + +Newer binutils (>= 2.36) refuse to assemble lmw/stmw when building in +little endian mode. That breaks compilation of our alignment handler +test: + + /tmp/cco4l14N.s: Assembler messages: + /tmp/cco4l14N.s:1440: Error: `lmw' invalid when little-endian + /tmp/cco4l14N.s:1814: Error: `stmw' invalid when little-endian + make[2]: *** [../../lib.mk:139: /output/kselftest/powerpc/alignment/alignment_handler] Error 1 + +These tests do pass on little endian machines, as the kernel will +still emulate those instructions even when running little +endian (which is arguably a kernel bug). + +But we don't really need to test that case, so ifdef those +instructions out to get the alignment test building again. + +Reported-by: Libor Pechacek +Signed-off-by: Michael Ellerman +Tested-by: Libor Pechacek +Link: https://lore.kernel.org/r/20210119041800.3093047-1-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + .../testing/selftests/powerpc/alignment/alignment_handler.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/powerpc/alignment/alignment_handler.c b/tools/testing/selftests/powerpc/alignment/alignment_handler.c +index 169a8b9719fb9..4f8335e0c9858 100644 +--- a/tools/testing/selftests/powerpc/alignment/alignment_handler.c ++++ b/tools/testing/selftests/powerpc/alignment/alignment_handler.c +@@ -384,7 +384,6 @@ int test_alignment_handler_integer(void) + LOAD_DFORM_TEST(ldu); + LOAD_XFORM_TEST(ldx); + LOAD_XFORM_TEST(ldux); +- LOAD_DFORM_TEST(lmw); + STORE_DFORM_TEST(stb); + STORE_XFORM_TEST(stbx); + STORE_DFORM_TEST(stbu); +@@ -403,7 +402,11 @@ int test_alignment_handler_integer(void) + STORE_XFORM_TEST(stdx); + STORE_DFORM_TEST(stdu); + STORE_XFORM_TEST(stdux); ++ ++#ifdef __BIG_ENDIAN__ ++ LOAD_DFORM_TEST(lmw); + STORE_DFORM_TEST(stmw); ++#endif + + return rc; + } +-- +2.27.0 + diff --git a/queue-4.19/series b/queue-4.19/series index 7ceb62227a0..e9d6c08d92c 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -3,3 +3,15 @@ ibmvnic-ensure-that-crq-entry-read-are-correctly-ordered.patch acpi-thermal-do-not-call-acpi_thermal_check-directly.patch sysctl-handle-overflow-in-proc_get_long.patch net_sched-gen_estimator-support-large-ewma-log.patch +phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch +platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch +platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch +x86-__always_inline-__-rd-wr-msr.patch +scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch +scsi-libfc-avoid-invoking-response-handler-twice-if-.patch +mac80211-fix-fast-rx-encryption-check.patch +scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch +selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch +objtool-don-t-fail-on-missing-symbol-table.patch +kthread-extract-kthread_is_per_cpu.patch +workqueue-restrict-affinity-change-to-rescuer.patch diff --git a/queue-4.19/workqueue-restrict-affinity-change-to-rescuer.patch b/queue-4.19/workqueue-restrict-affinity-change-to-rescuer.patch new file mode 100644 index 00000000000..a0d8bdc24c7 --- /dev/null +++ b/queue-4.19/workqueue-restrict-affinity-change-to-rescuer.patch @@ -0,0 +1,58 @@ +From 9606bef7ed32de0638b822805f323796aef5c1fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Jan 2021 19:08:36 +0100 +Subject: workqueue: Restrict affinity change to rescuer + +From: Peter Zijlstra + +[ Upstream commit 640f17c82460e9724fd256f0a1f5d99e7ff0bda4 ] + +create_worker() will already set the right affinity using +kthread_bind_mask(), this means only the rescuer will need to change +it's affinity. + +Howveer, while in cpu-hot-unplug a regular task is not allowed to run +on online&&!active as it would be pushed away quite agressively. We +need KTHREAD_IS_PER_CPU to survive in that environment. + +Therefore set the affinity after getting that magic flag. + +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Valentin Schneider +Tested-by: Valentin Schneider +Link: https://lkml.kernel.org/r/20210121103506.826629830@infradead.org +Signed-off-by: Sasha Levin +--- + kernel/workqueue.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index cd98ef48345e1..78600f97ffa72 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -1728,12 +1728,6 @@ static void worker_attach_to_pool(struct worker *worker, + { + mutex_lock(&wq_pool_attach_mutex); + +- /* +- * set_cpus_allowed_ptr() will fail if the cpumask doesn't have any +- * online CPUs. It'll be re-applied when any of the CPUs come up. +- */ +- set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask); +- + /* + * The wq_pool_attach_mutex ensures %POOL_DISASSOCIATED remains + * stable across this function. See the comments above the flag +@@ -1742,6 +1736,9 @@ static void worker_attach_to_pool(struct worker *worker, + if (pool->flags & POOL_DISASSOCIATED) + worker->flags |= WORKER_UNBOUND; + ++ if (worker->rescue_wq) ++ set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask); ++ + list_add_tail(&worker->node, &pool->workers); + worker->pool = pool; + +-- +2.27.0 + diff --git a/queue-4.19/x86-__always_inline-__-rd-wr-msr.patch b/queue-4.19/x86-__always_inline-__-rd-wr-msr.patch new file mode 100644 index 00000000000..e1a07c1fabe --- /dev/null +++ b/queue-4.19/x86-__always_inline-__-rd-wr-msr.patch @@ -0,0 +1,48 @@ +From f9b9ec7e454905728e8e94f95ff3be776b674027 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Jan 2021 11:14:25 +0100 +Subject: x86: __always_inline __{rd,wr}msr() + +From: Peter Zijlstra + +[ Upstream commit 66a425011c61e71560c234492d204e83cfb73d1d ] + +When the compiler choses to not inline the trivial MSR helpers: + + vmlinux.o: warning: objtool: __sev_es_nmi_complete()+0xce: call to __wrmsr.constprop.14() leaves .noinstr.text section + +Reported-by: Randy Dunlap +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Thomas Gleixner +Acked-by: Randy Dunlap # build-tested +Link: https://lore.kernel.org/r/X/bf3gV+BW7kGEsB@hirez.programming.kicks-ass.net +Signed-off-by: Sasha Levin +--- + arch/x86/include/asm/msr.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h +index 04addd6e0a4a2..2571e2017a8bb 100644 +--- a/arch/x86/include/asm/msr.h ++++ b/arch/x86/include/asm/msr.h +@@ -88,7 +88,7 @@ static inline void do_trace_rdpmc(unsigned int msr, u64 val, int failed) {} + * think of extending them - you will be slapped with a stinking trout or a frozen + * shark will reach you, wherever you are! You've been warned. + */ +-static inline unsigned long long notrace __rdmsr(unsigned int msr) ++static __always_inline unsigned long long __rdmsr(unsigned int msr) + { + DECLARE_ARGS(val, low, high); + +@@ -100,7 +100,7 @@ static inline unsigned long long notrace __rdmsr(unsigned int msr) + return EAX_EDX_VAL(val, low, high); + } + +-static inline void notrace __wrmsr(unsigned int msr, u32 low, u32 high) ++static __always_inline void __wrmsr(unsigned int msr, u32 low, u32 high) + { + asm volatile("1: wrmsr\n" + "2:\n" +-- +2.27.0 + -- 2.47.3