]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Oct 2021 09:14:54 +0000 (11:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Oct 2021 09:14:54 +0000 (11:14 +0200)
added patches:
libata-add-ata_horkage_no_ncq_on_ati-for-samsung-860-and-870-ssd.patch
perf-x86-reset-destroy-callback-on-event-init-failure.patch

queue-5.14/kvm-x86-nsvm-restore-int_vector-in-svm_clear_vintr.patch
queue-5.14/libata-add-ata_horkage_no_ncq_on_ati-for-samsung-860-and-870-ssd.patch [new file with mode: 0644]
queue-5.14/perf-x86-reset-destroy-callback-on-event-init-failure.patch [new file with mode: 0644]
queue-5.14/series

index 7c0646d1835ecba3a8e6cc32dc23ef3c38f06685..81a03447597d9ef298a8274d3c77a8a64a8c1cfa 100644 (file)
@@ -16,14 +16,12 @@ Message-Id: <20210914154825.104886-2-mlevitsk@redhat.com>
 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- arch/x86/kvm/svm/svm.c | 2 ++
+ arch/x86/kvm/svm/svm.c |    2 ++
  1 file changed, 2 insertions(+)
 
-diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
-index 69639f9624f5..19d6ffdd3f73 100644
 --- a/arch/x86/kvm/svm/svm.c
 +++ b/arch/x86/kvm/svm/svm.c
-@@ -1601,6 +1601,8 @@ static void svm_clear_vintr(struct vcpu_svm *svm)
+@@ -1601,6 +1601,8 @@ static void svm_clear_vintr(struct vcpu_
  
                svm->vmcb->control.int_ctl |= svm->nested.ctl.int_ctl &
                        V_IRQ_INJECTION_BITS_MASK;
@@ -32,6 +30,3 @@ index 69639f9624f5..19d6ffdd3f73 100644
        }
  
        vmcb_mark_dirty(svm->vmcb, VMCB_INTR);
--- 
-2.33.0
-
diff --git a/queue-5.14/libata-add-ata_horkage_no_ncq_on_ati-for-samsung-860-and-870-ssd.patch b/queue-5.14/libata-add-ata_horkage_no_ncq_on_ati-for-samsung-860-and-870-ssd.patch
new file mode 100644 (file)
index 0000000..b8af708
--- /dev/null
@@ -0,0 +1,119 @@
+From 7a8526a5cd51cf5f070310c6c37dd7293334ac49 Mon Sep 17 00:00:00 2001
+From: Kate Hsuan <hpa@redhat.com>
+Date: Fri, 3 Sep 2021 17:44:11 +0800
+Subject: libata: Add ATA_HORKAGE_NO_NCQ_ON_ATI for Samsung 860 and 870 SSD.
+
+From: Kate Hsuan <hpa@redhat.com>
+
+commit 7a8526a5cd51cf5f070310c6c37dd7293334ac49 upstream.
+
+Many users are reporting that the Samsung 860 and 870 SSD are having
+various issues when combined with AMD/ATI (vendor ID 0x1002)  SATA
+controllers and only completely disabling NCQ helps to avoid these
+issues.
+
+Always disabling NCQ for Samsung 860/870 SSDs regardless of the host
+SATA adapter vendor will cause I/O performance degradation with well
+behaved adapters. To limit the performance impact to ATI adapters,
+introduce the ATA_HORKAGE_NO_NCQ_ON_ATI flag to force disable NCQ
+only for these adapters.
+
+Also, two libata.force parameters (noncqati and ncqati) are introduced
+to disable and enable the NCQ for the system which equipped with ATI
+SATA adapter and Samsung 860 and 870 SSDs. The user can determine NCQ
+function to be enabled or disabled according to the demand.
+
+After verifying the chipset from the user reports, the issue appears
+on AMD/ATI SB7x0/SB8x0/SB9x0 SATA Controllers and does not appear on
+recent AMD SATA adapters. The vendor ID of ATI should be 0x1002.
+Therefore, ATA_HORKAGE_NO_NCQ_ON_AMD was modified to
+ATA_HORKAGE_NO_NCQ_ON_ATI.
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201693
+Signed-off-by: Kate Hsuan <hpa@redhat.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Link: https://lore.kernel.org/r/20210903094411.58749-1-hpa@redhat.com
+Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Cc: Krzysztof Olędzki <ole@ans.pl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/libata-core.c |   34 ++++++++++++++++++++++++++++++++--
+ include/linux/libata.h    |    1 +
+ 2 files changed, 33 insertions(+), 2 deletions(-)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -2199,6 +2199,25 @@ static void ata_dev_config_ncq_prio(stru
+ }
++static bool ata_dev_check_adapter(struct ata_device *dev,
++                                unsigned short vendor_id)
++{
++      struct pci_dev *pcidev = NULL;
++      struct device *parent_dev = NULL;
++
++      for (parent_dev = dev->tdev.parent; parent_dev != NULL;
++           parent_dev = parent_dev->parent) {
++              if (dev_is_pci(parent_dev)) {
++                      pcidev = to_pci_dev(parent_dev);
++                      if (pcidev->vendor == vendor_id)
++                              return true;
++                      break;
++              }
++      }
++
++      return false;
++}
++
+ static int ata_dev_config_ncq(struct ata_device *dev,
+                              char *desc, size_t desc_sz)
+ {
+@@ -2217,6 +2236,13 @@ static int ata_dev_config_ncq(struct ata
+               snprintf(desc, desc_sz, "NCQ (not used)");
+               return 0;
+       }
++
++      if (dev->horkage & ATA_HORKAGE_NO_NCQ_ON_ATI &&
++          ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) {
++              snprintf(desc, desc_sz, "NCQ (not used)");
++              return 0;
++      }
++
+       if (ap->flags & ATA_FLAG_NCQ) {
+               hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE);
+               dev->flags |= ATA_DFLAG_NCQ;
+@@ -3951,9 +3977,11 @@ static const struct ata_blacklist_entry
+       { "Samsung SSD 850*",           NULL,   ATA_HORKAGE_NO_NCQ_TRIM |
+                                               ATA_HORKAGE_ZERO_AFTER_TRIM, },
+       { "Samsung SSD 860*",           NULL,   ATA_HORKAGE_NO_NCQ_TRIM |
+-                                              ATA_HORKAGE_ZERO_AFTER_TRIM, },
++                                              ATA_HORKAGE_ZERO_AFTER_TRIM |
++                                              ATA_HORKAGE_NO_NCQ_ON_ATI, },
+       { "Samsung SSD 870*",           NULL,   ATA_HORKAGE_NO_NCQ_TRIM |
+-                                              ATA_HORKAGE_ZERO_AFTER_TRIM, },
++                                              ATA_HORKAGE_ZERO_AFTER_TRIM |
++                                              ATA_HORKAGE_NO_NCQ_ON_ATI, },
+       { "FCCT*M500*",                 NULL,   ATA_HORKAGE_NO_NCQ_TRIM |
+                                               ATA_HORKAGE_ZERO_AFTER_TRIM, },
+@@ -6108,6 +6136,8 @@ static int __init ata_parse_force_one(ch
+               { "ncq",        .horkage_off    = ATA_HORKAGE_NONCQ },
+               { "noncqtrim",  .horkage_on     = ATA_HORKAGE_NO_NCQ_TRIM },
+               { "ncqtrim",    .horkage_off    = ATA_HORKAGE_NO_NCQ_TRIM },
++              { "noncqati",   .horkage_on     = ATA_HORKAGE_NO_NCQ_ON_ATI },
++              { "ncqati",     .horkage_off    = ATA_HORKAGE_NO_NCQ_ON_ATI },
+               { "dump_id",    .horkage_on     = ATA_HORKAGE_DUMP_ID },
+               { "pio0",       .xfer_mask      = 1 << (ATA_SHIFT_PIO + 0) },
+               { "pio1",       .xfer_mask      = 1 << (ATA_SHIFT_PIO + 1) },
+--- a/include/linux/libata.h
++++ b/include/linux/libata.h
+@@ -422,6 +422,7 @@ enum {
+       ATA_HORKAGE_NOTRIM      = (1 << 24),    /* don't use TRIM */
+       ATA_HORKAGE_MAX_SEC_1024 = (1 << 25),   /* Limit max sects to 1024 */
+       ATA_HORKAGE_MAX_TRIM_128M = (1 << 26),  /* Limit max trim size to 128M */
++      ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27),  /* Disable NCQ on ATI chipset */
+        /* DMA mask for user DMA control: User visible values; DO NOT
+           renumber */
diff --git a/queue-5.14/perf-x86-reset-destroy-callback-on-event-init-failure.patch b/queue-5.14/perf-x86-reset-destroy-callback-on-event-init-failure.patch
new file mode 100644 (file)
index 0000000..439236d
--- /dev/null
@@ -0,0 +1,49 @@
+From 02d029a41dc986e2d5a77ecca45803857b346829 Mon Sep 17 00:00:00 2001
+From: Anand K Mistry <amistry@google.com>
+Date: Wed, 29 Sep 2021 17:04:21 +1000
+Subject: perf/x86: Reset destroy callback on event init failure
+
+From: Anand K Mistry <amistry@google.com>
+
+commit 02d029a41dc986e2d5a77ecca45803857b346829 upstream.
+
+perf_init_event tries multiple init callbacks and does not reset the
+event state between tries. When x86_pmu_event_init runs, it
+unconditionally sets the destroy callback to hw_perf_event_destroy. On
+the next init attempt after x86_pmu_event_init, in perf_try_init_event,
+if the pmu's capabilities includes PERF_PMU_CAP_NO_EXCLUDE, the destroy
+callback will be run. However, if the next init didn't set the destroy
+callback, hw_perf_event_destroy will be run (since the callback wasn't
+reset).
+
+Looking at other pmu init functions, the common pattern is to only set
+the destroy callback on a successful init. Resetting the callback on
+failure tries to replicate that pattern.
+
+This was discovered after commit f11dd0d80555 ("perf/x86/amd/ibs: Extend
+PERF_PMU_CAP_NO_EXCLUDE to IBS Op") when the second (and only second)
+run of the perf tool after a reboot results in 0 samples being
+generated. The extra run of hw_perf_event_destroy results in
+active_events having an extra decrement on each perf run. The second run
+has active_events == 0 and every subsequent run has active_events < 0.
+When active_events == 0, the NMI handler will early-out and not record
+any samples.
+
+Signed-off-by: Anand K Mistry <amistry@google.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lkml.kernel.org/r/20210929170405.1.I078b98ee7727f9ae9d6df8262bad7e325e40faf0@changeid
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/events/core.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/x86/events/core.c
++++ b/arch/x86/events/core.c
+@@ -2467,6 +2467,7 @@ static int x86_pmu_event_init(struct per
+       if (err) {
+               if (event->destroy)
+                       event->destroy(event);
++              event->destroy = NULL;
+       }
+       if (READ_ONCE(x86_pmu.attr_rdpmc) &&
index a871d4412121808bbcd56ca8510f14d10d22f18e..f322ad2dad7b0528e6ac206c599c29b457abecde 100644 (file)
@@ -42,3 +42,5 @@ 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
 kvm-x86-nsvm-restore-int_vector-in-svm_clear_vintr.patch
+perf-x86-reset-destroy-callback-on-event-init-failure.patch
+libata-add-ata_horkage_no_ncq_on_ati-for-samsung-860-and-870-ssd.patch