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
Unified · Split
| @@ -202,7 +202,7 @@ extern unsigned int s390_pci_no_rid; · 201 unmodified lines | |||
| 202 | ----------------------------------------------------------------------------- */ | 202 | ----------------------------------------------------------------------------- */ |
| 203 | /* Base stuff */ | 203 | /* Base stuff */ |
| 204 | int zpci_create_device(u32 fid, u32 fh, enum zpci_state state); | 204 | 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); |
| 206 | int zpci_enable_device(struct zpci_dev *); | 206 | int zpci_enable_device(struct zpci_dev *); |
| 207 | int zpci_disable_device(struct zpci_dev *); | 207 | int zpci_disable_device(struct zpci_dev *); |
| 208 | int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); | 208 | int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); |
| @@ -968,7 +968,7 @@ static int cf_diag_all_start(void) · 967 unmodified lines | |||
| 968 | */ | 968 | */ |
| 969 | static size_t cf_diag_needspace(unsigned int sets) | 969 | static size_t cf_diag_needspace(unsigned int sets) |
| 970 | { | 970 | { |
| 971 | struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); | 971 | struct cpu_cf_events *cpuhw = get_cpu_ptr(&cpu_cf_events); |
| 972 | size_t bytes = 0; | 972 | size_t bytes = 0; |
| 973 | int i; | 973 | int i; |
| 974 | 974 | ||
| @@ -984,6 +984,7 @@ static size_t cf_diag_needspace(unsigned int sets) · 9 unmodified lines | |||
| 984 | sizeof(((struct s390_ctrset_cpudata *)0)->no_sets)); | 984 | sizeof(((struct s390_ctrset_cpudata *)0)->no_sets)); |
| 985 | debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__, | 985 | debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__, |
| 986 | bytes); | 986 | bytes); |
| 987 | put_cpu_ptr(&cpu_cf_events); | ||
| 987 | return bytes; | 988 | return bytes; |
| 988 | } | 989 | } |
| 989 | 990 | ||
| @@ -214,7 +214,7 @@ void vtime_flush(struct task_struct *tsk) · 213 unmodified lines | |||
| 214 | avg_steal = S390_lowcore.avg_steal_timer / 2; | 214 | avg_steal = S390_lowcore.avg_steal_timer / 2; |
| 215 | if ((s64) steal > 0) { | 215 | if ((s64) steal > 0) { |
| 216 | S390_lowcore.steal_timer = 0; | 216 | S390_lowcore.steal_timer = 0; |
| 217 | account_steal_time(steal); | 217 | account_steal_time(cputime_to_nsecs(steal)); |
| 218 | avg_steal += steal; | 218 | avg_steal += steal; |
| 219 | } | 219 | } |
| 220 | S390_lowcore.avg_steal_timer = avg_steal; | 220 | S390_lowcore.avg_steal_timer = avg_steal; |
| @@ -682,16 +682,36 @@ int zpci_disable_device(struct zpci_dev *zdev) · 681 unmodified lines | |||
| 682 | } | 682 | } |
| 683 | EXPORT_SYMBOL_GPL(zpci_disable_device); | 683 | EXPORT_SYMBOL_GPL(zpci_disable_device); |
| 684 | 684 | ||
| 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) | ||
| 686 | { | 695 | { |
| 687 | struct zpci_bus *zbus = zdev->zbus; | 696 | struct zpci_bus *zbus = zdev->zbus; |
| 688 | struct pci_dev *pdev; | 697 | struct pci_dev *pdev; |
| 689 | 698 | ||
| 699 | if (!zdev->zbus->bus) | ||
| 700 | return; | ||
| 701 | |||
| 690 | pdev = pci_get_slot(zbus->bus, zdev->devfn); | 702 | pdev = pci_get_slot(zbus->bus, zdev->devfn); |
| 691 | if (pdev) { | 703 | if (pdev) { |
| 692 | if (pdev->is_virtfn) | 704 | if (set_error) |
| 693 | return zpci_iov_remove_virtfn(pdev, zdev->vfn); | 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 | } | ||
| 694 | pci_stop_and_remove_bus_device_locked(pdev); | 712 | pci_stop_and_remove_bus_device_locked(pdev); |
| 713 | /* balance pci_get_slot */ | ||
| 714 | pci_dev_put(pdev); | ||
| 695 | } | 715 | } |
| 696 | } | 716 | } |
| 697 | 717 | ||
| @@ -765,7 +785,7 @@ void zpci_release_device(struct kref *kref) · 67 unmodified lines | |||
| 765 | struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); | 785 | struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); |
| 766 | 786 | ||
| 767 | if (zdev->zbus->bus) | 787 | if (zdev->zbus->bus) |
| 768 | zpci_remove_device(zdev); | 788 | zpci_remove_device(zdev, false); |
| 769 | 789 | ||
| 770 | switch (zdev->state) { | 790 | switch (zdev->state) { |
| 771 | case ZPCI_FN_STATE_ONLINE: | 791 | case ZPCI_FN_STATE_ONLINE: |
| @@ -76,13 +76,10 @@ void zpci_event_error(void *data) · 75 unmodified lines | |||
| 76 | static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) | 76 | static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) |
| 77 | { | 77 | { |
| 78 | struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); | 78 | struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); |
| 79 | struct pci_dev *pdev = NULL; | ||
| 80 | enum zpci_state state; | 79 | enum zpci_state state; |
| 80 | struct pci_dev *pdev; | ||
| 81 | int ret; | 81 | int ret; |
| 82 | 82 | ||
| 83 | if (zdev && zdev->zbus->bus) | ||
| 84 | pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); | ||
| 85 | |||
| 86 | zpci_err("avail CCDF:\n"); | 83 | zpci_err("avail CCDF:\n"); |
| 87 | zpci_err_hex(ccdf, sizeof(*ccdf)); | 84 | zpci_err_hex(ccdf, sizeof(*ccdf)); |
| 88 | 85 | ||
| @@ -124,8 +121,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 35 unmodified lines | |||
| 124 | case 0x0303: /* Deconfiguration requested */ | 121 | case 0x0303: /* Deconfiguration requested */ |
| 125 | if (!zdev) | 122 | if (!zdev) |
| 126 | break; | 123 | break; |
| 127 | if (pdev) | 124 | zpci_remove_device(zdev, false); |
| 128 | zpci_remove_device(zdev); | ||
| 129 | 125 | ||
| 130 | ret = zpci_disable_device(zdev); | 126 | ret = zpci_disable_device(zdev); |
| 131 | if (ret) | 127 | if (ret) |
| @@ -140,12 +136,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 8 unmodified lines | |||
| 140 | case 0x0304: /* Configured -> Standby|Reserved */ | 136 | case 0x0304: /* Configured -> Standby|Reserved */ |
| 141 | if (!zdev) | 137 | if (!zdev) |
| 142 | break; | 138 | break; |
| 143 | if (pdev) { | 139 | /* Give the driver a hint that the function is |
| 144 | /* Give the driver a hint that the function is | 140 | * already unusable. |
| 145 | * already unusable. */ | 141 | */ |
| 146 | pdev->error_state = pci_channel_io_perm_failure; | 142 | zpci_remove_device(zdev, true); |
| 147 | zpci_remove_device(zdev); | ||
| 148 | } | ||
| 149 | 143 | ||
| 150 | zdev->fh = ccdf->fh; | 144 | zdev->fh = ccdf->fh; |
| 151 | zpci_disable_device(zdev); | 145 | zpci_disable_device(zdev); |
| @@ -93,8 +93,9 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) · 92 unmodified lines | |||
| 93 | pci_dev_put(pdev); | 93 | pci_dev_put(pdev); |
| 94 | return -EBUSY; | 94 | return -EBUSY; |
| 95 | } | 95 | } |
| 96 | pci_dev_put(pdev); | ||
| 96 | 97 | ||
| 97 | zpci_remove_device(zdev); | 98 | zpci_remove_device(zdev, false); |
| 98 | 99 | ||
| 99 | rc = zpci_disable_device(zdev); | 100 | rc = zpci_disable_device(zdev); |
| 100 | if (rc) | 101 | if (rc) |