From: Greg Kroah-Hartman Date: Mon, 6 Jan 2014 18:56:16 +0000 (-0800) Subject: 3.10-stable patches X-Git-Tag: v3.4.76~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba1df0dd1f417361af4ad6bb2324fc6bdabf3395;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: libata-add-ata_horkage_broken_fpdma_aa-quirk-for-seagate-momentus-spinpoint-m8.patch libata-add-atapi_dmadir-force-flag.patch libata-disable-a-disk-via-libata.force-params.patch libata-freezer-avoid-block-device-removal-while-system-is-frozen.patch --- diff --git a/queue-3.10/libata-add-ata_horkage_broken_fpdma_aa-quirk-for-seagate-momentus-spinpoint-m8.patch b/queue-3.10/libata-add-ata_horkage_broken_fpdma_aa-quirk-for-seagate-momentus-spinpoint-m8.patch new file mode 100644 index 00000000000..c5253474e90 --- /dev/null +++ b/queue-3.10/libata-add-ata_horkage_broken_fpdma_aa-quirk-for-seagate-momentus-spinpoint-m8.patch @@ -0,0 +1,39 @@ +From 87809942d3fa60bafb7a58d0bdb1c79e90a6821d Mon Sep 17 00:00:00 2001 +From: Michele Baldessari +Date: Mon, 25 Nov 2013 19:00:14 +0000 +Subject: libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for Seagate Momentus SpinPoint M8 + +From: Michele Baldessari + +commit 87809942d3fa60bafb7a58d0bdb1c79e90a6821d upstream. + +We've received multiple reports in Fedora via (BZ 907193) +that the Seagate Momentus SpinPoint M8 errors out when enabling AA: +[ 2.555905] ata2.00: failed to enable AA (error_mask=0x1) +[ 2.568482] ata2.00: failed to enable AA (error_mask=0x1) + +Add the ATA_HORKAGE_BROKEN_FPDMA_AA for this specific harddisk. + +Reported-by: Nicholas +Signed-off-by: Michele Baldessari +Tested-by: Nicholas +Acked-by: Alan Cox +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libata-core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -4140,6 +4140,9 @@ static const struct ata_blacklist_entry + { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ | + ATA_HORKAGE_FIRMWARE_WARN }, + ++ /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ ++ { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, ++ + /* Blacklist entries taken from Silicon Image 3124/3132 + Windows driver .inf file - also several Linux problem reports */ + { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, diff --git a/queue-3.10/libata-add-atapi_dmadir-force-flag.patch b/queue-3.10/libata-add-atapi_dmadir-force-flag.patch new file mode 100644 index 00000000000..8a6ff44102d --- /dev/null +++ b/queue-3.10/libata-add-atapi_dmadir-force-flag.patch @@ -0,0 +1,71 @@ +From 966fbe193f47c68e70a80ec9991098e88e7959cb Mon Sep 17 00:00:00 2001 +From: Vincent Pelletier +Date: Tue, 21 May 2013 22:30:58 +0200 +Subject: libata: Add atapi_dmadir force flag + +From: Vincent Pelletier + +commit 966fbe193f47c68e70a80ec9991098e88e7959cb upstream. + +Some device require DMADIR to be enabled, but are not detected as such +by atapi_id_dmadir. One such example is "Asus Serillel 2" +SATA-host-to-PATA-device bridge: the bridge itself requires DMADIR, +even if the bridged device does not. + +As atapi_dmadir module parameter can cause problems with some devices +(as per Tejun Heo's memory), enabling it globally may not be possible +depending on the hardware. + +This patch adds atapi_dmadir in the form of a "force" horkage value, +allowing global, per-bus and per-device control. + +Signed-off-by: Vincent Pelletier +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/kernel-parameters.txt | 2 ++ + drivers/ata/libata-core.c | 3 ++- + include/linux/libata.h | 1 + + 3 files changed, 5 insertions(+), 1 deletion(-) + +--- a/Documentation/kernel-parameters.txt ++++ b/Documentation/kernel-parameters.txt +@@ -1456,6 +1456,8 @@ bytes respectively. Such letter suffixes + + * dump_id: dump IDENTIFY data. + ++ * atapi_dmadir: Enable ATAPI DMADIR bridge support ++ + If there are multiple matching configurations changing + the same attribute, the last one is used. + +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -2401,7 +2401,7 @@ int ata_dev_configure(struct ata_device + cdb_intr_string = ", CDB intr"; + } + +- if (atapi_dmadir || atapi_id_dmadir(dev->id)) { ++ if (atapi_dmadir || (dev->horkage & ATA_HORKAGE_ATAPI_DMADIR) || atapi_id_dmadir(dev->id)) { + dev->flags |= ATA_DFLAG_DMADIR; + dma_dir_string = ", DMADIR"; + } +@@ -6506,6 +6506,7 @@ static int __init ata_parse_force_one(ch + { "nosrst", .lflags = ATA_LFLAG_NO_SRST }, + { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST }, + { "rstonce", .lflags = ATA_LFLAG_RST_ONCE }, ++ { "atapi_dmadir", .horkage_on = ATA_HORKAGE_ATAPI_DMADIR }, + }; + char *start = *cur, *p = *cur; + char *id, *val, *endp; +--- a/include/linux/libata.h ++++ b/include/linux/libata.h +@@ -399,6 +399,7 @@ enum { + ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ + ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */ + ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */ ++ ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */ + + /* DMA mask for user DMA control: User visible values; DO NOT + renumber */ diff --git a/queue-3.10/libata-disable-a-disk-via-libata.force-params.patch b/queue-3.10/libata-disable-a-disk-via-libata.force-params.patch new file mode 100644 index 00000000000..2b372ef8cb3 --- /dev/null +++ b/queue-3.10/libata-disable-a-disk-via-libata.force-params.patch @@ -0,0 +1,58 @@ +From b8bd6dc36186fe99afa7b73e9e2d9a98ad5c4865 Mon Sep 17 00:00:00 2001 +From: "Robin H. Johnson" +Date: Mon, 16 Dec 2013 09:31:19 -0800 +Subject: libata: disable a disk via libata.force params + +From: "Robin H. Johnson" + +commit b8bd6dc36186fe99afa7b73e9e2d9a98ad5c4865 upstream. + +A user on StackExchange had a failing SSD that's soldered directly +onto the motherboard of his system. The BIOS does not give any option +to disable it at all, so he can't just hide it from the OS via the +BIOS. + +The old IDE layer had hdX=noprobe override for situations like this, +but that was never ported to the libata layer. + +This patch implements a disable flag for libata.force. + +Example use: + + libata.force=2.0:disable + +[v2 of the patch, removed the nodisable flag per Tejun Heo] + +Signed-off-by: Robin H. Johnson +Signed-off-by: Tejun Heo +Link: http://unix.stackexchange.com/questions/102648/how-to-tell-linux-kernel-3-0-to-completely-ignore-a-failing-disk +Link: http://askubuntu.com/questions/352836/how-can-i-tell-linux-kernel-to-completely-ignore-a-disk-as-if-it-was-not-even-co +Link: http://superuser.com/questions/599333/how-to-disable-kernel-probing-for-drive +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/kernel-parameters.txt | 2 ++ + drivers/ata/libata-core.c | 1 + + 2 files changed, 3 insertions(+) + +--- a/Documentation/kernel-parameters.txt ++++ b/Documentation/kernel-parameters.txt +@@ -1458,6 +1458,8 @@ bytes respectively. Such letter suffixes + + * atapi_dmadir: Enable ATAPI DMADIR bridge support + ++ * disable: Disable this device. ++ + If there are multiple matching configurations changing + the same attribute, the last one is used. + +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -6507,6 +6507,7 @@ static int __init ata_parse_force_one(ch + { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST }, + { "rstonce", .lflags = ATA_LFLAG_RST_ONCE }, + { "atapi_dmadir", .horkage_on = ATA_HORKAGE_ATAPI_DMADIR }, ++ { "disable", .horkage_on = ATA_HORKAGE_DISABLE }, + }; + char *start = *cur, *p = *cur; + char *id, *val, *endp; diff --git a/queue-3.10/libata-freezer-avoid-block-device-removal-while-system-is-frozen.patch b/queue-3.10/libata-freezer-avoid-block-device-removal-while-system-is-frozen.patch new file mode 100644 index 00000000000..f3dc674ef64 --- /dev/null +++ b/queue-3.10/libata-freezer-avoid-block-device-removal-while-system-is-frozen.patch @@ -0,0 +1,111 @@ +From 85fbd722ad0f5d64d1ad15888cd1eb2188bfb557 Mon Sep 17 00:00:00 2001 +From: Tejun Heo +Date: Wed, 18 Dec 2013 07:07:32 -0500 +Subject: libata, freezer: avoid block device removal while system is frozen + +From: Tejun Heo + +commit 85fbd722ad0f5d64d1ad15888cd1eb2188bfb557 upstream. + +Freezable kthreads and workqueues are fundamentally problematic in +that they effectively introduce a big kernel lock widely used in the +kernel and have already been the culprit of several deadlock +scenarios. This is the latest occurrence. + +During resume, libata rescans all the ports and revalidates all +pre-existing devices. If it determines that a device has gone +missing, the device is removed from the system which involves +invalidating block device and flushing bdi while holding driver core +layer locks. Unfortunately, this can race with the rest of device +resume. Because freezable kthreads and workqueues are thawed after +device resume is complete and block device removal depends on +freezable workqueues and kthreads (e.g. bdi_wq, jbd2) to make +progress, this can lead to deadlock - block device removal can't +proceed because kthreads are frozen and kthreads can't be thawed +because device resume is blocked behind block device removal. + +839a8e8660b6 ("writeback: replace custom worker pool implementation +with unbound workqueue") made this particular deadlock scenario more +visible but the underlying problem has always been there - the +original forker task and jbd2 are freezable too. In fact, this is +highly likely just one of many possible deadlock scenarios given that +freezer behaves as a big kernel lock and we don't have any debug +mechanism around it. + +I believe the right thing to do is getting rid of freezable kthreads +and workqueues. This is something fundamentally broken. For now, +implement a funny workaround in libata - just avoid doing block device +hot[un]plug while the system is frozen. Kernel engineering at its +finest. :( + +v2: Add EXPORT_SYMBOL_GPL(pm_freezing) for cases where libata is built + as a module. + +v3: Comment updated and polling interval changed to 10ms as suggested + by Rafael. + +v4: Add #ifdef CONFIG_FREEZER around the hack as pm_freezing is not + defined when FREEZER is not configured thus breaking build. + Reported by kbuild test robot. + +Signed-off-by: Tejun Heo +Reported-by: Tomaž Šolc +Reviewed-by: "Rafael J. Wysocki" +Link: https://bugzilla.kernel.org/show_bug.cgi?id=62801 +Link: http://lkml.kernel.org/r/20131213174932.GA27070@htj.dyndns.org +Cc: Greg Kroah-Hartman +Cc: Len Brown +Cc: Oleg Nesterov +Cc: kbuild test robot +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libata-scsi.c | 21 +++++++++++++++++++++ + kernel/freezer.c | 6 ++++++ + 2 files changed, 27 insertions(+) + +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -3864,6 +3864,27 @@ void ata_scsi_hotplug(struct work_struct + return; + } + ++ /* ++ * XXX - UGLY HACK ++ * ++ * The block layer suspend/resume path is fundamentally broken due ++ * to freezable kthreads and workqueue and may deadlock if a block ++ * device gets removed while resume is in progress. I don't know ++ * what the solution is short of removing freezable kthreads and ++ * workqueues altogether. ++ * ++ * The following is an ugly hack to avoid kicking off device ++ * removal while freezer is active. This is a joke but does avoid ++ * this particular deadlock scenario. ++ * ++ * https://bugzilla.kernel.org/show_bug.cgi?id=62801 ++ * http://marc.info/?l=linux-kernel&m=138695698516487 ++ */ ++#ifdef CONFIG_FREEZER ++ while (pm_freezing) ++ msleep(10); ++#endif ++ + DPRINTK("ENTER\n"); + mutex_lock(&ap->scsi_scan_mutex); + +--- a/kernel/freezer.c ++++ b/kernel/freezer.c +@@ -19,6 +19,12 @@ EXPORT_SYMBOL(system_freezing_cnt); + bool pm_freezing; + bool pm_nosig_freezing; + ++/* ++ * Temporary export for the deadlock workaround in ata_scsi_hotplug(). ++ * Remove once the hack becomes unnecessary. ++ */ ++EXPORT_SYMBOL_GPL(pm_freezing); ++ + /* protects freezing and frozen transitions */ + static DEFINE_SPINLOCK(freezer_lock); + diff --git a/queue-3.10/series b/queue-3.10/series index 07b3a62e5ff..d2d33855df9 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -58,3 +58,7 @@ kvm-x86-fix-apic-map-calculation-after-re-enabling.patch powerpc-fix-bad-stack-check-in-exception-entry.patch powerpc-align-p_end.patch cpupower-fix-segfault-due-to-incorrect-getopt_long-arugments.patch +libata-add-ata_horkage_broken_fpdma_aa-quirk-for-seagate-momentus-spinpoint-m8.patch +libata-add-atapi_dmadir-force-flag.patch +libata-disable-a-disk-via-libata.force-params.patch +libata-freezer-avoid-block-device-removal-while-system-is-frozen.patch