diff options
81 files changed, 743 insertions, 447 deletions
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c index 829df49dee99..41ebbfebb333 100644 --- a/arch/um/kernel/exitcode.c +++ b/arch/um/kernel/exitcode.c | |||
@@ -40,9 +40,11 @@ static ssize_t exitcode_proc_write(struct file *file, | |||
40 | const char __user *buffer, size_t count, loff_t *pos) | 40 | const char __user *buffer, size_t count, loff_t *pos) |
41 | { | 41 | { |
42 | char *end, buf[sizeof("nnnnn\0")]; | 42 | char *end, buf[sizeof("nnnnn\0")]; |
43 | size_t size; | ||
43 | int tmp; | 44 | int tmp; |
44 | 45 | ||
45 | if (copy_from_user(buf, buffer, count)) | 46 | size = min(count, sizeof(buf)); |
47 | if (copy_from_user(buf, buffer, size)) | ||
46 | return -EFAULT; | 48 | return -EFAULT; |
47 | 49 | ||
48 | tmp = simple_strtol(buf, &end, 0); | 50 | tmp = simple_strtol(buf, &end, 0); |
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 0da5200ee79d..b3e18f800302 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -128,7 +128,8 @@ do { \ | |||
128 | do { \ | 128 | do { \ |
129 | typedef typeof(var) pao_T__; \ | 129 | typedef typeof(var) pao_T__; \ |
130 | const int pao_ID__ = (__builtin_constant_p(val) && \ | 130 | const int pao_ID__ = (__builtin_constant_p(val) && \ |
131 | ((val) == 1 || (val) == -1)) ? (val) : 0; \ | 131 | ((val) == 1 || (val) == -1)) ? \ |
132 | (int)(val) : 0; \ | ||
132 | if (0) { \ | 133 | if (0) { \ |
133 | pao_T__ pao_tmp__; \ | 134 | pao_T__ pao_tmp__; \ |
134 | pao_tmp__ = (val); \ | 135 | pao_tmp__ = (val); \ |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index a0e2a8a80c94..b2046e4d0b59 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -609,7 +609,7 @@ static struct dentry *d_kvm_debug; | |||
609 | 609 | ||
610 | struct dentry *kvm_init_debugfs(void) | 610 | struct dentry *kvm_init_debugfs(void) |
611 | { | 611 | { |
612 | d_kvm_debug = debugfs_create_dir("kvm", NULL); | 612 | d_kvm_debug = debugfs_create_dir("kvm-guest", NULL); |
613 | if (!d_kvm_debug) | 613 | if (!d_kvm_debug) |
614 | printk(KERN_WARNING "Could not create 'kvm' debugfs directory\n"); | 614 | printk(KERN_WARNING "Could not create 'kvm' debugfs directory\n"); |
615 | 615 | ||
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index de1dfa18d0a1..21dbe6bdb8ed 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1122,7 +1122,7 @@ ENDPROC(fast_syscall_spill_registers) | |||
1122 | * a3: exctable, original value in excsave1 | 1122 | * a3: exctable, original value in excsave1 |
1123 | */ | 1123 | */ |
1124 | 1124 | ||
1125 | fast_syscall_spill_registers_fixup: | 1125 | ENTRY(fast_syscall_spill_registers_fixup) |
1126 | 1126 | ||
1127 | rsr a2, windowbase # get current windowbase (a2 is saved) | 1127 | rsr a2, windowbase # get current windowbase (a2 is saved) |
1128 | xsr a0, depc # restore depc and a0 | 1128 | xsr a0, depc # restore depc and a0 |
@@ -1134,22 +1134,26 @@ fast_syscall_spill_registers_fixup: | |||
1134 | */ | 1134 | */ |
1135 | 1135 | ||
1136 | xsr a3, excsave1 # get spill-mask | 1136 | xsr a3, excsave1 # get spill-mask |
1137 | slli a2, a3, 1 # shift left by one | 1137 | slli a3, a3, 1 # shift left by one |
1138 | 1138 | ||
1139 | slli a3, a2, 32-WSBITS | 1139 | slli a2, a3, 32-WSBITS |
1140 | src a2, a2, a3 # a1 = xxwww1yyxxxwww1yy...... | 1140 | src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy...... |
1141 | wsr a2, windowstart # set corrected windowstart | 1141 | wsr a2, windowstart # set corrected windowstart |
1142 | 1142 | ||
1143 | rsr a3, excsave1 | 1143 | srli a3, a3, 1 |
1144 | l32i a2, a3, EXC_TABLE_DOUBLE_SAVE # restore a2 | 1144 | rsr a2, excsave1 |
1145 | l32i a3, a3, EXC_TABLE_PARAM # original WB (in user task) | 1145 | l32i a2, a2, EXC_TABLE_DOUBLE_SAVE # restore a2 |
1146 | xsr a2, excsave1 | ||
1147 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE # save a3 | ||
1148 | l32i a3, a2, EXC_TABLE_PARAM # original WB (in user task) | ||
1149 | xsr a2, excsave1 | ||
1146 | 1150 | ||
1147 | /* Return to the original (user task) WINDOWBASE. | 1151 | /* Return to the original (user task) WINDOWBASE. |
1148 | * We leave the following frame behind: | 1152 | * We leave the following frame behind: |
1149 | * a0, a1, a2 same | 1153 | * a0, a1, a2 same |
1150 | * a3: trashed (saved in excsave_1) | 1154 | * a3: trashed (saved in EXC_TABLE_DOUBLE_SAVE) |
1151 | * depc: depc (we have to return to that address) | 1155 | * depc: depc (we have to return to that address) |
1152 | * excsave_1: a3 | 1156 | * excsave_1: exctable |
1153 | */ | 1157 | */ |
1154 | 1158 | ||
1155 | wsr a3, windowbase | 1159 | wsr a3, windowbase |
@@ -1159,9 +1163,9 @@ fast_syscall_spill_registers_fixup: | |||
1159 | * a0: return address | 1163 | * a0: return address |
1160 | * a1: used, stack pointer | 1164 | * a1: used, stack pointer |
1161 | * a2: kernel stack pointer | 1165 | * a2: kernel stack pointer |
1162 | * a3: available, saved in EXCSAVE_1 | 1166 | * a3: available |
1163 | * depc: exception address | 1167 | * depc: exception address |
1164 | * excsave: a3 | 1168 | * excsave: exctable |
1165 | * Note: This frame might be the same as above. | 1169 | * Note: This frame might be the same as above. |
1166 | */ | 1170 | */ |
1167 | 1171 | ||
@@ -1181,9 +1185,12 @@ fast_syscall_spill_registers_fixup: | |||
1181 | rsr a0, exccause | 1185 | rsr a0, exccause |
1182 | addx4 a0, a0, a3 # find entry in table | 1186 | addx4 a0, a0, a3 # find entry in table |
1183 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler | 1187 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler |
1188 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1184 | jx a0 | 1189 | jx a0 |
1185 | 1190 | ||
1186 | fast_syscall_spill_registers_fixup_return: | 1191 | ENDPROC(fast_syscall_spill_registers_fixup) |
1192 | |||
1193 | ENTRY(fast_syscall_spill_registers_fixup_return) | ||
1187 | 1194 | ||
1188 | /* When we return here, all registers have been restored (a2: DEPC) */ | 1195 | /* When we return here, all registers have been restored (a2: DEPC) */ |
1189 | 1196 | ||
@@ -1191,13 +1198,13 @@ fast_syscall_spill_registers_fixup_return: | |||
1191 | 1198 | ||
1192 | /* Restore fixup handler. */ | 1199 | /* Restore fixup handler. */ |
1193 | 1200 | ||
1194 | xsr a3, excsave1 | 1201 | rsr a2, excsave1 |
1195 | movi a2, fast_syscall_spill_registers_fixup | 1202 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE |
1196 | s32i a2, a3, EXC_TABLE_FIXUP | 1203 | movi a3, fast_syscall_spill_registers_fixup |
1197 | s32i a0, a3, EXC_TABLE_DOUBLE_SAVE | 1204 | s32i a3, a2, EXC_TABLE_FIXUP |
1198 | rsr a2, windowbase | 1205 | rsr a3, windowbase |
1199 | s32i a2, a3, EXC_TABLE_PARAM | 1206 | s32i a3, a2, EXC_TABLE_PARAM |
1200 | l32i a2, a3, EXC_TABLE_KSTK | 1207 | l32i a2, a2, EXC_TABLE_KSTK |
1201 | 1208 | ||
1202 | /* Load WB at the time the exception occurred. */ | 1209 | /* Load WB at the time the exception occurred. */ |
1203 | 1210 | ||
@@ -1206,8 +1213,12 @@ fast_syscall_spill_registers_fixup_return: | |||
1206 | wsr a3, windowbase | 1213 | wsr a3, windowbase |
1207 | rsync | 1214 | rsync |
1208 | 1215 | ||
1216 | rsr a3, excsave1 | ||
1217 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1218 | |||
1209 | rfde | 1219 | rfde |
1210 | 1220 | ||
1221 | ENDPROC(fast_syscall_spill_registers_fixup_return) | ||
1211 | 1222 | ||
1212 | /* | 1223 | /* |
1213 | * spill all registers. | 1224 | * spill all registers. |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index 718eca1850bd..98b67d5f1514 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -341,7 +341,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
341 | 341 | ||
342 | sp = regs->areg[1]; | 342 | sp = regs->areg[1]; |
343 | 343 | ||
344 | if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) { | 344 | if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && sas_ss_flags(sp) == 0) { |
345 | sp = current->sas_ss_sp + current->sas_ss_size; | 345 | sp = current->sas_ss_sp + current->sas_ss_size; |
346 | } | 346 | } |
347 | 347 | ||
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c index 56f88b7afe2f..e9e1aad8c271 100644 --- a/arch/xtensa/platforms/iss/network.c +++ b/arch/xtensa/platforms/iss/network.c | |||
@@ -737,7 +737,8 @@ static int __init iss_net_setup(char *str) | |||
737 | return 1; | 737 | return 1; |
738 | } | 738 | } |
739 | 739 | ||
740 | if ((new = alloc_bootmem(sizeof new)) == NULL) { | 740 | new = alloc_bootmem(sizeof(*new)); |
741 | if (new == NULL) { | ||
741 | printk("Alloc_bootmem failed\n"); | 742 | printk("Alloc_bootmem failed\n"); |
742 | return 1; | 743 | return 1; |
743 | } | 744 | } |
diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 51410c2ac2cb..4d978a3c88f7 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c | |||
@@ -27,6 +27,14 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define SRC_CR 0x00U | 29 | #define SRC_CR 0x00U |
30 | #define SRC_CR_T0_ENSEL BIT(15) | ||
31 | #define SRC_CR_T1_ENSEL BIT(17) | ||
32 | #define SRC_CR_T2_ENSEL BIT(19) | ||
33 | #define SRC_CR_T3_ENSEL BIT(21) | ||
34 | #define SRC_CR_T4_ENSEL BIT(23) | ||
35 | #define SRC_CR_T5_ENSEL BIT(25) | ||
36 | #define SRC_CR_T6_ENSEL BIT(27) | ||
37 | #define SRC_CR_T7_ENSEL BIT(29) | ||
30 | #define SRC_XTALCR 0x0CU | 38 | #define SRC_XTALCR 0x0CU |
31 | #define SRC_XTALCR_XTALTIMEN BIT(20) | 39 | #define SRC_XTALCR_XTALTIMEN BIT(20) |
32 | #define SRC_XTALCR_SXTALDIS BIT(19) | 40 | #define SRC_XTALCR_SXTALDIS BIT(19) |
@@ -543,6 +551,19 @@ void __init nomadik_clk_init(void) | |||
543 | __func__, np->name); | 551 | __func__, np->name); |
544 | return; | 552 | return; |
545 | } | 553 | } |
554 | |||
555 | /* Set all timers to use the 2.4 MHz TIMCLK */ | ||
556 | val = readl(src_base + SRC_CR); | ||
557 | val |= SRC_CR_T0_ENSEL; | ||
558 | val |= SRC_CR_T1_ENSEL; | ||
559 | val |= SRC_CR_T2_ENSEL; | ||
560 | val |= SRC_CR_T3_ENSEL; | ||
561 | val |= SRC_CR_T4_ENSEL; | ||
562 | val |= SRC_CR_T5_ENSEL; | ||
563 | val |= SRC_CR_T6_ENSEL; | ||
564 | val |= SRC_CR_T7_ENSEL; | ||
565 | writel(val, src_base + SRC_CR); | ||
566 | |||
546 | val = readl(src_base + SRC_XTALCR); | 567 | val = readl(src_base + SRC_XTALCR); |
547 | pr_info("SXTALO is %s\n", | 568 | pr_info("SXTALO is %s\n", |
548 | (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled"); | 569 | (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled"); |
diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c index fc777bdc1886..81a202d12a7a 100644 --- a/drivers/clk/mvebu/armada-370.c +++ b/drivers/clk/mvebu/armada-370.c | |||
@@ -39,8 +39,8 @@ static const struct coreclk_ratio a370_coreclk_ratios[] __initconst = { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | static const u32 a370_tclk_freqs[] __initconst = { | 41 | static const u32 a370_tclk_freqs[] __initconst = { |
42 | 16600000, | 42 | 166000000, |
43 | 20000000, | 43 | 200000000, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | static u32 __init a370_get_tclk_freq(void __iomem *sar) | 46 | static u32 __init a370_get_tclk_freq(void __iomem *sar) |
diff --git a/drivers/clk/socfpga/clk.c b/drivers/clk/socfpga/clk.c index 5bb848cac6ec..81dd31a686df 100644 --- a/drivers/clk/socfpga/clk.c +++ b/drivers/clk/socfpga/clk.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #define SOCFPGA_L4_SP_CLK "l4_sp_clk" | 49 | #define SOCFPGA_L4_SP_CLK "l4_sp_clk" |
50 | #define SOCFPGA_NAND_CLK "nand_clk" | 50 | #define SOCFPGA_NAND_CLK "nand_clk" |
51 | #define SOCFPGA_NAND_X_CLK "nand_x_clk" | 51 | #define SOCFPGA_NAND_X_CLK "nand_x_clk" |
52 | #define SOCFPGA_MMC_CLK "mmc_clk" | 52 | #define SOCFPGA_MMC_CLK "sdmmc_clk" |
53 | #define SOCFPGA_DB_CLK "gpio_db_clk" | 53 | #define SOCFPGA_DB_CLK "gpio_db_clk" |
54 | 54 | ||
55 | #define div_mask(width) ((1 << (width)) - 1) | 55 | #define div_mask(width) ((1 << (width)) - 1) |
diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index 67ccf4aa7277..f5e4c21b301f 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c | |||
@@ -107,7 +107,7 @@ static int icst_set_rate(struct clk_hw *hw, unsigned long rate, | |||
107 | 107 | ||
108 | vco = icst_hz_to_vco(icst->params, rate); | 108 | vco = icst_hz_to_vco(icst->params, rate); |
109 | icst->rate = icst_hz(icst->params, vco); | 109 | icst->rate = icst_hz(icst->params, vco); |
110 | vco_set(icst->vcoreg, icst->lockreg, vco); | 110 | vco_set(icst->lockreg, icst->vcoreg, vco); |
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 05ad9ba0a67e..fe58d0833a11 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -61,7 +61,7 @@ static int drm_version(struct drm_device *dev, void *data, | |||
61 | 61 | ||
62 | /** Ioctl table */ | 62 | /** Ioctl table */ |
63 | static const struct drm_ioctl_desc drm_ioctls[] = { | 63 | static const struct drm_ioctl_desc drm_ioctls[] = { |
64 | DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_UNLOCKED), | 64 | DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_UNLOCKED|DRM_RENDER_ALLOW), |
65 | DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), | 65 | DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), |
66 | DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0), | 66 | DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0), |
67 | DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY), | 67 | DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY), |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index ea9022ef15d5..10d1de5bce6f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -83,8 +83,7 @@ static bool intel_crt_get_hw_state(struct intel_encoder *encoder, | |||
83 | return true; | 83 | return true; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void intel_crt_get_config(struct intel_encoder *encoder, | 86 | static unsigned int intel_crt_get_flags(struct intel_encoder *encoder) |
87 | struct intel_crtc_config *pipe_config) | ||
88 | { | 87 | { |
89 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | 88 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
90 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | 89 | struct intel_crt *crt = intel_encoder_to_crt(encoder); |
@@ -102,7 +101,25 @@ static void intel_crt_get_config(struct intel_encoder *encoder, | |||
102 | else | 101 | else |
103 | flags |= DRM_MODE_FLAG_NVSYNC; | 102 | flags |= DRM_MODE_FLAG_NVSYNC; |
104 | 103 | ||
105 | pipe_config->adjusted_mode.flags |= flags; | 104 | return flags; |
105 | } | ||
106 | |||
107 | static void intel_crt_get_config(struct intel_encoder *encoder, | ||
108 | struct intel_crtc_config *pipe_config) | ||
109 | { | ||
110 | pipe_config->adjusted_mode.flags |= intel_crt_get_flags(encoder); | ||
111 | } | ||
112 | |||
113 | static void hsw_crt_get_config(struct intel_encoder *encoder, | ||
114 | struct intel_crtc_config *pipe_config) | ||
115 | { | ||
116 | intel_ddi_get_config(encoder, pipe_config); | ||
117 | |||
118 | pipe_config->adjusted_mode.flags &= ~(DRM_MODE_FLAG_PHSYNC | | ||
119 | DRM_MODE_FLAG_NHSYNC | | ||
120 | DRM_MODE_FLAG_PVSYNC | | ||
121 | DRM_MODE_FLAG_NVSYNC); | ||
122 | pipe_config->adjusted_mode.flags |= intel_crt_get_flags(encoder); | ||
106 | } | 123 | } |
107 | 124 | ||
108 | /* Note: The caller is required to filter out dpms modes not supported by the | 125 | /* Note: The caller is required to filter out dpms modes not supported by the |
@@ -799,7 +816,10 @@ void intel_crt_init(struct drm_device *dev) | |||
799 | crt->base.mode_set = intel_crt_mode_set; | 816 | crt->base.mode_set = intel_crt_mode_set; |
800 | crt->base.disable = intel_disable_crt; | 817 | crt->base.disable = intel_disable_crt; |
801 | crt->base.enable = intel_enable_crt; | 818 | crt->base.enable = intel_enable_crt; |
802 | crt->base.get_config = intel_crt_get_config; | 819 | if (IS_HASWELL(dev)) |
820 | crt->base.get_config = hsw_crt_get_config; | ||
821 | else | ||
822 | crt->base.get_config = intel_crt_get_config; | ||
803 | if (I915_HAS_HOTPLUG(dev)) | 823 | if (I915_HAS_HOTPLUG(dev)) |
804 | crt->base.hpd_pin = HPD_CRT; | 824 | crt->base.hpd_pin = HPD_CRT; |
805 | if (HAS_DDI(dev)) | 825 | if (HAS_DDI(dev)) |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 63de2701b974..b53fff84a7d5 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -1249,8 +1249,8 @@ static void intel_ddi_hot_plug(struct intel_encoder *intel_encoder) | |||
1249 | intel_dp_check_link_status(intel_dp); | 1249 | intel_dp_check_link_status(intel_dp); |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | static void intel_ddi_get_config(struct intel_encoder *encoder, | 1252 | void intel_ddi_get_config(struct intel_encoder *encoder, |
1253 | struct intel_crtc_config *pipe_config) | 1253 | struct intel_crtc_config *pipe_config) |
1254 | { | 1254 | { |
1255 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | 1255 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
1256 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); | 1256 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
@@ -1268,6 +1268,23 @@ static void intel_ddi_get_config(struct intel_encoder *encoder, | |||
1268 | flags |= DRM_MODE_FLAG_NVSYNC; | 1268 | flags |= DRM_MODE_FLAG_NVSYNC; |
1269 | 1269 | ||
1270 | pipe_config->adjusted_mode.flags |= flags; | 1270 | pipe_config->adjusted_mode.flags |= flags; |
1271 | |||
1272 | switch (temp & TRANS_DDI_BPC_MASK) { | ||
1273 | case TRANS_DDI_BPC_6: | ||
1274 | pipe_config->pipe_bpp = 18; | ||
1275 | break; | ||
1276 | case TRANS_DDI_BPC_8: | ||
1277 | pipe_config->pipe_bpp = 24; | ||
1278 | break; | ||
1279 | case TRANS_DDI_BPC_10: | ||
1280 | pipe_config->pipe_bpp = 30; | ||
1281 | break; | ||
1282 | case TRANS_DDI_BPC_12: | ||
1283 | pipe_config->pipe_bpp = 36; | ||
1284 | break; | ||
1285 | default: | ||
1286 | break; | ||
1287 | } | ||
1271 | } | 1288 | } |
1272 | 1289 | ||
1273 | static void intel_ddi_destroy(struct drm_encoder *encoder) | 1290 | static void intel_ddi_destroy(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 581fb4b2f766..d78d33f9337d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2327,9 +2327,10 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc) | |||
2327 | FDI_FE_ERRC_ENABLE); | 2327 | FDI_FE_ERRC_ENABLE); |
2328 | } | 2328 | } |
2329 | 2329 | ||
2330 | static bool pipe_has_enabled_pch(struct intel_crtc *intel_crtc) | 2330 | static bool pipe_has_enabled_pch(struct intel_crtc *crtc) |
2331 | { | 2331 | { |
2332 | return intel_crtc->base.enabled && intel_crtc->config.has_pch_encoder; | 2332 | return crtc->base.enabled && crtc->active && |
2333 | crtc->config.has_pch_encoder; | ||
2333 | } | 2334 | } |
2334 | 2335 | ||
2335 | static void ivb_modeset_global_resources(struct drm_device *dev) | 2336 | static void ivb_modeset_global_resources(struct drm_device *dev) |
@@ -2979,6 +2980,48 @@ static void ironlake_pch_transcoder_set_timings(struct intel_crtc *crtc, | |||
2979 | I915_READ(VSYNCSHIFT(cpu_transcoder))); | 2980 | I915_READ(VSYNCSHIFT(cpu_transcoder))); |
2980 | } | 2981 | } |
2981 | 2982 | ||
2983 | static void cpt_enable_fdi_bc_bifurcation(struct drm_device *dev) | ||
2984 | { | ||
2985 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2986 | uint32_t temp; | ||
2987 | |||
2988 | temp = I915_READ(SOUTH_CHICKEN1); | ||
2989 | if (temp & FDI_BC_BIFURCATION_SELECT) | ||
2990 | return; | ||
2991 | |||
2992 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_B)) & FDI_RX_ENABLE); | ||
2993 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_C)) & FDI_RX_ENABLE); | ||
2994 | |||
2995 | temp |= FDI_BC_BIFURCATION_SELECT; | ||
2996 | DRM_DEBUG_KMS("enabling fdi C rx\n"); | ||
2997 | I915_WRITE(SOUTH_CHICKEN1, temp); | ||
2998 | POSTING_READ(SOUTH_CHICKEN1); | ||
2999 | } | ||
3000 | |||
3001 | static void ivybridge_update_fdi_bc_bifurcation(struct intel_crtc *intel_crtc) | ||
3002 | { | ||
3003 | struct drm_device *dev = intel_crtc->base.dev; | ||
3004 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
3005 | |||
3006 | switch (intel_crtc->pipe) { | ||
3007 | case PIPE_A: | ||
3008 | break; | ||
3009 | case PIPE_B: | ||
3010 | if (intel_crtc->config.fdi_lanes > 2) | ||
3011 | WARN_ON(I915_READ(SOUTH_CHICKEN1) & FDI_BC_BIFURCATION_SELECT); | ||
3012 | else | ||
3013 | cpt_enable_fdi_bc_bifurcation(dev); | ||
3014 | |||
3015 | break; | ||
3016 | case PIPE_C: | ||
3017 | cpt_enable_fdi_bc_bifurcation(dev); | ||
3018 | |||
3019 | break; | ||
3020 | default: | ||
3021 | BUG(); | ||
3022 | } | ||
3023 | } | ||
3024 | |||
2982 | /* | 3025 | /* |
2983 | * Enable PCH resources required for PCH ports: | 3026 | * Enable PCH resources required for PCH ports: |
2984 | * - PCH PLLs | 3027 | * - PCH PLLs |
@@ -2997,6 +3040,9 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) | |||
2997 | 3040 | ||
2998 | assert_pch_transcoder_disabled(dev_priv, pipe); | 3041 | assert_pch_transcoder_disabled(dev_priv, pipe); |
2999 | 3042 | ||
3043 | if (IS_IVYBRIDGE(dev)) | ||
3044 | ivybridge_update_fdi_bc_bifurcation(intel_crtc); | ||
3045 | |||
3000 | /* Write the TU size bits before fdi link training, so that error | 3046 | /* Write the TU size bits before fdi link training, so that error |
3001 | * detection works. */ | 3047 | * detection works. */ |
3002 | I915_WRITE(FDI_RX_TUSIZE1(pipe), | 3048 | I915_WRITE(FDI_RX_TUSIZE1(pipe), |
@@ -4983,6 +5029,22 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, | |||
4983 | if (!(tmp & PIPECONF_ENABLE)) | 5029 | if (!(tmp & PIPECONF_ENABLE)) |
4984 | return false; | 5030 | return false; |
4985 | 5031 | ||
5032 | if (IS_G4X(dev) || IS_VALLEYVIEW(dev)) { | ||
5033 | switch (tmp & PIPECONF_BPC_MASK) { | ||
5034 | case PIPECONF_6BPC: | ||
5035 | pipe_config->pipe_bpp = 18; | ||
5036 | break; | ||
5037 | case PIPECONF_8BPC: | ||
5038 | pipe_config->pipe_bpp = 24; | ||
5039 | break; | ||
5040 | case PIPECONF_10BPC: | ||
5041 | pipe_config->pipe_bpp = 30; | ||
5042 | break; | ||
5043 | default: | ||
5044 | break; | ||
5045 | } | ||
5046 | } | ||
5047 | |||
4986 | intel_get_pipe_timings(crtc, pipe_config); | 5048 | intel_get_pipe_timings(crtc, pipe_config); |
4987 | 5049 | ||
4988 | i9xx_get_pfit_config(crtc, pipe_config); | 5050 | i9xx_get_pfit_config(crtc, pipe_config); |
@@ -5576,48 +5638,6 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, | |||
5576 | return true; | 5638 | return true; |
5577 | } | 5639 | } |
5578 | 5640 | ||
5579 | static void cpt_enable_fdi_bc_bifurcation(struct drm_device *dev) | ||
5580 | { | ||
5581 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5582 | uint32_t temp; | ||
5583 | |||
5584 | temp = I915_READ(SOUTH_CHICKEN1); | ||
5585 | if (temp & FDI_BC_BIFURCATION_SELECT) | ||
5586 | return; | ||
5587 | |||
5588 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_B)) & FDI_RX_ENABLE); | ||
5589 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_C)) & FDI_RX_ENABLE); | ||
5590 | |||
5591 | temp |= FDI_BC_BIFURCATION_SELECT; | ||
5592 | DRM_DEBUG_KMS("enabling fdi C rx\n"); | ||
5593 | I915_WRITE(SOUTH_CHICKEN1, temp); | ||
5594 | POSTING_READ(SOUTH_CHICKEN1); | ||
5595 | } | ||
5596 | |||
5597 | static void ivybridge_update_fdi_bc_bifurcation(struct intel_crtc *intel_crtc) | ||
5598 | { | ||
5599 | struct drm_device *dev = intel_crtc->base.dev; | ||
5600 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5601 | |||
5602 | switch (intel_crtc->pipe) { | ||
5603 | case PIPE_A: | ||
5604 | break; | ||
5605 | case PIPE_B: | ||
5606 | if (intel_crtc->config.fdi_lanes > 2) | ||
5607 | WARN_ON(I915_READ(SOUTH_CHICKEN1) & FDI_BC_BIFURCATION_SELECT); | ||
5608 | else | ||
5609 | cpt_enable_fdi_bc_bifurcation(dev); | ||
5610 | |||
5611 | break; | ||
5612 | case PIPE_C: | ||
5613 | cpt_enable_fdi_bc_bifurcation(dev); | ||
5614 | |||
5615 | break; | ||
5616 | default: | ||
5617 | BUG(); | ||
5618 | } | ||
5619 | } | ||
5620 | |||
5621 | int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp) | 5641 | int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp) |
5622 | { | 5642 | { |
5623 | /* | 5643 | /* |
@@ -5811,9 +5831,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5811 | &intel_crtc->config.fdi_m_n); | 5831 | &intel_crtc->config.fdi_m_n); |
5812 | } | 5832 | } |
5813 | 5833 | ||
5814 | if (IS_IVYBRIDGE(dev)) | ||
5815 | ivybridge_update_fdi_bc_bifurcation(intel_crtc); | ||
5816 | |||
5817 | ironlake_set_pipeconf(crtc); | 5834 | ironlake_set_pipeconf(crtc); |
5818 | 5835 | ||
5819 | /* Set up the display plane register */ | 5836 | /* Set up the display plane register */ |
@@ -5881,6 +5898,23 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc, | |||
5881 | if (!(tmp & PIPECONF_ENABLE)) | 5898 | if (!(tmp & PIPECONF_ENABLE)) |
5882 | return false; | 5899 | return false; |
5883 | 5900 | ||
5901 | switch (tmp & PIPECONF_BPC_MASK) { | ||
5902 | case PIPECONF_6BPC: | ||
5903 | pipe_config->pipe_bpp = 18; | ||
5904 | break; | ||
5905 | case PIPECONF_8BPC: | ||
5906 | pipe_config->pipe_bpp = 24; | ||
5907 | break; | ||
5908 | case PIPECONF_10BPC: | ||
5909 | pipe_config->pipe_bpp = 30; | ||
5910 | break; | ||
5911 | case PIPECONF_12BPC: | ||
5912 | pipe_config->pipe_bpp = 36; | ||
5913 | break; | ||
5914 | default: | ||
5915 | break; | ||
5916 | } | ||
5917 | |||
5884 | if (I915_READ(PCH_TRANSCONF(crtc->pipe)) & TRANS_ENABLE) { | 5918 | if (I915_READ(PCH_TRANSCONF(crtc->pipe)) & TRANS_ENABLE) { |
5885 | struct intel_shared_dpll *pll; | 5919 | struct intel_shared_dpll *pll; |
5886 | 5920 | ||
@@ -8612,6 +8646,9 @@ intel_pipe_config_compare(struct drm_device *dev, | |||
8612 | PIPE_CONF_CHECK_X(dpll_hw_state.fp0); | 8646 | PIPE_CONF_CHECK_X(dpll_hw_state.fp0); |
8613 | PIPE_CONF_CHECK_X(dpll_hw_state.fp1); | 8647 | PIPE_CONF_CHECK_X(dpll_hw_state.fp1); |
8614 | 8648 | ||
8649 | if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) | ||
8650 | PIPE_CONF_CHECK_I(pipe_bpp); | ||
8651 | |||
8615 | #undef PIPE_CONF_CHECK_X | 8652 | #undef PIPE_CONF_CHECK_X |
8616 | #undef PIPE_CONF_CHECK_I | 8653 | #undef PIPE_CONF_CHECK_I |
8617 | #undef PIPE_CONF_CHECK_FLAGS | 8654 | #undef PIPE_CONF_CHECK_FLAGS |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 2c555f91bfae..1a431377d83b 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1401,6 +1401,26 @@ static void intel_dp_get_config(struct intel_encoder *encoder, | |||
1401 | else | 1401 | else |
1402 | pipe_config->port_clock = 270000; | 1402 | pipe_config->port_clock = 270000; |
1403 | } | 1403 | } |
1404 | |||
1405 | if (is_edp(intel_dp) && dev_priv->vbt.edp_bpp && | ||
1406 | pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) { | ||
1407 | /* | ||
1408 | * This is a big fat ugly hack. | ||
1409 | * | ||
1410 | * Some machines in UEFI boot mode provide us a VBT that has 18 | ||
1411 | * bpp and 1.62 GHz link bandwidth for eDP, which for reasons | ||
1412 | * unknown we fail to light up. Yet the same BIOS boots up with | ||
1413 | * 24 bpp and 2.7 GHz link. Use the same bpp as the BIOS uses as | ||
1414 | * max, not what it tells us to use. | ||
1415 | * | ||
1416 | * Note: This will still be broken if the eDP panel is not lit | ||
1417 | * up by the BIOS, and thus we can't get the mode at module | ||
1418 | * load. | ||
1419 | */ | ||
1420 | DRM_DEBUG_KMS("pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp\n", | ||
1421 | pipe_config->pipe_bpp, dev_priv->vbt.edp_bpp); | ||
1422 | dev_priv->vbt.edp_bpp = pipe_config->pipe_bpp; | ||
1423 | } | ||
1404 | } | 1424 | } |
1405 | 1425 | ||
1406 | static bool is_edp_psr(struct intel_dp *intel_dp) | 1426 | static bool is_edp_psr(struct intel_dp *intel_dp) |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 9b7b68fd5d47..7f2b384ac939 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -765,6 +765,8 @@ extern void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder); | |||
765 | extern bool | 765 | extern bool |
766 | intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector); | 766 | intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector); |
767 | extern void intel_ddi_fdi_disable(struct drm_crtc *crtc); | 767 | extern void intel_ddi_fdi_disable(struct drm_crtc *crtc); |
768 | extern void intel_ddi_get_config(struct intel_encoder *encoder, | ||
769 | struct intel_crtc_config *pipe_config); | ||
768 | 770 | ||
769 | extern void intel_display_handle_reset(struct drm_device *dev); | 771 | extern void intel_display_handle_reset(struct drm_device *dev); |
770 | extern bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, | 772 | extern bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 831a5c021c4b..b8af94a5be39 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -700,6 +700,22 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
700 | }, | 700 | }, |
701 | { | 701 | { |
702 | .callback = intel_no_lvds_dmi_callback, | 702 | .callback = intel_no_lvds_dmi_callback, |
703 | .ident = "Intel D410PT", | ||
704 | .matches = { | ||
705 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), | ||
706 | DMI_MATCH(DMI_BOARD_NAME, "D410PT"), | ||
707 | }, | ||
708 | }, | ||
709 | { | ||
710 | .callback = intel_no_lvds_dmi_callback, | ||
711 | .ident = "Intel D425KT", | ||
712 | .matches = { | ||
713 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), | ||
714 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "D425KT"), | ||
715 | }, | ||
716 | }, | ||
717 | { | ||
718 | .callback = intel_no_lvds_dmi_callback, | ||
703 | .ident = "Intel D510MO", | 719 | .ident = "Intel D510MO", |
704 | .matches = { | 720 | .matches = { |
705 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), | 721 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index fe1de855775e..57fcc4b16a52 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -291,6 +291,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
291 | /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ | 291 | /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ |
292 | 292 | ||
293 | WREG32(HDMI_ACR_PACKET_CONTROL + offset, | 293 | WREG32(HDMI_ACR_PACKET_CONTROL + offset, |
294 | HDMI_ACR_SOURCE | /* select SW CTS value */ | ||
294 | HDMI_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ | 295 | HDMI_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ |
295 | 296 | ||
296 | evergreen_hdmi_update_ACR(encoder, mode->clock); | 297 | evergreen_hdmi_update_ACR(encoder, mode->clock); |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 71399065db04..b41905573cd2 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2635,7 +2635,7 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2635 | pi->caps_sclk_ds = true; | 2635 | pi->caps_sclk_ds = true; |
2636 | pi->enable_auto_thermal_throttling = true; | 2636 | pi->enable_auto_thermal_throttling = true; |
2637 | pi->disable_nb_ps3_in_battery = false; | 2637 | pi->disable_nb_ps3_in_battery = false; |
2638 | pi->bapm_enable = true; | 2638 | pi->bapm_enable = false; |
2639 | pi->voltage_drop_t = 0; | 2639 | pi->voltage_drop_t = 0; |
2640 | pi->caps_sclk_throttle_low_notification = false; | 2640 | pi->caps_sclk_throttle_low_notification = false; |
2641 | pi->caps_fps = false; /* true? */ | 2641 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index a400ac1c4147..24f4960f59ee 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1272,8 +1272,8 @@ struct radeon_blacklist_clocks | |||
1272 | struct radeon_clock_and_voltage_limits { | 1272 | struct radeon_clock_and_voltage_limits { |
1273 | u32 sclk; | 1273 | u32 sclk; |
1274 | u32 mclk; | 1274 | u32 mclk; |
1275 | u32 vddc; | 1275 | u16 vddc; |
1276 | u32 vddci; | 1276 | u16 vddci; |
1277 | }; | 1277 | }; |
1278 | 1278 | ||
1279 | struct radeon_clock_array { | 1279 | struct radeon_clock_array { |
diff --git a/drivers/input/input.c b/drivers/input/input.c index c04469928925..e75d015024a1 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1734,6 +1734,7 @@ EXPORT_SYMBOL_GPL(input_class); | |||
1734 | */ | 1734 | */ |
1735 | struct input_dev *input_allocate_device(void) | 1735 | struct input_dev *input_allocate_device(void) |
1736 | { | 1736 | { |
1737 | static atomic_t input_no = ATOMIC_INIT(0); | ||
1737 | struct input_dev *dev; | 1738 | struct input_dev *dev; |
1738 | 1739 | ||
1739 | dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); | 1740 | dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); |
@@ -1743,9 +1744,13 @@ struct input_dev *input_allocate_device(void) | |||
1743 | device_initialize(&dev->dev); | 1744 | device_initialize(&dev->dev); |
1744 | mutex_init(&dev->mutex); | 1745 | mutex_init(&dev->mutex); |
1745 | spin_lock_init(&dev->event_lock); | 1746 | spin_lock_init(&dev->event_lock); |
1747 | init_timer(&dev->timer); | ||
1746 | INIT_LIST_HEAD(&dev->h_list); | 1748 | INIT_LIST_HEAD(&dev->h_list); |
1747 | INIT_LIST_HEAD(&dev->node); | 1749 | INIT_LIST_HEAD(&dev->node); |
1748 | 1750 | ||
1751 | dev_set_name(&dev->dev, "input%ld", | ||
1752 | (unsigned long) atomic_inc_return(&input_no) - 1); | ||
1753 | |||
1749 | __module_get(THIS_MODULE); | 1754 | __module_get(THIS_MODULE); |
1750 | } | 1755 | } |
1751 | 1756 | ||
@@ -2019,7 +2024,6 @@ static void devm_input_device_unregister(struct device *dev, void *res) | |||
2019 | */ | 2024 | */ |
2020 | int input_register_device(struct input_dev *dev) | 2025 | int input_register_device(struct input_dev *dev) |
2021 | { | 2026 | { |
2022 | static atomic_t input_no = ATOMIC_INIT(0); | ||
2023 | struct input_devres *devres = NULL; | 2027 | struct input_devres *devres = NULL; |
2024 | struct input_handler *handler; | 2028 | struct input_handler *handler; |
2025 | unsigned int packet_size; | 2029 | unsigned int packet_size; |
@@ -2059,7 +2063,6 @@ int input_register_device(struct input_dev *dev) | |||
2059 | * If delay and period are pre-set by the driver, then autorepeating | 2063 | * If delay and period are pre-set by the driver, then autorepeating |
2060 | * is handled by the driver itself and we don't do it in input.c. | 2064 | * is handled by the driver itself and we don't do it in input.c. |
2061 | */ | 2065 | */ |
2062 | init_timer(&dev->timer); | ||
2063 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { | 2066 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { |
2064 | dev->timer.data = (long) dev; | 2067 | dev->timer.data = (long) dev; |
2065 | dev->timer.function = input_repeat_key; | 2068 | dev->timer.function = input_repeat_key; |
@@ -2073,9 +2076,6 @@ int input_register_device(struct input_dev *dev) | |||
2073 | if (!dev->setkeycode) | 2076 | if (!dev->setkeycode) |
2074 | dev->setkeycode = input_default_setkeycode; | 2077 | dev->setkeycode = input_default_setkeycode; |
2075 | 2078 | ||
2076 | dev_set_name(&dev->dev, "input%ld", | ||
2077 | (unsigned long) atomic_inc_return(&input_no) - 1); | ||
2078 | |||
2079 | error = device_add(&dev->dev); | 2079 | error = device_add(&dev->dev); |
2080 | if (error) | 2080 | if (error) |
2081 | goto err_free_vals; | 2081 | goto err_free_vals; |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 134c3b404a54..a2e758d27584 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -786,10 +786,17 @@ static int pxa27x_keypad_probe(struct platform_device *pdev) | |||
786 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | 786 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
787 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | 787 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); |
788 | 788 | ||
789 | if (pdata) | 789 | if (pdata) { |
790 | error = pxa27x_keypad_build_keycode(keypad); | 790 | error = pxa27x_keypad_build_keycode(keypad); |
791 | else | 791 | } else { |
792 | error = pxa27x_keypad_build_keycode_from_dt(keypad); | 792 | error = pxa27x_keypad_build_keycode_from_dt(keypad); |
793 | /* | ||
794 | * Data that we get from DT resides in dynamically | ||
795 | * allocated memory so we need to update our pdata | ||
796 | * pointer. | ||
797 | */ | ||
798 | pdata = keypad->pdata; | ||
799 | } | ||
793 | if (error) { | 800 | if (error) { |
794 | dev_err(&pdev->dev, "failed to build keycode\n"); | 801 | dev_err(&pdev->dev, "failed to build keycode\n"); |
795 | goto failed_put_clk; | 802 | goto failed_put_clk; |
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index 082684e7f390..9365535ba7f1 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c | |||
@@ -351,7 +351,9 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
351 | if (status) { | 351 | if (status) { |
352 | if (status == -ESHUTDOWN) | 352 | if (status == -ESHUTDOWN) |
353 | return; | 353 | return; |
354 | dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); | 354 | dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n", |
355 | __func__, status); | ||
356 | goto out; | ||
355 | } | 357 | } |
356 | 358 | ||
357 | /* Special keys */ | 359 | /* Special keys */ |
@@ -418,8 +420,12 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
418 | dev->ctl_data->byte[2], | 420 | dev->ctl_data->byte[2], |
419 | dev->ctl_data->byte[3]); | 421 | dev->ctl_data->byte[3]); |
420 | 422 | ||
421 | if (status) | 423 | if (status) { |
422 | dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); | 424 | if (status == -ESHUTDOWN) |
425 | return; | ||
426 | dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n", | ||
427 | __func__, status); | ||
428 | } | ||
423 | 429 | ||
424 | spin_lock(&dev->ctl_submit_lock); | 430 | spin_lock(&dev->ctl_submit_lock); |
425 | 431 | ||
@@ -427,7 +433,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
427 | 433 | ||
428 | if (likely(!dev->shutdown)) { | 434 | if (likely(!dev->shutdown)) { |
429 | 435 | ||
430 | if (dev->buzzer_pending) { | 436 | if (dev->buzzer_pending || status) { |
431 | dev->buzzer_pending = 0; | 437 | dev->buzzer_pending = 0; |
432 | dev->ctl_urb_pending = 1; | 438 | dev->ctl_urb_pending = 1; |
433 | cm109_submit_buzz_toggle(dev); | 439 | cm109_submit_buzz_toggle(dev); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 7c5d72a6a26a..83658472ad25 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -103,6 +103,7 @@ static const struct alps_model_info alps_model_data[] = { | |||
103 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ | 103 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ |
104 | { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, | 104 | { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, |
105 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, | 105 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, |
106 | { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_DUALPOINT }, /* Dell XT2 */ | ||
106 | { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ | 107 | { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ |
107 | { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, | 108 | { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, |
108 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ | 109 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 78e4de42efaa..52c9ebf94729 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -223,21 +223,26 @@ static int i8042_flush(void) | |||
223 | { | 223 | { |
224 | unsigned long flags; | 224 | unsigned long flags; |
225 | unsigned char data, str; | 225 | unsigned char data, str; |
226 | int i = 0; | 226 | int count = 0; |
227 | int retval = 0; | ||
227 | 228 | ||
228 | spin_lock_irqsave(&i8042_lock, flags); | 229 | spin_lock_irqsave(&i8042_lock, flags); |
229 | 230 | ||
230 | while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) { | 231 | while ((str = i8042_read_status()) & I8042_STR_OBF) { |
231 | udelay(50); | 232 | if (count++ < I8042_BUFFER_SIZE) { |
232 | data = i8042_read_data(); | 233 | udelay(50); |
233 | i++; | 234 | data = i8042_read_data(); |
234 | dbg("%02x <- i8042 (flush, %s)\n", | 235 | dbg("%02x <- i8042 (flush, %s)\n", |
235 | data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); | 236 | data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); |
237 | } else { | ||
238 | retval = -EIO; | ||
239 | break; | ||
240 | } | ||
236 | } | 241 | } |
237 | 242 | ||
238 | spin_unlock_irqrestore(&i8042_lock, flags); | 243 | spin_unlock_irqrestore(&i8042_lock, flags); |
239 | 244 | ||
240 | return i; | 245 | return retval; |
241 | } | 246 | } |
242 | 247 | ||
243 | /* | 248 | /* |
@@ -849,7 +854,7 @@ static int __init i8042_check_aux(void) | |||
849 | 854 | ||
850 | static int i8042_controller_check(void) | 855 | static int i8042_controller_check(void) |
851 | { | 856 | { |
852 | if (i8042_flush() == I8042_BUFFER_SIZE) { | 857 | if (i8042_flush()) { |
853 | pr_err("No controller found\n"); | 858 | pr_err("No controller found\n"); |
854 | return -ENODEV; | 859 | return -ENODEV; |
855 | } | 860 | } |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 79b69ea47f74..e53416a4d7f3 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -1031,6 +1031,7 @@ static void wacom_destroy_leds(struct wacom *wacom) | |||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static enum power_supply_property wacom_battery_props[] = { | 1033 | static enum power_supply_property wacom_battery_props[] = { |
1034 | POWER_SUPPLY_PROP_SCOPE, | ||
1034 | POWER_SUPPLY_PROP_CAPACITY | 1035 | POWER_SUPPLY_PROP_CAPACITY |
1035 | }; | 1036 | }; |
1036 | 1037 | ||
@@ -1042,6 +1043,9 @@ static int wacom_battery_get_property(struct power_supply *psy, | |||
1042 | int ret = 0; | 1043 | int ret = 0; |
1043 | 1044 | ||
1044 | switch (psp) { | 1045 | switch (psp) { |
1046 | case POWER_SUPPLY_PROP_SCOPE: | ||
1047 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; | ||
1048 | break; | ||
1045 | case POWER_SUPPLY_PROP_CAPACITY: | 1049 | case POWER_SUPPLY_PROP_CAPACITY: |
1046 | val->intval = | 1050 | val->intval = |
1047 | wacom->wacom_wac.battery_capacity * 100 / 31; | 1051 | wacom->wacom_wac.battery_capacity * 100 / 31; |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index b2aa503c16b1..c59b797eeafa 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -2054,6 +2054,12 @@ static const struct wacom_features wacom_features_0x101 = | |||
2054 | static const struct wacom_features wacom_features_0x10D = | 2054 | static const struct wacom_features wacom_features_0x10D = |
2055 | { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2055 | { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2056 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2056 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
2057 | static const struct wacom_features wacom_features_0x10E = | ||
2058 | { "Wacom ISDv4 10E", WACOM_PKGLEN_MTTPC, 27760, 15694, 255, | ||
2059 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2060 | static const struct wacom_features wacom_features_0x10F = | ||
2061 | { "Wacom ISDv4 10F", WACOM_PKGLEN_MTTPC, 27760, 15694, 255, | ||
2062 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2057 | static const struct wacom_features wacom_features_0x4001 = | 2063 | static const struct wacom_features wacom_features_0x4001 = |
2058 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2064 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2059 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2065 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -2248,6 +2254,8 @@ const struct usb_device_id wacom_ids[] = { | |||
2248 | { USB_DEVICE_WACOM(0x100) }, | 2254 | { USB_DEVICE_WACOM(0x100) }, |
2249 | { USB_DEVICE_WACOM(0x101) }, | 2255 | { USB_DEVICE_WACOM(0x101) }, |
2250 | { USB_DEVICE_WACOM(0x10D) }, | 2256 | { USB_DEVICE_WACOM(0x10D) }, |
2257 | { USB_DEVICE_WACOM(0x10E) }, | ||
2258 | { USB_DEVICE_WACOM(0x10F) }, | ||
2251 | { USB_DEVICE_WACOM(0x300) }, | 2259 | { USB_DEVICE_WACOM(0x300) }, |
2252 | { USB_DEVICE_WACOM(0x301) }, | 2260 | { USB_DEVICE_WACOM(0x301) }, |
2253 | { USB_DEVICE_WACOM(0x304) }, | 2261 | { USB_DEVICE_WACOM(0x304) }, |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index be12fbfcae10..1ea75236a15f 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -552,9 +552,8 @@ static void __ref enable_slot(struct acpiphp_slot *slot) | |||
552 | struct acpiphp_func *func; | 552 | struct acpiphp_func *func; |
553 | int max, pass; | 553 | int max, pass; |
554 | LIST_HEAD(add_list); | 554 | LIST_HEAD(add_list); |
555 | int nr_found; | ||
556 | 555 | ||
557 | nr_found = acpiphp_rescan_slot(slot); | 556 | acpiphp_rescan_slot(slot); |
558 | max = acpiphp_max_busnr(bus); | 557 | max = acpiphp_max_busnr(bus); |
559 | for (pass = 0; pass < 2; pass++) { | 558 | for (pass = 0; pass < 2; pass++) { |
560 | list_for_each_entry(dev, &bus->devices, bus_list) { | 559 | list_for_each_entry(dev, &bus->devices, bus_list) { |
@@ -574,9 +573,6 @@ static void __ref enable_slot(struct acpiphp_slot *slot) | |||
574 | } | 573 | } |
575 | } | 574 | } |
576 | __pci_bus_assign_resources(bus, &add_list, NULL); | 575 | __pci_bus_assign_resources(bus, &add_list, NULL); |
577 | /* Nothing more to do here if there are no new devices on this bus. */ | ||
578 | if (!nr_found && (slot->flags & SLOT_ENABLED)) | ||
579 | return; | ||
580 | 576 | ||
581 | acpiphp_sanitize_bus(bus); | 577 | acpiphp_sanitize_bus(bus); |
582 | acpiphp_set_hpp_values(bus); | 578 | acpiphp_set_hpp_values(bus); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 408a42ef787a..f0d432c139d0 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -771,6 +771,8 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long | |||
771 | static int aac_compat_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) | 771 | static int aac_compat_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) |
772 | { | 772 | { |
773 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; | 773 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; |
774 | if (!capable(CAP_SYS_RAWIO)) | ||
775 | return -EPERM; | ||
774 | return aac_compat_do_ioctl(dev, cmd, (unsigned long)arg); | 776 | return aac_compat_do_ioctl(dev, cmd, (unsigned long)arg); |
775 | } | 777 | } |
776 | 778 | ||
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 5cbc4bb1b395..df5e961484e1 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -105,8 +105,11 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ; | |||
105 | static int sg_add(struct device *, struct class_interface *); | 105 | static int sg_add(struct device *, struct class_interface *); |
106 | static void sg_remove(struct device *, struct class_interface *); | 106 | static void sg_remove(struct device *, struct class_interface *); |
107 | 107 | ||
108 | static DEFINE_SPINLOCK(sg_open_exclusive_lock); | ||
109 | |||
108 | static DEFINE_IDR(sg_index_idr); | 110 | static DEFINE_IDR(sg_index_idr); |
109 | static DEFINE_RWLOCK(sg_index_lock); | 111 | static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock |
112 | file descriptor list for device */ | ||
110 | 113 | ||
111 | static struct class_interface sg_interface = { | 114 | static struct class_interface sg_interface = { |
112 | .add_dev = sg_add, | 115 | .add_dev = sg_add, |
@@ -143,7 +146,8 @@ typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */ | |||
143 | } Sg_request; | 146 | } Sg_request; |
144 | 147 | ||
145 | typedef struct sg_fd { /* holds the state of a file descriptor */ | 148 | typedef struct sg_fd { /* holds the state of a file descriptor */ |
146 | struct list_head sfd_siblings; /* protected by sfd_lock of device */ | 149 | /* sfd_siblings is protected by sg_index_lock */ |
150 | struct list_head sfd_siblings; | ||
147 | struct sg_device *parentdp; /* owning device */ | 151 | struct sg_device *parentdp; /* owning device */ |
148 | wait_queue_head_t read_wait; /* queue read until command done */ | 152 | wait_queue_head_t read_wait; /* queue read until command done */ |
149 | rwlock_t rq_list_lock; /* protect access to list in req_arr */ | 153 | rwlock_t rq_list_lock; /* protect access to list in req_arr */ |
@@ -166,12 +170,13 @@ typedef struct sg_fd { /* holds the state of a file descriptor */ | |||
166 | 170 | ||
167 | typedef struct sg_device { /* holds the state of each scsi generic device */ | 171 | typedef struct sg_device { /* holds the state of each scsi generic device */ |
168 | struct scsi_device *device; | 172 | struct scsi_device *device; |
173 | wait_queue_head_t o_excl_wait; /* queue open() when O_EXCL in use */ | ||
169 | int sg_tablesize; /* adapter's max scatter-gather table size */ | 174 | int sg_tablesize; /* adapter's max scatter-gather table size */ |
170 | u32 index; /* device index number */ | 175 | u32 index; /* device index number */ |
171 | spinlock_t sfd_lock; /* protect file descriptor list for device */ | 176 | /* sfds is protected by sg_index_lock */ |
172 | struct list_head sfds; | 177 | struct list_head sfds; |
173 | struct rw_semaphore o_sem; /* exclude open should hold this rwsem */ | ||
174 | volatile char detached; /* 0->attached, 1->detached pending removal */ | 178 | volatile char detached; /* 0->attached, 1->detached pending removal */ |
179 | /* exclude protected by sg_open_exclusive_lock */ | ||
175 | char exclude; /* opened for exclusive access */ | 180 | char exclude; /* opened for exclusive access */ |
176 | char sgdebug; /* 0->off, 1->sense, 9->dump dev, 10-> all devs */ | 181 | char sgdebug; /* 0->off, 1->sense, 9->dump dev, 10-> all devs */ |
177 | struct gendisk *disk; | 182 | struct gendisk *disk; |
@@ -220,14 +225,35 @@ static int sg_allow_access(struct file *filp, unsigned char *cmd) | |||
220 | return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE); | 225 | return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE); |
221 | } | 226 | } |
222 | 227 | ||
228 | static int get_exclude(Sg_device *sdp) | ||
229 | { | ||
230 | unsigned long flags; | ||
231 | int ret; | ||
232 | |||
233 | spin_lock_irqsave(&sg_open_exclusive_lock, flags); | ||
234 | ret = sdp->exclude; | ||
235 | spin_unlock_irqrestore(&sg_open_exclusive_lock, flags); | ||
236 | return ret; | ||
237 | } | ||
238 | |||
239 | static int set_exclude(Sg_device *sdp, char val) | ||
240 | { | ||
241 | unsigned long flags; | ||
242 | |||
243 | spin_lock_irqsave(&sg_open_exclusive_lock, flags); | ||
244 | sdp->exclude = val; | ||
245 | spin_unlock_irqrestore(&sg_open_exclusive_lock, flags); | ||
246 | return val; | ||
247 | } | ||
248 | |||
223 | static int sfds_list_empty(Sg_device *sdp) | 249 | static int sfds_list_empty(Sg_device *sdp) |
224 | { | 250 | { |
225 | unsigned long flags; | 251 | unsigned long flags; |
226 | int ret; | 252 | int ret; |
227 | 253 | ||
228 | spin_lock_irqsave(&sdp->sfd_lock, flags); | 254 | read_lock_irqsave(&sg_index_lock, flags); |
229 | ret = list_empty(&sdp->sfds); | 255 | ret = list_empty(&sdp->sfds); |
230 | spin_unlock_irqrestore(&sdp->sfd_lock, flags); | 256 | read_unlock_irqrestore(&sg_index_lock, flags); |
231 | return ret; | 257 | return ret; |
232 | } | 258 | } |
233 | 259 | ||
@@ -239,6 +265,7 @@ sg_open(struct inode *inode, struct file *filp) | |||
239 | struct request_queue *q; | 265 | struct request_queue *q; |
240 | Sg_device *sdp; | 266 | Sg_device *sdp; |
241 | Sg_fd *sfp; | 267 | Sg_fd *sfp; |
268 | int res; | ||
242 | int retval; | 269 | int retval; |
243 | 270 | ||
244 | nonseekable_open(inode, filp); | 271 | nonseekable_open(inode, filp); |
@@ -267,52 +294,54 @@ sg_open(struct inode *inode, struct file *filp) | |||
267 | goto error_out; | 294 | goto error_out; |
268 | } | 295 | } |
269 | 296 | ||
270 | if ((flags & O_EXCL) && (O_RDONLY == (flags & O_ACCMODE))) { | 297 | if (flags & O_EXCL) { |
271 | retval = -EPERM; /* Can't lock it with read only access */ | 298 | if (O_RDONLY == (flags & O_ACCMODE)) { |
272 | goto error_out; | 299 | retval = -EPERM; /* Can't lock it with read only access */ |
273 | } | 300 | goto error_out; |
274 | if (flags & O_NONBLOCK) { | 301 | } |
275 | if (flags & O_EXCL) { | 302 | if (!sfds_list_empty(sdp) && (flags & O_NONBLOCK)) { |
276 | if (!down_write_trylock(&sdp->o_sem)) { | 303 | retval = -EBUSY; |
277 | retval = -EBUSY; | 304 | goto error_out; |
278 | goto error_out; | 305 | } |
279 | } | 306 | res = wait_event_interruptible(sdp->o_excl_wait, |
280 | } else { | 307 | ((!sfds_list_empty(sdp) || get_exclude(sdp)) ? 0 : set_exclude(sdp, 1))); |
281 | if (!down_read_trylock(&sdp->o_sem)) { | 308 | if (res) { |
282 | retval = -EBUSY; | 309 | retval = res; /* -ERESTARTSYS because signal hit process */ |
283 | goto error_out; | 310 | goto error_out; |
284 | } | 311 | } |
312 | } else if (get_exclude(sdp)) { /* some other fd has an exclusive lock on dev */ | ||
313 | if (flags & O_NONBLOCK) { | ||
314 | retval = -EBUSY; | ||
315 | goto error_out; | ||
316 | } | ||
317 | res = wait_event_interruptible(sdp->o_excl_wait, !get_exclude(sdp)); | ||
318 | if (res) { | ||
319 | retval = res; /* -ERESTARTSYS because signal hit process */ | ||
320 | goto error_out; | ||
285 | } | 321 | } |
286 | } else { | ||
287 | if (flags & O_EXCL) | ||
288 | down_write(&sdp->o_sem); | ||
289 | else | ||
290 | down_read(&sdp->o_sem); | ||
291 | } | 322 | } |
292 | /* Since write lock is held, no need to check sfd_list */ | 323 | if (sdp->detached) { |
293 | if (flags & O_EXCL) | 324 | retval = -ENODEV; |
294 | sdp->exclude = 1; /* used by release lock */ | 325 | goto error_out; |
295 | 326 | } | |
296 | if (sfds_list_empty(sdp)) { /* no existing opens on this device */ | 327 | if (sfds_list_empty(sdp)) { /* no existing opens on this device */ |
297 | sdp->sgdebug = 0; | 328 | sdp->sgdebug = 0; |
298 | q = sdp->device->request_queue; | 329 | q = sdp->device->request_queue; |
299 | sdp->sg_tablesize = queue_max_segments(q); | 330 | sdp->sg_tablesize = queue_max_segments(q); |
300 | } | 331 | } |
301 | sfp = sg_add_sfp(sdp, dev); | 332 | if ((sfp = sg_add_sfp(sdp, dev))) |
302 | if (!IS_ERR(sfp)) | ||
303 | filp->private_data = sfp; | 333 | filp->private_data = sfp; |
304 | /* retval is already provably zero at this point because of the | ||
305 | * check after retval = scsi_autopm_get_device(sdp->device)) | ||
306 | */ | ||
307 | else { | 334 | else { |
308 | retval = PTR_ERR(sfp); | ||
309 | |||
310 | if (flags & O_EXCL) { | 335 | if (flags & O_EXCL) { |
311 | sdp->exclude = 0; /* undo if error */ | 336 | set_exclude(sdp, 0); /* undo if error */ |
312 | up_write(&sdp->o_sem); | 337 | wake_up_interruptible(&sdp->o_excl_wait); |
313 | } else | 338 | } |
314 | up_read(&sdp->o_sem); | 339 | retval = -ENOMEM; |
340 | goto error_out; | ||
341 | } | ||
342 | retval = 0; | ||
315 | error_out: | 343 | error_out: |
344 | if (retval) { | ||
316 | scsi_autopm_put_device(sdp->device); | 345 | scsi_autopm_put_device(sdp->device); |
317 | sdp_put: | 346 | sdp_put: |
318 | scsi_device_put(sdp->device); | 347 | scsi_device_put(sdp->device); |
@@ -329,18 +358,13 @@ sg_release(struct inode *inode, struct file *filp) | |||
329 | { | 358 | { |
330 | Sg_device *sdp; | 359 | Sg_device *sdp; |
331 | Sg_fd *sfp; | 360 | Sg_fd *sfp; |
332 | int excl; | ||
333 | 361 | ||
334 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) | 362 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) |
335 | return -ENXIO; | 363 | return -ENXIO; |
336 | SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name)); | 364 | SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name)); |
337 | 365 | ||
338 | excl = sdp->exclude; | 366 | set_exclude(sdp, 0); |
339 | sdp->exclude = 0; | 367 | wake_up_interruptible(&sdp->o_excl_wait); |
340 | if (excl) | ||
341 | up_write(&sdp->o_sem); | ||
342 | else | ||
343 | up_read(&sdp->o_sem); | ||
344 | 368 | ||
345 | scsi_autopm_put_device(sdp->device); | 369 | scsi_autopm_put_device(sdp->device); |
346 | kref_put(&sfp->f_ref, sg_remove_sfp); | 370 | kref_put(&sfp->f_ref, sg_remove_sfp); |
@@ -1391,9 +1415,8 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) | |||
1391 | disk->first_minor = k; | 1415 | disk->first_minor = k; |
1392 | sdp->disk = disk; | 1416 | sdp->disk = disk; |
1393 | sdp->device = scsidp; | 1417 | sdp->device = scsidp; |
1394 | spin_lock_init(&sdp->sfd_lock); | ||
1395 | INIT_LIST_HEAD(&sdp->sfds); | 1418 | INIT_LIST_HEAD(&sdp->sfds); |
1396 | init_rwsem(&sdp->o_sem); | 1419 | init_waitqueue_head(&sdp->o_excl_wait); |
1397 | sdp->sg_tablesize = queue_max_segments(q); | 1420 | sdp->sg_tablesize = queue_max_segments(q); |
1398 | sdp->index = k; | 1421 | sdp->index = k; |
1399 | kref_init(&sdp->d_ref); | 1422 | kref_init(&sdp->d_ref); |
@@ -1526,13 +1549,11 @@ static void sg_remove(struct device *cl_dev, struct class_interface *cl_intf) | |||
1526 | 1549 | ||
1527 | /* Need a write lock to set sdp->detached. */ | 1550 | /* Need a write lock to set sdp->detached. */ |
1528 | write_lock_irqsave(&sg_index_lock, iflags); | 1551 | write_lock_irqsave(&sg_index_lock, iflags); |
1529 | spin_lock(&sdp->sfd_lock); | ||
1530 | sdp->detached = 1; | 1552 | sdp->detached = 1; |
1531 | list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) { | 1553 | list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) { |
1532 | wake_up_interruptible(&sfp->read_wait); | 1554 | wake_up_interruptible(&sfp->read_wait); |
1533 | kill_fasync(&sfp->async_qp, SIGPOLL, POLL_HUP); | 1555 | kill_fasync(&sfp->async_qp, SIGPOLL, POLL_HUP); |
1534 | } | 1556 | } |
1535 | spin_unlock(&sdp->sfd_lock); | ||
1536 | write_unlock_irqrestore(&sg_index_lock, iflags); | 1557 | write_unlock_irqrestore(&sg_index_lock, iflags); |
1537 | 1558 | ||
1538 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); | 1559 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); |
@@ -2043,7 +2064,7 @@ sg_add_sfp(Sg_device * sdp, int dev) | |||
2043 | 2064 | ||
2044 | sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN); | 2065 | sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN); |
2045 | if (!sfp) | 2066 | if (!sfp) |
2046 | return ERR_PTR(-ENOMEM); | 2067 | return NULL; |
2047 | 2068 | ||
2048 | init_waitqueue_head(&sfp->read_wait); | 2069 | init_waitqueue_head(&sfp->read_wait); |
2049 | rwlock_init(&sfp->rq_list_lock); | 2070 | rwlock_init(&sfp->rq_list_lock); |
@@ -2057,13 +2078,9 @@ sg_add_sfp(Sg_device * sdp, int dev) | |||
2057 | sfp->cmd_q = SG_DEF_COMMAND_Q; | 2078 | sfp->cmd_q = SG_DEF_COMMAND_Q; |
2058 | sfp->keep_orphan = SG_DEF_KEEP_ORPHAN; | 2079 | sfp->keep_orphan = SG_DEF_KEEP_ORPHAN; |
2059 | sfp->parentdp = sdp; | 2080 | sfp->parentdp = sdp; |
2060 | spin_lock_irqsave(&sdp->sfd_lock, iflags); | 2081 | write_lock_irqsave(&sg_index_lock, iflags); |
2061 | if (sdp->detached) { | ||
2062 | spin_unlock_irqrestore(&sdp->sfd_lock, iflags); | ||
2063 | return ERR_PTR(-ENODEV); | ||
2064 | } | ||
2065 | list_add_tail(&sfp->sfd_siblings, &sdp->sfds); | 2082 | list_add_tail(&sfp->sfd_siblings, &sdp->sfds); |
2066 | spin_unlock_irqrestore(&sdp->sfd_lock, iflags); | 2083 | write_unlock_irqrestore(&sg_index_lock, iflags); |
2067 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp)); | 2084 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp)); |
2068 | if (unlikely(sg_big_buff != def_reserved_size)) | 2085 | if (unlikely(sg_big_buff != def_reserved_size)) |
2069 | sg_big_buff = def_reserved_size; | 2086 | sg_big_buff = def_reserved_size; |
@@ -2113,9 +2130,10 @@ static void sg_remove_sfp(struct kref *kref) | |||
2113 | struct sg_device *sdp = sfp->parentdp; | 2130 | struct sg_device *sdp = sfp->parentdp; |
2114 | unsigned long iflags; | 2131 | unsigned long iflags; |
2115 | 2132 | ||
2116 | spin_lock_irqsave(&sdp->sfd_lock, iflags); | 2133 | write_lock_irqsave(&sg_index_lock, iflags); |
2117 | list_del(&sfp->sfd_siblings); | 2134 | list_del(&sfp->sfd_siblings); |
2118 | spin_unlock_irqrestore(&sdp->sfd_lock, iflags); | 2135 | write_unlock_irqrestore(&sg_index_lock, iflags); |
2136 | wake_up_interruptible(&sdp->o_excl_wait); | ||
2119 | 2137 | ||
2120 | INIT_WORK(&sfp->ew.work, sg_remove_sfp_usercontext); | 2138 | INIT_WORK(&sfp->ew.work, sg_remove_sfp_usercontext); |
2121 | schedule_work(&sfp->ew.work); | 2139 | schedule_work(&sfp->ew.work); |
@@ -2502,7 +2520,7 @@ static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v) | |||
2502 | return 0; | 2520 | return 0; |
2503 | } | 2521 | } |
2504 | 2522 | ||
2505 | /* must be called while holding sg_index_lock and sfd_lock */ | 2523 | /* must be called while holding sg_index_lock */ |
2506 | static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp) | 2524 | static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp) |
2507 | { | 2525 | { |
2508 | int k, m, new_interface, blen, usg; | 2526 | int k, m, new_interface, blen, usg; |
@@ -2587,26 +2605,22 @@ static int sg_proc_seq_show_debug(struct seq_file *s, void *v) | |||
2587 | 2605 | ||
2588 | read_lock_irqsave(&sg_index_lock, iflags); | 2606 | read_lock_irqsave(&sg_index_lock, iflags); |
2589 | sdp = it ? sg_lookup_dev(it->index) : NULL; | 2607 | sdp = it ? sg_lookup_dev(it->index) : NULL; |
2590 | if (sdp) { | 2608 | if (sdp && !list_empty(&sdp->sfds)) { |
2591 | spin_lock(&sdp->sfd_lock); | 2609 | struct scsi_device *scsidp = sdp->device; |
2592 | if (!list_empty(&sdp->sfds)) { | ||
2593 | struct scsi_device *scsidp = sdp->device; | ||
2594 | 2610 | ||
2595 | seq_printf(s, " >>> device=%s ", sdp->disk->disk_name); | 2611 | seq_printf(s, " >>> device=%s ", sdp->disk->disk_name); |
2596 | if (sdp->detached) | 2612 | if (sdp->detached) |
2597 | seq_printf(s, "detached pending close "); | 2613 | seq_printf(s, "detached pending close "); |
2598 | else | 2614 | else |
2599 | seq_printf | 2615 | seq_printf |
2600 | (s, "scsi%d chan=%d id=%d lun=%d em=%d", | 2616 | (s, "scsi%d chan=%d id=%d lun=%d em=%d", |
2601 | scsidp->host->host_no, | 2617 | scsidp->host->host_no, |
2602 | scsidp->channel, scsidp->id, | 2618 | scsidp->channel, scsidp->id, |
2603 | scsidp->lun, | 2619 | scsidp->lun, |
2604 | scsidp->host->hostt->emulated); | 2620 | scsidp->host->hostt->emulated); |
2605 | seq_printf(s, " sg_tablesize=%d excl=%d\n", | 2621 | seq_printf(s, " sg_tablesize=%d excl=%d\n", |
2606 | sdp->sg_tablesize, sdp->exclude); | 2622 | sdp->sg_tablesize, get_exclude(sdp)); |
2607 | sg_proc_debug_helper(s, sdp); | 2623 | sg_proc_debug_helper(s, sdp); |
2608 | } | ||
2609 | spin_unlock(&sdp->sfd_lock); | ||
2610 | } | 2624 | } |
2611 | read_unlock_irqrestore(&sg_index_lock, iflags); | 2625 | read_unlock_irqrestore(&sg_index_lock, iflags); |
2612 | return 0; | 2626 | return 0; |
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index f91bc1fdd895..639ba96adb36 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c | |||
@@ -1960,6 +1960,7 @@ cntrlEnd: | |||
1960 | 1960 | ||
1961 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); | 1961 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); |
1962 | 1962 | ||
1963 | memset(&DevInfo, 0, sizeof(DevInfo)); | ||
1963 | DevInfo.MaxRDMBufferSize = BUFFER_4K; | 1964 | DevInfo.MaxRDMBufferSize = BUFFER_4K; |
1964 | DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; | 1965 | DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; |
1965 | DevInfo.u32RxAlignmentCorrection = 0; | 1966 | DevInfo.u32RxAlignmentCorrection = 0; |
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 6ccb64fb0786..6ce0af9977d8 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c | |||
@@ -155,6 +155,9 @@ static ssize_t oz_cdev_write(struct file *filp, const char __user *buf, | |||
155 | struct oz_app_hdr *app_hdr; | 155 | struct oz_app_hdr *app_hdr; |
156 | struct oz_serial_ctx *ctx; | 156 | struct oz_serial_ctx *ctx; |
157 | 157 | ||
158 | if (count > sizeof(ei->data) - sizeof(*elt) - sizeof(*app_hdr)) | ||
159 | return -EINVAL; | ||
160 | |||
158 | spin_lock_bh(&g_cdev.lock); | 161 | spin_lock_bh(&g_cdev.lock); |
159 | pd = g_cdev.active_pd; | 162 | pd = g_cdev.active_pd; |
160 | if (pd) | 163 | if (pd) |
diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c index 23db32f07fd5..a10cdb17038b 100644 --- a/drivers/staging/sb105x/sb_pci_mp.c +++ b/drivers/staging/sb105x/sb_pci_mp.c | |||
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) | |||
1063 | 1063 | ||
1064 | static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) | 1064 | static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) |
1065 | { | 1065 | { |
1066 | struct serial_icounter_struct icount; | 1066 | struct serial_icounter_struct icount = {}; |
1067 | struct sb_uart_icount cnow; | 1067 | struct sb_uart_icount cnow; |
1068 | struct sb_uart_port *port = state->port; | 1068 | struct sb_uart_port *port = state->port; |
1069 | 1069 | ||
diff --git a/drivers/staging/wlags49_h2/wl_priv.c b/drivers/staging/wlags49_h2/wl_priv.c index c97e0e154d28..7e10dcdc3090 100644 --- a/drivers/staging/wlags49_h2/wl_priv.c +++ b/drivers/staging/wlags49_h2/wl_priv.c | |||
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) | |||
570 | ltv_t *pLtv; | 570 | ltv_t *pLtv; |
571 | bool_t ltvAllocated = FALSE; | 571 | bool_t ltvAllocated = FALSE; |
572 | ENCSTRCT sEncryption; | 572 | ENCSTRCT sEncryption; |
573 | size_t len; | ||
573 | 574 | ||
574 | #ifdef USE_WDS | 575 | #ifdef USE_WDS |
575 | hcf_16 hcfPort = HCF_PORT_0; | 576 | hcf_16 hcfPort = HCF_PORT_0; |
@@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) | |||
686 | break; | 687 | break; |
687 | case CFG_CNF_OWN_NAME: | 688 | case CFG_CNF_OWN_NAME: |
688 | memset(lp->StationName, 0, sizeof(lp->StationName)); | 689 | memset(lp->StationName, 0, sizeof(lp->StationName)); |
689 | memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); | 690 | len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); |
691 | strlcpy(lp->StationName, &pLtv->u.u8[2], len); | ||
690 | pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); | 692 | pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); |
691 | break; | 693 | break; |
692 | case CFG_CNF_LOAD_BALANCING: | 694 | case CFG_CNF_LOAD_BALANCING: |
@@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, | |||
1783 | { | 1785 | { |
1784 | struct wl_private *lp = wl_priv(dev); | 1786 | struct wl_private *lp = wl_priv(dev); |
1785 | unsigned long flags; | 1787 | unsigned long flags; |
1788 | size_t len; | ||
1786 | int ret = 0; | 1789 | int ret = 0; |
1787 | /*------------------------------------------------------------------------*/ | 1790 | /*------------------------------------------------------------------------*/ |
1788 | 1791 | ||
@@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, | |||
1793 | wl_lock(lp, &flags); | 1796 | wl_lock(lp, &flags); |
1794 | 1797 | ||
1795 | memset(lp->StationName, 0, sizeof(lp->StationName)); | 1798 | memset(lp->StationName, 0, sizeof(lp->StationName)); |
1796 | 1799 | len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); | |
1797 | memcpy(lp->StationName, extra, wrqu->data.length); | 1800 | strlcpy(lp->StationName, extra, len); |
1798 | 1801 | ||
1799 | /* Commit the adapter parameters */ | 1802 | /* Commit the adapter parameters */ |
1800 | wl_apply(lp); | 1803 | wl_apply(lp); |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index d067285a2d20..6b0f75eac8a2 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -1499,7 +1499,7 @@ static void atmel_set_ops(struct uart_port *port) | |||
1499 | /* | 1499 | /* |
1500 | * Get ip name usart or uart | 1500 | * Get ip name usart or uart |
1501 | */ | 1501 | */ |
1502 | static int atmel_get_ip_name(struct uart_port *port) | 1502 | static void atmel_get_ip_name(struct uart_port *port) |
1503 | { | 1503 | { |
1504 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 1504 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
1505 | int name = UART_GET_IP_NAME(port); | 1505 | int name = UART_GET_IP_NAME(port); |
@@ -1518,10 +1518,7 @@ static int atmel_get_ip_name(struct uart_port *port) | |||
1518 | atmel_port->is_usart = false; | 1518 | atmel_port->is_usart = false; |
1519 | } else { | 1519 | } else { |
1520 | dev_err(port->dev, "Not supported ip name, set to uart\n"); | 1520 | dev_err(port->dev, "Not supported ip name, set to uart\n"); |
1521 | return -EINVAL; | ||
1522 | } | 1521 | } |
1523 | |||
1524 | return 0; | ||
1525 | } | 1522 | } |
1526 | 1523 | ||
1527 | /* | 1524 | /* |
@@ -2405,9 +2402,7 @@ static int atmel_serial_probe(struct platform_device *pdev) | |||
2405 | /* | 2402 | /* |
2406 | * Get port name of usart or uart | 2403 | * Get port name of usart or uart |
2407 | */ | 2404 | */ |
2408 | ret = atmel_get_ip_name(&port->uart); | 2405 | atmel_get_ip_name(&port->uart); |
2409 | if (ret < 0) | ||
2410 | goto err_add_port; | ||
2411 | 2406 | ||
2412 | return 0; | 2407 | return 0; |
2413 | 2408 | ||
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index ba475632c5fa..0e808cf91d97 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -642,16 +642,29 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
642 | { | 642 | { |
643 | struct uio_device *idev = vma->vm_private_data; | 643 | struct uio_device *idev = vma->vm_private_data; |
644 | int mi = uio_find_mem_index(vma); | 644 | int mi = uio_find_mem_index(vma); |
645 | struct uio_mem *mem; | ||
645 | if (mi < 0) | 646 | if (mi < 0) |
646 | return -EINVAL; | 647 | return -EINVAL; |
648 | mem = idev->info->mem + mi; | ||
647 | 649 | ||
648 | vma->vm_ops = &uio_physical_vm_ops; | 650 | if (vma->vm_end - vma->vm_start > mem->size) |
651 | return -EINVAL; | ||
649 | 652 | ||
653 | vma->vm_ops = &uio_physical_vm_ops; | ||
650 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 654 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
651 | 655 | ||
656 | /* | ||
657 | * We cannot use the vm_iomap_memory() helper here, | ||
658 | * because vma->vm_pgoff is the map index we looked | ||
659 | * up above in uio_find_mem_index(), rather than an | ||
660 | * actual page offset into the mmap. | ||
661 | * | ||
662 | * So we just do the physical mmap without a page | ||
663 | * offset. | ||
664 | */ | ||
652 | return remap_pfn_range(vma, | 665 | return remap_pfn_range(vma, |
653 | vma->vm_start, | 666 | vma->vm_start, |
654 | idev->info->mem[mi].addr >> PAGE_SHIFT, | 667 | mem->addr >> PAGE_SHIFT, |
655 | vma->vm_end - vma->vm_start, | 668 | vma->vm_end - vma->vm_start, |
656 | vma->vm_page_prot); | 669 | vma->vm_page_prot); |
657 | } | 670 | } |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index a54ccdc4d661..22ad85242e5b 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -361,37 +361,13 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle) | |||
361 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) | 361 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) |
362 | { | 362 | { |
363 | struct au1100fb_device *fbdev; | 363 | struct au1100fb_device *fbdev; |
364 | unsigned int len; | ||
365 | unsigned long start=0, off; | ||
366 | 364 | ||
367 | fbdev = to_au1100fb_device(fbi); | 365 | fbdev = to_au1100fb_device(fbi); |
368 | 366 | ||
369 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { | ||
370 | return -EINVAL; | ||
371 | } | ||
372 | |||
373 | start = fbdev->fb_phys & PAGE_MASK; | ||
374 | len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len); | ||
375 | |||
376 | off = vma->vm_pgoff << PAGE_SHIFT; | ||
377 | |||
378 | if ((vma->vm_end - vma->vm_start + off) > len) { | ||
379 | return -EINVAL; | ||
380 | } | ||
381 | |||
382 | off += start; | ||
383 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
384 | |||
385 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 367 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
386 | pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6 | 368 | pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6 |
387 | 369 | ||
388 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 370 | return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len); |
389 | vma->vm_end - vma->vm_start, | ||
390 | vma->vm_page_prot)) { | ||
391 | return -EAGAIN; | ||
392 | } | ||
393 | |||
394 | return 0; | ||
395 | } | 371 | } |
396 | 372 | ||
397 | static struct fb_ops au1100fb_ops = | 373 | static struct fb_ops au1100fb_ops = |
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 301224ecc950..1d02897d17f2 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c | |||
@@ -1233,34 +1233,13 @@ static int au1200fb_fb_blank(int blank_mode, struct fb_info *fbi) | |||
1233 | * method mainly to allow the use of the TLB streaming flag (CCA=6) | 1233 | * method mainly to allow the use of the TLB streaming flag (CCA=6) |
1234 | */ | 1234 | */ |
1235 | static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | 1235 | static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
1236 | |||
1237 | { | 1236 | { |
1238 | unsigned int len; | ||
1239 | unsigned long start=0, off; | ||
1240 | struct au1200fb_device *fbdev = info->par; | 1237 | struct au1200fb_device *fbdev = info->par; |
1241 | 1238 | ||
1242 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { | ||
1243 | return -EINVAL; | ||
1244 | } | ||
1245 | |||
1246 | start = fbdev->fb_phys & PAGE_MASK; | ||
1247 | len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len); | ||
1248 | |||
1249 | off = vma->vm_pgoff << PAGE_SHIFT; | ||
1250 | |||
1251 | if ((vma->vm_end - vma->vm_start + off) > len) { | ||
1252 | return -EINVAL; | ||
1253 | } | ||
1254 | |||
1255 | off += start; | ||
1256 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
1257 | |||
1258 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 1239 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
1259 | pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ | 1240 | pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ |
1260 | 1241 | ||
1261 | return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 1242 | return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len); |
1262 | vma->vm_end - vma->vm_start, | ||
1263 | vma->vm_page_prot); | ||
1264 | } | 1243 | } |
1265 | 1244 | ||
1266 | static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) | 1245 | static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) |
diff --git a/fs/dcache.c b/fs/dcache.c index 20532cb0b06e..ae6ebb88ceff 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -542,7 +542,7 @@ EXPORT_SYMBOL(d_drop); | |||
542 | * If ref is non-zero, then decrement the refcount too. | 542 | * If ref is non-zero, then decrement the refcount too. |
543 | * Returns dentry requiring refcount drop, or NULL if we're done. | 543 | * Returns dentry requiring refcount drop, or NULL if we're done. |
544 | */ | 544 | */ |
545 | static inline struct dentry * | 545 | static struct dentry * |
546 | dentry_kill(struct dentry *dentry, int unlock_on_failure) | 546 | dentry_kill(struct dentry *dentry, int unlock_on_failure) |
547 | __releases(dentry->d_lock) | 547 | __releases(dentry->d_lock) |
548 | { | 548 | { |
@@ -630,7 +630,8 @@ repeat: | |||
630 | goto kill_it; | 630 | goto kill_it; |
631 | } | 631 | } |
632 | 632 | ||
633 | dentry->d_flags |= DCACHE_REFERENCED; | 633 | if (!(dentry->d_flags & DCACHE_REFERENCED)) |
634 | dentry->d_flags |= DCACHE_REFERENCED; | ||
634 | dentry_lru_add(dentry); | 635 | dentry_lru_add(dentry); |
635 | 636 | ||
636 | dentry->d_lockref.count--; | 637 | dentry->d_lockref.count--; |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 473e09da7d02..810c28fb8c3c 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/anon_inodes.h> | 35 | #include <linux/anon_inodes.h> |
36 | #include <linux/device.h> | 36 | #include <linux/device.h> |
37 | #include <linux/freezer.h> | ||
38 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
39 | #include <asm/io.h> | 38 | #include <asm/io.h> |
40 | #include <asm/mman.h> | 39 | #include <asm/mman.h> |
@@ -1605,8 +1604,7 @@ fetch_events: | |||
1605 | } | 1604 | } |
1606 | 1605 | ||
1607 | spin_unlock_irqrestore(&ep->lock, flags); | 1606 | spin_unlock_irqrestore(&ep->lock, flags); |
1608 | if (!freezable_schedule_hrtimeout_range(to, slack, | 1607 | if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) |
1609 | HRTIMER_MODE_ABS)) | ||
1610 | timed_out = 1; | 1608 | timed_out = 1; |
1611 | 1609 | ||
1612 | spin_lock_irqsave(&ep->lock, flags); | 1610 | spin_lock_irqsave(&ep->lock, flags); |
diff --git a/fs/select.c b/fs/select.c index 35d4adc749d9..dfd5cb18c012 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -238,8 +238,7 @@ int poll_schedule_timeout(struct poll_wqueues *pwq, int state, | |||
238 | 238 | ||
239 | set_current_state(state); | 239 | set_current_state(state); |
240 | if (!pwq->triggered) | 240 | if (!pwq->triggered) |
241 | rc = freezable_schedule_hrtimeout_range(expires, slack, | 241 | rc = schedule_hrtimeout_range(expires, slack, HRTIMER_MODE_ABS); |
242 | HRTIMER_MODE_ABS); | ||
243 | __set_current_state(TASK_RUNNING); | 242 | __set_current_state(TASK_RUNNING); |
244 | 243 | ||
245 | /* | 244 | /* |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index cc88172c7d9a..c74088ab103b 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -332,7 +332,7 @@ do { \ | |||
332 | #endif | 332 | #endif |
333 | 333 | ||
334 | #ifndef this_cpu_sub | 334 | #ifndef this_cpu_sub |
335 | # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) | 335 | # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val)) |
336 | #endif | 336 | #endif |
337 | 337 | ||
338 | #ifndef this_cpu_inc | 338 | #ifndef this_cpu_inc |
@@ -418,7 +418,7 @@ do { \ | |||
418 | # define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) | 418 | # define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) |
419 | #endif | 419 | #endif |
420 | 420 | ||
421 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) | 421 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val)) |
422 | #define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) | 422 | #define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) |
423 | #define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) | 423 | #define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) |
424 | 424 | ||
@@ -586,7 +586,7 @@ do { \ | |||
586 | #endif | 586 | #endif |
587 | 587 | ||
588 | #ifndef __this_cpu_sub | 588 | #ifndef __this_cpu_sub |
589 | # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) | 589 | # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val)) |
590 | #endif | 590 | #endif |
591 | 591 | ||
592 | #ifndef __this_cpu_inc | 592 | #ifndef __this_cpu_inc |
@@ -668,7 +668,7 @@ do { \ | |||
668 | __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) | 668 | __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) |
669 | #endif | 669 | #endif |
670 | 670 | ||
671 | #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val)) | 671 | #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val)) |
672 | #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) | 672 | #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) |
673 | #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) | 673 | #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) |
674 | 674 | ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 06344d986eb9..094f3152ec2b 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -983,7 +983,7 @@ config DEBUG_KOBJECT | |||
983 | 983 | ||
984 | config DEBUG_KOBJECT_RELEASE | 984 | config DEBUG_KOBJECT_RELEASE |
985 | bool "kobject release debugging" | 985 | bool "kobject release debugging" |
986 | depends on DEBUG_KERNEL | 986 | depends on DEBUG_OBJECTS_TIMERS |
987 | help | 987 | help |
988 | kobjects are reference counted objects. This means that their | 988 | kobjects are reference counted objects. This means that their |
989 | last reference count put is not predictable, and the kobject can | 989 | last reference count put is not predictable, and the kobject can |
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index a685c8a79578..d16fa295ae1d 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
@@ -577,7 +577,8 @@ void sg_miter_stop(struct sg_mapping_iter *miter) | |||
577 | miter->__offset += miter->consumed; | 577 | miter->__offset += miter->consumed; |
578 | miter->__remaining -= miter->consumed; | 578 | miter->__remaining -= miter->consumed; |
579 | 579 | ||
580 | if (miter->__flags & SG_MITER_TO_SG) | 580 | if ((miter->__flags & SG_MITER_TO_SG) && |
581 | !PageSlab(miter->page)) | ||
581 | flush_kernel_dcache_page(miter->page); | 582 | flush_kernel_dcache_page(miter->page); |
582 | 583 | ||
583 | if (miter->__flags & SG_MITER_ATOMIC) { | 584 | if (miter->__flags & SG_MITER_ATOMIC) { |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 610e3df2768a..cca80d96e509 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1278,64 +1278,90 @@ out: | |||
1278 | int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | 1278 | int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, |
1279 | unsigned long addr, pmd_t pmd, pmd_t *pmdp) | 1279 | unsigned long addr, pmd_t pmd, pmd_t *pmdp) |
1280 | { | 1280 | { |
1281 | struct anon_vma *anon_vma = NULL; | ||
1281 | struct page *page; | 1282 | struct page *page; |
1282 | unsigned long haddr = addr & HPAGE_PMD_MASK; | 1283 | unsigned long haddr = addr & HPAGE_PMD_MASK; |
1284 | int page_nid = -1, this_nid = numa_node_id(); | ||
1283 | int target_nid; | 1285 | int target_nid; |
1284 | int current_nid = -1; | 1286 | bool page_locked; |
1285 | bool migrated; | 1287 | bool migrated = false; |
1286 | 1288 | ||
1287 | spin_lock(&mm->page_table_lock); | 1289 | spin_lock(&mm->page_table_lock); |
1288 | if (unlikely(!pmd_same(pmd, *pmdp))) | 1290 | if (unlikely(!pmd_same(pmd, *pmdp))) |
1289 | goto out_unlock; | 1291 | goto out_unlock; |
1290 | 1292 | ||
1291 | page = pmd_page(pmd); | 1293 | page = pmd_page(pmd); |
1292 | get_page(page); | 1294 | page_nid = page_to_nid(page); |
1293 | current_nid = page_to_nid(page); | ||
1294 | count_vm_numa_event(NUMA_HINT_FAULTS); | 1295 | count_vm_numa_event(NUMA_HINT_FAULTS); |
1295 | if (current_nid == numa_node_id()) | 1296 | if (page_nid == this_nid) |
1296 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); | 1297 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); |
1297 | 1298 | ||
1299 | /* | ||
1300 | * Acquire the page lock to serialise THP migrations but avoid dropping | ||
1301 | * page_table_lock if at all possible | ||
1302 | */ | ||
1303 | page_locked = trylock_page(page); | ||
1298 | target_nid = mpol_misplaced(page, vma, haddr); | 1304 | target_nid = mpol_misplaced(page, vma, haddr); |
1299 | if (target_nid == -1) { | 1305 | if (target_nid == -1) { |
1300 | put_page(page); | 1306 | /* If the page was locked, there are no parallel migrations */ |
1301 | goto clear_pmdnuma; | 1307 | if (page_locked) |
1308 | goto clear_pmdnuma; | ||
1309 | |||
1310 | /* | ||
1311 | * Otherwise wait for potential migrations and retry. We do | ||
1312 | * relock and check_same as the page may no longer be mapped. | ||
1313 | * As the fault is being retried, do not account for it. | ||
1314 | */ | ||
1315 | spin_unlock(&mm->page_table_lock); | ||
1316 | wait_on_page_locked(page); | ||
1317 | page_nid = -1; | ||
1318 | goto out; | ||
1302 | } | 1319 | } |
1303 | 1320 | ||
1304 | /* Acquire the page lock to serialise THP migrations */ | 1321 | /* Page is misplaced, serialise migrations and parallel THP splits */ |
1322 | get_page(page); | ||
1305 | spin_unlock(&mm->page_table_lock); | 1323 | spin_unlock(&mm->page_table_lock); |
1306 | lock_page(page); | 1324 | if (!page_locked) |
1325 | lock_page(page); | ||
1326 | anon_vma = page_lock_anon_vma_read(page); | ||
1307 | 1327 | ||
1308 | /* Confirm the PTE did not while locked */ | 1328 | /* Confirm the PTE did not while locked */ |
1309 | spin_lock(&mm->page_table_lock); | 1329 | spin_lock(&mm->page_table_lock); |
1310 | if (unlikely(!pmd_same(pmd, *pmdp))) { | 1330 | if (unlikely(!pmd_same(pmd, *pmdp))) { |
1311 | unlock_page(page); | 1331 | unlock_page(page); |
1312 | put_page(page); | 1332 | put_page(page); |
1333 | page_nid = -1; | ||
1313 | goto out_unlock; | 1334 | goto out_unlock; |
1314 | } | 1335 | } |
1315 | spin_unlock(&mm->page_table_lock); | ||
1316 | 1336 | ||
1317 | /* Migrate the THP to the requested node */ | 1337 | /* |
1338 | * Migrate the THP to the requested node, returns with page unlocked | ||
1339 | * and pmd_numa cleared. | ||
1340 | */ | ||
1341 | spin_unlock(&mm->page_table_lock); | ||
1318 | migrated = migrate_misplaced_transhuge_page(mm, vma, | 1342 | migrated = migrate_misplaced_transhuge_page(mm, vma, |
1319 | pmdp, pmd, addr, page, target_nid); | 1343 | pmdp, pmd, addr, page, target_nid); |
1320 | if (!migrated) | 1344 | if (migrated) |
1321 | goto check_same; | 1345 | page_nid = target_nid; |
1322 | |||
1323 | task_numa_fault(target_nid, HPAGE_PMD_NR, true); | ||
1324 | return 0; | ||
1325 | 1346 | ||
1326 | check_same: | 1347 | goto out; |
1327 | spin_lock(&mm->page_table_lock); | ||
1328 | if (unlikely(!pmd_same(pmd, *pmdp))) | ||
1329 | goto out_unlock; | ||
1330 | clear_pmdnuma: | 1348 | clear_pmdnuma: |
1349 | BUG_ON(!PageLocked(page)); | ||
1331 | pmd = pmd_mknonnuma(pmd); | 1350 | pmd = pmd_mknonnuma(pmd); |
1332 | set_pmd_at(mm, haddr, pmdp, pmd); | 1351 | set_pmd_at(mm, haddr, pmdp, pmd); |
1333 | VM_BUG_ON(pmd_numa(*pmdp)); | 1352 | VM_BUG_ON(pmd_numa(*pmdp)); |
1334 | update_mmu_cache_pmd(vma, addr, pmdp); | 1353 | update_mmu_cache_pmd(vma, addr, pmdp); |
1354 | unlock_page(page); | ||
1335 | out_unlock: | 1355 | out_unlock: |
1336 | spin_unlock(&mm->page_table_lock); | 1356 | spin_unlock(&mm->page_table_lock); |
1337 | if (current_nid != -1) | 1357 | |
1338 | task_numa_fault(current_nid, HPAGE_PMD_NR, false); | 1358 | out: |
1359 | if (anon_vma) | ||
1360 | page_unlock_anon_vma_read(anon_vma); | ||
1361 | |||
1362 | if (page_nid != -1) | ||
1363 | task_numa_fault(page_nid, HPAGE_PMD_NR, migrated); | ||
1364 | |||
1339 | return 0; | 1365 | return 0; |
1340 | } | 1366 | } |
1341 | 1367 | ||
diff --git a/mm/list_lru.c b/mm/list_lru.c index 72467914b856..72f9decb0104 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c | |||
@@ -81,8 +81,9 @@ restart: | |||
81 | * decrement nr_to_walk first so that we don't livelock if we | 81 | * decrement nr_to_walk first so that we don't livelock if we |
82 | * get stuck on large numbesr of LRU_RETRY items | 82 | * get stuck on large numbesr of LRU_RETRY items |
83 | */ | 83 | */ |
84 | if (--(*nr_to_walk) == 0) | 84 | if (!*nr_to_walk) |
85 | break; | 85 | break; |
86 | --*nr_to_walk; | ||
86 | 87 | ||
87 | ret = isolate(item, &nlru->lock, cb_arg); | 88 | ret = isolate(item, &nlru->lock, cb_arg); |
88 | switch (ret) { | 89 | switch (ret) { |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 34d3ca9572d6..13b9d0f221b8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/page_cgroup.h> | 54 | #include <linux/page_cgroup.h> |
55 | #include <linux/cpu.h> | 55 | #include <linux/cpu.h> |
56 | #include <linux/oom.h> | 56 | #include <linux/oom.h> |
57 | #include <linux/lockdep.h> | ||
57 | #include "internal.h" | 58 | #include "internal.h" |
58 | #include <net/sock.h> | 59 | #include <net/sock.h> |
59 | #include <net/ip.h> | 60 | #include <net/ip.h> |
@@ -2046,6 +2047,12 @@ static int mem_cgroup_soft_reclaim(struct mem_cgroup *root_memcg, | |||
2046 | return total; | 2047 | return total; |
2047 | } | 2048 | } |
2048 | 2049 | ||
2050 | #ifdef CONFIG_LOCKDEP | ||
2051 | static struct lockdep_map memcg_oom_lock_dep_map = { | ||
2052 | .name = "memcg_oom_lock", | ||
2053 | }; | ||
2054 | #endif | ||
2055 | |||
2049 | static DEFINE_SPINLOCK(memcg_oom_lock); | 2056 | static DEFINE_SPINLOCK(memcg_oom_lock); |
2050 | 2057 | ||
2051 | /* | 2058 | /* |
@@ -2083,7 +2090,8 @@ static bool mem_cgroup_oom_trylock(struct mem_cgroup *memcg) | |||
2083 | } | 2090 | } |
2084 | iter->oom_lock = false; | 2091 | iter->oom_lock = false; |
2085 | } | 2092 | } |
2086 | } | 2093 | } else |
2094 | mutex_acquire(&memcg_oom_lock_dep_map, 0, 1, _RET_IP_); | ||
2087 | 2095 | ||
2088 | spin_unlock(&memcg_oom_lock); | 2096 | spin_unlock(&memcg_oom_lock); |
2089 | 2097 | ||
@@ -2095,6 +2103,7 @@ static void mem_cgroup_oom_unlock(struct mem_cgroup *memcg) | |||
2095 | struct mem_cgroup *iter; | 2103 | struct mem_cgroup *iter; |
2096 | 2104 | ||
2097 | spin_lock(&memcg_oom_lock); | 2105 | spin_lock(&memcg_oom_lock); |
2106 | mutex_release(&memcg_oom_lock_dep_map, 1, _RET_IP_); | ||
2098 | for_each_mem_cgroup_tree(iter, memcg) | 2107 | for_each_mem_cgroup_tree(iter, memcg) |
2099 | iter->oom_lock = false; | 2108 | iter->oom_lock = false; |
2100 | spin_unlock(&memcg_oom_lock); | 2109 | spin_unlock(&memcg_oom_lock); |
@@ -2765,10 +2774,10 @@ done: | |||
2765 | *ptr = memcg; | 2774 | *ptr = memcg; |
2766 | return 0; | 2775 | return 0; |
2767 | nomem: | 2776 | nomem: |
2768 | *ptr = NULL; | 2777 | if (!(gfp_mask & __GFP_NOFAIL)) { |
2769 | if (gfp_mask & __GFP_NOFAIL) | 2778 | *ptr = NULL; |
2770 | return 0; | 2779 | return -ENOMEM; |
2771 | return -ENOMEM; | 2780 | } |
2772 | bypass: | 2781 | bypass: |
2773 | *ptr = root_mem_cgroup; | 2782 | *ptr = root_mem_cgroup; |
2774 | return -EINTR; | 2783 | return -EINTR; |
@@ -3773,8 +3782,7 @@ void mem_cgroup_move_account_page_stat(struct mem_cgroup *from, | |||
3773 | { | 3782 | { |
3774 | /* Update stat data for mem_cgroup */ | 3783 | /* Update stat data for mem_cgroup */ |
3775 | preempt_disable(); | 3784 | preempt_disable(); |
3776 | WARN_ON_ONCE(from->stat->count[idx] < nr_pages); | 3785 | __this_cpu_sub(from->stat->count[idx], nr_pages); |
3777 | __this_cpu_add(from->stat->count[idx], -nr_pages); | ||
3778 | __this_cpu_add(to->stat->count[idx], nr_pages); | 3786 | __this_cpu_add(to->stat->count[idx], nr_pages); |
3779 | preempt_enable(); | 3787 | preempt_enable(); |
3780 | } | 3788 | } |
@@ -4950,31 +4958,18 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg) | |||
4950 | } while (usage > 0); | 4958 | } while (usage > 0); |
4951 | } | 4959 | } |
4952 | 4960 | ||
4953 | /* | ||
4954 | * This mainly exists for tests during the setting of set of use_hierarchy. | ||
4955 | * Since this is the very setting we are changing, the current hierarchy value | ||
4956 | * is meaningless | ||
4957 | */ | ||
4958 | static inline bool __memcg_has_children(struct mem_cgroup *memcg) | ||
4959 | { | ||
4960 | struct cgroup_subsys_state *pos; | ||
4961 | |||
4962 | /* bounce at first found */ | ||
4963 | css_for_each_child(pos, &memcg->css) | ||
4964 | return true; | ||
4965 | return false; | ||
4966 | } | ||
4967 | |||
4968 | /* | ||
4969 | * Must be called with memcg_create_mutex held, unless the cgroup is guaranteed | ||
4970 | * to be already dead (as in mem_cgroup_force_empty, for instance). This is | ||
4971 | * from mem_cgroup_count_children(), in the sense that we don't really care how | ||
4972 | * many children we have; we only need to know if we have any. It also counts | ||
4973 | * any memcg without hierarchy as infertile. | ||
4974 | */ | ||
4975 | static inline bool memcg_has_children(struct mem_cgroup *memcg) | 4961 | static inline bool memcg_has_children(struct mem_cgroup *memcg) |
4976 | { | 4962 | { |
4977 | return memcg->use_hierarchy && __memcg_has_children(memcg); | 4963 | lockdep_assert_held(&memcg_create_mutex); |
4964 | /* | ||
4965 | * The lock does not prevent addition or deletion to the list | ||
4966 | * of children, but it prevents a new child from being | ||
4967 | * initialized based on this parent in css_online(), so it's | ||
4968 | * enough to decide whether hierarchically inherited | ||
4969 | * attributes can still be changed or not. | ||
4970 | */ | ||
4971 | return memcg->use_hierarchy && | ||
4972 | !list_empty(&memcg->css.cgroup->children); | ||
4978 | } | 4973 | } |
4979 | 4974 | ||
4980 | /* | 4975 | /* |
@@ -5054,7 +5049,7 @@ static int mem_cgroup_hierarchy_write(struct cgroup_subsys_state *css, | |||
5054 | */ | 5049 | */ |
5055 | if ((!parent_memcg || !parent_memcg->use_hierarchy) && | 5050 | if ((!parent_memcg || !parent_memcg->use_hierarchy) && |
5056 | (val == 1 || val == 0)) { | 5051 | (val == 1 || val == 0)) { |
5057 | if (!__memcg_has_children(memcg)) | 5052 | if (list_empty(&memcg->css.cgroup->children)) |
5058 | memcg->use_hierarchy = val; | 5053 | memcg->use_hierarchy = val; |
5059 | else | 5054 | else |
5060 | retval = -EBUSY; | 5055 | retval = -EBUSY; |
diff --git a/mm/memory.c b/mm/memory.c index 1311f26497e6..d176154c243f 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3521,12 +3521,12 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3521 | } | 3521 | } |
3522 | 3522 | ||
3523 | int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, | 3523 | int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, |
3524 | unsigned long addr, int current_nid) | 3524 | unsigned long addr, int page_nid) |
3525 | { | 3525 | { |
3526 | get_page(page); | 3526 | get_page(page); |
3527 | 3527 | ||
3528 | count_vm_numa_event(NUMA_HINT_FAULTS); | 3528 | count_vm_numa_event(NUMA_HINT_FAULTS); |
3529 | if (current_nid == numa_node_id()) | 3529 | if (page_nid == numa_node_id()) |
3530 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); | 3530 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); |
3531 | 3531 | ||
3532 | return mpol_misplaced(page, vma, addr); | 3532 | return mpol_misplaced(page, vma, addr); |
@@ -3537,7 +3537,7 @@ int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3537 | { | 3537 | { |
3538 | struct page *page = NULL; | 3538 | struct page *page = NULL; |
3539 | spinlock_t *ptl; | 3539 | spinlock_t *ptl; |
3540 | int current_nid = -1; | 3540 | int page_nid = -1; |
3541 | int target_nid; | 3541 | int target_nid; |
3542 | bool migrated = false; | 3542 | bool migrated = false; |
3543 | 3543 | ||
@@ -3567,15 +3567,10 @@ int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3567 | return 0; | 3567 | return 0; |
3568 | } | 3568 | } |
3569 | 3569 | ||
3570 | current_nid = page_to_nid(page); | 3570 | page_nid = page_to_nid(page); |
3571 | target_nid = numa_migrate_prep(page, vma, addr, current_nid); | 3571 | target_nid = numa_migrate_prep(page, vma, addr, page_nid); |
3572 | pte_unmap_unlock(ptep, ptl); | 3572 | pte_unmap_unlock(ptep, ptl); |
3573 | if (target_nid == -1) { | 3573 | if (target_nid == -1) { |
3574 | /* | ||
3575 | * Account for the fault against the current node if it not | ||
3576 | * being replaced regardless of where the page is located. | ||
3577 | */ | ||
3578 | current_nid = numa_node_id(); | ||
3579 | put_page(page); | 3574 | put_page(page); |
3580 | goto out; | 3575 | goto out; |
3581 | } | 3576 | } |
@@ -3583,11 +3578,11 @@ int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3583 | /* Migrate to the requested node */ | 3578 | /* Migrate to the requested node */ |
3584 | migrated = migrate_misplaced_page(page, target_nid); | 3579 | migrated = migrate_misplaced_page(page, target_nid); |
3585 | if (migrated) | 3580 | if (migrated) |
3586 | current_nid = target_nid; | 3581 | page_nid = target_nid; |
3587 | 3582 | ||
3588 | out: | 3583 | out: |
3589 | if (current_nid != -1) | 3584 | if (page_nid != -1) |
3590 | task_numa_fault(current_nid, 1, migrated); | 3585 | task_numa_fault(page_nid, 1, migrated); |
3591 | return 0; | 3586 | return 0; |
3592 | } | 3587 | } |
3593 | 3588 | ||
@@ -3602,7 +3597,6 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3602 | unsigned long offset; | 3597 | unsigned long offset; |
3603 | spinlock_t *ptl; | 3598 | spinlock_t *ptl; |
3604 | bool numa = false; | 3599 | bool numa = false; |
3605 | int local_nid = numa_node_id(); | ||
3606 | 3600 | ||
3607 | spin_lock(&mm->page_table_lock); | 3601 | spin_lock(&mm->page_table_lock); |
3608 | pmd = *pmdp; | 3602 | pmd = *pmdp; |
@@ -3625,9 +3619,10 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3625 | for (addr = _addr + offset; addr < _addr + PMD_SIZE; pte++, addr += PAGE_SIZE) { | 3619 | for (addr = _addr + offset; addr < _addr + PMD_SIZE; pte++, addr += PAGE_SIZE) { |
3626 | pte_t pteval = *pte; | 3620 | pte_t pteval = *pte; |
3627 | struct page *page; | 3621 | struct page *page; |
3628 | int curr_nid = local_nid; | 3622 | int page_nid = -1; |
3629 | int target_nid; | 3623 | int target_nid; |
3630 | bool migrated; | 3624 | bool migrated = false; |
3625 | |||
3631 | if (!pte_present(pteval)) | 3626 | if (!pte_present(pteval)) |
3632 | continue; | 3627 | continue; |
3633 | if (!pte_numa(pteval)) | 3628 | if (!pte_numa(pteval)) |
@@ -3649,25 +3644,19 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3649 | if (unlikely(page_mapcount(page) != 1)) | 3644 | if (unlikely(page_mapcount(page) != 1)) |
3650 | continue; | 3645 | continue; |
3651 | 3646 | ||
3652 | /* | 3647 | page_nid = page_to_nid(page); |
3653 | * Note that the NUMA fault is later accounted to either | 3648 | target_nid = numa_migrate_prep(page, vma, addr, page_nid); |
3654 | * the node that is currently running or where the page is | 3649 | pte_unmap_unlock(pte, ptl); |
3655 | * migrated to. | 3650 | if (target_nid != -1) { |
3656 | */ | 3651 | migrated = migrate_misplaced_page(page, target_nid); |
3657 | curr_nid = local_nid; | 3652 | if (migrated) |
3658 | target_nid = numa_migrate_prep(page, vma, addr, | 3653 | page_nid = target_nid; |
3659 | page_to_nid(page)); | 3654 | } else { |
3660 | if (target_nid == -1) { | ||
3661 | put_page(page); | 3655 | put_page(page); |
3662 | continue; | ||
3663 | } | 3656 | } |
3664 | 3657 | ||
3665 | /* Migrate to the requested node */ | 3658 | if (page_nid != -1) |
3666 | pte_unmap_unlock(pte, ptl); | 3659 | task_numa_fault(page_nid, 1, migrated); |
3667 | migrated = migrate_misplaced_page(page, target_nid); | ||
3668 | if (migrated) | ||
3669 | curr_nid = target_nid; | ||
3670 | task_numa_fault(curr_nid, 1, migrated); | ||
3671 | 3660 | ||
3672 | pte = pte_offset_map_lock(mm, pmdp, addr, &ptl); | 3661 | pte = pte_offset_map_lock(mm, pmdp, addr, &ptl); |
3673 | } | 3662 | } |
diff --git a/mm/migrate.c b/mm/migrate.c index 7a7325ee1d08..c04692774e88 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1715,12 +1715,12 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
1715 | unlock_page(new_page); | 1715 | unlock_page(new_page); |
1716 | put_page(new_page); /* Free it */ | 1716 | put_page(new_page); /* Free it */ |
1717 | 1717 | ||
1718 | unlock_page(page); | 1718 | /* Retake the callers reference and putback on LRU */ |
1719 | get_page(page); | ||
1719 | putback_lru_page(page); | 1720 | putback_lru_page(page); |
1720 | 1721 | mod_zone_page_state(page_zone(page), | |
1721 | count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); | 1722 | NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR); |
1722 | isolated = 0; | 1723 | goto out_fail; |
1723 | goto out; | ||
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | /* | 1726 | /* |
@@ -1737,9 +1737,9 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
1737 | entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); | 1737 | entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); |
1738 | entry = pmd_mkhuge(entry); | 1738 | entry = pmd_mkhuge(entry); |
1739 | 1739 | ||
1740 | page_add_new_anon_rmap(new_page, vma, haddr); | 1740 | pmdp_clear_flush(vma, haddr, pmd); |
1741 | |||
1742 | set_pmd_at(mm, haddr, pmd, entry); | 1741 | set_pmd_at(mm, haddr, pmd, entry); |
1742 | page_add_new_anon_rmap(new_page, vma, haddr); | ||
1743 | update_mmu_cache_pmd(vma, address, &entry); | 1743 | update_mmu_cache_pmd(vma, address, &entry); |
1744 | page_remove_rmap(page); | 1744 | page_remove_rmap(page); |
1745 | /* | 1745 | /* |
@@ -1758,7 +1758,6 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
1758 | count_vm_events(PGMIGRATE_SUCCESS, HPAGE_PMD_NR); | 1758 | count_vm_events(PGMIGRATE_SUCCESS, HPAGE_PMD_NR); |
1759 | count_vm_numa_events(NUMA_PAGE_MIGRATE, HPAGE_PMD_NR); | 1759 | count_vm_numa_events(NUMA_PAGE_MIGRATE, HPAGE_PMD_NR); |
1760 | 1760 | ||
1761 | out: | ||
1762 | mod_zone_page_state(page_zone(page), | 1761 | mod_zone_page_state(page_zone(page), |
1763 | NR_ISOLATED_ANON + page_lru, | 1762 | NR_ISOLATED_ANON + page_lru, |
1764 | -HPAGE_PMD_NR); | 1763 | -HPAGE_PMD_NR); |
@@ -1767,6 +1766,10 @@ out: | |||
1767 | out_fail: | 1766 | out_fail: |
1768 | count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); | 1767 | count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); |
1769 | out_dropref: | 1768 | out_dropref: |
1769 | entry = pmd_mknonnuma(entry); | ||
1770 | set_pmd_at(mm, haddr, pmd, entry); | ||
1771 | update_mmu_cache_pmd(vma, address, &entry); | ||
1772 | |||
1770 | unlock_page(page); | 1773 | unlock_page(page); |
1771 | put_page(page); | 1774 | put_page(page); |
1772 | return 0; | 1775 | return 0; |
diff --git a/mm/mprotect.c b/mm/mprotect.c index a3af058f68e4..412ba2b7326a 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
@@ -148,7 +148,7 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma, | |||
148 | split_huge_page_pmd(vma, addr, pmd); | 148 | split_huge_page_pmd(vma, addr, pmd); |
149 | else if (change_huge_pmd(vma, pmd, addr, newprot, | 149 | else if (change_huge_pmd(vma, pmd, addr, newprot, |
150 | prot_numa)) { | 150 | prot_numa)) { |
151 | pages += HPAGE_PMD_NR; | 151 | pages++; |
152 | continue; | 152 | continue; |
153 | } | 153 | } |
154 | /* fall through */ | 154 | /* fall through */ |
diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 5da2cbcfdbb5..2beeabf502c5 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c | |||
@@ -242,7 +242,7 @@ int walk_page_range(unsigned long addr, unsigned long end, | |||
242 | if (err) | 242 | if (err) |
243 | break; | 243 | break; |
244 | pgd++; | 244 | pgd++; |
245 | } while (addr = next, addr != end); | 245 | } while (addr = next, addr < end); |
246 | 246 | ||
247 | return err; | 247 | return err; |
248 | } | 248 | } |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 17f45e8aa89c..e1e9e0c999fe 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -49,6 +49,8 @@ static struct snd_pcm *snd_pcm_get(struct snd_card *card, int device) | |||
49 | struct snd_pcm *pcm; | 49 | struct snd_pcm *pcm; |
50 | 50 | ||
51 | list_for_each_entry(pcm, &snd_pcm_devices, list) { | 51 | list_for_each_entry(pcm, &snd_pcm_devices, list) { |
52 | if (pcm->internal) | ||
53 | continue; | ||
52 | if (pcm->card == card && pcm->device == device) | 54 | if (pcm->card == card && pcm->device == device) |
53 | return pcm; | 55 | return pcm; |
54 | } | 56 | } |
@@ -60,6 +62,8 @@ static int snd_pcm_next(struct snd_card *card, int device) | |||
60 | struct snd_pcm *pcm; | 62 | struct snd_pcm *pcm; |
61 | 63 | ||
62 | list_for_each_entry(pcm, &snd_pcm_devices, list) { | 64 | list_for_each_entry(pcm, &snd_pcm_devices, list) { |
65 | if (pcm->internal) | ||
66 | continue; | ||
63 | if (pcm->card == card && pcm->device > device) | 67 | if (pcm->card == card && pcm->device > device) |
64 | return pcm->device; | 68 | return pcm->device; |
65 | else if (pcm->card->number > card->number) | 69 | else if (pcm->card->number > card->number) |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 5b6c4e3c92ca..748c6a941963 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -4864,8 +4864,8 @@ static void hda_power_work(struct work_struct *work) | |||
4864 | spin_unlock(&codec->power_lock); | 4864 | spin_unlock(&codec->power_lock); |
4865 | 4865 | ||
4866 | state = hda_call_codec_suspend(codec, true); | 4866 | state = hda_call_codec_suspend(codec, true); |
4867 | codec->pm_down_notified = 0; | 4867 | if (!codec->pm_down_notified && |
4868 | if (!bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) { | 4868 | !bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) { |
4869 | codec->pm_down_notified = 1; | 4869 | codec->pm_down_notified = 1; |
4870 | hda_call_pm_notify(bus, false); | 4870 | hda_call_pm_notify(bus, false); |
4871 | } | 4871 | } |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 26ad4f0aade3..b7c89dff7066 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -4475,9 +4475,11 @@ int snd_hda_gen_build_controls(struct hda_codec *codec) | |||
4475 | true, &spec->vmaster_mute.sw_kctl); | 4475 | true, &spec->vmaster_mute.sw_kctl); |
4476 | if (err < 0) | 4476 | if (err < 0) |
4477 | return err; | 4477 | return err; |
4478 | if (spec->vmaster_mute.hook) | 4478 | if (spec->vmaster_mute.hook) { |
4479 | snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, | 4479 | snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, |
4480 | spec->vmaster_mute_enum); | 4480 | spec->vmaster_mute_enum); |
4481 | snd_hda_sync_vmaster_hook(&spec->vmaster_mute); | ||
4482 | } | ||
4481 | } | 4483 | } |
4482 | 4484 | ||
4483 | free_kctls(spec); /* no longer needed */ | 4485 | free_kctls(spec); /* no longer needed */ |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 0cbdd87dde6d..2aa2f579b4d6 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -968,6 +968,15 @@ static void ad1884_fixup_hp_eapd(struct hda_codec *codec, | |||
968 | } | 968 | } |
969 | } | 969 | } |
970 | 970 | ||
971 | static void ad1884_fixup_thinkpad(struct hda_codec *codec, | ||
972 | const struct hda_fixup *fix, int action) | ||
973 | { | ||
974 | struct ad198x_spec *spec = codec->spec; | ||
975 | |||
976 | if (action == HDA_FIXUP_ACT_PRE_PROBE) | ||
977 | spec->gen.keep_eapd_on = 1; | ||
978 | } | ||
979 | |||
971 | /* set magic COEFs for dmic */ | 980 | /* set magic COEFs for dmic */ |
972 | static const struct hda_verb ad1884_dmic_init_verbs[] = { | 981 | static const struct hda_verb ad1884_dmic_init_verbs[] = { |
973 | {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7}, | 982 | {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7}, |
@@ -979,6 +988,7 @@ enum { | |||
979 | AD1884_FIXUP_AMP_OVERRIDE, | 988 | AD1884_FIXUP_AMP_OVERRIDE, |
980 | AD1884_FIXUP_HP_EAPD, | 989 | AD1884_FIXUP_HP_EAPD, |
981 | AD1884_FIXUP_DMIC_COEF, | 990 | AD1884_FIXUP_DMIC_COEF, |
991 | AD1884_FIXUP_THINKPAD, | ||
982 | AD1884_FIXUP_HP_TOUCHSMART, | 992 | AD1884_FIXUP_HP_TOUCHSMART, |
983 | }; | 993 | }; |
984 | 994 | ||
@@ -997,6 +1007,12 @@ static const struct hda_fixup ad1884_fixups[] = { | |||
997 | .type = HDA_FIXUP_VERBS, | 1007 | .type = HDA_FIXUP_VERBS, |
998 | .v.verbs = ad1884_dmic_init_verbs, | 1008 | .v.verbs = ad1884_dmic_init_verbs, |
999 | }, | 1009 | }, |
1010 | [AD1884_FIXUP_THINKPAD] = { | ||
1011 | .type = HDA_FIXUP_FUNC, | ||
1012 | .v.func = ad1884_fixup_thinkpad, | ||
1013 | .chained = true, | ||
1014 | .chain_id = AD1884_FIXUP_DMIC_COEF, | ||
1015 | }, | ||
1000 | [AD1884_FIXUP_HP_TOUCHSMART] = { | 1016 | [AD1884_FIXUP_HP_TOUCHSMART] = { |
1001 | .type = HDA_FIXUP_VERBS, | 1017 | .type = HDA_FIXUP_VERBS, |
1002 | .v.verbs = ad1884_dmic_init_verbs, | 1018 | .v.verbs = ad1884_dmic_init_verbs, |
@@ -1008,7 +1024,7 @@ static const struct hda_fixup ad1884_fixups[] = { | |||
1008 | static const struct snd_pci_quirk ad1884_fixup_tbl[] = { | 1024 | static const struct snd_pci_quirk ad1884_fixup_tbl[] = { |
1009 | SND_PCI_QUIRK(0x103c, 0x2a82, "HP Touchsmart", AD1884_FIXUP_HP_TOUCHSMART), | 1025 | SND_PCI_QUIRK(0x103c, 0x2a82, "HP Touchsmart", AD1884_FIXUP_HP_TOUCHSMART), |
1010 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1884_FIXUP_HP_EAPD), | 1026 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1884_FIXUP_HP_EAPD), |
1011 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1884_FIXUP_DMIC_COEF), | 1027 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1884_FIXUP_THINKPAD), |
1012 | {} | 1028 | {} |
1013 | }; | 1029 | }; |
1014 | 1030 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index bf313bea7085..8ad554312b69 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4623,6 +4623,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
4623 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 4623 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
4624 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), | 4624 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
4625 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_ASUS_MODE4), | 4625 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_ASUS_MODE4), |
4626 | SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_ASUS_MODE4), | ||
4626 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), | 4627 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), |
4627 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), | 4628 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), |
4628 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), | 4629 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 8b50e5958de5..01daf655e20b 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -530,6 +530,7 @@ static int hp_supply_event(struct snd_soc_dapm_widget *w, | |||
530 | hubs->hp_startup_mode); | 530 | hubs->hp_startup_mode); |
531 | break; | 531 | break; |
532 | } | 532 | } |
533 | break; | ||
533 | 534 | ||
534 | case SND_SOC_DAPM_PRE_PMD: | 535 | case SND_SOC_DAPM_PRE_PMD: |
535 | snd_soc_update_bits(codec, WM8993_CHARGE_PUMP_1, | 536 | snd_soc_update_bits(codec, WM8993_CHARGE_PUMP_1, |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c17c14c394df..b2949aed1ac2 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1949,7 +1949,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file, | |||
1949 | w->active ? "active" : "inactive"); | 1949 | w->active ? "active" : "inactive"); |
1950 | 1950 | ||
1951 | list_for_each_entry(p, &w->sources, list_sink) { | 1951 | list_for_each_entry(p, &w->sources, list_sink) { |
1952 | if (p->connected && !p->connected(w, p->sink)) | 1952 | if (p->connected && !p->connected(w, p->source)) |
1953 | continue; | 1953 | continue; |
1954 | 1954 | ||
1955 | if (p->connect) | 1955 | if (p->connect) |
@@ -3495,6 +3495,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | |||
3495 | if (!w) { | 3495 | if (!w) { |
3496 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", | 3496 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", |
3497 | dai->driver->playback.stream_name); | 3497 | dai->driver->playback.stream_name); |
3498 | return -ENOMEM; | ||
3498 | } | 3499 | } |
3499 | 3500 | ||
3500 | w->priv = dai; | 3501 | w->priv = dai; |
@@ -3513,6 +3514,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | |||
3513 | if (!w) { | 3514 | if (!w) { |
3514 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", | 3515 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", |
3515 | dai->driver->capture.stream_name); | 3516 | dai->driver->capture.stream_name); |
3517 | return -ENOMEM; | ||
3516 | } | 3518 | } |
3517 | 3519 | ||
3518 | w->priv = dai; | 3520 | w->priv = dai; |
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index e297b74471b8..ca0d3d9f4bac 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -90,8 +90,20 @@ OPTIONS | |||
90 | Number of mmap data pages. Must be a power of two. | 90 | Number of mmap data pages. Must be a power of two. |
91 | 91 | ||
92 | -g:: | 92 | -g:: |
93 | Enables call-graph (stack chain/backtrace) recording. | ||
94 | |||
93 | --call-graph:: | 95 | --call-graph:: |
94 | Do call-graph (stack chain/backtrace) recording. | 96 | Setup and enable call-graph (stack chain/backtrace) recording, |
97 | implies -g. | ||
98 | |||
99 | Allows specifying "fp" (frame pointer) or "dwarf" | ||
100 | (DWARF's CFI - Call Frame Information) as the method to collect | ||
101 | the information used to show the call graphs. | ||
102 | |||
103 | In some systems, where binaries are build with gcc | ||
104 | --fomit-frame-pointer, using the "fp" method will produce bogus | ||
105 | call graphs, using "dwarf", if available (perf tools linked to | ||
106 | the libunwind library) should be used instead. | ||
95 | 107 | ||
96 | -q:: | 108 | -q:: |
97 | --quiet:: | 109 | --quiet:: |
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index 58d6598a9686..6a118e71d003 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -140,20 +140,12 @@ Default is to monitor all CPUS. | |||
140 | --asm-raw:: | 140 | --asm-raw:: |
141 | Show raw instruction encoding of assembly instructions. | 141 | Show raw instruction encoding of assembly instructions. |
142 | 142 | ||
143 | -G [type,min,order]:: | 143 | -G:: |
144 | Enables call-graph (stack chain/backtrace) recording. | ||
145 | |||
144 | --call-graph:: | 146 | --call-graph:: |
145 | Display call chains using type, min percent threshold and order. | 147 | Setup and enable call-graph (stack chain/backtrace) recording, |
146 | type can be either: | 148 | implies -G. |
147 | - flat: single column, linear exposure of call chains. | ||
148 | - graph: use a graph tree, displaying absolute overhead rates. | ||
149 | - fractal: like graph, but displays relative rates. Each branch of | ||
150 | the tree is considered as a new profiled object. | ||
151 | |||
152 | order can be either: | ||
153 | - callee: callee based call graph. | ||
154 | - caller: inverted caller based call graph. | ||
155 | |||
156 | Default: fractal,0.5,callee. | ||
157 | 149 | ||
158 | --ignore-callees=<regex>:: | 150 | --ignore-callees=<regex>:: |
159 | Ignore callees of the function(s) matching the given regex. | 151 | Ignore callees of the function(s) matching the given regex. |
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 935d52216c89..fbc2888d6495 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -888,11 +888,18 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx, | |||
888 | while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) { | 888 | while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) { |
889 | err = perf_evlist__parse_sample(kvm->evlist, event, &sample); | 889 | err = perf_evlist__parse_sample(kvm->evlist, event, &sample); |
890 | if (err) { | 890 | if (err) { |
891 | perf_evlist__mmap_consume(kvm->evlist, idx); | ||
891 | pr_err("Failed to parse sample\n"); | 892 | pr_err("Failed to parse sample\n"); |
892 | return -1; | 893 | return -1; |
893 | } | 894 | } |
894 | 895 | ||
895 | err = perf_session_queue_event(kvm->session, event, &sample, 0); | 896 | err = perf_session_queue_event(kvm->session, event, &sample, 0); |
897 | /* | ||
898 | * FIXME: Here we can't consume the event, as perf_session_queue_event will | ||
899 | * point to it, and it'll get possibly overwritten by the kernel. | ||
900 | */ | ||
901 | perf_evlist__mmap_consume(kvm->evlist, idx); | ||
902 | |||
896 | if (err) { | 903 | if (err) { |
897 | pr_err("Failed to enqueue sample: %d\n", err); | 904 | pr_err("Failed to enqueue sample: %d\n", err); |
898 | return -1; | 905 | return -1; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a41ac41546c9..d04651484640 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -712,21 +712,12 @@ static int get_stack_size(char *str, unsigned long *_size) | |||
712 | } | 712 | } |
713 | #endif /* LIBUNWIND_SUPPORT */ | 713 | #endif /* LIBUNWIND_SUPPORT */ |
714 | 714 | ||
715 | int record_parse_callchain_opt(const struct option *opt, | 715 | int record_parse_callchain(const char *arg, struct perf_record_opts *opts) |
716 | const char *arg, int unset) | ||
717 | { | 716 | { |
718 | struct perf_record_opts *opts = opt->value; | ||
719 | char *tok, *name, *saveptr = NULL; | 717 | char *tok, *name, *saveptr = NULL; |
720 | char *buf; | 718 | char *buf; |
721 | int ret = -1; | 719 | int ret = -1; |
722 | 720 | ||
723 | /* --no-call-graph */ | ||
724 | if (unset) | ||
725 | return 0; | ||
726 | |||
727 | /* We specified default option if none is provided. */ | ||
728 | BUG_ON(!arg); | ||
729 | |||
730 | /* We need buffer that we know we can write to. */ | 721 | /* We need buffer that we know we can write to. */ |
731 | buf = malloc(strlen(arg) + 1); | 722 | buf = malloc(strlen(arg) + 1); |
732 | if (!buf) | 723 | if (!buf) |
@@ -764,13 +755,9 @@ int record_parse_callchain_opt(const struct option *opt, | |||
764 | ret = get_stack_size(tok, &size); | 755 | ret = get_stack_size(tok, &size); |
765 | opts->stack_dump_size = size; | 756 | opts->stack_dump_size = size; |
766 | } | 757 | } |
767 | |||
768 | if (!ret) | ||
769 | pr_debug("callchain: stack dump size %d\n", | ||
770 | opts->stack_dump_size); | ||
771 | #endif /* LIBUNWIND_SUPPORT */ | 758 | #endif /* LIBUNWIND_SUPPORT */ |
772 | } else { | 759 | } else { |
773 | pr_err("callchain: Unknown -g option " | 760 | pr_err("callchain: Unknown --call-graph option " |
774 | "value: %s\n", arg); | 761 | "value: %s\n", arg); |
775 | break; | 762 | break; |
776 | } | 763 | } |
@@ -778,13 +765,52 @@ int record_parse_callchain_opt(const struct option *opt, | |||
778 | } while (0); | 765 | } while (0); |
779 | 766 | ||
780 | free(buf); | 767 | free(buf); |
768 | return ret; | ||
769 | } | ||
770 | |||
771 | static void callchain_debug(struct perf_record_opts *opts) | ||
772 | { | ||
773 | pr_debug("callchain: type %d\n", opts->call_graph); | ||
781 | 774 | ||
775 | if (opts->call_graph == CALLCHAIN_DWARF) | ||
776 | pr_debug("callchain: stack dump size %d\n", | ||
777 | opts->stack_dump_size); | ||
778 | } | ||
779 | |||
780 | int record_parse_callchain_opt(const struct option *opt, | ||
781 | const char *arg, | ||
782 | int unset) | ||
783 | { | ||
784 | struct perf_record_opts *opts = opt->value; | ||
785 | int ret; | ||
786 | |||
787 | /* --no-call-graph */ | ||
788 | if (unset) { | ||
789 | opts->call_graph = CALLCHAIN_NONE; | ||
790 | pr_debug("callchain: disabled\n"); | ||
791 | return 0; | ||
792 | } | ||
793 | |||
794 | ret = record_parse_callchain(arg, opts); | ||
782 | if (!ret) | 795 | if (!ret) |
783 | pr_debug("callchain: type %d\n", opts->call_graph); | 796 | callchain_debug(opts); |
784 | 797 | ||
785 | return ret; | 798 | return ret; |
786 | } | 799 | } |
787 | 800 | ||
801 | int record_callchain_opt(const struct option *opt, | ||
802 | const char *arg __maybe_unused, | ||
803 | int unset __maybe_unused) | ||
804 | { | ||
805 | struct perf_record_opts *opts = opt->value; | ||
806 | |||
807 | if (opts->call_graph == CALLCHAIN_NONE) | ||
808 | opts->call_graph = CALLCHAIN_FP; | ||
809 | |||
810 | callchain_debug(opts); | ||
811 | return 0; | ||
812 | } | ||
813 | |||
788 | static const char * const record_usage[] = { | 814 | static const char * const record_usage[] = { |
789 | "perf record [<options>] [<command>]", | 815 | "perf record [<options>] [<command>]", |
790 | "perf record [<options>] -- <command> [<options>]", | 816 | "perf record [<options>] -- <command> [<options>]", |
@@ -813,12 +839,12 @@ static struct perf_record record = { | |||
813 | }, | 839 | }, |
814 | }; | 840 | }; |
815 | 841 | ||
816 | #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " | 842 | #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: " |
817 | 843 | ||
818 | #ifdef LIBUNWIND_SUPPORT | 844 | #ifdef LIBUNWIND_SUPPORT |
819 | const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; | 845 | const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf"; |
820 | #else | 846 | #else |
821 | const char record_callchain_help[] = CALLCHAIN_HELP "[fp]"; | 847 | const char record_callchain_help[] = CALLCHAIN_HELP "fp"; |
822 | #endif | 848 | #endif |
823 | 849 | ||
824 | /* | 850 | /* |
@@ -858,9 +884,12 @@ const struct option record_options[] = { | |||
858 | "number of mmap data pages"), | 884 | "number of mmap data pages"), |
859 | OPT_BOOLEAN(0, "group", &record.opts.group, | 885 | OPT_BOOLEAN(0, "group", &record.opts.group, |
860 | "put the counters into a counter group"), | 886 | "put the counters into a counter group"), |
861 | OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts, | 887 | OPT_CALLBACK_NOOPT('g', NULL, &record.opts, |
862 | "mode[,dump_size]", record_callchain_help, | 888 | NULL, "enables call-graph recording" , |
863 | &record_parse_callchain_opt, "fp"), | 889 | &record_callchain_opt), |
890 | OPT_CALLBACK(0, "call-graph", &record.opts, | ||
891 | "mode[,dump_size]", record_callchain_help, | ||
892 | &record_parse_callchain_opt), | ||
864 | OPT_INCR('v', "verbose", &verbose, | 893 | OPT_INCR('v', "verbose", &verbose, |
865 | "be more verbose (show counter open errors, etc)"), | 894 | "be more verbose (show counter open errors, etc)"), |
866 | OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), | 895 | OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 212214162bb2..5a11f13e56f9 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -810,7 +810,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
810 | ret = perf_evlist__parse_sample(top->evlist, event, &sample); | 810 | ret = perf_evlist__parse_sample(top->evlist, event, &sample); |
811 | if (ret) { | 811 | if (ret) { |
812 | pr_err("Can't parse sample, err = %d\n", ret); | 812 | pr_err("Can't parse sample, err = %d\n", ret); |
813 | continue; | 813 | goto next_event; |
814 | } | 814 | } |
815 | 815 | ||
816 | evsel = perf_evlist__id2evsel(session->evlist, sample.id); | 816 | evsel = perf_evlist__id2evsel(session->evlist, sample.id); |
@@ -825,13 +825,13 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
825 | case PERF_RECORD_MISC_USER: | 825 | case PERF_RECORD_MISC_USER: |
826 | ++top->us_samples; | 826 | ++top->us_samples; |
827 | if (top->hide_user_symbols) | 827 | if (top->hide_user_symbols) |
828 | continue; | 828 | goto next_event; |
829 | machine = &session->machines.host; | 829 | machine = &session->machines.host; |
830 | break; | 830 | break; |
831 | case PERF_RECORD_MISC_KERNEL: | 831 | case PERF_RECORD_MISC_KERNEL: |
832 | ++top->kernel_samples; | 832 | ++top->kernel_samples; |
833 | if (top->hide_kernel_symbols) | 833 | if (top->hide_kernel_symbols) |
834 | continue; | 834 | goto next_event; |
835 | machine = &session->machines.host; | 835 | machine = &session->machines.host; |
836 | break; | 836 | break; |
837 | case PERF_RECORD_MISC_GUEST_KERNEL: | 837 | case PERF_RECORD_MISC_GUEST_KERNEL: |
@@ -847,7 +847,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
847 | */ | 847 | */ |
848 | /* Fall thru */ | 848 | /* Fall thru */ |
849 | default: | 849 | default: |
850 | continue; | 850 | goto next_event; |
851 | } | 851 | } |
852 | 852 | ||
853 | 853 | ||
@@ -859,6 +859,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
859 | machine__process_event(machine, event); | 859 | machine__process_event(machine, event); |
860 | } else | 860 | } else |
861 | ++session->stats.nr_unknown_events; | 861 | ++session->stats.nr_unknown_events; |
862 | next_event: | ||
863 | perf_evlist__mmap_consume(top->evlist, idx); | ||
862 | } | 864 | } |
863 | } | 865 | } |
864 | 866 | ||
@@ -1016,16 +1018,16 @@ out_delete: | |||
1016 | } | 1018 | } |
1017 | 1019 | ||
1018 | static int | 1020 | static int |
1019 | parse_callchain_opt(const struct option *opt, const char *arg, int unset) | 1021 | callchain_opt(const struct option *opt, const char *arg, int unset) |
1020 | { | 1022 | { |
1021 | /* | ||
1022 | * --no-call-graph | ||
1023 | */ | ||
1024 | if (unset) | ||
1025 | return 0; | ||
1026 | |||
1027 | symbol_conf.use_callchain = true; | 1023 | symbol_conf.use_callchain = true; |
1024 | return record_callchain_opt(opt, arg, unset); | ||
1025 | } | ||
1028 | 1026 | ||
1027 | static int | ||
1028 | parse_callchain_opt(const struct option *opt, const char *arg, int unset) | ||
1029 | { | ||
1030 | symbol_conf.use_callchain = true; | ||
1029 | return record_parse_callchain_opt(opt, arg, unset); | 1031 | return record_parse_callchain_opt(opt, arg, unset); |
1030 | } | 1032 | } |
1031 | 1033 | ||
@@ -1106,9 +1108,12 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1106 | "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight"), | 1108 | "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight"), |
1107 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, | 1109 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, |
1108 | "Show a column with the number of samples"), | 1110 | "Show a column with the number of samples"), |
1109 | OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts, | 1111 | OPT_CALLBACK_NOOPT('G', NULL, &top.record_opts, |
1110 | "mode[,dump_size]", record_callchain_help, | 1112 | NULL, "enables call-graph recording", |
1111 | &parse_callchain_opt, "fp"), | 1113 | &callchain_opt), |
1114 | OPT_CALLBACK(0, "call-graph", &top.record_opts, | ||
1115 | "mode[,dump_size]", record_callchain_help, | ||
1116 | &parse_callchain_opt), | ||
1112 | OPT_CALLBACK(0, "ignore-callees", NULL, "regex", | 1117 | OPT_CALLBACK(0, "ignore-callees", NULL, "regex", |
1113 | "ignore callees of these functions in call graphs", | 1118 | "ignore callees of these functions in call graphs", |
1114 | report_parse_ignore_callees_opt), | 1119 | report_parse_ignore_callees_opt), |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 71aa3e35406b..99c8d9ad6729 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -987,7 +987,7 @@ again: | |||
987 | err = perf_evlist__parse_sample(evlist, event, &sample); | 987 | err = perf_evlist__parse_sample(evlist, event, &sample); |
988 | if (err) { | 988 | if (err) { |
989 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); | 989 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); |
990 | continue; | 990 | goto next_event; |
991 | } | 991 | } |
992 | 992 | ||
993 | if (trace->base_time == 0) | 993 | if (trace->base_time == 0) |
@@ -1001,18 +1001,20 @@ again: | |||
1001 | evsel = perf_evlist__id2evsel(evlist, sample.id); | 1001 | evsel = perf_evlist__id2evsel(evlist, sample.id); |
1002 | if (evsel == NULL) { | 1002 | if (evsel == NULL) { |
1003 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); | 1003 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); |
1004 | continue; | 1004 | goto next_event; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | if (sample.raw_data == NULL) { | 1007 | if (sample.raw_data == NULL) { |
1008 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", | 1008 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", |
1009 | perf_evsel__name(evsel), sample.tid, | 1009 | perf_evsel__name(evsel), sample.tid, |
1010 | sample.cpu, sample.raw_size); | 1010 | sample.cpu, sample.raw_size); |
1011 | continue; | 1011 | goto next_event; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | handler = evsel->handler.func; | 1014 | handler = evsel->handler.func; |
1015 | handler(trace, evsel, &sample); | 1015 | handler(trace, evsel, &sample); |
1016 | next_event: | ||
1017 | perf_evlist__mmap_consume(evlist, i); | ||
1016 | 1018 | ||
1017 | if (done) | 1019 | if (done) |
1018 | goto out_unmap_evlist; | 1020 | goto out_unmap_evlist; |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 6fb781d5586c..e3fedfa2906e 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -290,6 +290,7 @@ static int process_events(struct machine *machine, struct perf_evlist *evlist, | |||
290 | for (i = 0; i < evlist->nr_mmaps; i++) { | 290 | for (i = 0; i < evlist->nr_mmaps; i++) { |
291 | while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { | 291 | while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { |
292 | ret = process_event(machine, evlist, event, state); | 292 | ret = process_event(machine, evlist, event, state); |
293 | perf_evlist__mmap_consume(evlist, i); | ||
293 | if (ret < 0) | 294 | if (ret < 0) |
294 | return ret; | 295 | return ret; |
295 | } | 296 | } |
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index d444ea2c47d9..376c35608534 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c | |||
@@ -36,6 +36,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm) | |||
36 | (pid_t)event->comm.tid == getpid() && | 36 | (pid_t)event->comm.tid == getpid() && |
37 | strcmp(event->comm.comm, comm) == 0) | 37 | strcmp(event->comm.comm, comm) == 0) |
38 | found += 1; | 38 | found += 1; |
39 | perf_evlist__mmap_consume(evlist, i); | ||
39 | } | 40 | } |
40 | } | 41 | } |
41 | return found; | 42 | return found; |
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index c4185b9aeb80..a7232c204eb9 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -122,6 +122,7 @@ int test__basic_mmap(void) | |||
122 | goto out_munmap; | 122 | goto out_munmap; |
123 | } | 123 | } |
124 | nr_events[evsel->idx]++; | 124 | nr_events[evsel->idx]++; |
125 | perf_evlist__mmap_consume(evlist, 0); | ||
125 | } | 126 | } |
126 | 127 | ||
127 | err = 0; | 128 | err = 0; |
diff --git a/tools/perf/tests/open-syscall-tp-fields.c b/tools/perf/tests/open-syscall-tp-fields.c index fc5b9fca8b47..524b221b829b 100644 --- a/tools/perf/tests/open-syscall-tp-fields.c +++ b/tools/perf/tests/open-syscall-tp-fields.c | |||
@@ -77,8 +77,10 @@ int test__syscall_open_tp_fields(void) | |||
77 | 77 | ||
78 | ++nr_events; | 78 | ++nr_events; |
79 | 79 | ||
80 | if (type != PERF_RECORD_SAMPLE) | 80 | if (type != PERF_RECORD_SAMPLE) { |
81 | perf_evlist__mmap_consume(evlist, i); | ||
81 | continue; | 82 | continue; |
83 | } | ||
82 | 84 | ||
83 | err = perf_evsel__parse_sample(evsel, event, &sample); | 85 | err = perf_evsel__parse_sample(evsel, event, &sample); |
84 | if (err) { | 86 | if (err) { |
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index b8a7056519ac..7923b06ffc91 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
@@ -263,6 +263,8 @@ int test__PERF_RECORD(void) | |||
263 | type); | 263 | type); |
264 | ++errs; | 264 | ++errs; |
265 | } | 265 | } |
266 | |||
267 | perf_evlist__mmap_consume(evlist, i); | ||
266 | } | 268 | } |
267 | } | 269 | } |
268 | 270 | ||
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c index 0ab61b1f408e..4ca1b938f6a6 100644 --- a/tools/perf/tests/perf-time-to-tsc.c +++ b/tools/perf/tests/perf-time-to-tsc.c | |||
@@ -122,7 +122,7 @@ int test__perf_time_to_tsc(void) | |||
122 | if (event->header.type != PERF_RECORD_COMM || | 122 | if (event->header.type != PERF_RECORD_COMM || |
123 | (pid_t)event->comm.pid != getpid() || | 123 | (pid_t)event->comm.pid != getpid() || |
124 | (pid_t)event->comm.tid != getpid()) | 124 | (pid_t)event->comm.tid != getpid()) |
125 | continue; | 125 | goto next_event; |
126 | 126 | ||
127 | if (strcmp(event->comm.comm, comm1) == 0) { | 127 | if (strcmp(event->comm.comm, comm1) == 0) { |
128 | CHECK__(perf_evsel__parse_sample(evsel, event, | 128 | CHECK__(perf_evsel__parse_sample(evsel, event, |
@@ -134,6 +134,8 @@ int test__perf_time_to_tsc(void) | |||
134 | &sample)); | 134 | &sample)); |
135 | comm2_time = sample.time; | 135 | comm2_time = sample.time; |
136 | } | 136 | } |
137 | next_event: | ||
138 | perf_evlist__mmap_consume(evlist, i); | ||
137 | } | 139 | } |
138 | } | 140 | } |
139 | 141 | ||
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index 2e41e2d32ccc..6e2b44ec0749 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c | |||
@@ -78,7 +78,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
78 | struct perf_sample sample; | 78 | struct perf_sample sample; |
79 | 79 | ||
80 | if (event->header.type != PERF_RECORD_SAMPLE) | 80 | if (event->header.type != PERF_RECORD_SAMPLE) |
81 | continue; | 81 | goto next_event; |
82 | 82 | ||
83 | err = perf_evlist__parse_sample(evlist, event, &sample); | 83 | err = perf_evlist__parse_sample(evlist, event, &sample); |
84 | if (err < 0) { | 84 | if (err < 0) { |
@@ -88,6 +88,8 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
88 | 88 | ||
89 | total_periods += sample.period; | 89 | total_periods += sample.period; |
90 | nr_samples++; | 90 | nr_samples++; |
91 | next_event: | ||
92 | perf_evlist__mmap_consume(evlist, 0); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | if ((u64) nr_samples == total_periods) { | 95 | if ((u64) nr_samples == total_periods) { |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 28fe5894b061..a3e64876e940 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -96,10 +96,10 @@ int test__task_exit(void) | |||
96 | 96 | ||
97 | retry: | 97 | retry: |
98 | while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) { | 98 | while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) { |
99 | if (event->header.type != PERF_RECORD_EXIT) | 99 | if (event->header.type == PERF_RECORD_EXIT) |
100 | continue; | 100 | nr_exit++; |
101 | 101 | ||
102 | nr_exit++; | 102 | perf_evlist__mmap_consume(evlist, 0); |
103 | } | 103 | } |
104 | 104 | ||
105 | if (!exited || !nr_exit) { | 105 | if (!exited || !nr_exit) { |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 194e2f42ff5d..6c152686e837 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -315,8 +315,7 @@ static inline void advance_hpp(struct perf_hpp *hpp, int inc) | |||
315 | } | 315 | } |
316 | 316 | ||
317 | static int hist_entry__period_snprintf(struct perf_hpp *hpp, | 317 | static int hist_entry__period_snprintf(struct perf_hpp *hpp, |
318 | struct hist_entry *he, | 318 | struct hist_entry *he) |
319 | bool color) | ||
320 | { | 319 | { |
321 | const char *sep = symbol_conf.field_sep; | 320 | const char *sep = symbol_conf.field_sep; |
322 | struct perf_hpp_fmt *fmt; | 321 | struct perf_hpp_fmt *fmt; |
@@ -338,7 +337,7 @@ static int hist_entry__period_snprintf(struct perf_hpp *hpp, | |||
338 | } else | 337 | } else |
339 | first = false; | 338 | first = false; |
340 | 339 | ||
341 | if (color && fmt->color) | 340 | if (perf_hpp__use_color() && fmt->color) |
342 | ret = fmt->color(fmt, hpp, he); | 341 | ret = fmt->color(fmt, hpp, he); |
343 | else | 342 | else |
344 | ret = fmt->entry(fmt, hpp, he); | 343 | ret = fmt->entry(fmt, hpp, he); |
@@ -358,12 +357,11 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, | |||
358 | .buf = bf, | 357 | .buf = bf, |
359 | .size = size, | 358 | .size = size, |
360 | }; | 359 | }; |
361 | bool color = !symbol_conf.field_sep; | ||
362 | 360 | ||
363 | if (size == 0 || size > bfsz) | 361 | if (size == 0 || size > bfsz) |
364 | size = hpp.size = bfsz; | 362 | size = hpp.size = bfsz; |
365 | 363 | ||
366 | ret = hist_entry__period_snprintf(&hpp, he, color); | 364 | ret = hist_entry__period_snprintf(&hpp, he); |
367 | hist_entry__sort_snprintf(he, bf + ret, size - ret, hists); | 365 | hist_entry__sort_snprintf(he, bf + ret, size - ret, hists); |
368 | 366 | ||
369 | ret = fprintf(fp, "%s\n", bf); | 367 | ret = fprintf(fp, "%s\n", bf); |
@@ -482,6 +480,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
482 | 480 | ||
483 | print_entries: | 481 | print_entries: |
484 | linesz = hists__sort_list_width(hists) + 3 + 1; | 482 | linesz = hists__sort_list_width(hists) + 3 + 1; |
483 | linesz += perf_hpp__color_overhead(); | ||
485 | line = malloc(linesz); | 484 | line = malloc(linesz); |
486 | if (line == NULL) { | 485 | if (line == NULL) { |
487 | ret = -1; | 486 | ret = -1; |
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 2b585bc308cf..9e99060408ae 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -147,6 +147,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor) | |||
147 | 147 | ||
148 | struct option; | 148 | struct option; |
149 | 149 | ||
150 | int record_parse_callchain(const char *arg, struct perf_record_opts *opts); | ||
150 | int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); | 151 | int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); |
152 | int record_callchain_opt(const struct option *opt, const char *arg, int unset); | ||
153 | |||
151 | extern const char record_callchain_help[]; | 154 | extern const char record_callchain_help[]; |
152 | #endif /* __PERF_CALLCHAIN_H */ | 155 | #endif /* __PERF_CALLCHAIN_H */ |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 63df031fc9c7..49096ea58a15 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -213,7 +213,7 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
213 | &event->mmap.pgoff, | 213 | &event->mmap.pgoff, |
214 | execname); | 214 | execname); |
215 | 215 | ||
216 | if (n != 8) | 216 | if (n != 5) |
217 | continue; | 217 | continue; |
218 | 218 | ||
219 | if (prot[2] != 'x') | 219 | if (prot[2] != 'x') |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index f9f77bee0b1b..e584cd30b0f2 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -545,12 +545,19 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) | |||
545 | 545 | ||
546 | md->prev = old; | 546 | md->prev = old; |
547 | 547 | ||
548 | if (!evlist->overwrite) | ||
549 | perf_mmap__write_tail(md, old); | ||
550 | |||
551 | return event; | 548 | return event; |
552 | } | 549 | } |
553 | 550 | ||
551 | void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx) | ||
552 | { | ||
553 | if (!evlist->overwrite) { | ||
554 | struct perf_mmap *md = &evlist->mmap[idx]; | ||
555 | unsigned int old = md->prev; | ||
556 | |||
557 | perf_mmap__write_tail(md, old); | ||
558 | } | ||
559 | } | ||
560 | |||
554 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx) | 561 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx) |
555 | { | 562 | { |
556 | if (evlist->mmap[idx].base != NULL) { | 563 | if (evlist->mmap[idx].base != NULL) { |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 880d7139d2fb..206d09339306 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -89,6 +89,8 @@ struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id); | |||
89 | 89 | ||
90 | union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); | 90 | union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); |
91 | 91 | ||
92 | void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx); | ||
93 | |||
92 | int perf_evlist__open(struct perf_evlist *evlist); | 94 | int perf_evlist__open(struct perf_evlist *evlist); |
93 | void perf_evlist__close(struct perf_evlist *evlist); | 95 | void perf_evlist__close(struct perf_evlist *evlist); |
94 | 96 | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 1329b6b6ffe6..ce8dc61ce2c3 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <pthread.h> | 5 | #include <pthread.h> |
6 | #include "callchain.h" | 6 | #include "callchain.h" |
7 | #include "header.h" | 7 | #include "header.h" |
8 | #include "color.h" | ||
8 | 9 | ||
9 | extern struct callchain_param callchain_param; | 10 | extern struct callchain_param callchain_param; |
10 | 11 | ||
@@ -175,6 +176,18 @@ void perf_hpp__init(void); | |||
175 | void perf_hpp__column_register(struct perf_hpp_fmt *format); | 176 | void perf_hpp__column_register(struct perf_hpp_fmt *format); |
176 | void perf_hpp__column_enable(unsigned col); | 177 | void perf_hpp__column_enable(unsigned col); |
177 | 178 | ||
179 | static inline size_t perf_hpp__use_color(void) | ||
180 | { | ||
181 | return !symbol_conf.field_sep; | ||
182 | } | ||
183 | |||
184 | static inline size_t perf_hpp__color_overhead(void) | ||
185 | { | ||
186 | return perf_hpp__use_color() ? | ||
187 | (COLOR_MAXLEN + sizeof(PERF_COLOR_RESET)) * PERF_HPP__MAX_INDEX | ||
188 | : 0; | ||
189 | } | ||
190 | |||
178 | struct perf_evlist; | 191 | struct perf_evlist; |
179 | 192 | ||
180 | struct hist_browser_timer { | 193 | struct hist_browser_timer { |
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 71b5412bbbb9..2ac4bc92bb1f 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -822,6 +822,8 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, | |||
822 | PyObject *pyevent = pyrf_event__new(event); | 822 | PyObject *pyevent = pyrf_event__new(event); |
823 | struct pyrf_event *pevent = (struct pyrf_event *)pyevent; | 823 | struct pyrf_event *pevent = (struct pyrf_event *)pyevent; |
824 | 824 | ||
825 | perf_evlist__mmap_consume(evlist, cpu); | ||
826 | |||
825 | if (pyevent == NULL) | 827 | if (pyevent == NULL) |
826 | return PyErr_NoMemory(); | 828 | return PyErr_NoMemory(); |
827 | 829 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index cc75a3cef388..95d91a0b23af 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -56,6 +56,17 @@ static void handler_call_die(const char *handler_name) | |||
56 | Py_FatalError("problem in Python trace event handler"); | 56 | Py_FatalError("problem in Python trace event handler"); |
57 | } | 57 | } |
58 | 58 | ||
59 | /* | ||
60 | * Insert val into into the dictionary and decrement the reference counter. | ||
61 | * This is necessary for dictionaries since PyDict_SetItemString() does not | ||
62 | * steal a reference, as opposed to PyTuple_SetItem(). | ||
63 | */ | ||
64 | static void pydict_set_item_string_decref(PyObject *dict, const char *key, PyObject *val) | ||
65 | { | ||
66 | PyDict_SetItemString(dict, key, val); | ||
67 | Py_DECREF(val); | ||
68 | } | ||
69 | |||
59 | static void define_value(enum print_arg_type field_type, | 70 | static void define_value(enum print_arg_type field_type, |
60 | const char *ev_name, | 71 | const char *ev_name, |
61 | const char *field_name, | 72 | const char *field_name, |
@@ -279,11 +290,11 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
279 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); | 290 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); |
280 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); | 291 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); |
281 | } else { | 292 | } else { |
282 | PyDict_SetItemString(dict, "common_cpu", PyInt_FromLong(cpu)); | 293 | pydict_set_item_string_decref(dict, "common_cpu", PyInt_FromLong(cpu)); |
283 | PyDict_SetItemString(dict, "common_s", PyInt_FromLong(s)); | 294 | pydict_set_item_string_decref(dict, "common_s", PyInt_FromLong(s)); |
284 | PyDict_SetItemString(dict, "common_ns", PyInt_FromLong(ns)); | 295 | pydict_set_item_string_decref(dict, "common_ns", PyInt_FromLong(ns)); |
285 | PyDict_SetItemString(dict, "common_pid", PyInt_FromLong(pid)); | 296 | pydict_set_item_string_decref(dict, "common_pid", PyInt_FromLong(pid)); |
286 | PyDict_SetItemString(dict, "common_comm", PyString_FromString(comm)); | 297 | pydict_set_item_string_decref(dict, "common_comm", PyString_FromString(comm)); |
287 | } | 298 | } |
288 | for (field = event->format.fields; field; field = field->next) { | 299 | for (field = event->format.fields; field; field = field->next) { |
289 | if (field->flags & FIELD_IS_STRING) { | 300 | if (field->flags & FIELD_IS_STRING) { |
@@ -313,7 +324,7 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
313 | if (handler) | 324 | if (handler) |
314 | PyTuple_SetItem(t, n++, obj); | 325 | PyTuple_SetItem(t, n++, obj); |
315 | else | 326 | else |
316 | PyDict_SetItemString(dict, field->name, obj); | 327 | pydict_set_item_string_decref(dict, field->name, obj); |
317 | 328 | ||
318 | } | 329 | } |
319 | if (!handler) | 330 | if (!handler) |
@@ -370,21 +381,21 @@ static void python_process_general_event(union perf_event *perf_event | |||
370 | if (!handler || !PyCallable_Check(handler)) | 381 | if (!handler || !PyCallable_Check(handler)) |
371 | goto exit; | 382 | goto exit; |
372 | 383 | ||
373 | PyDict_SetItemString(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); | 384 | pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); |
374 | PyDict_SetItemString(dict, "attr", PyString_FromStringAndSize( | 385 | pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize( |
375 | (const char *)&evsel->attr, sizeof(evsel->attr))); | 386 | (const char *)&evsel->attr, sizeof(evsel->attr))); |
376 | PyDict_SetItemString(dict, "sample", PyString_FromStringAndSize( | 387 | pydict_set_item_string_decref(dict, "sample", PyString_FromStringAndSize( |
377 | (const char *)sample, sizeof(*sample))); | 388 | (const char *)sample, sizeof(*sample))); |
378 | PyDict_SetItemString(dict, "raw_buf", PyString_FromStringAndSize( | 389 | pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( |
379 | (const char *)sample->raw_data, sample->raw_size)); | 390 | (const char *)sample->raw_data, sample->raw_size)); |
380 | PyDict_SetItemString(dict, "comm", | 391 | pydict_set_item_string_decref(dict, "comm", |
381 | PyString_FromString(thread->comm)); | 392 | PyString_FromString(thread->comm)); |
382 | if (al->map) { | 393 | if (al->map) { |
383 | PyDict_SetItemString(dict, "dso", | 394 | pydict_set_item_string_decref(dict, "dso", |
384 | PyString_FromString(al->map->dso->name)); | 395 | PyString_FromString(al->map->dso->name)); |
385 | } | 396 | } |
386 | if (al->sym) { | 397 | if (al->sym) { |
387 | PyDict_SetItemString(dict, "symbol", | 398 | pydict_set_item_string_decref(dict, "symbol", |
388 | PyString_FromString(al->sym->name)); | 399 | PyString_FromString(al->sym->name)); |
389 | } | 400 | } |
390 | 401 | ||
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a9dd682cf5e3..1cf9ccb01013 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -3091,7 +3091,7 @@ static const struct file_operations *stat_fops[] = { | |||
3091 | 3091 | ||
3092 | static int kvm_init_debug(void) | 3092 | static int kvm_init_debug(void) |
3093 | { | 3093 | { |
3094 | int r = -EFAULT; | 3094 | int r = -EEXIST; |
3095 | struct kvm_stats_debugfs_item *p; | 3095 | struct kvm_stats_debugfs_item *p; |
3096 | 3096 | ||
3097 | kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); | 3097 | kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); |