History

Merge tag 's390-5.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 updates from Heiko Carstens: - disable preemption when accessing local per-cpu variables in the new counter set driver - fix by a factor of four increased steal time due to missing cputime_to_nsecs() conversion - fix PCI device structure leak * tag 's390-5.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/pci: fix leak of PCI device structure s390/vtime: fix increased steal time accounting s390/cpumf: disable preemption when accessing per-cpu variable

Linus Torvalds committed 5 years ago

Commit 6bfea142 parents 278924c 0b135256 files · +36 −20Browse files

Unified · Split

6 files
  1. arch/s390/include/asm/pci.h +1 −1
  2. arch/s390/kernel/perf_cpum_cf_diag.c +2 −1
  3. arch/s390/kernel/vtime.c +1 −1
  4. arch/s390/pci/pci.c +24 −4
  5. arch/s390/pci/pci_event.c +6 −12
  6. drivers/pci/hotplug/s390_pci_hpc.c +2 −1
arch/s390/include/asm/pci.h+1−1
@@ -202,7 +202,7 @@ extern unsigned int s390_pci_no_rid; · 201 unmodified lines
202202 ----------------------------------------------------------------------------- */
203203 /* Base stuff */
204204 int zpci_create_device(u32 fid, u32 fh, enum zpci_state state);
205−void zpci_remove_device(struct zpci_dev *zdev);
205+void zpci_remove_device(struct zpci_dev *zdev, bool set_error);
206206 int zpci_enable_device(struct zpci_dev *);
207207 int zpci_disable_device(struct zpci_dev *);
208208 int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64);
arch/s390/kernel/perf_cpum_cf_diag.c+2−1
@@ -968,7 +968,7 @@ static int cf_diag_all_start(void) · 967 unmodified lines
968968 */
969969 static size_t cf_diag_needspace(unsigned int sets)
970970 {
971− struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events);
971+ struct cpu_cf_events *cpuhw = get_cpu_ptr(&cpu_cf_events);
972972 size_t bytes = 0;
973973 int i;
974974
@@ -984,6 +984,7 @@ static size_t cf_diag_needspace(unsigned int sets) · 9 unmodified lines
984984 sizeof(((struct s390_ctrset_cpudata *)0)->no_sets));
985985 debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__,
986986 bytes);
987+ put_cpu_ptr(&cpu_cf_events);
987988 return bytes;
988989 }
989990
arch/s390/kernel/vtime.c+1−1
@@ -214,7 +214,7 @@ void vtime_flush(struct task_struct *tsk) · 213 unmodified lines
214214 avg_steal = S390_lowcore.avg_steal_timer / 2;
215215 if ((s64) steal > 0) {
216216 S390_lowcore.steal_timer = 0;
217− account_steal_time(steal);
217+ account_steal_time(cputime_to_nsecs(steal));
218218 avg_steal += steal;
219219 }
220220 S390_lowcore.avg_steal_timer = avg_steal;
arch/s390/pci/pci.c+24−4
@@ -682,16 +682,36 @@ int zpci_disable_device(struct zpci_dev *zdev) · 681 unmodified lines
682682 }
683683 EXPORT_SYMBOL_GPL(zpci_disable_device);
684684
685−void zpci_remove_device(struct zpci_dev *zdev)
685+/* zpci_remove_device - Removes the given zdev from the PCI core
686+ * @zdev: the zdev to be removed from the PCI core
687+ * @set_error: if true the device's error state is set to permanent failure
688+ *
689+ * Sets a zPCI device to a configured but offline state; the zPCI
690+ * device is still accessible through its hotplug slot and the zPCI
691+ * API but is removed from the common code PCI bus, making it
692+ * no longer available to drivers.
693+ */
694+void zpci_remove_device(struct zpci_dev *zdev, bool set_error)
686695 {
687696 struct zpci_bus *zbus = zdev->zbus;
688697 struct pci_dev *pdev;
689698
699+ if (!zdev->zbus->bus)
700+ return;
701+
690702 pdev = pci_get_slot(zbus->bus, zdev->devfn);
691703 if (pdev) {
692− if (pdev->is_virtfn)
693− return zpci_iov_remove_virtfn(pdev, zdev->vfn);
704+ if (set_error)
705+ pdev->error_state = pci_channel_io_perm_failure;
706+ if (pdev->is_virtfn) {
707+ zpci_iov_remove_virtfn(pdev, zdev->vfn);
708+ /* balance pci_get_slot */
709+ pci_dev_put(pdev);
710+ return;
711+ }
694712 pci_stop_and_remove_bus_device_locked(pdev);
713+ /* balance pci_get_slot */
714+ pci_dev_put(pdev);
695715 }
696716 }
697717
@@ -765,7 +785,7 @@ void zpci_release_device(struct kref *kref) · 67 unmodified lines
765785 struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref);
766786
767787 if (zdev->zbus->bus)
768− zpci_remove_device(zdev);
788+ zpci_remove_device(zdev, false);
769789
770790 switch (zdev->state) {
771791 case ZPCI_FN_STATE_ONLINE:
arch/s390/pci/pci_event.c+6−12
@@ -76,13 +76,10 @@ void zpci_event_error(void *data) · 75 unmodified lines
7676 static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
7777 {
7878 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
79− struct pci_dev *pdev = NULL;
8079 enum zpci_state state;
80+ struct pci_dev *pdev;
8181 int ret;
8282
83− if (zdev && zdev->zbus->bus)
84− pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
85−
8683 zpci_err("avail CCDF:\n");
8784 zpci_err_hex(ccdf, sizeof(*ccdf));
8885
@@ -124,8 +121,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 35 unmodified lines
124121 case 0x0303: /* Deconfiguration requested */
125122 if (!zdev)
126123 break;
127− if (pdev)
128− zpci_remove_device(zdev);
124+ zpci_remove_device(zdev, false);
129125
130126 ret = zpci_disable_device(zdev);
131127 if (ret)
@@ -140,12 +136,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 8 unmodified lines
140136 case 0x0304: /* Configured -> Standby|Reserved */
141137 if (!zdev)
142138 break;
143− if (pdev) {
144− /* Give the driver a hint that the function is
145− * already unusable. */
146− pdev->error_state = pci_channel_io_perm_failure;
147− zpci_remove_device(zdev);
148− }
139+ /* Give the driver a hint that the function is
140+ * already unusable.
141+ */
142+ zpci_remove_device(zdev, true);
149143
150144 zdev->fh = ccdf->fh;
151145 zpci_disable_device(zdev);
drivers/pci/hotplug/s390_pci_hpc.c+2−1
@@ -93,8 +93,9 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) · 92 unmodified lines
9393 pci_dev_put(pdev);
9494 return -EBUSY;
9595 }
96+ pci_dev_put(pdev);
9697
97− zpci_remove_device(zdev);
98+ zpci_remove_device(zdev, false);
9899
99100 rc = zpci_disable_device(zdev);
100101 if (rc)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t