From: Sasha Levin Date: Thu, 7 Oct 2021 14:20:23 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v4.4.288~11^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1435cfa1f3a1d480c90e6b2e178fd97c170584b5;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/ext2-fix-sleeping-in-atomic-bugs-on-error.patch b/queue-5.4/ext2-fix-sleeping-in-atomic-bugs-on-error.patch new file mode 100644 index 00000000000..e970023beb0 --- /dev/null +++ b/queue-5.4/ext2-fix-sleeping-in-atomic-bugs-on-error.patch @@ -0,0 +1,62 @@ +From e877b0fb2a3367652a82e5c045d78460dddc13b1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Sep 2021 23:32:33 +0300 +Subject: ext2: fix sleeping in atomic bugs on error + +From: Dan Carpenter + +[ Upstream commit 372d1f3e1bfede719864d0d1fbf3146b1e638c88 ] + +The ext2_error() function syncs the filesystem so it sleeps. The caller +is holding a spinlock so it's not allowed to sleep. + + ext2_statfs() <- disables preempt + -> ext2_count_free_blocks() + -> ext2_get_group_desc() + +Fix this by using WARN() to print an error message and a stack trace +instead of using ext2_error(). + +Link: https://lore.kernel.org/r/20210921203233.GA16529@kili +Signed-off-by: Dan Carpenter +Signed-off-by: Jan Kara +Signed-off-by: Sasha Levin +--- + fs/ext2/balloc.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c +index e0cc55164505..abac81a2e694 100644 +--- a/fs/ext2/balloc.c ++++ b/fs/ext2/balloc.c +@@ -48,10 +48,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, + struct ext2_sb_info *sbi = EXT2_SB(sb); + + if (block_group >= sbi->s_groups_count) { +- ext2_error (sb, "ext2_get_group_desc", +- "block_group >= groups_count - " +- "block_group = %d, groups_count = %lu", +- block_group, sbi->s_groups_count); ++ WARN(1, "block_group >= groups_count - " ++ "block_group = %d, groups_count = %lu", ++ block_group, sbi->s_groups_count); + + return NULL; + } +@@ -59,10 +58,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, + group_desc = block_group >> EXT2_DESC_PER_BLOCK_BITS(sb); + offset = block_group & (EXT2_DESC_PER_BLOCK(sb) - 1); + if (!sbi->s_group_desc[group_desc]) { +- ext2_error (sb, "ext2_get_group_desc", +- "Group descriptor not loaded - " +- "block_group = %d, group_desc = %lu, desc = %lu", +- block_group, group_desc, offset); ++ WARN(1, "Group descriptor not loaded - " ++ "block_group = %d, group_desc = %lu, desc = %lu", ++ block_group, group_desc, offset); + return NULL; + } + +-- +2.33.0 + diff --git a/queue-5.4/kvm-do-not-shrink-halt_poll_ns-below-grow_start.patch b/queue-5.4/kvm-do-not-shrink-halt_poll_ns-below-grow_start.patch new file mode 100644 index 00000000000..ce00367e59a --- /dev/null +++ b/queue-5.4/kvm-do-not-shrink-halt_poll_ns-below-grow_start.patch @@ -0,0 +1,72 @@ +From 32e42ad8c7c837b815af1642bd1f1e69e85d53ec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Sep 2021 12:11:00 +0900 +Subject: KVM: do not shrink halt_poll_ns below grow_start + +From: Sergey Senozhatsky + +[ Upstream commit ae232ea460888dc5a8b37e840c553b02521fbf18 ] + +grow_halt_poll_ns() ignores values between 0 and +halt_poll_ns_grow_start (10000 by default). However, +when we shrink halt_poll_ns we may fall way below +halt_poll_ns_grow_start and endup with halt_poll_ns +values that don't make a lot of sense: like 1 or 9, +or 19. + +VCPU1 trace (halt_poll_ns_shrink equals 2): + +VCPU1 grow 10000 +VCPU1 shrink 5000 +VCPU1 shrink 2500 +VCPU1 shrink 1250 +VCPU1 shrink 625 +VCPU1 shrink 312 +VCPU1 shrink 156 +VCPU1 shrink 78 +VCPU1 shrink 39 +VCPU1 shrink 19 +VCPU1 shrink 9 +VCPU1 shrink 4 + +Mirror what grow_halt_poll_ns() does and set halt_poll_ns +to 0 as soon as new shrink-ed halt_poll_ns value falls +below halt_poll_ns_grow_start. + +Signed-off-by: Sergey Senozhatsky +Signed-off-by: Paolo Bonzini +Message-Id: <20210902031100.252080-1-senozhatsky@chromium.org> +Signed-off-by: Paolo Bonzini +Signed-off-by: Sasha Levin +--- + virt/kvm/kvm_main.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c +index 77f84cbca740..f31976010622 100644 +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -2470,15 +2470,19 @@ out: + + static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu) + { +- unsigned int old, val, shrink; ++ unsigned int old, val, shrink, grow_start; + + old = val = vcpu->halt_poll_ns; + shrink = READ_ONCE(halt_poll_ns_shrink); ++ grow_start = READ_ONCE(halt_poll_ns_grow_start); + if (shrink == 0) + val = 0; + else + val /= shrink; + ++ if (val < grow_start) ++ val = 0; ++ + vcpu->halt_poll_ns = val; + trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, val, old); + } +-- +2.33.0 + diff --git a/queue-5.4/kvm-x86-add-amd-pmu-msrs-to-msrs_to_save_all.patch b/queue-5.4/kvm-x86-add-amd-pmu-msrs-to-msrs_to_save_all.patch new file mode 100644 index 00000000000..8b7ad6d2c56 --- /dev/null +++ b/queue-5.4/kvm-x86-add-amd-pmu-msrs-to-msrs_to_save_all.patch @@ -0,0 +1,45 @@ +From 89d835abf3a8e120030dc55124ac7c926c6229ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Sep 2021 13:39:50 +0000 +Subject: kvm: x86: Add AMD PMU MSRs to msrs_to_save_all[] + +From: Fares Mehanna + +[ Upstream commit e1fc1553cd78292ab3521c94c9dd6e3e70e606a1 ] + +Intel PMU MSRs is in msrs_to_save_all[], so add AMD PMU MSRs to have a +consistent behavior between Intel and AMD when using KVM_GET_MSRS, +KVM_SET_MSRS or KVM_GET_MSR_INDEX_LIST. + +We have to add legacy and new MSRs to handle guests running without +X86_FEATURE_PERFCTR_CORE. + +Signed-off-by: Fares Mehanna +Message-Id: <20210915133951.22389-1-faresx@amazon.de> +Signed-off-by: Paolo Bonzini +Signed-off-by: Sasha Levin +--- + arch/x86/kvm/x86.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index eed058529e4b..dfd70ed34f88 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -1239,6 +1239,13 @@ static const u32 msrs_to_save_all[] = { + MSR_ARCH_PERFMON_EVENTSEL0 + 12, MSR_ARCH_PERFMON_EVENTSEL0 + 13, + MSR_ARCH_PERFMON_EVENTSEL0 + 14, MSR_ARCH_PERFMON_EVENTSEL0 + 15, + MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17, ++ ++ MSR_K7_EVNTSEL0, MSR_K7_EVNTSEL1, MSR_K7_EVNTSEL2, MSR_K7_EVNTSEL3, ++ MSR_K7_PERFCTR0, MSR_K7_PERFCTR1, MSR_K7_PERFCTR2, MSR_K7_PERFCTR3, ++ MSR_F15H_PERF_CTL0, MSR_F15H_PERF_CTL1, MSR_F15H_PERF_CTL2, ++ MSR_F15H_PERF_CTL3, MSR_F15H_PERF_CTL4, MSR_F15H_PERF_CTL5, ++ MSR_F15H_PERF_CTR0, MSR_F15H_PERF_CTR1, MSR_F15H_PERF_CTR2, ++ MSR_F15H_PERF_CTR3, MSR_F15H_PERF_CTR4, MSR_F15H_PERF_CTR5, + }; + + static u32 msrs_to_save[ARRAY_SIZE(msrs_to_save_all)]; +-- +2.33.0 + diff --git a/queue-5.4/kvm-x86-reset-pdptrs_from_userspace-when-exiting-smm.patch b/queue-5.4/kvm-x86-reset-pdptrs_from_userspace-when-exiting-smm.patch new file mode 100644 index 00000000000..4ede6bb5129 --- /dev/null +++ b/queue-5.4/kvm-x86-reset-pdptrs_from_userspace-when-exiting-smm.patch @@ -0,0 +1,44 @@ +From a2676eced8f71a928d34cdbcbc0de8326f42801a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Sep 2021 17:09:50 +0300 +Subject: KVM: x86: reset pdptrs_from_userspace when exiting smm + +From: Maxim Levitsky + +[ Upstream commit 37687c403a641f251cb2ef2e7830b88aa0647ba9 ] + +When exiting SMM, pdpts are loaded again from the guest memory. + +This fixes a theoretical bug, when exit from SMM triggers entry to the +nested guest which re-uses some of the migration +code which uses this flag as a workaround for a legacy userspace. + +Signed-off-by: Maxim Levitsky +Message-Id: <20210913140954.165665-4-mlevitsk@redhat.com> +Signed-off-by: Paolo Bonzini +Signed-off-by: Sasha Levin +--- + arch/x86/kvm/x86.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index f1a0eebdcf64..eed058529e4b 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -6596,6 +6596,13 @@ static void kvm_smm_changed(struct kvm_vcpu *vcpu) + + /* Process a latched INIT or SMI, if any. */ + kvm_make_request(KVM_REQ_EVENT, vcpu); ++ ++ /* ++ * Even if KVM_SET_SREGS2 loaded PDPTRs out of band, ++ * on SMM exit we still need to reload them from ++ * guest memory ++ */ ++ vcpu->arch.pdptrs_from_userspace = false; + } + + kvm_mmu_reset_context(vcpu); +-- +2.33.0 + diff --git a/queue-5.4/net-mdio-introduce-a-shutdown-method-to-mdio-device-.patch b/queue-5.4/net-mdio-introduce-a-shutdown-method-to-mdio-device-.patch new file mode 100644 index 00000000000..1d49bb856f6 --- /dev/null +++ b/queue-5.4/net-mdio-introduce-a-shutdown-method-to-mdio-device-.patch @@ -0,0 +1,77 @@ +From de3b3abae577549b78c17024b700b02f2341b905 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Sep 2021 16:34:32 +0300 +Subject: net: mdio: introduce a shutdown method to mdio device drivers + +From: Vladimir Oltean + +[ Upstream commit cf9579976f724ad517cc15b7caadea728c7e245c ] + +MDIO-attached devices might have interrupts and other things that might +need quiesced when we kexec into a new kernel. Things are even more +creepy when those interrupt lines are shared, and in that case it is +absolutely mandatory to disable all interrupt sources. + +Moreover, MDIO devices might be DSA switches, and DSA needs its own +shutdown method to unlink from the DSA master, which is a new +requirement that appeared after commit 2f1e8ea726e9 ("net: dsa: link +interfaces with the DSA master to get rid of lockdep warnings"). + +So introduce a ->shutdown method in the MDIO device driver structure. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/mdio_device.c | 11 +++++++++++ + include/linux/mdio.h | 3 +++ + 2 files changed, 14 insertions(+) + +diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c +index c1d345c3cab3..b2dd293fc87e 100644 +--- a/drivers/net/phy/mdio_device.c ++++ b/drivers/net/phy/mdio_device.c +@@ -180,6 +180,16 @@ static int mdio_remove(struct device *dev) + return 0; + } + ++static void mdio_shutdown(struct device *dev) ++{ ++ struct mdio_device *mdiodev = to_mdio_device(dev); ++ struct device_driver *drv = mdiodev->dev.driver; ++ struct mdio_driver *mdiodrv = to_mdio_driver(drv); ++ ++ if (mdiodrv->shutdown) ++ mdiodrv->shutdown(mdiodev); ++} ++ + /** + * mdio_driver_register - register an mdio_driver with the MDIO layer + * @new_driver: new mdio_driver to register +@@ -194,6 +204,7 @@ int mdio_driver_register(struct mdio_driver *drv) + mdiodrv->driver.bus = &mdio_bus_type; + mdiodrv->driver.probe = mdio_probe; + mdiodrv->driver.remove = mdio_remove; ++ mdiodrv->driver.shutdown = mdio_shutdown; + + retval = driver_register(&mdiodrv->driver); + if (retval) { +diff --git a/include/linux/mdio.h b/include/linux/mdio.h +index a7604248777b..0f1f784de80e 100644 +--- a/include/linux/mdio.h ++++ b/include/linux/mdio.h +@@ -64,6 +64,9 @@ struct mdio_driver { + + /* Clears up any memory if needed */ + void (*remove)(struct mdio_device *mdiodev); ++ ++ /* Quiesces the device on system shutdown, turns off interrupts etc */ ++ void (*shutdown)(struct mdio_device *mdiodev); + }; + #define to_mdio_driver(d) \ + container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv) +-- +2.33.0 + diff --git a/queue-5.4/scsi-sd-free-scsi_disk-device-via-put_device.patch b/queue-5.4/scsi-sd-free-scsi_disk-device-via-put_device.patch new file mode 100644 index 00000000000..5e0c0cdedcd --- /dev/null +++ b/queue-5.4/scsi-sd-free-scsi_disk-device-via-put_device.patch @@ -0,0 +1,50 @@ +From 6802e3d186080130afc3280184aa2a0d4d30c66b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Sep 2021 17:01:12 +0800 +Subject: scsi: sd: Free scsi_disk device via put_device() + +From: Ming Lei + +[ Upstream commit 265dfe8ebbabae7959060bd1c3f75c2473b697ed ] + +After a device is initialized via device_initialize() it should be freed +via put_device(). sd_probe() currently gets this wrong, fix it up. + +Link: https://lore.kernel.org/r/20210906090112.531442-1-ming.lei@redhat.com +Reviewed-by: Bart Van Assche +Reviewed-by: Christoph Hellwig +Signed-off-by: Ming Lei +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/sd.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index f55249766d22..152b48605152 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -3345,15 +3345,16 @@ static int sd_probe(struct device *dev) + } + + device_initialize(&sdkp->dev); +- sdkp->dev.parent = dev; ++ sdkp->dev.parent = get_device(dev); + sdkp->dev.class = &sd_disk_class; + dev_set_name(&sdkp->dev, "%s", dev_name(dev)); + + error = device_add(&sdkp->dev); +- if (error) +- goto out_free_index; ++ if (error) { ++ put_device(&sdkp->dev); ++ goto out; ++ } + +- get_device(dev); + dev_set_drvdata(dev, sdkp); + + gd->major = sd_major((index & 0xf0) >> 4); +-- +2.33.0 + diff --git a/queue-5.4/scsi-ses-retry-failed-send-receive-diagnostic-comman.patch b/queue-5.4/scsi-ses-retry-failed-send-receive-diagnostic-comman.patch new file mode 100644 index 00000000000..24f62ad2d47 --- /dev/null +++ b/queue-5.4/scsi-ses-retry-failed-send-receive-diagnostic-comman.patch @@ -0,0 +1,81 @@ +From c42ba71ac5fbac609931d416cef23f3b2b113537 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Sep 2021 22:24:21 -0500 +Subject: scsi: ses: Retry failed Send/Receive Diagnostic commands + +From: Wen Xiong + +[ Upstream commit fbdac19e642899455b4e64c63aafe2325df7aafa ] + +Setting SCSI logging level with error=3, we saw some errors from enclosues: + +[108017.360833] ses 0:0:9:0: tag#641 Done: NEEDS_RETRY Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK cmd_age=0s +[108017.360838] ses 0:0:9:0: tag#641 CDB: Receive Diagnostic 1c 01 01 00 20 00 +[108017.427778] ses 0:0:9:0: Power-on or device reset occurred +[108017.427784] ses 0:0:9:0: tag#641 Done: SUCCESS Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s +[108017.427788] ses 0:0:9:0: tag#641 CDB: Receive Diagnostic 1c 01 01 00 20 00 +[108017.427791] ses 0:0:9:0: tag#641 Sense Key : Unit Attention [current] +[108017.427793] ses 0:0:9:0: tag#641 Add. Sense: Bus device reset function occurred +[108017.427801] ses 0:0:9:0: Failed to get diagnostic page 0x1 +[108017.427804] ses 0:0:9:0: Failed to bind enclosure -19 +[108017.427895] ses 0:0:10:0: Attached Enclosure device +[108017.427942] ses 0:0:10:0: Attached scsi generic sg18 type 13 + +Retry if the Send/Receive Diagnostic commands complete with a transient +error status (NOT_READY or UNIT_ATTENTION with ASC 0x29). + +Link: https://lore.kernel.org/r/1631849061-10210-2-git-send-email-wenxiong@linux.ibm.com +Reviewed-by: Brian King +Reviewed-by: James Bottomley +Signed-off-by: Wen Xiong +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/ses.c | 22 ++++++++++++++++++---- + 1 file changed, 18 insertions(+), 4 deletions(-) + +diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c +index c2afba2a5414..43e682297fd5 100644 +--- a/drivers/scsi/ses.c ++++ b/drivers/scsi/ses.c +@@ -87,9 +87,16 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, + 0 + }; + unsigned char recv_page_code; ++ unsigned int retries = SES_RETRIES; ++ struct scsi_sense_hdr sshdr; ++ ++ do { ++ ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, ++ &sshdr, SES_TIMEOUT, 1, NULL); ++ } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && ++ (sshdr.sense_key == NOT_READY || ++ (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); + +- ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, +- NULL, SES_TIMEOUT, SES_RETRIES, NULL); + if (unlikely(ret)) + return ret; + +@@ -121,9 +128,16 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, + bufflen & 0xff, + 0 + }; ++ struct scsi_sense_hdr sshdr; ++ unsigned int retries = SES_RETRIES; ++ ++ do { ++ result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, ++ &sshdr, SES_TIMEOUT, 1, NULL); ++ } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && ++ (sshdr.sense_key == NOT_READY || ++ (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); + +- result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, +- NULL, SES_TIMEOUT, SES_RETRIES, NULL); + if (result) + sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", + result); +-- +2.33.0 + diff --git a/queue-5.4/selftests-be-sure-to-make-khdr-before-other-targets.patch b/queue-5.4/selftests-be-sure-to-make-khdr-before-other-targets.patch new file mode 100644 index 00000000000..9c3bb509387 --- /dev/null +++ b/queue-5.4/selftests-be-sure-to-make-khdr-before-other-targets.patch @@ -0,0 +1,49 @@ +From 624a26e059a4497f567dcd0bce0d3329b34e0664 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Sep 2021 21:45:54 +0800 +Subject: selftests: be sure to make khdr before other targets +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Li Zhijian + +[ Upstream commit 8914a7a247e065438a0ec86a58c1c359223d2c9e ] + +LKP/0Day reported some building errors about kvm, and errors message +are not always same: +- lib/x86_64/processor.c:1083:31: error: ‘KVM_CAP_NESTED_STATE’ undeclared +(first use in this function); did you mean ‘KVM_CAP_PIT_STATE2’? +- lib/test_util.c:189:30: error: ‘MAP_HUGE_16KB’ undeclared (first use +in this function); did you mean ‘MAP_HUGE_16GB’? + +Although kvm relies on the khdr, they still be built in parallel when -j +is specified. In this case, it will cause compiling errors. + +Here we mark target khdr as NOTPARALLEL to make it be always built +first. + +CC: Philip Li +Reported-by: kernel test robot +Signed-off-by: Li Zhijian +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/lib.mk | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk +index 67386aa3f31d..8794ce382bf5 100644 +--- a/tools/testing/selftests/lib.mk ++++ b/tools/testing/selftests/lib.mk +@@ -48,6 +48,7 @@ ARCH ?= $(SUBARCH) + # When local build is done, headers are installed in the default + # INSTALL_HDR_PATH usr/include. + .PHONY: khdr ++.NOTPARALLEL: + khdr: + ifndef KSFT_KHDR_INSTALL_DONE + ifeq (1,$(DEFAULT_INSTALL_HDR_PATH)) +-- +2.33.0 + diff --git a/queue-5.4/selftests-kvm-fix-get_warnings_count-ignoring-fscanf.patch b/queue-5.4/selftests-kvm-fix-get_warnings_count-ignoring-fscanf.patch new file mode 100644 index 00000000000..537e92bb40e --- /dev/null +++ b/queue-5.4/selftests-kvm-fix-get_warnings_count-ignoring-fscanf.patch @@ -0,0 +1,45 @@ +From 5cc4675a0b44f5bb59a07f11b06d5f3ae70ff6ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Sep 2021 15:28:06 -0600 +Subject: selftests:kvm: fix get_warnings_count() ignoring fscanf() return warn +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Shuah Khan + +[ Upstream commit 39a71f712d8a13728febd8f3cb3f6db7e1fa7221 ] + +Fix get_warnings_count() to check fscanf() return value to get rid +of the following warning: + +x86_64/mmio_warning_test.c: In function ‘get_warnings_count’: +x86_64/mmio_warning_test.c:85:2: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] + 85 | fscanf(f, "%d", &warnings); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Shuah Khan +Acked-by: Paolo Bonzini +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c +index 00bb97d76000..2cbc09aad7f6 100644 +--- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c ++++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c +@@ -82,7 +82,8 @@ int get_warnings_count(void) + FILE *f; + + f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); +- fscanf(f, "%d", &warnings); ++ if (fscanf(f, "%d", &warnings) < 1) ++ warnings = 0; + fclose(f); + + return warnings; +-- +2.33.0 + diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..2e9be79068e --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1,14 @@ +net-mdio-introduce-a-shutdown-method-to-mdio-device-.patch +xen-netback-correct-success-error-reporting-for-the-.patch +sparc64-fix-pci_iounmap-when-config_pci-is-not-set.patch +ext2-fix-sleeping-in-atomic-bugs-on-error.patch +scsi-sd-free-scsi_disk-device-via-put_device.patch +usb-testusb-fix-for-showing-the-connection-speed.patch +usb-dwc2-check-return-value-after-calling-platform_g.patch +selftests-be-sure-to-make-khdr-before-other-targets.patch +selftests-kvm-fix-get_warnings_count-ignoring-fscanf.patch +scsi-ses-retry-failed-send-receive-diagnostic-comman.patch +tools-vm-page-types-remove-dependency-on-opt_file-fo.patch +kvm-do-not-shrink-halt_poll_ns-below-grow_start.patch +kvm-x86-reset-pdptrs_from_userspace-when-exiting-smm.patch +kvm-x86-add-amd-pmu-msrs-to-msrs_to_save_all.patch diff --git a/queue-5.4/sparc64-fix-pci_iounmap-when-config_pci-is-not-set.patch b/queue-5.4/sparc64-fix-pci_iounmap-when-config_pci-is-not-set.patch new file mode 100644 index 00000000000..ccaddd7d32c --- /dev/null +++ b/queue-5.4/sparc64-fix-pci_iounmap-when-config_pci-is-not-set.patch @@ -0,0 +1,48 @@ +From ba991a1deed0e7250d889657dffb12fb5babfda2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Sep 2021 10:56:32 -0700 +Subject: sparc64: fix pci_iounmap() when CONFIG_PCI is not set + +From: Linus Torvalds + +[ Upstream commit d8b1e10a2b8efaf71d151aa756052fbf2f3b6d57 ] + +Guenter reported [1] that the pci_iounmap() changes remain problematic, +with sparc64 allnoconfig and tinyconfig still not building due to the +header file changes and confusion with the arch-specific pci_iounmap() +implementation. + +I'm pretty convinced that sparc should just use GENERIC_IOMAP instead of +doing its own thing, since it turns out that the sparc64 version of +pci_iounmap() is somewhat buggy (see [2]). But in the meantime, this +just fixes the build by avoiding the trivial re-definition of the empty +case. + +Link: https://lore.kernel.org/lkml/20210920134424.GA346531@roeck-us.net/ [1] +Link: https://lore.kernel.org/lkml/CAHk-=wgheheFx9myQyy5osh79BAazvmvYURAtub2gQtMvLrhqQ@mail.gmail.com/ [2] +Reported-by: Guenter Roeck +Cc: David Miller +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/sparc/lib/iomap.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c +index c9da9f139694..f3a8cd491ce0 100644 +--- a/arch/sparc/lib/iomap.c ++++ b/arch/sparc/lib/iomap.c +@@ -19,8 +19,10 @@ void ioport_unmap(void __iomem *addr) + EXPORT_SYMBOL(ioport_map); + EXPORT_SYMBOL(ioport_unmap); + ++#ifdef CONFIG_PCI + void pci_iounmap(struct pci_dev *dev, void __iomem * addr) + { + /* nothing to do */ + } + EXPORT_SYMBOL(pci_iounmap); ++#endif +-- +2.33.0 + diff --git a/queue-5.4/tools-vm-page-types-remove-dependency-on-opt_file-fo.patch b/queue-5.4/tools-vm-page-types-remove-dependency-on-opt_file-fo.patch new file mode 100644 index 00000000000..8d2a62c5c95 --- /dev/null +++ b/queue-5.4/tools-vm-page-types-remove-dependency-on-opt_file-fo.patch @@ -0,0 +1,48 @@ +From 4e6a07da6318be216c22ad61037c3877e44661a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Sep 2021 15:43:41 -0700 +Subject: tools/vm/page-types: remove dependency on opt_file for idle page + tracking + +From: Changbin Du + +[ Upstream commit ebaeab2fe87987cef28eb5ab174c42cd28594387 ] + +Idle page tracking can also be used for process address space, not only +file mappings. + +Without this change, using with '-i' option for process address space +encounters below errors reported. + + $ sudo ./page-types -p $(pidof bash) -i + mark page idle: Bad file descriptor + mark page idle: Bad file descriptor + mark page idle: Bad file descriptor + mark page idle: Bad file descriptor + ... + +Link: https://lkml.kernel.org/r/20210917032826.10669-1-changbin.du@gmail.com +Signed-off-by: Changbin Du +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + tools/vm/page-types.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c +index 58c0eab71bca..d2e836b2d16b 100644 +--- a/tools/vm/page-types.c ++++ b/tools/vm/page-types.c +@@ -1329,7 +1329,7 @@ int main(int argc, char *argv[]) + if (opt_list && opt_list_mapcnt) + kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY); + +- if (opt_mark_idle && opt_file) ++ if (opt_mark_idle) + page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR); + + if (opt_list && opt_pid) +-- +2.33.0 + diff --git a/queue-5.4/usb-dwc2-check-return-value-after-calling-platform_g.patch b/queue-5.4/usb-dwc2-check-return-value-after-calling-platform_g.patch new file mode 100644 index 00000000000..6ffe91e5819 --- /dev/null +++ b/queue-5.4/usb-dwc2-check-return-value-after-calling-platform_g.patch @@ -0,0 +1,38 @@ +From 1ff934db634034d6343efae586aea09dc9b5130a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Aug 2021 16:42:36 +0800 +Subject: usb: dwc2: check return value after calling platform_get_resource() + +From: Yang Yingliang + +[ Upstream commit 856e6e8e0f9300befa87dde09edb578555c99a82 ] + +It will cause null-ptr-deref if platform_get_resource() returns NULL, +we need check the return value. + +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20210831084236.1359677-1-yangyingliang@huawei.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/dwc2/hcd.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c +index f29fbadb0548..78329d0e9af0 100644 +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -5074,6 +5074,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) + hcd->has_tt = 1; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ retval = -EINVAL; ++ goto error1; ++ } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + +-- +2.33.0 + diff --git a/queue-5.4/usb-testusb-fix-for-showing-the-connection-speed.patch b/queue-5.4/usb-testusb-fix-for-showing-the-connection-speed.patch new file mode 100644 index 00000000000..ade9165c08e --- /dev/null +++ b/queue-5.4/usb-testusb-fix-for-showing-the-connection-speed.patch @@ -0,0 +1,88 @@ +From 84b170ce3017fd68981adf85ca4c6cf4bd8ac63a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Sep 2021 17:14:44 +0530 +Subject: usb: testusb: Fix for showing the connection speed + +From: Faizel K B + +[ Upstream commit f81c08f897adafd2ed43f86f00207ff929f0b2eb ] + +testusb' application which uses 'usbtest' driver reports 'unknown speed' +from the function 'find_testdev'. The variable 'entry->speed' was not +updated from the application. The IOCTL mentioned in the FIXME comment can +only report whether the connection is low speed or not. Speed is read using +the IOCTL USBDEVFS_GET_SPEED which reports the proper speed grade. The +call is implemented in the function 'handle_testdev' where the file +descriptor was availble locally. Sample output is given below where 'high +speed' is printed as the connected speed. + +sudo ./testusb -a +high speed /dev/bus/usb/001/011 0 +/dev/bus/usb/001/011 test 0, 0.000015 secs +/dev/bus/usb/001/011 test 1, 0.194208 secs +/dev/bus/usb/001/011 test 2, 0.077289 secs +/dev/bus/usb/001/011 test 3, 0.170604 secs +/dev/bus/usb/001/011 test 4, 0.108335 secs +/dev/bus/usb/001/011 test 5, 2.788076 secs +/dev/bus/usb/001/011 test 6, 2.594610 secs +/dev/bus/usb/001/011 test 7, 2.905459 secs +/dev/bus/usb/001/011 test 8, 2.795193 secs +/dev/bus/usb/001/011 test 9, 8.372651 secs +/dev/bus/usb/001/011 test 10, 6.919731 secs +/dev/bus/usb/001/011 test 11, 16.372687 secs +/dev/bus/usb/001/011 test 12, 16.375233 secs +/dev/bus/usb/001/011 test 13, 2.977457 secs +/dev/bus/usb/001/011 test 14 --> 22 (Invalid argument) +/dev/bus/usb/001/011 test 17, 0.148826 secs +/dev/bus/usb/001/011 test 18, 0.068718 secs +/dev/bus/usb/001/011 test 19, 0.125992 secs +/dev/bus/usb/001/011 test 20, 0.127477 secs +/dev/bus/usb/001/011 test 21 --> 22 (Invalid argument) +/dev/bus/usb/001/011 test 24, 4.133763 secs +/dev/bus/usb/001/011 test 27, 2.140066 secs +/dev/bus/usb/001/011 test 28, 2.120713 secs +/dev/bus/usb/001/011 test 29, 0.507762 secs + +Signed-off-by: Faizel K B +Link: https://lore.kernel.org/r/20210902114444.15106-1-faizel.kb@dicortech.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + tools/usb/testusb.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c +index ee8208b2f946..69c3ead25313 100644 +--- a/tools/usb/testusb.c ++++ b/tools/usb/testusb.c +@@ -265,12 +265,6 @@ nomem: + } + + entry->ifnum = ifnum; +- +- /* FIXME update USBDEVFS_CONNECTINFO so it tells about high speed etc */ +- +- fprintf(stderr, "%s speed\t%s\t%u\n", +- speed(entry->speed), entry->name, entry->ifnum); +- + entry->next = testdevs; + testdevs = entry; + return 0; +@@ -299,6 +293,14 @@ static void *handle_testdev (void *arg) + return 0; + } + ++ status = ioctl(fd, USBDEVFS_GET_SPEED, NULL); ++ if (status < 0) ++ fprintf(stderr, "USBDEVFS_GET_SPEED failed %d\n", status); ++ else ++ dev->speed = status; ++ fprintf(stderr, "%s speed\t%s\t%u\n", ++ speed(dev->speed), dev->name, dev->ifnum); ++ + restart: + for (i = 0; i < TEST_CASES; i++) { + if (dev->test != -1 && dev->test != i) +-- +2.33.0 + diff --git a/queue-5.4/xen-netback-correct-success-error-reporting-for-the-.patch b/queue-5.4/xen-netback-correct-success-error-reporting-for-the-.patch new file mode 100644 index 00000000000..86156002a27 --- /dev/null +++ b/queue-5.4/xen-netback-correct-success-error-reporting-for-the-.patch @@ -0,0 +1,40 @@ +From a2fd367d249313603576f6752de8087187faf63d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Sep 2021 08:27:10 +0200 +Subject: xen-netback: correct success/error reporting for the + SKB-with-fraglist case + +From: Jan Beulich + +[ Upstream commit 3ede7f84c7c21f93c5eac611d60eba3f2c765e0f ] + +When re-entering the main loop of xenvif_tx_check_gop() a 2nd time, the +special considerations for the head of the SKB no longer apply. Don't +mistakenly report ERROR to the frontend for the first entry in the list, +even if - from all I can tell - this shouldn't matter much as the overall +transmit will need to be considered failed anyway. + +Signed-off-by: Jan Beulich +Reviewed-by: Paul Durrant +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/xen-netback/netback.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c +index c213f2b81269..995566a2785f 100644 +--- a/drivers/net/xen-netback/netback.c ++++ b/drivers/net/xen-netback/netback.c +@@ -492,7 +492,7 @@ check_frags: + * the header's copy failed, and they are + * sharing a slot, send an error + */ +- if (i == 0 && sharedslot) ++ if (i == 0 && !first_shinfo && sharedslot) + xenvif_idx_release(queue, pending_idx, + XEN_NETIF_RSP_ERROR); + else +-- +2.33.0 +