--- /dev/null
+From 057a28ef93bdbe84326d34cdb5543afdaab49fe1 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Thu, 7 Sep 2023 15:24:34 +0800
+Subject: ALSA: hda: Disable power save for solving pop issue on Lenovo ThinkCentre M70q
+
+From: Kailang Yang <kailang@realtek.com>
+
+commit 057a28ef93bdbe84326d34cdb5543afdaab49fe1 upstream.
+
+Lenovo ThinkCentre M70q had boot up pop noise.
+Disable power save will solve pop issue.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/315900e2efef42fd9855eacfeb443abd@realtek.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/hda_intel.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -2208,6 +2208,7 @@ static const struct snd_pci_quirk power_
+ SND_PCI_QUIRK(0x8086, 0x2068, "Intel NUC7i3BNB", 0),
+ /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */
+ SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0),
++ SND_PCI_QUIRK(0x17aa, 0x316e, "Lenovo ThinkCentre M70q", 0),
+ /* https://bugzilla.redhat.com/show_bug.cgi?id=1689623 */
+ SND_PCI_QUIRK(0x17aa, 0x367b, "Lenovo IdeaCentre B550", 0),
+ /* https://bugzilla.redhat.com/show_bug.cgi?id=1572975 */
--- /dev/null
+From 1263cc0f414d212129c0f1289b49b7df77f92084 Mon Sep 17 00:00:00 2001
+From: August Wikerfors <git@augustwikerfors.se>
+Date: Mon, 11 Sep 2023 23:34:09 +0200
+Subject: ASoC: amd: yc: Fix non-functional mic on Lenovo 82QF and 82UG
+
+From: August Wikerfors <git@augustwikerfors.se>
+
+commit 1263cc0f414d212129c0f1289b49b7df77f92084 upstream.
+
+Like the Lenovo 82TL and 82V2, the Lenovo 82QF (Yoga 7 14ARB7) and 82UG
+(Legion S7 16ARHA7) both need a quirk entry for the internal microphone to
+function. Commit c008323fe361 ("ASoC: amd: yc: Fix a non-functional mic on
+Lenovo 82SJ") restricted the quirk that previously matched "82" to "82V2",
+breaking microphone functionality on these devices. Fix this by adding
+specific quirks for these models, as was done for the Lenovo 82TL.
+
+Fixes: c008323fe361 ("ASoC: amd: yc: Fix a non-functional mic on Lenovo 82SJ")
+Closes: https://github.com/tomsom/yoga-linux/issues/51
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555#c780
+Cc: stable@vger.kernel.org
+Signed-off-by: August Wikerfors <git@augustwikerfors.se>
+Link: https://lore.kernel.org/r/20230911213409.6106-1-git@augustwikerfors.se
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/amd/yc/acp6x-mach.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/sound/soc/amd/yc/acp6x-mach.c
++++ b/sound/soc/amd/yc/acp6x-mach.c
+@@ -217,10 +217,24 @@ static const struct dmi_system_id yc_acp
+ .driver_data = &acp6x_card,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "82QF"),
++ }
++ },
++ {
++ .driver_data = &acp6x_card,
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "82V2"),
+ }
+ },
+ {
++ .driver_data = &acp6x_card,
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "82UG"),
++ }
++ },
++ {
+ .driver_data = &acp6x_card,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
--- /dev/null
+From 3ef600923521616ebe192c893468ad0424de2afb Mon Sep 17 00:00:00 2001
+From: Niklas Cassel <niklas.cassel@wdc.com>
+Date: Mon, 18 Sep 2023 22:24:50 +0200
+Subject: ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES
+
+From: Niklas Cassel <niklas.cassel@wdc.com>
+
+commit 3ef600923521616ebe192c893468ad0424de2afb upstream.
+
+For REPORT SUPPORTED OPERATION CODES command, the service action field is
+defined as bits 0-4 in the second byte in the CDB. Bits 5-7 in the second
+byte are reserved.
+
+Only look at the service action field in the second byte when determining
+if the MAINTENANCE IN opcode is a REPORT SUPPORTED OPERATION CODES command.
+
+This matches how we only look at the service action field in the second
+byte when determining if the SERVICE ACTION IN(16) opcode is a READ
+CAPACITY(16) command (reserved bits 5-7 in the second byte are ignored).
+
+Fixes: 7b2030942859 ("libata: Add support for SCT Write Same")
+Cc: stable@vger.kernel.org
+Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/libata-scsi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/ata/libata-scsi.c
++++ b/drivers/ata/libata-scsi.c
+@@ -4227,7 +4227,7 @@ void ata_scsi_simulate(struct ata_device
+ break;
+
+ case MAINTENANCE_IN:
+- if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES)
++ if ((scsicmd[1] & 0x1f) == MI_REPORT_SUPPORTED_OPERATION_CODES)
+ ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in);
+ else
+ ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
--- /dev/null
+From fb99ef17865035a6657786d4b2af11a27ba23f9b Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <dlemoal@kernel.org>
+Date: Fri, 25 Aug 2023 15:41:14 +0900
+Subject: ata: libata-scsi: link ata port and scsi device
+
+From: Damien Le Moal <dlemoal@kernel.org>
+
+commit fb99ef17865035a6657786d4b2af11a27ba23f9b upstream.
+
+There is no direct device ancestry defined between an ata_device and
+its scsi device which prevents the power management code from correctly
+ordering suspend and resume operations. Create such ancestry with the
+ata device as the parent to ensure that the scsi device (child) is
+suspended before the ata device and that resume handles the ata device
+before the scsi device.
+
+The parent-child (supplier-consumer) relationship is established between
+the ata_port (parent) and the scsi device (child) with the function
+device_add_link(). The parent used is not the ata_device as the PM
+operations are defined per port and the status of all devices connected
+through that port is controlled from the port operations.
+
+The device link is established with the new function
+ata_scsi_slave_alloc(), and this function is used to define the
+->slave_alloc callback of the scsi host template of all ata drivers.
+
+Fixes: a19a93e4c6a9 ("scsi: core: pm: Rely on the device driver core for async power management")
+Cc: stable@vger.kernel.org
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
+Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
+Reviewed-by: John Garry <john.g.garry@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/libata-scsi.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
+ include/linux/libata.h | 2 ++
+ 2 files changed, 42 insertions(+), 5 deletions(-)
+
+--- a/drivers/ata/libata-scsi.c
++++ b/drivers/ata/libata-scsi.c
+@@ -1114,6 +1114,42 @@ int ata_scsi_dev_config(struct scsi_devi
+ }
+
+ /**
++ * ata_scsi_slave_alloc - Early setup of SCSI device
++ * @sdev: SCSI device to examine
++ *
++ * This is called from scsi_alloc_sdev() when the scsi device
++ * associated with an ATA device is scanned on a port.
++ *
++ * LOCKING:
++ * Defined by SCSI layer. We don't really care.
++ */
++
++int ata_scsi_slave_alloc(struct scsi_device *sdev)
++{
++ struct ata_port *ap = ata_shost_to_port(sdev->host);
++ struct device_link *link;
++
++ ata_scsi_sdev_config(sdev);
++
++ /*
++ * Create a link from the ata_port device to the scsi device to ensure
++ * that PM does suspend/resume in the correct order: the scsi device is
++ * consumer (child) and the ata port the supplier (parent).
++ */
++ link = device_link_add(&sdev->sdev_gendev, &ap->tdev,
++ DL_FLAG_STATELESS |
++ DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE);
++ if (!link) {
++ ata_port_err(ap, "Failed to create link to scsi device %s\n",
++ dev_name(&sdev->sdev_gendev));
++ return -ENODEV;
++ }
++
++ return 0;
++}
++EXPORT_SYMBOL_GPL(ata_scsi_slave_alloc);
++
++/**
+ * ata_scsi_slave_config - Set SCSI device attributes
+ * @sdev: SCSI device to examine
+ *
+@@ -1129,14 +1165,11 @@ int ata_scsi_slave_config(struct scsi_de
+ {
+ struct ata_port *ap = ata_shost_to_port(sdev->host);
+ struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
+- int rc = 0;
+-
+- ata_scsi_sdev_config(sdev);
+
+ if (dev)
+- rc = ata_scsi_dev_config(sdev, dev);
++ return ata_scsi_dev_config(sdev, dev);
+
+- return rc;
++ return 0;
+ }
+ EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
+
+@@ -1163,6 +1196,8 @@ void ata_scsi_slave_destroy(struct scsi_
+ if (!ap->ops->error_handler)
+ return;
+
++ device_link_remove(&sdev->sdev_gendev, &ap->tdev);
++
+ spin_lock_irqsave(ap->lock, flags);
+ dev = __ata_scsi_find_dev(ap, sdev);
+ if (dev && dev->sdev) {
+--- a/include/linux/libata.h
++++ b/include/linux/libata.h
+@@ -1136,6 +1136,7 @@ extern int ata_std_bios_param(struct scs
+ struct block_device *bdev,
+ sector_t capacity, int geom[]);
+ extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev);
++extern int ata_scsi_slave_alloc(struct scsi_device *sdev);
+ extern int ata_scsi_slave_config(struct scsi_device *sdev);
+ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
+ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
+@@ -1384,6 +1385,7 @@ extern const struct attribute_group *ata
+ .this_id = ATA_SHT_THIS_ID, \
+ .emulated = ATA_SHT_EMULATED, \
+ .proc_name = drv_name, \
++ .slave_alloc = ata_scsi_slave_alloc, \
+ .slave_destroy = ata_scsi_slave_destroy, \
+ .bios_param = ata_std_bios_param, \
+ .unlock_native_capacity = ata_scsi_unlock_native_capacity,\
--- /dev/null
+From 3914784553f68c931fc666dbe7e86fe881aada38 Mon Sep 17 00:00:00 2001
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Thu, 14 Sep 2023 23:08:44 +0200
+Subject: i2c: i801: unregister tco_pdev in i801_probe() error path
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+commit 3914784553f68c931fc666dbe7e86fe881aada38 upstream.
+
+We have to unregister tco_pdev also if i2c_add_adapter() fails.
+
+Fixes: 9424693035a5 ("i2c: i801: Create iTCO device on newer Intel PCHs")
+Cc: stable@vger.kernel.org
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Reviewed-by: Jean Delvare <jdelvare@suse.de>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-i801.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/i2c/busses/i2c-i801.c
++++ b/drivers/i2c/busses/i2c-i801.c
+@@ -1754,6 +1754,7 @@ static int i801_probe(struct pci_dev *de
+ "SMBus I801 adapter at %04lx", priv->smba);
+ err = i2c_add_adapter(&priv->adapter);
+ if (err) {
++ platform_device_unregister(priv->tco_pdev);
+ i801_acpi_remove(priv);
+ return err;
+ }
--- /dev/null
+From a52d4f657568d6458e873f74a9602e022afe666f Mon Sep 17 00:00:00 2001
+From: Jens Axboe <axboe@kernel.dk>
+Date: Thu, 28 Sep 2023 09:23:27 -0600
+Subject: io_uring/fs: remove sqe->rw_flags checking from LINKAT
+
+From: Jens Axboe <axboe@kernel.dk>
+
+commit a52d4f657568d6458e873f74a9602e022afe666f upstream.
+
+This is unionized with the actual link flags, so they can of course be
+set and they will be evaluated further down. If not we fail any LINKAT
+that has to set option flags.
+
+Fixes: cf30da90bc3a ("io_uring: add support for IORING_OP_LINKAT")
+Cc: stable@vger.kernel.org
+Reported-by: Thomas Leonard <talex5@gmail.com>
+Link: https://github.com/axboe/liburing/issues/955
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ io_uring/fs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/io_uring/fs.c
++++ b/io_uring/fs.c
+@@ -243,7 +243,7 @@ int io_linkat_prep(struct io_kiocb *req,
+ struct io_link *lnk = io_kiocb_to_cmd(req, struct io_link);
+ const char __user *oldf, *newf;
+
+- if (sqe->rw_flags || sqe->buf_index || sqe->splice_fd_in)
++ if (sqe->buf_index || sqe->splice_fd_in)
+ return -EINVAL;
+ if (unlikely(req->flags & REQ_F_FIXED_FILE))
+ return -EBADF;
--- /dev/null
+From cff9b2332ab762b7e0586c793c431a8f2ea4db04 Mon Sep 17 00:00:00 2001
+From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
+Date: Fri, 15 Sep 2023 13:44:44 -0400
+Subject: kernel/sched: Modify initial boot task idle setup
+
+From: Liam R. Howlett <Liam.Howlett@oracle.com>
+
+commit cff9b2332ab762b7e0586c793c431a8f2ea4db04 upstream.
+
+Initial booting is setting the task flag to idle (PF_IDLE) by the call
+path sched_init() -> init_idle(). Having the task idle and calling
+call_rcu() in kernel/rcu/tiny.c means that TIF_NEED_RESCHED will be
+set. Subsequent calls to any cond_resched() will enable IRQs,
+potentially earlier than the IRQ setup has completed. Recent changes
+have caused just this scenario and IRQs have been enabled early.
+
+This causes a warning later in start_kernel() as interrupts are enabled
+before they are fully set up.
+
+Fix this issue by setting the PF_IDLE flag later in the boot sequence.
+
+Although the boot task was marked as idle since (at least) d80e4fda576d,
+I am not sure that it is wrong to do so. The forced context-switch on
+idle task was introduced in the tiny_rcu update, so I'm going to claim
+this fixes 5f6130fa52ee.
+
+Fixes: 5f6130fa52ee ("tiny_rcu: Directly force QS when call_rcu_[bh|sched]() on idle_task")
+Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/linux-mm/CAMuHMdWpvpWoDa=Ox-do92czYRvkok6_x6pYUH+ZouMcJbXy+Q@mail.gmail.com/
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/sched/core.c | 2 +-
+ kernel/sched/idle.c | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -9019,7 +9019,7 @@ void __init init_idle(struct task_struct
+ * PF_KTHREAD should already be set at this point; regardless, make it
+ * look like a proper per-CPU kthread.
+ */
+- idle->flags |= PF_IDLE | PF_KTHREAD | PF_NO_SETAFFINITY;
++ idle->flags |= PF_KTHREAD | PF_NO_SETAFFINITY;
+ kthread_set_per_cpu(idle, cpu);
+
+ #ifdef CONFIG_SMP
+--- a/kernel/sched/idle.c
++++ b/kernel/sched/idle.c
+@@ -394,6 +394,7 @@ EXPORT_SYMBOL_GPL(play_idle_precise);
+
+ void cpu_startup_entry(enum cpuhp_state state)
+ {
++ current->flags |= PF_IDLE;
+ arch_cpu_idle_prepare();
+ cpuhp_online_idle(state);
+ while (1)
--- /dev/null
+From 2761498876adebff77a43574639005b29e912c43 Mon Sep 17 00:00:00 2001
+From: Tiezhu Yang <yangtiezhu@loongson.cn>
+Date: Wed, 27 Sep 2023 16:19:13 +0800
+Subject: LoongArch: Define relocation types for ABI v2.10
+
+From: Tiezhu Yang <yangtiezhu@loongson.cn>
+
+commit 2761498876adebff77a43574639005b29e912c43 upstream.
+
+The relocation types from 101 to 109 are used by GNU binutils >= 2.41,
+add their definitions to use them in later patches.
+
+Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=include/elf/loongarch.h#l230
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
+Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/loongarch/include/asm/elf.h | 9 +++++++++
+ arch/loongarch/kernel/module.c | 2 +-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/arch/loongarch/include/asm/elf.h
++++ b/arch/loongarch/include/asm/elf.h
+@@ -111,6 +111,15 @@
+ #define R_LARCH_TLS_GD_HI20 98
+ #define R_LARCH_32_PCREL 99
+ #define R_LARCH_RELAX 100
++#define R_LARCH_DELETE 101
++#define R_LARCH_ALIGN 102
++#define R_LARCH_PCREL20_S2 103
++#define R_LARCH_CFA 104
++#define R_LARCH_ADD6 105
++#define R_LARCH_SUB6 106
++#define R_LARCH_ADD_ULEB128 107
++#define R_LARCH_SUB_ULEB128 108
++#define R_LARCH_64_PCREL 109
+
+ #ifndef ELF_ARCH
+
+--- a/arch/loongarch/kernel/module.c
++++ b/arch/loongarch/kernel/module.c
+@@ -376,7 +376,7 @@ typedef int (*reloc_rela_handler)(struct
+
+ /* The handlers for known reloc types */
+ static reloc_rela_handler reloc_rela_handlers[] = {
+- [R_LARCH_NONE ... R_LARCH_RELAX] = apply_r_larch_error,
++ [R_LARCH_NONE ... R_LARCH_64_PCREL] = apply_r_larch_error,
+
+ [R_LARCH_NONE] = apply_r_larch_none,
+ [R_LARCH_32] = apply_r_larch_32,
--- /dev/null
+From 1943feecf80e73ecc03ce40271f29c6cea142bac Mon Sep 17 00:00:00 2001
+From: Huacai Chen <chenhuacai@loongson.cn>
+Date: Wed, 27 Sep 2023 16:19:13 +0800
+Subject: LoongArch: numa: Fix high_memory calculation
+
+From: Huacai Chen <chenhuacai@loongson.cn>
+
+commit 1943feecf80e73ecc03ce40271f29c6cea142bac upstream.
+
+For 64bit kernel without HIGHMEM, high_memory is the virtual address of
+the highest physical address in the system. But __va(get_num_physpages()
+<< PAGE_SHIFT) is not what we want for high_memory because there may be
+holes in the physical address space. On the other hand, max_low_pfn is
+calculated from memblock_end_of_DRAM(), which is exactly corresponding
+to the highest physical address, so use it for high_memory calculation.
+
+Cc: <stable@vger.kernel.org>
+Fixes: d4b6f1562a3c3284adce ("LoongArch: Add Non-Uniform Memory Access (NUMA) support")
+Signed-off-by: Chong Qiao <qiaochong@loongson.cn>
+Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/loongarch/kernel/numa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/loongarch/kernel/numa.c
++++ b/arch/loongarch/kernel/numa.c
+@@ -453,7 +453,7 @@ void __init paging_init(void)
+
+ void __init mem_init(void)
+ {
+- high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
++ high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
+ memblock_free_all();
+ setup_zero_pages(); /* This comes from node 0 */
+ }
--- /dev/null
+From fc09027786c900368de98d03d40af058bcb01ad9 Mon Sep 17 00:00:00 2001
+From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
+Date: Sat, 23 Sep 2023 01:14:08 +0000
+Subject: sched/rt: Fix live lock between select_fallback_rq() and RT push
+
+From: Joel Fernandes (Google) <joel@joelfernandes.org>
+
+commit fc09027786c900368de98d03d40af058bcb01ad9 upstream.
+
+During RCU-boost testing with the TREE03 rcutorture config, I found that
+after a few hours, the machine locks up.
+
+On tracing, I found that there is a live lock happening between 2 CPUs.
+One CPU has an RT task running, while another CPU is being offlined
+which also has an RT task running. During this offlining, all threads
+are migrated. The migration thread is repeatedly scheduled to migrate
+actively running tasks on the CPU being offlined. This results in a live
+lock because select_fallback_rq() keeps picking the CPU that an RT task
+is already running on only to get pushed back to the CPU being offlined.
+
+It is anyway pointless to pick CPUs for pushing tasks to if they are
+being offlined only to get migrated away to somewhere else. This could
+also add unwanted latency to this task.
+
+Fix these issues by not selecting CPUs in RT if they are not 'active'
+for scheduling, using the cpu_active_mask. Other parts in core.c already
+use cpu_active_mask to prevent tasks from being put on CPUs going
+offline.
+
+With this fix I ran the tests for days and could not reproduce the
+hang. Without the patch, I hit it in a few hours.
+
+Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Tested-by: Paul E. McKenney <paulmck@kernel.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20230923011409.3522762-1-joel@joelfernandes.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/sched/cpupri.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/kernel/sched/cpupri.c
++++ b/kernel/sched/cpupri.c
+@@ -101,6 +101,7 @@ static inline int __cpupri_find(struct c
+
+ if (lowest_mask) {
+ cpumask_and(lowest_mask, &p->cpus_mask, vec->mask);
++ cpumask_and(lowest_mask, lowest_mask, cpu_active_mask);
+
+ /*
+ * We have to ensure that we have at least one bit
serial-8250_port-check-irq-data-before-use.patch
nilfs2-fix-potential-use-after-free-in-nilfs_gccache_submit_read_data.patch
netfilter-nf_tables-disallow-rule-removal-from-chain.patch
+alsa-hda-disable-power-save-for-solving-pop-issue-on-lenovo-thinkcentre-m70q.patch
+loongarch-define-relocation-types-for-abi-v2.10.patch
+loongarch-numa-fix-high_memory-calculation.patch
+ata-libata-scsi-link-ata-port-and-scsi-device.patch
+ata-libata-scsi-ignore-reserved-bits-for-report-supported-operation-codes.patch
+io_uring-fs-remove-sqe-rw_flags-checking-from-linkat.patch
+i2c-i801-unregister-tco_pdev-in-i801_probe-error-path.patch
+asoc-amd-yc-fix-non-functional-mic-on-lenovo-82qf-and-82ug.patch
+kernel-sched-modify-initial-boot-task-idle-setup.patch
+sched-rt-fix-live-lock-between-select_fallback_rq-and-rt-push.patch