diff options
239 files changed, 2194 insertions, 1396 deletions
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt index fd786ea13a1f..e182be5e3c83 100644 --- a/Documentation/acpi/enumeration.txt +++ b/Documentation/acpi/enumeration.txt | |||
| @@ -60,12 +60,6 @@ If the driver needs to perform more complex initialization like getting and | |||
| 60 | configuring GPIOs it can get its ACPI handle and extract this information | 60 | configuring GPIOs it can get its ACPI handle and extract this information |
| 61 | from ACPI tables. | 61 | from ACPI tables. |
| 62 | 62 | ||
| 63 | Currently the kernel is not able to automatically determine from which ACPI | ||
| 64 | device it should make the corresponding platform device so we need to add | ||
| 65 | the ACPI device explicitly to acpi_platform_device_ids list defined in | ||
| 66 | drivers/acpi/acpi_platform.c. This limitation is only for the platform | ||
| 67 | devices, SPI and I2C devices are created automatically as described below. | ||
| 68 | |||
| 69 | DMA support | 63 | DMA support |
| 70 | ~~~~~~~~~~~ | 64 | ~~~~~~~~~~~ |
| 71 | DMA controllers enumerated via ACPI should be registered in the system to | 65 | DMA controllers enumerated via ACPI should be registered in the system to |
diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt index f055515d2b62..366690cb86a3 100644 --- a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt | |||
| @@ -8,10 +8,12 @@ Both required and optional properties listed below must be defined | |||
| 8 | under node /cpus/cpu@0. | 8 | under node /cpus/cpu@0. |
| 9 | 9 | ||
| 10 | Required properties: | 10 | Required properties: |
| 11 | - operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt | 11 | - None |
| 12 | for details | ||
| 13 | 12 | ||
| 14 | Optional properties: | 13 | Optional properties: |
| 14 | - operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt for | ||
| 15 | details. OPPs *must* be supplied either via DT, i.e. this property, or | ||
| 16 | populated at runtime. | ||
| 15 | - clock-latency: Specify the possible maximum transition latency for clock, | 17 | - clock-latency: Specify the possible maximum transition latency for clock, |
| 16 | in unit of nanoseconds. | 18 | in unit of nanoseconds. |
| 17 | - voltage-tolerance: Specify the CPU voltage tolerance in percentage. | 19 | - voltage-tolerance: Specify the CPU voltage tolerance in percentage. |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index c1b9aa8c5a52..b7fa2f599459 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -2790,6 +2790,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 2790 | leaf rcu_node structure. Useful for very large | 2790 | leaf rcu_node structure. Useful for very large |
| 2791 | systems. | 2791 | systems. |
| 2792 | 2792 | ||
| 2793 | rcutree.jiffies_till_sched_qs= [KNL] | ||
| 2794 | Set required age in jiffies for a | ||
| 2795 | given grace period before RCU starts | ||
| 2796 | soliciting quiescent-state help from | ||
| 2797 | rcu_note_context_switch(). | ||
| 2798 | |||
| 2793 | rcutree.jiffies_till_first_fqs= [KNL] | 2799 | rcutree.jiffies_till_first_fqs= [KNL] |
| 2794 | Set delay from grace-period initialization to | 2800 | Set delay from grace-period initialization to |
| 2795 | first attempt to force quiescent states. | 2801 | first attempt to force quiescent states. |
| @@ -3526,7 +3532,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 3526 | the allocated input device; If set to 0, video driver | 3532 | the allocated input device; If set to 0, video driver |
| 3527 | will only send out the event without touching backlight | 3533 | will only send out the event without touching backlight |
| 3528 | brightness level. | 3534 | brightness level. |
| 3529 | default: 0 | 3535 | default: 1 |
| 3530 | 3536 | ||
| 3531 | virtio_mmio.device= | 3537 | virtio_mmio.device= |
| 3532 | [VMMIO] Memory mapped virtio (platform) device. | 3538 | [VMMIO] Memory mapped virtio (platform) device. |
diff --git a/MAINTAINERS b/MAINTAINERS index e31c87474739..61a8f486306b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -156,7 +156,6 @@ F: drivers/net/hamradio/6pack.c | |||
| 156 | 156 | ||
| 157 | 8169 10/100/1000 GIGABIT ETHERNET DRIVER | 157 | 8169 10/100/1000 GIGABIT ETHERNET DRIVER |
| 158 | M: Realtek linux nic maintainers <nic_swsd@realtek.com> | 158 | M: Realtek linux nic maintainers <nic_swsd@realtek.com> |
| 159 | M: Francois Romieu <romieu@fr.zoreil.com> | ||
| 160 | L: netdev@vger.kernel.org | 159 | L: netdev@vger.kernel.org |
| 161 | S: Maintained | 160 | S: Maintained |
| 162 | F: drivers/net/ethernet/realtek/r8169.c | 161 | F: drivers/net/ethernet/realtek/r8169.c |
| @@ -4511,8 +4510,7 @@ S: Supported | |||
| 4511 | F: drivers/idle/i7300_idle.c | 4510 | F: drivers/idle/i7300_idle.c |
| 4512 | 4511 | ||
| 4513 | IEEE 802.15.4 SUBSYSTEM | 4512 | IEEE 802.15.4 SUBSYSTEM |
| 4514 | M: Alexander Smirnov <alex.bluesman.smirnov@gmail.com> | 4513 | M: Alexander Aring <alex.aring@gmail.com> |
| 4515 | M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
| 4516 | L: linux-zigbee-devel@lists.sourceforge.net (moderated for non-subscribers) | 4514 | L: linux-zigbee-devel@lists.sourceforge.net (moderated for non-subscribers) |
| 4517 | W: http://apps.sourceforge.net/trac/linux-zigbee | 4515 | W: http://apps.sourceforge.net/trac/linux-zigbee |
| 4518 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git | 4516 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 245058b3b0ef..88acf8bc1490 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -6,6 +6,7 @@ config ARM | |||
| 6 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST | 6 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
| 7 | select ARCH_HAVE_CUSTOM_GPIO_H | 7 | select ARCH_HAVE_CUSTOM_GPIO_H |
| 8 | select ARCH_MIGHT_HAVE_PC_PARPORT | 8 | select ARCH_MIGHT_HAVE_PC_PARPORT |
| 9 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
| 9 | select ARCH_USE_BUILTIN_BSWAP | 10 | select ARCH_USE_BUILTIN_BSWAP |
| 10 | select ARCH_USE_CMPXCHG_LOCKREF | 11 | select ARCH_USE_CMPXCHG_LOCKREF |
| 11 | select ARCH_WANT_IPC_PARSE_VERSION | 12 | select ARCH_WANT_IPC_PARSE_VERSION |
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index 287795985e32..b84bac5bada4 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi | |||
| @@ -925,7 +925,7 @@ | |||
| 925 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | 925 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; |
| 926 | reg = <0x00500000 0x00100000>; | 926 | reg = <0x00500000 0x00100000>; |
| 927 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; | 927 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; |
| 928 | clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>, | 928 | clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, |
| 929 | <&uhpck>; | 929 | <&uhpck>; |
| 930 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; | 930 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; |
| 931 | status = "disabled"; | 931 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 2ebc42140ea6..2c0d6ea3ab41 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
| @@ -1124,6 +1124,7 @@ | |||
| 1124 | compatible = "atmel,at91sam9rl-pwm"; | 1124 | compatible = "atmel,at91sam9rl-pwm"; |
| 1125 | reg = <0xf8034000 0x300>; | 1125 | reg = <0xf8034000 0x300>; |
| 1126 | interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>; | 1126 | interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>; |
| 1127 | clocks = <&pwm_clk>; | ||
| 1127 | #pwm-cells = <3>; | 1128 | #pwm-cells = <3>; |
| 1128 | status = "disabled"; | 1129 | status = "disabled"; |
| 1129 | }; | 1130 | }; |
| @@ -1155,8 +1156,7 @@ | |||
| 1155 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | 1156 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; |
| 1156 | reg = <0x00600000 0x100000>; | 1157 | reg = <0x00600000 0x100000>; |
| 1157 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; | 1158 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; |
| 1158 | clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>, | 1159 | clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; |
| 1159 | <&uhpck>; | ||
| 1160 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; | 1160 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; |
| 1161 | status = "disabled"; | 1161 | status = "disabled"; |
| 1162 | }; | 1162 | }; |
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 9d853189028b..e35d880f9773 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c | |||
| @@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid) | |||
| 275 | cpu_topology[cpuid].socket_id, mpidr); | 275 | cpu_topology[cpuid].socket_id, mpidr); |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | static inline const int cpu_corepower_flags(void) | 278 | static inline int cpu_corepower_flags(void) |
| 279 | { | 279 | { |
| 280 | return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; | 280 | return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; |
| 281 | } | 281 | } |
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index 8a134d019cb3..920a4baa53cd 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c | |||
| @@ -40,15 +40,17 @@ static inline void cpu_leave_lowpower(void) | |||
| 40 | 40 | ||
| 41 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | 41 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) |
| 42 | { | 42 | { |
| 43 | u32 mpidr = cpu_logical_map(cpu); | ||
| 44 | u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
| 45 | |||
| 43 | for (;;) { | 46 | for (;;) { |
| 44 | 47 | ||
| 45 | /* make cpu1 to be turned off at next WFI command */ | 48 | /* Turn the CPU off on next WFI instruction. */ |
| 46 | if (cpu == 1) | 49 | exynos_cpu_power_down(core_id); |
| 47 | exynos_cpu_power_down(cpu); | ||
| 48 | 50 | ||
| 49 | wfi(); | 51 | wfi(); |
| 50 | 52 | ||
| 51 | if (pen_release == cpu_logical_map(cpu)) { | 53 | if (pen_release == core_id) { |
| 52 | /* | 54 | /* |
| 53 | * OK, proper wakeup, we're done | 55 | * OK, proper wakeup, we're done |
| 54 | */ | 56 | */ |
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 1c8d31e39520..50b9aad5e27b 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c | |||
| @@ -90,7 +90,8 @@ static void exynos_secondary_init(unsigned int cpu) | |||
| 90 | static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) | 90 | static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) |
| 91 | { | 91 | { |
| 92 | unsigned long timeout; | 92 | unsigned long timeout; |
| 93 | unsigned long phys_cpu = cpu_logical_map(cpu); | 93 | u32 mpidr = cpu_logical_map(cpu); |
| 94 | u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
| 94 | int ret = -ENOSYS; | 95 | int ret = -ENOSYS; |
| 95 | 96 | ||
| 96 | /* | 97 | /* |
| @@ -104,17 +105,18 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
| 104 | * the holding pen - release it, then wait for it to flag | 105 | * the holding pen - release it, then wait for it to flag |
| 105 | * that it has been released by resetting pen_release. | 106 | * that it has been released by resetting pen_release. |
| 106 | * | 107 | * |
| 107 | * Note that "pen_release" is the hardware CPU ID, whereas | 108 | * Note that "pen_release" is the hardware CPU core ID, whereas |
| 108 | * "cpu" is Linux's internal ID. | 109 | * "cpu" is Linux's internal ID. |
| 109 | */ | 110 | */ |
| 110 | write_pen_release(phys_cpu); | 111 | write_pen_release(core_id); |
| 111 | 112 | ||
| 112 | if (!exynos_cpu_power_state(cpu)) { | 113 | if (!exynos_cpu_power_state(core_id)) { |
| 113 | exynos_cpu_power_up(cpu); | 114 | exynos_cpu_power_up(core_id); |
| 114 | timeout = 10; | 115 | timeout = 10; |
| 115 | 116 | ||
| 116 | /* wait max 10 ms until cpu1 is on */ | 117 | /* wait max 10 ms until cpu1 is on */ |
| 117 | while (exynos_cpu_power_state(cpu) != S5P_CORE_LOCAL_PWR_EN) { | 118 | while (exynos_cpu_power_state(core_id) |
| 119 | != S5P_CORE_LOCAL_PWR_EN) { | ||
| 118 | if (timeout-- == 0) | 120 | if (timeout-- == 0) |
| 119 | break; | 121 | break; |
| 120 | 122 | ||
| @@ -145,20 +147,20 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
| 145 | * Try to set boot address using firmware first | 147 | * Try to set boot address using firmware first |
| 146 | * and fall back to boot register if it fails. | 148 | * and fall back to boot register if it fails. |
| 147 | */ | 149 | */ |
| 148 | ret = call_firmware_op(set_cpu_boot_addr, phys_cpu, boot_addr); | 150 | ret = call_firmware_op(set_cpu_boot_addr, core_id, boot_addr); |
| 149 | if (ret && ret != -ENOSYS) | 151 | if (ret && ret != -ENOSYS) |
| 150 | goto fail; | 152 | goto fail; |
| 151 | if (ret == -ENOSYS) { | 153 | if (ret == -ENOSYS) { |
| 152 | void __iomem *boot_reg = cpu_boot_reg(phys_cpu); | 154 | void __iomem *boot_reg = cpu_boot_reg(core_id); |
| 153 | 155 | ||
| 154 | if (IS_ERR(boot_reg)) { | 156 | if (IS_ERR(boot_reg)) { |
| 155 | ret = PTR_ERR(boot_reg); | 157 | ret = PTR_ERR(boot_reg); |
| 156 | goto fail; | 158 | goto fail; |
| 157 | } | 159 | } |
| 158 | __raw_writel(boot_addr, cpu_boot_reg(phys_cpu)); | 160 | __raw_writel(boot_addr, cpu_boot_reg(core_id)); |
| 159 | } | 161 | } |
| 160 | 162 | ||
| 161 | call_firmware_op(cpu_boot, phys_cpu); | 163 | call_firmware_op(cpu_boot, core_id); |
| 162 | 164 | ||
| 163 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); | 165 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); |
| 164 | 166 | ||
| @@ -227,22 +229,24 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) | |||
| 227 | * boot register if it fails. | 229 | * boot register if it fails. |
| 228 | */ | 230 | */ |
| 229 | for (i = 1; i < max_cpus; ++i) { | 231 | for (i = 1; i < max_cpus; ++i) { |
| 230 | unsigned long phys_cpu; | ||
| 231 | unsigned long boot_addr; | 232 | unsigned long boot_addr; |
| 233 | u32 mpidr; | ||
| 234 | u32 core_id; | ||
| 232 | int ret; | 235 | int ret; |
| 233 | 236 | ||
| 234 | phys_cpu = cpu_logical_map(i); | 237 | mpidr = cpu_logical_map(i); |
| 238 | core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
| 235 | boot_addr = virt_to_phys(exynos4_secondary_startup); | 239 | boot_addr = virt_to_phys(exynos4_secondary_startup); |
| 236 | 240 | ||
| 237 | ret = call_firmware_op(set_cpu_boot_addr, phys_cpu, boot_addr); | 241 | ret = call_firmware_op(set_cpu_boot_addr, core_id, boot_addr); |
| 238 | if (ret && ret != -ENOSYS) | 242 | if (ret && ret != -ENOSYS) |
| 239 | break; | 243 | break; |
| 240 | if (ret == -ENOSYS) { | 244 | if (ret == -ENOSYS) { |
| 241 | void __iomem *boot_reg = cpu_boot_reg(phys_cpu); | 245 | void __iomem *boot_reg = cpu_boot_reg(core_id); |
| 242 | 246 | ||
| 243 | if (IS_ERR(boot_reg)) | 247 | if (IS_ERR(boot_reg)) |
| 244 | break; | 248 | break; |
| 245 | __raw_writel(boot_addr, cpu_boot_reg(phys_cpu)); | 249 | __raw_writel(boot_addr, cpu_boot_reg(core_id)); |
| 246 | } | 250 | } |
| 247 | } | 251 | } |
| 248 | } | 252 | } |
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 8e795dea02ec..8556c787e59c 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c | |||
| @@ -70,7 +70,7 @@ static const char *cko_sels[] = { "cko1", "cko2", }; | |||
| 70 | static const char *lvds_sels[] = { | 70 | static const char *lvds_sels[] = { |
| 71 | "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", | 71 | "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", |
| 72 | "pll4_audio", "pll5_video", "pll8_mlb", "enet_ref", | 72 | "pll4_audio", "pll5_video", "pll8_mlb", "enet_ref", |
| 73 | "pcie_ref", "sata_ref", | 73 | "pcie_ref_125m", "sata_ref_100m", |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | enum mx6q_clks { | 76 | enum mx6q_clks { |
| @@ -491,7 +491,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) | |||
| 491 | 491 | ||
| 492 | /* All existing boards with PCIe use LVDS1 */ | 492 | /* All existing boards with PCIe use LVDS1 */ |
| 493 | if (IS_ENABLED(CONFIG_PCI_IMX6)) | 493 | if (IS_ENABLED(CONFIG_PCI_IMX6)) |
| 494 | clk_set_parent(clk[lvds1_sel], clk[sata_ref]); | 494 | clk_set_parent(clk[lvds1_sel], clk[sata_ref_100m]); |
| 495 | 495 | ||
| 496 | /* Set initial power mode */ | 496 | /* Set initial power mode */ |
| 497 | imx6q_set_lpm(WAIT_CLOCKED); | 497 | imx6q_set_lpm(WAIT_CLOCKED); |
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 477202fd39cc..2bdc3233abe2 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c | |||
| @@ -292,6 +292,10 @@ static struct notifier_block mvebu_hwcc_nb = { | |||
| 292 | .notifier_call = mvebu_hwcc_notifier, | 292 | .notifier_call = mvebu_hwcc_notifier, |
| 293 | }; | 293 | }; |
| 294 | 294 | ||
| 295 | static struct notifier_block mvebu_hwcc_pci_nb = { | ||
| 296 | .notifier_call = mvebu_hwcc_notifier, | ||
| 297 | }; | ||
| 298 | |||
| 295 | static void __init armada_370_coherency_init(struct device_node *np) | 299 | static void __init armada_370_coherency_init(struct device_node *np) |
| 296 | { | 300 | { |
| 297 | struct resource res; | 301 | struct resource res; |
| @@ -427,7 +431,7 @@ static int __init coherency_pci_init(void) | |||
| 427 | { | 431 | { |
| 428 | if (coherency_available()) | 432 | if (coherency_available()) |
| 429 | bus_register_notifier(&pci_bus_type, | 433 | bus_register_notifier(&pci_bus_type, |
| 430 | &mvebu_hwcc_nb); | 434 | &mvebu_hwcc_pci_nb); |
| 431 | return 0; | 435 | return 0; |
| 432 | } | 436 | } |
| 433 | 437 | ||
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S index 5925366bc03c..da5bb292b91c 100644 --- a/arch/arm/mach-mvebu/headsmp-a9.S +++ b/arch/arm/mach-mvebu/headsmp-a9.S | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
| 16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 17 | 17 | ||
| 18 | #include <asm/assembler.h> | ||
| 19 | |||
| 18 | __CPUINIT | 20 | __CPUINIT |
| 19 | #define CPU_RESUME_ADDR_REG 0xf10182d4 | 21 | #define CPU_RESUME_ADDR_REG 0xf10182d4 |
| 20 | 22 | ||
| @@ -22,13 +24,18 @@ | |||
| 22 | .global armada_375_smp_cpu1_enable_code_end | 24 | .global armada_375_smp_cpu1_enable_code_end |
| 23 | 25 | ||
| 24 | armada_375_smp_cpu1_enable_code_start: | 26 | armada_375_smp_cpu1_enable_code_start: |
| 25 | ldr r0, [pc, #4] | 27 | ARM_BE8(setend be) |
| 28 | adr r0, 1f | ||
| 29 | ldr r0, [r0] | ||
| 26 | ldr r1, [r0] | 30 | ldr r1, [r0] |
| 31 | ARM_BE8(rev r1, r1) | ||
| 27 | mov pc, r1 | 32 | mov pc, r1 |
| 33 | 1: | ||
| 28 | .word CPU_RESUME_ADDR_REG | 34 | .word CPU_RESUME_ADDR_REG |
| 29 | armada_375_smp_cpu1_enable_code_end: | 35 | armada_375_smp_cpu1_enable_code_end: |
| 30 | 36 | ||
| 31 | ENTRY(mvebu_cortex_a9_secondary_startup) | 37 | ENTRY(mvebu_cortex_a9_secondary_startup) |
| 38 | ARM_BE8(setend be) | ||
| 32 | bl v7_invalidate_l1 | 39 | bl v7_invalidate_l1 |
| 33 | b secondary_startup | 40 | b secondary_startup |
| 34 | ENDPROC(mvebu_cortex_a9_secondary_startup) | 41 | ENDPROC(mvebu_cortex_a9_secondary_startup) |
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index a1d407c0febe..25aa8237d668 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c | |||
| @@ -201,12 +201,12 @@ static noinline int do_armada_370_xp_cpu_suspend(unsigned long deepidle) | |||
| 201 | 201 | ||
| 202 | /* Test the CR_C bit and set it if it was cleared */ | 202 | /* Test the CR_C bit and set it if it was cleared */ |
| 203 | asm volatile( | 203 | asm volatile( |
| 204 | "mrc p15, 0, %0, c1, c0, 0 \n\t" | 204 | "mrc p15, 0, r0, c1, c0, 0 \n\t" |
| 205 | "tst %0, #(1 << 2) \n\t" | 205 | "tst r0, #(1 << 2) \n\t" |
| 206 | "orreq %0, %0, #(1 << 2) \n\t" | 206 | "orreq r0, r0, #(1 << 2) \n\t" |
| 207 | "mcreq p15, 0, %0, c1, c0, 0 \n\t" | 207 | "mcreq p15, 0, r0, c1, c0, 0 \n\t" |
| 208 | "isb " | 208 | "isb " |
| 209 | : : "r" (0)); | 209 | : : : "r0"); |
| 210 | 210 | ||
| 211 | pr_warn("Failed to suspend the system\n"); | 211 | pr_warn("Failed to suspend the system\n"); |
| 212 | 212 | ||
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a474de346be6..839f48c26ef0 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
| @@ -4,6 +4,7 @@ config ARM64 | |||
| 4 | select ARCH_HAS_OPP | 4 | select ARCH_HAS_OPP |
| 5 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST | 5 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
| 6 | select ARCH_USE_CMPXCHG_LOCKREF | 6 | select ARCH_USE_CMPXCHG_LOCKREF |
| 7 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
| 7 | select ARCH_WANT_OPTIONAL_GPIOLIB | 8 | select ARCH_WANT_OPTIONAL_GPIOLIB |
| 8 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION | 9 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION |
| 9 | select ARCH_WANT_FRAME_POINTERS | 10 | select ARCH_WANT_FRAME_POINTERS |
diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c index 60e98a639ac5..e786e6cdc400 100644 --- a/arch/arm64/kernel/efi-stub.c +++ b/arch/arm64/kernel/efi-stub.c | |||
| @@ -12,8 +12,6 @@ | |||
| 12 | #include <linux/efi.h> | 12 | #include <linux/efi.h> |
| 13 | #include <linux/libfdt.h> | 13 | #include <linux/libfdt.h> |
| 14 | #include <asm/sections.h> | 14 | #include <asm/sections.h> |
| 15 | #include <generated/compile.h> | ||
| 16 | #include <generated/utsrelease.h> | ||
| 17 | 15 | ||
| 18 | /* | 16 | /* |
| 19 | * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from | 17 | * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index fefe7c8bf05f..80b94b0add1f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
| @@ -145,6 +145,7 @@ config PPC | |||
| 145 | select HAVE_IRQ_EXIT_ON_IRQ_STACK | 145 | select HAVE_IRQ_EXIT_ON_IRQ_STACK |
| 146 | select ARCH_USE_CMPXCHG_LOCKREF if PPC64 | 146 | select ARCH_USE_CMPXCHG_LOCKREF if PPC64 |
| 147 | select HAVE_ARCH_AUDITSYSCALL | 147 | select HAVE_ARCH_AUDITSYSCALL |
| 148 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
| 148 | 149 | ||
| 149 | config GENERIC_CSUM | 150 | config GENERIC_CSUM |
| 150 | def_bool CPU_LITTLE_ENDIAN | 151 | def_bool CPU_LITTLE_ENDIAN |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 51a3ff78838a..1007fb802e6b 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
| @@ -747,7 +747,7 @@ int setup_profiling_timer(unsigned int multiplier) | |||
| 747 | 747 | ||
| 748 | #ifdef CONFIG_SCHED_SMT | 748 | #ifdef CONFIG_SCHED_SMT |
| 749 | /* cpumask of CPUs with asymetric SMT dependancy */ | 749 | /* cpumask of CPUs with asymetric SMT dependancy */ |
| 750 | static const int powerpc_smt_flags(void) | 750 | static int powerpc_smt_flags(void) |
| 751 | { | 751 | { |
| 752 | int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; | 752 | int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; |
| 753 | 753 | ||
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index 6dcdadefd8d0..82e82cadcde5 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c | |||
| @@ -390,12 +390,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
| 390 | case BPF_ANC | SKF_AD_VLAN_TAG: | 390 | case BPF_ANC | SKF_AD_VLAN_TAG: |
| 391 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: | 391 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
| 392 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | 392 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); |
| 393 | BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000); | ||
| 394 | |||
| 393 | PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, | 395 | PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, |
| 394 | vlan_tci)); | 396 | vlan_tci)); |
| 395 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) | 397 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { |
| 396 | PPC_ANDI(r_A, r_A, VLAN_VID_MASK); | 398 | PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT); |
| 397 | else | 399 | } else { |
| 398 | PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); | 400 | PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); |
| 401 | PPC_SRWI(r_A, r_A, 12); | ||
| 402 | } | ||
| 399 | break; | 403 | break; |
| 400 | case BPF_ANC | SKF_AD_QUEUE: | 404 | case BPF_ANC | SKF_AD_QUEUE: |
| 401 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 405 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 29f2e988c56a..407c87d9879a 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
| @@ -78,6 +78,7 @@ config SPARC64 | |||
| 78 | select HAVE_C_RECORDMCOUNT | 78 | select HAVE_C_RECORDMCOUNT |
| 79 | select NO_BOOTMEM | 79 | select NO_BOOTMEM |
| 80 | select HAVE_ARCH_AUDITSYSCALL | 80 | select HAVE_ARCH_AUDITSYSCALL |
| 81 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
| 81 | 82 | ||
| 82 | config ARCH_DEFCONFIG | 83 | config ARCH_DEFCONFIG |
| 83 | string | 84 | string |
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index 9472079471bb..f1b3eb14b855 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <mem_user.h> | 12 | #include <mem_user.h> |
| 13 | #include <os.h> | 13 | #include <os.h> |
| 14 | #include <skas.h> | 14 | #include <skas.h> |
| 15 | #include <kern_util.h> | ||
| 15 | 16 | ||
| 16 | struct host_vm_change { | 17 | struct host_vm_change { |
| 17 | struct host_vm_op { | 18 | struct host_vm_op { |
| @@ -124,6 +125,9 @@ static int add_munmap(unsigned long addr, unsigned long len, | |||
| 124 | struct host_vm_op *last; | 125 | struct host_vm_op *last; |
| 125 | int ret = 0; | 126 | int ret = 0; |
| 126 | 127 | ||
| 128 | if ((addr >= STUB_START) && (addr < STUB_END)) | ||
| 129 | return -EINVAL; | ||
| 130 | |||
| 127 | if (hvc->index != 0) { | 131 | if (hvc->index != 0) { |
| 128 | last = &hvc->ops[hvc->index - 1]; | 132 | last = &hvc->ops[hvc->index - 1]; |
| 129 | if ((last->type == MUNMAP) && | 133 | if ((last->type == MUNMAP) && |
| @@ -283,8 +287,11 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr, | |||
| 283 | /* This is not an else because ret is modified above */ | 287 | /* This is not an else because ret is modified above */ |
| 284 | if (ret) { | 288 | if (ret) { |
| 285 | printk(KERN_ERR "fix_range_common: failed, killing current " | 289 | printk(KERN_ERR "fix_range_common: failed, killing current " |
| 286 | "process\n"); | 290 | "process: %d\n", task_tgid_vnr(current)); |
| 291 | /* We are under mmap_sem, release it such that current can terminate */ | ||
| 292 | up_write(¤t->mm->mmap_sem); | ||
| 287 | force_sig(SIGKILL, current); | 293 | force_sig(SIGKILL, current); |
| 294 | do_signal(); | ||
| 288 | } | 295 | } |
| 289 | } | 296 | } |
| 290 | 297 | ||
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index 974b87474a99..5678c3571e7c 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
| @@ -206,7 +206,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, | |||
| 206 | int is_write = FAULT_WRITE(fi); | 206 | int is_write = FAULT_WRITE(fi); |
| 207 | unsigned long address = FAULT_ADDRESS(fi); | 207 | unsigned long address = FAULT_ADDRESS(fi); |
| 208 | 208 | ||
| 209 | if (regs) | 209 | if (!is_user && regs) |
| 210 | current->thread.segv_regs = container_of(regs, struct pt_regs, regs); | 210 | current->thread.segv_regs = container_of(regs, struct pt_regs, regs); |
| 211 | 211 | ||
| 212 | if (!is_user && (address >= start_vm) && (address < end_vm)) { | 212 | if (!is_user && (address >= start_vm) && (address < end_vm)) { |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index d531879a4617..908579f2b0ab 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
| @@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid) | |||
| 54 | 54 | ||
| 55 | void wait_stub_done(int pid) | 55 | void wait_stub_done(int pid) |
| 56 | { | 56 | { |
| 57 | int n, status, err, bad_stop = 0; | 57 | int n, status, err; |
| 58 | 58 | ||
| 59 | while (1) { | 59 | while (1) { |
| 60 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); | 60 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); |
| @@ -74,8 +74,6 @@ void wait_stub_done(int pid) | |||
| 74 | 74 | ||
| 75 | if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) | 75 | if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) |
| 76 | return; | 76 | return; |
| 77 | else | ||
| 78 | bad_stop = 1; | ||
| 79 | 77 | ||
| 80 | bad_wait: | 78 | bad_wait: |
| 81 | err = ptrace_dump_regs(pid); | 79 | err = ptrace_dump_regs(pid); |
| @@ -85,10 +83,7 @@ bad_wait: | |||
| 85 | printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " | 83 | printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " |
| 86 | "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, | 84 | "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, |
| 87 | status); | 85 | status); |
| 88 | if (bad_stop) | 86 | fatal_sigsegv(); |
| 89 | kill(pid, SIGKILL); | ||
| 90 | else | ||
| 91 | fatal_sigsegv(); | ||
| 92 | } | 87 | } |
| 93 | 88 | ||
| 94 | extern unsigned long current_stub_stack(void); | 89 | extern unsigned long current_stub_stack(void); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index a8f749ef0fdc..d24887b645dc 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -131,6 +131,7 @@ config X86 | |||
| 131 | select HAVE_CC_STACKPROTECTOR | 131 | select HAVE_CC_STACKPROTECTOR |
| 132 | select GENERIC_CPU_AUTOPROBE | 132 | select GENERIC_CPU_AUTOPROBE |
| 133 | select HAVE_ARCH_AUDITSYSCALL | 133 | select HAVE_ARCH_AUDITSYSCALL |
| 134 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
| 134 | 135 | ||
| 135 | config INSTRUCTION_DECODER | 136 | config INSTRUCTION_DECODER |
| 136 | def_bool y | 137 | def_bool y |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 84c223479e3c..7a6d43a554d7 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
| @@ -91,10 +91,9 @@ bs_die: | |||
| 91 | 91 | ||
| 92 | .section ".bsdata", "a" | 92 | .section ".bsdata", "a" |
| 93 | bugger_off_msg: | 93 | bugger_off_msg: |
| 94 | .ascii "Direct floppy boot is not supported. " | 94 | .ascii "Use a boot loader.\r\n" |
| 95 | .ascii "Use a boot loader program instead.\r\n" | ||
| 96 | .ascii "\n" | 95 | .ascii "\n" |
| 97 | .ascii "Remove disk and press any key to reboot ...\r\n" | 96 | .ascii "Remove disk and press any key to reboot...\r\n" |
| 98 | .byte 0 | 97 | .byte 0 |
| 99 | 98 | ||
| 100 | #ifdef CONFIG_EFI_STUB | 99 | #ifdef CONFIG_EFI_STUB |
| @@ -108,7 +107,7 @@ coff_header: | |||
| 108 | #else | 107 | #else |
| 109 | .word 0x8664 # x86-64 | 108 | .word 0x8664 # x86-64 |
| 110 | #endif | 109 | #endif |
| 111 | .word 3 # nr_sections | 110 | .word 4 # nr_sections |
| 112 | .long 0 # TimeDateStamp | 111 | .long 0 # TimeDateStamp |
| 113 | .long 0 # PointerToSymbolTable | 112 | .long 0 # PointerToSymbolTable |
| 114 | .long 1 # NumberOfSymbols | 113 | .long 1 # NumberOfSymbols |
| @@ -250,6 +249,25 @@ section_table: | |||
| 250 | .word 0 # NumberOfLineNumbers | 249 | .word 0 # NumberOfLineNumbers |
| 251 | .long 0x60500020 # Characteristics (section flags) | 250 | .long 0x60500020 # Characteristics (section flags) |
| 252 | 251 | ||
| 252 | # | ||
| 253 | # The offset & size fields are filled in by build.c. | ||
| 254 | # | ||
| 255 | .ascii ".bss" | ||
| 256 | .byte 0 | ||
| 257 | .byte 0 | ||
| 258 | .byte 0 | ||
| 259 | .byte 0 | ||
| 260 | .long 0 | ||
| 261 | .long 0x0 | ||
| 262 | .long 0 # Size of initialized data | ||
| 263 | # on disk | ||
| 264 | .long 0x0 | ||
| 265 | .long 0 # PointerToRelocations | ||
| 266 | .long 0 # PointerToLineNumbers | ||
| 267 | .word 0 # NumberOfRelocations | ||
| 268 | .word 0 # NumberOfLineNumbers | ||
| 269 | .long 0xc8000080 # Characteristics (section flags) | ||
| 270 | |||
| 253 | #endif /* CONFIG_EFI_STUB */ | 271 | #endif /* CONFIG_EFI_STUB */ |
| 254 | 272 | ||
| 255 | # Kernel attributes; used by setup. This is part 1 of the | 273 | # Kernel attributes; used by setup. This is part 1 of the |
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index 1a2f2121cada..a7661c430cd9 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c | |||
| @@ -143,7 +143,7 @@ static void usage(void) | |||
| 143 | 143 | ||
| 144 | #ifdef CONFIG_EFI_STUB | 144 | #ifdef CONFIG_EFI_STUB |
| 145 | 145 | ||
| 146 | static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) | 146 | static void update_pecoff_section_header_fields(char *section_name, u32 vma, u32 size, u32 datasz, u32 offset) |
| 147 | { | 147 | { |
| 148 | unsigned int pe_header; | 148 | unsigned int pe_header; |
| 149 | unsigned short num_sections; | 149 | unsigned short num_sections; |
| @@ -164,10 +164,10 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz | |||
| 164 | put_unaligned_le32(size, section + 0x8); | 164 | put_unaligned_le32(size, section + 0x8); |
| 165 | 165 | ||
| 166 | /* section header vma field */ | 166 | /* section header vma field */ |
| 167 | put_unaligned_le32(offset, section + 0xc); | 167 | put_unaligned_le32(vma, section + 0xc); |
| 168 | 168 | ||
| 169 | /* section header 'size of initialised data' field */ | 169 | /* section header 'size of initialised data' field */ |
| 170 | put_unaligned_le32(size, section + 0x10); | 170 | put_unaligned_le32(datasz, section + 0x10); |
| 171 | 171 | ||
| 172 | /* section header 'file offset' field */ | 172 | /* section header 'file offset' field */ |
| 173 | put_unaligned_le32(offset, section + 0x14); | 173 | put_unaligned_le32(offset, section + 0x14); |
| @@ -179,6 +179,11 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz | |||
| 179 | } | 179 | } |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) | ||
| 183 | { | ||
| 184 | update_pecoff_section_header_fields(section_name, offset, size, size, offset); | ||
| 185 | } | ||
| 186 | |||
| 182 | static void update_pecoff_setup_and_reloc(unsigned int size) | 187 | static void update_pecoff_setup_and_reloc(unsigned int size) |
| 183 | { | 188 | { |
| 184 | u32 setup_offset = 0x200; | 189 | u32 setup_offset = 0x200; |
| @@ -203,9 +208,6 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) | |||
| 203 | 208 | ||
| 204 | pe_header = get_unaligned_le32(&buf[0x3c]); | 209 | pe_header = get_unaligned_le32(&buf[0x3c]); |
| 205 | 210 | ||
| 206 | /* Size of image */ | ||
| 207 | put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); | ||
| 208 | |||
| 209 | /* | 211 | /* |
| 210 | * Size of code: Subtract the size of the first sector (512 bytes) | 212 | * Size of code: Subtract the size of the first sector (512 bytes) |
| 211 | * which includes the header. | 213 | * which includes the header. |
| @@ -220,6 +222,22 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) | |||
| 220 | update_pecoff_section_header(".text", text_start, text_sz); | 222 | update_pecoff_section_header(".text", text_start, text_sz); |
| 221 | } | 223 | } |
| 222 | 224 | ||
| 225 | static void update_pecoff_bss(unsigned int file_sz, unsigned int init_sz) | ||
| 226 | { | ||
| 227 | unsigned int pe_header; | ||
| 228 | unsigned int bss_sz = init_sz - file_sz; | ||
| 229 | |||
| 230 | pe_header = get_unaligned_le32(&buf[0x3c]); | ||
| 231 | |||
| 232 | /* Size of uninitialized data */ | ||
| 233 | put_unaligned_le32(bss_sz, &buf[pe_header + 0x24]); | ||
| 234 | |||
| 235 | /* Size of image */ | ||
| 236 | put_unaligned_le32(init_sz, &buf[pe_header + 0x50]); | ||
| 237 | |||
| 238 | update_pecoff_section_header_fields(".bss", file_sz, bss_sz, 0, 0); | ||
| 239 | } | ||
| 240 | |||
| 223 | static int reserve_pecoff_reloc_section(int c) | 241 | static int reserve_pecoff_reloc_section(int c) |
| 224 | { | 242 | { |
| 225 | /* Reserve 0x20 bytes for .reloc section */ | 243 | /* Reserve 0x20 bytes for .reloc section */ |
| @@ -259,6 +277,8 @@ static void efi_stub_entry_update(void) | |||
| 259 | static inline void update_pecoff_setup_and_reloc(unsigned int size) {} | 277 | static inline void update_pecoff_setup_and_reloc(unsigned int size) {} |
| 260 | static inline void update_pecoff_text(unsigned int text_start, | 278 | static inline void update_pecoff_text(unsigned int text_start, |
| 261 | unsigned int file_sz) {} | 279 | unsigned int file_sz) {} |
| 280 | static inline void update_pecoff_bss(unsigned int file_sz, | ||
| 281 | unsigned int init_sz) {} | ||
| 262 | static inline void efi_stub_defaults(void) {} | 282 | static inline void efi_stub_defaults(void) {} |
| 263 | static inline void efi_stub_entry_update(void) {} | 283 | static inline void efi_stub_entry_update(void) {} |
| 264 | 284 | ||
| @@ -310,7 +330,7 @@ static void parse_zoffset(char *fname) | |||
| 310 | 330 | ||
| 311 | int main(int argc, char ** argv) | 331 | int main(int argc, char ** argv) |
| 312 | { | 332 | { |
| 313 | unsigned int i, sz, setup_sectors; | 333 | unsigned int i, sz, setup_sectors, init_sz; |
| 314 | int c; | 334 | int c; |
| 315 | u32 sys_size; | 335 | u32 sys_size; |
| 316 | struct stat sb; | 336 | struct stat sb; |
| @@ -376,7 +396,9 @@ int main(int argc, char ** argv) | |||
| 376 | buf[0x1f1] = setup_sectors-1; | 396 | buf[0x1f1] = setup_sectors-1; |
| 377 | put_unaligned_le32(sys_size, &buf[0x1f4]); | 397 | put_unaligned_le32(sys_size, &buf[0x1f4]); |
| 378 | 398 | ||
| 379 | update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); | 399 | update_pecoff_text(setup_sectors * 512, i + (sys_size * 16)); |
| 400 | init_sz = get_unaligned_le32(&buf[0x260]); | ||
| 401 | update_pecoff_bss(i + (sys_size * 16), init_sz); | ||
| 380 | 402 | ||
| 381 | efi_stub_entry_update(); | 403 | efi_stub_entry_update(); |
| 382 | 404 | ||
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index f3a1f04ed4cb..584874451414 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
| @@ -841,7 +841,6 @@ static int apm_do_idle(void) | |||
| 841 | u32 eax; | 841 | u32 eax; |
| 842 | u8 ret = 0; | 842 | u8 ret = 0; |
| 843 | int idled = 0; | 843 | int idled = 0; |
| 844 | int polling; | ||
| 845 | int err = 0; | 844 | int err = 0; |
| 846 | 845 | ||
| 847 | if (!need_resched()) { | 846 | if (!need_resched()) { |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index adb02aa62af5..07846d738bdb 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
| @@ -1382,6 +1382,15 @@ again: | |||
| 1382 | intel_pmu_lbr_read(); | 1382 | intel_pmu_lbr_read(); |
| 1383 | 1383 | ||
| 1384 | /* | 1384 | /* |
| 1385 | * CondChgd bit 63 doesn't mean any overflow status. Ignore | ||
| 1386 | * and clear the bit. | ||
| 1387 | */ | ||
| 1388 | if (__test_and_clear_bit(63, (unsigned long *)&status)) { | ||
| 1389 | if (!status) | ||
| 1390 | goto done; | ||
| 1391 | } | ||
| 1392 | |||
| 1393 | /* | ||
| 1385 | * PEBS overflow sets bit 62 in the global status register | 1394 | * PEBS overflow sets bit 62 in the global status register |
| 1386 | */ | 1395 | */ |
| 1387 | if (__test_and_clear_bit(62, (unsigned long *)&status)) { | 1396 | if (__test_and_clear_bit(62, (unsigned long *)&status)) { |
diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c index 6afbb16e9b79..94d857fb1033 100644 --- a/arch/x86/kernel/espfix_64.c +++ b/arch/x86/kernel/espfix_64.c | |||
| @@ -175,7 +175,7 @@ void init_espfix_ap(void) | |||
| 175 | if (!pud_present(pud)) { | 175 | if (!pud_present(pud)) { |
| 176 | pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP); | 176 | pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP); |
| 177 | pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); | 177 | pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); |
| 178 | paravirt_alloc_pud(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); | 178 | paravirt_alloc_pmd(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); |
| 179 | for (n = 0; n < ESPFIX_PUD_CLONES; n++) | 179 | for (n = 0; n < ESPFIX_PUD_CLONES; n++) |
| 180 | set_pud(&pud_p[n], pud); | 180 | set_pud(&pud_p[n], pud); |
| 181 | } | 181 | } |
| @@ -185,7 +185,7 @@ void init_espfix_ap(void) | |||
| 185 | if (!pmd_present(pmd)) { | 185 | if (!pmd_present(pmd)) { |
| 186 | pte_p = (pte_t *)__get_free_page(PGALLOC_GFP); | 186 | pte_p = (pte_t *)__get_free_page(PGALLOC_GFP); |
| 187 | pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); | 187 | pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); |
| 188 | paravirt_alloc_pmd(&init_mm, __pa(pte_p) >> PAGE_SHIFT); | 188 | paravirt_alloc_pte(&init_mm, __pa(pte_p) >> PAGE_SHIFT); |
| 189 | for (n = 0; n < ESPFIX_PMD_CLONES; n++) | 189 | for (n = 0; n < ESPFIX_PMD_CLONES; n++) |
| 190 | set_pmd(&pmd_p[n], pmd); | 190 | set_pmd(&pmd_p[n], pmd); |
| 191 | } | 191 | } |
| @@ -193,7 +193,6 @@ void init_espfix_ap(void) | |||
| 193 | pte_p = pte_offset_kernel(&pmd, addr); | 193 | pte_p = pte_offset_kernel(&pmd, addr); |
| 194 | stack_page = (void *)__get_free_page(GFP_KERNEL); | 194 | stack_page = (void *)__get_free_page(GFP_KERNEL); |
| 195 | pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); | 195 | pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); |
| 196 | paravirt_alloc_pte(&init_mm, __pa(stack_page) >> PAGE_SHIFT); | ||
| 197 | for (n = 0; n < ESPFIX_PTE_CLONES; n++) | 196 | for (n = 0; n < ESPFIX_PTE_CLONES; n++) |
| 198 | set_pte(&pte_p[n*PTE_STRIDE], pte); | 197 | set_pte(&pte_p[n*PTE_STRIDE], pte); |
| 199 | 198 | ||
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 57e5ce126d5a..ea030319b321 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
| @@ -920,9 +920,9 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
| 920 | tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new); | 920 | tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new); |
| 921 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) | 921 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) |
| 922 | mark_tsc_unstable("cpufreq changes"); | 922 | mark_tsc_unstable("cpufreq changes"); |
| 923 | } | ||
| 924 | 923 | ||
| 925 | set_cyc2ns_scale(tsc_khz, freq->cpu); | 924 | set_cyc2ns_scale(tsc_khz, freq->cpu); |
| 925 | } | ||
| 926 | 926 | ||
| 927 | return 0; | 927 | return 0; |
| 928 | } | 928 | } |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 071c1dfb93f3..350d52a8f781 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -68,7 +68,7 @@ MODULE_AUTHOR("Bruno Ducrot"); | |||
| 68 | MODULE_DESCRIPTION("ACPI Video Driver"); | 68 | MODULE_DESCRIPTION("ACPI Video Driver"); |
| 69 | MODULE_LICENSE("GPL"); | 69 | MODULE_LICENSE("GPL"); |
| 70 | 70 | ||
| 71 | static bool brightness_switch_enabled; | 71 | static bool brightness_switch_enabled = 1; |
| 72 | module_param(brightness_switch_enabled, bool, 0644); | 72 | module_param(brightness_switch_enabled, bool, 0644); |
| 73 | 73 | ||
| 74 | /* | 74 | /* |
| @@ -581,6 +581,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
| 581 | }, | 581 | }, |
| 582 | { | 582 | { |
| 583 | .callback = video_set_use_native_backlight, | 583 | .callback = video_set_use_native_backlight, |
| 584 | .ident = "HP ProBook 4540s", | ||
| 585 | .matches = { | ||
| 586 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 587 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP ProBook 4540s"), | ||
| 588 | }, | ||
| 589 | }, | ||
| 590 | { | ||
| 591 | .callback = video_set_use_native_backlight, | ||
| 584 | .ident = "HP ProBook 2013 models", | 592 | .ident = "HP ProBook 2013 models", |
| 585 | .matches = { | 593 | .matches = { |
| 586 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | 594 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index f98380648cb3..f50dffc0374f 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
| @@ -90,7 +90,6 @@ static const struct usb_device_id ath3k_table[] = { | |||
| 90 | { USB_DEVICE(0x0b05, 0x17d0) }, | 90 | { USB_DEVICE(0x0b05, 0x17d0) }, |
| 91 | { USB_DEVICE(0x0CF3, 0x0036) }, | 91 | { USB_DEVICE(0x0CF3, 0x0036) }, |
| 92 | { USB_DEVICE(0x0CF3, 0x3004) }, | 92 | { USB_DEVICE(0x0CF3, 0x3004) }, |
| 93 | { USB_DEVICE(0x0CF3, 0x3005) }, | ||
| 94 | { USB_DEVICE(0x0CF3, 0x3008) }, | 93 | { USB_DEVICE(0x0CF3, 0x3008) }, |
| 95 | { USB_DEVICE(0x0CF3, 0x311D) }, | 94 | { USB_DEVICE(0x0CF3, 0x311D) }, |
| 96 | { USB_DEVICE(0x0CF3, 0x311E) }, | 95 | { USB_DEVICE(0x0CF3, 0x311E) }, |
| @@ -140,7 +139,6 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
| 140 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
| 141 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, |
| 142 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
| 143 | { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
| 144 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 142 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
| 145 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 143 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
| 146 | { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 }, | 144 | { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a1c80b0c7663..6250fc2fb93a 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -162,7 +162,6 @@ static const struct usb_device_id blacklist_table[] = { | |||
| 162 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, | 162 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
| 163 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, | 163 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, |
| 164 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 164 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
| 165 | { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
| 166 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 165 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
| 167 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 166 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
| 168 | { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, | 167 | { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 04680ead9275..fede8ca7147c 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c | |||
| @@ -406,6 +406,7 @@ static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c) | |||
| 406 | H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) { | 406 | H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) { |
| 407 | BT_ERR("Non-link packet received in non-active state"); | 407 | BT_ERR("Non-link packet received in non-active state"); |
| 408 | h5_reset_rx(h5); | 408 | h5_reset_rx(h5); |
| 409 | return 0; | ||
| 409 | } | 410 | } |
| 410 | 411 | ||
| 411 | h5->rx_func = h5_rx_payload; | 412 | h5->rx_func = h5_rx_payload; |
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 334601cc81cf..c4419ea1ab07 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
| @@ -55,16 +55,41 @@ static DEFINE_MUTEX(rng_mutex); | |||
| 55 | static int data_avail; | 55 | static int data_avail; |
| 56 | static u8 *rng_buffer; | 56 | static u8 *rng_buffer; |
| 57 | 57 | ||
| 58 | static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size, | ||
| 59 | int wait); | ||
| 60 | |||
| 58 | static size_t rng_buffer_size(void) | 61 | static size_t rng_buffer_size(void) |
| 59 | { | 62 | { |
| 60 | return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES; | 63 | return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES; |
| 61 | } | 64 | } |
| 62 | 65 | ||
| 66 | static void add_early_randomness(struct hwrng *rng) | ||
| 67 | { | ||
| 68 | unsigned char bytes[16]; | ||
| 69 | int bytes_read; | ||
| 70 | |||
| 71 | /* | ||
| 72 | * Currently only virtio-rng cannot return data during device | ||
| 73 | * probe, and that's handled in virtio-rng.c itself. If there | ||
| 74 | * are more such devices, this call to rng_get_data can be | ||
| 75 | * made conditional here instead of doing it per-device. | ||
| 76 | */ | ||
| 77 | bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1); | ||
| 78 | if (bytes_read > 0) | ||
| 79 | add_device_randomness(bytes, bytes_read); | ||
| 80 | } | ||
| 81 | |||
| 63 | static inline int hwrng_init(struct hwrng *rng) | 82 | static inline int hwrng_init(struct hwrng *rng) |
| 64 | { | 83 | { |
| 65 | if (!rng->init) | 84 | if (rng->init) { |
| 66 | return 0; | 85 | int ret; |
| 67 | return rng->init(rng); | 86 | |
| 87 | ret = rng->init(rng); | ||
| 88 | if (ret) | ||
| 89 | return ret; | ||
| 90 | } | ||
| 91 | add_early_randomness(rng); | ||
| 92 | return 0; | ||
| 68 | } | 93 | } |
| 69 | 94 | ||
| 70 | static inline void hwrng_cleanup(struct hwrng *rng) | 95 | static inline void hwrng_cleanup(struct hwrng *rng) |
| @@ -304,8 +329,6 @@ int hwrng_register(struct hwrng *rng) | |||
| 304 | { | 329 | { |
| 305 | int err = -EINVAL; | 330 | int err = -EINVAL; |
| 306 | struct hwrng *old_rng, *tmp; | 331 | struct hwrng *old_rng, *tmp; |
| 307 | unsigned char bytes[16]; | ||
| 308 | int bytes_read; | ||
| 309 | 332 | ||
| 310 | if (rng->name == NULL || | 333 | if (rng->name == NULL || |
| 311 | (rng->data_read == NULL && rng->read == NULL)) | 334 | (rng->data_read == NULL && rng->read == NULL)) |
| @@ -347,9 +370,17 @@ int hwrng_register(struct hwrng *rng) | |||
| 347 | INIT_LIST_HEAD(&rng->list); | 370 | INIT_LIST_HEAD(&rng->list); |
| 348 | list_add_tail(&rng->list, &rng_list); | 371 | list_add_tail(&rng->list, &rng_list); |
| 349 | 372 | ||
| 350 | bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1); | 373 | if (old_rng && !rng->init) { |
| 351 | if (bytes_read > 0) | 374 | /* |
| 352 | add_device_randomness(bytes, bytes_read); | 375 | * Use a new device's input to add some randomness to |
| 376 | * the system. If this rng device isn't going to be | ||
| 377 | * used right away, its init function hasn't been | ||
| 378 | * called yet; so only use the randomness from devices | ||
| 379 | * that don't need an init callback. | ||
| 380 | */ | ||
| 381 | add_early_randomness(rng); | ||
| 382 | } | ||
| 383 | |||
| 353 | out_unlock: | 384 | out_unlock: |
| 354 | mutex_unlock(&rng_mutex); | 385 | mutex_unlock(&rng_mutex); |
| 355 | out: | 386 | out: |
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index f3e71501de54..e9b15bc18b4d 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
| @@ -38,6 +38,8 @@ struct virtrng_info { | |||
| 38 | int index; | 38 | int index; |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | static bool probe_done; | ||
| 42 | |||
| 41 | static void random_recv_done(struct virtqueue *vq) | 43 | static void random_recv_done(struct virtqueue *vq) |
| 42 | { | 44 | { |
| 43 | struct virtrng_info *vi = vq->vdev->priv; | 45 | struct virtrng_info *vi = vq->vdev->priv; |
| @@ -67,6 +69,13 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) | |||
| 67 | int ret; | 69 | int ret; |
| 68 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; | 70 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; |
| 69 | 71 | ||
| 72 | /* | ||
| 73 | * Don't ask host for data till we're setup. This call can | ||
| 74 | * happen during hwrng_register(), after commit d9e7972619. | ||
| 75 | */ | ||
| 76 | if (unlikely(!probe_done)) | ||
| 77 | return 0; | ||
| 78 | |||
| 70 | if (!vi->busy) { | 79 | if (!vi->busy) { |
| 71 | vi->busy = true; | 80 | vi->busy = true; |
| 72 | init_completion(&vi->have_data); | 81 | init_completion(&vi->have_data); |
| @@ -137,6 +146,7 @@ static int probe_common(struct virtio_device *vdev) | |||
| 137 | return err; | 146 | return err; |
| 138 | } | 147 | } |
| 139 | 148 | ||
| 149 | probe_done = true; | ||
| 140 | return 0; | 150 | return 0; |
| 141 | } | 151 | } |
| 142 | 152 | ||
diff --git a/drivers/char/random.c b/drivers/char/random.c index 0a7ac0a7b252..71529e196b84 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
| @@ -641,7 +641,7 @@ retry: | |||
| 641 | } while (unlikely(entropy_count < pool_size-2 && pnfrac)); | 641 | } while (unlikely(entropy_count < pool_size-2 && pnfrac)); |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | if (entropy_count < 0) { | 644 | if (unlikely(entropy_count < 0)) { |
| 645 | pr_warn("random: negative entropy/overflow: pool %s count %d\n", | 645 | pr_warn("random: negative entropy/overflow: pool %s count %d\n", |
| 646 | r->name, entropy_count); | 646 | r->name, entropy_count); |
| 647 | WARN_ON(1); | 647 | WARN_ON(1); |
| @@ -981,7 +981,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
| 981 | int reserved) | 981 | int reserved) |
| 982 | { | 982 | { |
| 983 | int entropy_count, orig; | 983 | int entropy_count, orig; |
| 984 | size_t ibytes; | 984 | size_t ibytes, nfrac; |
| 985 | 985 | ||
| 986 | BUG_ON(r->entropy_count > r->poolinfo->poolfracbits); | 986 | BUG_ON(r->entropy_count > r->poolinfo->poolfracbits); |
| 987 | 987 | ||
| @@ -999,7 +999,17 @@ retry: | |||
| 999 | } | 999 | } |
| 1000 | if (ibytes < min) | 1000 | if (ibytes < min) |
| 1001 | ibytes = 0; | 1001 | ibytes = 0; |
| 1002 | if ((entropy_count -= ibytes << (ENTROPY_SHIFT + 3)) < 0) | 1002 | |
| 1003 | if (unlikely(entropy_count < 0)) { | ||
| 1004 | pr_warn("random: negative entropy count: pool %s count %d\n", | ||
| 1005 | r->name, entropy_count); | ||
| 1006 | WARN_ON(1); | ||
| 1007 | entropy_count = 0; | ||
| 1008 | } | ||
| 1009 | nfrac = ibytes << (ENTROPY_SHIFT + 3); | ||
| 1010 | if ((size_t) entropy_count > nfrac) | ||
| 1011 | entropy_count -= nfrac; | ||
| 1012 | else | ||
| 1003 | entropy_count = 0; | 1013 | entropy_count = 0; |
| 1004 | 1014 | ||
| 1005 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) | 1015 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) |
| @@ -1376,6 +1386,7 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | |||
| 1376 | "with %d bits of entropy available\n", | 1386 | "with %d bits of entropy available\n", |
| 1377 | current->comm, nonblocking_pool.entropy_total); | 1387 | current->comm, nonblocking_pool.entropy_total); |
| 1378 | 1388 | ||
| 1389 | nbytes = min_t(size_t, nbytes, INT_MAX >> (ENTROPY_SHIFT + 3)); | ||
| 1379 | ret = extract_entropy_user(&nonblocking_pool, buf, nbytes); | 1390 | ret = extract_entropy_user(&nonblocking_pool, buf, nbytes); |
| 1380 | 1391 | ||
| 1381 | trace_urandom_read(8 * nbytes, ENTROPY_BITS(&nonblocking_pool), | 1392 | trace_urandom_read(8 * nbytes, ENTROPY_BITS(&nonblocking_pool), |
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index ebac67115009..7364a538e056 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
| @@ -104,6 +104,7 @@ config ARM_IMX6Q_CPUFREQ | |||
| 104 | tristate "Freescale i.MX6 cpufreq support" | 104 | tristate "Freescale i.MX6 cpufreq support" |
| 105 | depends on ARCH_MXC | 105 | depends on ARCH_MXC |
| 106 | depends on REGULATOR_ANATOP | 106 | depends on REGULATOR_ANATOP |
| 107 | select PM_OPP | ||
| 107 | help | 108 | help |
| 108 | This adds cpufreq driver support for Freescale i.MX6 series SoCs. | 109 | This adds cpufreq driver support for Freescale i.MX6 series SoCs. |
| 109 | 110 | ||
| @@ -118,7 +119,7 @@ config ARM_INTEGRATOR | |||
| 118 | If in doubt, say Y. | 119 | If in doubt, say Y. |
| 119 | 120 | ||
| 120 | config ARM_KIRKWOOD_CPUFREQ | 121 | config ARM_KIRKWOOD_CPUFREQ |
| 121 | def_bool MACH_KIRKWOOD | 122 | def_bool ARCH_KIRKWOOD || MACH_KIRKWOOD |
| 122 | help | 123 | help |
| 123 | This adds the CPUFreq driver for Marvell Kirkwood | 124 | This adds the CPUFreq driver for Marvell Kirkwood |
| 124 | SoCs. | 125 | SoCs. |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index ee1ae303a07c..86beda9f950b 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
| @@ -152,11 +152,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
| 152 | goto out_put_reg; | 152 | goto out_put_reg; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | ret = of_init_opp_table(cpu_dev); | 155 | /* OPPs might be populated at runtime, don't check for error here */ |
| 156 | if (ret) { | 156 | of_init_opp_table(cpu_dev); |
| 157 | pr_err("failed to init OPP table: %d\n", ret); | ||
| 158 | goto out_put_clk; | ||
| 159 | } | ||
| 160 | 157 | ||
| 161 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); | 158 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); |
| 162 | if (ret) { | 159 | if (ret) { |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 62259d27f03e..6f024852c6fb 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -1153,10 +1153,12 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) | |||
| 1153 | * the creation of a brand new one. So we need to perform this update | 1153 | * the creation of a brand new one. So we need to perform this update |
| 1154 | * by invoking update_policy_cpu(). | 1154 | * by invoking update_policy_cpu(). |
| 1155 | */ | 1155 | */ |
| 1156 | if (recover_policy && cpu != policy->cpu) | 1156 | if (recover_policy && cpu != policy->cpu) { |
| 1157 | update_policy_cpu(policy, cpu); | 1157 | update_policy_cpu(policy, cpu); |
| 1158 | else | 1158 | WARN_ON(kobject_move(&policy->kobj, &dev->kobj)); |
| 1159 | } else { | ||
| 1159 | policy->cpu = cpu; | 1160 | policy->cpu = cpu; |
| 1161 | } | ||
| 1160 | 1162 | ||
| 1161 | cpumask_copy(policy->cpus, cpumask_of(cpu)); | 1163 | cpumask_copy(policy->cpus, cpumask_of(cpu)); |
| 1162 | 1164 | ||
diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c index 546376719d8f..b5befc211172 100644 --- a/drivers/cpufreq/sa1110-cpufreq.c +++ b/drivers/cpufreq/sa1110-cpufreq.c | |||
| @@ -349,7 +349,7 @@ static int __init sa1110_clk_init(void) | |||
| 349 | name = "K4S641632D"; | 349 | name = "K4S641632D"; |
| 350 | if (machine_is_h3100()) | 350 | if (machine_is_h3100()) |
| 351 | name = "KM416S4030CT"; | 351 | name = "KM416S4030CT"; |
| 352 | if (machine_is_jornada720()) | 352 | if (machine_is_jornada720() || machine_is_h3600()) |
| 353 | name = "K4S281632B-1H"; | 353 | name = "K4S281632B-1H"; |
| 354 | if (machine_is_nanoengine()) | 354 | if (machine_is_nanoengine()) |
| 355 | name = "MT48LC8M16A2TG-75"; | 355 | name = "MT48LC8M16A2TG-75"; |
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index 4199849e3758..145974f9662b 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | menu "IEEE 1394 (FireWire) support" | 1 | menu "IEEE 1394 (FireWire) support" |
| 2 | depends on HAS_DMA | ||
| 2 | depends on PCI || COMPILE_TEST | 3 | depends on PCI || COMPILE_TEST |
| 3 | # firewire-core does not depend on PCI but is | 4 | # firewire-core does not depend on PCI but is |
| 4 | # not useful without PCI controller driver | 5 | # not useful without PCI controller driver |
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index eff1a2f22f09..dc79346689e6 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
| @@ -346,6 +346,7 @@ static __initdata struct { | |||
| 346 | 346 | ||
| 347 | struct param_info { | 347 | struct param_info { |
| 348 | int verbose; | 348 | int verbose; |
| 349 | int found; | ||
| 349 | void *params; | 350 | void *params; |
| 350 | }; | 351 | }; |
| 351 | 352 | ||
| @@ -362,16 +363,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
| 362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) | 363 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) |
| 363 | return 0; | 364 | return 0; |
| 364 | 365 | ||
| 365 | pr_info("Getting parameters from FDT:\n"); | ||
| 366 | |||
| 367 | for (i = 0; i < ARRAY_SIZE(dt_params); i++) { | 366 | for (i = 0; i < ARRAY_SIZE(dt_params); i++) { |
| 368 | prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); | 367 | prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); |
| 369 | if (!prop) { | 368 | if (!prop) |
| 370 | pr_err("Can't find %s in device tree!\n", | ||
| 371 | dt_params[i].name); | ||
| 372 | return 0; | 369 | return 0; |
| 373 | } | ||
| 374 | dest = info->params + dt_params[i].offset; | 370 | dest = info->params + dt_params[i].offset; |
| 371 | info->found++; | ||
| 375 | 372 | ||
| 376 | val = of_read_number(prop, len / sizeof(u32)); | 373 | val = of_read_number(prop, len / sizeof(u32)); |
| 377 | 374 | ||
| @@ -390,10 +387,21 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
| 390 | int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose) | 387 | int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose) |
| 391 | { | 388 | { |
| 392 | struct param_info info; | 389 | struct param_info info; |
| 390 | int ret; | ||
| 391 | |||
| 392 | pr_info("Getting EFI parameters from FDT:\n"); | ||
| 393 | 393 | ||
| 394 | info.verbose = verbose; | 394 | info.verbose = verbose; |
| 395 | info.found = 0; | ||
| 395 | info.params = params; | 396 | info.params = params; |
| 396 | 397 | ||
| 397 | return of_scan_flat_dt(fdt_find_uefi_params, &info); | 398 | ret = of_scan_flat_dt(fdt_find_uefi_params, &info); |
| 399 | if (!info.found) | ||
| 400 | pr_info("UEFI not found.\n"); | ||
| 401 | else if (!ret) | ||
| 402 | pr_err("Can't find '%s' in device tree!\n", | ||
| 403 | dt_params[info.found].name); | ||
| 404 | |||
| 405 | return ret; | ||
| 398 | } | 406 | } |
| 399 | #endif /* CONFIG_EFI_PARAMS_FROM_FDT */ | 407 | #endif /* CONFIG_EFI_PARAMS_FROM_FDT */ |
diff --git a/drivers/firmware/efi/fdt.c b/drivers/firmware/efi/fdt.c index 82d774161cc9..507a3df46a5d 100644 --- a/drivers/firmware/efi/fdt.c +++ b/drivers/firmware/efi/fdt.c | |||
| @@ -23,16 +23,6 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
| 23 | u32 fdt_val32; | 23 | u32 fdt_val32; |
| 24 | u64 fdt_val64; | 24 | u64 fdt_val64; |
| 25 | 25 | ||
| 26 | /* | ||
| 27 | * Copy definition of linux_banner here. Since this code is | ||
| 28 | * built as part of the decompressor for ARM v7, pulling | ||
| 29 | * in version.c where linux_banner is defined for the | ||
| 30 | * kernel brings other kernel dependencies with it. | ||
| 31 | */ | ||
| 32 | const char linux_banner[] = | ||
| 33 | "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" | ||
| 34 | LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; | ||
| 35 | |||
| 36 | /* Do some checks on provided FDT, if it exists*/ | 26 | /* Do some checks on provided FDT, if it exists*/ |
| 37 | if (orig_fdt) { | 27 | if (orig_fdt) { |
| 38 | if (fdt_check_header(orig_fdt)) { | 28 | if (fdt_check_header(orig_fdt)) { |
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index fe7c0e211f9a..57adbc90fdad 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c | |||
| @@ -900,8 +900,6 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
| 900 | if (spi_present_mask & (1 << addr)) | 900 | if (spi_present_mask & (1 << addr)) |
| 901 | chips++; | 901 | chips++; |
| 902 | } | 902 | } |
| 903 | if (!chips) | ||
| 904 | return -ENODEV; | ||
| 905 | } else { | 903 | } else { |
| 906 | type = spi_get_device_id(spi)->driver_data; | 904 | type = spi_get_device_id(spi)->driver_data; |
| 907 | pdata = dev_get_platdata(&spi->dev); | 905 | pdata = dev_get_platdata(&spi->dev); |
| @@ -940,10 +938,6 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
| 940 | if (!(spi_present_mask & (1 << addr))) | 938 | if (!(spi_present_mask & (1 << addr))) |
| 941 | continue; | 939 | continue; |
| 942 | chips--; | 940 | chips--; |
| 943 | if (chips < 0) { | ||
| 944 | dev_err(&spi->dev, "FATAL: invalid negative chip id\n"); | ||
| 945 | goto fail; | ||
| 946 | } | ||
| 947 | data->mcp[addr] = &data->chip[chips]; | 941 | data->mcp[addr] = &data->chip[chips]; |
| 948 | status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, | 942 | status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, |
| 949 | 0x40 | (addr << 1), type, base, | 943 | 0x40 | (addr << 1), type, base, |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e27e7804c0b9..f0be855ddf45 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -11673,6 +11673,9 @@ static struct intel_quirk intel_quirks[] = { | |||
| 11673 | 11673 | ||
| 11674 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ | 11674 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ |
| 11675 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, | 11675 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, |
| 11676 | |||
| 11677 | /* HP Chromebook 14 (Celeron 2955U) */ | ||
| 11678 | { 0x0a06, 0x103c, 0x21ed, quirk_backlight_present }, | ||
| 11676 | }; | 11679 | }; |
| 11677 | 11680 | ||
| 11678 | static void intel_init_quirks(struct drm_device *dev) | 11681 | static void intel_init_quirks(struct drm_device *dev) |
| @@ -11911,6 +11914,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) | |||
| 11911 | * ... */ | 11914 | * ... */ |
| 11912 | plane = crtc->plane; | 11915 | plane = crtc->plane; |
| 11913 | crtc->plane = !plane; | 11916 | crtc->plane = !plane; |
| 11917 | crtc->primary_enabled = true; | ||
| 11914 | dev_priv->display.crtc_disable(&crtc->base); | 11918 | dev_priv->display.crtc_disable(&crtc->base); |
| 11915 | crtc->plane = plane; | 11919 | crtc->plane = plane; |
| 11916 | 11920 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 075170d1844f..8a1a4fbc06ac 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -906,8 +906,8 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
| 906 | mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, | 906 | mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, |
| 907 | bpp); | 907 | bpp); |
| 908 | 908 | ||
| 909 | for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) { | 909 | for (clock = min_clock; clock <= max_clock; clock++) { |
| 910 | for (clock = min_clock; clock <= max_clock; clock++) { | 910 | for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) { |
| 911 | link_clock = drm_dp_bw_code_to_link_rate(bws[clock]); | 911 | link_clock = drm_dp_bw_code_to_link_rate(bws[clock]); |
| 912 | link_avail = intel_dp_max_data_rate(link_clock, | 912 | link_avail = intel_dp_max_data_rate(link_clock, |
| 913 | lane_count); | 913 | lane_count); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 23126023aeba..5e5a72fca5fb 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
| @@ -111,6 +111,13 @@ static void intel_lvds_get_config(struct intel_encoder *encoder, | |||
| 111 | 111 | ||
| 112 | pipe_config->adjusted_mode.flags |= flags; | 112 | pipe_config->adjusted_mode.flags |= flags; |
| 113 | 113 | ||
| 114 | /* gen2/3 store dither state in pfit control, needs to match */ | ||
| 115 | if (INTEL_INFO(dev)->gen < 4) { | ||
| 116 | tmp = I915_READ(PFIT_CONTROL); | ||
| 117 | |||
| 118 | pipe_config->gmch_pfit.control |= tmp & PANEL_8TO6_DITHER_ENABLE; | ||
| 119 | } | ||
| 120 | |||
| 114 | dotclock = pipe_config->port_clock; | 121 | dotclock = pipe_config->port_clock; |
| 115 | 122 | ||
| 116 | if (HAS_PCH_SPLIT(dev_priv->dev)) | 123 | if (HAS_PCH_SPLIT(dev_priv->dev)) |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 628cd8938274..12b02fe1d0ae 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
| @@ -361,16 +361,16 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, | |||
| 361 | pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | | 361 | pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | |
| 362 | PFIT_FILTER_FUZZY); | 362 | PFIT_FILTER_FUZZY); |
| 363 | 363 | ||
| 364 | /* Make sure pre-965 set dither correctly for 18bpp panels. */ | ||
| 365 | if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18) | ||
| 366 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
| 367 | |||
| 368 | out: | 364 | out: |
| 369 | if ((pfit_control & PFIT_ENABLE) == 0) { | 365 | if ((pfit_control & PFIT_ENABLE) == 0) { |
| 370 | pfit_control = 0; | 366 | pfit_control = 0; |
| 371 | pfit_pgm_ratios = 0; | 367 | pfit_pgm_ratios = 0; |
| 372 | } | 368 | } |
| 373 | 369 | ||
| 370 | /* Make sure pre-965 set dither correctly for 18bpp panels. */ | ||
| 371 | if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18) | ||
| 372 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
| 373 | |||
| 374 | pipe_config->gmch_pfit.control = pfit_control; | 374 | pipe_config->gmch_pfit.control = pfit_control; |
| 375 | pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; | 375 | pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; |
| 376 | pipe_config->gmch_pfit.lvds_border_bits = border; | 376 | pipe_config->gmch_pfit.lvds_border_bits = border; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c index cfde9eb44ad0..6212537b90c5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | |||
| @@ -192,11 +192,11 @@ alarm_timer_callback(struct nouveau_alarm *alarm) | |||
| 192 | nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown, | 192 | nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown, |
| 193 | NOUVEAU_THERM_THRS_SHUTDOWN); | 193 | NOUVEAU_THERM_THRS_SHUTDOWN); |
| 194 | 194 | ||
| 195 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); | ||
| 196 | |||
| 195 | /* schedule the next poll in one second */ | 197 | /* schedule the next poll in one second */ |
| 196 | if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head)) | 198 | if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head)) |
| 197 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); | 199 | ptimer->alarm(ptimer, 1000000000ULL, alarm); |
| 198 | |||
| 199 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); | ||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | void | 202 | void |
diff --git a/drivers/gpu/drm/qxl/qxl_irq.c b/drivers/gpu/drm/qxl/qxl_irq.c index 34d6a85e9023..0bf1e20c6e44 100644 --- a/drivers/gpu/drm/qxl/qxl_irq.c +++ b/drivers/gpu/drm/qxl/qxl_irq.c | |||
| @@ -33,6 +33,9 @@ irqreturn_t qxl_irq_handler(int irq, void *arg) | |||
| 33 | 33 | ||
| 34 | pending = xchg(&qdev->ram_header->int_pending, 0); | 34 | pending = xchg(&qdev->ram_header->int_pending, 0); |
| 35 | 35 | ||
| 36 | if (!pending) | ||
| 37 | return IRQ_NONE; | ||
| 38 | |||
| 36 | atomic_inc(&qdev->irq_received); | 39 | atomic_inc(&qdev->irq_received); |
| 37 | 40 | ||
| 38 | if (pending & QXL_INTERRUPT_DISPLAY) { | 41 | if (pending & QXL_INTERRUPT_DISPLAY) { |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index a03c73411a56..30d242b25078 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -1414,8 +1414,8 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1414 | tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; | 1414 | tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; |
| 1415 | WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | 1415 | WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); |
| 1416 | 1416 | ||
| 1417 | /* set pageflip to happen anywhere in vblank interval */ | 1417 | /* set pageflip to happen only at start of vblank interval (front porch) */ |
| 1418 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | 1418 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 3); |
| 1419 | 1419 | ||
| 1420 | if (!atomic && fb && fb != crtc->primary->fb) { | 1420 | if (!atomic && fb && fb != crtc->primary->fb) { |
| 1421 | radeon_fb = to_radeon_framebuffer(fb); | 1421 | radeon_fb = to_radeon_framebuffer(fb); |
| @@ -1614,8 +1614,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1614 | tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; | 1614 | tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; |
| 1615 | WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | 1615 | WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); |
| 1616 | 1616 | ||
| 1617 | /* set pageflip to happen anywhere in vblank interval */ | 1617 | /* set pageflip to happen only at start of vblank interval (front porch) */ |
| 1618 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | 1618 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 3); |
| 1619 | 1619 | ||
| 1620 | if (!atomic && fb && fb != crtc->primary->fb) { | 1620 | if (!atomic && fb && fb != crtc->primary->fb) { |
| 1621 | radeon_fb = to_radeon_framebuffer(fb); | 1621 | radeon_fb = to_radeon_framebuffer(fb); |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 2b2908440644..7d68203a3737 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
| @@ -183,7 +183,6 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
| 183 | struct backlight_properties props; | 183 | struct backlight_properties props; |
| 184 | struct radeon_backlight_privdata *pdata; | 184 | struct radeon_backlight_privdata *pdata; |
| 185 | struct radeon_encoder_atom_dig *dig; | 185 | struct radeon_encoder_atom_dig *dig; |
| 186 | u8 backlight_level; | ||
| 187 | char bl_name[16]; | 186 | char bl_name[16]; |
| 188 | 187 | ||
| 189 | /* Mac laptops with multiple GPUs use the gmux driver for backlight | 188 | /* Mac laptops with multiple GPUs use the gmux driver for backlight |
| @@ -222,12 +221,17 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
| 222 | 221 | ||
| 223 | pdata->encoder = radeon_encoder; | 222 | pdata->encoder = radeon_encoder; |
| 224 | 223 | ||
| 225 | backlight_level = radeon_atom_get_backlight_level_from_reg(rdev); | ||
| 226 | |||
| 227 | dig = radeon_encoder->enc_priv; | 224 | dig = radeon_encoder->enc_priv; |
| 228 | dig->bl_dev = bd; | 225 | dig->bl_dev = bd; |
| 229 | 226 | ||
| 230 | bd->props.brightness = radeon_atom_backlight_get_brightness(bd); | 227 | bd->props.brightness = radeon_atom_backlight_get_brightness(bd); |
| 228 | /* Set a reasonable default here if the level is 0 otherwise | ||
| 229 | * fbdev will attempt to turn the backlight on after console | ||
| 230 | * unblanking and it will try and restore 0 which turns the backlight | ||
| 231 | * off again. | ||
| 232 | */ | ||
| 233 | if (bd->props.brightness == 0) | ||
| 234 | bd->props.brightness = RADEON_MAX_BL_LEVEL; | ||
| 231 | bd->props.power = FB_BLANK_UNBLANK; | 235 | bd->props.power = FB_BLANK_UNBLANK; |
| 232 | backlight_update_status(bd); | 236 | backlight_update_status(bd); |
| 233 | 237 | ||
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index f7ece0ff431b..250bac3935a4 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -2642,8 +2642,9 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s | |||
| 2642 | for (i = 0; i < rdev->num_crtc; i++) { | 2642 | for (i = 0; i < rdev->num_crtc; i++) { |
| 2643 | if (save->crtc_enabled[i]) { | 2643 | if (save->crtc_enabled[i]) { |
| 2644 | tmp = RREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i]); | 2644 | tmp = RREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i]); |
| 2645 | if ((tmp & 0x3) != 0) { | 2645 | if ((tmp & 0x7) != 3) { |
| 2646 | tmp &= ~0x3; | 2646 | tmp &= ~0x7; |
| 2647 | tmp |= 0x3; | ||
| 2647 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); | 2648 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); |
| 2648 | } | 2649 | } |
| 2649 | tmp = RREG32(EVERGREEN_GRPH_UPDATE + crtc_offsets[i]); | 2650 | tmp = RREG32(EVERGREEN_GRPH_UPDATE + crtc_offsets[i]); |
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index 333d143fca2c..23bff590fb6e 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h | |||
| @@ -239,7 +239,6 @@ | |||
| 239 | # define EVERGREEN_CRTC_V_BLANK (1 << 0) | 239 | # define EVERGREEN_CRTC_V_BLANK (1 << 0) |
| 240 | #define EVERGREEN_CRTC_STATUS_POSITION 0x6e90 | 240 | #define EVERGREEN_CRTC_STATUS_POSITION 0x6e90 |
| 241 | #define EVERGREEN_CRTC_STATUS_HV_COUNT 0x6ea0 | 241 | #define EVERGREEN_CRTC_STATUS_HV_COUNT 0x6ea0 |
| 242 | #define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 | ||
| 243 | #define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 | 242 | #define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 |
| 244 | #define EVERGREEN_MASTER_UPDATE_LOCK 0x6ef4 | 243 | #define EVERGREEN_MASTER_UPDATE_LOCK 0x6ef4 |
| 245 | #define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 | 244 | #define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 29d9cc04c04e..b7204500a9a6 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -684,10 +684,9 @@ struct radeon_flip_work { | |||
| 684 | struct work_struct unpin_work; | 684 | struct work_struct unpin_work; |
| 685 | struct radeon_device *rdev; | 685 | struct radeon_device *rdev; |
| 686 | int crtc_id; | 686 | int crtc_id; |
| 687 | struct drm_framebuffer *fb; | 687 | uint64_t base; |
| 688 | struct drm_pending_vblank_event *event; | 688 | struct drm_pending_vblank_event *event; |
| 689 | struct radeon_bo *old_rbo; | 689 | struct radeon_bo *old_rbo; |
| 690 | struct radeon_bo *new_rbo; | ||
| 691 | struct radeon_fence *fence; | 690 | struct radeon_fence *fence; |
| 692 | }; | 691 | }; |
| 693 | 692 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 13896edcf0b6..bf25061c8ac4 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -366,7 +366,6 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
| 366 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 366 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
| 367 | 367 | ||
| 368 | drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id); | 368 | drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id); |
| 369 | radeon_fence_unref(&work->fence); | ||
| 370 | radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id); | 369 | radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id); |
| 371 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); | 370 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); |
| 372 | } | 371 | } |
| @@ -386,51 +385,108 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
| 386 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[work->crtc_id]; | 385 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[work->crtc_id]; |
| 387 | 386 | ||
| 388 | struct drm_crtc *crtc = &radeon_crtc->base; | 387 | struct drm_crtc *crtc = &radeon_crtc->base; |
| 389 | struct drm_framebuffer *fb = work->fb; | ||
| 390 | |||
| 391 | uint32_t tiling_flags, pitch_pixels; | ||
| 392 | uint64_t base; | ||
| 393 | |||
| 394 | unsigned long flags; | 388 | unsigned long flags; |
| 395 | int r; | 389 | int r; |
| 396 | 390 | ||
| 397 | down_read(&rdev->exclusive_lock); | 391 | down_read(&rdev->exclusive_lock); |
| 398 | while (work->fence) { | 392 | if (work->fence) { |
| 399 | r = radeon_fence_wait(work->fence, false); | 393 | r = radeon_fence_wait(work->fence, false); |
| 400 | if (r == -EDEADLK) { | 394 | if (r == -EDEADLK) { |
| 401 | up_read(&rdev->exclusive_lock); | 395 | up_read(&rdev->exclusive_lock); |
| 402 | r = radeon_gpu_reset(rdev); | 396 | r = radeon_gpu_reset(rdev); |
| 403 | down_read(&rdev->exclusive_lock); | 397 | down_read(&rdev->exclusive_lock); |
| 404 | } | 398 | } |
| 399 | if (r) | ||
| 400 | DRM_ERROR("failed to wait on page flip fence (%d)!\n", r); | ||
| 405 | 401 | ||
| 406 | if (r) { | 402 | /* We continue with the page flip even if we failed to wait on |
| 407 | DRM_ERROR("failed to wait on page flip fence (%d)!\n", | 403 | * the fence, otherwise the DRM core and userspace will be |
| 408 | r); | 404 | * confused about which BO the CRTC is scanning out |
| 409 | goto cleanup; | 405 | */ |
| 410 | } else | 406 | |
| 411 | radeon_fence_unref(&work->fence); | 407 | radeon_fence_unref(&work->fence); |
| 412 | } | 408 | } |
| 413 | 409 | ||
| 410 | /* We borrow the event spin lock for protecting flip_status */ | ||
| 411 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | ||
| 412 | |||
| 413 | /* set the proper interrupt */ | ||
| 414 | radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id); | ||
| 415 | |||
| 416 | /* do the flip (mmio) */ | ||
| 417 | radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base); | ||
| 418 | |||
| 419 | radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED; | ||
| 420 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | ||
| 421 | up_read(&rdev->exclusive_lock); | ||
| 422 | } | ||
| 423 | |||
| 424 | static int radeon_crtc_page_flip(struct drm_crtc *crtc, | ||
| 425 | struct drm_framebuffer *fb, | ||
| 426 | struct drm_pending_vblank_event *event, | ||
| 427 | uint32_t page_flip_flags) | ||
| 428 | { | ||
| 429 | struct drm_device *dev = crtc->dev; | ||
| 430 | struct radeon_device *rdev = dev->dev_private; | ||
| 431 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 432 | struct radeon_framebuffer *old_radeon_fb; | ||
| 433 | struct radeon_framebuffer *new_radeon_fb; | ||
| 434 | struct drm_gem_object *obj; | ||
| 435 | struct radeon_flip_work *work; | ||
| 436 | struct radeon_bo *new_rbo; | ||
| 437 | uint32_t tiling_flags, pitch_pixels; | ||
| 438 | uint64_t base; | ||
| 439 | unsigned long flags; | ||
| 440 | int r; | ||
| 441 | |||
| 442 | work = kzalloc(sizeof *work, GFP_KERNEL); | ||
| 443 | if (work == NULL) | ||
| 444 | return -ENOMEM; | ||
| 445 | |||
| 446 | INIT_WORK(&work->flip_work, radeon_flip_work_func); | ||
| 447 | INIT_WORK(&work->unpin_work, radeon_unpin_work_func); | ||
| 448 | |||
| 449 | work->rdev = rdev; | ||
| 450 | work->crtc_id = radeon_crtc->crtc_id; | ||
| 451 | work->event = event; | ||
| 452 | |||
| 453 | /* schedule unpin of the old buffer */ | ||
| 454 | old_radeon_fb = to_radeon_framebuffer(crtc->primary->fb); | ||
| 455 | obj = old_radeon_fb->obj; | ||
| 456 | |||
| 457 | /* take a reference to the old object */ | ||
| 458 | drm_gem_object_reference(obj); | ||
| 459 | work->old_rbo = gem_to_radeon_bo(obj); | ||
| 460 | |||
| 461 | new_radeon_fb = to_radeon_framebuffer(fb); | ||
| 462 | obj = new_radeon_fb->obj; | ||
| 463 | new_rbo = gem_to_radeon_bo(obj); | ||
| 464 | |||
| 465 | spin_lock(&new_rbo->tbo.bdev->fence_lock); | ||
| 466 | if (new_rbo->tbo.sync_obj) | ||
| 467 | work->fence = radeon_fence_ref(new_rbo->tbo.sync_obj); | ||
| 468 | spin_unlock(&new_rbo->tbo.bdev->fence_lock); | ||
| 469 | |||
| 414 | /* pin the new buffer */ | 470 | /* pin the new buffer */ |
| 415 | DRM_DEBUG_DRIVER("flip-ioctl() cur_fbo = %p, cur_bbo = %p\n", | 471 | DRM_DEBUG_DRIVER("flip-ioctl() cur_rbo = %p, new_rbo = %p\n", |
| 416 | work->old_rbo, work->new_rbo); | 472 | work->old_rbo, new_rbo); |
| 417 | 473 | ||
| 418 | r = radeon_bo_reserve(work->new_rbo, false); | 474 | r = radeon_bo_reserve(new_rbo, false); |
| 419 | if (unlikely(r != 0)) { | 475 | if (unlikely(r != 0)) { |
| 420 | DRM_ERROR("failed to reserve new rbo buffer before flip\n"); | 476 | DRM_ERROR("failed to reserve new rbo buffer before flip\n"); |
| 421 | goto cleanup; | 477 | goto cleanup; |
| 422 | } | 478 | } |
| 423 | /* Only 27 bit offset for legacy CRTC */ | 479 | /* Only 27 bit offset for legacy CRTC */ |
| 424 | r = radeon_bo_pin_restricted(work->new_rbo, RADEON_GEM_DOMAIN_VRAM, | 480 | r = radeon_bo_pin_restricted(new_rbo, RADEON_GEM_DOMAIN_VRAM, |
| 425 | ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, &base); | 481 | ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, &base); |
| 426 | if (unlikely(r != 0)) { | 482 | if (unlikely(r != 0)) { |
| 427 | radeon_bo_unreserve(work->new_rbo); | 483 | radeon_bo_unreserve(new_rbo); |
| 428 | r = -EINVAL; | 484 | r = -EINVAL; |
| 429 | DRM_ERROR("failed to pin new rbo buffer before flip\n"); | 485 | DRM_ERROR("failed to pin new rbo buffer before flip\n"); |
| 430 | goto cleanup; | 486 | goto cleanup; |
| 431 | } | 487 | } |
| 432 | radeon_bo_get_tiling_flags(work->new_rbo, &tiling_flags, NULL); | 488 | radeon_bo_get_tiling_flags(new_rbo, &tiling_flags, NULL); |
| 433 | radeon_bo_unreserve(work->new_rbo); | 489 | radeon_bo_unreserve(new_rbo); |
| 434 | 490 | ||
| 435 | if (!ASIC_IS_AVIVO(rdev)) { | 491 | if (!ASIC_IS_AVIVO(rdev)) { |
| 436 | /* crtc offset is from display base addr not FB location */ | 492 | /* crtc offset is from display base addr not FB location */ |
| @@ -467,6 +523,7 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
| 467 | } | 523 | } |
| 468 | base &= ~7; | 524 | base &= ~7; |
| 469 | } | 525 | } |
| 526 | work->base = base; | ||
| 470 | 527 | ||
| 471 | r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id); | 528 | r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id); |
| 472 | if (r) { | 529 | if (r) { |
| @@ -477,100 +534,42 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
| 477 | /* We borrow the event spin lock for protecting flip_work */ | 534 | /* We borrow the event spin lock for protecting flip_work */ |
| 478 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 535 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
| 479 | 536 | ||
| 480 | /* set the proper interrupt */ | 537 | if (radeon_crtc->flip_status != RADEON_FLIP_NONE) { |
| 481 | radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id); | 538 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
| 539 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | ||
| 540 | r = -EBUSY; | ||
| 541 | goto vblank_cleanup; | ||
| 542 | } | ||
| 543 | radeon_crtc->flip_status = RADEON_FLIP_PENDING; | ||
| 544 | radeon_crtc->flip_work = work; | ||
| 482 | 545 | ||
| 483 | /* do the flip (mmio) */ | 546 | /* update crtc fb */ |
| 484 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); | 547 | crtc->primary->fb = fb; |
| 485 | 548 | ||
| 486 | radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED; | ||
| 487 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 549 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
| 488 | up_read(&rdev->exclusive_lock); | ||
| 489 | 550 | ||
| 490 | return; | 551 | queue_work(radeon_crtc->flip_queue, &work->flip_work); |
| 552 | return 0; | ||
| 553 | |||
| 554 | vblank_cleanup: | ||
| 555 | drm_vblank_put(crtc->dev, radeon_crtc->crtc_id); | ||
| 491 | 556 | ||
| 492 | pflip_cleanup: | 557 | pflip_cleanup: |
| 493 | if (unlikely(radeon_bo_reserve(work->new_rbo, false) != 0)) { | 558 | if (unlikely(radeon_bo_reserve(new_rbo, false) != 0)) { |
| 494 | DRM_ERROR("failed to reserve new rbo in error path\n"); | 559 | DRM_ERROR("failed to reserve new rbo in error path\n"); |
| 495 | goto cleanup; | 560 | goto cleanup; |
| 496 | } | 561 | } |
| 497 | if (unlikely(radeon_bo_unpin(work->new_rbo) != 0)) { | 562 | if (unlikely(radeon_bo_unpin(new_rbo) != 0)) { |
| 498 | DRM_ERROR("failed to unpin new rbo in error path\n"); | 563 | DRM_ERROR("failed to unpin new rbo in error path\n"); |
| 499 | } | 564 | } |
| 500 | radeon_bo_unreserve(work->new_rbo); | 565 | radeon_bo_unreserve(new_rbo); |
| 501 | 566 | ||
| 502 | cleanup: | 567 | cleanup: |
| 503 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 568 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); |
| 504 | radeon_fence_unref(&work->fence); | 569 | radeon_fence_unref(&work->fence); |
| 505 | kfree(work); | 570 | kfree(work); |
| 506 | up_read(&rdev->exclusive_lock); | ||
| 507 | } | ||
| 508 | |||
| 509 | static int radeon_crtc_page_flip(struct drm_crtc *crtc, | ||
| 510 | struct drm_framebuffer *fb, | ||
| 511 | struct drm_pending_vblank_event *event, | ||
| 512 | uint32_t page_flip_flags) | ||
| 513 | { | ||
| 514 | struct drm_device *dev = crtc->dev; | ||
| 515 | struct radeon_device *rdev = dev->dev_private; | ||
| 516 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 517 | struct radeon_framebuffer *old_radeon_fb; | ||
| 518 | struct radeon_framebuffer *new_radeon_fb; | ||
| 519 | struct drm_gem_object *obj; | ||
| 520 | struct radeon_flip_work *work; | ||
| 521 | unsigned long flags; | ||
| 522 | |||
| 523 | work = kzalloc(sizeof *work, GFP_KERNEL); | ||
| 524 | if (work == NULL) | ||
| 525 | return -ENOMEM; | ||
| 526 | |||
| 527 | INIT_WORK(&work->flip_work, radeon_flip_work_func); | ||
| 528 | INIT_WORK(&work->unpin_work, radeon_unpin_work_func); | ||
| 529 | |||
| 530 | work->rdev = rdev; | ||
| 531 | work->crtc_id = radeon_crtc->crtc_id; | ||
| 532 | work->fb = fb; | ||
| 533 | work->event = event; | ||
| 534 | |||
| 535 | /* schedule unpin of the old buffer */ | ||
| 536 | old_radeon_fb = to_radeon_framebuffer(crtc->primary->fb); | ||
| 537 | obj = old_radeon_fb->obj; | ||
| 538 | |||
| 539 | /* take a reference to the old object */ | ||
| 540 | drm_gem_object_reference(obj); | ||
| 541 | work->old_rbo = gem_to_radeon_bo(obj); | ||
| 542 | |||
| 543 | new_radeon_fb = to_radeon_framebuffer(fb); | ||
| 544 | obj = new_radeon_fb->obj; | ||
| 545 | work->new_rbo = gem_to_radeon_bo(obj); | ||
| 546 | |||
| 547 | spin_lock(&work->new_rbo->tbo.bdev->fence_lock); | ||
| 548 | if (work->new_rbo->tbo.sync_obj) | ||
| 549 | work->fence = radeon_fence_ref(work->new_rbo->tbo.sync_obj); | ||
| 550 | spin_unlock(&work->new_rbo->tbo.bdev->fence_lock); | ||
| 551 | |||
| 552 | /* We borrow the event spin lock for protecting flip_work */ | ||
| 553 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | ||
| 554 | 571 | ||
| 555 | if (radeon_crtc->flip_status != RADEON_FLIP_NONE) { | 572 | return r; |
| 556 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | ||
| 557 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | ||
| 558 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | ||
| 559 | radeon_fence_unref(&work->fence); | ||
| 560 | kfree(work); | ||
| 561 | return -EBUSY; | ||
| 562 | } | ||
| 563 | radeon_crtc->flip_status = RADEON_FLIP_PENDING; | ||
| 564 | radeon_crtc->flip_work = work; | ||
| 565 | |||
| 566 | /* update crtc fb */ | ||
| 567 | crtc->primary->fb = fb; | ||
| 568 | |||
| 569 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | ||
| 570 | |||
| 571 | queue_work(radeon_crtc->flip_queue, &work->flip_work); | ||
| 572 | |||
| 573 | return 0; | ||
| 574 | } | 573 | } |
| 575 | 574 | ||
| 576 | static int | 575 | static int |
| @@ -830,6 +829,10 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
| 830 | struct radeon_device *rdev = dev->dev_private; | 829 | struct radeon_device *rdev = dev->dev_private; |
| 831 | int ret = 0; | 830 | int ret = 0; |
| 832 | 831 | ||
| 832 | /* don't leak the edid if we already fetched it in detect() */ | ||
| 833 | if (radeon_connector->edid) | ||
| 834 | goto got_edid; | ||
| 835 | |||
| 833 | /* on hw with routers, select right port */ | 836 | /* on hw with routers, select right port */ |
| 834 | if (radeon_connector->router.ddc_valid) | 837 | if (radeon_connector->router.ddc_valid) |
| 835 | radeon_router_select_ddc_port(radeon_connector); | 838 | radeon_router_select_ddc_port(radeon_connector); |
| @@ -868,6 +871,7 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
| 868 | radeon_connector->edid = radeon_bios_get_hardcoded_edid(rdev); | 871 | radeon_connector->edid = radeon_bios_get_hardcoded_edid(rdev); |
| 869 | } | 872 | } |
| 870 | if (radeon_connector->edid) { | 873 | if (radeon_connector->edid) { |
| 874 | got_edid: | ||
| 871 | drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid); | 875 | drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid); |
| 872 | ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid); | 876 | ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid); |
| 873 | drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid); | 877 | drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid); |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 237dd29d9f1c..3e21e869015f 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
| @@ -406,8 +406,9 @@ void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) | |||
| 406 | for (i = 0; i < rdev->num_crtc; i++) { | 406 | for (i = 0; i < rdev->num_crtc; i++) { |
| 407 | if (save->crtc_enabled[i]) { | 407 | if (save->crtc_enabled[i]) { |
| 408 | tmp = RREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i]); | 408 | tmp = RREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i]); |
| 409 | if ((tmp & 0x3) != 0) { | 409 | if ((tmp & 0x7) != 3) { |
| 410 | tmp &= ~0x3; | 410 | tmp &= ~0x7; |
| 411 | tmp |= 0x3; | ||
| 411 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); | 412 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); |
| 412 | } | 413 | } |
| 413 | tmp = RREG32(AVIVO_D1GRPH_UPDATE + crtc_offsets[i]); | 414 | tmp = RREG32(AVIVO_D1GRPH_UPDATE + crtc_offsets[i]); |
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 0f4dea5ccf17..9ee3913850d6 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c | |||
| @@ -515,7 +515,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
| 515 | return -EINVAL; | 515 | return -EINVAL; |
| 516 | 516 | ||
| 517 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 517 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
| 518 | temp = clamp_val(temp, 0, 255); | 518 | temp = clamp_val(temp, -128, 127); |
| 519 | 519 | ||
| 520 | mutex_lock(&data->lock); | 520 | mutex_lock(&data->lock); |
| 521 | data->temp_min[attr->index] = temp; | 521 | data->temp_min[attr->index] = temp; |
| @@ -549,7 +549,7 @@ static ssize_t set_temp_max(struct device *dev, | |||
| 549 | return -EINVAL; | 549 | return -EINVAL; |
| 550 | 550 | ||
| 551 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 551 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
| 552 | temp = clamp_val(temp, 0, 255); | 552 | temp = clamp_val(temp, -128, 127); |
| 553 | 553 | ||
| 554 | mutex_lock(&data->lock); | 554 | mutex_lock(&data->lock); |
| 555 | data->temp_max[attr->index] = temp; | 555 | data->temp_max[attr->index] = temp; |
| @@ -826,7 +826,7 @@ static ssize_t set_pwm_tmin(struct device *dev, | |||
| 826 | return -EINVAL; | 826 | return -EINVAL; |
| 827 | 827 | ||
| 828 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 828 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
| 829 | temp = clamp_val(temp, 0, 255); | 829 | temp = clamp_val(temp, -128, 127); |
| 830 | 830 | ||
| 831 | mutex_lock(&data->lock); | 831 | mutex_lock(&data->lock); |
| 832 | data->pwm_tmin[attr->index] = temp; | 832 | data->pwm_tmin[attr->index] = temp; |
diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c index afd31042b452..d14ab3c45daa 100644 --- a/drivers/hwmon/da9052-hwmon.c +++ b/drivers/hwmon/da9052-hwmon.c | |||
| @@ -194,7 +194,7 @@ static ssize_t da9052_hwmon_show_name(struct device *dev, | |||
| 194 | struct device_attribute *devattr, | 194 | struct device_attribute *devattr, |
| 195 | char *buf) | 195 | char *buf) |
| 196 | { | 196 | { |
| 197 | return sprintf(buf, "da9052-hwmon\n"); | 197 | return sprintf(buf, "da9052\n"); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | static ssize_t show_label(struct device *dev, | 200 | static ssize_t show_label(struct device *dev, |
diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c index 73b3865f1207..35eb7738d711 100644 --- a/drivers/hwmon/da9055-hwmon.c +++ b/drivers/hwmon/da9055-hwmon.c | |||
| @@ -204,7 +204,7 @@ static ssize_t da9055_hwmon_show_name(struct device *dev, | |||
| 204 | struct device_attribute *devattr, | 204 | struct device_attribute *devattr, |
| 205 | char *buf) | 205 | char *buf) |
| 206 | { | 206 | { |
| 207 | return sprintf(buf, "da9055-hwmon\n"); | 207 | return sprintf(buf, "da9055\n"); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | static ssize_t show_label(struct device *dev, | 210 | static ssize_t show_label(struct device *dev, |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 5e153f6d4b48..768a0fb67dd6 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
| @@ -432,8 +432,17 @@ static void arp_failure_discard(void *handle, struct sk_buff *skb) | |||
| 432 | */ | 432 | */ |
| 433 | static void act_open_req_arp_failure(void *handle, struct sk_buff *skb) | 433 | static void act_open_req_arp_failure(void *handle, struct sk_buff *skb) |
| 434 | { | 434 | { |
| 435 | struct c4iw_ep *ep = handle; | ||
| 436 | |||
| 435 | printk(KERN_ERR MOD "ARP failure duing connect\n"); | 437 | printk(KERN_ERR MOD "ARP failure duing connect\n"); |
| 436 | kfree_skb(skb); | 438 | kfree_skb(skb); |
| 439 | connect_reply_upcall(ep, -EHOSTUNREACH); | ||
| 440 | state_set(&ep->com, DEAD); | ||
| 441 | remove_handle(ep->com.dev, &ep->com.dev->atid_idr, ep->atid); | ||
| 442 | cxgb4_free_atid(ep->com.dev->rdev.lldi.tids, ep->atid); | ||
| 443 | dst_release(ep->dst); | ||
| 444 | cxgb4_l2t_release(ep->l2t); | ||
| 445 | c4iw_put_ep(&ep->com); | ||
| 437 | } | 446 | } |
| 438 | 447 | ||
| 439 | /* | 448 | /* |
| @@ -658,7 +667,7 @@ static int send_connect(struct c4iw_ep *ep) | |||
| 658 | opt2 |= T5_OPT_2_VALID; | 667 | opt2 |= T5_OPT_2_VALID; |
| 659 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); | 668 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); |
| 660 | } | 669 | } |
| 661 | t4_set_arp_err_handler(skb, NULL, act_open_req_arp_failure); | 670 | t4_set_arp_err_handler(skb, ep, act_open_req_arp_failure); |
| 662 | 671 | ||
| 663 | if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { | 672 | if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { |
| 664 | if (ep->com.remote_addr.ss_family == AF_INET) { | 673 | if (ep->com.remote_addr.ss_family == AF_INET) { |
| @@ -2180,7 +2189,6 @@ static void reject_cr(struct c4iw_dev *dev, u32 hwtid, struct sk_buff *skb) | |||
| 2180 | PDBG("%s c4iw_dev %p tid %u\n", __func__, dev, hwtid); | 2189 | PDBG("%s c4iw_dev %p tid %u\n", __func__, dev, hwtid); |
| 2181 | BUG_ON(skb_cloned(skb)); | 2190 | BUG_ON(skb_cloned(skb)); |
| 2182 | skb_trim(skb, sizeof(struct cpl_tid_release)); | 2191 | skb_trim(skb, sizeof(struct cpl_tid_release)); |
| 2183 | skb_get(skb); | ||
| 2184 | release_tid(&dev->rdev, hwtid, skb); | 2192 | release_tid(&dev->rdev, hwtid, skb); |
| 2185 | return; | 2193 | return; |
| 2186 | } | 2194 | } |
| @@ -3917,7 +3925,7 @@ int __init c4iw_cm_init(void) | |||
| 3917 | return 0; | 3925 | return 0; |
| 3918 | } | 3926 | } |
| 3919 | 3927 | ||
| 3920 | void __exit c4iw_cm_term(void) | 3928 | void c4iw_cm_term(void) |
| 3921 | { | 3929 | { |
| 3922 | WARN_ON(!list_empty(&timeout_list)); | 3930 | WARN_ON(!list_empty(&timeout_list)); |
| 3923 | flush_workqueue(workq); | 3931 | flush_workqueue(workq); |
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index dd93aadc996e..7db82b24302b 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
| @@ -696,6 +696,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) | |||
| 696 | pr_err(MOD "error allocating status page\n"); | 696 | pr_err(MOD "error allocating status page\n"); |
| 697 | goto err4; | 697 | goto err4; |
| 698 | } | 698 | } |
| 699 | rdev->status_page->db_off = 0; | ||
| 699 | return 0; | 700 | return 0; |
| 700 | err4: | 701 | err4: |
| 701 | c4iw_rqtpool_destroy(rdev); | 702 | c4iw_rqtpool_destroy(rdev); |
| @@ -729,7 +730,6 @@ static void c4iw_dealloc(struct uld_ctx *ctx) | |||
| 729 | if (ctx->dev->rdev.oc_mw_kva) | 730 | if (ctx->dev->rdev.oc_mw_kva) |
| 730 | iounmap(ctx->dev->rdev.oc_mw_kva); | 731 | iounmap(ctx->dev->rdev.oc_mw_kva); |
| 731 | ib_dealloc_device(&ctx->dev->ibdev); | 732 | ib_dealloc_device(&ctx->dev->ibdev); |
| 732 | iwpm_exit(RDMA_NL_C4IW); | ||
| 733 | ctx->dev = NULL; | 733 | ctx->dev = NULL; |
| 734 | } | 734 | } |
| 735 | 735 | ||
| @@ -826,12 +826,6 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
| 826 | setup_debugfs(devp); | 826 | setup_debugfs(devp); |
| 827 | } | 827 | } |
| 828 | 828 | ||
| 829 | ret = iwpm_init(RDMA_NL_C4IW); | ||
| 830 | if (ret) { | ||
| 831 | pr_err("port mapper initialization failed with %d\n", ret); | ||
| 832 | ib_dealloc_device(&devp->ibdev); | ||
| 833 | return ERR_PTR(ret); | ||
| 834 | } | ||
| 835 | 829 | ||
| 836 | return devp; | 830 | return devp; |
| 837 | } | 831 | } |
| @@ -1332,6 +1326,15 @@ static int __init c4iw_init_module(void) | |||
| 1332 | pr_err("%s[%u]: Failed to add netlink callback\n" | 1326 | pr_err("%s[%u]: Failed to add netlink callback\n" |
| 1333 | , __func__, __LINE__); | 1327 | , __func__, __LINE__); |
| 1334 | 1328 | ||
| 1329 | err = iwpm_init(RDMA_NL_C4IW); | ||
| 1330 | if (err) { | ||
| 1331 | pr_err("port mapper initialization failed with %d\n", err); | ||
| 1332 | ibnl_remove_client(RDMA_NL_C4IW); | ||
| 1333 | c4iw_cm_term(); | ||
| 1334 | debugfs_remove_recursive(c4iw_debugfs_root); | ||
| 1335 | return err; | ||
| 1336 | } | ||
| 1337 | |||
| 1335 | cxgb4_register_uld(CXGB4_ULD_RDMA, &c4iw_uld_info); | 1338 | cxgb4_register_uld(CXGB4_ULD_RDMA, &c4iw_uld_info); |
| 1336 | 1339 | ||
| 1337 | return 0; | 1340 | return 0; |
| @@ -1349,6 +1352,7 @@ static void __exit c4iw_exit_module(void) | |||
| 1349 | } | 1352 | } |
| 1350 | mutex_unlock(&dev_mutex); | 1353 | mutex_unlock(&dev_mutex); |
| 1351 | cxgb4_unregister_uld(CXGB4_ULD_RDMA); | 1354 | cxgb4_unregister_uld(CXGB4_ULD_RDMA); |
| 1355 | iwpm_exit(RDMA_NL_C4IW); | ||
| 1352 | ibnl_remove_client(RDMA_NL_C4IW); | 1356 | ibnl_remove_client(RDMA_NL_C4IW); |
| 1353 | c4iw_cm_term(); | 1357 | c4iw_cm_term(); |
| 1354 | debugfs_remove_recursive(c4iw_debugfs_root); | 1358 | debugfs_remove_recursive(c4iw_debugfs_root); |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index 125bc5d1e175..361fff7a0742 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
| @@ -908,7 +908,7 @@ int c4iw_destroy_ctrl_qp(struct c4iw_rdev *rdev); | |||
| 908 | int c4iw_register_device(struct c4iw_dev *dev); | 908 | int c4iw_register_device(struct c4iw_dev *dev); |
| 909 | void c4iw_unregister_device(struct c4iw_dev *dev); | 909 | void c4iw_unregister_device(struct c4iw_dev *dev); |
| 910 | int __init c4iw_cm_init(void); | 910 | int __init c4iw_cm_init(void); |
| 911 | void __exit c4iw_cm_term(void); | 911 | void c4iw_cm_term(void); |
| 912 | void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, | 912 | void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, |
| 913 | struct c4iw_dev_ucontext *uctx); | 913 | struct c4iw_dev_ucontext *uctx); |
| 914 | void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, | 914 | void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index d13ddf1c0033..bbbcf389272c 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -675,7 +675,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, | |||
| 675 | int err; | 675 | int err; |
| 676 | 676 | ||
| 677 | uuari = &dev->mdev.priv.uuari; | 677 | uuari = &dev->mdev.priv.uuari; |
| 678 | if (init_attr->create_flags & ~IB_QP_CREATE_SIGNATURE_EN) | 678 | if (init_attr->create_flags & ~(IB_QP_CREATE_SIGNATURE_EN | IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK)) |
| 679 | return -EINVAL; | 679 | return -EINVAL; |
| 680 | 680 | ||
| 681 | if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR) | 681 | if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR) |
diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c index b99dd88e31b9..bb446d742a2d 100644 --- a/drivers/iommu/fsl_pamu.c +++ b/drivers/iommu/fsl_pamu.c | |||
| @@ -170,10 +170,10 @@ int pamu_disable_liodn(int liodn) | |||
| 170 | static unsigned int map_addrspace_size_to_wse(phys_addr_t addrspace_size) | 170 | static unsigned int map_addrspace_size_to_wse(phys_addr_t addrspace_size) |
| 171 | { | 171 | { |
| 172 | /* Bug if not a power of 2 */ | 172 | /* Bug if not a power of 2 */ |
| 173 | BUG_ON(!is_power_of_2(addrspace_size)); | 173 | BUG_ON((addrspace_size & (addrspace_size - 1))); |
| 174 | 174 | ||
| 175 | /* window size is 2^(WSE+1) bytes */ | 175 | /* window size is 2^(WSE+1) bytes */ |
| 176 | return __ffs(addrspace_size) - 1; | 176 | return fls64(addrspace_size) - 2; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | /* Derive the PAACE window count encoding for the subwindow count */ | 179 | /* Derive the PAACE window count encoding for the subwindow count */ |
| @@ -351,7 +351,7 @@ int pamu_config_ppaace(int liodn, phys_addr_t win_addr, phys_addr_t win_size, | |||
| 351 | struct paace *ppaace; | 351 | struct paace *ppaace; |
| 352 | unsigned long fspi; | 352 | unsigned long fspi; |
| 353 | 353 | ||
| 354 | if (!is_power_of_2(win_size) || win_size < PAMU_PAGE_SIZE) { | 354 | if ((win_size & (win_size - 1)) || win_size < PAMU_PAGE_SIZE) { |
| 355 | pr_debug("window size too small or not a power of two %llx\n", win_size); | 355 | pr_debug("window size too small or not a power of two %llx\n", win_size); |
| 356 | return -EINVAL; | 356 | return -EINVAL; |
| 357 | } | 357 | } |
| @@ -464,7 +464,7 @@ int pamu_config_spaace(int liodn, u32 subwin_cnt, u32 subwin, | |||
| 464 | return -ENOENT; | 464 | return -ENOENT; |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | if (!is_power_of_2(subwin_size) || subwin_size < PAMU_PAGE_SIZE) { | 467 | if ((subwin_size & (subwin_size - 1)) || subwin_size < PAMU_PAGE_SIZE) { |
| 468 | pr_debug("subwindow size out of range, or not a power of 2\n"); | 468 | pr_debug("subwindow size out of range, or not a power of 2\n"); |
| 469 | return -EINVAL; | 469 | return -EINVAL; |
| 470 | } | 470 | } |
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 93072ba44b1d..af47648301a9 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
| @@ -301,7 +301,7 @@ static int check_size(u64 size, dma_addr_t iova) | |||
| 301 | * Size must be a power of two and at least be equal | 301 | * Size must be a power of two and at least be equal |
| 302 | * to PAMU page size. | 302 | * to PAMU page size. |
| 303 | */ | 303 | */ |
| 304 | if (!is_power_of_2(size) || size < PAMU_PAGE_SIZE) { | 304 | if ((size & (size - 1)) || size < PAMU_PAGE_SIZE) { |
| 305 | pr_debug("%s: size too small or not a power of two\n", __func__); | 305 | pr_debug("%s: size too small or not a power of two\n", __func__); |
| 306 | return -EINVAL; | 306 | return -EINVAL; |
| 307 | } | 307 | } |
| @@ -335,11 +335,6 @@ static struct fsl_dma_domain *iommu_alloc_dma_domain(void) | |||
| 335 | return domain; | 335 | return domain; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | static inline struct device_domain_info *find_domain(struct device *dev) | ||
| 339 | { | ||
| 340 | return dev->archdata.iommu_domain; | ||
| 341 | } | ||
| 342 | |||
| 343 | static void remove_device_ref(struct device_domain_info *info, u32 win_cnt) | 338 | static void remove_device_ref(struct device_domain_info *info, u32 win_cnt) |
| 344 | { | 339 | { |
| 345 | unsigned long flags; | 340 | unsigned long flags; |
| @@ -380,7 +375,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d | |||
| 380 | * Check here if the device is already attached to domain or not. | 375 | * Check here if the device is already attached to domain or not. |
| 381 | * If the device is already attached to a domain detach it. | 376 | * If the device is already attached to a domain detach it. |
| 382 | */ | 377 | */ |
| 383 | old_domain_info = find_domain(dev); | 378 | old_domain_info = dev->archdata.iommu_domain; |
| 384 | if (old_domain_info && old_domain_info->domain != dma_domain) { | 379 | if (old_domain_info && old_domain_info->domain != dma_domain) { |
| 385 | spin_unlock_irqrestore(&device_domain_lock, flags); | 380 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 386 | detach_device(dev, old_domain_info->domain); | 381 | detach_device(dev, old_domain_info->domain); |
| @@ -399,7 +394,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d | |||
| 399 | * the info for the first LIODN as all | 394 | * the info for the first LIODN as all |
| 400 | * LIODNs share the same domain | 395 | * LIODNs share the same domain |
| 401 | */ | 396 | */ |
| 402 | if (!old_domain_info) | 397 | if (!dev->archdata.iommu_domain) |
| 403 | dev->archdata.iommu_domain = info; | 398 | dev->archdata.iommu_domain = info; |
| 404 | spin_unlock_irqrestore(&device_domain_lock, flags); | 399 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 405 | 400 | ||
| @@ -1042,12 +1037,15 @@ root_bus: | |||
| 1042 | group = get_shared_pci_device_group(pdev); | 1037 | group = get_shared_pci_device_group(pdev); |
| 1043 | } | 1038 | } |
| 1044 | 1039 | ||
| 1040 | if (!group) | ||
| 1041 | group = ERR_PTR(-ENODEV); | ||
| 1042 | |||
| 1045 | return group; | 1043 | return group; |
| 1046 | } | 1044 | } |
| 1047 | 1045 | ||
| 1048 | static int fsl_pamu_add_device(struct device *dev) | 1046 | static int fsl_pamu_add_device(struct device *dev) |
| 1049 | { | 1047 | { |
| 1050 | struct iommu_group *group = NULL; | 1048 | struct iommu_group *group = ERR_PTR(-ENODEV); |
| 1051 | struct pci_dev *pdev; | 1049 | struct pci_dev *pdev; |
| 1052 | const u32 *prop; | 1050 | const u32 *prop; |
| 1053 | int ret, len; | 1051 | int ret, len; |
| @@ -1070,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev) | |||
| 1070 | group = get_device_iommu_group(dev); | 1068 | group = get_device_iommu_group(dev); |
| 1071 | } | 1069 | } |
| 1072 | 1070 | ||
| 1073 | if (!group || IS_ERR(group)) | 1071 | if (IS_ERR(group)) |
| 1074 | return PTR_ERR(group); | 1072 | return PTR_ERR(group); |
| 1075 | 1073 | ||
| 1076 | ret = iommu_group_add_device(group, dev); | 1074 | ret = iommu_group_add_device(group, dev); |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 7e11c9d6ae8c..7c131cf7cc13 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <linux/irqchip/chained_irq.h> | 42 | #include <linux/irqchip/chained_irq.h> |
| 43 | #include <linux/irqchip/arm-gic.h> | 43 | #include <linux/irqchip/arm-gic.h> |
| 44 | 44 | ||
| 45 | #include <asm/cputype.h> | ||
| 45 | #include <asm/irq.h> | 46 | #include <asm/irq.h> |
| 46 | #include <asm/exception.h> | 47 | #include <asm/exception.h> |
| 47 | #include <asm/smp_plat.h> | 48 | #include <asm/smp_plat.h> |
| @@ -954,7 +955,9 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
| 954 | } | 955 | } |
| 955 | 956 | ||
| 956 | for_each_possible_cpu(cpu) { | 957 | for_each_possible_cpu(cpu) { |
| 957 | unsigned long offset = percpu_offset * cpu_logical_map(cpu); | 958 | u32 mpidr = cpu_logical_map(cpu); |
| 959 | u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
| 960 | unsigned long offset = percpu_offset * core_id; | ||
| 958 | *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset; | 961 | *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset; |
| 959 | *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset; | 962 | *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset; |
| 960 | } | 963 | } |
| @@ -1071,8 +1074,10 @@ gic_of_init(struct device_node *node, struct device_node *parent) | |||
| 1071 | gic_cnt++; | 1074 | gic_cnt++; |
| 1072 | return 0; | 1075 | return 0; |
| 1073 | } | 1076 | } |
| 1077 | IRQCHIP_DECLARE(gic_400, "arm,gic-400", gic_of_init); | ||
| 1074 | IRQCHIP_DECLARE(cortex_a15_gic, "arm,cortex-a15-gic", gic_of_init); | 1078 | IRQCHIP_DECLARE(cortex_a15_gic, "arm,cortex-a15-gic", gic_of_init); |
| 1075 | IRQCHIP_DECLARE(cortex_a9_gic, "arm,cortex-a9-gic", gic_of_init); | 1079 | IRQCHIP_DECLARE(cortex_a9_gic, "arm,cortex-a9-gic", gic_of_init); |
| 1080 | IRQCHIP_DECLARE(cortex_a7_gic, "arm,cortex-a7-gic", gic_of_init); | ||
| 1076 | IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init); | 1081 | IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init); |
| 1077 | IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init); | 1082 | IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init); |
| 1078 | 1083 | ||
diff --git a/drivers/isdn/hisax/l3ni1.c b/drivers/isdn/hisax/l3ni1.c index 0df6691d045c..8dc791bfaa6f 100644 --- a/drivers/isdn/hisax/l3ni1.c +++ b/drivers/isdn/hisax/l3ni1.c | |||
| @@ -2059,13 +2059,17 @@ static int l3ni1_cmd_global(struct PStack *st, isdn_ctrl *ic) | |||
| 2059 | memcpy(p, ic->parm.ni1_io.data, ic->parm.ni1_io.datalen); /* copy data */ | 2059 | memcpy(p, ic->parm.ni1_io.data, ic->parm.ni1_io.datalen); /* copy data */ |
| 2060 | l = (p - temp) + ic->parm.ni1_io.datalen; /* total length */ | 2060 | l = (p - temp) + ic->parm.ni1_io.datalen; /* total length */ |
| 2061 | 2061 | ||
| 2062 | if (ic->parm.ni1_io.timeout > 0) | 2062 | if (ic->parm.ni1_io.timeout > 0) { |
| 2063 | if (!(pc = ni1_new_l3_process(st, -1))) | 2063 | pc = ni1_new_l3_process(st, -1); |
| 2064 | { free_invoke_id(st, id); | 2064 | if (!pc) { |
| 2065 | free_invoke_id(st, id); | ||
| 2065 | return (-2); | 2066 | return (-2); |
| 2066 | } | 2067 | } |
| 2067 | pc->prot.ni1.ll_id = ic->parm.ni1_io.ll_id; /* remember id */ | 2068 | /* remember id */ |
| 2068 | pc->prot.ni1.proc = ic->parm.ni1_io.proc; /* and procedure */ | 2069 | pc->prot.ni1.ll_id = ic->parm.ni1_io.ll_id; |
| 2070 | /* and procedure */ | ||
| 2071 | pc->prot.ni1.proc = ic->parm.ni1_io.proc; | ||
| 2072 | } | ||
| 2069 | 2073 | ||
| 2070 | if (!(skb = l3_alloc_skb(l))) | 2074 | if (!(skb = l3_alloc_skb(l))) |
| 2071 | { free_invoke_id(st, id); | 2075 | { free_invoke_id(st, id); |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 61ac63237446..a333b7f798d1 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
| @@ -442,7 +442,7 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 442 | { | 442 | { |
| 443 | struct sock_fprog uprog; | 443 | struct sock_fprog uprog; |
| 444 | struct sock_filter *code = NULL; | 444 | struct sock_filter *code = NULL; |
| 445 | int len, err; | 445 | int len; |
| 446 | 446 | ||
| 447 | if (copy_from_user(&uprog, arg, sizeof(uprog))) | 447 | if (copy_from_user(&uprog, arg, sizeof(uprog))) |
| 448 | return -EFAULT; | 448 | return -EFAULT; |
| @@ -458,12 +458,6 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 458 | if (IS_ERR(code)) | 458 | if (IS_ERR(code)) |
| 459 | return PTR_ERR(code); | 459 | return PTR_ERR(code); |
| 460 | 460 | ||
| 461 | err = sk_chk_filter(code, uprog.len); | ||
| 462 | if (err) { | ||
| 463 | kfree(code); | ||
| 464 | return err; | ||
| 465 | } | ||
| 466 | |||
| 467 | *p = code; | 461 | *p = code; |
| 468 | return uprog.len; | 462 | return uprog.len; |
| 469 | } | 463 | } |
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index 4ead4ba60656..d2899e7eb3aa 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
| @@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd) | |||
| 425 | 425 | ||
| 426 | disk_super = dm_block_data(sblock); | 426 | disk_super = dm_block_data(sblock); |
| 427 | 427 | ||
| 428 | /* Verify the data block size hasn't changed */ | ||
| 429 | if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) { | ||
| 430 | DMERR("changing the data block size (from %u to %llu) is not supported", | ||
| 431 | le32_to_cpu(disk_super->data_block_size), | ||
| 432 | (unsigned long long)cmd->data_block_size); | ||
| 433 | r = -EINVAL; | ||
| 434 | goto bad; | ||
| 435 | } | ||
| 436 | |||
| 428 | r = __check_incompat_features(disk_super, cmd); | 437 | r = __check_incompat_features(disk_super, cmd); |
| 429 | if (r < 0) | 438 | if (r < 0) |
| 430 | goto bad; | 439 | goto bad; |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index b086a945edcb..e9d33ad59df5 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
| @@ -613,6 +613,15 @@ static int __open_metadata(struct dm_pool_metadata *pmd) | |||
| 613 | 613 | ||
| 614 | disk_super = dm_block_data(sblock); | 614 | disk_super = dm_block_data(sblock); |
| 615 | 615 | ||
| 616 | /* Verify the data block size hasn't changed */ | ||
| 617 | if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) { | ||
| 618 | DMERR("changing the data block size (from %u to %llu) is not supported", | ||
| 619 | le32_to_cpu(disk_super->data_block_size), | ||
| 620 | (unsigned long long)pmd->data_block_size); | ||
| 621 | r = -EINVAL; | ||
| 622 | goto bad_unlock_sblock; | ||
| 623 | } | ||
| 624 | |||
| 616 | r = __check_incompat_features(disk_super, pmd); | 625 | r = __check_incompat_features(disk_super, pmd); |
| 617 | if (r < 0) | 626 | if (r < 0) |
| 618 | goto bad_unlock_sblock; | 627 | goto bad_unlock_sblock; |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index e4ec355704a6..a7543ba3e190 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
| @@ -52,6 +52,11 @@ | |||
| 52 | /* Atmel chips */ | 52 | /* Atmel chips */ |
| 53 | #define AT49BV640D 0x02de | 53 | #define AT49BV640D 0x02de |
| 54 | #define AT49BV640DT 0x02db | 54 | #define AT49BV640DT 0x02db |
| 55 | /* Sharp chips */ | ||
| 56 | #define LH28F640BFHE_PTTL90 0x00b0 | ||
| 57 | #define LH28F640BFHE_PBTL90 0x00b1 | ||
| 58 | #define LH28F640BFHE_PTTL70A 0x00b2 | ||
| 59 | #define LH28F640BFHE_PBTL70A 0x00b3 | ||
| 55 | 60 | ||
| 56 | static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 61 | static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
| 57 | static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 62 | static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
| @@ -258,6 +263,36 @@ static void fixup_st_m28w320cb(struct mtd_info *mtd) | |||
| 258 | (cfi->cfiq->EraseRegionInfo[1] & 0xffff0000) | 0x3e; | 263 | (cfi->cfiq->EraseRegionInfo[1] & 0xffff0000) | 0x3e; |
| 259 | }; | 264 | }; |
| 260 | 265 | ||
| 266 | static int is_LH28F640BF(struct cfi_private *cfi) | ||
| 267 | { | ||
| 268 | /* Sharp LH28F640BF Family */ | ||
| 269 | if (cfi->mfr == CFI_MFR_SHARP && ( | ||
| 270 | cfi->id == LH28F640BFHE_PTTL90 || cfi->id == LH28F640BFHE_PBTL90 || | ||
| 271 | cfi->id == LH28F640BFHE_PTTL70A || cfi->id == LH28F640BFHE_PBTL70A)) | ||
| 272 | return 1; | ||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | |||
| 276 | static void fixup_LH28F640BF(struct mtd_info *mtd) | ||
| 277 | { | ||
| 278 | struct map_info *map = mtd->priv; | ||
| 279 | struct cfi_private *cfi = map->fldrv_priv; | ||
| 280 | struct cfi_pri_intelext *extp = cfi->cmdset_priv; | ||
| 281 | |||
| 282 | /* Reset the Partition Configuration Register on LH28F640BF | ||
| 283 | * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */ | ||
| 284 | if (is_LH28F640BF(cfi)) { | ||
| 285 | printk(KERN_INFO "Reset Partition Config. Register: 1 Partition of 4 planes\n"); | ||
| 286 | map_write(map, CMD(0x60), 0); | ||
| 287 | map_write(map, CMD(0x04), 0); | ||
| 288 | |||
| 289 | /* We have set one single partition thus | ||
| 290 | * Simultaneous Operations are not allowed */ | ||
| 291 | printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations disabled\n"); | ||
| 292 | extp->FeatureSupport &= ~512; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | |||
| 261 | static void fixup_use_point(struct mtd_info *mtd) | 296 | static void fixup_use_point(struct mtd_info *mtd) |
| 262 | { | 297 | { |
| 263 | struct map_info *map = mtd->priv; | 298 | struct map_info *map = mtd->priv; |
| @@ -309,6 +344,8 @@ static struct cfi_fixup cfi_fixup_table[] = { | |||
| 309 | { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct }, | 344 | { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct }, |
| 310 | { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb }, | 345 | { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb }, |
| 311 | { CFI_MFR_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock }, | 346 | { CFI_MFR_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock }, |
| 347 | { CFI_MFR_SHARP, CFI_ID_ANY, fixup_unlock_powerup_lock }, | ||
| 348 | { CFI_MFR_SHARP, CFI_ID_ANY, fixup_LH28F640BF }, | ||
| 312 | { 0, 0, NULL } | 349 | { 0, 0, NULL } |
| 313 | }; | 350 | }; |
| 314 | 351 | ||
| @@ -1649,6 +1686,12 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1649 | initial_adr = adr; | 1686 | initial_adr = adr; |
| 1650 | cmd_adr = adr & ~(wbufsize-1); | 1687 | cmd_adr = adr & ~(wbufsize-1); |
| 1651 | 1688 | ||
| 1689 | /* Sharp LH28F640BF chips need the first address for the | ||
| 1690 | * Page Buffer Program command. See Table 5 of | ||
| 1691 | * LH28F320BF, LH28F640BF, LH28F128BF Series (Appendix FUM00701) */ | ||
| 1692 | if (is_LH28F640BF(cfi)) | ||
| 1693 | cmd_adr = adr; | ||
| 1694 | |||
| 1652 | /* Let's determine this according to the interleave only once */ | 1695 | /* Let's determine this according to the interleave only once */ |
| 1653 | write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9); | 1696 | write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9); |
| 1654 | 1697 | ||
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c index 7df86948e6d4..b4f61c7fc161 100644 --- a/drivers/mtd/devices/elm.c +++ b/drivers/mtd/devices/elm.c | |||
| @@ -475,6 +475,7 @@ static int elm_context_save(struct elm_info *info) | |||
| 475 | ELM_SYNDROME_FRAGMENT_1 + offset); | 475 | ELM_SYNDROME_FRAGMENT_1 + offset); |
| 476 | regs->elm_syndrome_fragment_0[i] = elm_read_reg(info, | 476 | regs->elm_syndrome_fragment_0[i] = elm_read_reg(info, |
| 477 | ELM_SYNDROME_FRAGMENT_0 + offset); | 477 | ELM_SYNDROME_FRAGMENT_0 + offset); |
| 478 | break; | ||
| 478 | default: | 479 | default: |
| 479 | return -EINVAL; | 480 | return -EINVAL; |
| 480 | } | 481 | } |
| @@ -520,6 +521,7 @@ static int elm_context_restore(struct elm_info *info) | |||
| 520 | regs->elm_syndrome_fragment_1[i]); | 521 | regs->elm_syndrome_fragment_1[i]); |
| 521 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset, | 522 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset, |
| 522 | regs->elm_syndrome_fragment_0[i]); | 523 | regs->elm_syndrome_fragment_0[i]); |
| 524 | break; | ||
| 523 | default: | 525 | default: |
| 524 | return -EINVAL; | 526 | return -EINVAL; |
| 525 | } | 527 | } |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 41167e9e991e..4f3e80c68a26 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -4047,8 +4047,10 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
| 4047 | ecc->layout->oobavail += ecc->layout->oobfree[i].length; | 4047 | ecc->layout->oobavail += ecc->layout->oobfree[i].length; |
| 4048 | mtd->oobavail = ecc->layout->oobavail; | 4048 | mtd->oobavail = ecc->layout->oobavail; |
| 4049 | 4049 | ||
| 4050 | /* ECC sanity check: warn noisily if it's too weak */ | 4050 | /* ECC sanity check: warn if it's too weak */ |
| 4051 | WARN_ON(!nand_ecc_strength_good(mtd)); | 4051 | if (!nand_ecc_strength_good(mtd)) |
| 4052 | pr_warn("WARNING: %s: the ECC used on your system is too weak compared to the one required by the NAND chip\n", | ||
| 4053 | mtd->name); | ||
| 4052 | 4054 | ||
| 4053 | /* | 4055 | /* |
| 4054 | * Set the number of read / write steps for one page depending on ECC | 4056 | * Set the number of read / write steps for one page depending on ECC |
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index b04e7d059888..0431b46d9fd9 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
| @@ -125,7 +125,7 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id, | |||
| 125 | parent = *p; | 125 | parent = *p; |
| 126 | av = rb_entry(parent, struct ubi_ainf_volume, rb); | 126 | av = rb_entry(parent, struct ubi_ainf_volume, rb); |
| 127 | 127 | ||
| 128 | if (vol_id < av->vol_id) | 128 | if (vol_id > av->vol_id) |
| 129 | p = &(*p)->rb_left; | 129 | p = &(*p)->rb_left; |
| 130 | else | 130 | else |
| 131 | p = &(*p)->rb_right; | 131 | p = &(*p)->rb_right; |
| @@ -423,7 +423,7 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
| 423 | pnum, err); | 423 | pnum, err); |
| 424 | ret = err > 0 ? UBI_BAD_FASTMAP : err; | 424 | ret = err > 0 ? UBI_BAD_FASTMAP : err; |
| 425 | goto out; | 425 | goto out; |
| 426 | } else if (ret == UBI_IO_BITFLIPS) | 426 | } else if (err == UBI_IO_BITFLIPS) |
| 427 | scrub = 1; | 427 | scrub = 1; |
| 428 | 428 | ||
| 429 | /* | 429 | /* |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3a451b6cd3d5..701f86cd5993 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -4068,7 +4068,7 @@ static int bond_check_params(struct bond_params *params) | |||
| 4068 | } | 4068 | } |
| 4069 | 4069 | ||
| 4070 | if (ad_select) { | 4070 | if (ad_select) { |
| 4071 | bond_opt_initstr(&newval, lacp_rate); | 4071 | bond_opt_initstr(&newval, ad_select); |
| 4072 | valptr = bond_opt_parse(bond_opt_get(BOND_OPT_AD_SELECT), | 4072 | valptr = bond_opt_parse(bond_opt_get(BOND_OPT_AD_SELECT), |
| 4073 | &newval); | 4073 | &newval); |
| 4074 | if (!valptr) { | 4074 | if (!valptr) { |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 141160ef249a..5776e503e4c5 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
| @@ -654,13 +654,13 @@ static int bcm_sysport_tx_poll(struct napi_struct *napi, int budget) | |||
| 654 | 654 | ||
| 655 | work_done = bcm_sysport_tx_reclaim(ring->priv, ring); | 655 | work_done = bcm_sysport_tx_reclaim(ring->priv, ring); |
| 656 | 656 | ||
| 657 | if (work_done < budget) { | 657 | if (work_done == 0) { |
| 658 | napi_complete(napi); | 658 | napi_complete(napi); |
| 659 | /* re-enable TX interrupt */ | 659 | /* re-enable TX interrupt */ |
| 660 | intrl2_1_mask_clear(ring->priv, BIT(ring->index)); | 660 | intrl2_1_mask_clear(ring->priv, BIT(ring->index)); |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | return work_done; | 663 | return 0; |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | static void bcm_sysport_tx_reclaim_all(struct bcm_sysport_priv *priv) | 666 | static void bcm_sysport_tx_reclaim_all(struct bcm_sysport_priv *priv) |
| @@ -1254,28 +1254,17 @@ static inline void umac_enable_set(struct bcm_sysport_priv *priv, | |||
| 1254 | usleep_range(1000, 2000); | 1254 | usleep_range(1000, 2000); |
| 1255 | } | 1255 | } |
| 1256 | 1256 | ||
| 1257 | static inline int umac_reset(struct bcm_sysport_priv *priv) | 1257 | static inline void umac_reset(struct bcm_sysport_priv *priv) |
| 1258 | { | 1258 | { |
| 1259 | unsigned int timeout = 0; | ||
| 1260 | u32 reg; | 1259 | u32 reg; |
| 1261 | int ret = 0; | ||
| 1262 | |||
| 1263 | umac_writel(priv, 0, UMAC_CMD); | ||
| 1264 | while (timeout++ < 1000) { | ||
| 1265 | reg = umac_readl(priv, UMAC_CMD); | ||
| 1266 | if (!(reg & CMD_SW_RESET)) | ||
| 1267 | break; | ||
| 1268 | |||
| 1269 | udelay(1); | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | if (timeout == 1000) { | ||
| 1273 | dev_err(&priv->pdev->dev, | ||
| 1274 | "timeout waiting for MAC to come out of reset\n"); | ||
| 1275 | ret = -ETIMEDOUT; | ||
| 1276 | } | ||
| 1277 | 1260 | ||
| 1278 | return ret; | 1261 | reg = umac_readl(priv, UMAC_CMD); |
| 1262 | reg |= CMD_SW_RESET; | ||
| 1263 | umac_writel(priv, reg, UMAC_CMD); | ||
| 1264 | udelay(10); | ||
| 1265 | reg = umac_readl(priv, UMAC_CMD); | ||
| 1266 | reg &= ~CMD_SW_RESET; | ||
| 1267 | umac_writel(priv, reg, UMAC_CMD); | ||
| 1279 | } | 1268 | } |
| 1280 | 1269 | ||
| 1281 | static void umac_set_hw_addr(struct bcm_sysport_priv *priv, | 1270 | static void umac_set_hw_addr(struct bcm_sysport_priv *priv, |
| @@ -1303,11 +1292,7 @@ static int bcm_sysport_open(struct net_device *dev) | |||
| 1303 | int ret; | 1292 | int ret; |
| 1304 | 1293 | ||
| 1305 | /* Reset UniMAC */ | 1294 | /* Reset UniMAC */ |
| 1306 | ret = umac_reset(priv); | 1295 | umac_reset(priv); |
| 1307 | if (ret) { | ||
| 1308 | netdev_err(dev, "UniMAC reset failed\n"); | ||
| 1309 | return ret; | ||
| 1310 | } | ||
| 1311 | 1296 | ||
| 1312 | /* Flush TX and RX FIFOs at TOPCTRL level */ | 1297 | /* Flush TX and RX FIFOs at TOPCTRL level */ |
| 1313 | topctrl_flush(priv); | 1298 | topctrl_flush(priv); |
| @@ -1589,12 +1574,6 @@ static int bcm_sysport_probe(struct platform_device *pdev) | |||
| 1589 | BUILD_BUG_ON(sizeof(struct bcm_tsb) != 8); | 1574 | BUILD_BUG_ON(sizeof(struct bcm_tsb) != 8); |
| 1590 | dev->needed_headroom += sizeof(struct bcm_tsb); | 1575 | dev->needed_headroom += sizeof(struct bcm_tsb); |
| 1591 | 1576 | ||
| 1592 | /* We are interfaced to a switch which handles the multicast | ||
| 1593 | * filtering for us, so we do not support programming any | ||
| 1594 | * multicast hash table in this Ethernet MAC. | ||
| 1595 | */ | ||
| 1596 | dev->flags &= ~IFF_MULTICAST; | ||
| 1597 | |||
| 1598 | /* libphy will adjust the link state accordingly */ | 1577 | /* libphy will adjust the link state accordingly */ |
| 1599 | netif_carrier_off(dev); | 1578 | netif_carrier_off(dev); |
| 1600 | 1579 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 47c5814114e1..4b875da1c7ed 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
| @@ -797,7 +797,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 797 | 797 | ||
| 798 | return; | 798 | return; |
| 799 | } | 799 | } |
| 800 | bnx2x_frag_free(fp, new_data); | 800 | if (new_data) |
| 801 | bnx2x_frag_free(fp, new_data); | ||
| 801 | drop: | 802 | drop: |
| 802 | /* drop the packet and keep the buffer in the bin */ | 803 | /* drop the packet and keep the buffer in the bin */ |
| 803 | DP(NETIF_MSG_RX_STATUS, | 804 | DP(NETIF_MSG_RX_STATUS, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 2887034523e0..6a8b1453a1b9 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -12937,7 +12937,7 @@ static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev, int cnic_cnt) | |||
| 12937 | * without the default SB. | 12937 | * without the default SB. |
| 12938 | * For VFs there is no default SB, then we return (index+1). | 12938 | * For VFs there is no default SB, then we return (index+1). |
| 12939 | */ | 12939 | */ |
| 12940 | pci_read_config_word(pdev, pdev->msix_cap + PCI_MSI_FLAGS, &control); | 12940 | pci_read_config_word(pdev, pdev->msix_cap + PCI_MSIX_FLAGS, &control); |
| 12941 | 12941 | ||
| 12942 | index = control & PCI_MSIX_FLAGS_QSIZE; | 12942 | index = control & PCI_MSIX_FLAGS_QSIZE; |
| 12943 | 12943 | ||
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 5ba1cfbd60da..16281ad2da12 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
| @@ -1408,13 +1408,6 @@ static int bcmgenet_alloc_rx_buffers(struct bcmgenet_priv *priv) | |||
| 1408 | if (cb->skb) | 1408 | if (cb->skb) |
| 1409 | continue; | 1409 | continue; |
| 1410 | 1410 | ||
| 1411 | /* set the DMA descriptor length once and for all | ||
| 1412 | * it will only change if we support dynamically sizing | ||
| 1413 | * priv->rx_buf_len, but we do not | ||
| 1414 | */ | ||
| 1415 | dmadesc_set_length_status(priv, priv->rx_bd_assign_ptr, | ||
| 1416 | priv->rx_buf_len << DMA_BUFLENGTH_SHIFT); | ||
| 1417 | |||
| 1418 | ret = bcmgenet_rx_refill(priv, cb); | 1411 | ret = bcmgenet_rx_refill(priv, cb); |
| 1419 | if (ret) | 1412 | if (ret) |
| 1420 | break; | 1413 | break; |
| @@ -2535,14 +2528,17 @@ static int bcmgenet_probe(struct platform_device *pdev) | |||
| 2535 | netif_set_real_num_tx_queues(priv->dev, priv->hw_params->tx_queues + 1); | 2528 | netif_set_real_num_tx_queues(priv->dev, priv->hw_params->tx_queues + 1); |
| 2536 | netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); | 2529 | netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); |
| 2537 | 2530 | ||
| 2538 | err = register_netdev(dev); | 2531 | /* libphy will determine the link state */ |
| 2539 | if (err) | 2532 | netif_carrier_off(dev); |
| 2540 | goto err_clk_disable; | ||
| 2541 | 2533 | ||
| 2542 | /* Turn off the main clock, WOL clock is handled separately */ | 2534 | /* Turn off the main clock, WOL clock is handled separately */ |
| 2543 | if (!IS_ERR(priv->clk)) | 2535 | if (!IS_ERR(priv->clk)) |
| 2544 | clk_disable_unprepare(priv->clk); | 2536 | clk_disable_unprepare(priv->clk); |
| 2545 | 2537 | ||
| 2538 | err = register_netdev(dev); | ||
| 2539 | if (err) | ||
| 2540 | goto err; | ||
| 2541 | |||
| 2546 | return err; | 2542 | return err; |
| 2547 | 2543 | ||
| 2548 | err_clk_disable: | 2544 | err_clk_disable: |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index 0f117105fed1..e23c993b1362 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | |||
| @@ -331,9 +331,9 @@ struct bcmgenet_mib_counters { | |||
| 331 | #define EXT_ENERGY_DET_MASK (1 << 12) | 331 | #define EXT_ENERGY_DET_MASK (1 << 12) |
| 332 | 332 | ||
| 333 | #define EXT_RGMII_OOB_CTRL 0x0C | 333 | #define EXT_RGMII_OOB_CTRL 0x0C |
| 334 | #define RGMII_MODE_EN (1 << 0) | ||
| 335 | #define RGMII_LINK (1 << 4) | 334 | #define RGMII_LINK (1 << 4) |
| 336 | #define OOB_DISABLE (1 << 5) | 335 | #define OOB_DISABLE (1 << 5) |
| 336 | #define RGMII_MODE_EN (1 << 6) | ||
| 337 | #define ID_MODE_DIS (1 << 16) | 337 | #define ID_MODE_DIS (1 << 16) |
| 338 | 338 | ||
| 339 | #define EXT_GPHY_CTRL 0x1C | 339 | #define EXT_GPHY_CTRL 0x1C |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 34a26e42f19d..1e187fb760f8 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -2902,7 +2902,7 @@ static int be_open(struct net_device *netdev) | |||
| 2902 | for_all_evt_queues(adapter, eqo, i) { | 2902 | for_all_evt_queues(adapter, eqo, i) { |
| 2903 | napi_enable(&eqo->napi); | 2903 | napi_enable(&eqo->napi); |
| 2904 | be_enable_busy_poll(eqo); | 2904 | be_enable_busy_poll(eqo); |
| 2905 | be_eq_notify(adapter, eqo->q.id, true, false, 0); | 2905 | be_eq_notify(adapter, eqo->q.id, true, true, 0); |
| 2906 | } | 2906 | } |
| 2907 | adapter->flags |= BE_FLAGS_NAPI_ENABLED; | 2907 | adapter->flags |= BE_FLAGS_NAPI_ENABLED; |
| 2908 | 2908 | ||
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index fab39e295441..36fc429298e3 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
| @@ -2990,11 +2990,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
| 2990 | if (ug_info->rxExtendedFiltering) { | 2990 | if (ug_info->rxExtendedFiltering) { |
| 2991 | size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; | 2991 | size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; |
| 2992 | if (ug_info->largestexternallookupkeysize == | 2992 | if (ug_info->largestexternallookupkeysize == |
| 2993 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES) | 2993 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) |
| 2994 | size += | 2994 | size += |
| 2995 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8; | 2995 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8; |
| 2996 | if (ug_info->largestexternallookupkeysize == | 2996 | if (ug_info->largestexternallookupkeysize == |
| 2997 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES) | 2997 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES) |
| 2998 | size += | 2998 | size += |
| 2999 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16; | 2999 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16; |
| 3000 | } | 3000 | } |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index a2db388cc31e..ee74f9536b31 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
| @@ -1481,6 +1481,13 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw) | |||
| 1481 | s32 ret_val; | 1481 | s32 ret_val; |
| 1482 | u16 i, rar_count = mac->rar_entry_count; | 1482 | u16 i, rar_count = mac->rar_entry_count; |
| 1483 | 1483 | ||
| 1484 | if ((hw->mac.type >= e1000_i210) && | ||
| 1485 | !(igb_get_flash_presence_i210(hw))) { | ||
| 1486 | ret_val = igb_pll_workaround_i210(hw); | ||
| 1487 | if (ret_val) | ||
| 1488 | return ret_val; | ||
| 1489 | } | ||
| 1490 | |||
| 1484 | /* Initialize identification LED */ | 1491 | /* Initialize identification LED */ |
| 1485 | ret_val = igb_id_led_init(hw); | 1492 | ret_val = igb_id_led_init(hw); |
| 1486 | if (ret_val) { | 1493 | if (ret_val) { |
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h index 2a8bb35c2df2..217f8138851b 100644 --- a/drivers/net/ethernet/intel/igb/e1000_defines.h +++ b/drivers/net/ethernet/intel/igb/e1000_defines.h | |||
| @@ -46,14 +46,15 @@ | |||
| 46 | #define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* SDP3 Data direction */ | 46 | #define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* SDP3 Data direction */ |
| 47 | 47 | ||
| 48 | /* Physical Func Reset Done Indication */ | 48 | /* Physical Func Reset Done Indication */ |
| 49 | #define E1000_CTRL_EXT_PFRSTD 0x00004000 | 49 | #define E1000_CTRL_EXT_PFRSTD 0x00004000 |
| 50 | #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 | 50 | #define E1000_CTRL_EXT_SDLPE 0X00040000 /* SerDes Low Power Enable */ |
| 51 | #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 | 51 | #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 |
| 52 | #define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000 | 52 | #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 |
| 53 | #define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000 | 53 | #define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000 |
| 54 | #define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 | 54 | #define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000 |
| 55 | #define E1000_CTRL_EXT_EIAME 0x01000000 | 55 | #define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 |
| 56 | #define E1000_CTRL_EXT_IRCA 0x00000001 | 56 | #define E1000_CTRL_EXT_EIAME 0x01000000 |
| 57 | #define E1000_CTRL_EXT_IRCA 0x00000001 | ||
| 57 | /* Interrupt delay cancellation */ | 58 | /* Interrupt delay cancellation */ |
| 58 | /* Driver loaded bit for FW */ | 59 | /* Driver loaded bit for FW */ |
| 59 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 | 60 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 |
| @@ -62,6 +63,7 @@ | |||
| 62 | /* packet buffer parity error detection enabled */ | 63 | /* packet buffer parity error detection enabled */ |
| 63 | /* descriptor FIFO parity error detection enable */ | 64 | /* descriptor FIFO parity error detection enable */ |
| 64 | #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ | 65 | #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ |
| 66 | #define E1000_CTRL_EXT_PHYPDEN 0x00100000 | ||
| 65 | #define E1000_I2CCMD_REG_ADDR_SHIFT 16 | 67 | #define E1000_I2CCMD_REG_ADDR_SHIFT 16 |
| 66 | #define E1000_I2CCMD_PHY_ADDR_SHIFT 24 | 68 | #define E1000_I2CCMD_PHY_ADDR_SHIFT 24 |
| 67 | #define E1000_I2CCMD_OPCODE_READ 0x08000000 | 69 | #define E1000_I2CCMD_OPCODE_READ 0x08000000 |
diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h index 89925e405849..ce55ea5d750c 100644 --- a/drivers/net/ethernet/intel/igb/e1000_hw.h +++ b/drivers/net/ethernet/intel/igb/e1000_hw.h | |||
| @@ -567,4 +567,7 @@ struct net_device *igb_get_hw_dev(struct e1000_hw *hw); | |||
| 567 | /* These functions must be implemented by drivers */ | 567 | /* These functions must be implemented by drivers */ |
| 568 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); | 568 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); |
| 569 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); | 569 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); |
| 570 | |||
| 571 | void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); | ||
| 572 | void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); | ||
| 570 | #endif /* _E1000_HW_H_ */ | 573 | #endif /* _E1000_HW_H_ */ |
diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c index 337161f440dd..65d931669f81 100644 --- a/drivers/net/ethernet/intel/igb/e1000_i210.c +++ b/drivers/net/ethernet/intel/igb/e1000_i210.c | |||
| @@ -834,3 +834,69 @@ s32 igb_init_nvm_params_i210(struct e1000_hw *hw) | |||
| 834 | } | 834 | } |
| 835 | return ret_val; | 835 | return ret_val; |
| 836 | } | 836 | } |
| 837 | |||
| 838 | /** | ||
| 839 | * igb_pll_workaround_i210 | ||
| 840 | * @hw: pointer to the HW structure | ||
| 841 | * | ||
| 842 | * Works around an errata in the PLL circuit where it occasionally | ||
| 843 | * provides the wrong clock frequency after power up. | ||
| 844 | **/ | ||
| 845 | s32 igb_pll_workaround_i210(struct e1000_hw *hw) | ||
| 846 | { | ||
| 847 | s32 ret_val; | ||
| 848 | u32 wuc, mdicnfg, ctrl, ctrl_ext, reg_val; | ||
| 849 | u16 nvm_word, phy_word, pci_word, tmp_nvm; | ||
| 850 | int i; | ||
| 851 | |||
| 852 | /* Get and set needed register values */ | ||
| 853 | wuc = rd32(E1000_WUC); | ||
| 854 | mdicnfg = rd32(E1000_MDICNFG); | ||
| 855 | reg_val = mdicnfg & ~E1000_MDICNFG_EXT_MDIO; | ||
| 856 | wr32(E1000_MDICNFG, reg_val); | ||
| 857 | |||
| 858 | /* Get data from NVM, or set default */ | ||
| 859 | ret_val = igb_read_invm_word_i210(hw, E1000_INVM_AUTOLOAD, | ||
| 860 | &nvm_word); | ||
| 861 | if (ret_val) | ||
| 862 | nvm_word = E1000_INVM_DEFAULT_AL; | ||
| 863 | tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; | ||
| 864 | for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { | ||
| 865 | /* check current state directly from internal PHY */ | ||
| 866 | igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE | | ||
| 867 | E1000_PHY_PLL_FREQ_REG), &phy_word); | ||
| 868 | if ((phy_word & E1000_PHY_PLL_UNCONF) | ||
| 869 | != E1000_PHY_PLL_UNCONF) { | ||
| 870 | ret_val = 0; | ||
| 871 | break; | ||
| 872 | } else { | ||
| 873 | ret_val = -E1000_ERR_PHY; | ||
| 874 | } | ||
| 875 | /* directly reset the internal PHY */ | ||
| 876 | ctrl = rd32(E1000_CTRL); | ||
| 877 | wr32(E1000_CTRL, ctrl|E1000_CTRL_PHY_RST); | ||
| 878 | |||
| 879 | ctrl_ext = rd32(E1000_CTRL_EXT); | ||
| 880 | ctrl_ext |= (E1000_CTRL_EXT_PHYPDEN | E1000_CTRL_EXT_SDLPE); | ||
| 881 | wr32(E1000_CTRL_EXT, ctrl_ext); | ||
| 882 | |||
| 883 | wr32(E1000_WUC, 0); | ||
| 884 | reg_val = (E1000_INVM_AUTOLOAD << 4) | (tmp_nvm << 16); | ||
| 885 | wr32(E1000_EEARBC_I210, reg_val); | ||
| 886 | |||
| 887 | igb_read_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); | ||
| 888 | pci_word |= E1000_PCI_PMCSR_D3; | ||
| 889 | igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); | ||
| 890 | usleep_range(1000, 2000); | ||
| 891 | pci_word &= ~E1000_PCI_PMCSR_D3; | ||
| 892 | igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); | ||
| 893 | reg_val = (E1000_INVM_AUTOLOAD << 4) | (nvm_word << 16); | ||
| 894 | wr32(E1000_EEARBC_I210, reg_val); | ||
| 895 | |||
| 896 | /* restore WUC register */ | ||
| 897 | wr32(E1000_WUC, wuc); | ||
| 898 | } | ||
| 899 | /* restore MDICNFG setting */ | ||
| 900 | wr32(E1000_MDICNFG, mdicnfg); | ||
| 901 | return ret_val; | ||
| 902 | } | ||
diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.h b/drivers/net/ethernet/intel/igb/e1000_i210.h index 9f34976687ba..3442b6357d01 100644 --- a/drivers/net/ethernet/intel/igb/e1000_i210.h +++ b/drivers/net/ethernet/intel/igb/e1000_i210.h | |||
| @@ -33,6 +33,7 @@ s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data); | |||
| 33 | s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data); | 33 | s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data); |
| 34 | s32 igb_init_nvm_params_i210(struct e1000_hw *hw); | 34 | s32 igb_init_nvm_params_i210(struct e1000_hw *hw); |
| 35 | bool igb_get_flash_presence_i210(struct e1000_hw *hw); | 35 | bool igb_get_flash_presence_i210(struct e1000_hw *hw); |
| 36 | s32 igb_pll_workaround_i210(struct e1000_hw *hw); | ||
| 36 | 37 | ||
| 37 | #define E1000_STM_OPCODE 0xDB00 | 38 | #define E1000_STM_OPCODE 0xDB00 |
| 38 | #define E1000_EEPROM_FLASH_SIZE_WORD 0x11 | 39 | #define E1000_EEPROM_FLASH_SIZE_WORD 0x11 |
| @@ -78,4 +79,15 @@ enum E1000_INVM_STRUCTURE_TYPE { | |||
| 78 | #define NVM_LED_1_CFG_DEFAULT_I211 0x0184 | 79 | #define NVM_LED_1_CFG_DEFAULT_I211 0x0184 |
| 79 | #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C | 80 | #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C |
| 80 | 81 | ||
| 82 | /* PLL Defines */ | ||
| 83 | #define E1000_PCI_PMCSR 0x44 | ||
| 84 | #define E1000_PCI_PMCSR_D3 0x03 | ||
| 85 | #define E1000_MAX_PLL_TRIES 5 | ||
| 86 | #define E1000_PHY_PLL_UNCONF 0xFF | ||
| 87 | #define E1000_PHY_PLL_FREQ_PAGE 0xFC0000 | ||
| 88 | #define E1000_PHY_PLL_FREQ_REG 0x000E | ||
| 89 | #define E1000_INVM_DEFAULT_AL 0x202F | ||
| 90 | #define E1000_INVM_AUTOLOAD 0x0A | ||
| 91 | #define E1000_INVM_PLL_WO_VAL 0x0010 | ||
| 92 | |||
| 81 | #endif | 93 | #endif |
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h index 1cc4b1a7e597..f5ba4e4eafb9 100644 --- a/drivers/net/ethernet/intel/igb/e1000_regs.h +++ b/drivers/net/ethernet/intel/igb/e1000_regs.h | |||
| @@ -66,6 +66,7 @@ | |||
| 66 | #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ | 66 | #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ |
| 67 | #define E1000_PBS 0x01008 /* Packet Buffer Size */ | 67 | #define E1000_PBS 0x01008 /* Packet Buffer Size */ |
| 68 | #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ | 68 | #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ |
| 69 | #define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */ | ||
| 69 | #define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */ | 70 | #define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */ |
| 70 | #define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */ | 71 | #define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */ |
| 71 | #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */ | 72 | #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index f145adbb55ac..a9537ba7a5a0 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
| @@ -7215,6 +7215,20 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
| 7215 | } | 7215 | } |
| 7216 | } | 7216 | } |
| 7217 | 7217 | ||
| 7218 | void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) | ||
| 7219 | { | ||
| 7220 | struct igb_adapter *adapter = hw->back; | ||
| 7221 | |||
| 7222 | pci_read_config_word(adapter->pdev, reg, value); | ||
| 7223 | } | ||
| 7224 | |||
| 7225 | void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) | ||
| 7226 | { | ||
| 7227 | struct igb_adapter *adapter = hw->back; | ||
| 7228 | |||
| 7229 | pci_write_config_word(adapter->pdev, reg, *value); | ||
| 7230 | } | ||
| 7231 | |||
| 7218 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) | 7232 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) |
| 7219 | { | 7233 | { |
| 7220 | struct igb_adapter *adapter = hw->back; | 7234 | struct igb_adapter *adapter = hw->back; |
| @@ -7578,6 +7592,8 @@ static int igb_sriov_reinit(struct pci_dev *dev) | |||
| 7578 | 7592 | ||
| 7579 | if (netif_running(netdev)) | 7593 | if (netif_running(netdev)) |
| 7580 | igb_close(netdev); | 7594 | igb_close(netdev); |
| 7595 | else | ||
| 7596 | igb_reset(adapter); | ||
| 7581 | 7597 | ||
| 7582 | igb_clear_interrupt_scheme(adapter); | 7598 | igb_clear_interrupt_scheme(adapter); |
| 7583 | 7599 | ||
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 45beca17fa50..dadd9a5f6323 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
| @@ -1207,7 +1207,7 @@ static u32 mvneta_txq_desc_csum(int l3_offs, int l3_proto, | |||
| 1207 | command = l3_offs << MVNETA_TX_L3_OFF_SHIFT; | 1207 | command = l3_offs << MVNETA_TX_L3_OFF_SHIFT; |
| 1208 | command |= ip_hdr_len << MVNETA_TX_IP_HLEN_SHIFT; | 1208 | command |= ip_hdr_len << MVNETA_TX_IP_HLEN_SHIFT; |
| 1209 | 1209 | ||
| 1210 | if (l3_proto == swab16(ETH_P_IP)) | 1210 | if (l3_proto == htons(ETH_P_IP)) |
| 1211 | command |= MVNETA_TXD_IP_CSUM; | 1211 | command |= MVNETA_TXD_IP_CSUM; |
| 1212 | else | 1212 | else |
| 1213 | command |= MVNETA_TX_L3_IP6; | 1213 | command |= MVNETA_TX_L3_IP6; |
| @@ -2529,7 +2529,7 @@ static void mvneta_adjust_link(struct net_device *ndev) | |||
| 2529 | 2529 | ||
| 2530 | if (phydev->speed == SPEED_1000) | 2530 | if (phydev->speed == SPEED_1000) |
| 2531 | val |= MVNETA_GMAC_CONFIG_GMII_SPEED; | 2531 | val |= MVNETA_GMAC_CONFIG_GMII_SPEED; |
| 2532 | else | 2532 | else if (phydev->speed == SPEED_100) |
| 2533 | val |= MVNETA_GMAC_CONFIG_MII_SPEED; | 2533 | val |= MVNETA_GMAC_CONFIG_MII_SPEED; |
| 2534 | 2534 | ||
| 2535 | mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); | 2535 | mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c index 80f725228f5b..56022d647837 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/cq.c | |||
| @@ -294,8 +294,6 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, | |||
| 294 | init_completion(&cq->free); | 294 | init_completion(&cq->free); |
| 295 | 295 | ||
| 296 | cq->irq = priv->eq_table.eq[cq->vector].irq; | 296 | cq->irq = priv->eq_table.eq[cq->vector].irq; |
| 297 | cq->irq_affinity_change = false; | ||
| 298 | |||
| 299 | return 0; | 297 | return 0; |
| 300 | 298 | ||
| 301 | err_radix: | 299 | err_radix: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c index 4b2130760eed..14c00048bbec 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c | |||
| @@ -128,6 +128,10 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, | |||
| 128 | mlx4_warn(mdev, "Failed assigning an EQ to %s, falling back to legacy EQ's\n", | 128 | mlx4_warn(mdev, "Failed assigning an EQ to %s, falling back to legacy EQ's\n", |
| 129 | name); | 129 | name); |
| 130 | } | 130 | } |
| 131 | |||
| 132 | cq->irq_desc = | ||
| 133 | irq_to_desc(mlx4_eq_get_irq(mdev->dev, | ||
| 134 | cq->vector)); | ||
| 131 | } | 135 | } |
| 132 | } else { | 136 | } else { |
| 133 | cq->vector = (cq->ring + 1 + priv->port) % | 137 | cq->vector = (cq->ring + 1 + priv->port) % |
| @@ -187,8 +191,6 @@ void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq) | |||
| 187 | mlx4_en_unmap_buffer(&cq->wqres.buf); | 191 | mlx4_en_unmap_buffer(&cq->wqres.buf); |
| 188 | mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); | 192 | mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); |
| 189 | if (priv->mdev->dev->caps.comp_pool && cq->vector) { | 193 | if (priv->mdev->dev->caps.comp_pool && cq->vector) { |
| 190 | if (!cq->is_tx) | ||
| 191 | irq_set_affinity_hint(cq->mcq.irq, NULL); | ||
| 192 | mlx4_release_eq(priv->mdev->dev, cq->vector); | 194 | mlx4_release_eq(priv->mdev->dev, cq->vector); |
| 193 | } | 195 | } |
| 194 | cq->vector = 0; | 196 | cq->vector = 0; |
| @@ -204,6 +206,7 @@ void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) | |||
| 204 | if (!cq->is_tx) { | 206 | if (!cq->is_tx) { |
| 205 | napi_hash_del(&cq->napi); | 207 | napi_hash_del(&cq->napi); |
| 206 | synchronize_rcu(); | 208 | synchronize_rcu(); |
| 209 | irq_set_affinity_hint(cq->mcq.irq, NULL); | ||
| 207 | } | 210 | } |
| 208 | netif_napi_del(&cq->napi); | 211 | netif_napi_del(&cq->napi); |
| 209 | 212 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index fa1a069e14e6..68d763d2d030 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
| @@ -417,6 +417,8 @@ static int mlx4_en_get_coalesce(struct net_device *dev, | |||
| 417 | 417 | ||
| 418 | coal->tx_coalesce_usecs = priv->tx_usecs; | 418 | coal->tx_coalesce_usecs = priv->tx_usecs; |
| 419 | coal->tx_max_coalesced_frames = priv->tx_frames; | 419 | coal->tx_max_coalesced_frames = priv->tx_frames; |
| 420 | coal->tx_max_coalesced_frames_irq = priv->tx_work_limit; | ||
| 421 | |||
| 420 | coal->rx_coalesce_usecs = priv->rx_usecs; | 422 | coal->rx_coalesce_usecs = priv->rx_usecs; |
| 421 | coal->rx_max_coalesced_frames = priv->rx_frames; | 423 | coal->rx_max_coalesced_frames = priv->rx_frames; |
| 422 | 424 | ||
| @@ -426,6 +428,7 @@ static int mlx4_en_get_coalesce(struct net_device *dev, | |||
| 426 | coal->rx_coalesce_usecs_high = priv->rx_usecs_high; | 428 | coal->rx_coalesce_usecs_high = priv->rx_usecs_high; |
| 427 | coal->rate_sample_interval = priv->sample_interval; | 429 | coal->rate_sample_interval = priv->sample_interval; |
| 428 | coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal; | 430 | coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal; |
| 431 | |||
| 429 | return 0; | 432 | return 0; |
| 430 | } | 433 | } |
| 431 | 434 | ||
| @@ -434,6 +437,9 @@ static int mlx4_en_set_coalesce(struct net_device *dev, | |||
| 434 | { | 437 | { |
| 435 | struct mlx4_en_priv *priv = netdev_priv(dev); | 438 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 436 | 439 | ||
| 440 | if (!coal->tx_max_coalesced_frames_irq) | ||
| 441 | return -EINVAL; | ||
| 442 | |||
| 437 | priv->rx_frames = (coal->rx_max_coalesced_frames == | 443 | priv->rx_frames = (coal->rx_max_coalesced_frames == |
| 438 | MLX4_EN_AUTO_CONF) ? | 444 | MLX4_EN_AUTO_CONF) ? |
| 439 | MLX4_EN_RX_COAL_TARGET : | 445 | MLX4_EN_RX_COAL_TARGET : |
| @@ -457,6 +463,7 @@ static int mlx4_en_set_coalesce(struct net_device *dev, | |||
| 457 | priv->rx_usecs_high = coal->rx_coalesce_usecs_high; | 463 | priv->rx_usecs_high = coal->rx_coalesce_usecs_high; |
| 458 | priv->sample_interval = coal->rate_sample_interval; | 464 | priv->sample_interval = coal->rate_sample_interval; |
| 459 | priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce; | 465 | priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce; |
| 466 | priv->tx_work_limit = coal->tx_max_coalesced_frames_irq; | ||
| 460 | 467 | ||
| 461 | return mlx4_en_moderation_update(priv); | 468 | return mlx4_en_moderation_update(priv); |
| 462 | } | 469 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 7d4fb7bf2593..7345c43b019e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -2336,7 +2336,7 @@ static void mlx4_en_add_vxlan_port(struct net_device *dev, | |||
| 2336 | struct mlx4_en_priv *priv = netdev_priv(dev); | 2336 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 2337 | __be16 current_port; | 2337 | __be16 current_port; |
| 2338 | 2338 | ||
| 2339 | if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS)) | 2339 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
| 2340 | return; | 2340 | return; |
| 2341 | 2341 | ||
| 2342 | if (sa_family == AF_INET6) | 2342 | if (sa_family == AF_INET6) |
| @@ -2473,6 +2473,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
| 2473 | MLX4_WQE_CTRL_SOLICITED); | 2473 | MLX4_WQE_CTRL_SOLICITED); |
| 2474 | priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up; | 2474 | priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up; |
| 2475 | priv->tx_ring_num = prof->tx_ring_num; | 2475 | priv->tx_ring_num = prof->tx_ring_num; |
| 2476 | priv->tx_work_limit = MLX4_EN_DEFAULT_TX_WORK; | ||
| 2476 | 2477 | ||
| 2477 | priv->tx_ring = kzalloc(sizeof(struct mlx4_en_tx_ring *) * MAX_TX_RINGS, | 2478 | priv->tx_ring = kzalloc(sizeof(struct mlx4_en_tx_ring *) * MAX_TX_RINGS, |
| 2478 | GFP_KERNEL); | 2479 | GFP_KERNEL); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index d2d415732d99..5535862f27cc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include <linux/if_ether.h> | 40 | #include <linux/if_ether.h> |
| 41 | #include <linux/if_vlan.h> | 41 | #include <linux/if_vlan.h> |
| 42 | #include <linux/vmalloc.h> | 42 | #include <linux/vmalloc.h> |
| 43 | #include <linux/irq.h> | ||
| 43 | 44 | ||
| 44 | #include "mlx4_en.h" | 45 | #include "mlx4_en.h" |
| 45 | 46 | ||
| @@ -782,6 +783,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
| 782 | PKT_HASH_TYPE_L3); | 783 | PKT_HASH_TYPE_L3); |
| 783 | 784 | ||
| 784 | skb_record_rx_queue(gro_skb, cq->ring); | 785 | skb_record_rx_queue(gro_skb, cq->ring); |
| 786 | skb_mark_napi_id(gro_skb, &cq->napi); | ||
| 785 | 787 | ||
| 786 | if (ring->hwtstamp_rx_filter == HWTSTAMP_FILTER_ALL) { | 788 | if (ring->hwtstamp_rx_filter == HWTSTAMP_FILTER_ALL) { |
| 787 | timestamp = mlx4_en_get_cqe_ts(cqe); | 789 | timestamp = mlx4_en_get_cqe_ts(cqe); |
| @@ -896,16 +898,25 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget) | |||
| 896 | 898 | ||
| 897 | /* If we used up all the quota - we're probably not done yet... */ | 899 | /* If we used up all the quota - we're probably not done yet... */ |
| 898 | if (done == budget) { | 900 | if (done == budget) { |
| 901 | int cpu_curr; | ||
| 902 | const struct cpumask *aff; | ||
| 903 | |||
| 899 | INC_PERF_COUNTER(priv->pstats.napi_quota); | 904 | INC_PERF_COUNTER(priv->pstats.napi_quota); |
| 900 | if (unlikely(cq->mcq.irq_affinity_change)) { | 905 | |
| 901 | cq->mcq.irq_affinity_change = false; | 906 | cpu_curr = smp_processor_id(); |
| 907 | aff = irq_desc_get_irq_data(cq->irq_desc)->affinity; | ||
| 908 | |||
| 909 | if (unlikely(!cpumask_test_cpu(cpu_curr, aff))) { | ||
| 910 | /* Current cpu is not according to smp_irq_affinity - | ||
| 911 | * probably affinity changed. need to stop this NAPI | ||
| 912 | * poll, and restart it on the right CPU | ||
| 913 | */ | ||
| 902 | napi_complete(napi); | 914 | napi_complete(napi); |
| 903 | mlx4_en_arm_cq(priv, cq); | 915 | mlx4_en_arm_cq(priv, cq); |
| 904 | return 0; | 916 | return 0; |
| 905 | } | 917 | } |
| 906 | } else { | 918 | } else { |
| 907 | /* Done for now */ | 919 | /* Done for now */ |
| 908 | cq->mcq.irq_affinity_change = false; | ||
| 909 | napi_complete(napi); | 920 | napi_complete(napi); |
| 910 | mlx4_en_arm_cq(priv, cq); | 921 | mlx4_en_arm_cq(priv, cq); |
| 911 | } | 922 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 8be7483f8236..5045bab59633 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
| @@ -351,9 +351,8 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring) | |||
| 351 | return cnt; | 351 | return cnt; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | static int mlx4_en_process_tx_cq(struct net_device *dev, | 354 | static bool mlx4_en_process_tx_cq(struct net_device *dev, |
| 355 | struct mlx4_en_cq *cq, | 355 | struct mlx4_en_cq *cq) |
| 356 | int budget) | ||
| 357 | { | 356 | { |
| 358 | struct mlx4_en_priv *priv = netdev_priv(dev); | 357 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 359 | struct mlx4_cq *mcq = &cq->mcq; | 358 | struct mlx4_cq *mcq = &cq->mcq; |
| @@ -372,9 +371,10 @@ static int mlx4_en_process_tx_cq(struct net_device *dev, | |||
| 372 | int factor = priv->cqe_factor; | 371 | int factor = priv->cqe_factor; |
| 373 | u64 timestamp = 0; | 372 | u64 timestamp = 0; |
| 374 | int done = 0; | 373 | int done = 0; |
| 374 | int budget = priv->tx_work_limit; | ||
| 375 | 375 | ||
| 376 | if (!priv->port_up) | 376 | if (!priv->port_up) |
| 377 | return 0; | 377 | return true; |
| 378 | 378 | ||
| 379 | index = cons_index & size_mask; | 379 | index = cons_index & size_mask; |
| 380 | cqe = &buf[(index << factor) + factor]; | 380 | cqe = &buf[(index << factor) + factor]; |
| @@ -447,7 +447,7 @@ static int mlx4_en_process_tx_cq(struct net_device *dev, | |||
| 447 | netif_tx_wake_queue(ring->tx_queue); | 447 | netif_tx_wake_queue(ring->tx_queue); |
| 448 | ring->wake_queue++; | 448 | ring->wake_queue++; |
| 449 | } | 449 | } |
| 450 | return done; | 450 | return done < budget; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | void mlx4_en_tx_irq(struct mlx4_cq *mcq) | 453 | void mlx4_en_tx_irq(struct mlx4_cq *mcq) |
| @@ -467,24 +467,16 @@ int mlx4_en_poll_tx_cq(struct napi_struct *napi, int budget) | |||
| 467 | struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); | 467 | struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); |
| 468 | struct net_device *dev = cq->dev; | 468 | struct net_device *dev = cq->dev; |
| 469 | struct mlx4_en_priv *priv = netdev_priv(dev); | 469 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 470 | int done; | 470 | int clean_complete; |
| 471 | 471 | ||
| 472 | done = mlx4_en_process_tx_cq(dev, cq, budget); | 472 | clean_complete = mlx4_en_process_tx_cq(dev, cq); |
| 473 | if (!clean_complete) | ||
| 474 | return budget; | ||
| 473 | 475 | ||
| 474 | /* If we used up all the quota - we're probably not done yet... */ | 476 | napi_complete(napi); |
| 475 | if (done < budget) { | 477 | mlx4_en_arm_cq(priv, cq); |
| 476 | /* Done for now */ | 478 | |
| 477 | cq->mcq.irq_affinity_change = false; | 479 | return 0; |
| 478 | napi_complete(napi); | ||
| 479 | mlx4_en_arm_cq(priv, cq); | ||
| 480 | return done; | ||
| 481 | } else if (unlikely(cq->mcq.irq_affinity_change)) { | ||
| 482 | cq->mcq.irq_affinity_change = false; | ||
| 483 | napi_complete(napi); | ||
| 484 | mlx4_en_arm_cq(priv, cq); | ||
| 485 | return 0; | ||
| 486 | } | ||
| 487 | return budget; | ||
| 488 | } | 480 | } |
| 489 | 481 | ||
| 490 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, | 482 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index d954ec1eac17..2a004b347e1d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
| @@ -53,11 +53,6 @@ enum { | |||
| 53 | MLX4_EQ_ENTRY_SIZE = 0x20 | 53 | MLX4_EQ_ENTRY_SIZE = 0x20 |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | struct mlx4_irq_notify { | ||
| 57 | void *arg; | ||
| 58 | struct irq_affinity_notify notify; | ||
| 59 | }; | ||
| 60 | |||
| 61 | #define MLX4_EQ_STATUS_OK ( 0 << 28) | 56 | #define MLX4_EQ_STATUS_OK ( 0 << 28) |
| 62 | #define MLX4_EQ_STATUS_WRITE_FAIL (10 << 28) | 57 | #define MLX4_EQ_STATUS_WRITE_FAIL (10 << 28) |
| 63 | #define MLX4_EQ_OWNER_SW ( 0 << 24) | 58 | #define MLX4_EQ_OWNER_SW ( 0 << 24) |
| @@ -1088,57 +1083,6 @@ static void mlx4_unmap_clr_int(struct mlx4_dev *dev) | |||
| 1088 | iounmap(priv->clr_base); | 1083 | iounmap(priv->clr_base); |
| 1089 | } | 1084 | } |
| 1090 | 1085 | ||
| 1091 | static void mlx4_irq_notifier_notify(struct irq_affinity_notify *notify, | ||
| 1092 | const cpumask_t *mask) | ||
| 1093 | { | ||
| 1094 | struct mlx4_irq_notify *n = container_of(notify, | ||
| 1095 | struct mlx4_irq_notify, | ||
| 1096 | notify); | ||
| 1097 | struct mlx4_priv *priv = (struct mlx4_priv *)n->arg; | ||
| 1098 | struct radix_tree_iter iter; | ||
| 1099 | void **slot; | ||
| 1100 | |||
| 1101 | radix_tree_for_each_slot(slot, &priv->cq_table.tree, &iter, 0) { | ||
| 1102 | struct mlx4_cq *cq = (struct mlx4_cq *)(*slot); | ||
| 1103 | |||
| 1104 | if (cq->irq == notify->irq) | ||
| 1105 | cq->irq_affinity_change = true; | ||
| 1106 | } | ||
| 1107 | } | ||
| 1108 | |||
| 1109 | static void mlx4_release_irq_notifier(struct kref *ref) | ||
| 1110 | { | ||
| 1111 | struct mlx4_irq_notify *n = container_of(ref, struct mlx4_irq_notify, | ||
| 1112 | notify.kref); | ||
| 1113 | kfree(n); | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | static void mlx4_assign_irq_notifier(struct mlx4_priv *priv, | ||
| 1117 | struct mlx4_dev *dev, int irq) | ||
| 1118 | { | ||
| 1119 | struct mlx4_irq_notify *irq_notifier = NULL; | ||
| 1120 | int err = 0; | ||
| 1121 | |||
| 1122 | irq_notifier = kzalloc(sizeof(*irq_notifier), GFP_KERNEL); | ||
| 1123 | if (!irq_notifier) { | ||
| 1124 | mlx4_warn(dev, "Failed to allocate irq notifier. irq %d\n", | ||
| 1125 | irq); | ||
| 1126 | return; | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | irq_notifier->notify.irq = irq; | ||
| 1130 | irq_notifier->notify.notify = mlx4_irq_notifier_notify; | ||
| 1131 | irq_notifier->notify.release = mlx4_release_irq_notifier; | ||
| 1132 | irq_notifier->arg = priv; | ||
| 1133 | err = irq_set_affinity_notifier(irq, &irq_notifier->notify); | ||
| 1134 | if (err) { | ||
| 1135 | kfree(irq_notifier); | ||
| 1136 | irq_notifier = NULL; | ||
| 1137 | mlx4_warn(dev, "Failed to set irq notifier. irq %d\n", irq); | ||
| 1138 | } | ||
| 1139 | } | ||
| 1140 | |||
| 1141 | |||
| 1142 | int mlx4_alloc_eq_table(struct mlx4_dev *dev) | 1086 | int mlx4_alloc_eq_table(struct mlx4_dev *dev) |
| 1143 | { | 1087 | { |
| 1144 | struct mlx4_priv *priv = mlx4_priv(dev); | 1088 | struct mlx4_priv *priv = mlx4_priv(dev); |
| @@ -1409,8 +1353,6 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | |||
| 1409 | continue; | 1353 | continue; |
| 1410 | /*we dont want to break here*/ | 1354 | /*we dont want to break here*/ |
| 1411 | } | 1355 | } |
| 1412 | mlx4_assign_irq_notifier(priv, dev, | ||
| 1413 | priv->eq_table.eq[vec].irq); | ||
| 1414 | 1356 | ||
| 1415 | eq_set_ci(&priv->eq_table.eq[vec], 1); | 1357 | eq_set_ci(&priv->eq_table.eq[vec], 1); |
| 1416 | } | 1358 | } |
| @@ -1427,6 +1369,14 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | |||
| 1427 | } | 1369 | } |
| 1428 | EXPORT_SYMBOL(mlx4_assign_eq); | 1370 | EXPORT_SYMBOL(mlx4_assign_eq); |
| 1429 | 1371 | ||
| 1372 | int mlx4_eq_get_irq(struct mlx4_dev *dev, int vec) | ||
| 1373 | { | ||
| 1374 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
| 1375 | |||
| 1376 | return priv->eq_table.eq[vec].irq; | ||
| 1377 | } | ||
| 1378 | EXPORT_SYMBOL(mlx4_eq_get_irq); | ||
| 1379 | |||
| 1430 | void mlx4_release_eq(struct mlx4_dev *dev, int vec) | 1380 | void mlx4_release_eq(struct mlx4_dev *dev, int vec) |
| 1431 | { | 1381 | { |
| 1432 | struct mlx4_priv *priv = mlx4_priv(dev); | 1382 | struct mlx4_priv *priv = mlx4_priv(dev); |
| @@ -1438,9 +1388,6 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec) | |||
| 1438 | Belonging to a legacy EQ*/ | 1388 | Belonging to a legacy EQ*/ |
| 1439 | mutex_lock(&priv->msix_ctl.pool_lock); | 1389 | mutex_lock(&priv->msix_ctl.pool_lock); |
| 1440 | if (priv->msix_ctl.pool_bm & 1ULL << i) { | 1390 | if (priv->msix_ctl.pool_bm & 1ULL << i) { |
| 1441 | irq_set_affinity_notifier( | ||
| 1442 | priv->eq_table.eq[vec].irq, | ||
| 1443 | NULL); | ||
| 1444 | free_irq(priv->eq_table.eq[vec].irq, | 1391 | free_irq(priv->eq_table.eq[vec].irq, |
| 1445 | &priv->eq_table.eq[vec]); | 1392 | &priv->eq_table.eq[vec]); |
| 1446 | priv->msix_ctl.pool_bm &= ~(1ULL << i); | 1393 | priv->msix_ctl.pool_bm &= ~(1ULL << i); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 0e15295bedd6..d72a5a894fc6 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
| @@ -126,6 +126,8 @@ enum { | |||
| 126 | #define MAX_TX_RINGS (MLX4_EN_MAX_TX_RING_P_UP * \ | 126 | #define MAX_TX_RINGS (MLX4_EN_MAX_TX_RING_P_UP * \ |
| 127 | MLX4_EN_NUM_UP) | 127 | MLX4_EN_NUM_UP) |
| 128 | 128 | ||
| 129 | #define MLX4_EN_DEFAULT_TX_WORK 256 | ||
| 130 | |||
| 129 | /* Target number of packets to coalesce with interrupt moderation */ | 131 | /* Target number of packets to coalesce with interrupt moderation */ |
| 130 | #define MLX4_EN_RX_COAL_TARGET 44 | 132 | #define MLX4_EN_RX_COAL_TARGET 44 |
| 131 | #define MLX4_EN_RX_COAL_TIME 0x10 | 133 | #define MLX4_EN_RX_COAL_TIME 0x10 |
| @@ -343,6 +345,7 @@ struct mlx4_en_cq { | |||
| 343 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) | 345 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) |
| 344 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ | 346 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ |
| 345 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | 347 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
| 348 | struct irq_desc *irq_desc; | ||
| 346 | }; | 349 | }; |
| 347 | 350 | ||
| 348 | struct mlx4_en_port_profile { | 351 | struct mlx4_en_port_profile { |
| @@ -542,6 +545,7 @@ struct mlx4_en_priv { | |||
| 542 | __be32 ctrl_flags; | 545 | __be32 ctrl_flags; |
| 543 | u32 flags; | 546 | u32 flags; |
| 544 | u8 num_tx_rings_p_up; | 547 | u8 num_tx_rings_p_up; |
| 548 | u32 tx_work_limit; | ||
| 545 | u32 tx_ring_num; | 549 | u32 tx_ring_num; |
| 546 | u32 rx_ring_num; | 550 | u32 rx_ring_num; |
| 547 | u32 rx_skb_size; | 551 | u32 rx_skb_size; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c index ba0401d4af50..184c3615f479 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c | |||
| @@ -94,6 +94,11 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, | |||
| 94 | write_lock_irq(&table->lock); | 94 | write_lock_irq(&table->lock); |
| 95 | err = radix_tree_insert(&table->tree, mlx5_base_mkey(mr->key), mr); | 95 | err = radix_tree_insert(&table->tree, mlx5_base_mkey(mr->key), mr); |
| 96 | write_unlock_irq(&table->lock); | 96 | write_unlock_irq(&table->lock); |
| 97 | if (err) { | ||
| 98 | mlx5_core_warn(dev, "failed radix tree insert of mr 0x%x, %d\n", | ||
| 99 | mlx5_base_mkey(mr->key), err); | ||
| 100 | mlx5_core_destroy_mkey(dev, mr); | ||
| 101 | } | ||
| 97 | 102 | ||
| 98 | return err; | 103 | return err; |
| 99 | } | 104 | } |
| @@ -104,12 +109,22 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr) | |||
| 104 | struct mlx5_mr_table *table = &dev->priv.mr_table; | 109 | struct mlx5_mr_table *table = &dev->priv.mr_table; |
| 105 | struct mlx5_destroy_mkey_mbox_in in; | 110 | struct mlx5_destroy_mkey_mbox_in in; |
| 106 | struct mlx5_destroy_mkey_mbox_out out; | 111 | struct mlx5_destroy_mkey_mbox_out out; |
| 112 | struct mlx5_core_mr *deleted_mr; | ||
| 107 | unsigned long flags; | 113 | unsigned long flags; |
| 108 | int err; | 114 | int err; |
| 109 | 115 | ||
| 110 | memset(&in, 0, sizeof(in)); | 116 | memset(&in, 0, sizeof(in)); |
| 111 | memset(&out, 0, sizeof(out)); | 117 | memset(&out, 0, sizeof(out)); |
| 112 | 118 | ||
| 119 | write_lock_irqsave(&table->lock, flags); | ||
| 120 | deleted_mr = radix_tree_delete(&table->tree, mlx5_base_mkey(mr->key)); | ||
| 121 | write_unlock_irqrestore(&table->lock, flags); | ||
| 122 | if (!deleted_mr) { | ||
| 123 | mlx5_core_warn(dev, "failed radix tree delete of mr 0x%x\n", | ||
| 124 | mlx5_base_mkey(mr->key)); | ||
| 125 | return -ENOENT; | ||
| 126 | } | ||
| 127 | |||
| 113 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_MKEY); | 128 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_MKEY); |
| 114 | in.mkey = cpu_to_be32(mlx5_mkey_to_idx(mr->key)); | 129 | in.mkey = cpu_to_be32(mlx5_mkey_to_idx(mr->key)); |
| 115 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | 130 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); |
| @@ -119,10 +134,6 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr) | |||
| 119 | if (out.hdr.status) | 134 | if (out.hdr.status) |
| 120 | return mlx5_cmd_status_to_err(&out.hdr); | 135 | return mlx5_cmd_status_to_err(&out.hdr); |
| 121 | 136 | ||
| 122 | write_lock_irqsave(&table->lock, flags); | ||
| 123 | radix_tree_delete(&table->tree, mlx5_base_mkey(mr->key)); | ||
| 124 | write_unlock_irqrestore(&table->lock, flags); | ||
| 125 | |||
| 126 | return err; | 137 | return err; |
| 127 | } | 138 | } |
| 128 | EXPORT_SYMBOL(mlx5_core_destroy_mkey); | 139 | EXPORT_SYMBOL(mlx5_core_destroy_mkey); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index be425ad5e824..06bdc31a828d 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -538,6 +538,7 @@ enum rtl_register_content { | |||
| 538 | MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ | 538 | MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ |
| 539 | LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ | 539 | LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ |
| 540 | Jumbo_En0 = (1 << 2), /* 8168 only. Reserved in the 8168b */ | 540 | Jumbo_En0 = (1 << 2), /* 8168 only. Reserved in the 8168b */ |
| 541 | Rdy_to_L23 = (1 << 1), /* L23 Enable */ | ||
| 541 | Beacon_en = (1 << 0), /* 8168 only. Reserved in the 8168b */ | 542 | Beacon_en = (1 << 0), /* 8168 only. Reserved in the 8168b */ |
| 542 | 543 | ||
| 543 | /* Config4 register */ | 544 | /* Config4 register */ |
| @@ -4897,6 +4898,21 @@ static void rtl_enable_clock_request(struct pci_dev *pdev) | |||
| 4897 | PCI_EXP_LNKCTL_CLKREQ_EN); | 4898 | PCI_EXP_LNKCTL_CLKREQ_EN); |
| 4898 | } | 4899 | } |
| 4899 | 4900 | ||
| 4901 | static void rtl_pcie_state_l2l3_enable(struct rtl8169_private *tp, bool enable) | ||
| 4902 | { | ||
| 4903 | void __iomem *ioaddr = tp->mmio_addr; | ||
| 4904 | u8 data; | ||
| 4905 | |||
| 4906 | data = RTL_R8(Config3); | ||
| 4907 | |||
| 4908 | if (enable) | ||
| 4909 | data |= Rdy_to_L23; | ||
| 4910 | else | ||
| 4911 | data &= ~Rdy_to_L23; | ||
| 4912 | |||
| 4913 | RTL_W8(Config3, data); | ||
| 4914 | } | ||
| 4915 | |||
| 4900 | #define R8168_CPCMD_QUIRK_MASK (\ | 4916 | #define R8168_CPCMD_QUIRK_MASK (\ |
| 4901 | EnableBist | \ | 4917 | EnableBist | \ |
| 4902 | Mac_dbgo_oe | \ | 4918 | Mac_dbgo_oe | \ |
| @@ -5246,6 +5262,7 @@ static void rtl_hw_start_8411(struct rtl8169_private *tp) | |||
| 5246 | }; | 5262 | }; |
| 5247 | 5263 | ||
| 5248 | rtl_hw_start_8168f(tp); | 5264 | rtl_hw_start_8168f(tp); |
| 5265 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5249 | 5266 | ||
| 5250 | rtl_ephy_init(tp, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1)); | 5267 | rtl_ephy_init(tp, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1)); |
| 5251 | 5268 | ||
| @@ -5284,6 +5301,8 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp) | |||
| 5284 | 5301 | ||
| 5285 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x06, ERIAR_EXGMAC); | 5302 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x06, ERIAR_EXGMAC); |
| 5286 | rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); | 5303 | rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); |
| 5304 | |||
| 5305 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5287 | } | 5306 | } |
| 5288 | 5307 | ||
| 5289 | static void rtl_hw_start_8168g_2(struct rtl8169_private *tp) | 5308 | static void rtl_hw_start_8168g_2(struct rtl8169_private *tp) |
| @@ -5536,6 +5555,8 @@ static void rtl_hw_start_8105e_1(struct rtl8169_private *tp) | |||
| 5536 | RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); | 5555 | RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); |
| 5537 | 5556 | ||
| 5538 | rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); | 5557 | rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); |
| 5558 | |||
| 5559 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5539 | } | 5560 | } |
| 5540 | 5561 | ||
| 5541 | static void rtl_hw_start_8105e_2(struct rtl8169_private *tp) | 5562 | static void rtl_hw_start_8105e_2(struct rtl8169_private *tp) |
| @@ -5571,6 +5592,8 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp) | |||
| 5571 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); | 5592 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); |
| 5572 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); | 5593 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); |
| 5573 | rtl_w1w0_eri(tp, 0x0d4, ERIAR_MASK_0011, 0x0e00, 0xff00, ERIAR_EXGMAC); | 5594 | rtl_w1w0_eri(tp, 0x0d4, ERIAR_MASK_0011, 0x0e00, 0xff00, ERIAR_EXGMAC); |
| 5595 | |||
| 5596 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5574 | } | 5597 | } |
| 5575 | 5598 | ||
| 5576 | static void rtl_hw_start_8106(struct rtl8169_private *tp) | 5599 | static void rtl_hw_start_8106(struct rtl8169_private *tp) |
| @@ -5583,6 +5606,8 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp) | |||
| 5583 | RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN); | 5606 | RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN); |
| 5584 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); | 5607 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); |
| 5585 | RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); | 5608 | RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); |
| 5609 | |||
| 5610 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5586 | } | 5611 | } |
| 5587 | 5612 | ||
| 5588 | static void rtl_hw_start_8101(struct net_device *dev) | 5613 | static void rtl_hw_start_8101(struct net_device *dev) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index b3e148ef5683..9d3748361a1e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | |||
| @@ -320,11 +320,8 @@ static void dwmac1000_set_eee_timer(void __iomem *ioaddr, int ls, int tw) | |||
| 320 | 320 | ||
| 321 | static void dwmac1000_ctrl_ane(void __iomem *ioaddr, bool restart) | 321 | static void dwmac1000_ctrl_ane(void __iomem *ioaddr, bool restart) |
| 322 | { | 322 | { |
| 323 | u32 value; | ||
| 324 | |||
| 325 | value = readl(ioaddr + GMAC_AN_CTRL); | ||
| 326 | /* auto negotiation enable and External Loopback enable */ | 323 | /* auto negotiation enable and External Loopback enable */ |
| 327 | value = GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_ELE; | 324 | u32 value = GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_ELE; |
| 328 | 325 | ||
| 329 | if (restart) | 326 | if (restart) |
| 330 | value |= GMAC_AN_CTRL_RAN; | 327 | value |= GMAC_AN_CTRL_RAN; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c index 7e6628a91514..1e2bcf5f89e1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c | |||
| @@ -145,7 +145,7 @@ static void enh_desc_get_ext_status(void *data, struct stmmac_extra_stats *x, | |||
| 145 | x->rx_msg_type_delay_req++; | 145 | x->rx_msg_type_delay_req++; |
| 146 | else if (p->des4.erx.msg_type == RDES_EXT_DELAY_RESP) | 146 | else if (p->des4.erx.msg_type == RDES_EXT_DELAY_RESP) |
| 147 | x->rx_msg_type_delay_resp++; | 147 | x->rx_msg_type_delay_resp++; |
| 148 | else if (p->des4.erx.msg_type == RDES_EXT_DELAY_REQ) | 148 | else if (p->des4.erx.msg_type == RDES_EXT_PDELAY_REQ) |
| 149 | x->rx_msg_type_pdelay_req++; | 149 | x->rx_msg_type_pdelay_req++; |
| 150 | else if (p->des4.erx.msg_type == RDES_EXT_PDELAY_RESP) | 150 | else if (p->des4.erx.msg_type == RDES_EXT_PDELAY_RESP) |
| 151 | x->rx_msg_type_pdelay_resp++; | 151 | x->rx_msg_type_pdelay_resp++; |
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c index eb78203cd58e..2aa57270838f 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c | |||
| @@ -291,7 +291,11 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type); | |||
| 291 | 291 | ||
| 292 | static int dfx_rcv_init(DFX_board_t *bp, int get_buffers); | 292 | static int dfx_rcv_init(DFX_board_t *bp, int get_buffers); |
| 293 | static void dfx_rcv_queue_process(DFX_board_t *bp); | 293 | static void dfx_rcv_queue_process(DFX_board_t *bp); |
| 294 | #ifdef DYNAMIC_BUFFERS | ||
| 294 | static void dfx_rcv_flush(DFX_board_t *bp); | 295 | static void dfx_rcv_flush(DFX_board_t *bp); |
| 296 | #else | ||
| 297 | static inline void dfx_rcv_flush(DFX_board_t *bp) {} | ||
| 298 | #endif | ||
| 295 | 299 | ||
| 296 | static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb, | 300 | static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb, |
| 297 | struct net_device *dev); | 301 | struct net_device *dev); |
| @@ -2849,7 +2853,7 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type) | |||
| 2849 | * Align an sk_buff to a boundary power of 2 | 2853 | * Align an sk_buff to a boundary power of 2 |
| 2850 | * | 2854 | * |
| 2851 | */ | 2855 | */ |
| 2852 | 2856 | #ifdef DYNAMIC_BUFFERS | |
| 2853 | static void my_skb_align(struct sk_buff *skb, int n) | 2857 | static void my_skb_align(struct sk_buff *skb, int n) |
| 2854 | { | 2858 | { |
| 2855 | unsigned long x = (unsigned long)skb->data; | 2859 | unsigned long x = (unsigned long)skb->data; |
| @@ -2859,7 +2863,7 @@ static void my_skb_align(struct sk_buff *skb, int n) | |||
| 2859 | 2863 | ||
| 2860 | skb_reserve(skb, v - x); | 2864 | skb_reserve(skb, v - x); |
| 2861 | } | 2865 | } |
| 2862 | 2866 | #endif | |
| 2863 | 2867 | ||
| 2864 | /* | 2868 | /* |
| 2865 | * ================ | 2869 | * ================ |
| @@ -3074,10 +3078,7 @@ static void dfx_rcv_queue_process( | |||
| 3074 | break; | 3078 | break; |
| 3075 | } | 3079 | } |
| 3076 | else { | 3080 | else { |
| 3077 | #ifndef DYNAMIC_BUFFERS | 3081 | if (!rx_in_place) { |
| 3078 | if (! rx_in_place) | ||
| 3079 | #endif | ||
| 3080 | { | ||
| 3081 | /* Receive buffer allocated, pass receive packet up */ | 3082 | /* Receive buffer allocated, pass receive packet up */ |
| 3082 | 3083 | ||
| 3083 | skb_copy_to_linear_data(skb, | 3084 | skb_copy_to_linear_data(skb, |
| @@ -3453,10 +3454,6 @@ static void dfx_rcv_flush( DFX_board_t *bp ) | |||
| 3453 | } | 3454 | } |
| 3454 | 3455 | ||
| 3455 | } | 3456 | } |
| 3456 | #else | ||
| 3457 | static inline void dfx_rcv_flush( DFX_board_t *bp ) | ||
| 3458 | { | ||
| 3459 | } | ||
| 3460 | #endif /* DYNAMIC_BUFFERS */ | 3457 | #endif /* DYNAMIC_BUFFERS */ |
| 3461 | 3458 | ||
| 3462 | /* | 3459 | /* |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 6a999e6814a0..9408157a246c 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
| @@ -1323,15 +1323,15 @@ static bool dp83640_rxtstamp(struct phy_device *phydev, | |||
| 1323 | { | 1323 | { |
| 1324 | struct dp83640_private *dp83640 = phydev->priv; | 1324 | struct dp83640_private *dp83640 = phydev->priv; |
| 1325 | 1325 | ||
| 1326 | if (!dp83640->hwts_rx_en) | ||
| 1327 | return false; | ||
| 1328 | |||
| 1329 | if (is_status_frame(skb, type)) { | 1326 | if (is_status_frame(skb, type)) { |
| 1330 | decode_status_frame(dp83640, skb); | 1327 | decode_status_frame(dp83640, skb); |
| 1331 | kfree_skb(skb); | 1328 | kfree_skb(skb); |
| 1332 | return true; | 1329 | return true; |
| 1333 | } | 1330 | } |
| 1334 | 1331 | ||
| 1332 | if (!dp83640->hwts_rx_en) | ||
| 1333 | return false; | ||
| 1334 | |||
| 1335 | SKB_PTP_TYPE(skb) = type; | 1335 | SKB_PTP_TYPE(skb) = type; |
| 1336 | skb_queue_tail(&dp83640->rx_queue, skb); | 1336 | skb_queue_tail(&dp83640->rx_queue, skb); |
| 1337 | schedule_work(&dp83640->ts_work); | 1337 | schedule_work(&dp83640->ts_work); |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 2e58aa54484c..4eaadcfcb0fe 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
| @@ -187,6 +187,50 @@ struct mii_bus *of_mdio_find_bus(struct device_node *mdio_bus_np) | |||
| 187 | return d ? to_mii_bus(d) : NULL; | 187 | return d ? to_mii_bus(d) : NULL; |
| 188 | } | 188 | } |
| 189 | EXPORT_SYMBOL(of_mdio_find_bus); | 189 | EXPORT_SYMBOL(of_mdio_find_bus); |
| 190 | |||
| 191 | /* Walk the list of subnodes of a mdio bus and look for a node that matches the | ||
| 192 | * phy's address with its 'reg' property. If found, set the of_node pointer for | ||
| 193 | * the phy. This allows auto-probed pyh devices to be supplied with information | ||
| 194 | * passed in via DT. | ||
| 195 | */ | ||
| 196 | static void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 197 | struct phy_device *phydev) | ||
| 198 | { | ||
| 199 | struct device *dev = &phydev->dev; | ||
| 200 | struct device_node *child; | ||
| 201 | |||
| 202 | if (dev->of_node || !mdio->dev.of_node) | ||
| 203 | return; | ||
| 204 | |||
| 205 | for_each_available_child_of_node(mdio->dev.of_node, child) { | ||
| 206 | int addr; | ||
| 207 | int ret; | ||
| 208 | |||
| 209 | ret = of_property_read_u32(child, "reg", &addr); | ||
| 210 | if (ret < 0) { | ||
| 211 | dev_err(dev, "%s has invalid PHY address\n", | ||
| 212 | child->full_name); | ||
| 213 | continue; | ||
| 214 | } | ||
| 215 | |||
| 216 | /* A PHY must have a reg property in the range [0-31] */ | ||
| 217 | if (addr >= PHY_MAX_ADDR) { | ||
| 218 | dev_err(dev, "%s PHY address %i is too large\n", | ||
| 219 | child->full_name, addr); | ||
| 220 | continue; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (addr == phydev->addr) { | ||
| 224 | dev->of_node = child; | ||
| 225 | return; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | } | ||
| 229 | #else /* !IS_ENABLED(CONFIG_OF_MDIO) */ | ||
| 230 | static inline void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 231 | struct phy_device *phydev) | ||
| 232 | { | ||
| 233 | } | ||
| 190 | #endif | 234 | #endif |
| 191 | 235 | ||
| 192 | /** | 236 | /** |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 91d6c1272fcf..e2f20f807de8 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
| @@ -539,7 +539,7 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 539 | { | 539 | { |
| 540 | struct sock_fprog uprog; | 540 | struct sock_fprog uprog; |
| 541 | struct sock_filter *code = NULL; | 541 | struct sock_filter *code = NULL; |
| 542 | int len, err; | 542 | int len; |
| 543 | 543 | ||
| 544 | if (copy_from_user(&uprog, arg, sizeof(uprog))) | 544 | if (copy_from_user(&uprog, arg, sizeof(uprog))) |
| 545 | return -EFAULT; | 545 | return -EFAULT; |
| @@ -554,12 +554,6 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 554 | if (IS_ERR(code)) | 554 | if (IS_ERR(code)) |
| 555 | return PTR_ERR(code); | 555 | return PTR_ERR(code); |
| 556 | 556 | ||
| 557 | err = sk_chk_filter(code, uprog.len); | ||
| 558 | if (err) { | ||
| 559 | kfree(code); | ||
| 560 | return err; | ||
| 561 | } | ||
| 562 | |||
| 563 | *p = code; | 557 | *p = code; |
| 564 | return uprog.len; | 558 | return uprog.len; |
| 565 | } | 559 | } |
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 2ea7efd11857..6c9c16d76935 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
| @@ -675,7 +675,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
| 675 | po->chan.hdrlen = (sizeof(struct pppoe_hdr) + | 675 | po->chan.hdrlen = (sizeof(struct pppoe_hdr) + |
| 676 | dev->hard_header_len); | 676 | dev->hard_header_len); |
| 677 | 677 | ||
| 678 | po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr); | 678 | po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2; |
| 679 | po->chan.private = sk; | 679 | po->chan.private = sk; |
| 680 | po->chan.ops = &pppoe_chan_ops; | 680 | po->chan.ops = &pppoe_chan_ops; |
| 681 | 681 | ||
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index a3a05869309d..a4272ed62da8 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -258,10 +258,8 @@ struct hso_serial { | |||
| 258 | * so as not to drop characters on the floor. | 258 | * so as not to drop characters on the floor. |
| 259 | */ | 259 | */ |
| 260 | int curr_rx_urb_idx; | 260 | int curr_rx_urb_idx; |
| 261 | u16 curr_rx_urb_offset; | ||
| 262 | u8 rx_urb_filled[MAX_RX_URBS]; | 261 | u8 rx_urb_filled[MAX_RX_URBS]; |
| 263 | struct tasklet_struct unthrottle_tasklet; | 262 | struct tasklet_struct unthrottle_tasklet; |
| 264 | struct work_struct retry_unthrottle_workqueue; | ||
| 265 | }; | 263 | }; |
| 266 | 264 | ||
| 267 | struct hso_device { | 265 | struct hso_device { |
| @@ -1252,14 +1250,6 @@ static void hso_unthrottle(struct tty_struct *tty) | |||
| 1252 | tasklet_hi_schedule(&serial->unthrottle_tasklet); | 1250 | tasklet_hi_schedule(&serial->unthrottle_tasklet); |
| 1253 | } | 1251 | } |
| 1254 | 1252 | ||
| 1255 | static void hso_unthrottle_workfunc(struct work_struct *work) | ||
| 1256 | { | ||
| 1257 | struct hso_serial *serial = | ||
| 1258 | container_of(work, struct hso_serial, | ||
| 1259 | retry_unthrottle_workqueue); | ||
| 1260 | hso_unthrottle_tasklet(serial); | ||
| 1261 | } | ||
| 1262 | |||
| 1263 | /* open the requested serial port */ | 1253 | /* open the requested serial port */ |
| 1264 | static int hso_serial_open(struct tty_struct *tty, struct file *filp) | 1254 | static int hso_serial_open(struct tty_struct *tty, struct file *filp) |
| 1265 | { | 1255 | { |
| @@ -1295,8 +1285,6 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp) | |||
| 1295 | tasklet_init(&serial->unthrottle_tasklet, | 1285 | tasklet_init(&serial->unthrottle_tasklet, |
| 1296 | (void (*)(unsigned long))hso_unthrottle_tasklet, | 1286 | (void (*)(unsigned long))hso_unthrottle_tasklet, |
| 1297 | (unsigned long)serial); | 1287 | (unsigned long)serial); |
| 1298 | INIT_WORK(&serial->retry_unthrottle_workqueue, | ||
| 1299 | hso_unthrottle_workfunc); | ||
| 1300 | result = hso_start_serial_device(serial->parent, GFP_KERNEL); | 1288 | result = hso_start_serial_device(serial->parent, GFP_KERNEL); |
| 1301 | if (result) { | 1289 | if (result) { |
| 1302 | hso_stop_serial_device(serial->parent); | 1290 | hso_stop_serial_device(serial->parent); |
| @@ -1345,7 +1333,6 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
| 1345 | if (!usb_gone) | 1333 | if (!usb_gone) |
| 1346 | hso_stop_serial_device(serial->parent); | 1334 | hso_stop_serial_device(serial->parent); |
| 1347 | tasklet_kill(&serial->unthrottle_tasklet); | 1335 | tasklet_kill(&serial->unthrottle_tasklet); |
| 1348 | cancel_work_sync(&serial->retry_unthrottle_workqueue); | ||
| 1349 | } | 1336 | } |
| 1350 | 1337 | ||
| 1351 | if (!usb_gone) | 1338 | if (!usb_gone) |
| @@ -2013,8 +2000,7 @@ static void ctrl_callback(struct urb *urb) | |||
| 2013 | static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | 2000 | static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) |
| 2014 | { | 2001 | { |
| 2015 | struct tty_struct *tty; | 2002 | struct tty_struct *tty; |
| 2016 | int write_length_remaining = 0; | 2003 | int count; |
| 2017 | int curr_write_len; | ||
| 2018 | 2004 | ||
| 2019 | /* Sanity check */ | 2005 | /* Sanity check */ |
| 2020 | if (urb == NULL || serial == NULL) { | 2006 | if (urb == NULL || serial == NULL) { |
| @@ -2024,29 +2010,28 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | |||
| 2024 | 2010 | ||
| 2025 | tty = tty_port_tty_get(&serial->port); | 2011 | tty = tty_port_tty_get(&serial->port); |
| 2026 | 2012 | ||
| 2013 | if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { | ||
| 2014 | tty_kref_put(tty); | ||
| 2015 | return -1; | ||
| 2016 | } | ||
| 2017 | |||
| 2027 | /* Push data to tty */ | 2018 | /* Push data to tty */ |
| 2028 | write_length_remaining = urb->actual_length - | ||
| 2029 | serial->curr_rx_urb_offset; | ||
| 2030 | D1("data to push to tty"); | 2019 | D1("data to push to tty"); |
| 2031 | while (write_length_remaining) { | 2020 | count = tty_buffer_request_room(&serial->port, urb->actual_length); |
| 2032 | if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { | 2021 | if (count >= urb->actual_length) { |
| 2033 | tty_kref_put(tty); | 2022 | tty_insert_flip_string(&serial->port, urb->transfer_buffer, |
| 2034 | return -1; | 2023 | urb->actual_length); |
| 2035 | } | ||
| 2036 | curr_write_len = tty_insert_flip_string(&serial->port, | ||
| 2037 | urb->transfer_buffer + serial->curr_rx_urb_offset, | ||
| 2038 | write_length_remaining); | ||
| 2039 | serial->curr_rx_urb_offset += curr_write_len; | ||
| 2040 | write_length_remaining -= curr_write_len; | ||
| 2041 | tty_flip_buffer_push(&serial->port); | 2024 | tty_flip_buffer_push(&serial->port); |
| 2025 | } else { | ||
| 2026 | dev_warn(&serial->parent->usb->dev, | ||
| 2027 | "dropping data, %d bytes lost\n", urb->actual_length); | ||
| 2042 | } | 2028 | } |
| 2029 | |||
| 2043 | tty_kref_put(tty); | 2030 | tty_kref_put(tty); |
| 2044 | 2031 | ||
| 2045 | if (write_length_remaining == 0) { | 2032 | serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0; |
| 2046 | serial->curr_rx_urb_offset = 0; | 2033 | |
| 2047 | serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0; | 2034 | return 0; |
| 2048 | } | ||
| 2049 | return write_length_remaining; | ||
| 2050 | } | 2035 | } |
| 2051 | 2036 | ||
| 2052 | 2037 | ||
| @@ -2217,7 +2202,6 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) | |||
| 2217 | } | 2202 | } |
| 2218 | } | 2203 | } |
| 2219 | serial->curr_rx_urb_idx = 0; | 2204 | serial->curr_rx_urb_idx = 0; |
| 2220 | serial->curr_rx_urb_offset = 0; | ||
| 2221 | 2205 | ||
| 2222 | if (serial->tx_urb) | 2206 | if (serial->tx_urb) |
| 2223 | usb_kill_urb(serial->tx_urb); | 2207 | usb_kill_urb(serial->tx_urb); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index cf62d7e8329f..c4638c67f6b9 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -741,6 +741,7 @@ static const struct usb_device_id products[] = { | |||
| 741 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, | 741 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, |
| 742 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, | 742 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, |
| 743 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ | 743 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ |
| 744 | {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ | ||
| 744 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ | 745 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
| 745 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ | 746 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
| 746 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ | 747 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 25431965a625..7bad2d316637 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
| @@ -1359,7 +1359,7 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb, | |||
| 1359 | struct sk_buff_head seg_list; | 1359 | struct sk_buff_head seg_list; |
| 1360 | struct sk_buff *segs, *nskb; | 1360 | struct sk_buff *segs, *nskb; |
| 1361 | 1361 | ||
| 1362 | features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO); | 1362 | features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6); |
| 1363 | segs = skb_gso_segment(skb, features); | 1363 | segs = skb_gso_segment(skb, features); |
| 1364 | if (IS_ERR(segs) || !segs) | 1364 | if (IS_ERR(segs) || !segs) |
| 1365 | goto drop; | 1365 | goto drop; |
| @@ -3204,8 +3204,13 @@ static void rtl8152_get_ethtool_stats(struct net_device *dev, | |||
| 3204 | struct r8152 *tp = netdev_priv(dev); | 3204 | struct r8152 *tp = netdev_priv(dev); |
| 3205 | struct tally_counter tally; | 3205 | struct tally_counter tally; |
| 3206 | 3206 | ||
| 3207 | if (usb_autopm_get_interface(tp->intf) < 0) | ||
| 3208 | return; | ||
| 3209 | |||
| 3207 | generic_ocp_read(tp, PLA_TALLYCNT, sizeof(tally), &tally, MCU_TYPE_PLA); | 3210 | generic_ocp_read(tp, PLA_TALLYCNT, sizeof(tally), &tally, MCU_TYPE_PLA); |
| 3208 | 3211 | ||
| 3212 | usb_autopm_put_interface(tp->intf); | ||
| 3213 | |||
| 3209 | data[0] = le64_to_cpu(tally.tx_packets); | 3214 | data[0] = le64_to_cpu(tally.tx_packets); |
| 3210 | data[1] = le64_to_cpu(tally.rx_packets); | 3215 | data[1] = le64_to_cpu(tally.rx_packets); |
| 3211 | data[2] = le64_to_cpu(tally.tx_errors); | 3216 | data[2] = le64_to_cpu(tally.tx_errors); |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 424db65e4396..d07bf4cb893f 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
| @@ -1714,6 +1714,18 @@ static int smsc95xx_resume(struct usb_interface *intf) | |||
| 1714 | return ret; | 1714 | return ret; |
| 1715 | } | 1715 | } |
| 1716 | 1716 | ||
| 1717 | static int smsc95xx_reset_resume(struct usb_interface *intf) | ||
| 1718 | { | ||
| 1719 | struct usbnet *dev = usb_get_intfdata(intf); | ||
| 1720 | int ret; | ||
| 1721 | |||
| 1722 | ret = smsc95xx_reset(dev); | ||
| 1723 | if (ret < 0) | ||
| 1724 | return ret; | ||
| 1725 | |||
| 1726 | return smsc95xx_resume(intf); | ||
| 1727 | } | ||
| 1728 | |||
| 1717 | static void smsc95xx_rx_csum_offload(struct sk_buff *skb) | 1729 | static void smsc95xx_rx_csum_offload(struct sk_buff *skb) |
| 1718 | { | 1730 | { |
| 1719 | skb->csum = *(u16 *)(skb_tail_pointer(skb) - 2); | 1731 | skb->csum = *(u16 *)(skb_tail_pointer(skb) - 2); |
| @@ -2004,7 +2016,7 @@ static struct usb_driver smsc95xx_driver = { | |||
| 2004 | .probe = usbnet_probe, | 2016 | .probe = usbnet_probe, |
| 2005 | .suspend = smsc95xx_suspend, | 2017 | .suspend = smsc95xx_suspend, |
| 2006 | .resume = smsc95xx_resume, | 2018 | .resume = smsc95xx_resume, |
| 2007 | .reset_resume = smsc95xx_resume, | 2019 | .reset_resume = smsc95xx_reset_resume, |
| 2008 | .disconnect = usbnet_disconnect, | 2020 | .disconnect = usbnet_disconnect, |
| 2009 | .disable_hub_initiated_lpm = 1, | 2021 | .disable_hub_initiated_lpm = 1, |
| 2010 | .supports_autosuspend = 1, | 2022 | .supports_autosuspend = 1, |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 93ace042d0aa..1f041271f7fe 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
| @@ -2363,7 +2363,7 @@ static char *type_strings[] = { | |||
| 2363 | "FarSync TE1" | 2363 | "FarSync TE1" |
| 2364 | }; | 2364 | }; |
| 2365 | 2365 | ||
| 2366 | static void | 2366 | static int |
| 2367 | fst_init_card(struct fst_card_info *card) | 2367 | fst_init_card(struct fst_card_info *card) |
| 2368 | { | 2368 | { |
| 2369 | int i; | 2369 | int i; |
| @@ -2374,24 +2374,21 @@ fst_init_card(struct fst_card_info *card) | |||
| 2374 | * we'll have to revise it in some way then. | 2374 | * we'll have to revise it in some way then. |
| 2375 | */ | 2375 | */ |
| 2376 | for (i = 0; i < card->nports; i++) { | 2376 | for (i = 0; i < card->nports; i++) { |
| 2377 | err = register_hdlc_device(card->ports[i].dev); | 2377 | err = register_hdlc_device(card->ports[i].dev); |
| 2378 | if (err < 0) { | 2378 | if (err < 0) { |
| 2379 | int j; | ||
| 2380 | pr_err("Cannot register HDLC device for port %d (errno %d)\n", | 2379 | pr_err("Cannot register HDLC device for port %d (errno %d)\n", |
| 2381 | i, -err); | 2380 | i, -err); |
| 2382 | for (j = i; j < card->nports; j++) { | 2381 | while (i--) |
| 2383 | free_netdev(card->ports[j].dev); | 2382 | unregister_hdlc_device(card->ports[i].dev); |
| 2384 | card->ports[j].dev = NULL; | 2383 | return err; |
| 2385 | } | 2384 | } |
| 2386 | card->nports = i; | ||
| 2387 | break; | ||
| 2388 | } | ||
| 2389 | } | 2385 | } |
| 2390 | 2386 | ||
| 2391 | pr_info("%s-%s: %s IRQ%d, %d ports\n", | 2387 | pr_info("%s-%s: %s IRQ%d, %d ports\n", |
| 2392 | port_to_dev(&card->ports[0])->name, | 2388 | port_to_dev(&card->ports[0])->name, |
| 2393 | port_to_dev(&card->ports[card->nports - 1])->name, | 2389 | port_to_dev(&card->ports[card->nports - 1])->name, |
| 2394 | type_strings[card->type], card->irq, card->nports); | 2390 | type_strings[card->type], card->irq, card->nports); |
| 2391 | return 0; | ||
| 2395 | } | 2392 | } |
| 2396 | 2393 | ||
| 2397 | static const struct net_device_ops fst_ops = { | 2394 | static const struct net_device_ops fst_ops = { |
| @@ -2447,15 +2444,12 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2447 | /* Try to enable the device */ | 2444 | /* Try to enable the device */ |
| 2448 | if ((err = pci_enable_device(pdev)) != 0) { | 2445 | if ((err = pci_enable_device(pdev)) != 0) { |
| 2449 | pr_err("Failed to enable card. Err %d\n", -err); | 2446 | pr_err("Failed to enable card. Err %d\n", -err); |
| 2450 | kfree(card); | 2447 | goto enable_fail; |
| 2451 | return err; | ||
| 2452 | } | 2448 | } |
| 2453 | 2449 | ||
| 2454 | if ((err = pci_request_regions(pdev, "FarSync")) !=0) { | 2450 | if ((err = pci_request_regions(pdev, "FarSync")) !=0) { |
| 2455 | pr_err("Failed to allocate regions. Err %d\n", -err); | 2451 | pr_err("Failed to allocate regions. Err %d\n", -err); |
| 2456 | pci_disable_device(pdev); | 2452 | goto regions_fail; |
| 2457 | kfree(card); | ||
| 2458 | return err; | ||
| 2459 | } | 2453 | } |
| 2460 | 2454 | ||
| 2461 | /* Get virtual addresses of memory regions */ | 2455 | /* Get virtual addresses of memory regions */ |
| @@ -2464,30 +2458,21 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2464 | card->phys_ctlmem = pci_resource_start(pdev, 3); | 2458 | card->phys_ctlmem = pci_resource_start(pdev, 3); |
| 2465 | if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) { | 2459 | if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) { |
| 2466 | pr_err("Physical memory remap failed\n"); | 2460 | pr_err("Physical memory remap failed\n"); |
| 2467 | pci_release_regions(pdev); | 2461 | err = -ENODEV; |
| 2468 | pci_disable_device(pdev); | 2462 | goto ioremap_physmem_fail; |
| 2469 | kfree(card); | ||
| 2470 | return -ENODEV; | ||
| 2471 | } | 2463 | } |
| 2472 | if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) { | 2464 | if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) { |
| 2473 | pr_err("Control memory remap failed\n"); | 2465 | pr_err("Control memory remap failed\n"); |
| 2474 | pci_release_regions(pdev); | 2466 | err = -ENODEV; |
| 2475 | pci_disable_device(pdev); | 2467 | goto ioremap_ctlmem_fail; |
| 2476 | iounmap(card->mem); | ||
| 2477 | kfree(card); | ||
| 2478 | return -ENODEV; | ||
| 2479 | } | 2468 | } |
| 2480 | dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem); | 2469 | dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem); |
| 2481 | 2470 | ||
| 2482 | /* Register the interrupt handler */ | 2471 | /* Register the interrupt handler */ |
| 2483 | if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { | 2472 | if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { |
| 2484 | pr_err("Unable to register interrupt %d\n", card->irq); | 2473 | pr_err("Unable to register interrupt %d\n", card->irq); |
| 2485 | pci_release_regions(pdev); | 2474 | err = -ENODEV; |
| 2486 | pci_disable_device(pdev); | 2475 | goto irq_fail; |
| 2487 | iounmap(card->ctlmem); | ||
| 2488 | iounmap(card->mem); | ||
| 2489 | kfree(card); | ||
| 2490 | return -ENODEV; | ||
| 2491 | } | 2476 | } |
| 2492 | 2477 | ||
| 2493 | /* Record info we need */ | 2478 | /* Record info we need */ |
| @@ -2513,13 +2498,8 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2513 | while (i--) | 2498 | while (i--) |
| 2514 | free_netdev(card->ports[i].dev); | 2499 | free_netdev(card->ports[i].dev); |
| 2515 | pr_err("FarSync: out of memory\n"); | 2500 | pr_err("FarSync: out of memory\n"); |
| 2516 | free_irq(card->irq, card); | 2501 | err = -ENOMEM; |
| 2517 | pci_release_regions(pdev); | 2502 | goto hdlcdev_fail; |
| 2518 | pci_disable_device(pdev); | ||
| 2519 | iounmap(card->ctlmem); | ||
| 2520 | iounmap(card->mem); | ||
| 2521 | kfree(card); | ||
| 2522 | return -ENODEV; | ||
| 2523 | } | 2503 | } |
| 2524 | card->ports[i].dev = dev; | 2504 | card->ports[i].dev = dev; |
| 2525 | card->ports[i].card = card; | 2505 | card->ports[i].card = card; |
| @@ -2565,9 +2545,16 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2565 | pci_set_drvdata(pdev, card); | 2545 | pci_set_drvdata(pdev, card); |
| 2566 | 2546 | ||
| 2567 | /* Remainder of card setup */ | 2547 | /* Remainder of card setup */ |
| 2548 | if (no_of_cards_added >= FST_MAX_CARDS) { | ||
| 2549 | pr_err("FarSync: too many cards\n"); | ||
| 2550 | err = -ENOMEM; | ||
| 2551 | goto card_array_fail; | ||
| 2552 | } | ||
| 2568 | fst_card_array[no_of_cards_added] = card; | 2553 | fst_card_array[no_of_cards_added] = card; |
| 2569 | card->card_no = no_of_cards_added++; /* Record instance and bump it */ | 2554 | card->card_no = no_of_cards_added++; /* Record instance and bump it */ |
| 2570 | fst_init_card(card); | 2555 | err = fst_init_card(card); |
| 2556 | if (err) | ||
| 2557 | goto init_card_fail; | ||
| 2571 | if (card->family == FST_FAMILY_TXU) { | 2558 | if (card->family == FST_FAMILY_TXU) { |
| 2572 | /* | 2559 | /* |
| 2573 | * Allocate a dma buffer for transmit and receives | 2560 | * Allocate a dma buffer for transmit and receives |
| @@ -2577,29 +2564,46 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2577 | &card->rx_dma_handle_card); | 2564 | &card->rx_dma_handle_card); |
| 2578 | if (card->rx_dma_handle_host == NULL) { | 2565 | if (card->rx_dma_handle_host == NULL) { |
| 2579 | pr_err("Could not allocate rx dma buffer\n"); | 2566 | pr_err("Could not allocate rx dma buffer\n"); |
| 2580 | fst_disable_intr(card); | 2567 | err = -ENOMEM; |
| 2581 | pci_release_regions(pdev); | 2568 | goto rx_dma_fail; |
| 2582 | pci_disable_device(pdev); | ||
| 2583 | iounmap(card->ctlmem); | ||
| 2584 | iounmap(card->mem); | ||
| 2585 | kfree(card); | ||
| 2586 | return -ENOMEM; | ||
| 2587 | } | 2569 | } |
| 2588 | card->tx_dma_handle_host = | 2570 | card->tx_dma_handle_host = |
| 2589 | pci_alloc_consistent(card->device, FST_MAX_MTU, | 2571 | pci_alloc_consistent(card->device, FST_MAX_MTU, |
| 2590 | &card->tx_dma_handle_card); | 2572 | &card->tx_dma_handle_card); |
| 2591 | if (card->tx_dma_handle_host == NULL) { | 2573 | if (card->tx_dma_handle_host == NULL) { |
| 2592 | pr_err("Could not allocate tx dma buffer\n"); | 2574 | pr_err("Could not allocate tx dma buffer\n"); |
| 2593 | fst_disable_intr(card); | 2575 | err = -ENOMEM; |
| 2594 | pci_release_regions(pdev); | 2576 | goto tx_dma_fail; |
| 2595 | pci_disable_device(pdev); | ||
| 2596 | iounmap(card->ctlmem); | ||
| 2597 | iounmap(card->mem); | ||
| 2598 | kfree(card); | ||
| 2599 | return -ENOMEM; | ||
| 2600 | } | 2577 | } |
| 2601 | } | 2578 | } |
| 2602 | return 0; /* Success */ | 2579 | return 0; /* Success */ |
| 2580 | |||
| 2581 | tx_dma_fail: | ||
| 2582 | pci_free_consistent(card->device, FST_MAX_MTU, | ||
| 2583 | card->rx_dma_handle_host, | ||
| 2584 | card->rx_dma_handle_card); | ||
| 2585 | rx_dma_fail: | ||
| 2586 | fst_disable_intr(card); | ||
| 2587 | for (i = 0 ; i < card->nports ; i++) | ||
| 2588 | unregister_hdlc_device(card->ports[i].dev); | ||
| 2589 | init_card_fail: | ||
| 2590 | fst_card_array[card->card_no] = NULL; | ||
| 2591 | card_array_fail: | ||
| 2592 | for (i = 0 ; i < card->nports ; i++) | ||
| 2593 | free_netdev(card->ports[i].dev); | ||
| 2594 | hdlcdev_fail: | ||
| 2595 | free_irq(card->irq, card); | ||
| 2596 | irq_fail: | ||
| 2597 | iounmap(card->ctlmem); | ||
| 2598 | ioremap_ctlmem_fail: | ||
| 2599 | iounmap(card->mem); | ||
| 2600 | ioremap_physmem_fail: | ||
| 2601 | pci_release_regions(pdev); | ||
| 2602 | regions_fail: | ||
| 2603 | pci_disable_device(pdev); | ||
| 2604 | enable_fail: | ||
| 2605 | kfree(card); | ||
| 2606 | return err; | ||
| 2603 | } | 2607 | } |
| 2604 | 2608 | ||
| 2605 | /* | 2609 | /* |
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 82017f56e661..e6c56c5bb0f6 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
| @@ -795,7 +795,11 @@ int ath10k_core_start(struct ath10k *ar) | |||
| 795 | if (status) | 795 | if (status) |
| 796 | goto err_htc_stop; | 796 | goto err_htc_stop; |
| 797 | 797 | ||
| 798 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; | 798 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) |
| 799 | ar->free_vdev_map = (1 << TARGET_10X_NUM_VDEVS) - 1; | ||
| 800 | else | ||
| 801 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; | ||
| 802 | |||
| 799 | INIT_LIST_HEAD(&ar->arvifs); | 803 | INIT_LIST_HEAD(&ar->arvifs); |
| 800 | 804 | ||
| 801 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) | 805 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 6c102b1312ff..eebc860c3655 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
| @@ -312,7 +312,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
| 312 | int msdu_len, msdu_chaining = 0; | 312 | int msdu_len, msdu_chaining = 0; |
| 313 | struct sk_buff *msdu; | 313 | struct sk_buff *msdu; |
| 314 | struct htt_rx_desc *rx_desc; | 314 | struct htt_rx_desc *rx_desc; |
| 315 | bool corrupted = false; | ||
| 316 | 315 | ||
| 317 | lockdep_assert_held(&htt->rx_ring.lock); | 316 | lockdep_assert_held(&htt->rx_ring.lock); |
| 318 | 317 | ||
| @@ -439,9 +438,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
| 439 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & | 438 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & |
| 440 | RX_MSDU_END_INFO0_LAST_MSDU; | 439 | RX_MSDU_END_INFO0_LAST_MSDU; |
| 441 | 440 | ||
| 442 | if (msdu_chaining && !last_msdu) | ||
| 443 | corrupted = true; | ||
| 444 | |||
| 445 | if (last_msdu) { | 441 | if (last_msdu) { |
| 446 | msdu->next = NULL; | 442 | msdu->next = NULL; |
| 447 | break; | 443 | break; |
| @@ -457,20 +453,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
| 457 | msdu_chaining = -1; | 453 | msdu_chaining = -1; |
| 458 | 454 | ||
| 459 | /* | 455 | /* |
| 460 | * Apparently FW sometimes reports weird chained MSDU sequences with | ||
| 461 | * more than one rx descriptor. This seems like a bug but needs more | ||
| 462 | * analyzing. For the time being fix it by dropping such sequences to | ||
| 463 | * avoid blowing up the host system. | ||
| 464 | */ | ||
| 465 | if (corrupted) { | ||
| 466 | ath10k_warn("failed to pop chained msdus, dropping\n"); | ||
| 467 | ath10k_htt_rx_free_msdu_chain(*head_msdu); | ||
| 468 | *head_msdu = NULL; | ||
| 469 | *tail_msdu = NULL; | ||
| 470 | msdu_chaining = -EINVAL; | ||
| 471 | } | ||
| 472 | |||
| 473 | /* | ||
| 474 | * Don't refill the ring yet. | 456 | * Don't refill the ring yet. |
| 475 | * | 457 | * |
| 476 | * First, the elements popped here are still in use - it is not | 458 | * First, the elements popped here are still in use - it is not |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 6db51a666f61..d06fcb05adf2 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
| @@ -1184,8 +1184,6 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
| 1184 | bus->bus_priv.usb = bus_pub; | 1184 | bus->bus_priv.usb = bus_pub; |
| 1185 | dev_set_drvdata(dev, bus); | 1185 | dev_set_drvdata(dev, bus); |
| 1186 | bus->ops = &brcmf_usb_bus_ops; | 1186 | bus->ops = &brcmf_usb_bus_ops; |
| 1187 | bus->chip = bus_pub->devid; | ||
| 1188 | bus->chiprev = bus_pub->chiprev; | ||
| 1189 | bus->proto_type = BRCMF_PROTO_BCDC; | 1187 | bus->proto_type = BRCMF_PROTO_BCDC; |
| 1190 | bus->always_use_fws_queue = true; | 1188 | bus->always_use_fws_queue = true; |
| 1191 | 1189 | ||
| @@ -1194,6 +1192,9 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
| 1194 | if (ret) | 1192 | if (ret) |
| 1195 | goto fail; | 1193 | goto fail; |
| 1196 | } | 1194 | } |
| 1195 | bus->chip = bus_pub->devid; | ||
| 1196 | bus->chiprev = bus_pub->chiprev; | ||
| 1197 | |||
| 1197 | /* request firmware here */ | 1198 | /* request firmware here */ |
| 1198 | brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL, | 1199 | brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL, |
| 1199 | brcmf_usb_probe_phase2); | 1200 | brcmf_usb_probe_phase2); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index ed50de6362ed..6dc5dd3ced44 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
| @@ -1068,13 +1068,6 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
| 1068 | /* recalculate basic rates */ | 1068 | /* recalculate basic rates */ |
| 1069 | iwl_calc_basic_rates(priv, ctx); | 1069 | iwl_calc_basic_rates(priv, ctx); |
| 1070 | 1070 | ||
| 1071 | /* | ||
| 1072 | * force CTS-to-self frames protection if RTS-CTS is not preferred | ||
| 1073 | * one aggregation protection method | ||
| 1074 | */ | ||
| 1075 | if (!priv->hw_params.use_rts_for_aggregation) | ||
| 1076 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
| 1077 | |||
| 1078 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || | 1071 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || |
| 1079 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) | 1072 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) |
| 1080 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; | 1073 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
| @@ -1480,11 +1473,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
| 1480 | else | 1473 | else |
| 1481 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | 1474 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
| 1482 | 1475 | ||
| 1483 | if (bss_conf->use_cts_prot) | ||
| 1484 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
| 1485 | else | ||
| 1486 | ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; | ||
| 1487 | |||
| 1488 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); | 1476 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); |
| 1489 | 1477 | ||
| 1490 | if (vif->type == NL80211_IFTYPE_AP || | 1478 | if (vif->type == NL80211_IFTYPE_AP || |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index 0aa7c0085c9f..b1a33322b9ba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
| @@ -88,6 +88,7 @@ | |||
| 88 | * P2P client interfaces simultaneously if they are in different bindings. | 88 | * P2P client interfaces simultaneously if they are in different bindings. |
| 89 | * @IWL_UCODE_TLV_FLAGS_P2P_BSS_PS_SCM: support power save on BSS station and | 89 | * @IWL_UCODE_TLV_FLAGS_P2P_BSS_PS_SCM: support power save on BSS station and |
| 90 | * P2P client interfaces simultaneously if they are in same bindings. | 90 | * P2P client interfaces simultaneously if they are in same bindings. |
| 91 | * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD | ||
| 91 | * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save | 92 | * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save |
| 92 | * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. | 93 | * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. |
| 93 | * @IWL_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients | 94 | * @IWL_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 8b5302777632..725ba49576bf 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
| @@ -667,10 +667,9 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, | |||
| 667 | if (vif->bss_conf.qos) | 667 | if (vif->bss_conf.qos) |
| 668 | cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); | 668 | cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); |
| 669 | 669 | ||
| 670 | if (vif->bss_conf.use_cts_prot) { | 670 | if (vif->bss_conf.use_cts_prot) |
| 671 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); | 671 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); |
| 672 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_SELF_CTS_EN); | 672 | |
| 673 | } | ||
| 674 | IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", | 673 | IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", |
| 675 | vif->bss_conf.use_cts_prot, | 674 | vif->bss_conf.use_cts_prot, |
| 676 | vif->bss_conf.ht_operation_mode); | 675 | vif->bss_conf.ht_operation_mode); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 7215f5980186..9bfb90680cdc 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
| @@ -303,6 +303,13 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
| 303 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; | 303 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT && | ||
| 307 | !iwlwifi_mod_params.uapsd_disable) { | ||
| 308 | hw->flags |= IEEE80211_HW_SUPPORTS_UAPSD; | ||
| 309 | hw->uapsd_queues = IWL_UAPSD_AC_INFO; | ||
| 310 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; | ||
| 311 | } | ||
| 312 | |||
| 306 | hw->sta_data_size = sizeof(struct iwl_mvm_sta); | 313 | hw->sta_data_size = sizeof(struct iwl_mvm_sta); |
| 307 | hw->vif_data_size = sizeof(struct iwl_mvm_vif); | 314 | hw->vif_data_size = sizeof(struct iwl_mvm_vif); |
| 308 | hw->chanctx_data_size = sizeof(u16); | 315 | hw->chanctx_data_size = sizeof(u16); |
| @@ -1159,8 +1166,12 @@ static void iwl_mvm_bcast_filter_iterator(void *_data, u8 *mac, | |||
| 1159 | 1166 | ||
| 1160 | bcast_mac = &cmd->macs[mvmvif->id]; | 1167 | bcast_mac = &cmd->macs[mvmvif->id]; |
| 1161 | 1168 | ||
| 1162 | /* enable filtering only for associated stations */ | 1169 | /* |
| 1163 | if (vif->type != NL80211_IFTYPE_STATION || !vif->bss_conf.assoc) | 1170 | * enable filtering only for associated stations, but not for P2P |
| 1171 | * Clients | ||
| 1172 | */ | ||
| 1173 | if (vif->type != NL80211_IFTYPE_STATION || vif->p2p || | ||
| 1174 | !vif->bss_conf.assoc) | ||
| 1164 | return; | 1175 | return; |
| 1165 | 1176 | ||
| 1166 | bcast_mac->default_discard = 1; | 1177 | bcast_mac->default_discard = 1; |
| @@ -1237,10 +1248,6 @@ static int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm, | |||
| 1237 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING)) | 1248 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING)) |
| 1238 | return 0; | 1249 | return 0; |
| 1239 | 1250 | ||
| 1240 | /* bcast filtering isn't supported for P2P client */ | ||
| 1241 | if (vif->p2p) | ||
| 1242 | return 0; | ||
| 1243 | |||
| 1244 | if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | 1251 | if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) |
| 1245 | return 0; | 1252 | return 0; |
| 1246 | 1253 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 4b6c7d4bd199..eac2b424f6a0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
| @@ -588,9 +588,7 @@ static void iwl_build_scan_cmd(struct iwl_mvm *mvm, | |||
| 588 | struct iwl_scan_offload_cmd *scan, | 588 | struct iwl_scan_offload_cmd *scan, |
| 589 | struct iwl_mvm_scan_params *params) | 589 | struct iwl_mvm_scan_params *params) |
| 590 | { | 590 | { |
| 591 | scan->channel_count = | 591 | scan->channel_count = req->n_channels; |
| 592 | mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels + | ||
| 593 | mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; | ||
| 594 | scan->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME); | 592 | scan->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME); |
| 595 | scan->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH); | 593 | scan->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH); |
| 596 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DEFAULT; | 594 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DEFAULT; |
| @@ -669,61 +667,37 @@ static void iwl_build_channel_cfg(struct iwl_mvm *mvm, | |||
| 669 | struct cfg80211_sched_scan_request *req, | 667 | struct cfg80211_sched_scan_request *req, |
| 670 | struct iwl_scan_channel_cfg *channels, | 668 | struct iwl_scan_channel_cfg *channels, |
| 671 | enum ieee80211_band band, | 669 | enum ieee80211_band band, |
| 672 | int *head, int *tail, | 670 | int *head, |
| 673 | u32 ssid_bitmap, | 671 | u32 ssid_bitmap, |
| 674 | struct iwl_mvm_scan_params *params) | 672 | struct iwl_mvm_scan_params *params) |
| 675 | { | 673 | { |
| 676 | struct ieee80211_supported_band *s_band; | 674 | int i, index = 0; |
| 677 | int n_channels = req->n_channels; | ||
| 678 | int i, j, index = 0; | ||
| 679 | bool partial; | ||
| 680 | 675 | ||
| 681 | /* | 676 | for (i = 0; i < req->n_channels; i++) { |
| 682 | * We have to configure all supported channels, even if we don't want to | 677 | struct ieee80211_channel *chan = req->channels[i]; |
| 683 | * scan on them, but we have to send channels in the order that we want | 678 | |
| 684 | * to scan. So add requested channels to head of the list and others to | 679 | if (chan->band != band) |
| 685 | * the end. | 680 | continue; |
| 686 | */ | 681 | |
| 687 | s_band = &mvm->nvm_data->bands[band]; | 682 | index = *head; |
| 688 | 683 | (*head)++; | |
| 689 | for (i = 0; i < s_band->n_channels && *head <= *tail; i++) { | 684 | |
| 690 | partial = false; | 685 | channels->channel_number[index] = cpu_to_le16(chan->hw_value); |
| 691 | for (j = 0; j < n_channels; j++) | ||
| 692 | if (s_band->channels[i].center_freq == | ||
| 693 | req->channels[j]->center_freq) { | ||
| 694 | index = *head; | ||
| 695 | (*head)++; | ||
| 696 | /* | ||
| 697 | * Channels that came with the request will be | ||
| 698 | * in partial scan . | ||
| 699 | */ | ||
| 700 | partial = true; | ||
| 701 | break; | ||
| 702 | } | ||
| 703 | if (!partial) { | ||
| 704 | index = *tail; | ||
| 705 | (*tail)--; | ||
| 706 | } | ||
| 707 | channels->channel_number[index] = | ||
| 708 | cpu_to_le16(ieee80211_frequency_to_channel( | ||
| 709 | s_band->channels[i].center_freq)); | ||
| 710 | channels->dwell_time[index][0] = params->dwell[band].active; | 686 | channels->dwell_time[index][0] = params->dwell[band].active; |
| 711 | channels->dwell_time[index][1] = params->dwell[band].passive; | 687 | channels->dwell_time[index][1] = params->dwell[band].passive; |
| 712 | 688 | ||
| 713 | channels->iter_count[index] = cpu_to_le16(1); | 689 | channels->iter_count[index] = cpu_to_le16(1); |
| 714 | channels->iter_interval[index] = 0; | 690 | channels->iter_interval[index] = 0; |
| 715 | 691 | ||
| 716 | if (!(s_band->channels[i].flags & IEEE80211_CHAN_NO_IR)) | 692 | if (!(chan->flags & IEEE80211_CHAN_NO_IR)) |
| 717 | channels->type[index] |= | 693 | channels->type[index] |= |
| 718 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE); | 694 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE); |
| 719 | 695 | ||
| 720 | channels->type[index] |= | 696 | channels->type[index] |= |
| 721 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_FULL); | 697 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_FULL | |
| 722 | if (partial) | 698 | IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL); |
| 723 | channels->type[index] |= | ||
| 724 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL); | ||
| 725 | 699 | ||
| 726 | if (s_band->channels[i].flags & IEEE80211_CHAN_NO_HT40) | 700 | if (chan->flags & IEEE80211_CHAN_NO_HT40) |
| 727 | channels->type[index] |= | 701 | channels->type[index] |= |
| 728 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_NARROW); | 702 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_NARROW); |
| 729 | 703 | ||
| @@ -740,7 +714,6 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
| 740 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; | 714 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; |
| 741 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; | 715 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; |
| 742 | int head = 0; | 716 | int head = 0; |
| 743 | int tail = band_2ghz + band_5ghz - 1; | ||
| 744 | u32 ssid_bitmap; | 717 | u32 ssid_bitmap; |
| 745 | int cmd_len; | 718 | int cmd_len; |
| 746 | int ret; | 719 | int ret; |
| @@ -772,7 +745,7 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
| 772 | &scan_cfg->scan_cmd.tx_cmd[0], | 745 | &scan_cfg->scan_cmd.tx_cmd[0], |
| 773 | scan_cfg->data); | 746 | scan_cfg->data); |
| 774 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, | 747 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, |
| 775 | IEEE80211_BAND_2GHZ, &head, &tail, | 748 | IEEE80211_BAND_2GHZ, &head, |
| 776 | ssid_bitmap, ¶ms); | 749 | ssid_bitmap, ¶ms); |
| 777 | } | 750 | } |
| 778 | if (band_5ghz) { | 751 | if (band_5ghz) { |
| @@ -782,7 +755,7 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
| 782 | scan_cfg->data + | 755 | scan_cfg->data + |
| 783 | SCAN_OFFLOAD_PROBE_REQ_SIZE); | 756 | SCAN_OFFLOAD_PROBE_REQ_SIZE); |
| 784 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, | 757 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, |
| 785 | IEEE80211_BAND_5GHZ, &head, &tail, | 758 | IEEE80211_BAND_5GHZ, &head, |
| 786 | ssid_bitmap, ¶ms); | 759 | ssid_bitmap, ¶ms); |
| 787 | } | 760 | } |
| 788 | 761 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 7091a18d5a72..98950e45c7b0 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
| @@ -367,6 +367,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
| 367 | {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, | 367 | {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, |
| 368 | {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)}, | 368 | {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)}, |
| 369 | {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, | 369 | {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, |
| 370 | {IWL_PCI_DEVICE(0x095A, 0x5510, iwl7265_2ac_cfg)}, | ||
| 370 | {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, | 371 | {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, |
| 371 | {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, | 372 | {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, |
| 372 | {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, | 373 | {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, |
| @@ -380,7 +381,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
| 380 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, | 381 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, |
| 381 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, | 382 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, |
| 382 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, | 383 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, |
| 383 | {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)}, | 384 | {IWL_PCI_DEVICE(0x095B, 0x9200, iwl7265_2ac_cfg)}, |
| 384 | {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, | 385 | {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, |
| 385 | {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, | 386 | {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, |
| 386 | {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, | 387 | {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index 5b32106182f8..fe0f66f73507 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
| @@ -185,6 +185,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
| 185 | skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); | 185 | skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); |
| 186 | tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); | 186 | tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); |
| 187 | 187 | ||
| 188 | memset(tx_info_aggr, 0, sizeof(*tx_info_aggr)); | ||
| 188 | tx_info_aggr->bss_type = tx_info_src->bss_type; | 189 | tx_info_aggr->bss_type = tx_info_src->bss_type; |
| 189 | tx_info_aggr->bss_num = tx_info_src->bss_num; | 190 | tx_info_aggr->bss_num = tx_info_src->bss_num; |
| 190 | 191 | ||
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index e95dec91a561..b511613bba2d 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
| @@ -220,6 +220,7 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | tx_info = MWIFIEX_SKB_TXCB(skb); | 222 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 223 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 223 | tx_info->bss_num = priv->bss_num; | 224 | tx_info->bss_num = priv->bss_num; |
| 224 | tx_info->bss_type = priv->bss_type; | 225 | tx_info->bss_type = priv->bss_type; |
| 225 | tx_info->pkt_len = pkt_len; | 226 | tx_info->pkt_len = pkt_len; |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 8dee6c86f4f1..c161141f6c39 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
| @@ -453,6 +453,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) | |||
| 453 | 453 | ||
| 454 | if (skb) { | 454 | if (skb) { |
| 455 | rx_info = MWIFIEX_SKB_RXCB(skb); | 455 | rx_info = MWIFIEX_SKB_RXCB(skb); |
| 456 | memset(rx_info, 0, sizeof(*rx_info)); | ||
| 456 | rx_info->bss_num = priv->bss_num; | 457 | rx_info->bss_num = priv->bss_num; |
| 457 | rx_info->bss_type = priv->bss_type; | 458 | rx_info->bss_type = priv->bss_type; |
| 458 | } | 459 | } |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index cbabc12fbda3..e91cd0fa5ca8 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
| @@ -645,6 +645,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | tx_info = MWIFIEX_SKB_TXCB(skb); | 647 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 648 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 648 | tx_info->bss_num = priv->bss_num; | 649 | tx_info->bss_num = priv->bss_num; |
| 649 | tx_info->bss_type = priv->bss_type; | 650 | tx_info->bss_type = priv->bss_type; |
| 650 | tx_info->pkt_len = skb->len; | 651 | tx_info->pkt_len = skb->len; |
diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c index 5fce7e78a36e..70eb863c7249 100644 --- a/drivers/net/wireless/mwifiex/sta_tx.c +++ b/drivers/net/wireless/mwifiex/sta_tx.c | |||
| @@ -150,6 +150,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) | |||
| 150 | return -1; | 150 | return -1; |
| 151 | 151 | ||
| 152 | tx_info = MWIFIEX_SKB_TXCB(skb); | 152 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 153 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 153 | tx_info->bss_num = priv->bss_num; | 154 | tx_info->bss_num = priv->bss_num; |
| 154 | tx_info->bss_type = priv->bss_type; | 155 | tx_info->bss_type = priv->bss_type; |
| 155 | tx_info->pkt_len = data_len - (sizeof(struct txpd) + INTF_HEADER_LEN); | 156 | tx_info->pkt_len = data_len - (sizeof(struct txpd) + INTF_HEADER_LEN); |
diff --git a/drivers/net/wireless/mwifiex/tdls.c b/drivers/net/wireless/mwifiex/tdls.c index e73034fbbde9..0e88364e0c67 100644 --- a/drivers/net/wireless/mwifiex/tdls.c +++ b/drivers/net/wireless/mwifiex/tdls.c | |||
| @@ -605,6 +605,7 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, | |||
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | tx_info = MWIFIEX_SKB_TXCB(skb); | 607 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 608 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 608 | tx_info->bss_num = priv->bss_num; | 609 | tx_info->bss_num = priv->bss_num; |
| 609 | tx_info->bss_type = priv->bss_type; | 610 | tx_info->bss_type = priv->bss_type; |
| 610 | 611 | ||
| @@ -760,6 +761,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, | |||
| 760 | skb->priority = MWIFIEX_PRIO_VI; | 761 | skb->priority = MWIFIEX_PRIO_VI; |
| 761 | 762 | ||
| 762 | tx_info = MWIFIEX_SKB_TXCB(skb); | 763 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 764 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 763 | tx_info->bss_num = priv->bss_num; | 765 | tx_info->bss_num = priv->bss_num; |
| 764 | tx_info->bss_type = priv->bss_type; | 766 | tx_info->bss_type = priv->bss_type; |
| 765 | tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; | 767 | tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index 37f26afd4314..fd7e5b9b4581 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
| @@ -55,6 +55,7 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, | |||
| 55 | return -1; | 55 | return -1; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | memset(rx_info, 0, sizeof(*rx_info)); | ||
| 58 | rx_info->bss_num = priv->bss_num; | 59 | rx_info->bss_num = priv->bss_num; |
| 59 | rx_info->bss_type = priv->bss_type; | 60 | rx_info->bss_type = priv->bss_type; |
| 60 | 61 | ||
diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c index 9a56bc61cb1d..b0601b91cc4f 100644 --- a/drivers/net/wireless/mwifiex/uap_txrx.c +++ b/drivers/net/wireless/mwifiex/uap_txrx.c | |||
| @@ -175,6 +175,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | tx_info = MWIFIEX_SKB_TXCB(skb); | 177 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 178 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 178 | tx_info->bss_num = priv->bss_num; | 179 | tx_info->bss_num = priv->bss_num; |
| 179 | tx_info->bss_type = priv->bss_type; | 180 | tx_info->bss_type = priv->bss_type; |
| 180 | tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT; | 181 | tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT; |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index e11dab2216c6..832006b5aab1 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
| @@ -231,9 +231,12 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer) | |||
| 231 | */ | 231 | */ |
| 232 | static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) | 232 | static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) |
| 233 | { | 233 | { |
| 234 | __le32 reg; | 234 | __le32 *reg; |
| 235 | u32 fw_mode; | 235 | u32 fw_mode; |
| 236 | 236 | ||
| 237 | reg = kmalloc(sizeof(*reg), GFP_KERNEL); | ||
| 238 | if (reg == NULL) | ||
| 239 | return -ENOMEM; | ||
| 237 | /* cannot use rt2x00usb_register_read here as it uses different | 240 | /* cannot use rt2x00usb_register_read here as it uses different |
| 238 | * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the | 241 | * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the |
| 239 | * magic value USB_MODE_AUTORUN (0x11) to the device, thus the | 242 | * magic value USB_MODE_AUTORUN (0x11) to the device, thus the |
| @@ -241,8 +244,9 @@ static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) | |||
| 241 | */ | 244 | */ |
| 242 | rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, | 245 | rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, |
| 243 | USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, | 246 | USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, |
| 244 | ®, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE); | 247 | reg, sizeof(*reg), REGISTER_TIMEOUT_FIRMWARE); |
| 245 | fw_mode = le32_to_cpu(reg); | 248 | fw_mode = le32_to_cpu(*reg); |
| 249 | kfree(reg); | ||
| 246 | 250 | ||
| 247 | if ((fw_mode & 0x00000003) == 2) | 251 | if ((fw_mode & 0x00000003) == 2) |
| 248 | return 1; | 252 | return 1; |
| @@ -261,6 +265,7 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
| 261 | int status; | 265 | int status; |
| 262 | u32 offset; | 266 | u32 offset; |
| 263 | u32 length; | 267 | u32 length; |
| 268 | int retval; | ||
| 264 | 269 | ||
| 265 | /* | 270 | /* |
| 266 | * Check which section of the firmware we need. | 271 | * Check which section of the firmware we need. |
| @@ -278,7 +283,10 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
| 278 | /* | 283 | /* |
| 279 | * Write firmware to device. | 284 | * Write firmware to device. |
| 280 | */ | 285 | */ |
| 281 | if (rt2800usb_autorun_detect(rt2x00dev)) { | 286 | retval = rt2800usb_autorun_detect(rt2x00dev); |
| 287 | if (retval < 0) | ||
| 288 | return retval; | ||
| 289 | if (retval) { | ||
| 282 | rt2x00_info(rt2x00dev, | 290 | rt2x00_info(rt2x00dev, |
| 283 | "Firmware loading not required - NIC in AutoRun mode\n"); | 291 | "Firmware loading not required - NIC in AutoRun mode\n"); |
| 284 | } else { | 292 | } else { |
| @@ -763,7 +771,12 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
| 763 | */ | 771 | */ |
| 764 | static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) | 772 | static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) |
| 765 | { | 773 | { |
| 766 | if (rt2800usb_autorun_detect(rt2x00dev)) | 774 | int retval; |
| 775 | |||
| 776 | retval = rt2800usb_autorun_detect(rt2x00dev); | ||
| 777 | if (retval < 0) | ||
| 778 | return retval; | ||
| 779 | if (retval) | ||
| 767 | return 1; | 780 | return 1; |
| 768 | return rt2800_efuse_detect(rt2x00dev); | 781 | return rt2800_efuse_detect(rt2x00dev); |
| 769 | } | 782 | } |
| @@ -772,7 +785,10 @@ static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) | |||
| 772 | { | 785 | { |
| 773 | int retval; | 786 | int retval; |
| 774 | 787 | ||
| 775 | if (rt2800usb_efuse_detect(rt2x00dev)) | 788 | retval = rt2800usb_efuse_detect(rt2x00dev); |
| 789 | if (retval < 0) | ||
| 790 | return retval; | ||
| 791 | if (retval) | ||
| 776 | retval = rt2800_read_eeprom_efuse(rt2x00dev); | 792 | retval = rt2800_read_eeprom_efuse(rt2x00dev); |
| 777 | else | 793 | else |
| 778 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, | 794 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 2ccb4a02368b..055222bae6e4 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
| @@ -1439,16 +1439,11 @@ static void xennet_disconnect_backend(struct netfront_info *info) | |||
| 1439 | unsigned int i = 0; | 1439 | unsigned int i = 0; |
| 1440 | unsigned int num_queues = info->netdev->real_num_tx_queues; | 1440 | unsigned int num_queues = info->netdev->real_num_tx_queues; |
| 1441 | 1441 | ||
| 1442 | netif_carrier_off(info->netdev); | ||
| 1443 | |||
| 1442 | for (i = 0; i < num_queues; ++i) { | 1444 | for (i = 0; i < num_queues; ++i) { |
| 1443 | struct netfront_queue *queue = &info->queues[i]; | 1445 | struct netfront_queue *queue = &info->queues[i]; |
| 1444 | 1446 | ||
| 1445 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ | ||
| 1446 | spin_lock_bh(&queue->rx_lock); | ||
| 1447 | spin_lock_irq(&queue->tx_lock); | ||
| 1448 | netif_carrier_off(queue->info->netdev); | ||
| 1449 | spin_unlock_irq(&queue->tx_lock); | ||
| 1450 | spin_unlock_bh(&queue->rx_lock); | ||
| 1451 | |||
| 1452 | if (queue->tx_irq && (queue->tx_irq == queue->rx_irq)) | 1447 | if (queue->tx_irq && (queue->tx_irq == queue->rx_irq)) |
| 1453 | unbind_from_irqhandler(queue->tx_irq, queue); | 1448 | unbind_from_irqhandler(queue->tx_irq, queue); |
| 1454 | if (queue->tx_irq && (queue->tx_irq != queue->rx_irq)) { | 1449 | if (queue->tx_irq && (queue->tx_irq != queue->rx_irq)) { |
| @@ -1458,6 +1453,8 @@ static void xennet_disconnect_backend(struct netfront_info *info) | |||
| 1458 | queue->tx_evtchn = queue->rx_evtchn = 0; | 1453 | queue->tx_evtchn = queue->rx_evtchn = 0; |
| 1459 | queue->tx_irq = queue->rx_irq = 0; | 1454 | queue->tx_irq = queue->rx_irq = 0; |
| 1460 | 1455 | ||
| 1456 | napi_synchronize(&queue->napi); | ||
| 1457 | |||
| 1461 | /* End access and free the pages */ | 1458 | /* End access and free the pages */ |
| 1462 | xennet_end_access(queue->tx_ring_ref, queue->tx.sring); | 1459 | xennet_end_access(queue->tx_ring_ref, queue->tx.sring); |
| 1463 | xennet_end_access(queue->rx_ring_ref, queue->rx.sring); | 1460 | xennet_end_access(queue->rx_ring_ref, queue->rx.sring); |
| @@ -2046,13 +2043,15 @@ static int xennet_connect(struct net_device *dev) | |||
| 2046 | /* By now, the queue structures have been set up */ | 2043 | /* By now, the queue structures have been set up */ |
| 2047 | for (j = 0; j < num_queues; ++j) { | 2044 | for (j = 0; j < num_queues; ++j) { |
| 2048 | queue = &np->queues[j]; | 2045 | queue = &np->queues[j]; |
| 2049 | spin_lock_bh(&queue->rx_lock); | ||
| 2050 | spin_lock_irq(&queue->tx_lock); | ||
| 2051 | 2046 | ||
| 2052 | /* Step 1: Discard all pending TX packet fragments. */ | 2047 | /* Step 1: Discard all pending TX packet fragments. */ |
| 2048 | spin_lock_irq(&queue->tx_lock); | ||
| 2053 | xennet_release_tx_bufs(queue); | 2049 | xennet_release_tx_bufs(queue); |
| 2050 | spin_unlock_irq(&queue->tx_lock); | ||
| 2054 | 2051 | ||
| 2055 | /* Step 2: Rebuild the RX buffer freelist and the RX ring itself. */ | 2052 | /* Step 2: Rebuild the RX buffer freelist and the RX ring itself. */ |
| 2053 | spin_lock_bh(&queue->rx_lock); | ||
| 2054 | |||
| 2056 | for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++) { | 2055 | for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++) { |
| 2057 | skb_frag_t *frag; | 2056 | skb_frag_t *frag; |
| 2058 | const struct page *page; | 2057 | const struct page *page; |
| @@ -2076,6 +2075,8 @@ static int xennet_connect(struct net_device *dev) | |||
| 2076 | } | 2075 | } |
| 2077 | 2076 | ||
| 2078 | queue->rx.req_prod_pvt = requeue_idx; | 2077 | queue->rx.req_prod_pvt = requeue_idx; |
| 2078 | |||
| 2079 | spin_unlock_bh(&queue->rx_lock); | ||
| 2079 | } | 2080 | } |
| 2080 | 2081 | ||
| 2081 | /* | 2082 | /* |
| @@ -2087,13 +2088,17 @@ static int xennet_connect(struct net_device *dev) | |||
| 2087 | netif_carrier_on(np->netdev); | 2088 | netif_carrier_on(np->netdev); |
| 2088 | for (j = 0; j < num_queues; ++j) { | 2089 | for (j = 0; j < num_queues; ++j) { |
| 2089 | queue = &np->queues[j]; | 2090 | queue = &np->queues[j]; |
| 2091 | |||
| 2090 | notify_remote_via_irq(queue->tx_irq); | 2092 | notify_remote_via_irq(queue->tx_irq); |
| 2091 | if (queue->tx_irq != queue->rx_irq) | 2093 | if (queue->tx_irq != queue->rx_irq) |
| 2092 | notify_remote_via_irq(queue->rx_irq); | 2094 | notify_remote_via_irq(queue->rx_irq); |
| 2093 | xennet_tx_buf_gc(queue); | ||
| 2094 | xennet_alloc_rx_buffers(queue); | ||
| 2095 | 2095 | ||
| 2096 | spin_lock_irq(&queue->tx_lock); | ||
| 2097 | xennet_tx_buf_gc(queue); | ||
| 2096 | spin_unlock_irq(&queue->tx_lock); | 2098 | spin_unlock_irq(&queue->tx_lock); |
| 2099 | |||
| 2100 | spin_lock_bh(&queue->rx_lock); | ||
| 2101 | xennet_alloc_rx_buffers(queue); | ||
| 2097 | spin_unlock_bh(&queue->rx_lock); | 2102 | spin_unlock_bh(&queue->rx_lock); |
| 2098 | } | 2103 | } |
| 2099 | 2104 | ||
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index a3bf2122a8d5..401b2453da45 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
| @@ -182,40 +182,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
| 182 | } | 182 | } |
| 183 | EXPORT_SYMBOL(of_mdiobus_register); | 183 | EXPORT_SYMBOL(of_mdiobus_register); |
| 184 | 184 | ||
| 185 | /** | ||
| 186 | * of_mdiobus_link_phydev - Find a device node for a phy | ||
| 187 | * @mdio: pointer to mii_bus structure | ||
| 188 | * @phydev: phydev for which the of_node pointer should be set | ||
| 189 | * | ||
| 190 | * Walk the list of subnodes of a mdio bus and look for a node that matches the | ||
| 191 | * phy's address with its 'reg' property. If found, set the of_node pointer for | ||
| 192 | * the phy. This allows auto-probed pyh devices to be supplied with information | ||
| 193 | * passed in via DT. | ||
| 194 | */ | ||
| 195 | void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 196 | struct phy_device *phydev) | ||
| 197 | { | ||
| 198 | struct device *dev = &phydev->dev; | ||
| 199 | struct device_node *child; | ||
| 200 | |||
| 201 | if (dev->of_node || !mdio->dev.of_node) | ||
| 202 | return; | ||
| 203 | |||
| 204 | for_each_available_child_of_node(mdio->dev.of_node, child) { | ||
| 205 | int addr; | ||
| 206 | |||
| 207 | addr = of_mdio_parse_addr(&mdio->dev, child); | ||
| 208 | if (addr < 0) | ||
| 209 | continue; | ||
| 210 | |||
| 211 | if (addr == phydev->addr) { | ||
| 212 | dev->of_node = child; | ||
| 213 | return; | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | EXPORT_SYMBOL(of_mdiobus_link_phydev); | ||
| 218 | |||
| 219 | /* Helper function for of_phy_find_device */ | 185 | /* Helper function for of_phy_find_device */ |
| 220 | static int of_phy_match(struct device *dev, void *phy_np) | 186 | static int of_phy_match(struct device *dev, void *phy_np) |
| 221 | { | 187 | { |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index b7a506f2bb14..5c660c77f03b 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -426,20 +426,18 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
| 426 | * p2m are consistent. | 426 | * p2m are consistent. |
| 427 | */ | 427 | */ |
| 428 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 428 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
| 429 | unsigned long p; | ||
| 430 | struct page *scratch_page = get_balloon_scratch_page(); | ||
| 431 | |||
| 432 | if (!PageHighMem(page)) { | 429 | if (!PageHighMem(page)) { |
| 430 | struct page *scratch_page = get_balloon_scratch_page(); | ||
| 431 | |||
| 433 | ret = HYPERVISOR_update_va_mapping( | 432 | ret = HYPERVISOR_update_va_mapping( |
| 434 | (unsigned long)__va(pfn << PAGE_SHIFT), | 433 | (unsigned long)__va(pfn << PAGE_SHIFT), |
| 435 | pfn_pte(page_to_pfn(scratch_page), | 434 | pfn_pte(page_to_pfn(scratch_page), |
| 436 | PAGE_KERNEL_RO), 0); | 435 | PAGE_KERNEL_RO), 0); |
| 437 | BUG_ON(ret); | 436 | BUG_ON(ret); |
| 438 | } | ||
| 439 | p = page_to_pfn(scratch_page); | ||
| 440 | __set_phys_to_machine(pfn, pfn_to_mfn(p)); | ||
| 441 | 437 | ||
| 442 | put_balloon_scratch_page(); | 438 | put_balloon_scratch_page(); |
| 439 | } | ||
| 440 | __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); | ||
| 443 | } | 441 | } |
| 444 | #endif | 442 | #endif |
| 445 | 443 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index c3667b202f2f..5f1e1f3cd186 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -88,7 +88,6 @@ static int xen_suspend(void *data) | |||
| 88 | 88 | ||
| 89 | if (!si->cancelled) { | 89 | if (!si->cancelled) { |
| 90 | xen_irq_resume(); | 90 | xen_irq_resume(); |
| 91 | xen_console_resume(); | ||
| 92 | xen_timer_resume(); | 91 | xen_timer_resume(); |
| 93 | } | 92 | } |
| 94 | 93 | ||
| @@ -135,6 +134,10 @@ static void do_suspend(void) | |||
| 135 | 134 | ||
| 136 | err = stop_machine(xen_suspend, &si, cpumask_of(0)); | 135 | err = stop_machine(xen_suspend, &si, cpumask_of(0)); |
| 137 | 136 | ||
| 137 | /* Resume console as early as possible. */ | ||
| 138 | if (!si.cancelled) | ||
| 139 | xen_console_resume(); | ||
| 140 | |||
| 138 | raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); | 141 | raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); |
| 139 | 142 | ||
| 140 | dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE); | 143 | dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE); |
| @@ -830,16 +830,20 @@ void exit_aio(struct mm_struct *mm) | |||
| 830 | static void put_reqs_available(struct kioctx *ctx, unsigned nr) | 830 | static void put_reqs_available(struct kioctx *ctx, unsigned nr) |
| 831 | { | 831 | { |
| 832 | struct kioctx_cpu *kcpu; | 832 | struct kioctx_cpu *kcpu; |
| 833 | unsigned long flags; | ||
| 833 | 834 | ||
| 834 | preempt_disable(); | 835 | preempt_disable(); |
| 835 | kcpu = this_cpu_ptr(ctx->cpu); | 836 | kcpu = this_cpu_ptr(ctx->cpu); |
| 836 | 837 | ||
| 838 | local_irq_save(flags); | ||
| 837 | kcpu->reqs_available += nr; | 839 | kcpu->reqs_available += nr; |
| 840 | |||
| 838 | while (kcpu->reqs_available >= ctx->req_batch * 2) { | 841 | while (kcpu->reqs_available >= ctx->req_batch * 2) { |
| 839 | kcpu->reqs_available -= ctx->req_batch; | 842 | kcpu->reqs_available -= ctx->req_batch; |
| 840 | atomic_add(ctx->req_batch, &ctx->reqs_available); | 843 | atomic_add(ctx->req_batch, &ctx->reqs_available); |
| 841 | } | 844 | } |
| 842 | 845 | ||
| 846 | local_irq_restore(flags); | ||
| 843 | preempt_enable(); | 847 | preempt_enable(); |
| 844 | } | 848 | } |
| 845 | 849 | ||
| @@ -847,10 +851,12 @@ static bool get_reqs_available(struct kioctx *ctx) | |||
| 847 | { | 851 | { |
| 848 | struct kioctx_cpu *kcpu; | 852 | struct kioctx_cpu *kcpu; |
| 849 | bool ret = false; | 853 | bool ret = false; |
| 854 | unsigned long flags; | ||
| 850 | 855 | ||
| 851 | preempt_disable(); | 856 | preempt_disable(); |
| 852 | kcpu = this_cpu_ptr(ctx->cpu); | 857 | kcpu = this_cpu_ptr(ctx->cpu); |
| 853 | 858 | ||
| 859 | local_irq_save(flags); | ||
| 854 | if (!kcpu->reqs_available) { | 860 | if (!kcpu->reqs_available) { |
| 855 | int old, avail = atomic_read(&ctx->reqs_available); | 861 | int old, avail = atomic_read(&ctx->reqs_available); |
| 856 | 862 | ||
| @@ -869,6 +875,7 @@ static bool get_reqs_available(struct kioctx *ctx) | |||
| 869 | ret = true; | 875 | ret = true; |
| 870 | kcpu->reqs_available--; | 876 | kcpu->reqs_available--; |
| 871 | out: | 877 | out: |
| 878 | local_irq_restore(flags); | ||
| 872 | preempt_enable(); | 879 | preempt_enable(); |
| 873 | return ret; | 880 | return ret; |
| 874 | } | 881 | } |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index e12441c7cf1d..7187b14faa6c 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
| @@ -484,8 +484,19 @@ void btrfs_wait_logged_extents(struct btrfs_root *log, u64 transid) | |||
| 484 | log_list); | 484 | log_list); |
| 485 | list_del_init(&ordered->log_list); | 485 | list_del_init(&ordered->log_list); |
| 486 | spin_unlock_irq(&log->log_extents_lock[index]); | 486 | spin_unlock_irq(&log->log_extents_lock[index]); |
| 487 | |||
| 488 | if (!test_bit(BTRFS_ORDERED_IO_DONE, &ordered->flags) && | ||
| 489 | !test_bit(BTRFS_ORDERED_DIRECT, &ordered->flags)) { | ||
| 490 | struct inode *inode = ordered->inode; | ||
| 491 | u64 start = ordered->file_offset; | ||
| 492 | u64 end = ordered->file_offset + ordered->len - 1; | ||
| 493 | |||
| 494 | WARN_ON(!inode); | ||
| 495 | filemap_fdatawrite_range(inode->i_mapping, start, end); | ||
| 496 | } | ||
| 487 | wait_event(ordered->wait, test_bit(BTRFS_ORDERED_IO_DONE, | 497 | wait_event(ordered->wait, test_bit(BTRFS_ORDERED_IO_DONE, |
| 488 | &ordered->flags)); | 498 | &ordered->flags)); |
| 499 | |||
| 489 | btrfs_put_ordered_extent(ordered); | 500 | btrfs_put_ordered_extent(ordered); |
| 490 | spin_lock_irq(&log->log_extents_lock[index]); | 501 | spin_lock_irq(&log->log_extents_lock[index]); |
| 491 | } | 502 | } |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6104676857f5..6cb82f62cb7c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -1680,11 +1680,11 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
| 1680 | if (device->bdev == root->fs_info->fs_devices->latest_bdev) | 1680 | if (device->bdev == root->fs_info->fs_devices->latest_bdev) |
| 1681 | root->fs_info->fs_devices->latest_bdev = next_device->bdev; | 1681 | root->fs_info->fs_devices->latest_bdev = next_device->bdev; |
| 1682 | 1682 | ||
| 1683 | if (device->bdev) | 1683 | if (device->bdev) { |
| 1684 | device->fs_devices->open_devices--; | 1684 | device->fs_devices->open_devices--; |
| 1685 | 1685 | /* remove sysfs entry */ | |
| 1686 | /* remove sysfs entry */ | 1686 | btrfs_kobj_rm_device(root->fs_info, device); |
| 1687 | btrfs_kobj_rm_device(root->fs_info, device); | 1687 | } |
| 1688 | 1688 | ||
| 1689 | call_rcu(&device->rcu, free_device); | 1689 | call_rcu(&device->rcu, free_device); |
| 1690 | 1690 | ||
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 098f97bdcf1b..ca887314aba9 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -643,9 +643,8 @@ struct fuse_copy_state { | |||
| 643 | unsigned long seglen; | 643 | unsigned long seglen; |
| 644 | unsigned long addr; | 644 | unsigned long addr; |
| 645 | struct page *pg; | 645 | struct page *pg; |
| 646 | void *mapaddr; | ||
| 647 | void *buf; | ||
| 648 | unsigned len; | 646 | unsigned len; |
| 647 | unsigned offset; | ||
| 649 | unsigned move_pages:1; | 648 | unsigned move_pages:1; |
| 650 | }; | 649 | }; |
| 651 | 650 | ||
| @@ -666,23 +665,17 @@ static void fuse_copy_finish(struct fuse_copy_state *cs) | |||
| 666 | if (cs->currbuf) { | 665 | if (cs->currbuf) { |
| 667 | struct pipe_buffer *buf = cs->currbuf; | 666 | struct pipe_buffer *buf = cs->currbuf; |
| 668 | 667 | ||
| 669 | if (!cs->write) { | 668 | if (cs->write) |
| 670 | kunmap_atomic(cs->mapaddr); | ||
| 671 | } else { | ||
| 672 | kunmap_atomic(cs->mapaddr); | ||
| 673 | buf->len = PAGE_SIZE - cs->len; | 669 | buf->len = PAGE_SIZE - cs->len; |
| 674 | } | ||
| 675 | cs->currbuf = NULL; | 670 | cs->currbuf = NULL; |
| 676 | cs->mapaddr = NULL; | 671 | } else if (cs->pg) { |
| 677 | } else if (cs->mapaddr) { | ||
| 678 | kunmap_atomic(cs->mapaddr); | ||
| 679 | if (cs->write) { | 672 | if (cs->write) { |
| 680 | flush_dcache_page(cs->pg); | 673 | flush_dcache_page(cs->pg); |
| 681 | set_page_dirty_lock(cs->pg); | 674 | set_page_dirty_lock(cs->pg); |
| 682 | } | 675 | } |
| 683 | put_page(cs->pg); | 676 | put_page(cs->pg); |
| 684 | cs->mapaddr = NULL; | ||
| 685 | } | 677 | } |
| 678 | cs->pg = NULL; | ||
| 686 | } | 679 | } |
| 687 | 680 | ||
| 688 | /* | 681 | /* |
| @@ -691,7 +684,7 @@ static void fuse_copy_finish(struct fuse_copy_state *cs) | |||
| 691 | */ | 684 | */ |
| 692 | static int fuse_copy_fill(struct fuse_copy_state *cs) | 685 | static int fuse_copy_fill(struct fuse_copy_state *cs) |
| 693 | { | 686 | { |
| 694 | unsigned long offset; | 687 | struct page *page; |
| 695 | int err; | 688 | int err; |
| 696 | 689 | ||
| 697 | unlock_request(cs->fc, cs->req); | 690 | unlock_request(cs->fc, cs->req); |
| @@ -706,14 +699,12 @@ static int fuse_copy_fill(struct fuse_copy_state *cs) | |||
| 706 | 699 | ||
| 707 | BUG_ON(!cs->nr_segs); | 700 | BUG_ON(!cs->nr_segs); |
| 708 | cs->currbuf = buf; | 701 | cs->currbuf = buf; |
| 709 | cs->mapaddr = kmap_atomic(buf->page); | 702 | cs->pg = buf->page; |
| 703 | cs->offset = buf->offset; | ||
| 710 | cs->len = buf->len; | 704 | cs->len = buf->len; |
| 711 | cs->buf = cs->mapaddr + buf->offset; | ||
| 712 | cs->pipebufs++; | 705 | cs->pipebufs++; |
| 713 | cs->nr_segs--; | 706 | cs->nr_segs--; |
| 714 | } else { | 707 | } else { |
| 715 | struct page *page; | ||
| 716 | |||
| 717 | if (cs->nr_segs == cs->pipe->buffers) | 708 | if (cs->nr_segs == cs->pipe->buffers) |
| 718 | return -EIO; | 709 | return -EIO; |
| 719 | 710 | ||
| @@ -726,8 +717,8 @@ static int fuse_copy_fill(struct fuse_copy_state *cs) | |||
| 726 | buf->len = 0; | 717 | buf->len = 0; |
| 727 | 718 | ||
| 728 | cs->currbuf = buf; | 719 | cs->currbuf = buf; |
| 729 | cs->mapaddr = kmap_atomic(page); | 720 | cs->pg = page; |
| 730 | cs->buf = cs->mapaddr; | 721 | cs->offset = 0; |
| 731 | cs->len = PAGE_SIZE; | 722 | cs->len = PAGE_SIZE; |
| 732 | cs->pipebufs++; | 723 | cs->pipebufs++; |
| 733 | cs->nr_segs++; | 724 | cs->nr_segs++; |
| @@ -740,14 +731,13 @@ static int fuse_copy_fill(struct fuse_copy_state *cs) | |||
| 740 | cs->iov++; | 731 | cs->iov++; |
| 741 | cs->nr_segs--; | 732 | cs->nr_segs--; |
| 742 | } | 733 | } |
| 743 | err = get_user_pages_fast(cs->addr, 1, cs->write, &cs->pg); | 734 | err = get_user_pages_fast(cs->addr, 1, cs->write, &page); |
| 744 | if (err < 0) | 735 | if (err < 0) |
| 745 | return err; | 736 | return err; |
| 746 | BUG_ON(err != 1); | 737 | BUG_ON(err != 1); |
| 747 | offset = cs->addr % PAGE_SIZE; | 738 | cs->pg = page; |
| 748 | cs->mapaddr = kmap_atomic(cs->pg); | 739 | cs->offset = cs->addr % PAGE_SIZE; |
| 749 | cs->buf = cs->mapaddr + offset; | 740 | cs->len = min(PAGE_SIZE - cs->offset, cs->seglen); |
| 750 | cs->len = min(PAGE_SIZE - offset, cs->seglen); | ||
| 751 | cs->seglen -= cs->len; | 741 | cs->seglen -= cs->len; |
| 752 | cs->addr += cs->len; | 742 | cs->addr += cs->len; |
| 753 | } | 743 | } |
| @@ -760,15 +750,20 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size) | |||
| 760 | { | 750 | { |
| 761 | unsigned ncpy = min(*size, cs->len); | 751 | unsigned ncpy = min(*size, cs->len); |
| 762 | if (val) { | 752 | if (val) { |
| 753 | void *pgaddr = kmap_atomic(cs->pg); | ||
| 754 | void *buf = pgaddr + cs->offset; | ||
| 755 | |||
| 763 | if (cs->write) | 756 | if (cs->write) |
| 764 | memcpy(cs->buf, *val, ncpy); | 757 | memcpy(buf, *val, ncpy); |
| 765 | else | 758 | else |
| 766 | memcpy(*val, cs->buf, ncpy); | 759 | memcpy(*val, buf, ncpy); |
| 760 | |||
| 761 | kunmap_atomic(pgaddr); | ||
| 767 | *val += ncpy; | 762 | *val += ncpy; |
| 768 | } | 763 | } |
| 769 | *size -= ncpy; | 764 | *size -= ncpy; |
| 770 | cs->len -= ncpy; | 765 | cs->len -= ncpy; |
| 771 | cs->buf += ncpy; | 766 | cs->offset += ncpy; |
| 772 | return ncpy; | 767 | return ncpy; |
| 773 | } | 768 | } |
| 774 | 769 | ||
| @@ -874,8 +869,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) | |||
| 874 | out_fallback_unlock: | 869 | out_fallback_unlock: |
| 875 | unlock_page(newpage); | 870 | unlock_page(newpage); |
| 876 | out_fallback: | 871 | out_fallback: |
| 877 | cs->mapaddr = kmap_atomic(buf->page); | 872 | cs->pg = buf->page; |
| 878 | cs->buf = cs->mapaddr + buf->offset; | 873 | cs->offset = buf->offset; |
| 879 | 874 | ||
| 880 | err = lock_request(cs->fc, cs->req); | 875 | err = lock_request(cs->fc, cs->req); |
| 881 | if (err) | 876 | if (err) |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 42198359fa1b..0c6048247a34 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
| @@ -198,7 +198,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) | |||
| 198 | inode = ACCESS_ONCE(entry->d_inode); | 198 | inode = ACCESS_ONCE(entry->d_inode); |
| 199 | if (inode && is_bad_inode(inode)) | 199 | if (inode && is_bad_inode(inode)) |
| 200 | goto invalid; | 200 | goto invalid; |
| 201 | else if (fuse_dentry_time(entry) < get_jiffies_64()) { | 201 | else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || |
| 202 | (flags & LOOKUP_REVAL)) { | ||
| 202 | int err; | 203 | int err; |
| 203 | struct fuse_entry_out outarg; | 204 | struct fuse_entry_out outarg; |
| 204 | struct fuse_req *req; | 205 | struct fuse_req *req; |
| @@ -814,13 +815,6 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, | |||
| 814 | return err; | 815 | return err; |
| 815 | } | 816 | } |
| 816 | 817 | ||
| 817 | static int fuse_rename(struct inode *olddir, struct dentry *oldent, | ||
| 818 | struct inode *newdir, struct dentry *newent) | ||
| 819 | { | ||
| 820 | return fuse_rename_common(olddir, oldent, newdir, newent, 0, | ||
| 821 | FUSE_RENAME, sizeof(struct fuse_rename_in)); | ||
| 822 | } | ||
| 823 | |||
| 824 | static int fuse_rename2(struct inode *olddir, struct dentry *oldent, | 818 | static int fuse_rename2(struct inode *olddir, struct dentry *oldent, |
| 825 | struct inode *newdir, struct dentry *newent, | 819 | struct inode *newdir, struct dentry *newent, |
| 826 | unsigned int flags) | 820 | unsigned int flags) |
| @@ -831,17 +825,30 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent, | |||
| 831 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) | 825 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) |
| 832 | return -EINVAL; | 826 | return -EINVAL; |
| 833 | 827 | ||
| 834 | if (fc->no_rename2 || fc->minor < 23) | 828 | if (flags) { |
| 835 | return -EINVAL; | 829 | if (fc->no_rename2 || fc->minor < 23) |
| 830 | return -EINVAL; | ||
| 836 | 831 | ||
| 837 | err = fuse_rename_common(olddir, oldent, newdir, newent, flags, | 832 | err = fuse_rename_common(olddir, oldent, newdir, newent, flags, |
| 838 | FUSE_RENAME2, sizeof(struct fuse_rename2_in)); | 833 | FUSE_RENAME2, |
| 839 | if (err == -ENOSYS) { | 834 | sizeof(struct fuse_rename2_in)); |
| 840 | fc->no_rename2 = 1; | 835 | if (err == -ENOSYS) { |
| 841 | err = -EINVAL; | 836 | fc->no_rename2 = 1; |
| 837 | err = -EINVAL; | ||
| 838 | } | ||
| 839 | } else { | ||
| 840 | err = fuse_rename_common(olddir, oldent, newdir, newent, 0, | ||
| 841 | FUSE_RENAME, | ||
| 842 | sizeof(struct fuse_rename_in)); | ||
| 842 | } | 843 | } |
| 844 | |||
| 843 | return err; | 845 | return err; |
| 846 | } | ||
| 844 | 847 | ||
| 848 | static int fuse_rename(struct inode *olddir, struct dentry *oldent, | ||
| 849 | struct inode *newdir, struct dentry *newent) | ||
| 850 | { | ||
| 851 | return fuse_rename2(olddir, oldent, newdir, newent, 0); | ||
| 845 | } | 852 | } |
| 846 | 853 | ||
| 847 | static int fuse_link(struct dentry *entry, struct inode *newdir, | 854 | static int fuse_link(struct dentry *entry, struct inode *newdir, |
| @@ -985,7 +992,7 @@ int fuse_update_attributes(struct inode *inode, struct kstat *stat, | |||
| 985 | int err; | 992 | int err; |
| 986 | bool r; | 993 | bool r; |
| 987 | 994 | ||
| 988 | if (fi->i_time < get_jiffies_64()) { | 995 | if (time_before64(fi->i_time, get_jiffies_64())) { |
| 989 | r = true; | 996 | r = true; |
| 990 | err = fuse_do_getattr(inode, stat, file); | 997 | err = fuse_do_getattr(inode, stat, file); |
| 991 | } else { | 998 | } else { |
| @@ -1171,7 +1178,7 @@ static int fuse_permission(struct inode *inode, int mask) | |||
| 1171 | ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) { | 1178 | ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) { |
| 1172 | struct fuse_inode *fi = get_fuse_inode(inode); | 1179 | struct fuse_inode *fi = get_fuse_inode(inode); |
| 1173 | 1180 | ||
| 1174 | if (fi->i_time < get_jiffies_64()) { | 1181 | if (time_before64(fi->i_time, get_jiffies_64())) { |
| 1175 | refreshed = true; | 1182 | refreshed = true; |
| 1176 | 1183 | ||
| 1177 | err = fuse_perm_getattr(inode, mask); | 1184 | err = fuse_perm_getattr(inode, mask); |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 6e16dad13e9b..40ac2628ddcf 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -1687,7 +1687,7 @@ static int fuse_writepage_locked(struct page *page) | |||
| 1687 | error = -EIO; | 1687 | error = -EIO; |
| 1688 | req->ff = fuse_write_file_get(fc, fi); | 1688 | req->ff = fuse_write_file_get(fc, fi); |
| 1689 | if (!req->ff) | 1689 | if (!req->ff) |
| 1690 | goto err_free; | 1690 | goto err_nofile; |
| 1691 | 1691 | ||
| 1692 | fuse_write_fill(req, req->ff, page_offset(page), 0); | 1692 | fuse_write_fill(req, req->ff, page_offset(page), 0); |
| 1693 | 1693 | ||
| @@ -1715,6 +1715,8 @@ static int fuse_writepage_locked(struct page *page) | |||
| 1715 | 1715 | ||
| 1716 | return 0; | 1716 | return 0; |
| 1717 | 1717 | ||
| 1718 | err_nofile: | ||
| 1719 | __free_page(tmp_page); | ||
| 1718 | err_free: | 1720 | err_free: |
| 1719 | fuse_request_free(req); | 1721 | fuse_request_free(req); |
| 1720 | err: | 1722 | err: |
| @@ -1955,8 +1957,8 @@ static int fuse_writepages(struct address_space *mapping, | |||
| 1955 | data.ff = NULL; | 1957 | data.ff = NULL; |
| 1956 | 1958 | ||
| 1957 | err = -ENOMEM; | 1959 | err = -ENOMEM; |
| 1958 | data.orig_pages = kzalloc(sizeof(struct page *) * | 1960 | data.orig_pages = kcalloc(FUSE_MAX_PAGES_PER_REQ, |
| 1959 | FUSE_MAX_PAGES_PER_REQ, | 1961 | sizeof(struct page *), |
| 1960 | GFP_NOFS); | 1962 | GFP_NOFS); |
| 1961 | if (!data.orig_pages) | 1963 | if (!data.orig_pages) |
| 1962 | goto out; | 1964 | goto out; |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 754dcf23de8a..8474028d7848 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -478,6 +478,17 @@ static const match_table_t tokens = { | |||
| 478 | {OPT_ERR, NULL} | 478 | {OPT_ERR, NULL} |
| 479 | }; | 479 | }; |
| 480 | 480 | ||
| 481 | static int fuse_match_uint(substring_t *s, unsigned int *res) | ||
| 482 | { | ||
| 483 | int err = -ENOMEM; | ||
| 484 | char *buf = match_strdup(s); | ||
| 485 | if (buf) { | ||
| 486 | err = kstrtouint(buf, 10, res); | ||
| 487 | kfree(buf); | ||
| 488 | } | ||
| 489 | return err; | ||
| 490 | } | ||
| 491 | |||
| 481 | static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev) | 492 | static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev) |
| 482 | { | 493 | { |
| 483 | char *p; | 494 | char *p; |
| @@ -488,6 +499,7 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev) | |||
| 488 | while ((p = strsep(&opt, ",")) != NULL) { | 499 | while ((p = strsep(&opt, ",")) != NULL) { |
| 489 | int token; | 500 | int token; |
| 490 | int value; | 501 | int value; |
| 502 | unsigned uv; | ||
| 491 | substring_t args[MAX_OPT_ARGS]; | 503 | substring_t args[MAX_OPT_ARGS]; |
| 492 | if (!*p) | 504 | if (!*p) |
| 493 | continue; | 505 | continue; |
| @@ -511,18 +523,18 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev) | |||
| 511 | break; | 523 | break; |
| 512 | 524 | ||
| 513 | case OPT_USER_ID: | 525 | case OPT_USER_ID: |
| 514 | if (match_int(&args[0], &value)) | 526 | if (fuse_match_uint(&args[0], &uv)) |
| 515 | return 0; | 527 | return 0; |
| 516 | d->user_id = make_kuid(current_user_ns(), value); | 528 | d->user_id = make_kuid(current_user_ns(), uv); |
| 517 | if (!uid_valid(d->user_id)) | 529 | if (!uid_valid(d->user_id)) |
| 518 | return 0; | 530 | return 0; |
| 519 | d->user_id_present = 1; | 531 | d->user_id_present = 1; |
| 520 | break; | 532 | break; |
| 521 | 533 | ||
| 522 | case OPT_GROUP_ID: | 534 | case OPT_GROUP_ID: |
| 523 | if (match_int(&args[0], &value)) | 535 | if (fuse_match_uint(&args[0], &uv)) |
| 524 | return 0; | 536 | return 0; |
| 525 | d->group_id = make_kgid(current_user_ns(), value); | 537 | d->group_id = make_kgid(current_user_ns(), uv); |
| 526 | if (!gid_valid(d->group_id)) | 538 | if (!gid_valid(d->group_id)) |
| 527 | return 0; | 539 | return 0; |
| 528 | d->group_id_present = 1; | 540 | d->group_id_present = 1; |
| @@ -1006,7 +1018,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
| 1006 | 1018 | ||
| 1007 | sb->s_flags &= ~(MS_NOSEC | MS_I_VERSION); | 1019 | sb->s_flags &= ~(MS_NOSEC | MS_I_VERSION); |
| 1008 | 1020 | ||
| 1009 | if (!parse_fuse_opt((char *) data, &d, is_bdev)) | 1021 | if (!parse_fuse_opt(data, &d, is_bdev)) |
| 1010 | goto err; | 1022 | goto err; |
| 1011 | 1023 | ||
| 1012 | if (is_bdev) { | 1024 | if (is_bdev) { |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 4fc3a3046174..26b3f952e6b1 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
| @@ -981,7 +981,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
| 981 | int error = 0; | 981 | int error = 0; |
| 982 | 982 | ||
| 983 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; | 983 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; |
| 984 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE; | 984 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT; |
| 985 | 985 | ||
| 986 | mutex_lock(&fp->f_fl_mutex); | 986 | mutex_lock(&fp->f_fl_mutex); |
| 987 | 987 | ||
| @@ -991,7 +991,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
| 991 | goto out; | 991 | goto out; |
| 992 | flock_lock_file_wait(file, | 992 | flock_lock_file_wait(file, |
| 993 | &(struct file_lock){.fl_type = F_UNLCK}); | 993 | &(struct file_lock){.fl_type = F_UNLCK}); |
| 994 | gfs2_glock_dq_wait(fl_gh); | 994 | gfs2_glock_dq(fl_gh); |
| 995 | gfs2_holder_reinit(state, flags, fl_gh); | 995 | gfs2_holder_reinit(state, flags, fl_gh); |
| 996 | } else { | 996 | } else { |
| 997 | error = gfs2_glock_get(GFS2_SB(&ip->i_inode), ip->i_no_addr, | 997 | error = gfs2_glock_get(GFS2_SB(&ip->i_inode), ip->i_no_addr, |
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index c355f7320e44..ee4e04fe60fc 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
| @@ -731,14 +731,14 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
| 731 | cachep = gfs2_glock_aspace_cachep; | 731 | cachep = gfs2_glock_aspace_cachep; |
| 732 | else | 732 | else |
| 733 | cachep = gfs2_glock_cachep; | 733 | cachep = gfs2_glock_cachep; |
| 734 | gl = kmem_cache_alloc(cachep, GFP_KERNEL); | 734 | gl = kmem_cache_alloc(cachep, GFP_NOFS); |
| 735 | if (!gl) | 735 | if (!gl) |
| 736 | return -ENOMEM; | 736 | return -ENOMEM; |
| 737 | 737 | ||
| 738 | memset(&gl->gl_lksb, 0, sizeof(struct dlm_lksb)); | 738 | memset(&gl->gl_lksb, 0, sizeof(struct dlm_lksb)); |
| 739 | 739 | ||
| 740 | if (glops->go_flags & GLOF_LVB) { | 740 | if (glops->go_flags & GLOF_LVB) { |
| 741 | gl->gl_lksb.sb_lvbptr = kzalloc(GFS2_MIN_LVB_SIZE, GFP_KERNEL); | 741 | gl->gl_lksb.sb_lvbptr = kzalloc(GFS2_MIN_LVB_SIZE, GFP_NOFS); |
| 742 | if (!gl->gl_lksb.sb_lvbptr) { | 742 | if (!gl->gl_lksb.sb_lvbptr) { |
| 743 | kmem_cache_free(cachep, gl); | 743 | kmem_cache_free(cachep, gl); |
| 744 | return -ENOMEM; | 744 | return -ENOMEM; |
| @@ -1404,12 +1404,16 @@ __acquires(&lru_lock) | |||
| 1404 | gl = list_entry(list->next, struct gfs2_glock, gl_lru); | 1404 | gl = list_entry(list->next, struct gfs2_glock, gl_lru); |
| 1405 | list_del_init(&gl->gl_lru); | 1405 | list_del_init(&gl->gl_lru); |
| 1406 | if (!spin_trylock(&gl->gl_spin)) { | 1406 | if (!spin_trylock(&gl->gl_spin)) { |
| 1407 | add_back_to_lru: | ||
| 1407 | list_add(&gl->gl_lru, &lru_list); | 1408 | list_add(&gl->gl_lru, &lru_list); |
| 1408 | atomic_inc(&lru_count); | 1409 | atomic_inc(&lru_count); |
| 1409 | continue; | 1410 | continue; |
| 1410 | } | 1411 | } |
| 1412 | if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { | ||
| 1413 | spin_unlock(&gl->gl_spin); | ||
| 1414 | goto add_back_to_lru; | ||
| 1415 | } | ||
| 1411 | clear_bit(GLF_LRU, &gl->gl_flags); | 1416 | clear_bit(GLF_LRU, &gl->gl_flags); |
| 1412 | spin_unlock(&lru_lock); | ||
| 1413 | gl->gl_lockref.count++; | 1417 | gl->gl_lockref.count++; |
| 1414 | if (demote_ok(gl)) | 1418 | if (demote_ok(gl)) |
| 1415 | handle_callback(gl, LM_ST_UNLOCKED, 0, false); | 1419 | handle_callback(gl, LM_ST_UNLOCKED, 0, false); |
| @@ -1417,7 +1421,7 @@ __acquires(&lru_lock) | |||
| 1417 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) | 1421 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) |
| 1418 | gl->gl_lockref.count--; | 1422 | gl->gl_lockref.count--; |
| 1419 | spin_unlock(&gl->gl_spin); | 1423 | spin_unlock(&gl->gl_spin); |
| 1420 | spin_lock(&lru_lock); | 1424 | cond_resched_lock(&lru_lock); |
| 1421 | } | 1425 | } |
| 1422 | } | 1426 | } |
| 1423 | 1427 | ||
| @@ -1442,7 +1446,7 @@ static long gfs2_scan_glock_lru(int nr) | |||
| 1442 | gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru); | 1446 | gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru); |
| 1443 | 1447 | ||
| 1444 | /* Test for being demotable */ | 1448 | /* Test for being demotable */ |
| 1445 | if (!test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { | 1449 | if (!test_bit(GLF_LOCK, &gl->gl_flags)) { |
| 1446 | list_move(&gl->gl_lru, &dispose); | 1450 | list_move(&gl->gl_lru, &dispose); |
| 1447 | atomic_dec(&lru_count); | 1451 | atomic_dec(&lru_count); |
| 1448 | freed++; | 1452 | freed++; |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index fc1100781bbc..2ffc67dce87f 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
| @@ -234,8 +234,8 @@ static void inode_go_sync(struct gfs2_glock *gl) | |||
| 234 | * inode_go_inval - prepare a inode glock to be released | 234 | * inode_go_inval - prepare a inode glock to be released |
| 235 | * @gl: the glock | 235 | * @gl: the glock |
| 236 | * @flags: | 236 | * @flags: |
| 237 | * | 237 | * |
| 238 | * Normally we invlidate everything, but if we are moving into | 238 | * Normally we invalidate everything, but if we are moving into |
| 239 | * LM_ST_DEFERRED from LM_ST_SHARED or LM_ST_EXCLUSIVE then we | 239 | * LM_ST_DEFERRED from LM_ST_SHARED or LM_ST_EXCLUSIVE then we |
| 240 | * can keep hold of the metadata, since it won't have changed. | 240 | * can keep hold of the metadata, since it won't have changed. |
| 241 | * | 241 | * |
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 91f274de1246..4fafea1c9ecf 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
| @@ -1036,8 +1036,8 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots, | |||
| 1036 | 1036 | ||
| 1037 | new_size = old_size + RECOVER_SIZE_INC; | 1037 | new_size = old_size + RECOVER_SIZE_INC; |
| 1038 | 1038 | ||
| 1039 | submit = kzalloc(new_size * sizeof(uint32_t), GFP_NOFS); | 1039 | submit = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS); |
| 1040 | result = kzalloc(new_size * sizeof(uint32_t), GFP_NOFS); | 1040 | result = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS); |
| 1041 | if (!submit || !result) { | 1041 | if (!submit || !result) { |
| 1042 | kfree(submit); | 1042 | kfree(submit); |
| 1043 | kfree(result); | 1043 | kfree(result); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index db629d1bd1bd..f4cb9c0d6bbd 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
| @@ -337,7 +337,7 @@ static bool gfs2_unaligned_extlen(struct gfs2_rbm *rbm, u32 n_unaligned, u32 *le | |||
| 337 | 337 | ||
| 338 | /** | 338 | /** |
| 339 | * gfs2_free_extlen - Return extent length of free blocks | 339 | * gfs2_free_extlen - Return extent length of free blocks |
| 340 | * @rbm: Starting position | 340 | * @rrbm: Starting position |
| 341 | * @len: Max length to check | 341 | * @len: Max length to check |
| 342 | * | 342 | * |
| 343 | * Starting at the block specified by the rbm, see how many free blocks | 343 | * Starting at the block specified by the rbm, see how many free blocks |
| @@ -2522,7 +2522,7 @@ void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state) | |||
| 2522 | 2522 | ||
| 2523 | /** | 2523 | /** |
| 2524 | * gfs2_rlist_free - free a resource group list | 2524 | * gfs2_rlist_free - free a resource group list |
| 2525 | * @list: the list of resource groups | 2525 | * @rlist: the list of resource groups |
| 2526 | * | 2526 | * |
| 2527 | */ | 2527 | */ |
| 2528 | 2528 | ||
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 8f98138cbc43..f11b9eed0de1 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
| @@ -756,7 +756,6 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) | |||
| 756 | spin_unlock(&dreq->lock); | 756 | spin_unlock(&dreq->lock); |
| 757 | 757 | ||
| 758 | while (!list_empty(&hdr->pages)) { | 758 | while (!list_empty(&hdr->pages)) { |
| 759 | bool do_destroy = true; | ||
| 760 | 759 | ||
| 761 | req = nfs_list_entry(hdr->pages.next); | 760 | req = nfs_list_entry(hdr->pages.next); |
| 762 | nfs_list_remove_request(req); | 761 | nfs_list_remove_request(req); |
| @@ -765,7 +764,6 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) | |||
| 765 | case NFS_IOHDR_NEED_COMMIT: | 764 | case NFS_IOHDR_NEED_COMMIT: |
| 766 | kref_get(&req->wb_kref); | 765 | kref_get(&req->wb_kref); |
| 767 | nfs_mark_request_commit(req, hdr->lseg, &cinfo); | 766 | nfs_mark_request_commit(req, hdr->lseg, &cinfo); |
| 768 | do_destroy = false; | ||
| 769 | } | 767 | } |
| 770 | nfs_unlock_and_release_request(req); | 768 | nfs_unlock_and_release_request(req); |
| 771 | } | 769 | } |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 82ddbf46660e..f415cbf9f6c3 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
| @@ -244,6 +244,7 @@ void nfs_pgio_data_release(struct nfs_pgio_data *); | |||
| 244 | int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *); | 244 | int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *); |
| 245 | int nfs_initiate_pgio(struct rpc_clnt *, struct nfs_pgio_data *, | 245 | int nfs_initiate_pgio(struct rpc_clnt *, struct nfs_pgio_data *, |
| 246 | const struct rpc_call_ops *, int, int); | 246 | const struct rpc_call_ops *, int, int); |
| 247 | void nfs_free_request(struct nfs_page *req); | ||
| 247 | 248 | ||
| 248 | static inline void nfs_iocounter_init(struct nfs_io_counter *c) | 249 | static inline void nfs_iocounter_init(struct nfs_io_counter *c) |
| 249 | { | 250 | { |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index 871d6eda8dba..8f854dde4150 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
| @@ -247,3 +247,46 @@ const struct xattr_handler *nfs3_xattr_handlers[] = { | |||
| 247 | &posix_acl_default_xattr_handler, | 247 | &posix_acl_default_xattr_handler, |
| 248 | NULL, | 248 | NULL, |
| 249 | }; | 249 | }; |
| 250 | |||
| 251 | static int | ||
| 252 | nfs3_list_one_acl(struct inode *inode, int type, const char *name, void *data, | ||
| 253 | size_t size, ssize_t *result) | ||
| 254 | { | ||
| 255 | struct posix_acl *acl; | ||
| 256 | char *p = data + *result; | ||
| 257 | |||
| 258 | acl = get_acl(inode, type); | ||
| 259 | if (!acl) | ||
| 260 | return 0; | ||
| 261 | |||
| 262 | posix_acl_release(acl); | ||
| 263 | |||
| 264 | *result += strlen(name); | ||
| 265 | *result += 1; | ||
| 266 | if (!size) | ||
| 267 | return 0; | ||
| 268 | if (*result > size) | ||
| 269 | return -ERANGE; | ||
| 270 | |||
| 271 | strcpy(p, name); | ||
| 272 | return 0; | ||
| 273 | } | ||
| 274 | |||
| 275 | ssize_t | ||
| 276 | nfs3_listxattr(struct dentry *dentry, char *data, size_t size) | ||
| 277 | { | ||
| 278 | struct inode *inode = dentry->d_inode; | ||
| 279 | ssize_t result = 0; | ||
| 280 | int error; | ||
| 281 | |||
| 282 | error = nfs3_list_one_acl(inode, ACL_TYPE_ACCESS, | ||
| 283 | POSIX_ACL_XATTR_ACCESS, data, size, &result); | ||
| 284 | if (error) | ||
| 285 | return error; | ||
| 286 | |||
| 287 | error = nfs3_list_one_acl(inode, ACL_TYPE_DEFAULT, | ||
| 288 | POSIX_ACL_XATTR_DEFAULT, data, size, &result); | ||
| 289 | if (error) | ||
| 290 | return error; | ||
| 291 | return result; | ||
| 292 | } | ||
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index e7daa42bbc86..f0afa291fd58 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
| @@ -885,7 +885,7 @@ static const struct inode_operations nfs3_dir_inode_operations = { | |||
| 885 | .getattr = nfs_getattr, | 885 | .getattr = nfs_getattr, |
| 886 | .setattr = nfs_setattr, | 886 | .setattr = nfs_setattr, |
| 887 | #ifdef CONFIG_NFS_V3_ACL | 887 | #ifdef CONFIG_NFS_V3_ACL |
| 888 | .listxattr = generic_listxattr, | 888 | .listxattr = nfs3_listxattr, |
| 889 | .getxattr = generic_getxattr, | 889 | .getxattr = generic_getxattr, |
| 890 | .setxattr = generic_setxattr, | 890 | .setxattr = generic_setxattr, |
| 891 | .removexattr = generic_removexattr, | 891 | .removexattr = generic_removexattr, |
| @@ -899,7 +899,7 @@ static const struct inode_operations nfs3_file_inode_operations = { | |||
| 899 | .getattr = nfs_getattr, | 899 | .getattr = nfs_getattr, |
| 900 | .setattr = nfs_setattr, | 900 | .setattr = nfs_setattr, |
| 901 | #ifdef CONFIG_NFS_V3_ACL | 901 | #ifdef CONFIG_NFS_V3_ACL |
| 902 | .listxattr = generic_listxattr, | 902 | .listxattr = nfs3_listxattr, |
| 903 | .getxattr = generic_getxattr, | 903 | .getxattr = generic_getxattr, |
| 904 | .setxattr = generic_setxattr, | 904 | .setxattr = generic_setxattr, |
| 905 | .removexattr = generic_removexattr, | 905 | .removexattr = generic_removexattr, |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index b6ee3a6ee96d..17fab89f6358 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
| @@ -29,8 +29,6 @@ | |||
| 29 | static struct kmem_cache *nfs_page_cachep; | 29 | static struct kmem_cache *nfs_page_cachep; |
| 30 | static const struct rpc_call_ops nfs_pgio_common_ops; | 30 | static const struct rpc_call_ops nfs_pgio_common_ops; |
| 31 | 31 | ||
| 32 | static void nfs_free_request(struct nfs_page *); | ||
| 33 | |||
| 34 | static bool nfs_pgarray_set(struct nfs_page_array *p, unsigned int pagecount) | 32 | static bool nfs_pgarray_set(struct nfs_page_array *p, unsigned int pagecount) |
| 35 | { | 33 | { |
| 36 | p->npages = pagecount; | 34 | p->npages = pagecount; |
| @@ -239,20 +237,28 @@ nfs_page_group_init(struct nfs_page *req, struct nfs_page *prev) | |||
| 239 | WARN_ON_ONCE(prev == req); | 237 | WARN_ON_ONCE(prev == req); |
| 240 | 238 | ||
| 241 | if (!prev) { | 239 | if (!prev) { |
| 240 | /* a head request */ | ||
| 242 | req->wb_head = req; | 241 | req->wb_head = req; |
| 243 | req->wb_this_page = req; | 242 | req->wb_this_page = req; |
| 244 | } else { | 243 | } else { |
| 244 | /* a subrequest */ | ||
| 245 | WARN_ON_ONCE(prev->wb_this_page != prev->wb_head); | 245 | WARN_ON_ONCE(prev->wb_this_page != prev->wb_head); |
| 246 | WARN_ON_ONCE(!test_bit(PG_HEADLOCK, &prev->wb_head->wb_flags)); | 246 | WARN_ON_ONCE(!test_bit(PG_HEADLOCK, &prev->wb_head->wb_flags)); |
| 247 | req->wb_head = prev->wb_head; | 247 | req->wb_head = prev->wb_head; |
| 248 | req->wb_this_page = prev->wb_this_page; | 248 | req->wb_this_page = prev->wb_this_page; |
| 249 | prev->wb_this_page = req; | 249 | prev->wb_this_page = req; |
| 250 | 250 | ||
| 251 | /* All subrequests take a ref on the head request until | ||
| 252 | * nfs_page_group_destroy is called */ | ||
| 253 | kref_get(&req->wb_head->wb_kref); | ||
| 254 | |||
| 251 | /* grab extra ref if head request has extra ref from | 255 | /* grab extra ref if head request has extra ref from |
| 252 | * the write/commit path to handle handoff between write | 256 | * the write/commit path to handle handoff between write |
| 253 | * and commit lists */ | 257 | * and commit lists */ |
| 254 | if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) | 258 | if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) { |
| 259 | set_bit(PG_INODE_REF, &req->wb_flags); | ||
| 255 | kref_get(&req->wb_kref); | 260 | kref_get(&req->wb_kref); |
| 261 | } | ||
| 256 | } | 262 | } |
| 257 | } | 263 | } |
| 258 | 264 | ||
| @@ -269,6 +275,10 @@ nfs_page_group_destroy(struct kref *kref) | |||
| 269 | struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref); | 275 | struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref); |
| 270 | struct nfs_page *tmp, *next; | 276 | struct nfs_page *tmp, *next; |
| 271 | 277 | ||
| 278 | /* subrequests must release the ref on the head request */ | ||
| 279 | if (req->wb_head != req) | ||
| 280 | nfs_release_request(req->wb_head); | ||
| 281 | |||
| 272 | if (!nfs_page_group_sync_on_bit(req, PG_TEARDOWN)) | 282 | if (!nfs_page_group_sync_on_bit(req, PG_TEARDOWN)) |
| 273 | return; | 283 | return; |
| 274 | 284 | ||
| @@ -394,7 +404,7 @@ static void nfs_clear_request(struct nfs_page *req) | |||
| 394 | * | 404 | * |
| 395 | * Note: Should never be called with the spinlock held! | 405 | * Note: Should never be called with the spinlock held! |
| 396 | */ | 406 | */ |
| 397 | static void nfs_free_request(struct nfs_page *req) | 407 | void nfs_free_request(struct nfs_page *req) |
| 398 | { | 408 | { |
| 399 | WARN_ON_ONCE(req->wb_this_page != req); | 409 | WARN_ON_ONCE(req->wb_this_page != req); |
| 400 | 410 | ||
| @@ -925,7 +935,6 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, | |||
| 925 | nfs_pageio_doio(desc); | 935 | nfs_pageio_doio(desc); |
| 926 | if (desc->pg_error < 0) | 936 | if (desc->pg_error < 0) |
| 927 | return 0; | 937 | return 0; |
| 928 | desc->pg_moreio = 0; | ||
| 929 | if (desc->pg_recoalesce) | 938 | if (desc->pg_recoalesce) |
| 930 | return 0; | 939 | return 0; |
| 931 | /* retry add_request for this subreq */ | 940 | /* retry add_request for this subreq */ |
| @@ -972,6 +981,7 @@ static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc) | |||
| 972 | desc->pg_count = 0; | 981 | desc->pg_count = 0; |
| 973 | desc->pg_base = 0; | 982 | desc->pg_base = 0; |
| 974 | desc->pg_recoalesce = 0; | 983 | desc->pg_recoalesce = 0; |
| 984 | desc->pg_moreio = 0; | ||
| 975 | 985 | ||
| 976 | while (!list_empty(&head)) { | 986 | while (!list_empty(&head)) { |
| 977 | struct nfs_page *req; | 987 | struct nfs_page *req; |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 98ff061ccaf3..5e2f10304548 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -46,6 +46,7 @@ static const struct rpc_call_ops nfs_commit_ops; | |||
| 46 | static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops; | 46 | static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops; |
| 47 | static const struct nfs_commit_completion_ops nfs_commit_completion_ops; | 47 | static const struct nfs_commit_completion_ops nfs_commit_completion_ops; |
| 48 | static const struct nfs_rw_ops nfs_rw_write_ops; | 48 | static const struct nfs_rw_ops nfs_rw_write_ops; |
| 49 | static void nfs_clear_request_commit(struct nfs_page *req); | ||
| 49 | 50 | ||
| 50 | static struct kmem_cache *nfs_wdata_cachep; | 51 | static struct kmem_cache *nfs_wdata_cachep; |
| 51 | static mempool_t *nfs_wdata_mempool; | 52 | static mempool_t *nfs_wdata_mempool; |
| @@ -91,8 +92,15 @@ static void nfs_context_set_write_error(struct nfs_open_context *ctx, int error) | |||
| 91 | set_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags); | 92 | set_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 95 | /* | ||
| 96 | * nfs_page_find_head_request_locked - find head request associated with @page | ||
| 97 | * | ||
| 98 | * must be called while holding the inode lock. | ||
| 99 | * | ||
| 100 | * returns matching head request with reference held, or NULL if not found. | ||
| 101 | */ | ||
| 94 | static struct nfs_page * | 102 | static struct nfs_page * |
| 95 | nfs_page_find_request_locked(struct nfs_inode *nfsi, struct page *page) | 103 | nfs_page_find_head_request_locked(struct nfs_inode *nfsi, struct page *page) |
| 96 | { | 104 | { |
| 97 | struct nfs_page *req = NULL; | 105 | struct nfs_page *req = NULL; |
| 98 | 106 | ||
| @@ -104,25 +112,33 @@ nfs_page_find_request_locked(struct nfs_inode *nfsi, struct page *page) | |||
| 104 | /* Linearly search the commit list for the correct req */ | 112 | /* Linearly search the commit list for the correct req */ |
| 105 | list_for_each_entry_safe(freq, t, &nfsi->commit_info.list, wb_list) { | 113 | list_for_each_entry_safe(freq, t, &nfsi->commit_info.list, wb_list) { |
| 106 | if (freq->wb_page == page) { | 114 | if (freq->wb_page == page) { |
| 107 | req = freq; | 115 | req = freq->wb_head; |
| 108 | break; | 116 | break; |
| 109 | } | 117 | } |
| 110 | } | 118 | } |
| 111 | } | 119 | } |
| 112 | 120 | ||
| 113 | if (req) | 121 | if (req) { |
| 122 | WARN_ON_ONCE(req->wb_head != req); | ||
| 123 | |||
| 114 | kref_get(&req->wb_kref); | 124 | kref_get(&req->wb_kref); |
| 125 | } | ||
| 115 | 126 | ||
| 116 | return req; | 127 | return req; |
| 117 | } | 128 | } |
| 118 | 129 | ||
| 119 | static struct nfs_page *nfs_page_find_request(struct page *page) | 130 | /* |
| 131 | * nfs_page_find_head_request - find head request associated with @page | ||
| 132 | * | ||
| 133 | * returns matching head request with reference held, or NULL if not found. | ||
| 134 | */ | ||
| 135 | static struct nfs_page *nfs_page_find_head_request(struct page *page) | ||
| 120 | { | 136 | { |
| 121 | struct inode *inode = page_file_mapping(page)->host; | 137 | struct inode *inode = page_file_mapping(page)->host; |
| 122 | struct nfs_page *req = NULL; | 138 | struct nfs_page *req = NULL; |
| 123 | 139 | ||
| 124 | spin_lock(&inode->i_lock); | 140 | spin_lock(&inode->i_lock); |
| 125 | req = nfs_page_find_request_locked(NFS_I(inode), page); | 141 | req = nfs_page_find_head_request_locked(NFS_I(inode), page); |
| 126 | spin_unlock(&inode->i_lock); | 142 | spin_unlock(&inode->i_lock); |
| 127 | return req; | 143 | return req; |
| 128 | } | 144 | } |
| @@ -274,36 +290,246 @@ static void nfs_end_page_writeback(struct nfs_page *req) | |||
| 274 | clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC); | 290 | clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC); |
| 275 | } | 291 | } |
| 276 | 292 | ||
| 277 | static struct nfs_page *nfs_find_and_lock_request(struct page *page, bool nonblock) | 293 | |
| 294 | /* nfs_page_group_clear_bits | ||
| 295 | * @req - an nfs request | ||
| 296 | * clears all page group related bits from @req | ||
| 297 | */ | ||
| 298 | static void | ||
| 299 | nfs_page_group_clear_bits(struct nfs_page *req) | ||
| 300 | { | ||
| 301 | clear_bit(PG_TEARDOWN, &req->wb_flags); | ||
| 302 | clear_bit(PG_UNLOCKPAGE, &req->wb_flags); | ||
| 303 | clear_bit(PG_UPTODATE, &req->wb_flags); | ||
| 304 | clear_bit(PG_WB_END, &req->wb_flags); | ||
| 305 | clear_bit(PG_REMOVE, &req->wb_flags); | ||
| 306 | } | ||
| 307 | |||
| 308 | |||
| 309 | /* | ||
| 310 | * nfs_unroll_locks_and_wait - unlock all newly locked reqs and wait on @req | ||
| 311 | * | ||
| 312 | * this is a helper function for nfs_lock_and_join_requests | ||
| 313 | * | ||
| 314 | * @inode - inode associated with request page group, must be holding inode lock | ||
| 315 | * @head - head request of page group, must be holding head lock | ||
| 316 | * @req - request that couldn't lock and needs to wait on the req bit lock | ||
| 317 | * @nonblock - if true, don't actually wait | ||
| 318 | * | ||
| 319 | * NOTE: this must be called holding page_group bit lock and inode spin lock | ||
| 320 | * and BOTH will be released before returning. | ||
| 321 | * | ||
| 322 | * returns 0 on success, < 0 on error. | ||
| 323 | */ | ||
| 324 | static int | ||
| 325 | nfs_unroll_locks_and_wait(struct inode *inode, struct nfs_page *head, | ||
| 326 | struct nfs_page *req, bool nonblock) | ||
| 327 | __releases(&inode->i_lock) | ||
| 328 | { | ||
| 329 | struct nfs_page *tmp; | ||
| 330 | int ret; | ||
| 331 | |||
| 332 | /* relinquish all the locks successfully grabbed this run */ | ||
| 333 | for (tmp = head ; tmp != req; tmp = tmp->wb_this_page) | ||
| 334 | nfs_unlock_request(tmp); | ||
| 335 | |||
| 336 | WARN_ON_ONCE(test_bit(PG_TEARDOWN, &req->wb_flags)); | ||
| 337 | |||
| 338 | /* grab a ref on the request that will be waited on */ | ||
| 339 | kref_get(&req->wb_kref); | ||
| 340 | |||
| 341 | nfs_page_group_unlock(head); | ||
| 342 | spin_unlock(&inode->i_lock); | ||
| 343 | |||
| 344 | /* release ref from nfs_page_find_head_request_locked */ | ||
| 345 | nfs_release_request(head); | ||
| 346 | |||
| 347 | if (!nonblock) | ||
| 348 | ret = nfs_wait_on_request(req); | ||
| 349 | else | ||
| 350 | ret = -EAGAIN; | ||
| 351 | nfs_release_request(req); | ||
| 352 | |||
| 353 | return ret; | ||
| 354 | } | ||
| 355 | |||
| 356 | /* | ||
| 357 | * nfs_destroy_unlinked_subrequests - destroy recently unlinked subrequests | ||
| 358 | * | ||
| 359 | * @destroy_list - request list (using wb_this_page) terminated by @old_head | ||
| 360 | * @old_head - the old head of the list | ||
| 361 | * | ||
| 362 | * All subrequests must be locked and removed from all lists, so at this point | ||
| 363 | * they are only "active" in this function, and possibly in nfs_wait_on_request | ||
| 364 | * with a reference held by some other context. | ||
| 365 | */ | ||
| 366 | static void | ||
| 367 | nfs_destroy_unlinked_subrequests(struct nfs_page *destroy_list, | ||
| 368 | struct nfs_page *old_head) | ||
| 369 | { | ||
| 370 | while (destroy_list) { | ||
| 371 | struct nfs_page *subreq = destroy_list; | ||
| 372 | |||
| 373 | destroy_list = (subreq->wb_this_page == old_head) ? | ||
| 374 | NULL : subreq->wb_this_page; | ||
| 375 | |||
| 376 | WARN_ON_ONCE(old_head != subreq->wb_head); | ||
| 377 | |||
| 378 | /* make sure old group is not used */ | ||
| 379 | subreq->wb_head = subreq; | ||
| 380 | subreq->wb_this_page = subreq; | ||
| 381 | |||
| 382 | nfs_clear_request_commit(subreq); | ||
| 383 | |||
| 384 | /* subreq is now totally disconnected from page group or any | ||
| 385 | * write / commit lists. last chance to wake any waiters */ | ||
| 386 | nfs_unlock_request(subreq); | ||
| 387 | |||
| 388 | if (!test_bit(PG_TEARDOWN, &subreq->wb_flags)) { | ||
| 389 | /* release ref on old head request */ | ||
| 390 | nfs_release_request(old_head); | ||
| 391 | |||
| 392 | nfs_page_group_clear_bits(subreq); | ||
| 393 | |||
| 394 | /* release the PG_INODE_REF reference */ | ||
| 395 | if (test_and_clear_bit(PG_INODE_REF, &subreq->wb_flags)) | ||
| 396 | nfs_release_request(subreq); | ||
| 397 | else | ||
| 398 | WARN_ON_ONCE(1); | ||
| 399 | } else { | ||
| 400 | WARN_ON_ONCE(test_bit(PG_CLEAN, &subreq->wb_flags)); | ||
| 401 | /* zombie requests have already released the last | ||
| 402 | * reference and were waiting on the rest of the | ||
| 403 | * group to complete. Since it's no longer part of a | ||
| 404 | * group, simply free the request */ | ||
| 405 | nfs_page_group_clear_bits(subreq); | ||
| 406 | nfs_free_request(subreq); | ||
| 407 | } | ||
| 408 | } | ||
| 409 | } | ||
| 410 | |||
| 411 | /* | ||
| 412 | * nfs_lock_and_join_requests - join all subreqs to the head req and return | ||
| 413 | * a locked reference, cancelling any pending | ||
| 414 | * operations for this page. | ||
| 415 | * | ||
| 416 | * @page - the page used to lookup the "page group" of nfs_page structures | ||
| 417 | * @nonblock - if true, don't block waiting for request locks | ||
| 418 | * | ||
| 419 | * This function joins all sub requests to the head request by first | ||
| 420 | * locking all requests in the group, cancelling any pending operations | ||
| 421 | * and finally updating the head request to cover the whole range covered by | ||
| 422 | * the (former) group. All subrequests are removed from any write or commit | ||
| 423 | * lists, unlinked from the group and destroyed. | ||
| 424 | * | ||
| 425 | * Returns a locked, referenced pointer to the head request - which after | ||
| 426 | * this call is guaranteed to be the only request associated with the page. | ||
| 427 | * Returns NULL if no requests are found for @page, or a ERR_PTR if an | ||
| 428 | * error was encountered. | ||
| 429 | */ | ||
| 430 | static struct nfs_page * | ||
| 431 | nfs_lock_and_join_requests(struct page *page, bool nonblock) | ||
| 278 | { | 432 | { |
| 279 | struct inode *inode = page_file_mapping(page)->host; | 433 | struct inode *inode = page_file_mapping(page)->host; |
| 280 | struct nfs_page *req; | 434 | struct nfs_page *head, *subreq; |
| 435 | struct nfs_page *destroy_list = NULL; | ||
| 436 | unsigned int total_bytes; | ||
| 281 | int ret; | 437 | int ret; |
| 282 | 438 | ||
| 439 | try_again: | ||
| 440 | total_bytes = 0; | ||
| 441 | |||
| 442 | WARN_ON_ONCE(destroy_list); | ||
| 443 | |||
| 283 | spin_lock(&inode->i_lock); | 444 | spin_lock(&inode->i_lock); |
| 284 | for (;;) { | 445 | |
| 285 | req = nfs_page_find_request_locked(NFS_I(inode), page); | 446 | /* |
| 286 | if (req == NULL) | 447 | * A reference is taken only on the head request which acts as a |
| 287 | break; | 448 | * reference to the whole page group - the group will not be destroyed |
| 288 | if (nfs_lock_request(req)) | 449 | * until the head reference is released. |
| 289 | break; | 450 | */ |
| 290 | /* Note: If we hold the page lock, as is the case in nfs_writepage, | 451 | head = nfs_page_find_head_request_locked(NFS_I(inode), page); |
| 291 | * then the call to nfs_lock_request() will always | 452 | |
| 292 | * succeed provided that someone hasn't already marked the | 453 | if (!head) { |
| 293 | * request as dirty (in which case we don't care). | ||
| 294 | */ | ||
| 295 | spin_unlock(&inode->i_lock); | 454 | spin_unlock(&inode->i_lock); |
| 296 | if (!nonblock) | 455 | return NULL; |
| 297 | ret = nfs_wait_on_request(req); | 456 | } |
| 298 | else | 457 | |
| 299 | ret = -EAGAIN; | 458 | /* lock each request in the page group */ |
| 300 | nfs_release_request(req); | 459 | nfs_page_group_lock(head); |
| 301 | if (ret != 0) | 460 | subreq = head; |
| 461 | do { | ||
| 462 | /* | ||
| 463 | * Subrequests are always contiguous, non overlapping | ||
| 464 | * and in order. If not, it's a programming error. | ||
| 465 | */ | ||
| 466 | WARN_ON_ONCE(subreq->wb_offset != | ||
| 467 | (head->wb_offset + total_bytes)); | ||
| 468 | |||
| 469 | /* keep track of how many bytes this group covers */ | ||
| 470 | total_bytes += subreq->wb_bytes; | ||
| 471 | |||
| 472 | if (!nfs_lock_request(subreq)) { | ||
| 473 | /* releases page group bit lock and | ||
| 474 | * inode spin lock and all references */ | ||
| 475 | ret = nfs_unroll_locks_and_wait(inode, head, | ||
| 476 | subreq, nonblock); | ||
| 477 | |||
| 478 | if (ret == 0) | ||
| 479 | goto try_again; | ||
| 480 | |||
| 302 | return ERR_PTR(ret); | 481 | return ERR_PTR(ret); |
| 303 | spin_lock(&inode->i_lock); | 482 | } |
| 483 | |||
| 484 | subreq = subreq->wb_this_page; | ||
| 485 | } while (subreq != head); | ||
| 486 | |||
| 487 | /* Now that all requests are locked, make sure they aren't on any list. | ||
| 488 | * Commit list removal accounting is done after locks are dropped */ | ||
| 489 | subreq = head; | ||
| 490 | do { | ||
| 491 | nfs_list_remove_request(subreq); | ||
| 492 | subreq = subreq->wb_this_page; | ||
| 493 | } while (subreq != head); | ||
| 494 | |||
| 495 | /* unlink subrequests from head, destroy them later */ | ||
| 496 | if (head->wb_this_page != head) { | ||
| 497 | /* destroy list will be terminated by head */ | ||
| 498 | destroy_list = head->wb_this_page; | ||
| 499 | head->wb_this_page = head; | ||
| 500 | |||
| 501 | /* change head request to cover whole range that | ||
| 502 | * the former page group covered */ | ||
| 503 | head->wb_bytes = total_bytes; | ||
| 304 | } | 504 | } |
| 505 | |||
| 506 | /* | ||
| 507 | * prepare head request to be added to new pgio descriptor | ||
| 508 | */ | ||
| 509 | nfs_page_group_clear_bits(head); | ||
| 510 | |||
| 511 | /* | ||
| 512 | * some part of the group was still on the inode list - otherwise | ||
| 513 | * the group wouldn't be involved in async write. | ||
| 514 | * grab a reference for the head request, iff it needs one. | ||
| 515 | */ | ||
| 516 | if (!test_and_set_bit(PG_INODE_REF, &head->wb_flags)) | ||
| 517 | kref_get(&head->wb_kref); | ||
| 518 | |||
| 519 | nfs_page_group_unlock(head); | ||
| 520 | |||
| 521 | /* drop lock to clear_request_commit the head req and clean up | ||
| 522 | * requests on destroy list */ | ||
| 305 | spin_unlock(&inode->i_lock); | 523 | spin_unlock(&inode->i_lock); |
| 306 | return req; | 524 | |
| 525 | nfs_destroy_unlinked_subrequests(destroy_list, head); | ||
| 526 | |||
| 527 | /* clean up commit list state */ | ||
| 528 | nfs_clear_request_commit(head); | ||
| 529 | |||
| 530 | /* still holds ref on head from nfs_page_find_head_request_locked | ||
| 531 | * and still has lock on head from lock loop */ | ||
| 532 | return head; | ||
| 307 | } | 533 | } |
| 308 | 534 | ||
| 309 | /* | 535 | /* |
| @@ -316,7 +542,7 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, | |||
| 316 | struct nfs_page *req; | 542 | struct nfs_page *req; |
| 317 | int ret = 0; | 543 | int ret = 0; |
| 318 | 544 | ||
| 319 | req = nfs_find_and_lock_request(page, nonblock); | 545 | req = nfs_lock_and_join_requests(page, nonblock); |
| 320 | if (!req) | 546 | if (!req) |
| 321 | goto out; | 547 | goto out; |
| 322 | ret = PTR_ERR(req); | 548 | ret = PTR_ERR(req); |
| @@ -448,7 +674,9 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req) | |||
| 448 | set_page_private(req->wb_page, (unsigned long)req); | 674 | set_page_private(req->wb_page, (unsigned long)req); |
| 449 | } | 675 | } |
| 450 | nfsi->npages++; | 676 | nfsi->npages++; |
| 451 | set_bit(PG_INODE_REF, &req->wb_flags); | 677 | /* this a head request for a page group - mark it as having an |
| 678 | * extra reference so sub groups can follow suit */ | ||
| 679 | WARN_ON(test_and_set_bit(PG_INODE_REF, &req->wb_flags)); | ||
| 452 | kref_get(&req->wb_kref); | 680 | kref_get(&req->wb_kref); |
| 453 | spin_unlock(&inode->i_lock); | 681 | spin_unlock(&inode->i_lock); |
| 454 | } | 682 | } |
| @@ -474,7 +702,9 @@ static void nfs_inode_remove_request(struct nfs_page *req) | |||
| 474 | nfsi->npages--; | 702 | nfsi->npages--; |
| 475 | spin_unlock(&inode->i_lock); | 703 | spin_unlock(&inode->i_lock); |
| 476 | } | 704 | } |
| 477 | nfs_release_request(req); | 705 | |
| 706 | if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) | ||
| 707 | nfs_release_request(req); | ||
| 478 | } | 708 | } |
| 479 | 709 | ||
| 480 | static void | 710 | static void |
| @@ -638,7 +868,6 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr) | |||
| 638 | { | 868 | { |
| 639 | struct nfs_commit_info cinfo; | 869 | struct nfs_commit_info cinfo; |
| 640 | unsigned long bytes = 0; | 870 | unsigned long bytes = 0; |
| 641 | bool do_destroy; | ||
| 642 | 871 | ||
| 643 | if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) | 872 | if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) |
| 644 | goto out; | 873 | goto out; |
| @@ -668,7 +897,6 @@ remove_req: | |||
| 668 | next: | 897 | next: |
| 669 | nfs_unlock_request(req); | 898 | nfs_unlock_request(req); |
| 670 | nfs_end_page_writeback(req); | 899 | nfs_end_page_writeback(req); |
| 671 | do_destroy = !test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags); | ||
| 672 | nfs_release_request(req); | 900 | nfs_release_request(req); |
| 673 | } | 901 | } |
| 674 | out: | 902 | out: |
| @@ -769,7 +997,7 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode, | |||
| 769 | spin_lock(&inode->i_lock); | 997 | spin_lock(&inode->i_lock); |
| 770 | 998 | ||
| 771 | for (;;) { | 999 | for (;;) { |
| 772 | req = nfs_page_find_request_locked(NFS_I(inode), page); | 1000 | req = nfs_page_find_head_request_locked(NFS_I(inode), page); |
| 773 | if (req == NULL) | 1001 | if (req == NULL) |
| 774 | goto out_unlock; | 1002 | goto out_unlock; |
| 775 | 1003 | ||
| @@ -877,7 +1105,7 @@ int nfs_flush_incompatible(struct file *file, struct page *page) | |||
| 877 | * dropped page. | 1105 | * dropped page. |
| 878 | */ | 1106 | */ |
| 879 | do { | 1107 | do { |
| 880 | req = nfs_page_find_request(page); | 1108 | req = nfs_page_find_head_request(page); |
| 881 | if (req == NULL) | 1109 | if (req == NULL) |
| 882 | return 0; | 1110 | return 0; |
| 883 | l_ctx = req->wb_lock_context; | 1111 | l_ctx = req->wb_lock_context; |
| @@ -1569,27 +1797,28 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page) | |||
| 1569 | struct nfs_page *req; | 1797 | struct nfs_page *req; |
| 1570 | int ret = 0; | 1798 | int ret = 0; |
| 1571 | 1799 | ||
| 1572 | for (;;) { | 1800 | wait_on_page_writeback(page); |
| 1573 | wait_on_page_writeback(page); | 1801 | |
| 1574 | req = nfs_page_find_request(page); | 1802 | /* blocking call to cancel all requests and join to a single (head) |
| 1575 | if (req == NULL) | 1803 | * request */ |
| 1576 | break; | 1804 | req = nfs_lock_and_join_requests(page, false); |
| 1577 | if (nfs_lock_request(req)) { | 1805 | |
| 1578 | nfs_clear_request_commit(req); | 1806 | if (IS_ERR(req)) { |
| 1579 | nfs_inode_remove_request(req); | 1807 | ret = PTR_ERR(req); |
| 1580 | /* | 1808 | } else if (req) { |
| 1581 | * In case nfs_inode_remove_request has marked the | 1809 | /* all requests from this page have been cancelled by |
| 1582 | * page as being dirty | 1810 | * nfs_lock_and_join_requests, so just remove the head |
| 1583 | */ | 1811 | * request from the inode / page_private pointer and |
| 1584 | cancel_dirty_page(page, PAGE_CACHE_SIZE); | 1812 | * release it */ |
| 1585 | nfs_unlock_and_release_request(req); | 1813 | nfs_inode_remove_request(req); |
| 1586 | break; | 1814 | /* |
| 1587 | } | 1815 | * In case nfs_inode_remove_request has marked the |
| 1588 | ret = nfs_wait_on_request(req); | 1816 | * page as being dirty |
| 1589 | nfs_release_request(req); | 1817 | */ |
| 1590 | if (ret < 0) | 1818 | cancel_dirty_page(page, PAGE_CACHE_SIZE); |
| 1591 | break; | 1819 | nfs_unlock_and_release_request(req); |
| 1592 | } | 1820 | } |
| 1821 | |||
| 1593 | return ret; | 1822 | return ret; |
| 1594 | } | 1823 | } |
| 1595 | 1824 | ||
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 9cd5f63715c0..7f30bdc57d13 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
| @@ -702,6 +702,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) | |||
| 702 | struct dquot *dquot; | 702 | struct dquot *dquot; |
| 703 | unsigned long freed = 0; | 703 | unsigned long freed = 0; |
| 704 | 704 | ||
| 705 | spin_lock(&dq_list_lock); | ||
| 705 | head = free_dquots.prev; | 706 | head = free_dquots.prev; |
| 706 | while (head != &free_dquots && sc->nr_to_scan) { | 707 | while (head != &free_dquots && sc->nr_to_scan) { |
| 707 | dquot = list_entry(head, struct dquot, dq_free); | 708 | dquot = list_entry(head, struct dquot, dq_free); |
| @@ -713,6 +714,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) | |||
| 713 | freed++; | 714 | freed++; |
| 714 | head = free_dquots.prev; | 715 | head = free_dquots.prev; |
| 715 | } | 716 | } |
| 717 | spin_unlock(&dq_list_lock); | ||
| 716 | return freed; | 718 | return freed; |
| 717 | } | 719 | } |
| 718 | 720 | ||
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 96175df211b1..75c3fe5f3d9d 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
| @@ -4298,8 +4298,8 @@ xfs_bmapi_delay( | |||
| 4298 | } | 4298 | } |
| 4299 | 4299 | ||
| 4300 | 4300 | ||
| 4301 | int | 4301 | static int |
| 4302 | __xfs_bmapi_allocate( | 4302 | xfs_bmapi_allocate( |
| 4303 | struct xfs_bmalloca *bma) | 4303 | struct xfs_bmalloca *bma) |
| 4304 | { | 4304 | { |
| 4305 | struct xfs_mount *mp = bma->ip->i_mount; | 4305 | struct xfs_mount *mp = bma->ip->i_mount; |
| @@ -4578,9 +4578,6 @@ xfs_bmapi_write( | |||
| 4578 | bma.flist = flist; | 4578 | bma.flist = flist; |
| 4579 | bma.firstblock = firstblock; | 4579 | bma.firstblock = firstblock; |
| 4580 | 4580 | ||
| 4581 | if (flags & XFS_BMAPI_STACK_SWITCH) | ||
| 4582 | bma.stack_switch = 1; | ||
| 4583 | |||
| 4584 | while (bno < end && n < *nmap) { | 4581 | while (bno < end && n < *nmap) { |
| 4585 | inhole = eof || bma.got.br_startoff > bno; | 4582 | inhole = eof || bma.got.br_startoff > bno; |
| 4586 | wasdelay = !inhole && isnullstartblock(bma.got.br_startblock); | 4583 | wasdelay = !inhole && isnullstartblock(bma.got.br_startblock); |
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h index 38ba36e9b2f0..b879ca56a64c 100644 --- a/fs/xfs/xfs_bmap.h +++ b/fs/xfs/xfs_bmap.h | |||
| @@ -77,7 +77,6 @@ typedef struct xfs_bmap_free | |||
| 77 | * from written to unwritten, otherwise convert from unwritten to written. | 77 | * from written to unwritten, otherwise convert from unwritten to written. |
| 78 | */ | 78 | */ |
| 79 | #define XFS_BMAPI_CONVERT 0x040 | 79 | #define XFS_BMAPI_CONVERT 0x040 |
| 80 | #define XFS_BMAPI_STACK_SWITCH 0x080 | ||
| 81 | 80 | ||
| 82 | #define XFS_BMAPI_FLAGS \ | 81 | #define XFS_BMAPI_FLAGS \ |
| 83 | { XFS_BMAPI_ENTIRE, "ENTIRE" }, \ | 82 | { XFS_BMAPI_ENTIRE, "ENTIRE" }, \ |
| @@ -86,8 +85,7 @@ typedef struct xfs_bmap_free | |||
| 86 | { XFS_BMAPI_PREALLOC, "PREALLOC" }, \ | 85 | { XFS_BMAPI_PREALLOC, "PREALLOC" }, \ |
| 87 | { XFS_BMAPI_IGSTATE, "IGSTATE" }, \ | 86 | { XFS_BMAPI_IGSTATE, "IGSTATE" }, \ |
| 88 | { XFS_BMAPI_CONTIG, "CONTIG" }, \ | 87 | { XFS_BMAPI_CONTIG, "CONTIG" }, \ |
| 89 | { XFS_BMAPI_CONVERT, "CONVERT" }, \ | 88 | { XFS_BMAPI_CONVERT, "CONVERT" } |
| 90 | { XFS_BMAPI_STACK_SWITCH, "STACK_SWITCH" } | ||
| 91 | 89 | ||
| 92 | 90 | ||
| 93 | static inline int xfs_bmapi_aflag(int w) | 91 | static inline int xfs_bmapi_aflag(int w) |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 703b3ec1796c..64731ef3324d 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
| @@ -249,59 +249,6 @@ xfs_bmap_rtalloc( | |||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | /* | 251 | /* |
| 252 | * Stack switching interfaces for allocation | ||
| 253 | */ | ||
| 254 | static void | ||
| 255 | xfs_bmapi_allocate_worker( | ||
| 256 | struct work_struct *work) | ||
| 257 | { | ||
| 258 | struct xfs_bmalloca *args = container_of(work, | ||
| 259 | struct xfs_bmalloca, work); | ||
| 260 | unsigned long pflags; | ||
| 261 | unsigned long new_pflags = PF_FSTRANS; | ||
| 262 | |||
| 263 | /* | ||
| 264 | * we are in a transaction context here, but may also be doing work | ||
| 265 | * in kswapd context, and hence we may need to inherit that state | ||
| 266 | * temporarily to ensure that we don't block waiting for memory reclaim | ||
| 267 | * in any way. | ||
| 268 | */ | ||
| 269 | if (args->kswapd) | ||
| 270 | new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; | ||
| 271 | |||
| 272 | current_set_flags_nested(&pflags, new_pflags); | ||
| 273 | |||
| 274 | args->result = __xfs_bmapi_allocate(args); | ||
| 275 | complete(args->done); | ||
| 276 | |||
| 277 | current_restore_flags_nested(&pflags, new_pflags); | ||
| 278 | } | ||
| 279 | |||
| 280 | /* | ||
| 281 | * Some allocation requests often come in with little stack to work on. Push | ||
| 282 | * them off to a worker thread so there is lots of stack to use. Otherwise just | ||
| 283 | * call directly to avoid the context switch overhead here. | ||
| 284 | */ | ||
| 285 | int | ||
| 286 | xfs_bmapi_allocate( | ||
| 287 | struct xfs_bmalloca *args) | ||
| 288 | { | ||
| 289 | DECLARE_COMPLETION_ONSTACK(done); | ||
| 290 | |||
| 291 | if (!args->stack_switch) | ||
| 292 | return __xfs_bmapi_allocate(args); | ||
| 293 | |||
| 294 | |||
| 295 | args->done = &done; | ||
| 296 | args->kswapd = current_is_kswapd(); | ||
| 297 | INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); | ||
| 298 | queue_work(xfs_alloc_wq, &args->work); | ||
| 299 | wait_for_completion(&done); | ||
| 300 | destroy_work_on_stack(&args->work); | ||
| 301 | return args->result; | ||
| 302 | } | ||
| 303 | |||
| 304 | /* | ||
| 305 | * Check if the endoff is outside the last extent. If so the caller will grow | 252 | * Check if the endoff is outside the last extent. If so the caller will grow |
| 306 | * the allocation to a stripe unit boundary. All offsets are considered outside | 253 | * the allocation to a stripe unit boundary. All offsets are considered outside |
| 307 | * the end of file for an empty fork, so 1 is returned in *eof in that case. | 254 | * the end of file for an empty fork, so 1 is returned in *eof in that case. |
diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h index 075f72232a64..2fdb72d2c908 100644 --- a/fs/xfs/xfs_bmap_util.h +++ b/fs/xfs/xfs_bmap_util.h | |||
| @@ -55,8 +55,6 @@ struct xfs_bmalloca { | |||
| 55 | bool userdata;/* set if is user data */ | 55 | bool userdata;/* set if is user data */ |
| 56 | bool aeof; /* allocated space at eof */ | 56 | bool aeof; /* allocated space at eof */ |
| 57 | bool conv; /* overwriting unwritten extents */ | 57 | bool conv; /* overwriting unwritten extents */ |
| 58 | bool stack_switch; | ||
| 59 | bool kswapd; /* allocation in kswapd context */ | ||
| 60 | int flags; | 58 | int flags; |
| 61 | struct completion *done; | 59 | struct completion *done; |
| 62 | struct work_struct work; | 60 | struct work_struct work; |
| @@ -66,8 +64,6 @@ struct xfs_bmalloca { | |||
| 66 | int xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist, | 64 | int xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist, |
| 67 | int *committed); | 65 | int *committed); |
| 68 | int xfs_bmap_rtalloc(struct xfs_bmalloca *ap); | 66 | int xfs_bmap_rtalloc(struct xfs_bmalloca *ap); |
| 69 | int xfs_bmapi_allocate(struct xfs_bmalloca *args); | ||
| 70 | int __xfs_bmapi_allocate(struct xfs_bmalloca *args); | ||
| 71 | int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff, | 67 | int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff, |
| 72 | int whichfork, int *eof); | 68 | int whichfork, int *eof); |
| 73 | int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip, | 69 | int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip, |
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index bf810c6baf2b..cf893bc1e373 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include "xfs_error.h" | 33 | #include "xfs_error.h" |
| 34 | #include "xfs_trace.h" | 34 | #include "xfs_trace.h" |
| 35 | #include "xfs_cksum.h" | 35 | #include "xfs_cksum.h" |
| 36 | #include "xfs_alloc.h" | ||
| 36 | 37 | ||
| 37 | /* | 38 | /* |
| 38 | * Cursor allocation zone. | 39 | * Cursor allocation zone. |
| @@ -2323,7 +2324,7 @@ error1: | |||
| 2323 | * record (to be inserted into parent). | 2324 | * record (to be inserted into parent). |
| 2324 | */ | 2325 | */ |
| 2325 | STATIC int /* error */ | 2326 | STATIC int /* error */ |
| 2326 | xfs_btree_split( | 2327 | __xfs_btree_split( |
| 2327 | struct xfs_btree_cur *cur, | 2328 | struct xfs_btree_cur *cur, |
| 2328 | int level, | 2329 | int level, |
| 2329 | union xfs_btree_ptr *ptrp, | 2330 | union xfs_btree_ptr *ptrp, |
| @@ -2503,6 +2504,85 @@ error0: | |||
| 2503 | return error; | 2504 | return error; |
| 2504 | } | 2505 | } |
| 2505 | 2506 | ||
| 2507 | struct xfs_btree_split_args { | ||
| 2508 | struct xfs_btree_cur *cur; | ||
| 2509 | int level; | ||
| 2510 | union xfs_btree_ptr *ptrp; | ||
| 2511 | union xfs_btree_key *key; | ||
| 2512 | struct xfs_btree_cur **curp; | ||
| 2513 | int *stat; /* success/failure */ | ||
| 2514 | int result; | ||
| 2515 | bool kswapd; /* allocation in kswapd context */ | ||
| 2516 | struct completion *done; | ||
| 2517 | struct work_struct work; | ||
| 2518 | }; | ||
| 2519 | |||
| 2520 | /* | ||
| 2521 | * Stack switching interfaces for allocation | ||
| 2522 | */ | ||
| 2523 | static void | ||
| 2524 | xfs_btree_split_worker( | ||
| 2525 | struct work_struct *work) | ||
| 2526 | { | ||
| 2527 | struct xfs_btree_split_args *args = container_of(work, | ||
| 2528 | struct xfs_btree_split_args, work); | ||
| 2529 | unsigned long pflags; | ||
| 2530 | unsigned long new_pflags = PF_FSTRANS; | ||
| 2531 | |||
| 2532 | /* | ||
| 2533 | * we are in a transaction context here, but may also be doing work | ||
| 2534 | * in kswapd context, and hence we may need to inherit that state | ||
| 2535 | * temporarily to ensure that we don't block waiting for memory reclaim | ||
| 2536 | * in any way. | ||
| 2537 | */ | ||
| 2538 | if (args->kswapd) | ||
| 2539 | new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; | ||
| 2540 | |||
| 2541 | current_set_flags_nested(&pflags, new_pflags); | ||
| 2542 | |||
| 2543 | args->result = __xfs_btree_split(args->cur, args->level, args->ptrp, | ||
| 2544 | args->key, args->curp, args->stat); | ||
| 2545 | complete(args->done); | ||
| 2546 | |||
| 2547 | current_restore_flags_nested(&pflags, new_pflags); | ||
| 2548 | } | ||
| 2549 | |||
| 2550 | /* | ||
| 2551 | * BMBT split requests often come in with little stack to work on. Push | ||
| 2552 | * them off to a worker thread so there is lots of stack to use. For the other | ||
| 2553 | * btree types, just call directly to avoid the context switch overhead here. | ||
| 2554 | */ | ||
| 2555 | STATIC int /* error */ | ||
| 2556 | xfs_btree_split( | ||
| 2557 | struct xfs_btree_cur *cur, | ||
| 2558 | int level, | ||
| 2559 | union xfs_btree_ptr *ptrp, | ||
| 2560 | union xfs_btree_key *key, | ||
| 2561 | struct xfs_btree_cur **curp, | ||
| 2562 | int *stat) /* success/failure */ | ||
| 2563 | { | ||
| 2564 | struct xfs_btree_split_args args; | ||
| 2565 | DECLARE_COMPLETION_ONSTACK(done); | ||
| 2566 | |||
| 2567 | if (cur->bc_btnum != XFS_BTNUM_BMAP) | ||
| 2568 | return __xfs_btree_split(cur, level, ptrp, key, curp, stat); | ||
| 2569 | |||
| 2570 | args.cur = cur; | ||
| 2571 | args.level = level; | ||
| 2572 | args.ptrp = ptrp; | ||
| 2573 | args.key = key; | ||
| 2574 | args.curp = curp; | ||
| 2575 | args.stat = stat; | ||
| 2576 | args.done = &done; | ||
| 2577 | args.kswapd = current_is_kswapd(); | ||
| 2578 | INIT_WORK_ONSTACK(&args.work, xfs_btree_split_worker); | ||
| 2579 | queue_work(xfs_alloc_wq, &args.work); | ||
| 2580 | wait_for_completion(&done); | ||
| 2581 | destroy_work_on_stack(&args.work); | ||
| 2582 | return args.result; | ||
| 2583 | } | ||
| 2584 | |||
| 2585 | |||
| 2506 | /* | 2586 | /* |
| 2507 | * Copy the old inode root contents into a real block and make the | 2587 | * Copy the old inode root contents into a real block and make the |
| 2508 | * broot point to it. | 2588 | * broot point to it. |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 6c5eb4c551e3..6d3ec2b6ee29 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
| @@ -749,8 +749,7 @@ xfs_iomap_write_allocate( | |||
| 749 | * pointer that the caller gave to us. | 749 | * pointer that the caller gave to us. |
| 750 | */ | 750 | */ |
| 751 | error = xfs_bmapi_write(tp, ip, map_start_fsb, | 751 | error = xfs_bmapi_write(tp, ip, map_start_fsb, |
| 752 | count_fsb, | 752 | count_fsb, 0, |
| 753 | XFS_BMAPI_STACK_SWITCH, | ||
| 754 | &first_block, 1, | 753 | &first_block, 1, |
| 755 | imap, &nimaps, &free_list); | 754 | imap, &nimaps, &free_list); |
| 756 | if (error) | 755 | if (error) |
diff --git a/fs/xfs/xfs_sb.c b/fs/xfs/xfs_sb.c index c3453b11f563..7703fa6770ff 100644 --- a/fs/xfs/xfs_sb.c +++ b/fs/xfs/xfs_sb.c | |||
| @@ -483,10 +483,16 @@ xfs_sb_quota_to_disk( | |||
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | /* | 485 | /* |
| 486 | * GQUOTINO and PQUOTINO cannot be used together in versions | 486 | * GQUOTINO and PQUOTINO cannot be used together in versions of |
| 487 | * of superblock that do not have pquotino. from->sb_flags | 487 | * superblock that do not have pquotino. from->sb_flags tells us which |
| 488 | * tells us which quota is active and should be copied to | 488 | * quota is active and should be copied to disk. If neither are active, |
| 489 | * disk. | 489 | * make sure we write NULLFSINO to the sb_gquotino field as a quota |
| 490 | * inode value of "0" is invalid when the XFS_SB_VERSION_QUOTA feature | ||
| 491 | * bit is set. | ||
| 492 | * | ||
| 493 | * Note that we don't need to handle the sb_uquotino or sb_pquotino here | ||
| 494 | * as they do not require any translation. Hence the main sb field loop | ||
| 495 | * will write them appropriately from the in-core superblock. | ||
| 490 | */ | 496 | */ |
| 491 | if ((*fields & XFS_SB_GQUOTINO) && | 497 | if ((*fields & XFS_SB_GQUOTINO) && |
| 492 | (from->sb_qflags & XFS_GQUOTA_ACCT)) | 498 | (from->sb_qflags & XFS_GQUOTA_ACCT)) |
| @@ -494,6 +500,17 @@ xfs_sb_quota_to_disk( | |||
| 494 | else if ((*fields & XFS_SB_PQUOTINO) && | 500 | else if ((*fields & XFS_SB_PQUOTINO) && |
| 495 | (from->sb_qflags & XFS_PQUOTA_ACCT)) | 501 | (from->sb_qflags & XFS_PQUOTA_ACCT)) |
| 496 | to->sb_gquotino = cpu_to_be64(from->sb_pquotino); | 502 | to->sb_gquotino = cpu_to_be64(from->sb_pquotino); |
| 503 | else { | ||
| 504 | /* | ||
| 505 | * We can't rely on just the fields being logged to tell us | ||
| 506 | * that it is safe to write NULLFSINO - we should only do that | ||
| 507 | * if quotas are not actually enabled. Hence only write | ||
| 508 | * NULLFSINO if both in-core quota inodes are NULL. | ||
| 509 | */ | ||
| 510 | if (from->sb_gquotino == NULLFSINO && | ||
| 511 | from->sb_pquotino == NULLFSINO) | ||
| 512 | to->sb_gquotino = cpu_to_be64(NULLFSINO); | ||
| 513 | } | ||
| 497 | 514 | ||
| 498 | *fields &= ~(XFS_SB_PQUOTINO | XFS_SB_GQUOTINO); | 515 | *fields &= ~(XFS_SB_PQUOTINO | XFS_SB_GQUOTINO); |
| 499 | } | 516 | } |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ec4112d257bc..8f8ae95c6e27 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -482,8 +482,8 @@ extern struct cpufreq_governor cpufreq_gov_conservative; | |||
| 482 | *********************************************************************/ | 482 | *********************************************************************/ |
| 483 | 483 | ||
| 484 | /* Special Values of .frequency field */ | 484 | /* Special Values of .frequency field */ |
| 485 | #define CPUFREQ_ENTRY_INVALID ~0 | 485 | #define CPUFREQ_ENTRY_INVALID ~0u |
| 486 | #define CPUFREQ_TABLE_END ~1 | 486 | #define CPUFREQ_TABLE_END ~1u |
| 487 | /* Special Values of .flags field */ | 487 | /* Special Values of .flags field */ |
| 488 | #define CPUFREQ_BOOST_FREQ (1 << 0) | 488 | #define CPUFREQ_BOOST_FREQ (1 << 0) |
| 489 | 489 | ||
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index b12f4bbd064c..35b51e7af886 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -578,8 +578,6 @@ struct mlx4_cq { | |||
| 578 | u32 cons_index; | 578 | u32 cons_index; |
| 579 | 579 | ||
| 580 | u16 irq; | 580 | u16 irq; |
| 581 | bool irq_affinity_change; | ||
| 582 | |||
| 583 | __be32 *set_ci_db; | 581 | __be32 *set_ci_db; |
| 584 | __be32 *arm_db; | 582 | __be32 *arm_db; |
| 585 | int arm_sn; | 583 | int arm_sn; |
| @@ -1167,6 +1165,8 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | |||
| 1167 | int *vector); | 1165 | int *vector); |
| 1168 | void mlx4_release_eq(struct mlx4_dev *dev, int vec); | 1166 | void mlx4_release_eq(struct mlx4_dev *dev, int vec); |
| 1169 | 1167 | ||
| 1168 | int mlx4_eq_get_irq(struct mlx4_dev *dev, int vec); | ||
| 1169 | |||
| 1170 | int mlx4_get_phys_port_id(struct mlx4_dev *dev); | 1170 | int mlx4_get_phys_port_id(struct mlx4_dev *dev); |
| 1171 | int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port); | 1171 | int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port); |
| 1172 | int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port); | 1172 | int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port); |
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 11692dea18aa..42aa9b9ecd5f 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/lockdep.h> | 17 | #include <linux/lockdep.h> |
| 18 | #include <linux/atomic.h> | 18 | #include <linux/atomic.h> |
| 19 | #include <asm/processor.h> | 19 | #include <asm/processor.h> |
| 20 | #include <linux/osq_lock.h> | ||
| 20 | 21 | ||
| 21 | /* | 22 | /* |
| 22 | * Simple, straightforward mutexes with strict semantics: | 23 | * Simple, straightforward mutexes with strict semantics: |
| @@ -46,7 +47,6 @@ | |||
| 46 | * - detects multi-task circular deadlocks and prints out all affected | 47 | * - detects multi-task circular deadlocks and prints out all affected |
| 47 | * locks and tasks (and only those tasks) | 48 | * locks and tasks (and only those tasks) |
| 48 | */ | 49 | */ |
| 49 | struct optimistic_spin_queue; | ||
| 50 | struct mutex { | 50 | struct mutex { |
| 51 | /* 1: unlocked, 0: locked, negative: locked, possible waiters */ | 51 | /* 1: unlocked, 0: locked, negative: locked, possible waiters */ |
| 52 | atomic_t count; | 52 | atomic_t count; |
| @@ -56,7 +56,7 @@ struct mutex { | |||
| 56 | struct task_struct *owner; | 56 | struct task_struct *owner; |
| 57 | #endif | 57 | #endif |
| 58 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER | 58 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER |
| 59 | struct optimistic_spin_queue *osq; /* Spinner MCS lock */ | 59 | struct optimistic_spin_queue osq; /* Spinner MCS lock */ |
| 60 | #endif | 60 | #endif |
| 61 | #ifdef CONFIG_DEBUG_MUTEXES | 61 | #ifdef CONFIG_DEBUG_MUTEXES |
| 62 | const char *name; | 62 | const char *name; |
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index a70c9493d55a..d449018d0726 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h | |||
| @@ -25,9 +25,6 @@ struct phy_device *of_phy_attach(struct net_device *dev, | |||
| 25 | 25 | ||
| 26 | extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); | 26 | extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); |
| 27 | 27 | ||
| 28 | extern void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 29 | struct phy_device *phydev); | ||
| 30 | |||
| 31 | #else /* CONFIG_OF */ | 28 | #else /* CONFIG_OF */ |
| 32 | static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | 29 | static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) |
| 33 | { | 30 | { |
| @@ -63,11 +60,6 @@ static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) | |||
| 63 | { | 60 | { |
| 64 | return NULL; | 61 | return NULL; |
| 65 | } | 62 | } |
| 66 | |||
| 67 | static inline void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 68 | struct phy_device *phydev) | ||
| 69 | { | ||
| 70 | } | ||
| 71 | #endif /* CONFIG_OF */ | 63 | #endif /* CONFIG_OF */ |
| 72 | 64 | ||
| 73 | #if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY) | 65 | #if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY) |
diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h new file mode 100644 index 000000000000..90230d5811c5 --- /dev/null +++ b/include/linux/osq_lock.h | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #ifndef __LINUX_OSQ_LOCK_H | ||
| 2 | #define __LINUX_OSQ_LOCK_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * An MCS like lock especially tailored for optimistic spinning for sleeping | ||
| 6 | * lock implementations (mutex, rwsem, etc). | ||
| 7 | */ | ||
| 8 | |||
| 9 | #define OSQ_UNLOCKED_VAL (0) | ||
| 10 | |||
| 11 | struct optimistic_spin_queue { | ||
| 12 | /* | ||
| 13 | * Stores an encoded value of the CPU # of the tail node in the queue. | ||
| 14 | * If the queue is empty, then it's set to OSQ_UNLOCKED_VAL. | ||
| 15 | */ | ||
| 16 | atomic_t tail; | ||
| 17 | }; | ||
| 18 | |||
| 19 | /* Init macro and function. */ | ||
| 20 | #define OSQ_LOCK_UNLOCKED { ATOMIC_INIT(OSQ_UNLOCKED_VAL) } | ||
| 21 | |||
| 22 | static inline void osq_lock_init(struct optimistic_spin_queue *lock) | ||
| 23 | { | ||
| 24 | atomic_set(&lock->tail, OSQ_UNLOCKED_VAL); | ||
| 25 | } | ||
| 26 | |||
| 27 | #endif | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 5a75d19aa661..6a94cc8b1ca0 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -44,7 +44,6 @@ | |||
| 44 | #include <linux/debugobjects.h> | 44 | #include <linux/debugobjects.h> |
| 45 | #include <linux/bug.h> | 45 | #include <linux/bug.h> |
| 46 | #include <linux/compiler.h> | 46 | #include <linux/compiler.h> |
| 47 | #include <linux/percpu.h> | ||
| 48 | #include <asm/barrier.h> | 47 | #include <asm/barrier.h> |
| 49 | 48 | ||
| 50 | extern int rcu_expedited; /* for sysctl */ | 49 | extern int rcu_expedited; /* for sysctl */ |
| @@ -300,41 +299,6 @@ bool __rcu_is_watching(void); | |||
| 300 | #endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ | 299 | #endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ |
| 301 | 300 | ||
| 302 | /* | 301 | /* |
| 303 | * Hooks for cond_resched() and friends to avoid RCU CPU stall warnings. | ||
| 304 | */ | ||
| 305 | |||
| 306 | #define RCU_COND_RESCHED_LIM 256 /* ms vs. 100s of ms. */ | ||
| 307 | DECLARE_PER_CPU(int, rcu_cond_resched_count); | ||
| 308 | void rcu_resched(void); | ||
| 309 | |||
| 310 | /* | ||
| 311 | * Is it time to report RCU quiescent states? | ||
| 312 | * | ||
| 313 | * Note unsynchronized access to rcu_cond_resched_count. Yes, we might | ||
| 314 | * increment some random CPU's count, and possibly also load the result from | ||
| 315 | * yet another CPU's count. We might even clobber some other CPU's attempt | ||
| 316 | * to zero its counter. This is all OK because the goal is not precision, | ||
| 317 | * but rather reasonable amortization of rcu_note_context_switch() overhead | ||
| 318 | * and extremely high probability of avoiding RCU CPU stall warnings. | ||
| 319 | * Note that this function has to be preempted in just the wrong place, | ||
| 320 | * many thousands of times in a row, for anything bad to happen. | ||
| 321 | */ | ||
| 322 | static inline bool rcu_should_resched(void) | ||
| 323 | { | ||
| 324 | return raw_cpu_inc_return(rcu_cond_resched_count) >= | ||
| 325 | RCU_COND_RESCHED_LIM; | ||
| 326 | } | ||
| 327 | |||
| 328 | /* | ||
| 329 | * Report quiscent states to RCU if it is time to do so. | ||
| 330 | */ | ||
| 331 | static inline void rcu_cond_resched(void) | ||
| 332 | { | ||
| 333 | if (unlikely(rcu_should_resched())) | ||
| 334 | rcu_resched(); | ||
| 335 | } | ||
| 336 | |||
| 337 | /* | ||
| 338 | * Infrastructure to implement the synchronize_() primitives in | 302 | * Infrastructure to implement the synchronize_() primitives in |
| 339 | * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. | 303 | * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. |
| 340 | */ | 304 | */ |
| @@ -358,9 +322,19 @@ void wait_rcu_gp(call_rcu_func_t crf); | |||
| 358 | * initialization. | 322 | * initialization. |
| 359 | */ | 323 | */ |
| 360 | #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD | 324 | #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD |
| 325 | void init_rcu_head(struct rcu_head *head); | ||
| 326 | void destroy_rcu_head(struct rcu_head *head); | ||
| 361 | void init_rcu_head_on_stack(struct rcu_head *head); | 327 | void init_rcu_head_on_stack(struct rcu_head *head); |
| 362 | void destroy_rcu_head_on_stack(struct rcu_head *head); | 328 | void destroy_rcu_head_on_stack(struct rcu_head *head); |
| 363 | #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | 329 | #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ |
| 330 | static inline void init_rcu_head(struct rcu_head *head) | ||
| 331 | { | ||
| 332 | } | ||
| 333 | |||
| 334 | static inline void destroy_rcu_head(struct rcu_head *head) | ||
| 335 | { | ||
| 336 | } | ||
| 337 | |||
| 364 | static inline void init_rcu_head_on_stack(struct rcu_head *head) | 338 | static inline void init_rcu_head_on_stack(struct rcu_head *head) |
| 365 | { | 339 | { |
| 366 | } | 340 | } |
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h index d5b13bc07a0b..561e8615528d 100644 --- a/include/linux/rwsem-spinlock.h +++ b/include/linux/rwsem-spinlock.h | |||
| @@ -15,13 +15,13 @@ | |||
| 15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
| 16 | /* | 16 | /* |
| 17 | * the rw-semaphore definition | 17 | * the rw-semaphore definition |
| 18 | * - if activity is 0 then there are no active readers or writers | 18 | * - if count is 0 then there are no active readers or writers |
| 19 | * - if activity is +ve then that is the number of active readers | 19 | * - if count is +ve then that is the number of active readers |
| 20 | * - if activity is -1 then there is one active writer | 20 | * - if count is -1 then there is one active writer |
| 21 | * - if wait_list is not empty, then there are processes waiting for the semaphore | 21 | * - if wait_list is not empty, then there are processes waiting for the semaphore |
| 22 | */ | 22 | */ |
| 23 | struct rw_semaphore { | 23 | struct rw_semaphore { |
| 24 | __s32 activity; | 24 | __s32 count; |
| 25 | raw_spinlock_t wait_lock; | 25 | raw_spinlock_t wait_lock; |
| 26 | struct list_head wait_list; | 26 | struct list_head wait_list; |
| 27 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 27 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 8d79708146aa..035d3c57fc8a 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
| @@ -13,10 +13,11 @@ | |||
| 13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
| 14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
| 15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| 16 | |||
| 17 | #include <linux/atomic.h> | 16 | #include <linux/atomic.h> |
| 17 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | ||
| 18 | #include <linux/osq_lock.h> | ||
| 19 | #endif | ||
| 18 | 20 | ||
| 19 | struct optimistic_spin_queue; | ||
| 20 | struct rw_semaphore; | 21 | struct rw_semaphore; |
| 21 | 22 | ||
| 22 | #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK | 23 | #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK |
| @@ -25,15 +26,15 @@ struct rw_semaphore; | |||
| 25 | /* All arch specific implementations share the same struct */ | 26 | /* All arch specific implementations share the same struct */ |
| 26 | struct rw_semaphore { | 27 | struct rw_semaphore { |
| 27 | long count; | 28 | long count; |
| 28 | raw_spinlock_t wait_lock; | ||
| 29 | struct list_head wait_list; | 29 | struct list_head wait_list; |
| 30 | #ifdef CONFIG_SMP | 30 | raw_spinlock_t wait_lock; |
| 31 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | ||
| 32 | struct optimistic_spin_queue osq; /* spinner MCS lock */ | ||
| 31 | /* | 33 | /* |
| 32 | * Write owner. Used as a speculative check to see | 34 | * Write owner. Used as a speculative check to see |
| 33 | * if the owner is running on the cpu. | 35 | * if the owner is running on the cpu. |
| 34 | */ | 36 | */ |
| 35 | struct task_struct *owner; | 37 | struct task_struct *owner; |
| 36 | struct optimistic_spin_queue *osq; /* spinner MCS lock */ | ||
| 37 | #endif | 38 | #endif |
| 38 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 39 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 39 | struct lockdep_map dep_map; | 40 | struct lockdep_map dep_map; |
| @@ -64,22 +65,19 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) | |||
| 64 | # define __RWSEM_DEP_MAP_INIT(lockname) | 65 | # define __RWSEM_DEP_MAP_INIT(lockname) |
| 65 | #endif | 66 | #endif |
| 66 | 67 | ||
| 67 | #if defined(CONFIG_SMP) && !defined(CONFIG_RWSEM_GENERIC_SPINLOCK) | 68 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 68 | #define __RWSEM_INITIALIZER(name) \ | 69 | #define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED, .owner = NULL |
| 69 | { RWSEM_UNLOCKED_VALUE, \ | ||
| 70 | __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ | ||
| 71 | LIST_HEAD_INIT((name).wait_list), \ | ||
| 72 | NULL, /* owner */ \ | ||
| 73 | NULL /* mcs lock */ \ | ||
| 74 | __RWSEM_DEP_MAP_INIT(name) } | ||
| 75 | #else | 70 | #else |
| 76 | #define __RWSEM_INITIALIZER(name) \ | 71 | #define __RWSEM_OPT_INIT(lockname) |
| 77 | { RWSEM_UNLOCKED_VALUE, \ | ||
| 78 | __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ | ||
| 79 | LIST_HEAD_INIT((name).wait_list) \ | ||
| 80 | __RWSEM_DEP_MAP_INIT(name) } | ||
| 81 | #endif | 72 | #endif |
| 82 | 73 | ||
| 74 | #define __RWSEM_INITIALIZER(name) \ | ||
| 75 | { .count = RWSEM_UNLOCKED_VALUE, \ | ||
| 76 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ | ||
| 77 | .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock) \ | ||
| 78 | __RWSEM_OPT_INIT(name) \ | ||
| 79 | __RWSEM_DEP_MAP_INIT(name) } | ||
| 80 | |||
| 83 | #define DECLARE_RWSEM(name) \ | 81 | #define DECLARE_RWSEM(name) \ |
| 84 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 82 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
| 85 | 83 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 306f4f0c987a..0376b054a0d0 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -872,21 +872,21 @@ enum cpu_idle_type { | |||
| 872 | #define SD_NUMA 0x4000 /* cross-node balancing */ | 872 | #define SD_NUMA 0x4000 /* cross-node balancing */ |
| 873 | 873 | ||
| 874 | #ifdef CONFIG_SCHED_SMT | 874 | #ifdef CONFIG_SCHED_SMT |
| 875 | static inline const int cpu_smt_flags(void) | 875 | static inline int cpu_smt_flags(void) |
| 876 | { | 876 | { |
| 877 | return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; | 877 | return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; |
| 878 | } | 878 | } |
| 879 | #endif | 879 | #endif |
| 880 | 880 | ||
| 881 | #ifdef CONFIG_SCHED_MC | 881 | #ifdef CONFIG_SCHED_MC |
| 882 | static inline const int cpu_core_flags(void) | 882 | static inline int cpu_core_flags(void) |
| 883 | { | 883 | { |
| 884 | return SD_SHARE_PKG_RESOURCES; | 884 | return SD_SHARE_PKG_RESOURCES; |
| 885 | } | 885 | } |
| 886 | #endif | 886 | #endif |
| 887 | 887 | ||
| 888 | #ifdef CONFIG_NUMA | 888 | #ifdef CONFIG_NUMA |
| 889 | static inline const int cpu_numa_flags(void) | 889 | static inline int cpu_numa_flags(void) |
| 890 | { | 890 | { |
| 891 | return SD_NUMA; | 891 | return SD_NUMA; |
| 892 | } | 892 | } |
| @@ -999,7 +999,7 @@ void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); | |||
| 999 | bool cpus_share_cache(int this_cpu, int that_cpu); | 999 | bool cpus_share_cache(int this_cpu, int that_cpu); |
| 1000 | 1000 | ||
| 1001 | typedef const struct cpumask *(*sched_domain_mask_f)(int cpu); | 1001 | typedef const struct cpumask *(*sched_domain_mask_f)(int cpu); |
| 1002 | typedef const int (*sched_domain_flags_f)(void); | 1002 | typedef int (*sched_domain_flags_f)(void); |
| 1003 | 1003 | ||
| 1004 | #define SDTL_OVERLAP 0x01 | 1004 | #define SDTL_OVERLAP 0x01 |
| 1005 | 1005 | ||
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 7277caf3743d..47f425464f84 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -203,7 +203,6 @@ struct neigh_table { | |||
| 203 | void (*proxy_redo)(struct sk_buff *skb); | 203 | void (*proxy_redo)(struct sk_buff *skb); |
| 204 | char *id; | 204 | char *id; |
| 205 | struct neigh_parms parms; | 205 | struct neigh_parms parms; |
| 206 | /* HACK. gc_* should follow parms without a gap! */ | ||
| 207 | int gc_interval; | 206 | int gc_interval; |
| 208 | int gc_thresh1; | 207 | int gc_thresh1; |
| 209 | int gc_thresh2; | 208 | int gc_thresh2; |
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h index 079030c853d8..e2070960bac0 100644 --- a/include/net/netns/ieee802154_6lowpan.h +++ b/include/net/netns/ieee802154_6lowpan.h | |||
| @@ -16,7 +16,7 @@ struct netns_sysctl_lowpan { | |||
| 16 | struct netns_ieee802154_lowpan { | 16 | struct netns_ieee802154_lowpan { |
| 17 | struct netns_sysctl_lowpan sysctl; | 17 | struct netns_sysctl_lowpan sysctl; |
| 18 | struct netns_frags frags; | 18 | struct netns_frags frags; |
| 19 | u16 max_dsize; | 19 | int max_dsize; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | #endif | 22 | #endif |
diff --git a/include/net/sock.h b/include/net/sock.h index 173cae485de1..156350745700 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -1768,9 +1768,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst) | |||
| 1768 | static inline void | 1768 | static inline void |
| 1769 | sk_dst_set(struct sock *sk, struct dst_entry *dst) | 1769 | sk_dst_set(struct sock *sk, struct dst_entry *dst) |
| 1770 | { | 1770 | { |
| 1771 | spin_lock(&sk->sk_dst_lock); | 1771 | struct dst_entry *old_dst; |
| 1772 | __sk_dst_set(sk, dst); | 1772 | |
| 1773 | spin_unlock(&sk->sk_dst_lock); | 1773 | sk_tx_queue_clear(sk); |
| 1774 | old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst); | ||
| 1775 | dst_release(old_dst); | ||
| 1774 | } | 1776 | } |
| 1775 | 1777 | ||
| 1776 | static inline void | 1778 | static inline void |
| @@ -1782,9 +1784,7 @@ __sk_dst_reset(struct sock *sk) | |||
| 1782 | static inline void | 1784 | static inline void |
| 1783 | sk_dst_reset(struct sock *sk) | 1785 | sk_dst_reset(struct sock *sk) |
| 1784 | { | 1786 | { |
| 1785 | spin_lock(&sk->sk_dst_lock); | 1787 | sk_dst_set(sk, NULL); |
| 1786 | __sk_dst_reset(sk); | ||
| 1787 | spin_unlock(&sk->sk_dst_lock); | ||
| 1788 | } | 1788 | } |
| 1789 | 1789 | ||
| 1790 | struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); | 1790 | struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); |
diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks index 35536d9c0964..76768ee812b2 100644 --- a/kernel/Kconfig.locks +++ b/kernel/Kconfig.locks | |||
| @@ -220,9 +220,16 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE | |||
| 220 | 220 | ||
| 221 | endif | 221 | endif |
| 222 | 222 | ||
| 223 | config ARCH_SUPPORTS_ATOMIC_RMW | ||
| 224 | bool | ||
| 225 | |||
| 223 | config MUTEX_SPIN_ON_OWNER | 226 | config MUTEX_SPIN_ON_OWNER |
| 224 | def_bool y | 227 | def_bool y |
| 225 | depends on SMP && !DEBUG_MUTEXES | 228 | depends on SMP && !DEBUG_MUTEXES && ARCH_SUPPORTS_ATOMIC_RMW |
| 229 | |||
| 230 | config RWSEM_SPIN_ON_OWNER | ||
| 231 | def_bool y | ||
| 232 | depends on SMP && RWSEM_XCHGADD_ALGORITHM && ARCH_SUPPORTS_ATOMIC_RMW | ||
| 226 | 233 | ||
| 227 | config ARCH_USE_QUEUE_RWLOCK | 234 | config ARCH_USE_QUEUE_RWLOCK |
| 228 | bool | 235 | bool |
diff --git a/kernel/events/core.c b/kernel/events/core.c index a33d9a2bcbd7..b0c95f0f06fd 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -2320,7 +2320,7 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn, | |||
| 2320 | next_parent = rcu_dereference(next_ctx->parent_ctx); | 2320 | next_parent = rcu_dereference(next_ctx->parent_ctx); |
| 2321 | 2321 | ||
| 2322 | /* If neither context have a parent context; they cannot be clones. */ | 2322 | /* If neither context have a parent context; they cannot be clones. */ |
| 2323 | if (!parent && !next_parent) | 2323 | if (!parent || !next_parent) |
| 2324 | goto unlock; | 2324 | goto unlock; |
| 2325 | 2325 | ||
| 2326 | if (next_parent == ctx || next_ctx == parent || next_parent == parent) { | 2326 | if (next_parent == ctx || next_ctx == parent || next_parent == parent) { |
diff --git a/kernel/locking/mcs_spinlock.c b/kernel/locking/mcs_spinlock.c index 838dc9e00669..be9ee1559fca 100644 --- a/kernel/locking/mcs_spinlock.c +++ b/kernel/locking/mcs_spinlock.c | |||
| @@ -14,21 +14,47 @@ | |||
| 14 | * called from interrupt context and we have preemption disabled while | 14 | * called from interrupt context and we have preemption disabled while |
| 15 | * spinning. | 15 | * spinning. |
| 16 | */ | 16 | */ |
| 17 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct optimistic_spin_queue, osq_node); | 17 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct optimistic_spin_node, osq_node); |
| 18 | |||
| 19 | /* | ||
| 20 | * We use the value 0 to represent "no CPU", thus the encoded value | ||
| 21 | * will be the CPU number incremented by 1. | ||
| 22 | */ | ||
| 23 | static inline int encode_cpu(int cpu_nr) | ||
| 24 | { | ||
| 25 | return cpu_nr + 1; | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline struct optimistic_spin_node *decode_cpu(int encoded_cpu_val) | ||
| 29 | { | ||
| 30 | int cpu_nr = encoded_cpu_val - 1; | ||
| 31 | |||
| 32 | return per_cpu_ptr(&osq_node, cpu_nr); | ||
| 33 | } | ||
| 18 | 34 | ||
| 19 | /* | 35 | /* |
| 20 | * Get a stable @node->next pointer, either for unlock() or unqueue() purposes. | 36 | * Get a stable @node->next pointer, either for unlock() or unqueue() purposes. |
| 21 | * Can return NULL in case we were the last queued and we updated @lock instead. | 37 | * Can return NULL in case we were the last queued and we updated @lock instead. |
| 22 | */ | 38 | */ |
| 23 | static inline struct optimistic_spin_queue * | 39 | static inline struct optimistic_spin_node * |
| 24 | osq_wait_next(struct optimistic_spin_queue **lock, | 40 | osq_wait_next(struct optimistic_spin_queue *lock, |
| 25 | struct optimistic_spin_queue *node, | 41 | struct optimistic_spin_node *node, |
| 26 | struct optimistic_spin_queue *prev) | 42 | struct optimistic_spin_node *prev) |
| 27 | { | 43 | { |
| 28 | struct optimistic_spin_queue *next = NULL; | 44 | struct optimistic_spin_node *next = NULL; |
| 45 | int curr = encode_cpu(smp_processor_id()); | ||
| 46 | int old; | ||
| 47 | |||
| 48 | /* | ||
| 49 | * If there is a prev node in queue, then the 'old' value will be | ||
| 50 | * the prev node's CPU #, else it's set to OSQ_UNLOCKED_VAL since if | ||
| 51 | * we're currently last in queue, then the queue will then become empty. | ||
| 52 | */ | ||
| 53 | old = prev ? prev->cpu : OSQ_UNLOCKED_VAL; | ||
| 29 | 54 | ||
| 30 | for (;;) { | 55 | for (;;) { |
| 31 | if (*lock == node && cmpxchg(lock, node, prev) == node) { | 56 | if (atomic_read(&lock->tail) == curr && |
| 57 | atomic_cmpxchg(&lock->tail, curr, old) == curr) { | ||
| 32 | /* | 58 | /* |
| 33 | * We were the last queued, we moved @lock back. @prev | 59 | * We were the last queued, we moved @lock back. @prev |
| 34 | * will now observe @lock and will complete its | 60 | * will now observe @lock and will complete its |
| @@ -59,18 +85,23 @@ osq_wait_next(struct optimistic_spin_queue **lock, | |||
| 59 | return next; | 85 | return next; |
| 60 | } | 86 | } |
| 61 | 87 | ||
| 62 | bool osq_lock(struct optimistic_spin_queue **lock) | 88 | bool osq_lock(struct optimistic_spin_queue *lock) |
| 63 | { | 89 | { |
| 64 | struct optimistic_spin_queue *node = this_cpu_ptr(&osq_node); | 90 | struct optimistic_spin_node *node = this_cpu_ptr(&osq_node); |
| 65 | struct optimistic_spin_queue *prev, *next; | 91 | struct optimistic_spin_node *prev, *next; |
| 92 | int curr = encode_cpu(smp_processor_id()); | ||
| 93 | int old; | ||
| 66 | 94 | ||
| 67 | node->locked = 0; | 95 | node->locked = 0; |
| 68 | node->next = NULL; | 96 | node->next = NULL; |
| 97 | node->cpu = curr; | ||
| 69 | 98 | ||
| 70 | node->prev = prev = xchg(lock, node); | 99 | old = atomic_xchg(&lock->tail, curr); |
| 71 | if (likely(prev == NULL)) | 100 | if (old == OSQ_UNLOCKED_VAL) |
| 72 | return true; | 101 | return true; |
| 73 | 102 | ||
| 103 | prev = decode_cpu(old); | ||
| 104 | node->prev = prev; | ||
| 74 | ACCESS_ONCE(prev->next) = node; | 105 | ACCESS_ONCE(prev->next) = node; |
| 75 | 106 | ||
| 76 | /* | 107 | /* |
| @@ -149,20 +180,21 @@ unqueue: | |||
| 149 | return false; | 180 | return false; |
| 150 | } | 181 | } |
| 151 | 182 | ||
| 152 | void osq_unlock(struct optimistic_spin_queue **lock) | 183 | void osq_unlock(struct optimistic_spin_queue *lock) |
| 153 | { | 184 | { |
| 154 | struct optimistic_spin_queue *node = this_cpu_ptr(&osq_node); | 185 | struct optimistic_spin_node *node, *next; |
| 155 | struct optimistic_spin_queue *next; | 186 | int curr = encode_cpu(smp_processor_id()); |
| 156 | 187 | ||
| 157 | /* | 188 | /* |
| 158 | * Fast path for the uncontended case. | 189 | * Fast path for the uncontended case. |
| 159 | */ | 190 | */ |
| 160 | if (likely(cmpxchg(lock, node, NULL) == node)) | 191 | if (likely(atomic_cmpxchg(&lock->tail, curr, OSQ_UNLOCKED_VAL) == curr)) |
| 161 | return; | 192 | return; |
| 162 | 193 | ||
| 163 | /* | 194 | /* |
| 164 | * Second most likely case. | 195 | * Second most likely case. |
| 165 | */ | 196 | */ |
| 197 | node = this_cpu_ptr(&osq_node); | ||
| 166 | next = xchg(&node->next, NULL); | 198 | next = xchg(&node->next, NULL); |
| 167 | if (next) { | 199 | if (next) { |
| 168 | ACCESS_ONCE(next->locked) = 1; | 200 | ACCESS_ONCE(next->locked) = 1; |
diff --git a/kernel/locking/mcs_spinlock.h b/kernel/locking/mcs_spinlock.h index a2dbac4aca6b..74356dc0ce29 100644 --- a/kernel/locking/mcs_spinlock.h +++ b/kernel/locking/mcs_spinlock.h | |||
| @@ -118,12 +118,13 @@ void mcs_spin_unlock(struct mcs_spinlock **lock, struct mcs_spinlock *node) | |||
| 118 | * mutex_lock()/rwsem_down_{read,write}() etc. | 118 | * mutex_lock()/rwsem_down_{read,write}() etc. |
| 119 | */ | 119 | */ |
| 120 | 120 | ||
| 121 | struct optimistic_spin_queue { | 121 | struct optimistic_spin_node { |
| 122 | struct optimistic_spin_queue *next, *prev; | 122 | struct optimistic_spin_node *next, *prev; |
| 123 | int locked; /* 1 if lock acquired */ | 123 | int locked; /* 1 if lock acquired */ |
| 124 | int cpu; /* encoded CPU # value */ | ||
| 124 | }; | 125 | }; |
| 125 | 126 | ||
| 126 | extern bool osq_lock(struct optimistic_spin_queue **lock); | 127 | extern bool osq_lock(struct optimistic_spin_queue *lock); |
| 127 | extern void osq_unlock(struct optimistic_spin_queue **lock); | 128 | extern void osq_unlock(struct optimistic_spin_queue *lock); |
| 128 | 129 | ||
| 129 | #endif /* __LINUX_MCS_SPINLOCK_H */ | 130 | #endif /* __LINUX_MCS_SPINLOCK_H */ |
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index bc73d33c6760..acca2c1a3c5e 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c | |||
| @@ -60,7 +60,7 @@ __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) | |||
| 60 | INIT_LIST_HEAD(&lock->wait_list); | 60 | INIT_LIST_HEAD(&lock->wait_list); |
| 61 | mutex_clear_owner(lock); | 61 | mutex_clear_owner(lock); |
| 62 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER | 62 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER |
| 63 | lock->osq = NULL; | 63 | osq_lock_init(&lock->osq); |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | debug_mutex_init(lock, name, key); | 66 | debug_mutex_init(lock, name, key); |
diff --git a/kernel/locking/rwsem-spinlock.c b/kernel/locking/rwsem-spinlock.c index 9be8a9144978..2c93571162cb 100644 --- a/kernel/locking/rwsem-spinlock.c +++ b/kernel/locking/rwsem-spinlock.c | |||
| @@ -26,7 +26,7 @@ int rwsem_is_locked(struct rw_semaphore *sem) | |||
| 26 | unsigned long flags; | 26 | unsigned long flags; |
| 27 | 27 | ||
| 28 | if (raw_spin_trylock_irqsave(&sem->wait_lock, flags)) { | 28 | if (raw_spin_trylock_irqsave(&sem->wait_lock, flags)) { |
| 29 | ret = (sem->activity != 0); | 29 | ret = (sem->count != 0); |
| 30 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | 30 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); |
| 31 | } | 31 | } |
| 32 | return ret; | 32 | return ret; |
| @@ -46,7 +46,7 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, | |||
| 46 | debug_check_no_locks_freed((void *)sem, sizeof(*sem)); | 46 | debug_check_no_locks_freed((void *)sem, sizeof(*sem)); |
| 47 | lockdep_init_map(&sem->dep_map, name, key, 0); | 47 | lockdep_init_map(&sem->dep_map, name, key, 0); |
| 48 | #endif | 48 | #endif |
| 49 | sem->activity = 0; | 49 | sem->count = 0; |
| 50 | raw_spin_lock_init(&sem->wait_lock); | 50 | raw_spin_lock_init(&sem->wait_lock); |
| 51 | INIT_LIST_HEAD(&sem->wait_list); | 51 | INIT_LIST_HEAD(&sem->wait_list); |
| 52 | } | 52 | } |
| @@ -95,7 +95,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, int wakewrite) | |||
| 95 | waiter = list_entry(next, struct rwsem_waiter, list); | 95 | waiter = list_entry(next, struct rwsem_waiter, list); |
| 96 | } while (waiter->type != RWSEM_WAITING_FOR_WRITE); | 96 | } while (waiter->type != RWSEM_WAITING_FOR_WRITE); |
| 97 | 97 | ||
| 98 | sem->activity += woken; | 98 | sem->count += woken; |
| 99 | 99 | ||
| 100 | out: | 100 | out: |
| 101 | return sem; | 101 | return sem; |
| @@ -126,9 +126,9 @@ void __sched __down_read(struct rw_semaphore *sem) | |||
| 126 | 126 | ||
| 127 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | 127 | raw_spin_lock_irqsave(&sem->wait_lock, flags); |
| 128 | 128 | ||
| 129 | if (sem->activity >= 0 && list_empty(&sem->wait_list)) { | 129 | if (sem->count >= 0 && list_empty(&sem->wait_list)) { |
| 130 | /* granted */ | 130 | /* granted */ |
| 131 | sem->activity++; | 131 | sem->count++; |
| 132 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | 132 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); |
| 133 | goto out; | 133 | goto out; |
| 134 | } | 134 | } |
| @@ -170,9 +170,9 @@ int __down_read_trylock(struct rw_semaphore *sem) | |||
| 170 | 170 | ||
| 171 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | 171 | raw_spin_lock_irqsave(&sem->wait_lock, flags); |
| 172 | 172 | ||
| 173 | if (sem->activity >= 0 && list_empty(&sem->wait_list)) { | 173 | if (sem->count >= 0 && list_empty(&sem->wait_list)) { |
| 174 | /* granted */ | 174 | /* granted */ |
| 175 | sem->activity++; | 175 | sem->count++; |
| 176 | ret = 1; | 176 | ret = 1; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| @@ -206,7 +206,7 @@ void __sched __down_write_nested(struct rw_semaphore *sem, int subclass) | |||
| 206 | * itself into sleep and waiting for system woke it or someone | 206 | * itself into sleep and waiting for system woke it or someone |
| 207 | * else in the head of the wait list up. | 207 | * else in the head of the wait list up. |
| 208 | */ | 208 | */ |
| 209 | if (sem->activity == 0) | 209 | if (sem->count == 0) |
| 210 | break; | 210 | break; |
| 211 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | 211 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); |
| 212 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | 212 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); |
| @@ -214,7 +214,7 @@ void __sched __down_write_nested(struct rw_semaphore *sem, int subclass) | |||
| 214 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | 214 | raw_spin_lock_irqsave(&sem->wait_lock, flags); |
| 215 | } | 215 | } |
| 216 | /* got the lock */ | 216 | /* got the lock */ |
| 217 | sem->activity = -1; | 217 | sem->count = -1; |
| 218 | list_del(&waiter.list); | 218 | list_del(&waiter.list); |
| 219 | 219 | ||
| 220 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | 220 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); |
| @@ -235,9 +235,9 @@ int __down_write_trylock(struct rw_semaphore *sem) | |||
| 235 | 235 | ||
| 236 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | 236 | raw_spin_lock_irqsave(&sem->wait_lock, flags); |
| 237 | 237 | ||
| 238 | if (sem->activity == 0) { | 238 | if (sem->count == 0) { |
| 239 | /* got the lock */ | 239 | /* got the lock */ |
| 240 | sem->activity = -1; | 240 | sem->count = -1; |
| 241 | ret = 1; | 241 | ret = 1; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| @@ -255,7 +255,7 @@ void __up_read(struct rw_semaphore *sem) | |||
| 255 | 255 | ||
| 256 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | 256 | raw_spin_lock_irqsave(&sem->wait_lock, flags); |
| 257 | 257 | ||
| 258 | if (--sem->activity == 0 && !list_empty(&sem->wait_list)) | 258 | if (--sem->count == 0 && !list_empty(&sem->wait_list)) |
| 259 | sem = __rwsem_wake_one_writer(sem); | 259 | sem = __rwsem_wake_one_writer(sem); |
| 260 | 260 | ||
| 261 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | 261 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); |
| @@ -270,7 +270,7 @@ void __up_write(struct rw_semaphore *sem) | |||
| 270 | 270 | ||
| 271 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | 271 | raw_spin_lock_irqsave(&sem->wait_lock, flags); |
| 272 | 272 | ||
| 273 | sem->activity = 0; | 273 | sem->count = 0; |
| 274 | if (!list_empty(&sem->wait_list)) | 274 | if (!list_empty(&sem->wait_list)) |
| 275 | sem = __rwsem_do_wake(sem, 1); | 275 | sem = __rwsem_do_wake(sem, 1); |
| 276 | 276 | ||
| @@ -287,7 +287,7 @@ void __downgrade_write(struct rw_semaphore *sem) | |||
| 287 | 287 | ||
| 288 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | 288 | raw_spin_lock_irqsave(&sem->wait_lock, flags); |
| 289 | 289 | ||
| 290 | sem->activity = 1; | 290 | sem->count = 1; |
| 291 | if (!list_empty(&sem->wait_list)) | 291 | if (!list_empty(&sem->wait_list)) |
| 292 | sem = __rwsem_do_wake(sem, 0); | 292 | sem = __rwsem_do_wake(sem, 0); |
| 293 | 293 | ||
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c index dacc32142fcc..a2391ac135c8 100644 --- a/kernel/locking/rwsem-xadd.c +++ b/kernel/locking/rwsem-xadd.c | |||
| @@ -82,9 +82,9 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, | |||
| 82 | sem->count = RWSEM_UNLOCKED_VALUE; | 82 | sem->count = RWSEM_UNLOCKED_VALUE; |
| 83 | raw_spin_lock_init(&sem->wait_lock); | 83 | raw_spin_lock_init(&sem->wait_lock); |
| 84 | INIT_LIST_HEAD(&sem->wait_list); | 84 | INIT_LIST_HEAD(&sem->wait_list); |
| 85 | #ifdef CONFIG_SMP | 85 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 86 | sem->owner = NULL; | 86 | sem->owner = NULL; |
| 87 | sem->osq = NULL; | 87 | osq_lock_init(&sem->osq); |
| 88 | #endif | 88 | #endif |
| 89 | } | 89 | } |
| 90 | 90 | ||
| @@ -262,7 +262,7 @@ static inline bool rwsem_try_write_lock(long count, struct rw_semaphore *sem) | |||
| 262 | return false; | 262 | return false; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | #ifdef CONFIG_SMP | 265 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 266 | /* | 266 | /* |
| 267 | * Try to acquire write lock before the writer has been put on wait queue. | 267 | * Try to acquire write lock before the writer has been put on wait queue. |
| 268 | */ | 268 | */ |
| @@ -285,10 +285,10 @@ static inline bool rwsem_try_write_lock_unqueued(struct rw_semaphore *sem) | |||
| 285 | static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem) | 285 | static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem) |
| 286 | { | 286 | { |
| 287 | struct task_struct *owner; | 287 | struct task_struct *owner; |
| 288 | bool on_cpu = true; | 288 | bool on_cpu = false; |
| 289 | 289 | ||
| 290 | if (need_resched()) | 290 | if (need_resched()) |
| 291 | return 0; | 291 | return false; |
| 292 | 292 | ||
| 293 | rcu_read_lock(); | 293 | rcu_read_lock(); |
| 294 | owner = ACCESS_ONCE(sem->owner); | 294 | owner = ACCESS_ONCE(sem->owner); |
| @@ -297,9 +297,9 @@ static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem) | |||
| 297 | rcu_read_unlock(); | 297 | rcu_read_unlock(); |
| 298 | 298 | ||
| 299 | /* | 299 | /* |
| 300 | * If sem->owner is not set, the rwsem owner may have | 300 | * If sem->owner is not set, yet we have just recently entered the |
| 301 | * just acquired it and not set the owner yet or the rwsem | 301 | * slowpath, then there is a possibility reader(s) may have the lock. |
| 302 | * has been released. | 302 | * To be safe, avoid spinning in these situations. |
| 303 | */ | 303 | */ |
| 304 | return on_cpu; | 304 | return on_cpu; |
| 305 | } | 305 | } |
diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index 42f806de49d4..e2d3bc7f03b4 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/atomic.h> | 13 | #include <linux/atomic.h> |
| 14 | 14 | ||
| 15 | #if defined(CONFIG_SMP) && defined(CONFIG_RWSEM_XCHGADD_ALGORITHM) | 15 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 16 | static inline void rwsem_set_owner(struct rw_semaphore *sem) | 16 | static inline void rwsem_set_owner(struct rw_semaphore *sem) |
| 17 | { | 17 | { |
| 18 | sem->owner = current; | 18 | sem->owner = current; |
diff --git a/kernel/power/process.c b/kernel/power/process.c index 0ca8d83e2369..4ee194eb524b 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
| @@ -186,6 +186,7 @@ void thaw_processes(void) | |||
| 186 | 186 | ||
| 187 | printk("Restarting tasks ... "); | 187 | printk("Restarting tasks ... "); |
| 188 | 188 | ||
| 189 | __usermodehelper_set_disable_depth(UMH_FREEZING); | ||
| 189 | thaw_workqueues(); | 190 | thaw_workqueues(); |
| 190 | 191 | ||
| 191 | read_lock(&tasklist_lock); | 192 | read_lock(&tasklist_lock); |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 4dd8822f732a..ed35a4790afe 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
| @@ -306,7 +306,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
| 306 | error = suspend_ops->begin(state); | 306 | error = suspend_ops->begin(state); |
| 307 | if (error) | 307 | if (error) |
| 308 | goto Close; | 308 | goto Close; |
| 309 | } else if (state == PM_SUSPEND_FREEZE && freeze_ops->begin) { | 309 | } else if (state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->begin) { |
| 310 | error = freeze_ops->begin(); | 310 | error = freeze_ops->begin(); |
| 311 | if (error) | 311 | if (error) |
| 312 | goto Close; | 312 | goto Close; |
| @@ -335,7 +335,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
| 335 | Close: | 335 | Close: |
| 336 | if (need_suspend_ops(state) && suspend_ops->end) | 336 | if (need_suspend_ops(state) && suspend_ops->end) |
| 337 | suspend_ops->end(); | 337 | suspend_ops->end(); |
| 338 | else if (state == PM_SUSPEND_FREEZE && freeze_ops->end) | 338 | else if (state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->end) |
| 339 | freeze_ops->end(); | 339 | freeze_ops->end(); |
| 340 | 340 | ||
| 341 | return error; | 341 | return error; |
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index f1ba77363fbb..625d0b0cd75a 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -206,6 +206,70 @@ void rcu_bh_qs(int cpu) | |||
| 206 | rdp->passed_quiesce = 1; | 206 | rdp->passed_quiesce = 1; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | static DEFINE_PER_CPU(int, rcu_sched_qs_mask); | ||
| 210 | |||
| 211 | static DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = { | ||
| 212 | .dynticks_nesting = DYNTICK_TASK_EXIT_IDLE, | ||
| 213 | .dynticks = ATOMIC_INIT(1), | ||
| 214 | #ifdef CONFIG_NO_HZ_FULL_SYSIDLE | ||
| 215 | .dynticks_idle_nesting = DYNTICK_TASK_NEST_VALUE, | ||
| 216 | .dynticks_idle = ATOMIC_INIT(1), | ||
| 217 | #endif /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */ | ||
| 218 | }; | ||
| 219 | |||
| 220 | /* | ||
| 221 | * Let the RCU core know that this CPU has gone through the scheduler, | ||
| 222 | * which is a quiescent state. This is called when the need for a | ||
| 223 | * quiescent state is urgent, so we burn an atomic operation and full | ||
| 224 | * memory barriers to let the RCU core know about it, regardless of what | ||
| 225 | * this CPU might (or might not) do in the near future. | ||
| 226 | * | ||
| 227 | * We inform the RCU core by emulating a zero-duration dyntick-idle | ||
| 228 | * period, which we in turn do by incrementing the ->dynticks counter | ||
| 229 | * by two. | ||
| 230 | */ | ||
| 231 | static void rcu_momentary_dyntick_idle(void) | ||
| 232 | { | ||
| 233 | unsigned long flags; | ||
| 234 | struct rcu_data *rdp; | ||
| 235 | struct rcu_dynticks *rdtp; | ||
| 236 | int resched_mask; | ||
| 237 | struct rcu_state *rsp; | ||
| 238 | |||
| 239 | local_irq_save(flags); | ||
| 240 | |||
| 241 | /* | ||
| 242 | * Yes, we can lose flag-setting operations. This is OK, because | ||
| 243 | * the flag will be set again after some delay. | ||
| 244 | */ | ||
| 245 | resched_mask = raw_cpu_read(rcu_sched_qs_mask); | ||
| 246 | raw_cpu_write(rcu_sched_qs_mask, 0); | ||
| 247 | |||
| 248 | /* Find the flavor that needs a quiescent state. */ | ||
| 249 | for_each_rcu_flavor(rsp) { | ||
| 250 | rdp = raw_cpu_ptr(rsp->rda); | ||
| 251 | if (!(resched_mask & rsp->flavor_mask)) | ||
| 252 | continue; | ||
| 253 | smp_mb(); /* rcu_sched_qs_mask before cond_resched_completed. */ | ||
| 254 | if (ACCESS_ONCE(rdp->mynode->completed) != | ||
| 255 | ACCESS_ONCE(rdp->cond_resched_completed)) | ||
| 256 | continue; | ||
| 257 | |||
| 258 | /* | ||
| 259 | * Pretend to be momentarily idle for the quiescent state. | ||
| 260 | * This allows the grace-period kthread to record the | ||
| 261 | * quiescent state, with no need for this CPU to do anything | ||
| 262 | * further. | ||
| 263 | */ | ||
| 264 | rdtp = this_cpu_ptr(&rcu_dynticks); | ||
| 265 | smp_mb__before_atomic(); /* Earlier stuff before QS. */ | ||
| 266 | atomic_add(2, &rdtp->dynticks); /* QS. */ | ||
| 267 | smp_mb__after_atomic(); /* Later stuff after QS. */ | ||
| 268 | break; | ||
| 269 | } | ||
| 270 | local_irq_restore(flags); | ||
| 271 | } | ||
| 272 | |||
| 209 | /* | 273 | /* |
| 210 | * Note a context switch. This is a quiescent state for RCU-sched, | 274 | * Note a context switch. This is a quiescent state for RCU-sched, |
| 211 | * and requires special handling for preemptible RCU. | 275 | * and requires special handling for preemptible RCU. |
| @@ -216,19 +280,12 @@ void rcu_note_context_switch(int cpu) | |||
| 216 | trace_rcu_utilization(TPS("Start context switch")); | 280 | trace_rcu_utilization(TPS("Start context switch")); |
| 217 | rcu_sched_qs(cpu); | 281 | rcu_sched_qs(cpu); |
| 218 | rcu_preempt_note_context_switch(cpu); | 282 | rcu_preempt_note_context_switch(cpu); |
| 283 | if (unlikely(raw_cpu_read(rcu_sched_qs_mask))) | ||
| 284 | rcu_momentary_dyntick_idle(); | ||
| 219 | trace_rcu_utilization(TPS("End context switch")); | 285 | trace_rcu_utilization(TPS("End context switch")); |
| 220 | } | 286 | } |
| 221 | EXPORT_SYMBOL_GPL(rcu_note_context_switch); | 287 | EXPORT_SYMBOL_GPL(rcu_note_context_switch); |
| 222 | 288 | ||
| 223 | static DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = { | ||
| 224 | .dynticks_nesting = DYNTICK_TASK_EXIT_IDLE, | ||
| 225 | .dynticks = ATOMIC_INIT(1), | ||
| 226 | #ifdef CONFIG_NO_HZ_FULL_SYSIDLE | ||
| 227 | .dynticks_idle_nesting = DYNTICK_TASK_NEST_VALUE, | ||
| 228 | .dynticks_idle = ATOMIC_INIT(1), | ||
| 229 | #endif /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */ | ||
| 230 | }; | ||
| 231 | |||
| 232 | static long blimit = 10; /* Maximum callbacks per rcu_do_batch. */ | 289 | static long blimit = 10; /* Maximum callbacks per rcu_do_batch. */ |
| 233 | static long qhimark = 10000; /* If this many pending, ignore blimit. */ | 290 | static long qhimark = 10000; /* If this many pending, ignore blimit. */ |
| 234 | static long qlowmark = 100; /* Once only this many pending, use blimit. */ | 291 | static long qlowmark = 100; /* Once only this many pending, use blimit. */ |
| @@ -243,6 +300,13 @@ static ulong jiffies_till_next_fqs = ULONG_MAX; | |||
| 243 | module_param(jiffies_till_first_fqs, ulong, 0644); | 300 | module_param(jiffies_till_first_fqs, ulong, 0644); |
| 244 | module_param(jiffies_till_next_fqs, ulong, 0644); | 301 | module_param(jiffies_till_next_fqs, ulong, 0644); |
| 245 | 302 | ||
| 303 | /* | ||
| 304 | * How long the grace period must be before we start recruiting | ||
| 305 | * quiescent-state help from rcu_note_context_switch(). | ||
| 306 | */ | ||
| 307 | static ulong jiffies_till_sched_qs = HZ / 20; | ||
| 308 | module_param(jiffies_till_sched_qs, ulong, 0644); | ||
| 309 | |||
| 246 | static bool rcu_start_gp_advanced(struct rcu_state *rsp, struct rcu_node *rnp, | 310 | static bool rcu_start_gp_advanced(struct rcu_state *rsp, struct rcu_node *rnp, |
| 247 | struct rcu_data *rdp); | 311 | struct rcu_data *rdp); |
| 248 | static void force_qs_rnp(struct rcu_state *rsp, | 312 | static void force_qs_rnp(struct rcu_state *rsp, |
| @@ -853,6 +917,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp, | |||
| 853 | bool *isidle, unsigned long *maxj) | 917 | bool *isidle, unsigned long *maxj) |
| 854 | { | 918 | { |
| 855 | unsigned int curr; | 919 | unsigned int curr; |
| 920 | int *rcrmp; | ||
| 856 | unsigned int snap; | 921 | unsigned int snap; |
| 857 | 922 | ||
| 858 | curr = (unsigned int)atomic_add_return(0, &rdp->dynticks->dynticks); | 923 | curr = (unsigned int)atomic_add_return(0, &rdp->dynticks->dynticks); |
| @@ -893,27 +958,43 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp, | |||
| 893 | } | 958 | } |
| 894 | 959 | ||
| 895 | /* | 960 | /* |
| 896 | * There is a possibility that a CPU in adaptive-ticks state | 961 | * A CPU running for an extended time within the kernel can |
| 897 | * might run in the kernel with the scheduling-clock tick disabled | 962 | * delay RCU grace periods. When the CPU is in NO_HZ_FULL mode, |
| 898 | * for an extended time period. Invoke rcu_kick_nohz_cpu() to | 963 | * even context-switching back and forth between a pair of |
| 899 | * force the CPU to restart the scheduling-clock tick in this | 964 | * in-kernel CPU-bound tasks cannot advance grace periods. |
| 900 | * CPU is in this state. | 965 | * So if the grace period is old enough, make the CPU pay attention. |
| 901 | */ | 966 | * Note that the unsynchronized assignments to the per-CPU |
| 902 | rcu_kick_nohz_cpu(rdp->cpu); | 967 | * rcu_sched_qs_mask variable are safe. Yes, setting of |
| 903 | 968 | * bits can be lost, but they will be set again on the next | |
| 904 | /* | 969 | * force-quiescent-state pass. So lost bit sets do not result |
| 905 | * Alternatively, the CPU might be running in the kernel | 970 | * in incorrect behavior, merely in a grace period lasting |
| 906 | * for an extended period of time without a quiescent state. | 971 | * a few jiffies longer than it might otherwise. Because |
| 907 | * Attempt to force the CPU through the scheduler to gain the | 972 | * there are at most four threads involved, and because the |
| 908 | * needed quiescent state, but only if the grace period has gone | 973 | * updates are only once every few jiffies, the probability of |
| 909 | * on for an uncommonly long time. If there are many stuck CPUs, | 974 | * lossage (and thus of slight grace-period extension) is |
| 910 | * we will beat on the first one until it gets unstuck, then move | 975 | * quite low. |
| 911 | * to the next. Only do this for the primary flavor of RCU. | 976 | * |
| 977 | * Note that if the jiffies_till_sched_qs boot/sysfs parameter | ||
| 978 | * is set too high, we override with half of the RCU CPU stall | ||
| 979 | * warning delay. | ||
| 912 | */ | 980 | */ |
| 913 | if (rdp->rsp == rcu_state_p && | 981 | rcrmp = &per_cpu(rcu_sched_qs_mask, rdp->cpu); |
| 982 | if (ULONG_CMP_GE(jiffies, | ||
| 983 | rdp->rsp->gp_start + jiffies_till_sched_qs) || | ||
| 914 | ULONG_CMP_GE(jiffies, rdp->rsp->jiffies_resched)) { | 984 | ULONG_CMP_GE(jiffies, rdp->rsp->jiffies_resched)) { |
| 915 | rdp->rsp->jiffies_resched += 5; | 985 | if (!(ACCESS_ONCE(*rcrmp) & rdp->rsp->flavor_mask)) { |
| 916 | resched_cpu(rdp->cpu); | 986 | ACCESS_ONCE(rdp->cond_resched_completed) = |
| 987 | ACCESS_ONCE(rdp->mynode->completed); | ||
| 988 | smp_mb(); /* ->cond_resched_completed before *rcrmp. */ | ||
| 989 | ACCESS_ONCE(*rcrmp) = | ||
| 990 | ACCESS_ONCE(*rcrmp) + rdp->rsp->flavor_mask; | ||
| 991 | resched_cpu(rdp->cpu); /* Force CPU into scheduler. */ | ||
| 992 | rdp->rsp->jiffies_resched += 5; /* Enable beating. */ | ||
| 993 | } else if (ULONG_CMP_GE(jiffies, rdp->rsp->jiffies_resched)) { | ||
| 994 | /* Time to beat on that CPU again! */ | ||
| 995 | resched_cpu(rdp->cpu); /* Force CPU into scheduler. */ | ||
| 996 | rdp->rsp->jiffies_resched += 5; /* Re-enable beating. */ | ||
| 997 | } | ||
| 917 | } | 998 | } |
| 918 | 999 | ||
| 919 | return 0; | 1000 | return 0; |
| @@ -3491,6 +3572,7 @@ static void __init rcu_init_one(struct rcu_state *rsp, | |||
| 3491 | "rcu_node_fqs_1", | 3572 | "rcu_node_fqs_1", |
| 3492 | "rcu_node_fqs_2", | 3573 | "rcu_node_fqs_2", |
| 3493 | "rcu_node_fqs_3" }; /* Match MAX_RCU_LVLS */ | 3574 | "rcu_node_fqs_3" }; /* Match MAX_RCU_LVLS */ |
| 3575 | static u8 fl_mask = 0x1; | ||
| 3494 | int cpustride = 1; | 3576 | int cpustride = 1; |
| 3495 | int i; | 3577 | int i; |
| 3496 | int j; | 3578 | int j; |
| @@ -3509,6 +3591,8 @@ static void __init rcu_init_one(struct rcu_state *rsp, | |||
| 3509 | for (i = 1; i < rcu_num_lvls; i++) | 3591 | for (i = 1; i < rcu_num_lvls; i++) |
| 3510 | rsp->level[i] = rsp->level[i - 1] + rsp->levelcnt[i - 1]; | 3592 | rsp->level[i] = rsp->level[i - 1] + rsp->levelcnt[i - 1]; |
| 3511 | rcu_init_levelspread(rsp); | 3593 | rcu_init_levelspread(rsp); |
| 3594 | rsp->flavor_mask = fl_mask; | ||
| 3595 | fl_mask <<= 1; | ||
| 3512 | 3596 | ||
| 3513 | /* Initialize the elements themselves, starting from the leaves. */ | 3597 | /* Initialize the elements themselves, starting from the leaves. */ |
| 3514 | 3598 | ||
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index bf2c1e669691..0f69a79c5b7d 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h | |||
| @@ -307,6 +307,9 @@ struct rcu_data { | |||
| 307 | /* 4) reasons this CPU needed to be kicked by force_quiescent_state */ | 307 | /* 4) reasons this CPU needed to be kicked by force_quiescent_state */ |
| 308 | unsigned long dynticks_fqs; /* Kicked due to dynticks idle. */ | 308 | unsigned long dynticks_fqs; /* Kicked due to dynticks idle. */ |
| 309 | unsigned long offline_fqs; /* Kicked due to being offline. */ | 309 | unsigned long offline_fqs; /* Kicked due to being offline. */ |
| 310 | unsigned long cond_resched_completed; | ||
| 311 | /* Grace period that needs help */ | ||
| 312 | /* from cond_resched(). */ | ||
| 310 | 313 | ||
| 311 | /* 5) __rcu_pending() statistics. */ | 314 | /* 5) __rcu_pending() statistics. */ |
| 312 | unsigned long n_rcu_pending; /* rcu_pending() calls since boot. */ | 315 | unsigned long n_rcu_pending; /* rcu_pending() calls since boot. */ |
| @@ -392,6 +395,7 @@ struct rcu_state { | |||
| 392 | struct rcu_node *level[RCU_NUM_LVLS]; /* Hierarchy levels. */ | 395 | struct rcu_node *level[RCU_NUM_LVLS]; /* Hierarchy levels. */ |
| 393 | u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */ | 396 | u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */ |
| 394 | u8 levelspread[RCU_NUM_LVLS]; /* kids/node in each level. */ | 397 | u8 levelspread[RCU_NUM_LVLS]; /* kids/node in each level. */ |
| 398 | u8 flavor_mask; /* bit in flavor mask. */ | ||
| 395 | struct rcu_data __percpu *rda; /* pointer of percu rcu_data. */ | 399 | struct rcu_data __percpu *rda; /* pointer of percu rcu_data. */ |
| 396 | void (*call)(struct rcu_head *head, /* call_rcu() flavor. */ | 400 | void (*call)(struct rcu_head *head, /* call_rcu() flavor. */ |
| 397 | void (*func)(struct rcu_head *head)); | 401 | void (*func)(struct rcu_head *head)); |
| @@ -563,7 +567,7 @@ static bool rcu_nocb_need_deferred_wakeup(struct rcu_data *rdp); | |||
| 563 | static void do_nocb_deferred_wakeup(struct rcu_data *rdp); | 567 | static void do_nocb_deferred_wakeup(struct rcu_data *rdp); |
| 564 | static void rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp); | 568 | static void rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp); |
| 565 | static void rcu_spawn_nocb_kthreads(struct rcu_state *rsp); | 569 | static void rcu_spawn_nocb_kthreads(struct rcu_state *rsp); |
| 566 | static void rcu_kick_nohz_cpu(int cpu); | 570 | static void __maybe_unused rcu_kick_nohz_cpu(int cpu); |
| 567 | static bool init_nocb_callback_list(struct rcu_data *rdp); | 571 | static bool init_nocb_callback_list(struct rcu_data *rdp); |
| 568 | static void rcu_sysidle_enter(struct rcu_dynticks *rdtp, int irq); | 572 | static void rcu_sysidle_enter(struct rcu_dynticks *rdtp, int irq); |
| 569 | static void rcu_sysidle_exit(struct rcu_dynticks *rdtp, int irq); | 573 | static void rcu_sysidle_exit(struct rcu_dynticks *rdtp, int irq); |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index cbc2c45265e2..02ac0fb186b8 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
| @@ -2404,7 +2404,7 @@ static bool init_nocb_callback_list(struct rcu_data *rdp) | |||
| 2404 | * if an adaptive-ticks CPU is failing to respond to the current grace | 2404 | * if an adaptive-ticks CPU is failing to respond to the current grace |
| 2405 | * period and has not be idle from an RCU perspective, kick it. | 2405 | * period and has not be idle from an RCU perspective, kick it. |
| 2406 | */ | 2406 | */ |
| 2407 | static void rcu_kick_nohz_cpu(int cpu) | 2407 | static void __maybe_unused rcu_kick_nohz_cpu(int cpu) |
| 2408 | { | 2408 | { |
| 2409 | #ifdef CONFIG_NO_HZ_FULL | 2409 | #ifdef CONFIG_NO_HZ_FULL |
| 2410 | if (tick_nohz_full_cpu(cpu)) | 2410 | if (tick_nohz_full_cpu(cpu)) |
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c index a2aeb4df0f60..bc7883570530 100644 --- a/kernel/rcu/update.c +++ b/kernel/rcu/update.c | |||
| @@ -200,12 +200,12 @@ void wait_rcu_gp(call_rcu_func_t crf) | |||
| 200 | EXPORT_SYMBOL_GPL(wait_rcu_gp); | 200 | EXPORT_SYMBOL_GPL(wait_rcu_gp); |
| 201 | 201 | ||
| 202 | #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD | 202 | #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD |
| 203 | static inline void debug_init_rcu_head(struct rcu_head *head) | 203 | void init_rcu_head(struct rcu_head *head) |
| 204 | { | 204 | { |
| 205 | debug_object_init(head, &rcuhead_debug_descr); | 205 | debug_object_init(head, &rcuhead_debug_descr); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | static inline void debug_rcu_head_free(struct rcu_head *head) | 208 | void destroy_rcu_head(struct rcu_head *head) |
| 209 | { | 209 | { |
| 210 | debug_object_free(head, &rcuhead_debug_descr); | 210 | debug_object_free(head, &rcuhead_debug_descr); |
| 211 | } | 211 | } |
| @@ -350,21 +350,3 @@ static int __init check_cpu_stall_init(void) | |||
| 350 | early_initcall(check_cpu_stall_init); | 350 | early_initcall(check_cpu_stall_init); |
| 351 | 351 | ||
| 352 | #endif /* #ifdef CONFIG_RCU_STALL_COMMON */ | 352 | #endif /* #ifdef CONFIG_RCU_STALL_COMMON */ |
| 353 | |||
| 354 | /* | ||
| 355 | * Hooks for cond_resched() and friends to avoid RCU CPU stall warnings. | ||
| 356 | */ | ||
| 357 | |||
| 358 | DEFINE_PER_CPU(int, rcu_cond_resched_count); | ||
| 359 | |||
| 360 | /* | ||
| 361 | * Report a set of RCU quiescent states, for use by cond_resched() | ||
| 362 | * and friends. Out of line due to being called infrequently. | ||
| 363 | */ | ||
| 364 | void rcu_resched(void) | ||
| 365 | { | ||
| 366 | preempt_disable(); | ||
| 367 | __this_cpu_write(rcu_cond_resched_count, 0); | ||
| 368 | rcu_note_context_switch(smp_processor_id()); | ||
| 369 | preempt_enable(); | ||
| 370 | } | ||
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3bdf01b494fe..bc1638b33449 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -4147,7 +4147,6 @@ static void __cond_resched(void) | |||
| 4147 | 4147 | ||
| 4148 | int __sched _cond_resched(void) | 4148 | int __sched _cond_resched(void) |
| 4149 | { | 4149 | { |
| 4150 | rcu_cond_resched(); | ||
| 4151 | if (should_resched()) { | 4150 | if (should_resched()) { |
| 4152 | __cond_resched(); | 4151 | __cond_resched(); |
| 4153 | return 1; | 4152 | return 1; |
| @@ -4166,18 +4165,15 @@ EXPORT_SYMBOL(_cond_resched); | |||
| 4166 | */ | 4165 | */ |
| 4167 | int __cond_resched_lock(spinlock_t *lock) | 4166 | int __cond_resched_lock(spinlock_t *lock) |
| 4168 | { | 4167 | { |
| 4169 | bool need_rcu_resched = rcu_should_resched(); | ||
| 4170 | int resched = should_resched(); | 4168 | int resched = should_resched(); |
| 4171 | int ret = 0; | 4169 | int ret = 0; |
| 4172 | 4170 | ||
| 4173 | lockdep_assert_held(lock); | 4171 | lockdep_assert_held(lock); |
| 4174 | 4172 | ||
| 4175 | if (spin_needbreak(lock) || resched || need_rcu_resched) { | 4173 | if (spin_needbreak(lock) || resched) { |
| 4176 | spin_unlock(lock); | 4174 | spin_unlock(lock); |
| 4177 | if (resched) | 4175 | if (resched) |
| 4178 | __cond_resched(); | 4176 | __cond_resched(); |
| 4179 | else if (unlikely(need_rcu_resched)) | ||
| 4180 | rcu_resched(); | ||
| 4181 | else | 4177 | else |
| 4182 | cpu_relax(); | 4178 | cpu_relax(); |
| 4183 | ret = 1; | 4179 | ret = 1; |
| @@ -4191,7 +4187,6 @@ int __sched __cond_resched_softirq(void) | |||
| 4191 | { | 4187 | { |
| 4192 | BUG_ON(!in_softirq()); | 4188 | BUG_ON(!in_softirq()); |
| 4193 | 4189 | ||
| 4194 | rcu_cond_resched(); /* BH disabled OK, just recording QSes. */ | ||
| 4195 | if (should_resched()) { | 4190 | if (should_resched()) { |
| 4196 | local_bh_enable(); | 4191 | local_bh_enable(); |
| 4197 | __cond_resched(); | 4192 | __cond_resched(); |
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 695f9773bb60..627b3c34b821 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c | |||
| @@ -608,7 +608,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
| 608 | 608 | ||
| 609 | avg_atom = p->se.sum_exec_runtime; | 609 | avg_atom = p->se.sum_exec_runtime; |
| 610 | if (nr_switches) | 610 | if (nr_switches) |
| 611 | do_div(avg_atom, nr_switches); | 611 | avg_atom = div64_ul(avg_atom, nr_switches); |
| 612 | else | 612 | else |
| 613 | avg_atom = -1LL; | 613 | avg_atom = -1LL; |
| 614 | 614 | ||
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 88c9c65a430d..fe75444ae7ec 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
| @@ -585,9 +585,14 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, | |||
| 585 | struct itimerspec *new_setting, | 585 | struct itimerspec *new_setting, |
| 586 | struct itimerspec *old_setting) | 586 | struct itimerspec *old_setting) |
| 587 | { | 587 | { |
| 588 | ktime_t exp; | ||
| 589 | |||
| 588 | if (!rtcdev) | 590 | if (!rtcdev) |
| 589 | return -ENOTSUPP; | 591 | return -ENOTSUPP; |
| 590 | 592 | ||
| 593 | if (flags & ~TIMER_ABSTIME) | ||
| 594 | return -EINVAL; | ||
| 595 | |||
| 591 | if (old_setting) | 596 | if (old_setting) |
| 592 | alarm_timer_get(timr, old_setting); | 597 | alarm_timer_get(timr, old_setting); |
| 593 | 598 | ||
| @@ -597,8 +602,16 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, | |||
| 597 | 602 | ||
| 598 | /* start the timer */ | 603 | /* start the timer */ |
| 599 | timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval); | 604 | timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval); |
| 600 | alarm_start(&timr->it.alarm.alarmtimer, | 605 | exp = timespec_to_ktime(new_setting->it_value); |
| 601 | timespec_to_ktime(new_setting->it_value)); | 606 | /* Convert (if necessary) to absolute time */ |
| 607 | if (flags != TIMER_ABSTIME) { | ||
| 608 | ktime_t now; | ||
| 609 | |||
| 610 | now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime(); | ||
| 611 | exp = ktime_add(now, exp); | ||
| 612 | } | ||
| 613 | |||
| 614 | alarm_start(&timr->it.alarm.alarmtimer, exp); | ||
| 602 | return 0; | 615 | return 0; |
| 603 | } | 616 | } |
| 604 | 617 | ||
| @@ -730,6 +743,9 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags, | |||
| 730 | if (!alarmtimer_get_rtcdev()) | 743 | if (!alarmtimer_get_rtcdev()) |
| 731 | return -ENOTSUPP; | 744 | return -ENOTSUPP; |
| 732 | 745 | ||
| 746 | if (flags & ~TIMER_ABSTIME) | ||
| 747 | return -EINVAL; | ||
| 748 | |||
| 733 | if (!capable(CAP_WAKE_ALARM)) | 749 | if (!capable(CAP_WAKE_ALARM)) |
| 734 | return -EPERM; | 750 | return -EPERM; |
| 735 | 751 | ||
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 5b372e3ed675..ac9d1dad630b 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -265,12 +265,12 @@ static void update_ftrace_function(void) | |||
| 265 | func = ftrace_ops_list_func; | 265 | func = ftrace_ops_list_func; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | update_function_graph_func(); | ||
| 269 | |||
| 268 | /* If there's no change, then do nothing more here */ | 270 | /* If there's no change, then do nothing more here */ |
| 269 | if (ftrace_trace_function == func) | 271 | if (ftrace_trace_function == func) |
| 270 | return; | 272 | return; |
| 271 | 273 | ||
| 272 | update_function_graph_func(); | ||
| 273 | |||
| 274 | /* | 274 | /* |
| 275 | * If we are using the list function, it doesn't care | 275 | * If we are using the list function, it doesn't care |
| 276 | * about the function_trace_ops. | 276 | * about the function_trace_ops. |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 7c56c3d06943..ff7027199a9a 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
| @@ -616,10 +616,6 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, | |||
| 616 | struct ring_buffer_per_cpu *cpu_buffer; | 616 | struct ring_buffer_per_cpu *cpu_buffer; |
| 617 | struct rb_irq_work *work; | 617 | struct rb_irq_work *work; |
| 618 | 618 | ||
| 619 | if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) || | ||
| 620 | (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu))) | ||
| 621 | return POLLIN | POLLRDNORM; | ||
| 622 | |||
| 623 | if (cpu == RING_BUFFER_ALL_CPUS) | 619 | if (cpu == RING_BUFFER_ALL_CPUS) |
| 624 | work = &buffer->irq_work; | 620 | work = &buffer->irq_work; |
| 625 | else { | 621 | else { |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index f243444a3772..bda9621638cc 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -466,6 +466,12 @@ int __trace_puts(unsigned long ip, const char *str, int size) | |||
| 466 | struct print_entry *entry; | 466 | struct print_entry *entry; |
| 467 | unsigned long irq_flags; | 467 | unsigned long irq_flags; |
| 468 | int alloc; | 468 | int alloc; |
| 469 | int pc; | ||
| 470 | |||
| 471 | if (!(trace_flags & TRACE_ITER_PRINTK)) | ||
| 472 | return 0; | ||
| 473 | |||
| 474 | pc = preempt_count(); | ||
| 469 | 475 | ||
| 470 | if (unlikely(tracing_selftest_running || tracing_disabled)) | 476 | if (unlikely(tracing_selftest_running || tracing_disabled)) |
| 471 | return 0; | 477 | return 0; |
| @@ -475,7 +481,7 @@ int __trace_puts(unsigned long ip, const char *str, int size) | |||
| 475 | local_save_flags(irq_flags); | 481 | local_save_flags(irq_flags); |
| 476 | buffer = global_trace.trace_buffer.buffer; | 482 | buffer = global_trace.trace_buffer.buffer; |
| 477 | event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc, | 483 | event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc, |
| 478 | irq_flags, preempt_count()); | 484 | irq_flags, pc); |
| 479 | if (!event) | 485 | if (!event) |
| 480 | return 0; | 486 | return 0; |
| 481 | 487 | ||
| @@ -492,6 +498,7 @@ int __trace_puts(unsigned long ip, const char *str, int size) | |||
| 492 | entry->buf[size] = '\0'; | 498 | entry->buf[size] = '\0'; |
| 493 | 499 | ||
| 494 | __buffer_unlock_commit(buffer, event); | 500 | __buffer_unlock_commit(buffer, event); |
| 501 | ftrace_trace_stack(buffer, irq_flags, 4, pc); | ||
| 495 | 502 | ||
| 496 | return size; | 503 | return size; |
| 497 | } | 504 | } |
| @@ -509,6 +516,12 @@ int __trace_bputs(unsigned long ip, const char *str) | |||
| 509 | struct bputs_entry *entry; | 516 | struct bputs_entry *entry; |
| 510 | unsigned long irq_flags; | 517 | unsigned long irq_flags; |
| 511 | int size = sizeof(struct bputs_entry); | 518 | int size = sizeof(struct bputs_entry); |
| 519 | int pc; | ||
| 520 | |||
| 521 | if (!(trace_flags & TRACE_ITER_PRINTK)) | ||
| 522 | return 0; | ||
| 523 | |||
| 524 | pc = preempt_count(); | ||
| 512 | 525 | ||
| 513 | if (unlikely(tracing_selftest_running || tracing_disabled)) | 526 | if (unlikely(tracing_selftest_running || tracing_disabled)) |
| 514 | return 0; | 527 | return 0; |
| @@ -516,7 +529,7 @@ int __trace_bputs(unsigned long ip, const char *str) | |||
| 516 | local_save_flags(irq_flags); | 529 | local_save_flags(irq_flags); |
| 517 | buffer = global_trace.trace_buffer.buffer; | 530 | buffer = global_trace.trace_buffer.buffer; |
| 518 | event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size, | 531 | event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size, |
| 519 | irq_flags, preempt_count()); | 532 | irq_flags, pc); |
| 520 | if (!event) | 533 | if (!event) |
| 521 | return 0; | 534 | return 0; |
| 522 | 535 | ||
| @@ -525,6 +538,7 @@ int __trace_bputs(unsigned long ip, const char *str) | |||
| 525 | entry->str = str; | 538 | entry->str = str; |
| 526 | 539 | ||
| 527 | __buffer_unlock_commit(buffer, event); | 540 | __buffer_unlock_commit(buffer, event); |
| 541 | ftrace_trace_stack(buffer, irq_flags, 4, pc); | ||
| 528 | 542 | ||
| 529 | return 1; | 543 | return 1; |
| 530 | } | 544 | } |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index f99e0b3bca8c..2de53628689f 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
| @@ -470,6 +470,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file) | |||
| 470 | 470 | ||
| 471 | list_del(&file->list); | 471 | list_del(&file->list); |
| 472 | remove_subsystem(file->system); | 472 | remove_subsystem(file->system); |
| 473 | free_event_filter(file->filter); | ||
| 473 | kmem_cache_free(file_cachep, file); | 474 | kmem_cache_free(file_cachep, file); |
| 474 | } | 475 | } |
| 475 | 476 | ||
diff --git a/lib/cpumask.c b/lib/cpumask.c index c101230658eb..b6513a9f2892 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
| @@ -191,7 +191,7 @@ int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp) | |||
| 191 | 191 | ||
| 192 | i %= num_online_cpus(); | 192 | i %= num_online_cpus(); |
| 193 | 193 | ||
| 194 | if (!cpumask_of_node(numa_node)) { | 194 | if (numa_node == -1 || !cpumask_of_node(numa_node)) { |
| 195 | /* Use all online cpu's for non numa aware system */ | 195 | /* Use all online cpu's for non numa aware system */ |
| 196 | cpumask_copy(mask, cpu_online_mask); | 196 | cpumask_copy(mask, cpu_online_mask); |
| 197 | } else { | 197 | } else { |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index ad2ac3c00398..dd11f612e03e 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
| @@ -627,8 +627,6 @@ static void vlan_dev_uninit(struct net_device *dev) | |||
| 627 | struct vlan_dev_priv *vlan = vlan_dev_priv(dev); | 627 | struct vlan_dev_priv *vlan = vlan_dev_priv(dev); |
| 628 | int i; | 628 | int i; |
| 629 | 629 | ||
| 630 | free_percpu(vlan->vlan_pcpu_stats); | ||
| 631 | vlan->vlan_pcpu_stats = NULL; | ||
| 632 | for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) { | 630 | for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) { |
| 633 | while ((pm = vlan->egress_priority_map[i]) != NULL) { | 631 | while ((pm = vlan->egress_priority_map[i]) != NULL) { |
| 634 | vlan->egress_priority_map[i] = pm->next; | 632 | vlan->egress_priority_map[i] = pm->next; |
| @@ -785,6 +783,15 @@ static const struct net_device_ops vlan_netdev_ops = { | |||
| 785 | .ndo_get_lock_subclass = vlan_dev_get_lock_subclass, | 783 | .ndo_get_lock_subclass = vlan_dev_get_lock_subclass, |
| 786 | }; | 784 | }; |
| 787 | 785 | ||
| 786 | static void vlan_dev_free(struct net_device *dev) | ||
| 787 | { | ||
| 788 | struct vlan_dev_priv *vlan = vlan_dev_priv(dev); | ||
| 789 | |||
| 790 | free_percpu(vlan->vlan_pcpu_stats); | ||
| 791 | vlan->vlan_pcpu_stats = NULL; | ||
| 792 | free_netdev(dev); | ||
| 793 | } | ||
| 794 | |||
| 788 | void vlan_setup(struct net_device *dev) | 795 | void vlan_setup(struct net_device *dev) |
| 789 | { | 796 | { |
| 790 | ether_setup(dev); | 797 | ether_setup(dev); |
| @@ -794,7 +801,7 @@ void vlan_setup(struct net_device *dev) | |||
| 794 | dev->tx_queue_len = 0; | 801 | dev->tx_queue_len = 0; |
| 795 | 802 | ||
| 796 | dev->netdev_ops = &vlan_netdev_ops; | 803 | dev->netdev_ops = &vlan_netdev_ops; |
| 797 | dev->destructor = free_netdev; | 804 | dev->destructor = vlan_dev_free; |
| 798 | dev->ethtool_ops = &vlan_ethtool_ops; | 805 | dev->ethtool_ops = &vlan_ethtool_ops; |
| 799 | 806 | ||
| 800 | memset(dev->broadcast, 0, ETH_ALEN); | 807 | memset(dev->broadcast, 0, ETH_ALEN); |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 01a1082e02b3..bfcf6be1d665 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
| @@ -1489,8 +1489,6 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
| 1489 | goto drop; | 1489 | goto drop; |
| 1490 | 1490 | ||
| 1491 | /* Queue packet (standard) */ | 1491 | /* Queue packet (standard) */ |
| 1492 | skb->sk = sock; | ||
| 1493 | |||
| 1494 | if (sock_queue_rcv_skb(sock, skb) < 0) | 1492 | if (sock_queue_rcv_skb(sock, skb) < 0) |
| 1495 | goto drop; | 1493 | goto drop; |
| 1496 | 1494 | ||
| @@ -1644,7 +1642,6 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr | |||
| 1644 | if (!skb) | 1642 | if (!skb) |
| 1645 | goto out; | 1643 | goto out; |
| 1646 | 1644 | ||
| 1647 | skb->sk = sk; | ||
| 1648 | skb_reserve(skb, ddp_dl->header_length); | 1645 | skb_reserve(skb, ddp_dl->header_length); |
| 1649 | skb_reserve(skb, dev->hard_header_len); | 1646 | skb_reserve(skb, dev->hard_header_len); |
| 1650 | skb->dev = dev; | 1647 | skb->dev = dev; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index ca01d1861854..a7a27bc2c0b1 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
| @@ -289,10 +289,20 @@ static void hci_conn_timeout(struct work_struct *work) | |||
| 289 | { | 289 | { |
| 290 | struct hci_conn *conn = container_of(work, struct hci_conn, | 290 | struct hci_conn *conn = container_of(work, struct hci_conn, |
| 291 | disc_work.work); | 291 | disc_work.work); |
| 292 | int refcnt = atomic_read(&conn->refcnt); | ||
| 292 | 293 | ||
| 293 | BT_DBG("hcon %p state %s", conn, state_to_string(conn->state)); | 294 | BT_DBG("hcon %p state %s", conn, state_to_string(conn->state)); |
| 294 | 295 | ||
| 295 | if (atomic_read(&conn->refcnt)) | 296 | WARN_ON(refcnt < 0); |
| 297 | |||
| 298 | /* FIXME: It was observed that in pairing failed scenario, refcnt | ||
| 299 | * drops below 0. Probably this is because l2cap_conn_del calls | ||
| 300 | * l2cap_chan_del for each channel, and inside l2cap_chan_del conn is | ||
| 301 | * dropped. After that loop hci_chan_del is called which also drops | ||
| 302 | * conn. For now make sure that ACL is alive if refcnt is higher then 0, | ||
| 303 | * otherwise drop it. | ||
| 304 | */ | ||
| 305 | if (refcnt > 0) | ||
| 296 | return; | 306 | return; |
| 297 | 307 | ||
| 298 | switch (conn->state) { | 308 | switch (conn->state) { |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index f2829a7932e2..e33a982161c1 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
| @@ -385,6 +385,16 @@ static const u8 gen_method[5][5] = { | |||
| 385 | { CFM_PASSKEY, CFM_PASSKEY, REQ_PASSKEY, JUST_WORKS, OVERLAP }, | 385 | { CFM_PASSKEY, CFM_PASSKEY, REQ_PASSKEY, JUST_WORKS, OVERLAP }, |
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 388 | static u8 get_auth_method(struct smp_chan *smp, u8 local_io, u8 remote_io) | ||
| 389 | { | ||
| 390 | /* If either side has unknown io_caps, use JUST WORKS */ | ||
| 391 | if (local_io > SMP_IO_KEYBOARD_DISPLAY || | ||
| 392 | remote_io > SMP_IO_KEYBOARD_DISPLAY) | ||
| 393 | return JUST_WORKS; | ||
| 394 | |||
| 395 | return gen_method[remote_io][local_io]; | ||
| 396 | } | ||
| 397 | |||
| 388 | static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, | 398 | static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, |
| 389 | u8 local_io, u8 remote_io) | 399 | u8 local_io, u8 remote_io) |
| 390 | { | 400 | { |
| @@ -401,14 +411,11 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, | |||
| 401 | BT_DBG("tk_request: auth:%d lcl:%d rem:%d", auth, local_io, remote_io); | 411 | BT_DBG("tk_request: auth:%d lcl:%d rem:%d", auth, local_io, remote_io); |
| 402 | 412 | ||
| 403 | /* If neither side wants MITM, use JUST WORKS */ | 413 | /* If neither side wants MITM, use JUST WORKS */ |
| 404 | /* If either side has unknown io_caps, use JUST WORKS */ | ||
| 405 | /* Otherwise, look up method from the table */ | 414 | /* Otherwise, look up method from the table */ |
| 406 | if (!(auth & SMP_AUTH_MITM) || | 415 | if (!(auth & SMP_AUTH_MITM)) |
| 407 | local_io > SMP_IO_KEYBOARD_DISPLAY || | ||
| 408 | remote_io > SMP_IO_KEYBOARD_DISPLAY) | ||
| 409 | method = JUST_WORKS; | 416 | method = JUST_WORKS; |
| 410 | else | 417 | else |
| 411 | method = gen_method[remote_io][local_io]; | 418 | method = get_auth_method(smp, local_io, remote_io); |
| 412 | 419 | ||
| 413 | /* If not bonding, don't ask user to confirm a Zero TK */ | 420 | /* If not bonding, don't ask user to confirm a Zero TK */ |
| 414 | if (!(auth & SMP_AUTH_BONDING) && method == JUST_CFM) | 421 | if (!(auth & SMP_AUTH_BONDING) && method == JUST_CFM) |
| @@ -669,7 +676,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
| 669 | { | 676 | { |
| 670 | struct smp_cmd_pairing rsp, *req = (void *) skb->data; | 677 | struct smp_cmd_pairing rsp, *req = (void *) skb->data; |
| 671 | struct smp_chan *smp; | 678 | struct smp_chan *smp; |
| 672 | u8 key_size, auth; | 679 | u8 key_size, auth, sec_level; |
| 673 | int ret; | 680 | int ret; |
| 674 | 681 | ||
| 675 | BT_DBG("conn %p", conn); | 682 | BT_DBG("conn %p", conn); |
| @@ -695,7 +702,19 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
| 695 | /* We didn't start the pairing, so match remote */ | 702 | /* We didn't start the pairing, so match remote */ |
| 696 | auth = req->auth_req; | 703 | auth = req->auth_req; |
| 697 | 704 | ||
| 698 | conn->hcon->pending_sec_level = authreq_to_seclevel(auth); | 705 | sec_level = authreq_to_seclevel(auth); |
| 706 | if (sec_level > conn->hcon->pending_sec_level) | ||
| 707 | conn->hcon->pending_sec_level = sec_level; | ||
| 708 | |||
| 709 | /* If we need MITM check that it can be acheived */ | ||
| 710 | if (conn->hcon->pending_sec_level >= BT_SECURITY_HIGH) { | ||
| 711 | u8 method; | ||
| 712 | |||
| 713 | method = get_auth_method(smp, conn->hcon->io_capability, | ||
| 714 | req->io_capability); | ||
| 715 | if (method == JUST_WORKS || method == JUST_CFM) | ||
| 716 | return SMP_AUTH_REQUIREMENTS; | ||
| 717 | } | ||
| 699 | 718 | ||
| 700 | build_pairing_cmd(conn, req, &rsp, auth); | 719 | build_pairing_cmd(conn, req, &rsp, auth); |
| 701 | 720 | ||
| @@ -743,6 +762,16 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) | |||
| 743 | if (check_enc_key_size(conn, key_size)) | 762 | if (check_enc_key_size(conn, key_size)) |
| 744 | return SMP_ENC_KEY_SIZE; | 763 | return SMP_ENC_KEY_SIZE; |
| 745 | 764 | ||
| 765 | /* If we need MITM check that it can be acheived */ | ||
| 766 | if (conn->hcon->pending_sec_level >= BT_SECURITY_HIGH) { | ||
| 767 | u8 method; | ||
| 768 | |||
| 769 | method = get_auth_method(smp, req->io_capability, | ||
| 770 | rsp->io_capability); | ||
| 771 | if (method == JUST_WORKS || method == JUST_CFM) | ||
| 772 | return SMP_AUTH_REQUIREMENTS; | ||
| 773 | } | ||
| 774 | |||
| 746 | get_random_bytes(smp->prnd, sizeof(smp->prnd)); | 775 | get_random_bytes(smp->prnd, sizeof(smp->prnd)); |
| 747 | 776 | ||
| 748 | smp->prsp[0] = SMP_CMD_PAIRING_RSP; | 777 | smp->prsp[0] = SMP_CMD_PAIRING_RSP; |
| @@ -838,6 +867,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
| 838 | struct smp_cmd_pairing cp; | 867 | struct smp_cmd_pairing cp; |
| 839 | struct hci_conn *hcon = conn->hcon; | 868 | struct hci_conn *hcon = conn->hcon; |
| 840 | struct smp_chan *smp; | 869 | struct smp_chan *smp; |
| 870 | u8 sec_level; | ||
| 841 | 871 | ||
| 842 | BT_DBG("conn %p", conn); | 872 | BT_DBG("conn %p", conn); |
| 843 | 873 | ||
| @@ -847,7 +877,9 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
| 847 | if (!(conn->hcon->link_mode & HCI_LM_MASTER)) | 877 | if (!(conn->hcon->link_mode & HCI_LM_MASTER)) |
| 848 | return SMP_CMD_NOTSUPP; | 878 | return SMP_CMD_NOTSUPP; |
| 849 | 879 | ||
| 850 | hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req); | 880 | sec_level = authreq_to_seclevel(rp->auth_req); |
| 881 | if (sec_level > hcon->pending_sec_level) | ||
| 882 | hcon->pending_sec_level = sec_level; | ||
| 851 | 883 | ||
| 852 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) | 884 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) |
| 853 | return 0; | 885 | return 0; |
| @@ -901,9 +933,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
| 901 | if (smp_sufficient_security(hcon, sec_level)) | 933 | if (smp_sufficient_security(hcon, sec_level)) |
| 902 | return 1; | 934 | return 1; |
| 903 | 935 | ||
| 936 | if (sec_level > hcon->pending_sec_level) | ||
| 937 | hcon->pending_sec_level = sec_level; | ||
| 938 | |||
| 904 | if (hcon->link_mode & HCI_LM_MASTER) | 939 | if (hcon->link_mode & HCI_LM_MASTER) |
| 905 | if (smp_ltk_encrypt(conn, sec_level)) | 940 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) |
| 906 | goto done; | 941 | return 0; |
| 907 | 942 | ||
| 908 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) | 943 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) |
| 909 | return 0; | 944 | return 0; |
| @@ -918,7 +953,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
| 918 | * requires it. | 953 | * requires it. |
| 919 | */ | 954 | */ |
| 920 | if (hcon->io_capability != HCI_IO_NO_INPUT_OUTPUT || | 955 | if (hcon->io_capability != HCI_IO_NO_INPUT_OUTPUT || |
| 921 | sec_level > BT_SECURITY_MEDIUM) | 956 | hcon->pending_sec_level > BT_SECURITY_MEDIUM) |
| 922 | authreq |= SMP_AUTH_MITM; | 957 | authreq |= SMP_AUTH_MITM; |
| 923 | 958 | ||
| 924 | if (hcon->link_mode & HCI_LM_MASTER) { | 959 | if (hcon->link_mode & HCI_LM_MASTER) { |
| @@ -937,9 +972,6 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
| 937 | 972 | ||
| 938 | set_bit(SMP_FLAG_INITIATOR, &smp->flags); | 973 | set_bit(SMP_FLAG_INITIATOR, &smp->flags); |
| 939 | 974 | ||
| 940 | done: | ||
| 941 | hcon->pending_sec_level = sec_level; | ||
| 942 | |||
| 943 | return 0; | 975 | return 0; |
| 944 | } | 976 | } |
| 945 | 977 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 30eedf677913..7990984ca364 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -148,6 +148,9 @@ struct list_head ptype_all __read_mostly; /* Taps */ | |||
| 148 | static struct list_head offload_base __read_mostly; | 148 | static struct list_head offload_base __read_mostly; |
| 149 | 149 | ||
| 150 | static int netif_rx_internal(struct sk_buff *skb); | 150 | static int netif_rx_internal(struct sk_buff *skb); |
| 151 | static int call_netdevice_notifiers_info(unsigned long val, | ||
| 152 | struct net_device *dev, | ||
| 153 | struct netdev_notifier_info *info); | ||
| 151 | 154 | ||
| 152 | /* | 155 | /* |
| 153 | * The @dev_base_head list is protected by @dev_base_lock and the rtnl | 156 | * The @dev_base_head list is protected by @dev_base_lock and the rtnl |
| @@ -1207,7 +1210,11 @@ EXPORT_SYMBOL(netdev_features_change); | |||
| 1207 | void netdev_state_change(struct net_device *dev) | 1210 | void netdev_state_change(struct net_device *dev) |
| 1208 | { | 1211 | { |
| 1209 | if (dev->flags & IFF_UP) { | 1212 | if (dev->flags & IFF_UP) { |
| 1210 | call_netdevice_notifiers(NETDEV_CHANGE, dev); | 1213 | struct netdev_notifier_change_info change_info; |
| 1214 | |||
| 1215 | change_info.flags_changed = 0; | ||
| 1216 | call_netdevice_notifiers_info(NETDEV_CHANGE, dev, | ||
| 1217 | &change_info.info); | ||
| 1211 | rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL); | 1218 | rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL); |
| 1212 | } | 1219 | } |
| 1213 | } | 1220 | } |
| @@ -4227,9 +4234,8 @@ static int process_backlog(struct napi_struct *napi, int quota) | |||
| 4227 | #endif | 4234 | #endif |
| 4228 | napi->weight = weight_p; | 4235 | napi->weight = weight_p; |
| 4229 | local_irq_disable(); | 4236 | local_irq_disable(); |
| 4230 | while (work < quota) { | 4237 | while (1) { |
| 4231 | struct sk_buff *skb; | 4238 | struct sk_buff *skb; |
| 4232 | unsigned int qlen; | ||
| 4233 | 4239 | ||
| 4234 | while ((skb = __skb_dequeue(&sd->process_queue))) { | 4240 | while ((skb = __skb_dequeue(&sd->process_queue))) { |
| 4235 | local_irq_enable(); | 4241 | local_irq_enable(); |
| @@ -4243,24 +4249,24 @@ static int process_backlog(struct napi_struct *napi, int quota) | |||
| 4243 | } | 4249 | } |
| 4244 | 4250 | ||
| 4245 | rps_lock(sd); | 4251 | rps_lock(sd); |
| 4246 | qlen = skb_queue_len(&sd->input_pkt_queue); | 4252 | if (skb_queue_empty(&sd->input_pkt_queue)) { |
| 4247 | if (qlen) | ||
| 4248 | skb_queue_splice_tail_init(&sd->input_pkt_queue, | ||
| 4249 | &sd->process_queue); | ||
| 4250 | |||
| 4251 | if (qlen < quota - work) { | ||
| 4252 | /* | 4253 | /* |
| 4253 | * Inline a custom version of __napi_complete(). | 4254 | * Inline a custom version of __napi_complete(). |
| 4254 | * only current cpu owns and manipulates this napi, | 4255 | * only current cpu owns and manipulates this napi, |
| 4255 | * and NAPI_STATE_SCHED is the only possible flag set on backlog. | 4256 | * and NAPI_STATE_SCHED is the only possible flag set |
| 4256 | * we can use a plain write instead of clear_bit(), | 4257 | * on backlog. |
| 4258 | * We can use a plain write instead of clear_bit(), | ||
| 4257 | * and we dont need an smp_mb() memory barrier. | 4259 | * and we dont need an smp_mb() memory barrier. |
| 4258 | */ | 4260 | */ |
| 4259 | list_del(&napi->poll_list); | 4261 | list_del(&napi->poll_list); |
| 4260 | napi->state = 0; | 4262 | napi->state = 0; |
| 4263 | rps_unlock(sd); | ||
| 4261 | 4264 | ||
| 4262 | quota = work + qlen; | 4265 | break; |
| 4263 | } | 4266 | } |
| 4267 | |||
| 4268 | skb_queue_splice_tail_init(&sd->input_pkt_queue, | ||
| 4269 | &sd->process_queue); | ||
| 4264 | rps_unlock(sd); | 4270 | rps_unlock(sd); |
| 4265 | } | 4271 | } |
| 4266 | local_irq_enable(); | 4272 | local_irq_enable(); |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 32d872eec7f5..559890b0f0a2 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
| @@ -3059,11 +3059,12 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | |||
| 3059 | memset(&t->neigh_vars[NEIGH_VAR_GC_INTERVAL], 0, | 3059 | memset(&t->neigh_vars[NEIGH_VAR_GC_INTERVAL], 0, |
| 3060 | sizeof(t->neigh_vars[NEIGH_VAR_GC_INTERVAL])); | 3060 | sizeof(t->neigh_vars[NEIGH_VAR_GC_INTERVAL])); |
| 3061 | } else { | 3061 | } else { |
| 3062 | struct neigh_table *tbl = p->tbl; | ||
| 3062 | dev_name_source = "default"; | 3063 | dev_name_source = "default"; |
| 3063 | t->neigh_vars[NEIGH_VAR_GC_INTERVAL].data = (int *)(p + 1); | 3064 | t->neigh_vars[NEIGH_VAR_GC_INTERVAL].data = &tbl->gc_interval; |
| 3064 | t->neigh_vars[NEIGH_VAR_GC_THRESH1].data = (int *)(p + 1) + 1; | 3065 | t->neigh_vars[NEIGH_VAR_GC_THRESH1].data = &tbl->gc_thresh1; |
| 3065 | t->neigh_vars[NEIGH_VAR_GC_THRESH2].data = (int *)(p + 1) + 2; | 3066 | t->neigh_vars[NEIGH_VAR_GC_THRESH2].data = &tbl->gc_thresh2; |
| 3066 | t->neigh_vars[NEIGH_VAR_GC_THRESH3].data = (int *)(p + 1) + 3; | 3067 | t->neigh_vars[NEIGH_VAR_GC_THRESH3].data = &tbl->gc_thresh3; |
| 3067 | } | 3068 | } |
| 3068 | 3069 | ||
| 3069 | if (handler) { | 3070 | if (handler) { |
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c index 4e9619bca732..0485bf7f8f03 100644 --- a/net/ipv4/gre_demux.c +++ b/net/ipv4/gre_demux.c | |||
| @@ -68,6 +68,7 @@ void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, | |||
| 68 | 68 | ||
| 69 | skb_push(skb, hdr_len); | 69 | skb_push(skb, hdr_len); |
| 70 | 70 | ||
| 71 | skb_reset_transport_header(skb); | ||
| 71 | greh = (struct gre_base_hdr *)skb->data; | 72 | greh = (struct gre_base_hdr *)skb->data; |
| 72 | greh->flags = tnl_flags_to_gre_flags(tpi->flags); | 73 | greh->flags = tnl_flags_to_gre_flags(tpi->flags); |
| 73 | greh->protocol = tpi->proto; | 74 | greh->protocol = tpi->proto; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 79c3d947a481..42b7bcf8045b 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
| @@ -739,8 +739,6 @@ static void icmp_unreach(struct sk_buff *skb) | |||
| 739 | /* fall through */ | 739 | /* fall through */ |
| 740 | case 0: | 740 | case 0: |
| 741 | info = ntohs(icmph->un.frag.mtu); | 741 | info = ntohs(icmph->un.frag.mtu); |
| 742 | if (!info) | ||
| 743 | goto out; | ||
| 744 | } | 742 | } |
| 745 | break; | 743 | break; |
| 746 | case ICMP_SR_FAILED: | 744 | case ICMP_SR_FAILED: |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 6748d420f714..db710b059bab 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
| @@ -1944,6 +1944,10 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr) | |||
| 1944 | 1944 | ||
| 1945 | rtnl_lock(); | 1945 | rtnl_lock(); |
| 1946 | in_dev = ip_mc_find_dev(net, imr); | 1946 | in_dev = ip_mc_find_dev(net, imr); |
| 1947 | if (!in_dev) { | ||
| 1948 | ret = -ENODEV; | ||
| 1949 | goto out; | ||
| 1950 | } | ||
| 1947 | ifindex = imr->imr_ifindex; | 1951 | ifindex = imr->imr_ifindex; |
| 1948 | for (imlp = &inet->mc_list; | 1952 | for (imlp = &inet->mc_list; |
| 1949 | (iml = rtnl_dereference(*imlp)) != NULL; | 1953 | (iml = rtnl_dereference(*imlp)) != NULL; |
| @@ -1961,16 +1965,14 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr) | |||
| 1961 | 1965 | ||
| 1962 | *imlp = iml->next_rcu; | 1966 | *imlp = iml->next_rcu; |
| 1963 | 1967 | ||
| 1964 | if (in_dev) | 1968 | ip_mc_dec_group(in_dev, group); |
| 1965 | ip_mc_dec_group(in_dev, group); | ||
| 1966 | rtnl_unlock(); | 1969 | rtnl_unlock(); |
| 1967 | /* decrease mem now to avoid the memleak warning */ | 1970 | /* decrease mem now to avoid the memleak warning */ |
| 1968 | atomic_sub(sizeof(*iml), &sk->sk_omem_alloc); | 1971 | atomic_sub(sizeof(*iml), &sk->sk_omem_alloc); |
| 1969 | kfree_rcu(iml, rcu); | 1972 | kfree_rcu(iml, rcu); |
| 1970 | return 0; | 1973 | return 0; |
| 1971 | } | 1974 | } |
| 1972 | if (!in_dev) | 1975 | out: |
| 1973 | ret = -ENODEV; | ||
| 1974 | rtnl_unlock(); | 1976 | rtnl_unlock(); |
| 1975 | return ret; | 1977 | return ret; |
| 1976 | } | 1978 | } |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 54b6731dab55..6f9de61dce5f 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
| @@ -169,6 +169,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, | |||
| 169 | 169 | ||
| 170 | hlist_for_each_entry_rcu(t, head, hash_node) { | 170 | hlist_for_each_entry_rcu(t, head, hash_node) { |
| 171 | if (remote != t->parms.iph.daddr || | 171 | if (remote != t->parms.iph.daddr || |
| 172 | t->parms.iph.saddr != 0 || | ||
| 172 | !(t->dev->flags & IFF_UP)) | 173 | !(t->dev->flags & IFF_UP)) |
| 173 | continue; | 174 | continue; |
| 174 | 175 | ||
| @@ -185,10 +186,11 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, | |||
| 185 | head = &itn->tunnels[hash]; | 186 | head = &itn->tunnels[hash]; |
| 186 | 187 | ||
| 187 | hlist_for_each_entry_rcu(t, head, hash_node) { | 188 | hlist_for_each_entry_rcu(t, head, hash_node) { |
| 188 | if ((local != t->parms.iph.saddr && | 189 | if ((local != t->parms.iph.saddr || t->parms.iph.daddr != 0) && |
| 189 | (local != t->parms.iph.daddr || | 190 | (local != t->parms.iph.daddr || !ipv4_is_multicast(local))) |
| 190 | !ipv4_is_multicast(local))) || | 191 | continue; |
| 191 | !(t->dev->flags & IFF_UP)) | 192 | |
| 193 | if (!(t->dev->flags & IFF_UP)) | ||
| 192 | continue; | 194 | continue; |
| 193 | 195 | ||
| 194 | if (!ip_tunnel_key_match(&t->parms, flags, key)) | 196 | if (!ip_tunnel_key_match(&t->parms, flags, key)) |
| @@ -205,6 +207,8 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, | |||
| 205 | 207 | ||
| 206 | hlist_for_each_entry_rcu(t, head, hash_node) { | 208 | hlist_for_each_entry_rcu(t, head, hash_node) { |
| 207 | if (t->parms.i_key != key || | 209 | if (t->parms.i_key != key || |
| 210 | t->parms.iph.saddr != 0 || | ||
| 211 | t->parms.iph.daddr != 0 || | ||
| 208 | !(t->dev->flags & IFF_UP)) | 212 | !(t->dev->flags & IFF_UP)) |
| 209 | continue; | 213 | continue; |
| 210 | 214 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 082239ffe34a..3162ea923ded 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -1010,7 +1010,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | |||
| 1010 | const struct iphdr *iph = (const struct iphdr *) skb->data; | 1010 | const struct iphdr *iph = (const struct iphdr *) skb->data; |
| 1011 | struct flowi4 fl4; | 1011 | struct flowi4 fl4; |
| 1012 | struct rtable *rt; | 1012 | struct rtable *rt; |
| 1013 | struct dst_entry *dst; | 1013 | struct dst_entry *odst = NULL; |
| 1014 | bool new = false; | 1014 | bool new = false; |
| 1015 | 1015 | ||
| 1016 | bh_lock_sock(sk); | 1016 | bh_lock_sock(sk); |
| @@ -1018,16 +1018,17 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | |||
| 1018 | if (!ip_sk_accept_pmtu(sk)) | 1018 | if (!ip_sk_accept_pmtu(sk)) |
| 1019 | goto out; | 1019 | goto out; |
| 1020 | 1020 | ||
| 1021 | rt = (struct rtable *) __sk_dst_get(sk); | 1021 | odst = sk_dst_get(sk); |
| 1022 | 1022 | ||
| 1023 | if (sock_owned_by_user(sk) || !rt) { | 1023 | if (sock_owned_by_user(sk) || !odst) { |
| 1024 | __ipv4_sk_update_pmtu(skb, sk, mtu); | 1024 | __ipv4_sk_update_pmtu(skb, sk, mtu); |
| 1025 | goto out; | 1025 | goto out; |
| 1026 | } | 1026 | } |
| 1027 | 1027 | ||
| 1028 | __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); | 1028 | __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); |
| 1029 | 1029 | ||
| 1030 | if (!__sk_dst_check(sk, 0)) { | 1030 | rt = (struct rtable *)odst; |
| 1031 | if (odst->obsolete && odst->ops->check(odst, 0) == NULL) { | ||
| 1031 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); | 1032 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); |
| 1032 | if (IS_ERR(rt)) | 1033 | if (IS_ERR(rt)) |
| 1033 | goto out; | 1034 | goto out; |
| @@ -1037,8 +1038,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | |||
| 1037 | 1038 | ||
| 1038 | __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu); | 1039 | __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu); |
| 1039 | 1040 | ||
| 1040 | dst = dst_check(&rt->dst, 0); | 1041 | if (!dst_check(&rt->dst, 0)) { |
| 1041 | if (!dst) { | ||
| 1042 | if (new) | 1042 | if (new) |
| 1043 | dst_release(&rt->dst); | 1043 | dst_release(&rt->dst); |
| 1044 | 1044 | ||
| @@ -1050,10 +1050,11 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | |||
| 1050 | } | 1050 | } |
| 1051 | 1051 | ||
| 1052 | if (new) | 1052 | if (new) |
| 1053 | __sk_dst_set(sk, &rt->dst); | 1053 | sk_dst_set(sk, &rt->dst); |
| 1054 | 1054 | ||
| 1055 | out: | 1055 | out: |
| 1056 | bh_unlock_sock(sk); | 1056 | bh_unlock_sock(sk); |
| 1057 | dst_release(odst); | ||
| 1057 | } | 1058 | } |
| 1058 | EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); | 1059 | EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); |
| 1059 | 1060 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index eb1dde37e678..9d2118e5fbc7 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -1108,7 +1108,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 1108 | if (unlikely(tp->repair)) { | 1108 | if (unlikely(tp->repair)) { |
| 1109 | if (tp->repair_queue == TCP_RECV_QUEUE) { | 1109 | if (tp->repair_queue == TCP_RECV_QUEUE) { |
| 1110 | copied = tcp_send_rcvq(sk, msg, size); | 1110 | copied = tcp_send_rcvq(sk, msg, size); |
| 1111 | goto out; | 1111 | goto out_nopush; |
| 1112 | } | 1112 | } |
| 1113 | 1113 | ||
| 1114 | err = -EINVAL; | 1114 | err = -EINVAL; |
| @@ -1282,6 +1282,7 @@ wait_for_memory: | |||
| 1282 | out: | 1282 | out: |
| 1283 | if (copied) | 1283 | if (copied) |
| 1284 | tcp_push(sk, flags, mss_now, tp->nonagle, size_goal); | 1284 | tcp_push(sk, flags, mss_now, tp->nonagle, size_goal); |
| 1285 | out_nopush: | ||
| 1285 | release_sock(sk); | 1286 | release_sock(sk); |
| 1286 | return copied + copied_syn; | 1287 | return copied + copied_syn; |
| 1287 | 1288 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index b5c23756965a..40639c288dc2 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -1106,7 +1106,7 @@ static bool tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb, | |||
| 1106 | } | 1106 | } |
| 1107 | 1107 | ||
| 1108 | /* D-SACK for already forgotten data... Do dumb counting. */ | 1108 | /* D-SACK for already forgotten data... Do dumb counting. */ |
| 1109 | if (dup_sack && tp->undo_marker && tp->undo_retrans && | 1109 | if (dup_sack && tp->undo_marker && tp->undo_retrans > 0 && |
| 1110 | !after(end_seq_0, prior_snd_una) && | 1110 | !after(end_seq_0, prior_snd_una) && |
| 1111 | after(end_seq_0, tp->undo_marker)) | 1111 | after(end_seq_0, tp->undo_marker)) |
| 1112 | tp->undo_retrans--; | 1112 | tp->undo_retrans--; |
| @@ -1187,7 +1187,7 @@ static u8 tcp_sacktag_one(struct sock *sk, | |||
| 1187 | 1187 | ||
| 1188 | /* Account D-SACK for retransmitted packet. */ | 1188 | /* Account D-SACK for retransmitted packet. */ |
| 1189 | if (dup_sack && (sacked & TCPCB_RETRANS)) { | 1189 | if (dup_sack && (sacked & TCPCB_RETRANS)) { |
| 1190 | if (tp->undo_marker && tp->undo_retrans && | 1190 | if (tp->undo_marker && tp->undo_retrans > 0 && |
| 1191 | after(end_seq, tp->undo_marker)) | 1191 | after(end_seq, tp->undo_marker)) |
| 1192 | tp->undo_retrans--; | 1192 | tp->undo_retrans--; |
| 1193 | if (sacked & TCPCB_SACKED_ACKED) | 1193 | if (sacked & TCPCB_SACKED_ACKED) |
| @@ -1893,7 +1893,7 @@ static void tcp_clear_retrans_partial(struct tcp_sock *tp) | |||
| 1893 | tp->lost_out = 0; | 1893 | tp->lost_out = 0; |
| 1894 | 1894 | ||
| 1895 | tp->undo_marker = 0; | 1895 | tp->undo_marker = 0; |
| 1896 | tp->undo_retrans = 0; | 1896 | tp->undo_retrans = -1; |
| 1897 | } | 1897 | } |
| 1898 | 1898 | ||
| 1899 | void tcp_clear_retrans(struct tcp_sock *tp) | 1899 | void tcp_clear_retrans(struct tcp_sock *tp) |
| @@ -2665,7 +2665,7 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack) | |||
| 2665 | 2665 | ||
| 2666 | tp->prior_ssthresh = 0; | 2666 | tp->prior_ssthresh = 0; |
| 2667 | tp->undo_marker = tp->snd_una; | 2667 | tp->undo_marker = tp->snd_una; |
| 2668 | tp->undo_retrans = tp->retrans_out; | 2668 | tp->undo_retrans = tp->retrans_out ? : -1; |
| 2669 | 2669 | ||
| 2670 | if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) { | 2670 | if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) { |
| 2671 | if (!ece_ack) | 2671 | if (!ece_ack) |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index d92bce0ea24e..179b51e6bda3 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -2525,8 +2525,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
| 2525 | if (!tp->retrans_stamp) | 2525 | if (!tp->retrans_stamp) |
| 2526 | tp->retrans_stamp = TCP_SKB_CB(skb)->when; | 2526 | tp->retrans_stamp = TCP_SKB_CB(skb)->when; |
| 2527 | 2527 | ||
| 2528 | tp->undo_retrans += tcp_skb_pcount(skb); | ||
| 2529 | |||
| 2530 | /* snd_nxt is stored to detect loss of retransmitted segment, | 2528 | /* snd_nxt is stored to detect loss of retransmitted segment, |
| 2531 | * see tcp_input.c tcp_sacktag_write_queue(). | 2529 | * see tcp_input.c tcp_sacktag_write_queue(). |
| 2532 | */ | 2530 | */ |
| @@ -2534,6 +2532,10 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
| 2534 | } else if (err != -EBUSY) { | 2532 | } else if (err != -EBUSY) { |
| 2535 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL); | 2533 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL); |
| 2536 | } | 2534 | } |
| 2535 | |||
| 2536 | if (tp->undo_retrans < 0) | ||
| 2537 | tp->undo_retrans = 0; | ||
| 2538 | tp->undo_retrans += tcp_skb_pcount(skb); | ||
| 2537 | return err; | 2539 | return err; |
| 2538 | } | 2540 | } |
| 2539 | 2541 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index d92f94b7e402..7d5a8661df76 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -1588,8 +1588,11 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
| 1588 | goto csum_error; | 1588 | goto csum_error; |
| 1589 | 1589 | ||
| 1590 | 1590 | ||
| 1591 | if (sk_rcvqueues_full(sk, skb, sk->sk_rcvbuf)) | 1591 | if (sk_rcvqueues_full(sk, skb, sk->sk_rcvbuf)) { |
| 1592 | UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, | ||
| 1593 | is_udplite); | ||
| 1592 | goto drop; | 1594 | goto drop; |
| 1595 | } | ||
| 1593 | 1596 | ||
| 1594 | rc = 0; | 1597 | rc = 0; |
| 1595 | 1598 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 08b367c6b9cf..617f0958e164 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
| @@ -1301,8 +1301,17 @@ int igmp6_event_query(struct sk_buff *skb) | |||
| 1301 | len = ntohs(ipv6_hdr(skb)->payload_len) + sizeof(struct ipv6hdr); | 1301 | len = ntohs(ipv6_hdr(skb)->payload_len) + sizeof(struct ipv6hdr); |
| 1302 | len -= skb_network_header_len(skb); | 1302 | len -= skb_network_header_len(skb); |
| 1303 | 1303 | ||
| 1304 | /* Drop queries with not link local source */ | 1304 | /* RFC3810 6.2 |
| 1305 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) | 1305 | * Upon reception of an MLD message that contains a Query, the node |
| 1306 | * checks if the source address of the message is a valid link-local | ||
| 1307 | * address, if the Hop Limit is set to 1, and if the Router Alert | ||
| 1308 | * option is present in the Hop-By-Hop Options header of the IPv6 | ||
| 1309 | * packet. If any of these checks fails, the packet is dropped. | ||
| 1310 | */ | ||
| 1311 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL) || | ||
| 1312 | ipv6_hdr(skb)->hop_limit != 1 || | ||
| 1313 | !(IP6CB(skb)->flags & IP6SKB_ROUTERALERT) || | ||
| 1314 | IP6CB(skb)->ra != htons(IPV6_OPT_ROUTERALERT_MLD)) | ||
| 1306 | return -EINVAL; | 1315 | return -EINVAL; |
| 1307 | 1316 | ||
| 1308 | idev = __in6_dev_get(skb->dev); | 1317 | idev = __in6_dev_get(skb->dev); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 95c834799288..7092ff78fd84 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -674,8 +674,11 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
| 674 | goto csum_error; | 674 | goto csum_error; |
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | if (sk_rcvqueues_full(sk, skb, sk->sk_rcvbuf)) | 677 | if (sk_rcvqueues_full(sk, skb, sk->sk_rcvbuf)) { |
| 678 | UDP6_INC_STATS_BH(sock_net(sk), | ||
| 679 | UDP_MIB_RCVBUFERRORS, is_udplite); | ||
| 678 | goto drop; | 680 | goto drop; |
| 681 | } | ||
| 679 | 682 | ||
| 680 | skb_dst_drop(skb); | 683 | skb_dst_drop(skb); |
| 681 | 684 | ||
| @@ -690,6 +693,7 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
| 690 | bh_unlock_sock(sk); | 693 | bh_unlock_sock(sk); |
| 691 | 694 | ||
| 692 | return rc; | 695 | return rc; |
| 696 | |||
| 693 | csum_error: | 697 | csum_error: |
| 694 | UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); | 698 | UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); |
| 695 | drop: | 699 | drop: |
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 950909f04ee6..13752d96275e 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
| @@ -1365,7 +1365,7 @@ static int pppol2tp_setsockopt(struct socket *sock, int level, int optname, | |||
| 1365 | int err; | 1365 | int err; |
| 1366 | 1366 | ||
| 1367 | if (level != SOL_PPPOL2TP) | 1367 | if (level != SOL_PPPOL2TP) |
| 1368 | return udp_prot.setsockopt(sk, level, optname, optval, optlen); | 1368 | return -EINVAL; |
| 1369 | 1369 | ||
| 1370 | if (optlen < sizeof(int)) | 1370 | if (optlen < sizeof(int)) |
| 1371 | return -EINVAL; | 1371 | return -EINVAL; |
| @@ -1491,7 +1491,7 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, int optname, | |||
| 1491 | struct pppol2tp_session *ps; | 1491 | struct pppol2tp_session *ps; |
| 1492 | 1492 | ||
| 1493 | if (level != SOL_PPPOL2TP) | 1493 | if (level != SOL_PPPOL2TP) |
| 1494 | return udp_prot.getsockopt(sk, level, optname, optval, optlen); | 1494 | return -EINVAL; |
| 1495 | 1495 | ||
| 1496 | if (get_user(len, optlen)) | 1496 | if (get_user(len, optlen)) |
| 1497 | return -EFAULT; | 1497 | return -EFAULT; |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 6886601afe1c..a6cda52ed920 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
| @@ -1096,11 +1096,12 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | |||
| 1096 | int err; | 1096 | int err; |
| 1097 | 1097 | ||
| 1098 | /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ | 1098 | /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ |
| 1099 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24 + 6 + extra_len); | 1099 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + |
| 1100 | 24 + 6 + extra_len + IEEE80211_WEP_ICV_LEN); | ||
| 1100 | if (!skb) | 1101 | if (!skb) |
| 1101 | return; | 1102 | return; |
| 1102 | 1103 | ||
| 1103 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1104 | skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); |
| 1104 | 1105 | ||
| 1105 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); | 1106 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); |
| 1106 | memset(mgmt, 0, 24 + 6); | 1107 | memset(mgmt, 0, 24 + 6); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 15c731f03fa6..e6fac7e3db52 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -636,7 +636,7 @@ static unsigned int netlink_poll(struct file *file, struct socket *sock, | |||
| 636 | while (nlk->cb_running && netlink_dump_space(nlk)) { | 636 | while (nlk->cb_running && netlink_dump_space(nlk)) { |
| 637 | err = netlink_dump(sk); | 637 | err = netlink_dump(sk); |
| 638 | if (err < 0) { | 638 | if (err < 0) { |
| 639 | sk->sk_err = err; | 639 | sk->sk_err = -err; |
| 640 | sk->sk_error_report(sk); | 640 | sk->sk_error_report(sk); |
| 641 | break; | 641 | break; |
| 642 | } | 642 | } |
| @@ -2483,7 +2483,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 2483 | atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) { | 2483 | atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) { |
| 2484 | ret = netlink_dump(sk); | 2484 | ret = netlink_dump(sk); |
| 2485 | if (ret) { | 2485 | if (ret) { |
| 2486 | sk->sk_err = ret; | 2486 | sk->sk_err = -ret; |
| 2487 | sk->sk_error_report(sk); | 2487 | sk->sk_error_report(sk); |
| 2488 | } | 2488 | } |
| 2489 | } | 2489 | } |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index c36856a457ca..e70d8b18e962 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
| @@ -551,6 +551,8 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
| 551 | 551 | ||
| 552 | case OVS_ACTION_ATTR_SAMPLE: | 552 | case OVS_ACTION_ATTR_SAMPLE: |
| 553 | err = sample(dp, skb, a); | 553 | err = sample(dp, skb, a); |
| 554 | if (unlikely(err)) /* skb already freed. */ | ||
| 555 | return err; | ||
| 554 | break; | 556 | break; |
| 555 | } | 557 | } |
| 556 | 558 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 0d407bca81e3..9db4bf6740d1 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2007-2013 Nicira, Inc. | 2 | * Copyright (c) 2007-2014 Nicira, Inc. |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of version 2 of the GNU General Public | 5 | * modify it under the terms of version 2 of the GNU General Public |
| @@ -276,7 +276,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb) | |||
| 276 | OVS_CB(skb)->flow = flow; | 276 | OVS_CB(skb)->flow = flow; |
| 277 | OVS_CB(skb)->pkt_key = &key; | 277 | OVS_CB(skb)->pkt_key = &key; |
| 278 | 278 | ||
| 279 | ovs_flow_stats_update(OVS_CB(skb)->flow, skb); | 279 | ovs_flow_stats_update(OVS_CB(skb)->flow, key.tp.flags, skb); |
| 280 | ovs_execute_actions(dp, skb); | 280 | ovs_execute_actions(dp, skb); |
| 281 | stats_counter = &stats->n_hit; | 281 | stats_counter = &stats->n_hit; |
| 282 | 282 | ||
| @@ -889,8 +889,11 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info) | |||
| 889 | } | 889 | } |
| 890 | /* The unmasked key has to be the same for flow updates. */ | 890 | /* The unmasked key has to be the same for flow updates. */ |
| 891 | if (unlikely(!ovs_flow_cmp_unmasked_key(flow, &match))) { | 891 | if (unlikely(!ovs_flow_cmp_unmasked_key(flow, &match))) { |
| 892 | error = -EEXIST; | 892 | flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); |
| 893 | goto err_unlock_ovs; | 893 | if (!flow) { |
| 894 | error = -ENOENT; | ||
| 895 | goto err_unlock_ovs; | ||
| 896 | } | ||
| 894 | } | 897 | } |
| 895 | /* Update actions. */ | 898 | /* Update actions. */ |
| 896 | old_acts = ovsl_dereference(flow->sf_acts); | 899 | old_acts = ovsl_dereference(flow->sf_acts); |
| @@ -981,16 +984,12 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info) | |||
| 981 | goto err_unlock_ovs; | 984 | goto err_unlock_ovs; |
| 982 | } | 985 | } |
| 983 | /* Check that the flow exists. */ | 986 | /* Check that the flow exists. */ |
| 984 | flow = ovs_flow_tbl_lookup(&dp->table, &key); | 987 | flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); |
| 985 | if (unlikely(!flow)) { | 988 | if (unlikely(!flow)) { |
| 986 | error = -ENOENT; | 989 | error = -ENOENT; |
| 987 | goto err_unlock_ovs; | 990 | goto err_unlock_ovs; |
| 988 | } | 991 | } |
| 989 | /* The unmasked key has to be the same for flow updates. */ | 992 | |
| 990 | if (unlikely(!ovs_flow_cmp_unmasked_key(flow, &match))) { | ||
| 991 | error = -EEXIST; | ||
| 992 | goto err_unlock_ovs; | ||
| 993 | } | ||
| 994 | /* Update actions, if present. */ | 993 | /* Update actions, if present. */ |
| 995 | if (likely(acts)) { | 994 | if (likely(acts)) { |
| 996 | old_acts = ovsl_dereference(flow->sf_acts); | 995 | old_acts = ovsl_dereference(flow->sf_acts); |
| @@ -1063,8 +1062,8 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info) | |||
| 1063 | goto unlock; | 1062 | goto unlock; |
| 1064 | } | 1063 | } |
| 1065 | 1064 | ||
| 1066 | flow = ovs_flow_tbl_lookup(&dp->table, &key); | 1065 | flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); |
| 1067 | if (!flow || !ovs_flow_cmp_unmasked_key(flow, &match)) { | 1066 | if (!flow) { |
| 1068 | err = -ENOENT; | 1067 | err = -ENOENT; |
| 1069 | goto unlock; | 1068 | goto unlock; |
| 1070 | } | 1069 | } |
| @@ -1113,8 +1112,8 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) | |||
| 1113 | goto unlock; | 1112 | goto unlock; |
| 1114 | } | 1113 | } |
| 1115 | 1114 | ||
| 1116 | flow = ovs_flow_tbl_lookup(&dp->table, &key); | 1115 | flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); |
| 1117 | if (unlikely(!flow || !ovs_flow_cmp_unmasked_key(flow, &match))) { | 1116 | if (unlikely(!flow)) { |
| 1118 | err = -ENOENT; | 1117 | err = -ENOENT; |
| 1119 | goto unlock; | 1118 | goto unlock; |
| 1120 | } | 1119 | } |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 334751cb1528..d07ab538fc9d 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
| @@ -61,10 +61,10 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies) | |||
| 61 | 61 | ||
| 62 | #define TCP_FLAGS_BE16(tp) (*(__be16 *)&tcp_flag_word(tp) & htons(0x0FFF)) | 62 | #define TCP_FLAGS_BE16(tp) (*(__be16 *)&tcp_flag_word(tp) & htons(0x0FFF)) |
| 63 | 63 | ||
| 64 | void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb) | 64 | void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags, |
| 65 | struct sk_buff *skb) | ||
| 65 | { | 66 | { |
| 66 | struct flow_stats *stats; | 67 | struct flow_stats *stats; |
| 67 | __be16 tcp_flags = flow->key.tp.flags; | ||
| 68 | int node = numa_node_id(); | 68 | int node = numa_node_id(); |
| 69 | 69 | ||
| 70 | stats = rcu_dereference(flow->stats[node]); | 70 | stats = rcu_dereference(flow->stats[node]); |
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h index ac395d2cd821..5e5aaed3a85b 100644 --- a/net/openvswitch/flow.h +++ b/net/openvswitch/flow.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2007-2013 Nicira, Inc. | 2 | * Copyright (c) 2007-2014 Nicira, Inc. |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of version 2 of the GNU General Public | 5 | * modify it under the terms of version 2 of the GNU General Public |
| @@ -180,7 +180,8 @@ struct arp_eth_header { | |||
| 180 | unsigned char ar_tip[4]; /* target IP address */ | 180 | unsigned char ar_tip[4]; /* target IP address */ |
| 181 | } __packed; | 181 | } __packed; |
| 182 | 182 | ||
| 183 | void ovs_flow_stats_update(struct sw_flow *, struct sk_buff *); | 183 | void ovs_flow_stats_update(struct sw_flow *, __be16 tcp_flags, |
| 184 | struct sk_buff *); | ||
| 184 | void ovs_flow_stats_get(const struct sw_flow *, struct ovs_flow_stats *, | 185 | void ovs_flow_stats_get(const struct sw_flow *, struct ovs_flow_stats *, |
| 185 | unsigned long *used, __be16 *tcp_flags); | 186 | unsigned long *used, __be16 *tcp_flags); |
| 186 | void ovs_flow_stats_clear(struct sw_flow *); | 187 | void ovs_flow_stats_clear(struct sw_flow *); |
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index 574c3abc9b30..cf2d853646f0 100644 --- a/net/openvswitch/flow_table.c +++ b/net/openvswitch/flow_table.c | |||
| @@ -456,6 +456,22 @@ struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl, | |||
| 456 | return ovs_flow_tbl_lookup_stats(tbl, key, &n_mask_hit); | 456 | return ovs_flow_tbl_lookup_stats(tbl, key, &n_mask_hit); |
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | struct sw_flow *ovs_flow_tbl_lookup_exact(struct flow_table *tbl, | ||
| 460 | struct sw_flow_match *match) | ||
| 461 | { | ||
| 462 | struct table_instance *ti = rcu_dereference_ovsl(tbl->ti); | ||
| 463 | struct sw_flow_mask *mask; | ||
| 464 | struct sw_flow *flow; | ||
| 465 | |||
| 466 | /* Always called under ovs-mutex. */ | ||
| 467 | list_for_each_entry(mask, &tbl->mask_list, list) { | ||
| 468 | flow = masked_flow_lookup(ti, match->key, mask); | ||
| 469 | if (flow && ovs_flow_cmp_unmasked_key(flow, match)) /* Found */ | ||
| 470 | return flow; | ||
| 471 | } | ||
| 472 | return NULL; | ||
| 473 | } | ||
| 474 | |||
| 459 | int ovs_flow_tbl_num_masks(const struct flow_table *table) | 475 | int ovs_flow_tbl_num_masks(const struct flow_table *table) |
| 460 | { | 476 | { |
| 461 | struct sw_flow_mask *mask; | 477 | struct sw_flow_mask *mask; |
diff --git a/net/openvswitch/flow_table.h b/net/openvswitch/flow_table.h index ca8a5820f615..5918bff7f3f6 100644 --- a/net/openvswitch/flow_table.h +++ b/net/openvswitch/flow_table.h | |||
| @@ -76,7 +76,8 @@ struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *, | |||
| 76 | u32 *n_mask_hit); | 76 | u32 *n_mask_hit); |
| 77 | struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *, | 77 | struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *, |
| 78 | const struct sw_flow_key *); | 78 | const struct sw_flow_key *); |
| 79 | 79 | struct sw_flow *ovs_flow_tbl_lookup_exact(struct flow_table *tbl, | |
| 80 | struct sw_flow_match *match); | ||
| 80 | bool ovs_flow_cmp_unmasked_key(const struct sw_flow *flow, | 81 | bool ovs_flow_cmp_unmasked_key(const struct sw_flow *flow, |
| 81 | struct sw_flow_match *match); | 82 | struct sw_flow_match *match); |
| 82 | 83 | ||
diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c index 35ec4fed09e2..f49148a07da2 100644 --- a/net/openvswitch/vport-gre.c +++ b/net/openvswitch/vport-gre.c | |||
| @@ -110,6 +110,22 @@ static int gre_rcv(struct sk_buff *skb, | |||
| 110 | return PACKET_RCVD; | 110 | return PACKET_RCVD; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | /* Called with rcu_read_lock and BH disabled. */ | ||
| 114 | static int gre_err(struct sk_buff *skb, u32 info, | ||
| 115 | const struct tnl_ptk_info *tpi) | ||
| 116 | { | ||
| 117 | struct ovs_net *ovs_net; | ||
| 118 | struct vport *vport; | ||
| 119 | |||
| 120 | ovs_net = net_generic(dev_net(skb->dev), ovs_net_id); | ||
| 121 | vport = rcu_dereference(ovs_net->vport_net.gre_vport); | ||
| 122 | |||
| 123 | if (unlikely(!vport)) | ||
| 124 | return PACKET_REJECT; | ||
| 125 | else | ||
| 126 | return PACKET_RCVD; | ||
| 127 | } | ||
| 128 | |||
| 113 | static int gre_tnl_send(struct vport *vport, struct sk_buff *skb) | 129 | static int gre_tnl_send(struct vport *vport, struct sk_buff *skb) |
| 114 | { | 130 | { |
| 115 | struct net *net = ovs_dp_get_net(vport->dp); | 131 | struct net *net = ovs_dp_get_net(vport->dp); |
| @@ -186,6 +202,7 @@ error: | |||
| 186 | 202 | ||
| 187 | static struct gre_cisco_protocol gre_protocol = { | 203 | static struct gre_cisco_protocol gre_protocol = { |
| 188 | .handler = gre_rcv, | 204 | .handler = gre_rcv, |
| 205 | .err_handler = gre_err, | ||
| 189 | .priority = 1, | 206 | .priority = 1, |
| 190 | }; | 207 | }; |
| 191 | 208 | ||
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 85c64658bd0b..b6842fdb53d4 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
| @@ -366,9 +366,10 @@ fail: | |||
| 366 | * specification [SCTP] and any extensions for a list of possible | 366 | * specification [SCTP] and any extensions for a list of possible |
| 367 | * error formats. | 367 | * error formats. |
| 368 | */ | 368 | */ |
| 369 | struct sctp_ulpevent *sctp_ulpevent_make_remote_error( | 369 | struct sctp_ulpevent * |
| 370 | const struct sctp_association *asoc, struct sctp_chunk *chunk, | 370 | sctp_ulpevent_make_remote_error(const struct sctp_association *asoc, |
| 371 | __u16 flags, gfp_t gfp) | 371 | struct sctp_chunk *chunk, __u16 flags, |
| 372 | gfp_t gfp) | ||
| 372 | { | 373 | { |
| 373 | struct sctp_ulpevent *event; | 374 | struct sctp_ulpevent *event; |
| 374 | struct sctp_remote_error *sre; | 375 | struct sctp_remote_error *sre; |
| @@ -387,8 +388,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error( | |||
| 387 | /* Copy the skb to a new skb with room for us to prepend | 388 | /* Copy the skb to a new skb with room for us to prepend |
| 388 | * notification with. | 389 | * notification with. |
| 389 | */ | 390 | */ |
| 390 | skb = skb_copy_expand(chunk->skb, sizeof(struct sctp_remote_error), | 391 | skb = skb_copy_expand(chunk->skb, sizeof(*sre), 0, gfp); |
| 391 | 0, gfp); | ||
| 392 | 392 | ||
| 393 | /* Pull off the rest of the cause TLV from the chunk. */ | 393 | /* Pull off the rest of the cause TLV from the chunk. */ |
| 394 | skb_pull(chunk->skb, elen); | 394 | skb_pull(chunk->skb, elen); |
| @@ -399,62 +399,21 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error( | |||
| 399 | event = sctp_skb2event(skb); | 399 | event = sctp_skb2event(skb); |
| 400 | sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); | 400 | sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); |
| 401 | 401 | ||
| 402 | sre = (struct sctp_remote_error *) | 402 | sre = (struct sctp_remote_error *) skb_push(skb, sizeof(*sre)); |
| 403 | skb_push(skb, sizeof(struct sctp_remote_error)); | ||
| 404 | 403 | ||
| 405 | /* Trim the buffer to the right length. */ | 404 | /* Trim the buffer to the right length. */ |
| 406 | skb_trim(skb, sizeof(struct sctp_remote_error) + elen); | 405 | skb_trim(skb, sizeof(*sre) + elen); |
| 407 | 406 | ||
| 408 | /* Socket Extensions for SCTP | 407 | /* RFC6458, Section 6.1.3. SCTP_REMOTE_ERROR */ |
| 409 | * 5.3.1.3 SCTP_REMOTE_ERROR | 408 | memset(sre, 0, sizeof(*sre)); |
| 410 | * | ||
| 411 | * sre_type: | ||
| 412 | * It should be SCTP_REMOTE_ERROR. | ||
| 413 | */ | ||
| 414 | sre->sre_type = SCTP_REMOTE_ERROR; | 409 | sre->sre_type = SCTP_REMOTE_ERROR; |
| 415 | |||
| 416 | /* | ||
| 417 | * Socket Extensions for SCTP | ||
| 418 | * 5.3.1.3 SCTP_REMOTE_ERROR | ||
| 419 | * | ||
| 420 | * sre_flags: 16 bits (unsigned integer) | ||
| 421 | * Currently unused. | ||
| 422 | */ | ||
| 423 | sre->sre_flags = 0; | 410 | sre->sre_flags = 0; |
| 424 | |||
| 425 | /* Socket Extensions for SCTP | ||
| 426 | * 5.3.1.3 SCTP_REMOTE_ERROR | ||
| 427 | * | ||
| 428 | * sre_length: sizeof (__u32) | ||
| 429 | * | ||
| 430 | * This field is the total length of the notification data, | ||
| 431 | * including the notification header. | ||
| 432 | */ | ||
| 433 | sre->sre_length = skb->len; | 411 | sre->sre_length = skb->len; |
| 434 | |||
| 435 | /* Socket Extensions for SCTP | ||
| 436 | * 5.3.1.3 SCTP_REMOTE_ERROR | ||
| 437 | * | ||
| 438 | * sre_error: 16 bits (unsigned integer) | ||
| 439 | * This value represents one of the Operational Error causes defined in | ||
| 440 | * the SCTP specification, in network byte order. | ||
| 441 | */ | ||
| 442 | sre->sre_error = cause; | 412 | sre->sre_error = cause; |
| 443 | |||
| 444 | /* Socket Extensions for SCTP | ||
| 445 | * 5.3.1.3 SCTP_REMOTE_ERROR | ||
| 446 | * | ||
| 447 | * sre_assoc_id: sizeof (sctp_assoc_t) | ||
| 448 | * | ||
| 449 | * The association id field, holds the identifier for the association. | ||
| 450 | * All notifications for a given association have the same association | ||
| 451 | * identifier. For TCP style socket, this field is ignored. | ||
| 452 | */ | ||
| 453 | sctp_ulpevent_set_owner(event, asoc); | 413 | sctp_ulpevent_set_owner(event, asoc); |
| 454 | sre->sre_assoc_id = sctp_assoc2id(asoc); | 414 | sre->sre_assoc_id = sctp_assoc2id(asoc); |
| 455 | 415 | ||
| 456 | return event; | 416 | return event; |
| 457 | |||
| 458 | fail: | 417 | fail: |
| 459 | return NULL; | 418 | return NULL; |
| 460 | } | 419 | } |
| @@ -899,7 +858,9 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event) | |||
| 899 | return notification->sn_header.sn_type; | 858 | return notification->sn_header.sn_type; |
| 900 | } | 859 | } |
| 901 | 860 | ||
| 902 | /* Copy out the sndrcvinfo into a msghdr. */ | 861 | /* RFC6458, Section 5.3.2. SCTP Header Information Structure |
| 862 | * (SCTP_SNDRCV, DEPRECATED) | ||
| 863 | */ | ||
| 903 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, | 864 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, |
| 904 | struct msghdr *msghdr) | 865 | struct msghdr *msghdr) |
| 905 | { | 866 | { |
| @@ -908,74 +869,21 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, | |||
| 908 | if (sctp_ulpevent_is_notification(event)) | 869 | if (sctp_ulpevent_is_notification(event)) |
| 909 | return; | 870 | return; |
| 910 | 871 | ||
| 911 | /* Sockets API Extensions for SCTP | 872 | memset(&sinfo, 0, sizeof(sinfo)); |
| 912 | * Section 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) | ||
| 913 | * | ||
| 914 | * sinfo_stream: 16 bits (unsigned integer) | ||
| 915 | * | ||
| 916 | * For recvmsg() the SCTP stack places the message's stream number in | ||
| 917 | * this value. | ||
| 918 | */ | ||
| 919 | sinfo.sinfo_stream = event->stream; | 873 | sinfo.sinfo_stream = event->stream; |
| 920 | /* sinfo_ssn: 16 bits (unsigned integer) | ||
| 921 | * | ||
| 922 | * For recvmsg() this value contains the stream sequence number that | ||
| 923 | * the remote endpoint placed in the DATA chunk. For fragmented | ||
| 924 | * messages this is the same number for all deliveries of the message | ||
| 925 | * (if more than one recvmsg() is needed to read the message). | ||
| 926 | */ | ||
| 927 | sinfo.sinfo_ssn = event->ssn; | 874 | sinfo.sinfo_ssn = event->ssn; |
| 928 | /* sinfo_ppid: 32 bits (unsigned integer) | ||
| 929 | * | ||
| 930 | * In recvmsg() this value is | ||
| 931 | * the same information that was passed by the upper layer in the peer | ||
| 932 | * application. Please note that byte order issues are NOT accounted | ||
| 933 | * for and this information is passed opaquely by the SCTP stack from | ||
| 934 | * one end to the other. | ||
| 935 | */ | ||
| 936 | sinfo.sinfo_ppid = event->ppid; | 875 | sinfo.sinfo_ppid = event->ppid; |
| 937 | /* sinfo_flags: 16 bits (unsigned integer) | ||
| 938 | * | ||
| 939 | * This field may contain any of the following flags and is composed of | ||
| 940 | * a bitwise OR of these values. | ||
| 941 | * | ||
| 942 | * recvmsg() flags: | ||
| 943 | * | ||
| 944 | * SCTP_UNORDERED - This flag is present when the message was sent | ||
| 945 | * non-ordered. | ||
| 946 | */ | ||
| 947 | sinfo.sinfo_flags = event->flags; | 876 | sinfo.sinfo_flags = event->flags; |
| 948 | /* sinfo_tsn: 32 bit (unsigned integer) | ||
| 949 | * | ||
| 950 | * For the receiving side, this field holds a TSN that was | ||
| 951 | * assigned to one of the SCTP Data Chunks. | ||
| 952 | */ | ||
| 953 | sinfo.sinfo_tsn = event->tsn; | 877 | sinfo.sinfo_tsn = event->tsn; |
| 954 | /* sinfo_cumtsn: 32 bit (unsigned integer) | ||
| 955 | * | ||
| 956 | * This field will hold the current cumulative TSN as | ||
| 957 | * known by the underlying SCTP layer. Note this field is | ||
| 958 | * ignored when sending and only valid for a receive | ||
| 959 | * operation when sinfo_flags are set to SCTP_UNORDERED. | ||
| 960 | */ | ||
| 961 | sinfo.sinfo_cumtsn = event->cumtsn; | 878 | sinfo.sinfo_cumtsn = event->cumtsn; |
| 962 | /* sinfo_assoc_id: sizeof (sctp_assoc_t) | ||
| 963 | * | ||
| 964 | * The association handle field, sinfo_assoc_id, holds the identifier | ||
| 965 | * for the association announced in the COMMUNICATION_UP notification. | ||
| 966 | * All notifications for a given association have the same identifier. | ||
| 967 | * Ignored for one-to-one style sockets. | ||
| 968 | */ | ||
| 969 | sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc); | 879 | sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc); |
| 970 | 880 | /* Context value that is set via SCTP_CONTEXT socket option. */ | |
| 971 | /* context value that is set via SCTP_CONTEXT socket option. */ | ||
| 972 | sinfo.sinfo_context = event->asoc->default_rcv_context; | 881 | sinfo.sinfo_context = event->asoc->default_rcv_context; |
| 973 | |||
| 974 | /* These fields are not used while receiving. */ | 882 | /* These fields are not used while receiving. */ |
| 975 | sinfo.sinfo_timetolive = 0; | 883 | sinfo.sinfo_timetolive = 0; |
| 976 | 884 | ||
| 977 | put_cmsg(msghdr, IPPROTO_SCTP, SCTP_SNDRCV, | 885 | put_cmsg(msghdr, IPPROTO_SCTP, SCTP_SNDRCV, |
| 978 | sizeof(struct sctp_sndrcvinfo), (void *)&sinfo); | 886 | sizeof(sinfo), &sinfo); |
| 979 | } | 887 | } |
| 980 | 888 | ||
| 981 | /* Do accounting for bytes received and hold a reference to the association | 889 | /* Do accounting for bytes received and hold a reference to the association |
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 26631679a1fa..55c6c9d3e1ce 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
| @@ -559,6 +559,7 @@ receive: | |||
| 559 | 559 | ||
| 560 | buf = node->bclink.deferred_head; | 560 | buf = node->bclink.deferred_head; |
| 561 | node->bclink.deferred_head = buf->next; | 561 | node->bclink.deferred_head = buf->next; |
| 562 | buf->next = NULL; | ||
| 562 | node->bclink.deferred_size--; | 563 | node->bclink.deferred_size--; |
| 563 | goto receive; | 564 | goto receive; |
| 564 | } | 565 | } |
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 8be6e94a1ca9..0a37a472c29f 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c | |||
| @@ -101,9 +101,11 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /* tipc_buf_append(): Append a buffer to the fragment list of another buffer | 103 | /* tipc_buf_append(): Append a buffer to the fragment list of another buffer |
| 104 | * Let first buffer become head buffer | 104 | * @*headbuf: in: NULL for first frag, otherwise value returned from prev call |
| 105 | * Returns 1 and sets *buf to headbuf if chain is complete, otherwise 0 | 105 | * out: set when successful non-complete reassembly, otherwise NULL |
| 106 | * Leaves headbuf pointer at NULL if failure | 106 | * @*buf: in: the buffer to append. Always defined |
| 107 | * out: head buf after sucessful complete reassembly, otherwise NULL | ||
| 108 | * Returns 1 when reassembly complete, otherwise 0 | ||
| 107 | */ | 109 | */ |
| 108 | int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) | 110 | int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) |
| 109 | { | 111 | { |
| @@ -122,6 +124,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) | |||
| 122 | goto out_free; | 124 | goto out_free; |
| 123 | head = *headbuf = frag; | 125 | head = *headbuf = frag; |
| 124 | skb_frag_list_init(head); | 126 | skb_frag_list_init(head); |
| 127 | *buf = NULL; | ||
| 125 | return 0; | 128 | return 0; |
| 126 | } | 129 | } |
| 127 | if (!head) | 130 | if (!head) |
| @@ -150,5 +153,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) | |||
| 150 | out_free: | 153 | out_free: |
| 151 | pr_warn_ratelimited("Unable to build fragment list\n"); | 154 | pr_warn_ratelimited("Unable to build fragment list\n"); |
| 152 | kfree_skb(*buf); | 155 | kfree_skb(*buf); |
| 156 | kfree_skb(*headbuf); | ||
| 157 | *buf = *headbuf = NULL; | ||
| 153 | return 0; | 158 | return 0; |
| 154 | } | 159 | } |
diff --git a/net/wireless/core.h b/net/wireless/core.h index e9afbf10e756..7e3a3cef7df9 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
| @@ -424,7 +424,7 @@ static inline unsigned int elapsed_jiffies_msecs(unsigned long start) | |||
| 424 | if (end >= start) | 424 | if (end >= start) |
| 425 | return jiffies_to_msecs(end - start); | 425 | return jiffies_to_msecs(end - start); |
| 426 | 426 | ||
| 427 | return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1); | 427 | return jiffies_to_msecs(end + (ULONG_MAX - start) + 1); |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | void | 430 | void |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ba4f1723c83a..6668daf69326 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -1497,18 +1497,17 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, | |||
| 1497 | } | 1497 | } |
| 1498 | CMD(start_p2p_device, START_P2P_DEVICE); | 1498 | CMD(start_p2p_device, START_P2P_DEVICE); |
| 1499 | CMD(set_mcast_rate, SET_MCAST_RATE); | 1499 | CMD(set_mcast_rate, SET_MCAST_RATE); |
| 1500 | #ifdef CONFIG_NL80211_TESTMODE | ||
| 1501 | CMD(testmode_cmd, TESTMODE); | ||
| 1502 | #endif | ||
| 1500 | if (state->split) { | 1503 | if (state->split) { |
| 1501 | CMD(crit_proto_start, CRIT_PROTOCOL_START); | 1504 | CMD(crit_proto_start, CRIT_PROTOCOL_START); |
| 1502 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); | 1505 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); |
| 1503 | if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) | 1506 | if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) |
| 1504 | CMD(channel_switch, CHANNEL_SWITCH); | 1507 | CMD(channel_switch, CHANNEL_SWITCH); |
| 1508 | CMD(set_qos_map, SET_QOS_MAP); | ||
| 1505 | } | 1509 | } |
| 1506 | CMD(set_qos_map, SET_QOS_MAP); | 1510 | /* add into the if now */ |
| 1507 | |||
| 1508 | #ifdef CONFIG_NL80211_TESTMODE | ||
| 1509 | CMD(testmode_cmd, TESTMODE); | ||
| 1510 | #endif | ||
| 1511 | |||
| 1512 | #undef CMD | 1511 | #undef CMD |
| 1513 | 1512 | ||
| 1514 | if (rdev->ops->connect || rdev->ops->auth) { | 1513 | if (rdev->ops->connect || rdev->ops->auth) { |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 558b0e3a02d8..1afdf45db38f 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
| @@ -935,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, | |||
| 935 | if (!band_rule_found) | 935 | if (!band_rule_found) |
| 936 | band_rule_found = freq_in_rule_band(fr, center_freq); | 936 | band_rule_found = freq_in_rule_band(fr, center_freq); |
| 937 | 937 | ||
| 938 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5)); | 938 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20)); |
| 939 | 939 | ||
| 940 | if (band_rule_found && bw_fits) | 940 | if (band_rule_found && bw_fits) |
| 941 | return rr; | 941 | return rr; |
| @@ -1019,10 +1019,10 @@ static void chan_reg_rule_print_dbg(const struct ieee80211_regdomain *regd, | |||
| 1019 | } | 1019 | } |
| 1020 | #endif | 1020 | #endif |
| 1021 | 1021 | ||
| 1022 | /* Find an ieee80211_reg_rule such that a 5MHz channel with frequency | 1022 | /* |
| 1023 | * chan->center_freq fits there. | 1023 | * Note that right now we assume the desired channel bandwidth |
| 1024 | * If there is no such reg_rule, disable the channel, otherwise set the | 1024 | * is always 20 MHz for each individual channel (HT40 uses 20 MHz |
| 1025 | * flags corresponding to the bandwidths allowed in the particular reg_rule | 1025 | * per channel, the primary and the extension channel). |
| 1026 | */ | 1026 | */ |
| 1027 | static void handle_channel(struct wiphy *wiphy, | 1027 | static void handle_channel(struct wiphy *wiphy, |
| 1028 | enum nl80211_reg_initiator initiator, | 1028 | enum nl80211_reg_initiator initiator, |
| @@ -1083,12 +1083,8 @@ static void handle_channel(struct wiphy *wiphy, | |||
| 1083 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1083 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
| 1084 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1084 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
| 1085 | 1085 | ||
| 1086 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
| 1087 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
| 1088 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
| 1089 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
| 1090 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1086 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
| 1091 | bw_flags |= IEEE80211_CHAN_NO_HT40; | 1087 | bw_flags = IEEE80211_CHAN_NO_HT40; |
| 1092 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1088 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
| 1093 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1089 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
| 1094 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1090 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |
| @@ -1522,12 +1518,8 @@ static void handle_channel_custom(struct wiphy *wiphy, | |||
| 1522 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1518 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
| 1523 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1519 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
| 1524 | 1520 | ||
| 1525 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
| 1526 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
| 1527 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
| 1528 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
| 1529 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1521 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
| 1530 | bw_flags |= IEEE80211_CHAN_NO_HT40; | 1522 | bw_flags = IEEE80211_CHAN_NO_HT40; |
| 1531 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1523 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
| 1532 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1524 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
| 1533 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1525 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 480bbddbd801..6df04d91c93c 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
| @@ -193,7 +193,8 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | |||
| 193 | dsp_unlock(azx_dev); | 193 | dsp_unlock(azx_dev); |
| 194 | return azx_dev; | 194 | return azx_dev; |
| 195 | } | 195 | } |
| 196 | if (!res) | 196 | if (!res || |
| 197 | (chip->driver_caps & AZX_DCAPS_REVERSE_ASSIGN)) | ||
| 197 | res = azx_dev; | 198 | res = azx_dev; |
| 198 | } | 199 | } |
| 199 | dsp_unlock(azx_dev); | 200 | dsp_unlock(azx_dev); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index b6b4e71a0b0b..83cd19017cf3 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -227,7 +227,7 @@ enum { | |||
| 227 | /* quirks for Intel PCH */ | 227 | /* quirks for Intel PCH */ |
| 228 | #define AZX_DCAPS_INTEL_PCH_NOPM \ | 228 | #define AZX_DCAPS_INTEL_PCH_NOPM \ |
| 229 | (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \ | 229 | (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \ |
| 230 | AZX_DCAPS_COUNT_LPIB_DELAY) | 230 | AZX_DCAPS_COUNT_LPIB_DELAY | AZX_DCAPS_REVERSE_ASSIGN) |
| 231 | 231 | ||
| 232 | #define AZX_DCAPS_INTEL_PCH \ | 232 | #define AZX_DCAPS_INTEL_PCH \ |
| 233 | (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_PM_RUNTIME) | 233 | (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_PM_RUNTIME) |
| @@ -596,7 +596,7 @@ static int azx_suspend(struct device *dev) | |||
| 596 | struct azx *chip = card->private_data; | 596 | struct azx *chip = card->private_data; |
| 597 | struct azx_pcm *p; | 597 | struct azx_pcm *p; |
| 598 | 598 | ||
| 599 | if (chip->disabled) | 599 | if (chip->disabled || chip->init_failed) |
| 600 | return 0; | 600 | return 0; |
| 601 | 601 | ||
| 602 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 602 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
| @@ -628,7 +628,7 @@ static int azx_resume(struct device *dev) | |||
| 628 | struct snd_card *card = dev_get_drvdata(dev); | 628 | struct snd_card *card = dev_get_drvdata(dev); |
| 629 | struct azx *chip = card->private_data; | 629 | struct azx *chip = card->private_data; |
| 630 | 630 | ||
| 631 | if (chip->disabled) | 631 | if (chip->disabled || chip->init_failed) |
| 632 | return 0; | 632 | return 0; |
| 633 | 633 | ||
| 634 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 634 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
| @@ -665,7 +665,7 @@ static int azx_runtime_suspend(struct device *dev) | |||
| 665 | struct snd_card *card = dev_get_drvdata(dev); | 665 | struct snd_card *card = dev_get_drvdata(dev); |
| 666 | struct azx *chip = card->private_data; | 666 | struct azx *chip = card->private_data; |
| 667 | 667 | ||
| 668 | if (chip->disabled) | 668 | if (chip->disabled || chip->init_failed) |
| 669 | return 0; | 669 | return 0; |
| 670 | 670 | ||
| 671 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | 671 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) |
| @@ -692,7 +692,7 @@ static int azx_runtime_resume(struct device *dev) | |||
| 692 | struct hda_codec *codec; | 692 | struct hda_codec *codec; |
| 693 | int status; | 693 | int status; |
| 694 | 694 | ||
| 695 | if (chip->disabled) | 695 | if (chip->disabled || chip->init_failed) |
| 696 | return 0; | 696 | return 0; |
| 697 | 697 | ||
| 698 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | 698 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) |
| @@ -729,7 +729,7 @@ static int azx_runtime_idle(struct device *dev) | |||
| 729 | struct snd_card *card = dev_get_drvdata(dev); | 729 | struct snd_card *card = dev_get_drvdata(dev); |
| 730 | struct azx *chip = card->private_data; | 730 | struct azx *chip = card->private_data; |
| 731 | 731 | ||
| 732 | if (chip->disabled) | 732 | if (chip->disabled || chip->init_failed) |
| 733 | return 0; | 733 | return 0; |
| 734 | 734 | ||
| 735 | if (!power_save_controller || | 735 | if (!power_save_controller || |
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 4a7cb01fa912..e9d1a5762a55 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h | |||
| @@ -186,6 +186,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
| 186 | #define AZX_DCAPS_BUFSIZE (1 << 21) /* no buffer size alignment */ | 186 | #define AZX_DCAPS_BUFSIZE (1 << 21) /* no buffer size alignment */ |
| 187 | #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */ | 187 | #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */ |
| 188 | #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ | 188 | #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ |
| 189 | #define AZX_DCAPS_REVERSE_ASSIGN (1 << 24) /* Assign devices in reverse order */ | ||
| 189 | #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ | 190 | #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ |
| 190 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ | 191 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ |
| 191 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ | 192 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ |
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index a366ba9293a8..358414da6418 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c | |||
| @@ -236,6 +236,7 @@ disable_hda: | |||
| 236 | return rc; | 236 | return rc; |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | #ifdef CONFIG_PM_SLEEP | ||
| 239 | static void hda_tegra_disable_clocks(struct hda_tegra *data) | 240 | static void hda_tegra_disable_clocks(struct hda_tegra *data) |
| 240 | { | 241 | { |
| 241 | clk_disable_unprepare(data->hda2hdmi_clk); | 242 | clk_disable_unprepare(data->hda2hdmi_clk); |
| @@ -243,7 +244,6 @@ static void hda_tegra_disable_clocks(struct hda_tegra *data) | |||
| 243 | clk_disable_unprepare(data->hda_clk); | 244 | clk_disable_unprepare(data->hda_clk); |
| 244 | } | 245 | } |
| 245 | 246 | ||
| 246 | #ifdef CONFIG_PM_SLEEP | ||
| 247 | /* | 247 | /* |
| 248 | * power management | 248 | * power management |
| 249 | */ | 249 | */ |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 4fe876b65fda..ba4ca52072ff 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
| @@ -3337,6 +3337,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = { | |||
| 3337 | { .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_nvhdmi }, | 3337 | { .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_nvhdmi }, |
| 3338 | { .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_nvhdmi }, | 3338 | { .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_nvhdmi }, |
| 3339 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, | 3339 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, |
| 3340 | { .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, | ||
| 3340 | { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, | 3341 | { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, |
| 3341 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, | 3342 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, |
| 3342 | { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, | 3343 | { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, |
| @@ -3394,6 +3395,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0044"); | |||
| 3394 | MODULE_ALIAS("snd-hda-codec-id:10de0051"); | 3395 | MODULE_ALIAS("snd-hda-codec-id:10de0051"); |
| 3395 | MODULE_ALIAS("snd-hda-codec-id:10de0060"); | 3396 | MODULE_ALIAS("snd-hda-codec-id:10de0060"); |
| 3396 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); | 3397 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); |
| 3398 | MODULE_ALIAS("snd-hda-codec-id:10de0070"); | ||
| 3397 | MODULE_ALIAS("snd-hda-codec-id:10de0071"); | 3399 | MODULE_ALIAS("snd-hda-codec-id:10de0071"); |
| 3398 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); | 3400 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); |
| 3399 | MODULE_ALIAS("snd-hda-codec-id:11069f80"); | 3401 | MODULE_ALIAS("snd-hda-codec-id:11069f80"); |
diff --git a/tools/lib/lockdep/include/liblockdep/mutex.h b/tools/lib/lockdep/include/liblockdep/mutex.h index c342f7087147..ee53a42818ca 100644 --- a/tools/lib/lockdep/include/liblockdep/mutex.h +++ b/tools/lib/lockdep/include/liblockdep/mutex.h | |||
| @@ -35,7 +35,7 @@ static inline int __mutex_init(liblockdep_pthread_mutex_t *lock, | |||
| 35 | 35 | ||
| 36 | static inline int liblockdep_pthread_mutex_lock(liblockdep_pthread_mutex_t *lock) | 36 | static inline int liblockdep_pthread_mutex_lock(liblockdep_pthread_mutex_t *lock) |
| 37 | { | 37 | { |
| 38 | lock_acquire(&lock->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 38 | lock_acquire(&lock->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 39 | return pthread_mutex_lock(&lock->mutex); | 39 | return pthread_mutex_lock(&lock->mutex); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| @@ -47,7 +47,7 @@ static inline int liblockdep_pthread_mutex_unlock(liblockdep_pthread_mutex_t *lo | |||
| 47 | 47 | ||
| 48 | static inline int liblockdep_pthread_mutex_trylock(liblockdep_pthread_mutex_t *lock) | 48 | static inline int liblockdep_pthread_mutex_trylock(liblockdep_pthread_mutex_t *lock) |
| 49 | { | 49 | { |
| 50 | lock_acquire(&lock->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 50 | lock_acquire(&lock->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 51 | return pthread_mutex_trylock(&lock->mutex) == 0 ? 1 : 0; | 51 | return pthread_mutex_trylock(&lock->mutex) == 0 ? 1 : 0; |
| 52 | } | 52 | } |
| 53 | 53 | ||
diff --git a/tools/lib/lockdep/include/liblockdep/rwlock.h b/tools/lib/lockdep/include/liblockdep/rwlock.h index a680ab8c2e36..4ec03f861551 100644 --- a/tools/lib/lockdep/include/liblockdep/rwlock.h +++ b/tools/lib/lockdep/include/liblockdep/rwlock.h | |||
| @@ -36,7 +36,7 @@ static inline int __rwlock_init(liblockdep_pthread_rwlock_t *lock, | |||
| 36 | 36 | ||
| 37 | static inline int liblockdep_pthread_rwlock_rdlock(liblockdep_pthread_rwlock_t *lock) | 37 | static inline int liblockdep_pthread_rwlock_rdlock(liblockdep_pthread_rwlock_t *lock) |
| 38 | { | 38 | { |
| 39 | lock_acquire(&lock->dep_map, 0, 0, 2, 2, NULL, (unsigned long)_RET_IP_); | 39 | lock_acquire(&lock->dep_map, 0, 0, 2, 1, NULL, (unsigned long)_RET_IP_); |
| 40 | return pthread_rwlock_rdlock(&lock->rwlock); | 40 | return pthread_rwlock_rdlock(&lock->rwlock); |
| 41 | 41 | ||
| 42 | } | 42 | } |
| @@ -49,19 +49,19 @@ static inline int liblockdep_pthread_rwlock_unlock(liblockdep_pthread_rwlock_t * | |||
| 49 | 49 | ||
| 50 | static inline int liblockdep_pthread_rwlock_wrlock(liblockdep_pthread_rwlock_t *lock) | 50 | static inline int liblockdep_pthread_rwlock_wrlock(liblockdep_pthread_rwlock_t *lock) |
| 51 | { | 51 | { |
| 52 | lock_acquire(&lock->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 52 | lock_acquire(&lock->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 53 | return pthread_rwlock_wrlock(&lock->rwlock); | 53 | return pthread_rwlock_wrlock(&lock->rwlock); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | static inline int liblockdep_pthread_rwlock_tryrdlock(liblockdep_pthread_rwlock_t *lock) | 56 | static inline int liblockdep_pthread_rwlock_tryrdlock(liblockdep_pthread_rwlock_t *lock) |
| 57 | { | 57 | { |
| 58 | lock_acquire(&lock->dep_map, 0, 1, 2, 2, NULL, (unsigned long)_RET_IP_); | 58 | lock_acquire(&lock->dep_map, 0, 1, 2, 1, NULL, (unsigned long)_RET_IP_); |
| 59 | return pthread_rwlock_tryrdlock(&lock->rwlock) == 0 ? 1 : 0; | 59 | return pthread_rwlock_tryrdlock(&lock->rwlock) == 0 ? 1 : 0; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | static inline int liblockdep_pthread_rwlock_trywlock(liblockdep_pthread_rwlock_t *lock) | 62 | static inline int liblockdep_pthread_rwlock_trywlock(liblockdep_pthread_rwlock_t *lock) |
| 63 | { | 63 | { |
| 64 | lock_acquire(&lock->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 64 | lock_acquire(&lock->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 65 | return pthread_rwlock_trywlock(&lock->rwlock) == 0 ? 1 : 0; | 65 | return pthread_rwlock_trywlock(&lock->rwlock) == 0 ? 1 : 0; |
| 66 | } | 66 | } |
| 67 | 67 | ||
diff --git a/tools/lib/lockdep/preload.c b/tools/lib/lockdep/preload.c index 23bd69cb5ade..6f803609e498 100644 --- a/tools/lib/lockdep/preload.c +++ b/tools/lib/lockdep/preload.c | |||
| @@ -92,7 +92,7 @@ enum { none, prepare, done, } __init_state; | |||
| 92 | static void init_preload(void); | 92 | static void init_preload(void); |
| 93 | static void try_init_preload(void) | 93 | static void try_init_preload(void) |
| 94 | { | 94 | { |
| 95 | if (!__init_state != done) | 95 | if (__init_state != done) |
| 96 | init_preload(); | 96 | init_preload(); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| @@ -252,7 +252,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) | |||
| 252 | 252 | ||
| 253 | try_init_preload(); | 253 | try_init_preload(); |
| 254 | 254 | ||
| 255 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 2, NULL, | 255 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 1, NULL, |
| 256 | (unsigned long)_RET_IP_); | 256 | (unsigned long)_RET_IP_); |
| 257 | /* | 257 | /* |
| 258 | * Here's the thing with pthread mutexes: unlike the kernel variant, | 258 | * Here's the thing with pthread mutexes: unlike the kernel variant, |
| @@ -281,7 +281,7 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex) | |||
| 281 | 281 | ||
| 282 | try_init_preload(); | 282 | try_init_preload(); |
| 283 | 283 | ||
| 284 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 284 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 285 | r = ll_pthread_mutex_trylock(mutex); | 285 | r = ll_pthread_mutex_trylock(mutex); |
| 286 | if (r) | 286 | if (r) |
| 287 | lock_release(&__get_lock(mutex)->dep_map, 0, (unsigned long)_RET_IP_); | 287 | lock_release(&__get_lock(mutex)->dep_map, 0, (unsigned long)_RET_IP_); |
| @@ -303,7 +303,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) | |||
| 303 | */ | 303 | */ |
| 304 | r = ll_pthread_mutex_unlock(mutex); | 304 | r = ll_pthread_mutex_unlock(mutex); |
| 305 | if (r) | 305 | if (r) |
| 306 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 306 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 307 | 307 | ||
| 308 | return r; | 308 | return r; |
| 309 | } | 309 | } |
| @@ -352,7 +352,7 @@ int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) | |||
| 352 | 352 | ||
| 353 | init_preload(); | 353 | init_preload(); |
| 354 | 354 | ||
| 355 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 2, 2, NULL, (unsigned long)_RET_IP_); | 355 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 2, 1, NULL, (unsigned long)_RET_IP_); |
| 356 | r = ll_pthread_rwlock_rdlock(rwlock); | 356 | r = ll_pthread_rwlock_rdlock(rwlock); |
| 357 | if (r) | 357 | if (r) |
| 358 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 358 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
| @@ -366,7 +366,7 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) | |||
| 366 | 366 | ||
| 367 | init_preload(); | 367 | init_preload(); |
| 368 | 368 | ||
| 369 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 2, 2, NULL, (unsigned long)_RET_IP_); | 369 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 2, 1, NULL, (unsigned long)_RET_IP_); |
| 370 | r = ll_pthread_rwlock_tryrdlock(rwlock); | 370 | r = ll_pthread_rwlock_tryrdlock(rwlock); |
| 371 | if (r) | 371 | if (r) |
| 372 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 372 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
| @@ -380,7 +380,7 @@ int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) | |||
| 380 | 380 | ||
| 381 | init_preload(); | 381 | init_preload(); |
| 382 | 382 | ||
| 383 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 383 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 384 | r = ll_pthread_rwlock_trywrlock(rwlock); | 384 | r = ll_pthread_rwlock_trywrlock(rwlock); |
| 385 | if (r) | 385 | if (r) |
| 386 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 386 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
| @@ -394,7 +394,7 @@ int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) | |||
| 394 | 394 | ||
| 395 | init_preload(); | 395 | init_preload(); |
| 396 | 396 | ||
| 397 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 397 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 398 | r = ll_pthread_rwlock_wrlock(rwlock); | 398 | r = ll_pthread_rwlock_wrlock(rwlock); |
| 399 | if (r) | 399 | if (r) |
| 400 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 400 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
| @@ -411,7 +411,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) | |||
| 411 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 411 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
| 412 | r = ll_pthread_rwlock_unlock(rwlock); | 412 | r = ll_pthread_rwlock_unlock(rwlock); |
| 413 | if (r) | 413 | if (r) |
| 414 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 414 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
| 415 | 415 | ||
| 416 | return r; | 416 | return r; |
| 417 | } | 417 | } |
| @@ -439,8 +439,6 @@ __attribute__((constructor)) static void init_preload(void) | |||
| 439 | ll_pthread_rwlock_unlock = dlsym(RTLD_NEXT, "pthread_rwlock_unlock"); | 439 | ll_pthread_rwlock_unlock = dlsym(RTLD_NEXT, "pthread_rwlock_unlock"); |
| 440 | #endif | 440 | #endif |
| 441 | 441 | ||
| 442 | printf("%p\n", ll_pthread_mutex_trylock);fflush(stdout); | ||
| 443 | |||
| 444 | lockdep_init(); | 442 | lockdep_init(); |
| 445 | 443 | ||
| 446 | __init_state = done; | 444 | __init_state = done; |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 52c03fbbba17..04a229aa5c0f 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include "../util.h" | 17 | #include "../util.h" |
| 18 | #include "../ui.h" | 18 | #include "../ui.h" |
| 19 | #include "map.h" | 19 | #include "map.h" |
| 20 | #include "annotate.h" | ||
| 20 | 21 | ||
| 21 | struct hist_browser { | 22 | struct hist_browser { |
| 22 | struct ui_browser b; | 23 | struct ui_browser b; |
| @@ -1593,13 +1594,18 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
| 1593 | bi->to.sym->name) > 0) | 1594 | bi->to.sym->name) > 0) |
| 1594 | annotate_t = nr_options++; | 1595 | annotate_t = nr_options++; |
| 1595 | } else { | 1596 | } else { |
| 1596 | |||
| 1597 | if (browser->selection != NULL && | 1597 | if (browser->selection != NULL && |
| 1598 | browser->selection->sym != NULL && | 1598 | browser->selection->sym != NULL && |
| 1599 | !browser->selection->map->dso->annotate_warned && | 1599 | !browser->selection->map->dso->annotate_warned) { |
| 1600 | asprintf(&options[nr_options], "Annotate %s", | 1600 | struct annotation *notes; |
| 1601 | browser->selection->sym->name) > 0) | 1601 | |
| 1602 | annotate = nr_options++; | 1602 | notes = symbol__annotation(browser->selection->sym); |
| 1603 | |||
| 1604 | if (notes->src && | ||
| 1605 | asprintf(&options[nr_options], "Annotate %s", | ||
| 1606 | browser->selection->sym->name) > 0) | ||
| 1607 | annotate = nr_options++; | ||
| 1608 | } | ||
| 1603 | } | 1609 | } |
| 1604 | 1610 | ||
| 1605 | if (thread != NULL && | 1611 | if (thread != NULL && |
| @@ -1656,6 +1662,7 @@ retry_popup_menu: | |||
| 1656 | 1662 | ||
| 1657 | if (choice == annotate || choice == annotate_t || choice == annotate_f) { | 1663 | if (choice == annotate || choice == annotate_t || choice == annotate_f) { |
| 1658 | struct hist_entry *he; | 1664 | struct hist_entry *he; |
| 1665 | struct annotation *notes; | ||
| 1659 | int err; | 1666 | int err; |
| 1660 | do_annotate: | 1667 | do_annotate: |
| 1661 | if (!objdump_path && perf_session_env__lookup_objdump(env)) | 1668 | if (!objdump_path && perf_session_env__lookup_objdump(env)) |
| @@ -1679,6 +1686,10 @@ do_annotate: | |||
| 1679 | he->ms.map = he->branch_info->to.map; | 1686 | he->ms.map = he->branch_info->to.map; |
| 1680 | } | 1687 | } |
| 1681 | 1688 | ||
| 1689 | notes = symbol__annotation(he->ms.sym); | ||
| 1690 | if (!notes->src) | ||
| 1691 | continue; | ||
| 1692 | |||
| 1682 | /* | 1693 | /* |
| 1683 | * Don't let this be freed, say, by hists__decay_entry. | 1694 | * Don't let this be freed, say, by hists__decay_entry. |
| 1684 | */ | 1695 | */ |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 0e5fea95d596..c73e1fc12e53 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -496,18 +496,6 @@ struct process_args { | |||
| 496 | u64 start; | 496 | u64 start; |
| 497 | }; | 497 | }; |
| 498 | 498 | ||
| 499 | static int symbol__in_kernel(void *arg, const char *name, | ||
| 500 | char type __maybe_unused, u64 start) | ||
| 501 | { | ||
| 502 | struct process_args *args = arg; | ||
| 503 | |||
| 504 | if (strchr(name, '[')) | ||
| 505 | return 0; | ||
| 506 | |||
| 507 | args->start = start; | ||
| 508 | return 1; | ||
| 509 | } | ||
| 510 | |||
| 511 | static void machine__get_kallsyms_filename(struct machine *machine, char *buf, | 499 | static void machine__get_kallsyms_filename(struct machine *machine, char *buf, |
| 512 | size_t bufsz) | 500 | size_t bufsz) |
| 513 | { | 501 | { |
| @@ -517,27 +505,41 @@ static void machine__get_kallsyms_filename(struct machine *machine, char *buf, | |||
| 517 | scnprintf(buf, bufsz, "%s/proc/kallsyms", machine->root_dir); | 505 | scnprintf(buf, bufsz, "%s/proc/kallsyms", machine->root_dir); |
| 518 | } | 506 | } |
| 519 | 507 | ||
| 520 | /* Figure out the start address of kernel map from /proc/kallsyms */ | 508 | const char *ref_reloc_sym_names[] = {"_text", "_stext", NULL}; |
| 521 | static u64 machine__get_kernel_start_addr(struct machine *machine) | 509 | |
| 510 | /* Figure out the start address of kernel map from /proc/kallsyms. | ||
| 511 | * Returns the name of the start symbol in *symbol_name. Pass in NULL as | ||
| 512 | * symbol_name if it's not that important. | ||
| 513 | */ | ||
| 514 | static u64 machine__get_kernel_start_addr(struct machine *machine, | ||
| 515 | const char **symbol_name) | ||
| 522 | { | 516 | { |
| 523 | char filename[PATH_MAX]; | 517 | char filename[PATH_MAX]; |
| 524 | struct process_args args; | 518 | int i; |
| 519 | const char *name; | ||
| 520 | u64 addr = 0; | ||
| 525 | 521 | ||
| 526 | machine__get_kallsyms_filename(machine, filename, PATH_MAX); | 522 | machine__get_kallsyms_filename(machine, filename, PATH_MAX); |
| 527 | 523 | ||
| 528 | if (symbol__restricted_filename(filename, "/proc/kallsyms")) | 524 | if (symbol__restricted_filename(filename, "/proc/kallsyms")) |
| 529 | return 0; | 525 | return 0; |
| 530 | 526 | ||
| 531 | if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0) | 527 | for (i = 0; (name = ref_reloc_sym_names[i]) != NULL; i++) { |
| 532 | return 0; | 528 | addr = kallsyms__get_function_start(filename, name); |
| 529 | if (addr) | ||
| 530 | break; | ||
| 531 | } | ||
| 532 | |||
| 533 | if (symbol_name) | ||
| 534 | *symbol_name = name; | ||
| 533 | 535 | ||
| 534 | return args.start; | 536 | return addr; |
| 535 | } | 537 | } |
| 536 | 538 | ||
| 537 | int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) | 539 | int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) |
| 538 | { | 540 | { |
| 539 | enum map_type type; | 541 | enum map_type type; |
| 540 | u64 start = machine__get_kernel_start_addr(machine); | 542 | u64 start = machine__get_kernel_start_addr(machine, NULL); |
| 541 | 543 | ||
| 542 | for (type = 0; type < MAP__NR_TYPES; ++type) { | 544 | for (type = 0; type < MAP__NR_TYPES; ++type) { |
| 543 | struct kmap *kmap; | 545 | struct kmap *kmap; |
| @@ -852,23 +854,11 @@ static int machine__create_modules(struct machine *machine) | |||
| 852 | return 0; | 854 | return 0; |
| 853 | } | 855 | } |
| 854 | 856 | ||
| 855 | const char *ref_reloc_sym_names[] = {"_text", "_stext", NULL}; | ||
| 856 | |||
| 857 | int machine__create_kernel_maps(struct machine *machine) | 857 | int machine__create_kernel_maps(struct machine *machine) |
| 858 | { | 858 | { |
| 859 | struct dso *kernel = machine__get_kernel(machine); | 859 | struct dso *kernel = machine__get_kernel(machine); |
| 860 | char filename[PATH_MAX]; | ||
| 861 | const char *name; | 860 | const char *name; |
| 862 | u64 addr = 0; | 861 | u64 addr = machine__get_kernel_start_addr(machine, &name); |
| 863 | int i; | ||
| 864 | |||
| 865 | machine__get_kallsyms_filename(machine, filename, PATH_MAX); | ||
| 866 | |||
| 867 | for (i = 0; (name = ref_reloc_sym_names[i]) != NULL; i++) { | ||
| 868 | addr = kallsyms__get_function_start(filename, name); | ||
| 869 | if (addr) | ||
| 870 | break; | ||
| 871 | } | ||
| 872 | if (!addr) | 862 | if (!addr) |
| 873 | return -1; | 863 | return -1; |
| 874 | 864 | ||
