History

Merge branch 'linus' into perf/core

Pick up the latest upstream fixes.

Ingo Molnar committed 13 years ago

Commit aee2bce2 parents 5ec4c59 c95389b331 files · +2778 −1364Browse files

Unified · Split

331 files
  1. Documentation/kernel-parameters.txt +1 −1
  2. MAINTAINERS +7 −7
  3. Makefile +1 −1
  4. arch/Kconfig +6 −0
  5. arch/arc/lib/strchr-700.S +10 −0
  6. arch/arm/boot/dts/at91sam9n12ek.dts +2 −2
  7. arch/arm/boot/dts/at91sam9x5ek.dtsi +3 −2
  8. arch/arm/boot/dts/tegra20-seaboard.dts +2 −0
  9. arch/arm/boot/dts/tegra20-trimslice.dts +2 −0
  10. arch/arm/boot/dts/tegra20-whistler.dts +4 −0
  11. arch/arm/include/asm/smp_plat.h +3 −0
  12. arch/arm/include/asm/spinlock.h +31 −20
  13. arch/arm/include/asm/tlb.h +5 −2
  14. arch/arm/kernel/entry-armv.S +2 −1
  15. arch/arm/kernel/fiq.c +3 −6
  16. arch/arm/kernel/machine_kexec.c +17 −4
  17. arch/arm/kernel/perf_event.c +9 −1
  18. arch/arm/kernel/process.c +1 −1
  19. arch/arm/kernel/smp.c +10 −0
  20. arch/arm/kvm/coproc.c +19 −7
  21. arch/arm/kvm/coproc.h +3 −0
  22. arch/arm/kvm/coproc_a15.c +5 −1
  23. arch/arm/kvm/mmio.c +2 −1
  24. arch/arm/kvm/mmu.c +15 −21
  25. arch/arm/mach-at91/at91sam9x5.c +2 −0
  26. arch/arm/mach-davinci/board-dm355-leopard.c +1 −0
  27. arch/arm/mach-davinci/board-dm644x-evm.c +1 −0
  28. arch/arm/mach-davinci/board-dm646x-evm.c +1 −0
  29. arch/arm/mach-davinci/board-neuros-osd2.c +1 −0
  30. arch/arm/mach-omap2/board-n8x0.c +0 −4
  31. arch/arm/mach-omap2/board-rx51.c +1 −1
  32. arch/arm/mach-omap2/usb-musb.c +1 −4
  33. arch/arm/mm/Kconfig +6 −3
  34. arch/arm/plat-samsung/init.c +3 −2
  35. arch/arm/xen/enlighten.c +1 −0
  36. arch/arm64/include/asm/kvm_asm.h +10 −7
  37. arch/arm64/include/asm/kvm_host.h +1 −1
  38. arch/arm64/include/asm/tlb.h +5 −2
  39. arch/arm64/kernel/perf_event.c +9 −1
  40. arch/arm64/kvm/hyp.S +13 −0
  41. arch/arm64/kvm/sys_regs.c +3 −0
  42. arch/hexagon/Kconfig +1 −0
  43. arch/ia64/include/asm/tlb.h +6 −3
  44. arch/m68k/emu/natfeat.c +19 −4
  45. arch/m68k/include/asm/div64.h +5 −4
  46. arch/microblaze/Kconfig +1 −1
  47. arch/mips/math-emu/cp1emu.c +26 −0
  48. arch/openrisc/Kconfig +1 −0
  49. arch/powerpc/Kconfig +1 −0
  50. arch/powerpc/include/asm/page.h +10 −0
  51. arch/powerpc/kernel/lparcfg.c +9 −13
  52. arch/s390/include/asm/tlb.h +6 −2
  53. arch/score/Kconfig +2 −0
  54. arch/sh/include/asm/tlb.h +4 −2
  55. arch/um/include/asm/tlb.h +4 −2
  56. arch/x86/include/asm/bootparam_utils.h +2 −2
  57. arch/x86/include/asm/microcode_amd.h +1 −1
  58. arch/x86/include/asm/pgtable-2level.h +47 −1
  59. arch/x86/include/asm/pgtable-3level.h +3 −0
  60. arch/x86/include/asm/pgtable.h +30 −0
  61. arch/x86/include/asm/pgtable_types.h +16 −1
  62. arch/x86/include/asm/spinlock.h +0 −4
  63. arch/x86/kernel/cpu/amd.c +5 −15
  64. arch/x86/kernel/cpu/perf_event_intel.c +1 −0
  65. arch/x86/kernel/cpu/perf_event_intel_uncore.c +2 −2
  66. arch/x86/kernel/microcode_amd.c +13 −14
  67. arch/x86/kernel/microcode_amd_early.c +13 −14
  68. arch/x86/kernel/sys_x86_64.c +1 −1
  69. arch/x86/mm/mmap.c +4 −2
  70. arch/x86/xen/setup.c +22 −0
  71. arch/x86/xen/smp.c +9 −2
  72. drivers/acpi/video.c +3 −8
  73. drivers/ata/libata-pmp.c +6 −6
  74. drivers/ata/sata_fsl.c +3 −2
  75. drivers/ata/sata_highbank.c +2 −2
  76. drivers/base/memory.c +2 −0
  77. drivers/base/regmap/regcache-rbtree.c +1 −1
  78. drivers/block/aoe/aoecmd.c +7 −10
  79. drivers/clk/samsung/clk-exynos4.c +34 −30
  80. drivers/clk/zynq/clkc.c +8 −5
  81. drivers/gpu/drm/gma500/psb_intel_sdvo.c +2 −1
  82. drivers/gpu/drm/i915/i915_gem_dmabuf.c +8 −0
  83. drivers/gpu/drm/i915/i915_reg.h +2 −0
  84. drivers/gpu/drm/i915/intel_display.c +57 −29
  85. drivers/gpu/drm/i915/intel_ringbuffer.c +12 −0
  86. drivers/gpu/drm/nouveau/core/core/mm.c +4 −0
  87. drivers/gpu/drm/nouveau/core/include/subdev/mc.h +4 −3
  88. drivers/gpu/drm/nouveau/core/subdev/fb/ramnv49.c +6 −6
  89. drivers/gpu/drm/nouveau/core/subdev/fb/ramnv4e.c +2 −2
  90. drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c +24 −10
  91. drivers/gpu/drm/nouveau/core/subdev/mc/base.c +5 −1
  92. drivers/gpu/drm/nouveau/core/subdev/mc/nv04.c +1 −2
  93. drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c +1 −2
  94. drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c +1 −2
  95. drivers/gpu/drm/nouveau/core/subdev/mc/nv98.c +1 −2
  96. drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c +1 −2
  97. drivers/gpu/drm/nouveau/dispnv04/crtc.c +43 −15
  98. drivers/gpu/drm/nouveau/dispnv04/disp.h +1 −0
  99. drivers/gpu/drm/nouveau/nouveau_display.c +3 −0
  100. drivers/gpu/drm/nouveau/nv40_pm.c +1 −1
  101. drivers/gpu/drm/radeon/radeon.h +1 −1
  102. drivers/gpu/drm/radeon/radeon_uvd.c +8 −0
  103. drivers/gpu/drm/radeon/rv770.c +6 −6
  104. drivers/iio/light/adjd_s311.c +2 −1
  105. drivers/md/dm-cache-policy-mq.c +7 −9
  106. drivers/net/bonding/bond_main.c +7 −1
  107. drivers/net/can/usb/peak_usb/pcan_usb.c +1 −1
  108. drivers/net/ethernet/arc/emac_main.c +1 −1
  109. drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +7 −0
  110. drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +42 −11
  111. drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h +3 −0
  112. drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +5 −0
  113. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +61 −27
  114. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +34 −24
  115. drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +54 −12
  116. drivers/net/ethernet/broadcom/tg3.c +8 −5
  117. drivers/net/ethernet/chelsio/cxgb3/sge.c +24 −83
  118. drivers/net/ethernet/emulex/benet/be_cmds.c +3 −0
  119. drivers/net/ethernet/emulex/benet/be_cmds.h +6 −0
  120. drivers/net/ethernet/emulex/benet/be_main.c +1 −1
  121. drivers/net/ethernet/marvell/skge.c +53 −15
  122. drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 −1
  123. drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 −1
  124. drivers/net/ethernet/mellanox/mlx5/core/fw.c +1 −1
  125. drivers/net/ethernet/mellanox/mlx5/core/health.c +1 −28
  126. drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +26 −32
  127. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +5 −0
  128. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +2 −1
  129. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +4 −2
  130. drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +3 −3
  131. drivers/net/ethernet/realtek/8139cp.c +1 −0
  132. drivers/net/ethernet/realtek/r8169.c +1 −1
  133. drivers/net/ethernet/sfc/filter.c +1 −1
  134. drivers/net/ethernet/stmicro/stmmac/ring_mode.c +11 −2
  135. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +92 −19
  136. drivers/net/ethernet/via/via-velocity.c +3 −1
  137. drivers/net/irda/via-ircc.c +2 −4
  138. drivers/net/macvlan.c +4 −0
  139. drivers/net/macvtap.c +18 −12
  140. drivers/net/phy/realtek.c +2 −2
  141. drivers/net/tun.c +4 −2
  142. drivers/net/usb/hso.c +10 −5
  143. drivers/net/vxlan.c +1 −3
  144. drivers/net/wireless/cw1200/sta.c +2 −5
  145. drivers/net/wireless/hostap/hostap_ioctl.c +2 −2
  146. drivers/net/wireless/iwlegacy/4965-mac.c +8 −8
  147. drivers/net/wireless/iwlegacy/common.c +1 −0
  148. drivers/net/wireless/iwlwifi/dvm/mac80211.c +4 −1
  149. drivers/net/wireless/iwlwifi/iwl-prph.h +0 −2
  150. drivers/net/wireless/iwlwifi/mvm/time-event.c +23 −10
  151. drivers/net/wireless/iwlwifi/pcie/rx.c +0 −8
  152. drivers/net/wireless/iwlwifi/pcie/trans.c +5 −5
  153. drivers/net/wireless/zd1201.c +3 −1
  154. drivers/of/fdt.c +2 −0
  155. drivers/pinctrl/pinctrl-sunxi.c +62 −4
  156. drivers/pinctrl/pinctrl-sunxi.h +2 −0
  157. drivers/platform/olpc/olpc-ec.c +1 −1
  158. drivers/platform/x86/hp-wmi.c +0 −16
  159. drivers/platform/x86/sony-laptop.c +6 −2
  160. drivers/rtc/rtc-stmp3xxx.c +25 −10
  161. drivers/s390/scsi/zfcp_erp.c +22 −7
  162. drivers/s390/scsi/zfcp_qdio.c +2 −6
  163. drivers/s390/scsi/zfcp_sysfs.c +14 −0
  164. drivers/scsi/Kconfig +0 −1
  165. drivers/staging/comedi/drivers.c +1 −1
  166. drivers/tty/hvc/hvsi_lib.c +2 −2
  167. drivers/usb/class/usbtmc.c +4 −4
  168. drivers/usb/core/quirks.c +6 −0
  169. drivers/usb/host/ehci-sched.c +6 −7
  170. drivers/usb/host/ohci-pci.c +7 −0
  171. drivers/usb/misc/adutux.c +1 −1
  172. drivers/usb/phy/phy-fsl-usb.h +1 −1
  173. drivers/usb/phy/phy-fsm-usb.c +1 −1
  174. drivers/usb/serial/keyspan.c +1 −1
  175. drivers/usb/serial/mos7720.c +14 −7
  176. drivers/usb/serial/mos7840.c +1 −1
  177. drivers/usb/serial/ti_usb_3410_5052.c +5 −4
  178. drivers/usb/serial/usb_wwan.c +10 −10
  179. drivers/usb/wusbcore/wa-xfer.c +7 −2
  180. drivers/xen/events.c +12 −1
  181. fs/bfs/inode.c +1 −1
  182. fs/bio.c +15 −5
  183. fs/cifs/cifsencrypt.c +9 −5
  184. fs/cifs/cifsfs.c +5 −6
  185. fs/cifs/cifsglob.h +4 −0
  186. fs/cifs/cifsproto.h +3 −1
  187. fs/cifs/connect.c +4 −3
  188. fs/cifs/file.c +1 −0
  189. fs/cifs/link.c +53 −31
  190. fs/cifs/readdir.c +8 −0
  191. fs/cifs/sess.c +3 −3
  192. fs/cifs/smb1ops.c +1 −0
  193. fs/cifs/smb2transport.c +7 −2
  194. fs/dcache.c +34 −34
  195. fs/efs/inode.c +1 −1
  196. fs/exec.c +2 −2
  197. fs/ext4/ext4.h +1 −0
  198. fs/ext4/ext4_jbd2.c +4 −4
  199. fs/ext4/file.c +4 −17
  200. fs/ext4/inode.c +43 −0
  201. fs/ext4/ioctl.c +4 −2
  202. fs/ext4/super.c +17 −2
  203. fs/gfs2/glock.c +4 −4
  204. fs/gfs2/glops.c +13 −5
  205. fs/gfs2/inode.c +5 −1
  206. fs/gfs2/main.c +1 −1
  207. fs/hugetlbfs/inode.c +11 −7
  208. fs/jfs/jfs_dtree.c +23 −8
  209. fs/namei.c +10 −6
  210. fs/namespace.c +1 −1
  211. fs/nilfs2/segbuf.c +2 −3
  212. fs/ocfs2/aops.c +1 −1
  213. fs/ocfs2/dir.c +1 −3
  214. fs/ocfs2/file.c +3 −3
  215. fs/ocfs2/journal.h +1 −1
  216. fs/ocfs2/move_extents.c +1 −1
  217. fs/ocfs2/refcounttree.c +8 −45
  218. fs/ocfs2/refcounttree.h +3 −3
  219. fs/ocfs2/super.c +1 −1
  220. fs/proc/fd.c +0 −2
  221. fs/proc/generic.c +1 −1
  222. fs/proc/root.c +3 −1
  223. fs/proc/task_mmu.c +21 −10
  224. include/asm-generic/pgtable.h +30 −0
  225. include/asm-generic/tlb.h +1 −1
  226. include/linux/dcache.h +10 −10
  227. include/linux/inetdevice.h +1 −33
  228. include/linux/ipv6.h +1 −0
  229. include/linux/lockref.h +71 −0
  230. include/linux/mlx5/device.h +10 −12
  231. include/linux/mlx5/driver.h +2 −5
  232. include/linux/mm_types.h +1 −0
  233. include/linux/regmap.h +1 −0
  234. include/linux/sched.h +6 −0
  235. include/linux/spinlock.h +11 −3
  236. include/linux/swapops.h +2 −0
  237. include/linux/syscalls.h +5 −0
  238. include/linux/wait.h +57 −0
  239. include/net/busy_poll.h +1 −6
  240. include/net/ip6_route.h +2 −0
  241. include/net/ip_tunnels.h +0 −14
  242. include/net/sch_generic.h +8 −1
  243. include/uapi/linux/cm4000_cs.h +1 −0
  244. include/uapi/linux/ip.h +34 −0
  245. include/uapi/linux/pkt_sched.h +9 −1
  246. include/uapi/linux/snmp.h +1 −1
  247. init/Kconfig +1 −1
  248. ipc/msg.c +3 −2
  249. kernel/cpuset.c +13 −7
  250. kernel/fork.c +6 −0
  251. kernel/mutex.c +2 −2
  252. kernel/power/qos.c +13 −7
  253. kernel/sched/core.c +74 −22
  254. kernel/sched/cpupri.c +2 −2
  255. kernel/sched/fair.c +8 −2
  256. kernel/time/sched_clock.c +1 −1
  257. kernel/time/tick-sched.c +2 −3
  258. kernel/time/timer_list.c +24 −17
  259. kernel/wait.c +1 −2
  260. lib/lz4/lz4_compress.c +2 −2
  261. lib/lz4/lz4_decompress.c +3 −3
  262. lib/lz4/lz4hc_compress.c +2 −2
  263. mm/fremap.c +8 −3
  264. mm/hugetlb.c +1 −1
  265. mm/memcontrol.c +2 −3
  266. mm/memory.c +31 −18
  267. mm/mmap.c +2 −2
  268. mm/mremap.c +20 −1
  269. mm/rmap.c +11 −3
  270. mm/shmem.c +1 −7
  271. mm/slab.h +2 −0
  272. mm/swapfile.c +17 −2
  273. net/8021q/vlan_core.c +6 −1
  274. net/batman-adv/bridge_loop_avoidance.c +2 −0
  275. net/batman-adv/gateway_client.c +12 −1
  276. net/batman-adv/gateway_client.h +1 −2
  277. net/batman-adv/soft-interface.c +8 −1
  278. net/batman-adv/unicast.c +17 −6
  279. net/bridge/br_fdb.c +5 −5
  280. net/bridge/br_multicast.c +1 −1
  281. net/bridge/br_netlink.c +2 −2
  282. net/bridge/br_sysfs_br.c +1 −1
  283. net/bridge/br_vlan.c +2 −2
  284. net/core/flow_dissector.c +1 −0
  285. net/core/neighbour.c +6 −4
  286. net/core/rtnetlink.c +2 −2
  287. net/ipv4/esp4.c +1 −1
  288. net/ipv4/fib_trie.c +1 −4
  289. net/ipv4/ip_gre.c +1 −1
  290. net/ipv4/ip_tunnel_core.c +1 −3
  291. net/ipv4/proc.c +1 −1
  292. net/ipv4/tcp.c +7 −0
  293. net/ipv4/tcp_cubic.c +7 −5
  294. net/ipv6/addrconf.c +4 −6
  295. net/ipv6/esp6.c +1 −1
  296. net/ipv6/ip6_fib.c +12 −4
  297. net/ipv6/ndisc.c +3 −1
  298. net/ipv6/reassembly.c +5 −0
  299. net/ipv6/route.c +21 −0
  300. net/mac80211/mlme.c +36 −18
  301. net/netfilter/nf_conntrack_proto_tcp.c +8 −4
  302. net/netfilter/nfnetlink_log.c +5 −1
  303. net/netfilter/nfnetlink_queue_core.c +4 −1
  304. net/netfilter/xt_TCPMSS.c +16 −12
  305. net/netfilter/xt_TCPOPTSTRIP.c +6 −4
  306. net/openvswitch/actions.c +1 −0
  307. net/openvswitch/datapath.c +0 −3
  308. net/openvswitch/flow.c +1 −1
  309. net/packet/af_packet.c +2 −0
  310. net/sched/sch_api.c +41 −0
  311. net/sched/sch_generic.c +7 −1
  312. net/sched/sch_htb.c +13 −0
  313. net/sctp/associola.c +2 −2
  314. net/sctp/transport.c +2 −2
  315. net/tipc/bearer.c +7 −2
  316. net/vmw_vsock/af_vsock.c +1 −1
  317. net/wireless/core.c +1 −0
  318. net/wireless/nl80211.c +15 −13
  319. net/wireless/sme.c +4 −6
  320. sound/pci/hda/hda_generic.c +3 −3
  321. sound/pci/hda/patch_realtek.c +11 −0
  322. sound/soc/codecs/cs42l52.c +4 −1
  323. sound/soc/codecs/sgtl5000.c +14 −4
  324. sound/soc/soc-dapm.c +4 −3
  325. sound/soc/tegra/tegra30_i2s.c +1 −1
  326. sound/usb/6fire/midi.c +15 −1
  327. sound/usb/6fire/midi.h +1 −5
  328. sound/usb/6fire/pcm.c +40 −1
  329. sound/usb/6fire/pcm.h +1 −1
  330. sound/usb/mixer.c +1 −0
  331. sound/usb/quirks.c +3 −3
Documentation/kernel-parameters.txt+1−1
@@ -2953,7 +2953,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 2952 unmodified lines
29532953 improve throughput, but will also increase the
29542954 amount of memory reserved for use by the client.
29552955
2956− swapaccount[=0|1]
2956+ swapaccount=[0|1]
29572957 [KNL] Enable accounting of swap in memory resource
29582958 controller if no parameter or 1 is given or disable
29592959 it if 0 is given (See Documentation/cgroups/memory.txt)
MAINTAINERS+7−7
@@ -5581,9 +5581,9 @@ S: Maintained · 5580 unmodified lines
55815581 F: drivers/media/tuners/mxl5007t.*
55825582
55835583 MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
5584−M: Andrew Gallatin <gallatin@myri.com>
5584+M: Hyong-Youb Kim <hykim@myri.com>
55855585 L: netdev@vger.kernel.org
5586−W: http://www.myri.com/scs/download-Myri10GE.html
5586+W: https://www.myricom.com/support/downloads/myri10ge.html
55875587 S: Supported
55885588 F: drivers/net/ethernet/myricom/myri10ge/
55895589
@@ -5884,7 +5884,7 @@ F: drivers/i2c/busses/i2c-omap.c · 294 unmodified lines
58845884 F: include/linux/i2c-omap.h
58855885
58865886 OMAP DEVICE TREE SUPPORT
5887−M: Benoît Cousson <b-cousson@ti.com>
5887+M: Benoît Cousson <bcousson@baylibre.com>
58885888 M: Tony Lindgren <tony@atomide.com>
58895889 L: linux-omap@vger.kernel.org
58905890 L: devicetree@vger.kernel.org
@@ -5964,14 +5964,14 @@ S: Maintained · 73 unmodified lines
59645964 F: drivers/char/hw_random/omap-rng.c
59655965
59665966 OMAP HWMOD SUPPORT
5967−M: Benoît Cousson <b-cousson@ti.com>
5967+M: Benoît Cousson <bcousson@baylibre.com>
59685968 M: Paul Walmsley <paul@pwsan.com>
59695969 L: linux-omap@vger.kernel.org
59705970 S: Maintained
59715971 F: arch/arm/mach-omap2/omap_hwmod.*
59725972
59735973 OMAP HWMOD DATA FOR OMAP4-BASED DEVICES
5974−M: Benoît Cousson <b-cousson@ti.com>
5974+M: Benoît Cousson <bcousson@baylibre.com>
59755975 L: linux-omap@vger.kernel.org
59765976 S: Maintained
59775977 F: arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -7366,7 +7366,6 @@ F: drivers/net/ethernet/sfc/ · 1388 unmodified lines
73667366
73677367 SGI GRU DRIVER
73687368 M: Dimitri Sivanich <sivanich@sgi.com>
7369−M: Robin Holt <holt@sgi.com>
73707369 S: Maintained
73717370 F: drivers/misc/sgi-gru/
73727371
@@ -7386,7 +7385,8 @@ S: Maintained for 2.6. · 13 unmodified lines
73867385 F: Documentation/sgi-visws.txt
73877386
73887387 SGI XP/XPC/XPNET DRIVER
7389−M: Robin Holt <holt@sgi.com>
7388+M: Cliff Whickman <cpw@sgi.com>
7389+M: Robin Holt <robinmholt@gmail.com>
73907390 S: Maintained
73917391 F: drivers/misc/sgi-xp/
73927392
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 3
22 PATCHLEVEL = 11
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc5
4+EXTRAVERSION = -rc7
55 NAME = Linux for Workgroups
66
77 # *DOCUMENTATION*
arch/Kconfig+6−0
@@ -407,6 +407,12 @@ config CLONE_BACKWARDS2 · 406 unmodified lines
407407 help
408408 Architecture has the first two arguments of clone(2) swapped.
409409
410+config CLONE_BACKWARDS3
411+ bool
412+ help
413+ Architecture has tls passed as the 3rd argument of clone(2),
414+ not the 5th one.
415+
410416 config ODD_RT_SIGACTION
411417 bool
412418 help
arch/arc/lib/strchr-700.S+10−0
@@ -39,9 +39,18 @@ ARC_ENTRY strchr · 38 unmodified lines
3939 ld.a r2,[r0,4]
4040 sub r12,r6,r7
4141 bic r12,r12,r6
42+#ifdef __LITTLE_ENDIAN__
4243 and r7,r12,r4
4344 breq r7,0,.Loop ; For speed, we want this branch to be unaligned.
4445 b .Lfound_char ; Likewise this one.
46+#else
47+ and r12,r12,r4
48+ breq r12,0,.Loop ; For speed, we want this branch to be unaligned.
49+ lsr_s r12,r12,7
50+ bic r2,r7,r6
51+ b.d .Lfound_char_b
52+ and_s r2,r2,r12
53+#endif
4554 ; /* We require this code address to be unaligned for speed... */
4655 .Laligned:
4756 ld_s r2,[r0]
@@ -95,6 +104,7 @@ ARC_ENTRY strchr · 47 unmodified lines
95104 lsr r7,r7,7
96105
97106 bic r2,r7,r6
107+.Lfound_char_b:
98108 norm r2,r2
99109 sub_s r0,r0,4
100110 asr_s r2,r2,3
arch/arm/boot/dts/at91sam9n12ek.dts+2−2
@@ -14,11 +14,11 @@ · 13 unmodified lines
1414 compatible = "atmel,at91sam9n12ek", "atmel,at91sam9n12", "atmel,at91sam9";
1515
1616 chosen {
17− bootargs = "mem=128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2";
17+ bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2";
1818 };
1919
2020 memory {
21− reg = <0x20000000 0x10000000>;
21+ reg = <0x20000000 0x8000000>;
2222 };
2323
2424 clocks {
arch/arm/boot/dts/at91sam9x5ek.dtsi+3−2
@@ -94,8 +94,9 @@ · 93 unmodified lines
9494
9595 usb0: ohci@00600000 {
9696 status = "okay";
97− num-ports = <2>;
98− atmel,vbus-gpio = <&pioD 19 GPIO_ACTIVE_LOW
97+ num-ports = <3>;
98+ atmel,vbus-gpio = <0 /* &pioD 18 GPIO_ACTIVE_LOW *//* Activate to have access to port A */
99+ &pioD 19 GPIO_ACTIVE_LOW
99100 &pioD 20 GPIO_ACTIVE_LOW
100101 >;
101102 };
arch/arm/boot/dts/tegra20-seaboard.dts+2−0
@@ -830,6 +830,8 @@ · 829 unmodified lines
830830 regulator-max-microvolt = <5000000>;
831831 enable-active-high;
832832 gpio = <&gpio 24 0>; /* PD0 */
833+ regulator-always-on;
834+ regulator-boot-on;
833835 };
834836 };
835837
arch/arm/boot/dts/tegra20-trimslice.dts+2−0
@@ -412,6 +412,8 @@ · 411 unmodified lines
412412 regulator-max-microvolt = <5000000>;
413413 enable-active-high;
414414 gpio = <&gpio 170 0>; /* PV2 */
415+ regulator-always-on;
416+ regulator-boot-on;
415417 };
416418 };
417419
arch/arm/boot/dts/tegra20-whistler.dts+4−0
@@ -588,6 +588,8 @@ · 587 unmodified lines
588588 regulator-max-microvolt = <5000000>;
589589 enable-active-high;
590590 gpio = <&tca6416 0 0>; /* GPIO_PMU0 */
591+ regulator-always-on;
592+ regulator-boot-on;
591593 };
592594
593595 vbus3_reg: regulator@3 {
@@ -598,6 +600,8 @@ · 4 unmodified lines
598600 regulator-max-microvolt = <5000000>;
599601 enable-active-high;
600602 gpio = <&tca6416 1 0>; /* GPIO_PMU1 */
603+ regulator-always-on;
604+ regulator-boot-on;
601605 };
602606 };
603607
arch/arm/include/asm/smp_plat.h+3−0
@@ -88,4 +88,7 @@ static inline u32 mpidr_hash_size(void) · 87 unmodified lines
8888 {
8989 return 1 << mpidr_hash.bits;
9090 }
91+
92+extern int platform_can_cpu_hotplug(void);
93+
9194 #endif
arch/arm/include/asm/spinlock.h+31−20
@@ -107,7 +107,7 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock) · 106 unmodified lines
107107 " subs %1, %0, %0, ror #16\n"
108108 " addeq %0, %0, %4\n"
109109 " strexeq %2, %0, [%3]"
110− : "=&r" (slock), "=&r" (contended), "=r" (res)
110+ : "=&r" (slock), "=&r" (contended), "=&r" (res)
111111 : "r" (&lock->slock), "I" (1 << TICKET_SHIFT)
112112 : "cc");
113113 } while (res);
@@ -168,17 +168,20 @@ static inline void arch_write_lock(arch_rwlock_t *rw) · 54 unmodified lines
168168
169169 static inline int arch_write_trylock(arch_rwlock_t *rw)
170170 {
171− unsigned long tmp;
171+ unsigned long contended, res;
172172
173− __asm__ __volatile__(
174−" ldrex %0, [%1]\n"
175−" teq %0, #0\n"
176−" strexeq %0, %2, [%1]"
177− : "=&r" (tmp)
178− : "r" (&rw->lock), "r" (0x80000000)
179− : "cc");
173+ do {
174+ __asm__ __volatile__(
175+ " ldrex %0, [%2]\n"
176+ " mov %1, #0\n"
177+ " teq %0, #0\n"
178+ " strexeq %1, %3, [%2]"
179+ : "=&r" (contended), "=&r" (res)
180+ : "r" (&rw->lock), "r" (0x80000000)
181+ : "cc");
182+ } while (res);
180183
181− if (tmp == 0) {
184+ if (!contended) {
182185 smp_mb();
183186 return 1;
184187 } else {
@@ -254,18 +257,26 @@ static inline void arch_read_unlock(arch_rwlock_t *rw) · 69 unmodified lines
254257
255258 static inline int arch_read_trylock(arch_rwlock_t *rw)
256259 {
257− unsigned long tmp, tmp2 = 1;
260+ unsigned long contended, res;
258261
259− __asm__ __volatile__(
260−" ldrex %0, [%2]\n"
261−" adds %0, %0, #1\n"
262−" strexpl %1, %0, [%2]\n"
263− : "=&r" (tmp), "+r" (tmp2)
264− : "r" (&rw->lock)
265− : "cc");
262+ do {
263+ __asm__ __volatile__(
264+ " ldrex %0, [%2]\n"
265+ " mov %1, #0\n"
266+ " adds %0, %0, #1\n"
267+ " strexpl %1, %0, [%2]"
268+ : "=&r" (contended), "=&r" (res)
269+ : "r" (&rw->lock)
270+ : "cc");
271+ } while (res);
266272
267− smp_mb();
268− return tmp2 == 0;
273+ /* If the lock is negative, then it is already held for write. */
274+ if (contended < 0x80000000) {
275+ smp_mb();
276+ return 1;
277+ } else {
278+ return 0;
279+ }
269280 }
270281
271282 /* read_can_lock - would read_trylock() succeed? */
arch/arm/include/asm/tlb.h+5−2
@@ -43,6 +43,7 @@ struct mmu_gather { · 42 unmodified lines
4343 struct mm_struct *mm;
4444 unsigned int fullmm;
4545 struct vm_area_struct *vma;
46+ unsigned long start, end;
4647 unsigned long range_start;
4748 unsigned long range_end;
4849 unsigned int nr;
@@ -107,10 +108,12 @@ static inline void tlb_flush_mmu(struct mmu_gather *tlb) · 58 unmodified lines
107108 }
108109
109110 static inline void
110−tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int fullmm)
111+tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
111112 {
112113 tlb->mm = mm;
113− tlb->fullmm = fullmm;
114+ tlb->fullmm = !(start | (end+1));
115+ tlb->start = start;
116+ tlb->end = end;
114117 tlb->vma = NULL;
115118 tlb->max = ARRAY_SIZE(tlb->local);
116119 tlb->pages = tlb->local;
arch/arm/kernel/entry-armv.S+2−1
@@ -357,7 +357,8 @@ ENDPROC(__pabt_svc) · 356 unmodified lines
357357 .endm
358358
359359 .macro kuser_cmpxchg_check
360−#if !defined(CONFIG_CPU_32v6K) && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
360+#if !defined(CONFIG_CPU_32v6K) && defined(CONFIG_KUSER_HELPERS) && \
361+ !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
361362 #ifndef CONFIG_MMU
362363 #warning "NPTL on non MMU needs fixing"
363364 #else
arch/arm/kernel/fiq.c+3−6
@@ -84,17 +84,14 @@ int show_fiq_list(struct seq_file *p, int prec) · 83 unmodified lines
8484
8585 void set_fiq_handler(void *start, unsigned int length)
8686 {
87−#if defined(CONFIG_CPU_USE_DOMAINS)
88− void *base = (void *)0xffff0000;
89−#else
9087 void *base = vectors_page;
91−#endif
9288 unsigned offset = FIQ_OFFSET;
9389
9490 memcpy(base + offset, start, length);
91+ if (!cache_is_vipt_nonaliasing())
92+ flush_icache_range((unsigned long)base + offset, offset +
93+ length);
9594 flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length);
96− if (!vectors_high())
97− flush_icache_range(offset, offset + length);
9895 }
9996
10097 int claim_fiq(struct fiq_handler *f)
arch/arm/kernel/machine_kexec.c+17−4
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <asm/mmu_context.h>
1616 #include <asm/cacheflush.h>
1717 #include <asm/mach-types.h>
18+#include <asm/smp_plat.h>
1819 #include <asm/system_misc.h>
1920
2021 extern const unsigned char relocate_new_kernel[];
@@ -38,6 +39,14 @@ int machine_kexec_prepare(struct kimage *image) · 17 unmodified lines
3839 __be32 header;
3940 int i, err;
4041
42+ /*
43+ * Validate that if the current HW supports SMP, then the SW supports
44+ * and implements CPU hotplug for the current HW. If not, we won't be
45+ * able to kexec reliably, so fail the prepare operation.
46+ */
47+ if (num_possible_cpus() > 1 && !platform_can_cpu_hotplug())
48+ return -EINVAL;
49+
4150 /*
4251 * No segment at default ATAGs address. try to locate
4352 * a dtb using magic.
@@ -73,6 +82,7 @@ void machine_crash_nonpanic_core(void *unused) · 29 unmodified lines
7382 crash_save_cpu(&regs, smp_processor_id());
7483 flush_cache_all();
7584
85+ set_cpu_online(smp_processor_id(), false);
7686 atomic_dec(&waiting_for_crash_ipi);
7787 while (1)
7888 cpu_relax();
@@ -134,10 +144,13 @@ void machine_kexec(struct kimage *image) · 55 unmodified lines
134144 unsigned long reboot_code_buffer_phys;
135145 void *reboot_code_buffer;
136146
137− if (num_online_cpus() > 1) {
138− pr_err("kexec: error: multiple CPUs still online\n");
139− return;
140− }
147+ /*
148+ * This can only happen if machine_shutdown() failed to disable some
149+ * CPU, and that can only happen if the checks in
150+ * machine_kexec_prepare() were not correct. If this fails, we can't
151+ * reliably kexec anyway, so BUG_ON is appropriate.
152+ */
153+ BUG_ON(num_online_cpus() > 1);
141154
142155 page_list = image->head & PAGE_MASK;
143156
arch/arm/kernel/perf_event.c+9−1
@@ -53,7 +53,12 @@ armpmu_map_cache_event(const unsigned (*cache_map) · 52 unmodified lines
5353 static int
5454 armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
5555 {
56− int mapping = (*event_map)[config];
56+ int mapping;
57+
58+ if (config >= PERF_COUNT_HW_MAX)
59+ return -EINVAL;
60+
61+ mapping = (*event_map)[config];
5762 return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
5863 }
5964
@@ -253,6 +258,9 @@ validate_event(struct pmu_hw_events *hw_events, · 193 unmodified lines
253258 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
254259 struct pmu *leader_pmu = event->group_leader->pmu;
255260
261+ if (is_software_event(event))
262+ return 1;
263+
256264 if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF)
257265 return 1;
258266
arch/arm/kernel/process.c+1−1
@@ -462,7 +462,7 @@ int in_gate_area_no_mm(unsigned long addr) · 461 unmodified lines
462462 {
463463 return in_gate_area(NULL, addr);
464464 }
465−#define is_gate_vma(vma) ((vma) = &gate_vma)
465+#define is_gate_vma(vma) ((vma) == &gate_vma)
466466 #else
467467 #define is_gate_vma(vma) 0
468468 #endif
arch/arm/kernel/smp.c+10−0
@@ -145,6 +145,16 @@ int boot_secondary(unsigned int cpu, struct task_struct *idle) · 144 unmodified lines
145145 return -ENOSYS;
146146 }
147147
148+int platform_can_cpu_hotplug(void)
149+{
150+#ifdef CONFIG_HOTPLUG_CPU
151+ if (smp_ops.cpu_kill)
152+ return 1;
153+#endif
154+
155+ return 0;
156+}
157+
148158 #ifdef CONFIG_HOTPLUG_CPU
149159 static void percpu_timer_stop(void);
150160
arch/arm/kvm/coproc.c+19−7
@@ -146,7 +146,11 @@ static bool pm_fake(struct kvm_vcpu *vcpu, · 145 unmodified lines
146146 #define access_pmintenclr pm_fake
147147
148148 /* Architected CP15 registers.
149− * Important: Must be sorted ascending by CRn, CRM, Op1, Op2
149+ * CRn denotes the primary register number, but is copied to the CRm in the
150+ * user space API for 64-bit register access in line with the terminology used
151+ * in the ARM ARM.
152+ * Important: Must be sorted ascending by CRn, CRM, Op1, Op2 and with 64-bit
153+ * registers preceding 32-bit ones.
150154 */
151155 static const struct coproc_reg cp15_regs[] = {
152156 /* CSSELR: swapped by interrupt.S. */
@@ -154,8 +158,8 @@ static const struct coproc_reg cp15_regs[] = { · 1 unmodified line
154158 NULL, reset_unknown, c0_CSSELR },
155159
156160 /* TTBR0/TTBR1: swapped by interrupt.S. */
157− { CRm( 2), Op1( 0), is64, NULL, reset_unknown64, c2_TTBR0 },
158− { CRm( 2), Op1( 1), is64, NULL, reset_unknown64, c2_TTBR1 },
161+ { CRm64( 2), Op1( 0), is64, NULL, reset_unknown64, c2_TTBR0 },
162+ { CRm64( 2), Op1( 1), is64, NULL, reset_unknown64, c2_TTBR1 },
159163
160164 /* TTBCR: swapped by interrupt.S. */
161165 { CRn( 2), CRm( 0), Op1( 0), Op2( 2), is32,
@@ -182,7 +186,7 @@ static const struct coproc_reg cp15_regs[] = { · 20 unmodified lines
182186 NULL, reset_unknown, c6_IFAR },
183187
184188 /* PAR swapped by interrupt.S */
185− { CRn( 7), Op1( 0), is64, NULL, reset_unknown64, c7_PAR },
189+ { CRm64( 7), Op1( 0), is64, NULL, reset_unknown64, c7_PAR },
186190
187191 /*
188192 * DC{C,I,CI}SW operations:
@@ -399,12 +403,13 @@ static bool index_to_params(u64 id, struct coproc_params *params) · 210 unmodified lines
399403 | KVM_REG_ARM_OPC1_MASK))
400404 return false;
401405 params->is_64bit = true;
402− params->CRm = ((id & KVM_REG_ARM_CRM_MASK)
406+ /* CRm to CRn: see cp15_to_index for details */
407+ params->CRn = ((id & KVM_REG_ARM_CRM_MASK)
403408 >> KVM_REG_ARM_CRM_SHIFT);
404409 params->Op1 = ((id & KVM_REG_ARM_OPC1_MASK)
405410 >> KVM_REG_ARM_OPC1_SHIFT);
406411 params->Op2 = 0;
407− params->CRn = 0;
412+ params->CRm = 0;
408413 return true;
409414 default:
410415 return false;
@@ -898,7 +903,14 @@ static u64 cp15_to_index(const struct coproc_reg *reg) · 487 unmodified lines
898903 if (reg->is_64) {
899904 val |= KVM_REG_SIZE_U64;
900905 val |= (reg->Op1 << KVM_REG_ARM_OPC1_SHIFT);
901− val |= (reg->CRm << KVM_REG_ARM_CRM_SHIFT);
906+ /*
907+ * CRn always denotes the primary coproc. reg. nr. for the
908+ * in-kernel representation, but the user space API uses the
909+ * CRm for the encoding, because it is modelled after the
910+ * MRRC/MCRR instructions: see the ARM ARM rev. c page
911+ * B3-1445
912+ */
913+ val |= (reg->CRn << KVM_REG_ARM_CRM_SHIFT);
902914 } else {
903915 val |= KVM_REG_SIZE_U32;
904916 val |= (reg->Op1 << KVM_REG_ARM_OPC1_SHIFT);
arch/arm/kvm/coproc.h+3−0
@@ -135,6 +135,8 @@ static inline int cmp_reg(const struct coproc_reg *i1, · 134 unmodified lines
135135 return -1;
136136 if (i1->CRn != i2->CRn)
137137 return i1->CRn - i2->CRn;
138+ if (i1->is_64 != i2->is_64)
139+ return i2->is_64 - i1->is_64;
138140 if (i1->CRm != i2->CRm)
139141 return i1->CRm - i2->CRm;
140142 if (i1->Op1 != i2->Op1)
@@ -145,6 +147,7 @@ static inline int cmp_reg(const struct coproc_reg *i1, · 4 unmodified lines
145147
146148 #define CRn(_x) .CRn = _x
147149 #define CRm(_x) .CRm = _x
150+#define CRm64(_x) .CRn = _x, .CRm = 0
148151 #define Op1(_x) .Op1 = _x
149152 #define Op2(_x) .Op2 = _x
150153 #define is64 .is_64 = true
arch/arm/kvm/coproc_a15.c+5−1
@@ -114,7 +114,11 @@ static bool access_l2ectlr(struct kvm_vcpu *vcpu, · 113 unmodified lines
114114
115115 /*
116116 * A15-specific CP15 registers.
117− * Important: Must be sorted ascending by CRn, CRM, Op1, Op2
117+ * CRn denotes the primary register number, but is copied to the CRm in the
118+ * user space API for 64-bit register access in line with the terminology used
119+ * in the ARM ARM.
120+ * Important: Must be sorted ascending by CRn, CRM, Op1, Op2 and with 64-bit
121+ * registers preceding 32-bit ones.
118122 */
119123 static const struct coproc_reg a15_regs[] = {
120124 /* MPIDR: we use VMPIDR for guest access. */
arch/arm/kvm/mmio.c+2−1
@@ -63,7 +63,8 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run) · 62 unmodified lines
6363 static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
6464 struct kvm_exit_mmio *mmio)
6565 {
66− unsigned long rt, len;
66+ unsigned long rt;
67+ int len;
6768 bool is_write, sign_extend;
6869
6970 if (kvm_vcpu_dabt_isextabt(vcpu)) {
arch/arm/kvm/mmu.c+15−21
@@ -85,6 +85,12 @@ static void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc) · 84 unmodified lines
8585 return p;
8686 }
8787
88+static bool page_empty(void *ptr)
89+{
90+ struct page *ptr_page = virt_to_page(ptr);
91+ return page_count(ptr_page) == 1;
92+}
93+
8894 static void clear_pud_entry(struct kvm *kvm, pud_t *pud, phys_addr_t addr)
8995 {
9096 pmd_t *pmd_table = pmd_offset(pud, 0);
@@ -103,12 +109,6 @@ static void clear_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr) · 12 unmodified lines
103109 put_page(virt_to_page(pmd));
104110 }
105111
106−static bool pmd_empty(pmd_t *pmd)
107−{
108− struct page *pmd_page = virt_to_page(pmd);
109− return page_count(pmd_page) == 1;
110−}
111−
112112 static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr)
113113 {
114114 if (pte_present(*pte)) {
@@ -118,12 +118,6 @@ static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr) · 3 unmodified lines
118118 }
119119 }
120120
121−static bool pte_empty(pte_t *pte)
122−{
123− struct page *pte_page = virt_to_page(pte);
124− return page_count(pte_page) == 1;
125−}
126−
127121 static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
128122 unsigned long long start, u64 size)
129123 {
@@ -132,37 +126,37 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, · 2 unmodified lines
132126 pmd_t *pmd;
133127 pte_t *pte;
134128 unsigned long long addr = start, end = start + size;
135− u64 range;
129+ u64 next;
136130
137131 while (addr < end) {
138132 pgd = pgdp + pgd_index(addr);
139133 pud = pud_offset(pgd, addr);
140134 if (pud_none(*pud)) {
141− addr += PUD_SIZE;
135+ addr = pud_addr_end(addr, end);
142136 continue;
143137 }
144138
145139 pmd = pmd_offset(pud, addr);
146140 if (pmd_none(*pmd)) {
147− addr += PMD_SIZE;
141+ addr = pmd_addr_end(addr, end);
148142 continue;
149143 }
150144
151145 pte = pte_offset_kernel(pmd, addr);
152146 clear_pte_entry(kvm, pte, addr);
153− range = PAGE_SIZE;
147+ next = addr + PAGE_SIZE;
154148
155149 /* If we emptied the pte, walk back up the ladder */
156− if (pte_empty(pte)) {
150+ if (page_empty(pte)) {
157151 clear_pmd_entry(kvm, pmd, addr);
158− range = PMD_SIZE;
159− if (pmd_empty(pmd)) {
152+ next = pmd_addr_end(addr, end);
153+ if (page_empty(pmd) && !page_empty(pud)) {
160154 clear_pud_entry(kvm, pud, addr);
161− range = PUD_SIZE;
155+ next = pud_addr_end(addr, end);
162156 }
163157 }
164158
165− addr += range;
159+ addr = next;
166160 }
167161 }
168162
arch/arm/mach-at91/at91sam9x5.c+2−0
@@ -227,6 +227,8 @@ static struct clk_lookup periph_clocks_lookups[] = { · 226 unmodified lines
227227 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart1_clk),
228228 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart2_clk),
229229 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
230+ CLKDEV_CON_DEV_ID("usart", "f8040000.serial", &uart0_clk),
231+ CLKDEV_CON_DEV_ID("usart", "f8044000.serial", &uart1_clk),
230232 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
231233 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
232234 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc0_clk),
arch/arm/mach-davinci/board-dm355-leopard.c+1−0
@@ -75,6 +75,7 @@ static struct davinci_nand_pdata davinci_nand_data = { · 74 unmodified lines
7575 .parts = davinci_nand_partitions,
7676 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
7777 .ecc_mode = NAND_ECC_HW_SYNDROME,
78+ .ecc_bits = 4,
7879 .bbt_options = NAND_BBT_USE_FLASH,
7980 };
8081
arch/arm/mach-davinci/board-dm644x-evm.c+1−0
@@ -153,6 +153,7 @@ static struct davinci_nand_pdata davinci_evm_nandflash_data = { · 152 unmodified lines
153153 .parts = davinci_evm_nandflash_partition,
154154 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition),
155155 .ecc_mode = NAND_ECC_HW,
156+ .ecc_bits = 1,
156157 .bbt_options = NAND_BBT_USE_FLASH,
157158 .timing = &davinci_evm_nandflash_timing,
158159 };
arch/arm/mach-davinci/board-dm646x-evm.c+1−0
@@ -90,6 +90,7 @@ static struct davinci_nand_pdata davinci_nand_data = { · 89 unmodified lines
9090 .parts = davinci_nand_partitions,
9191 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
9292 .ecc_mode = NAND_ECC_HW,
93+ .ecc_bits = 1,
9394 .options = 0,
9495 };
9596
arch/arm/mach-davinci/board-neuros-osd2.c+1−0
@@ -88,6 +88,7 @@ static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = { · 87 unmodified lines
8888 .parts = davinci_ntosd2_nandflash_partition,
8989 .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition),
9090 .ecc_mode = NAND_ECC_HW,
91+ .ecc_bits = 1,
9192 .bbt_options = NAND_BBT_USE_FLASH,
9293 };
9394
arch/arm/mach-omap2/board-n8x0.c+0−4
@@ -122,11 +122,7 @@ static struct musb_hdrc_config musb_config = { · 121 unmodified lines
122122 };
123123
124124 static struct musb_hdrc_platform_data tusb_data = {
125−#ifdef CONFIG_USB_GADGET_MUSB_HDRC
126125 .mode = MUSB_OTG,
127−#else
128− .mode = MUSB_HOST,
129−#endif
130126 .set_power = tusb_set_power,
131127 .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
132128 .power = 100, /* Max 100 mA VBUS for host mode */
arch/arm/mach-omap2/board-rx51.c+1−1
@@ -85,7 +85,7 @@ static struct omap_board_mux board_mux[] __initdata = { · 84 unmodified lines
8585
8686 static struct omap_musb_board_data musb_board_data = {
8787 .interface_type = MUSB_INTERFACE_ULPI,
88− .mode = MUSB_PERIPHERAL,
88+ .mode = MUSB_OTG,
8989 .power = 0,
9090 };
9191
arch/arm/mach-omap2/usb-musb.c+1−4
@@ -38,11 +38,8 @@ static struct musb_hdrc_config musb_config = { · 37 unmodified lines
3838 };
3939
4040 static struct musb_hdrc_platform_data musb_plat = {
41−#ifdef CONFIG_USB_GADGET_MUSB_HDRC
4241 .mode = MUSB_OTG,
43−#else
44− .mode = MUSB_HOST,
45−#endif
42+
4643 /* .clock is set dynamically */
4744 .config = &musb_config,
4845
arch/arm/mm/Kconfig+6−3
@@ -809,15 +809,18 @@ config KUSER_HELPERS · 808 unmodified lines
809809 the CPU type fitted to the system. This permits binaries to be
810810 run on ARMv4 through to ARMv7 without modification.
811811
812+ See Documentation/arm/kernel_user_helpers.txt for details.
813+
812814 However, the fixed address nature of these helpers can be used
813815 by ROP (return orientated programming) authors when creating
814816 exploits.
815817
816818 If all of the binaries and libraries which run on your platform
817819 are built specifically for your platform, and make no use of
818− these helpers, then you can turn this option off. However,
819− when such an binary or library is run, it will receive a SIGILL
820− signal, which will terminate the program.
820+ these helpers, then you can turn this option off to hinder
821+ such exploits. However, in that case, if a binary or library
822+ relying on those helpers is run, it will receive a SIGILL signal,
823+ which will terminate the program.
821824
822825 Say N here only if you are absolutely certain that you do not
823826 need these helpers; otherwise, the safe option is to say Y.
arch/arm/plat-samsung/init.c+3−2
@@ -55,12 +55,13 @@ void __init s3c_init_cpu(unsigned long idcode, · 54 unmodified lines
5555
5656 printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
5757
58− if (cpu->map_io == NULL || cpu->init == NULL) {
58+ if (cpu->init == NULL) {
5959 printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
6060 panic("Unsupported Samsung CPU");
6161 }
6262
63− cpu->map_io();
63+ if (cpu->map_io)
64+ cpu->map_io();
6465 }
6566
6667 /* s3c24xx_init_clocks
arch/arm/xen/enlighten.c+1−0
@@ -170,6 +170,7 @@ static void __init xen_percpu_init(void *unused) · 169 unmodified lines
170170 per_cpu(xen_vcpu, cpu) = vcpup;
171171
172172 enable_percpu_irq(xen_events_irq, 0);
173+ put_cpu();
173174 }
174175
175176 static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
arch/arm64/include/asm/kvm_asm.h+10−7
@@ -42,14 +42,15 @@ · 41 unmodified lines
4242 #define TPIDR_EL1 18 /* Thread ID, Privileged */
4343 #define AMAIR_EL1 19 /* Aux Memory Attribute Indirection Register */
4444 #define CNTKCTL_EL1 20 /* Timer Control Register (EL1) */
45+#define PAR_EL1 21 /* Physical Address Register */
4546 /* 32bit specific registers. Keep them at the end of the range */
46−#define DACR32_EL2 21 /* Domain Access Control Register */
47−#define IFSR32_EL2 22 /* Instruction Fault Status Register */
48−#define FPEXC32_EL2 23 /* Floating-Point Exception Control Register */
49−#define DBGVCR32_EL2 24 /* Debug Vector Catch Register */
50−#define TEECR32_EL1 25 /* ThumbEE Configuration Register */
51−#define TEEHBR32_EL1 26 /* ThumbEE Handler Base Register */
52−#define NR_SYS_REGS 27
47+#define DACR32_EL2 22 /* Domain Access Control Register */
48+#define IFSR32_EL2 23 /* Instruction Fault Status Register */
49+#define FPEXC32_EL2 24 /* Floating-Point Exception Control Register */
50+#define DBGVCR32_EL2 25 /* Debug Vector Catch Register */
51+#define TEECR32_EL1 26 /* ThumbEE Configuration Register */
52+#define TEEHBR32_EL1 27 /* ThumbEE Handler Base Register */
53+#define NR_SYS_REGS 28
5354
5455 /* 32bit mapping */
5556 #define c0_MPIDR (MPIDR_EL1 * 2) /* MultiProcessor ID Register */
@@ -69,6 +70,8 @@ · 13 unmodified lines
6970 #define c5_AIFSR (AFSR1_EL1 * 2) /* Auxiliary Instr Fault Status R */
7071 #define c6_DFAR (FAR_EL1 * 2) /* Data Fault Address Register */
7172 #define c6_IFAR (c6_DFAR + 1) /* Instruction Fault Address Register */
73+#define c7_PAR (PAR_EL1 * 2) /* Physical Address Register */
74+#define c7_PAR_high (c7_PAR + 1) /* PAR top 32 bits */
7275 #define c10_PRRR (MAIR_EL1 * 2) /* Primary Region Remap Register */
7376 #define c10_NMRR (c10_PRRR + 1) /* Normal Memory Remap Register */
7477 #define c12_VBAR (VBAR_EL1 * 2) /* Vector Base Address Register */
arch/arm64/include/asm/kvm_host.h+1−1
@@ -129,7 +129,7 @@ struct kvm_vcpu_arch { · 128 unmodified lines
129129 struct kvm_mmu_memory_cache mmu_page_cache;
130130
131131 /* Target CPU and feature flags */
132− u32 target;
132+ int target;
133133 DECLARE_BITMAP(features, KVM_VCPU_MAX_FEATURES);
134134
135135 /* Detect first run of a vcpu */
arch/arm64/include/asm/tlb.h+5−2
@@ -35,6 +35,7 @@ struct mmu_gather { · 34 unmodified lines
3535 struct mm_struct *mm;
3636 unsigned int fullmm;
3737 struct vm_area_struct *vma;
38+ unsigned long start, end;
3839 unsigned long range_start;
3940 unsigned long range_end;
4041 unsigned int nr;
@@ -97,10 +98,12 @@ static inline void tlb_flush_mmu(struct mmu_gather *tlb) · 56 unmodified lines
9798 }
9899
99100 static inline void
100−tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int fullmm)
101+tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
101102 {
102103 tlb->mm = mm;
103− tlb->fullmm = fullmm;
104+ tlb->fullmm = !(start | (end+1));
105+ tlb->start = start;
106+ tlb->end = end;
104107 tlb->vma = NULL;
105108 tlb->max = ARRAY_SIZE(tlb->local);
106109 tlb->pages = tlb->local;
arch/arm64/kernel/perf_event.c+9−1
@@ -107,7 +107,12 @@ armpmu_map_cache_event(const unsigned (*cache_map) · 106 unmodified lines
107107 static int
108108 armpmu_map_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
109109 {
110− int mapping = (*event_map)[config];
110+ int mapping;
111+
112+ if (config >= PERF_COUNT_HW_MAX)
113+ return -EINVAL;
114+
115+ mapping = (*event_map)[config];
111116 return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
112117 }
113118
@@ -317,6 +322,9 @@ validate_event(struct pmu_hw_events *hw_events, · 203 unmodified lines
317322 struct hw_perf_event fake_event = event->hw;
318323 struct pmu *leader_pmu = event->group_leader->pmu;
319324
325+ if (is_software_event(event))
326+ return 1;
327+
320328 if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF)
321329 return 1;
322330
arch/arm64/kvm/hyp.S+13−0
@@ -214,6 +214,7 @@ __kvm_hyp_code_start: · 213 unmodified lines
214214 mrs x21, tpidr_el1
215215 mrs x22, amair_el1
216216 mrs x23, cntkctl_el1
217+ mrs x24, par_el1
217218
218219 stp x4, x5, [x3]
219220 stp x6, x7, [x3, #16]
@@ -225,6 +226,7 @@ __kvm_hyp_code_start: · 5 unmodified lines
225226 stp x18, x19, [x3, #112]
226227 stp x20, x21, [x3, #128]
227228 stp x22, x23, [x3, #144]
229+ str x24, [x3, #160]
228230 .endm
229231
230232 .macro restore_sysregs
@@ -243,6 +245,7 @@ __kvm_hyp_code_start: · 12 unmodified lines
243245 ldp x18, x19, [x3, #112]
244246 ldp x20, x21, [x3, #128]
245247 ldp x22, x23, [x3, #144]
248+ ldr x24, [x3, #160]
246249
247250 msr vmpidr_el2, x4
248251 msr csselr_el1, x5
@@ -264,6 +267,7 @@ __kvm_hyp_code_start: · 15 unmodified lines
264267 msr tpidr_el1, x21
265268 msr amair_el1, x22
266269 msr cntkctl_el1, x23
270+ msr par_el1, x24
267271 .endm
268272
269273 .macro skip_32bit_state tmp, target
@@ -600,6 +604,8 @@ END(__kvm_vcpu_run) · 330 unmodified lines
600604
601605 // void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
602606 ENTRY(__kvm_tlb_flush_vmid_ipa)
607+ dsb ishst
608+
603609 kern_hyp_va x0
604610 ldr x2, [x0, #KVM_VTTBR]
605611 msr vttbr_el2, x2
@@ -621,6 +627,7 @@ ENTRY(__kvm_tlb_flush_vmid_ipa) · 15 unmodified lines
621627 ENDPROC(__kvm_tlb_flush_vmid_ipa)
622628
623629 ENTRY(__kvm_flush_vm_context)
630+ dsb ishst
624631 tlbi alle1is
625632 ic ialluis
626633 dsb sy
@@ -753,6 +760,10 @@ el1_trap: · 126 unmodified lines
753760 */
754761 tbnz x1, #7, 1f // S1PTW is set
755762
763+ /* Preserve PAR_EL1 */
764+ mrs x3, par_el1
765+ push x3, xzr
766+
756767 /*
757768 * Permission fault, HPFAR_EL2 is invalid.
758769 * Resolve the IPA the hard way using the guest VA.
@@ -766,6 +777,8 @@ el1_trap: · 7 unmodified lines
766777
767778 /* Read result */
768779 mrs x3, par_el1
780+ pop x0, xzr // Restore PAR_EL1 from the stack
781+ msr par_el1, x0
769782 tbnz x3, #0, 3f // Bail out if we failed the translation
770783 ubfx x3, x3, #12, #36 // Extract IPA
771784 lsl x3, x3, #4 // and present it like HPFAR
arch/arm64/kvm/sys_regs.c+3−0
@@ -211,6 +211,9 @@ static const struct sys_reg_desc sys_reg_descs[] = { · 210 unmodified lines
211211 /* FAR_EL1 */
212212 { Op0(0b11), Op1(0b000), CRn(0b0110), CRm(0b0000), Op2(0b000),
213213 NULL, reset_unknown, FAR_EL1 },
214+ /* PAR_EL1 */
215+ { Op0(0b11), Op1(0b000), CRn(0b0111), CRm(0b0100), Op2(0b000),
216+ NULL, reset_unknown, PAR_EL1 },
214217
215218 /* PMINTENSET_EL1 */
216219 { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b001),
arch/hexagon/Kconfig+1−0
@@ -158,6 +158,7 @@ source "kernel/Kconfig.hz" · 157 unmodified lines
158158 endmenu
159159
160160 source "init/Kconfig"
161+source "kernel/Kconfig.freezer"
161162 source "drivers/Kconfig"
162163 source "fs/Kconfig"
163164
arch/ia64/include/asm/tlb.h+6−3
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 * unmapping a portion of the virtual address space, these hooks are called according to
2323 * the following template:
2424 *
25− * tlb <- tlb_gather_mmu(mm, full_mm_flush); // start unmap for address space MM
25+ * tlb <- tlb_gather_mmu(mm, start, end); // start unmap for address space MM
2626 * {
2727 * for each vma that needs a shootdown do {
2828 * tlb_start_vma(tlb, vma);
@@ -58,6 +58,7 @@ struct mmu_gather { · 29 unmodified lines
5858 unsigned int max;
5959 unsigned char fullmm; /* non-zero means full mm flush */
6060 unsigned char need_flush; /* really unmapped some PTEs? */
61+ unsigned long start, end;
6162 unsigned long start_addr;
6263 unsigned long end_addr;
6364 struct page **pages;
@@ -155,13 +156,15 @@ static inline void __tlb_alloc_page(struct mmu_gather *tlb) · 91 unmodified lines
155156
156157
157158 static inline void
158−tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int full_mm_flush)
159+tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
159160 {
160161 tlb->mm = mm;
161162 tlb->max = ARRAY_SIZE(tlb->local);
162163 tlb->pages = tlb->local;
163164 tlb->nr = 0;
164− tlb->fullmm = full_mm_flush;
165+ tlb->fullmm = !(start | (end+1));
166+ tlb->start = start;
167+ tlb->end = end;
165168 tlb->start_addr = ~0UL;
166169 }
167170
arch/m68k/emu/natfeat.c+19−4
@@ -18,9 +18,11 @@ · 17 unmodified lines
1818 #include <asm/machdep.h>
1919 #include <asm/natfeat.h>
2020
21+extern long nf_get_id2(const char *feature_name);
22+
2123 asm("\n"
22−" .global nf_get_id,nf_call\n"
23−"nf_get_id:\n"
24+" .global nf_get_id2,nf_call\n"
25+"nf_get_id2:\n"
2426 " .short 0x7300\n"
2527 " rts\n"
2628 "nf_call:\n"
@@ -29,12 +31,25 @@ asm("\n" · 2 unmodified lines
2931 "1: moveq.l #0,%d0\n"
3032 " rts\n"
3133 " .section __ex_table,\"a\"\n"
32−" .long nf_get_id,1b\n"
34+" .long nf_get_id2,1b\n"
3335 " .long nf_call,1b\n"
3436 " .previous");
35−EXPORT_SYMBOL_GPL(nf_get_id);
3637 EXPORT_SYMBOL_GPL(nf_call);
3738
39+long nf_get_id(const char *feature_name)
40+{
41+ /* feature_name may be in vmalloc()ed memory, so make a copy */
42+ char name_copy[32];
43+ size_t n;
44+
45+ n = strlcpy(name_copy, feature_name, sizeof(name_copy));
46+ if (n >= sizeof(name_copy))
47+ return 0;
48+
49+ return nf_get_id2(name_copy);
50+}
51+EXPORT_SYMBOL_GPL(nf_get_id);
52+
3853 void nfprint(const char *fmt, ...)
3954 {
4055 static char buf[256];
arch/m68k/include/asm/div64.h+5−4
@@ -15,16 +15,17 @@ · 14 unmodified lines
1515 unsigned long long n64; \
1616 } __n; \
1717 unsigned long __rem, __upper; \
18+ unsigned long __base = (base); \
1819 \
1920 __n.n64 = (n); \
2021 if ((__upper = __n.n32[0])) { \
2122 asm ("divul.l %2,%1:%0" \
22− : "=d" (__n.n32[0]), "=d" (__upper) \
23− : "d" (base), "0" (__n.n32[0])); \
23+ : "=d" (__n.n32[0]), "=d" (__upper) \
24+ : "d" (__base), "0" (__n.n32[0])); \
2425 } \
2526 asm ("divu.l %2,%1:%0" \
26− : "=d" (__n.n32[1]), "=d" (__rem) \
27− : "d" (base), "1" (__upper), "0" (__n.n32[1])); \
27+ : "=d" (__n.n32[1]), "=d" (__rem) \
28+ : "d" (__base), "1" (__upper), "0" (__n.n32[1])); \
2829 (n) = __n.n64; \
2930 __rem; \
3031 })
arch/microblaze/Kconfig+1−1
@@ -28,7 +28,7 @@ config MICROBLAZE · 27 unmodified lines
2828 select GENERIC_CLOCKEVENTS
2929 select GENERIC_IDLE_POLL_SETUP
3030 select MODULES_USE_ELF_RELA
31− select CLONE_BACKWARDS
31+ select CLONE_BACKWARDS3
3232
3333 config SWAP
3434 def_bool n
arch/mips/math-emu/cp1emu.c+26−0
@@ -803,6 +803,32 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, · 802 unmodified lines
803803 dec_insn.next_pc_inc;
804804 return 1;
805805 break;
806+#ifdef CONFIG_CPU_CAVIUM_OCTEON
807+ case lwc2_op: /* This is bbit0 on Octeon */
808+ if ((regs->regs[insn.i_format.rs] & (1ull<<insn.i_format.rt)) == 0)
809+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);
810+ else
811+ *contpc = regs->cp0_epc + 8;
812+ return 1;
813+ case ldc2_op: /* This is bbit032 on Octeon */
814+ if ((regs->regs[insn.i_format.rs] & (1ull<<(insn.i_format.rt + 32))) == 0)
815+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);
816+ else
817+ *contpc = regs->cp0_epc + 8;
818+ return 1;
819+ case swc2_op: /* This is bbit1 on Octeon */
820+ if (regs->regs[insn.i_format.rs] & (1ull<<insn.i_format.rt))
821+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);
822+ else
823+ *contpc = regs->cp0_epc + 8;
824+ return 1;
825+ case sdc2_op: /* This is bbit132 on Octeon */
826+ if (regs->regs[insn.i_format.rs] & (1ull<<(insn.i_format.rt + 32)))
827+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);
828+ else
829+ *contpc = regs->cp0_epc + 8;
830+ return 1;
831+#endif
806832 case cop0_op:
807833 case cop1_op:
808834 case cop2_op:
arch/openrisc/Kconfig+1−0
@@ -55,6 +55,7 @@ config GENERIC_CSUM · 54 unmodified lines
5555
5656 source "init/Kconfig"
5757
58+source "kernel/Kconfig.freezer"
5859
5960 menu "Processor type and features"
6061
arch/powerpc/Kconfig+1−0
@@ -979,6 +979,7 @@ config RELOCATABLE · 978 unmodified lines
979979 must live at a different physical address than the primary
980980 kernel.
981981
982+# This value must have zeroes in the bottom 60 bits otherwise lots will break
982983 config PAGE_OFFSET
983984 hex
984985 default "0xc000000000000000"
arch/powerpc/include/asm/page.h+10−0
@@ -211,9 +211,19 @@ extern long long virt_phys_offset; · 210 unmodified lines
211211 #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + VIRT_PHYS_OFFSET))
212212 #define __pa(x) ((unsigned long)(x) - VIRT_PHYS_OFFSET)
213213 #else
214+#ifdef CONFIG_PPC64
215+/*
216+ * gcc miscompiles (unsigned long)(&static_var) - PAGE_OFFSET
217+ * with -mcmodel=medium, so we use & and | instead of - and + on 64-bit.
218+ */
219+#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) | PAGE_OFFSET))
220+#define __pa(x) ((unsigned long)(x) & 0x0fffffffffffffffUL)
221+
222+#else /* 32-bit, non book E */
214223 #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + PAGE_OFFSET - MEMORY_START))
215224 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START)
216225 #endif
226+#endif
217227
218228 /*
219229 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI,
arch/powerpc/kernel/lparcfg.c+9−13
@@ -35,7 +35,13 @@ · 34 unmodified lines
3535 #include <asm/vdso_datapage.h>
3636 #include <asm/vio.h>
3737 #include <asm/mmu.h>
38+#include <asm/machdep.h>
3839
40+
41+/*
42+ * This isn't a module but we expose that to userspace
43+ * via /proc so leave the definitions here
44+ */
3945 #define MODULE_VERS "1.9"
4046 #define MODULE_NAME "lparcfg"
4147
@@ -418,7 +424,8 @@ static void parse_em_data(struct seq_file *m) · 376 unmodified lines
418424 {
419425 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
420426
421− if (plpar_hcall(H_GET_EM_PARMS, retbuf) == H_SUCCESS)
427+ if (firmware_has_feature(FW_FEATURE_LPAR) &&
428+ plpar_hcall(H_GET_EM_PARMS, retbuf) == H_SUCCESS)
422429 seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]);
423430 }
424431
@@ -677,7 +684,6 @@ static int lparcfg_open(struct inode *inode, struct file *file) · 252 unmodified lines
677684 }
678685
679686 static const struct file_operations lparcfg_fops = {
680− .owner = THIS_MODULE,
681687 .read = seq_read,
682688 .write = lparcfg_write,
683689 .open = lparcfg_open,
@@ -699,14 +705,4 @@ static int __init lparcfg_init(void) · 15 unmodified lines
699705 }
700706 return 0;
701707 }
702−
703−static void __exit lparcfg_cleanup(void)
704−{
705− remove_proc_subtree("powerpc/lparcfg", NULL);
706−}
707−
708−module_init(lparcfg_init);
709−module_exit(lparcfg_cleanup);
710−MODULE_DESCRIPTION("Interface for LPAR configuration data");
711−MODULE_AUTHOR("Dave Engebretsen");
712−MODULE_LICENSE("GPL");
708+machine_device_initcall(pseries, lparcfg_init);
arch/s390/include/asm/tlb.h+6−2
@@ -32,6 +32,7 @@ struct mmu_gather { · 31 unmodified lines
3232 struct mm_struct *mm;
3333 struct mmu_table_batch *batch;
3434 unsigned int fullmm;
35+ unsigned long start, end;
3536 };
3637
3738 struct mmu_table_batch {
@@ -48,10 +49,13 @@ extern void tlb_remove_table(struct mmu_gather *tlb, void *table); · 10 unmodified lines
4849
4950 static inline void tlb_gather_mmu(struct mmu_gather *tlb,
5051 struct mm_struct *mm,
51− unsigned int full_mm_flush)
52+ unsigned long start,
53+ unsigned long end)
5254 {
5355 tlb->mm = mm;
54− tlb->fullmm = full_mm_flush;
56+ tlb->start = start;
57+ tlb->end = end;
58+ tlb->fullmm = !(start | (end+1));
5559 tlb->batch = NULL;
5660 if (tlb->fullmm)
5761 __tlb_flush_mm(mm);
arch/score/Kconfig+2−0
@@ -87,6 +87,8 @@ config STACKTRACE_SUPPORT · 86 unmodified lines
8787
8888 source "init/Kconfig"
8989
90+source "kernel/Kconfig.freezer"
91+
9092 config MMU
9193 def_bool y
9294
arch/sh/include/asm/tlb.h+4−2
@@ -36,10 +36,12 @@ static inline void init_tlb_gather(struct mmu_gather *tlb) · 35 unmodified lines
3636 }
3737
3838 static inline void
39−tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int full_mm_flush)
39+tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
4040 {
4141 tlb->mm = mm;
42− tlb->fullmm = full_mm_flush;
42+ tlb->start = start;
43+ tlb->end = end;
44+ tlb->fullmm = !(start | (end+1));
4345
4446 init_tlb_gather(tlb);
4547 }
arch/um/include/asm/tlb.h+4−2
@@ -45,10 +45,12 @@ static inline void init_tlb_gather(struct mmu_gather *tlb) · 44 unmodified lines
4545 }
4646
4747 static inline void
48−tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int full_mm_flush)
48+tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
4949 {
5050 tlb->mm = mm;
51− tlb->fullmm = full_mm_flush;
51+ tlb->start = start;
52+ tlb->end = end;
53+ tlb->fullmm = !(start | (end+1));
5254
5355 init_tlb_gather(tlb);
5456 }
arch/x86/include/asm/bootparam_utils.h+2−2
@@ -35,9 +35,9 @@ static void sanitize_boot_params(struct boot_params *boot_params) · 34 unmodified lines
3535 */
3636 if (boot_params->sentinel) {
3737 /* fields in boot_params are left uninitialized, clear them */
38− memset(&boot_params->olpc_ofw_header, 0,
38+ memset(&boot_params->ext_ramdisk_image, 0,
3939 (char *)&boot_params->efi_info -
40− (char *)&boot_params->olpc_ofw_header);
40+ (char *)&boot_params->ext_ramdisk_image);
4141 memset(&boot_params->kbd_status, 0,
4242 (char *)&boot_params->hdr -
4343 (char *)&boot_params->kbd_status);
arch/x86/include/asm/microcode_amd.h+1−1
@@ -59,7 +59,7 @@ static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table, · 58 unmodified lines
5959
6060 extern int __apply_microcode_amd(struct microcode_amd *mc_amd);
6161 extern int apply_microcode_amd(int cpu);
62−extern enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size);
62+extern enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size);
6363
6464 #ifdef CONFIG_MICROCODE_AMD_EARLY
6565 #ifdef CONFIG_X86_32
arch/x86/include/asm/pgtable-2level.h+47−1
@@ -55,9 +55,53 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) · 54 unmodified lines
5555 #define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp)
5656 #endif
5757
58+#ifdef CONFIG_MEM_SOFT_DIRTY
59+
60+/*
61+ * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE, _PAGE_BIT_SOFT_DIRTY and
62+ * _PAGE_BIT_PROTNONE are taken, split up the 28 bits of offset
63+ * into this range.
64+ */
65+#define PTE_FILE_MAX_BITS 28
66+#define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1)
67+#define PTE_FILE_SHIFT2 (_PAGE_BIT_FILE + 1)
68+#define PTE_FILE_SHIFT3 (_PAGE_BIT_PROTNONE + 1)
69+#define PTE_FILE_SHIFT4 (_PAGE_BIT_SOFT_DIRTY + 1)
70+#define PTE_FILE_BITS1 (PTE_FILE_SHIFT2 - PTE_FILE_SHIFT1 - 1)
71+#define PTE_FILE_BITS2 (PTE_FILE_SHIFT3 - PTE_FILE_SHIFT2 - 1)
72+#define PTE_FILE_BITS3 (PTE_FILE_SHIFT4 - PTE_FILE_SHIFT3 - 1)
73+
74+#define pte_to_pgoff(pte) \
75+ ((((pte).pte_low >> (PTE_FILE_SHIFT1)) \
76+ & ((1U << PTE_FILE_BITS1) - 1))) \
77+ + ((((pte).pte_low >> (PTE_FILE_SHIFT2)) \
78+ & ((1U << PTE_FILE_BITS2) - 1)) \
79+ << (PTE_FILE_BITS1)) \
80+ + ((((pte).pte_low >> (PTE_FILE_SHIFT3)) \
81+ & ((1U << PTE_FILE_BITS3) - 1)) \
82+ << (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \
83+ + ((((pte).pte_low >> (PTE_FILE_SHIFT4))) \
84+ << (PTE_FILE_BITS1 + PTE_FILE_BITS2 + PTE_FILE_BITS3))
85+
86+#define pgoff_to_pte(off) \
87+ ((pte_t) { .pte_low = \
88+ ((((off)) & ((1U << PTE_FILE_BITS1) - 1)) << PTE_FILE_SHIFT1) \
89+ + ((((off) >> PTE_FILE_BITS1) \
90+ & ((1U << PTE_FILE_BITS2) - 1)) \
91+ << PTE_FILE_SHIFT2) \
92+ + ((((off) >> (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \
93+ & ((1U << PTE_FILE_BITS3) - 1)) \
94+ << PTE_FILE_SHIFT3) \
95+ + ((((off) >> \
96+ (PTE_FILE_BITS1 + PTE_FILE_BITS2 + PTE_FILE_BITS3))) \
97+ << PTE_FILE_SHIFT4) \
98+ + _PAGE_FILE })
99+
100+#else /* CONFIG_MEM_SOFT_DIRTY */
101+
58102 /*
59103 * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE and _PAGE_BIT_PROTNONE are taken,
60− * split up the 29 bits of offset into this range:
104+ * split up the 29 bits of offset into this range.
61105 */
62106 #define PTE_FILE_MAX_BITS 29
63107 #define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1)
@@ -88,6 +132,8 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) · 24 unmodified lines
88132 << PTE_FILE_SHIFT3) \
89133 + _PAGE_FILE })
90134
135+#endif /* CONFIG_MEM_SOFT_DIRTY */
136+
91137 /* Encode and de-code a swap entry */
92138 #if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE
93139 #define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1)
arch/x86/include/asm/pgtable-3level.h+3−0
@@ -179,6 +179,9 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *pmdp) · 178 unmodified lines
179179 /*
180180 * Bits 0, 6 and 7 are taken in the low part of the pte,
181181 * put the 32 bits of offset into the high part.
182+ *
183+ * For soft-dirty tracking 11 bit is taken from
184+ * the low part of pte as well.
182185 */
183186 #define pte_to_pgoff(pte) ((pte).pte_high)
184187 #define pgoff_to_pte(off) \
arch/x86/include/asm/pgtable.h+30−0
@@ -314,6 +314,36 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd) · 313 unmodified lines
314314 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);
315315 }
316316
317+static inline pte_t pte_swp_mksoft_dirty(pte_t pte)
318+{
319+ return pte_set_flags(pte, _PAGE_SWP_SOFT_DIRTY);
320+}
321+
322+static inline int pte_swp_soft_dirty(pte_t pte)
323+{
324+ return pte_flags(pte) & _PAGE_SWP_SOFT_DIRTY;
325+}
326+
327+static inline pte_t pte_swp_clear_soft_dirty(pte_t pte)
328+{
329+ return pte_clear_flags(pte, _PAGE_SWP_SOFT_DIRTY);
330+}
331+
332+static inline pte_t pte_file_clear_soft_dirty(pte_t pte)
333+{
334+ return pte_clear_flags(pte, _PAGE_SOFT_DIRTY);
335+}
336+
337+static inline pte_t pte_file_mksoft_dirty(pte_t pte)
338+{
339+ return pte_set_flags(pte, _PAGE_SOFT_DIRTY);
340+}
341+
342+static inline int pte_file_soft_dirty(pte_t pte)
343+{
344+ return pte_flags(pte) & _PAGE_SOFT_DIRTY;
345+}
346+
317347 /*
318348 * Mask out unsupported bits in a present pgprot. Non-present pgprots
319349 * can use those bits for other purposes, so leave them be.
arch/x86/include/asm/pgtable_types.h+16−1
@@ -61,12 +61,27 @@ · 60 unmodified lines
6161 * they do not conflict with each other.
6262 */
6363
64+#define _PAGE_BIT_SOFT_DIRTY _PAGE_BIT_HIDDEN
65+
6466 #ifdef CONFIG_MEM_SOFT_DIRTY
65−#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN)
67+#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_SOFT_DIRTY)
6668 #else
6769 #define _PAGE_SOFT_DIRTY (_AT(pteval_t, 0))
6870 #endif
6971
72+/*
73+ * Tracking soft dirty bit when a page goes to a swap is tricky.
74+ * We need a bit which can be stored in pte _and_ not conflict
75+ * with swap entry format. On x86 bits 6 and 7 are *not* involved
76+ * into swap entry computation, but bit 6 is used for nonlinear
77+ * file mapping, so we borrow bit 7 for soft dirty tracking.
78+ */
79+#ifdef CONFIG_MEM_SOFT_DIRTY
80+#define _PAGE_SWP_SOFT_DIRTY _PAGE_PSE
81+#else
82+#define _PAGE_SWP_SOFT_DIRTY (_AT(pteval_t, 0))
83+#endif
84+
7085 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
7186 #define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
7287 #else
arch/x86/include/asm/spinlock.h+0−4
@@ -233,8 +233,4 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) · 232 unmodified lines
233233 #define arch_read_relax(lock) cpu_relax()
234234 #define arch_write_relax(lock) cpu_relax()
235235
236−/* The {read|write|spin}_lock() on x86 are full memory barriers. */
237−static inline void smp_mb__after_lock(void) { }
238−#define ARCH_HAS_SMP_MB_AFTER_LOCK
239−
240236 #endif /* _ASM_X86_SPINLOCK_H */
arch/x86/kernel/cpu/amd.c+5−15
@@ -512,7 +512,7 @@ static void early_init_amd(struct cpuinfo_x86 *c) · 511 unmodified lines
512512
513513 static const int amd_erratum_383[];
514514 static const int amd_erratum_400[];
515−static bool cpu_has_amd_erratum(const int *erratum);
515+static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum);
516516
517517 static void init_amd(struct cpuinfo_x86 *c)
518518 {
@@ -729,11 +729,11 @@ static void init_amd(struct cpuinfo_x86 *c) · 210 unmodified lines
729729 value &= ~(1ULL << 24);
730730 wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
731731
732− if (cpu_has_amd_erratum(amd_erratum_383))
732+ if (cpu_has_amd_erratum(c, amd_erratum_383))
733733 set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
734734 }
735735
736− if (cpu_has_amd_erratum(amd_erratum_400))
736+ if (cpu_has_amd_erratum(c, amd_erratum_400))
737737 set_cpu_bug(c, X86_BUG_AMD_APIC_C1E);
738738
739739 rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
@@ -878,23 +878,13 @@ static const int amd_erratum_400[] = · 138 unmodified lines
878878 static const int amd_erratum_383[] =
879879 AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf));
880880
881−static bool cpu_has_amd_erratum(const int *erratum)
881+
882+static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum)
882883 {
883− struct cpuinfo_x86 *cpu = __this_cpu_ptr(&cpu_info);
884884 int osvw_id = *erratum++;
885885 u32 range;
886886 u32 ms;
887887
888− /*
889− * If called early enough that current_cpu_data hasn't been initialized
890− * yet, fall back to boot_cpu_data.
891− */
892− if (cpu->x86 == 0)
893− cpu = &boot_cpu_data;
894−
895− if (cpu->x86_vendor != X86_VENDOR_AMD)
896− return false;
897−
898888 if (osvw_id >= 0 && osvw_id < 65536 &&
899889 cpu_has(cpu, X86_FEATURE_OSVW)) {
900890 u64 osvw_len;
arch/x86/kernel/cpu/perf_event_intel.c+1−0
@@ -2270,6 +2270,7 @@ __init int intel_pmu_init(void) · 2269 unmodified lines
22702270 case 70:
22712271 case 71:
22722272 case 63:
2273+ case 69:
22732274 x86_pmu.late_ack = true;
22742275 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids));
22752276 memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
arch/x86/kernel/cpu/perf_event_intel_uncore.c+2−2
@@ -352,8 +352,8 @@ static struct uncore_event_desc snbep_uncore_imc_events[] = { · 351 unmodified lines
352352 static struct uncore_event_desc snbep_uncore_qpi_events[] = {
353353 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x14"),
354354 INTEL_UNCORE_EVENT_DESC(txl_flits_active, "event=0x00,umask=0x06"),
355− INTEL_UNCORE_EVENT_DESC(drs_data, "event=0x02,umask=0x08"),
356− INTEL_UNCORE_EVENT_DESC(ncb_data, "event=0x03,umask=0x04"),
355+ INTEL_UNCORE_EVENT_DESC(drs_data, "event=0x102,umask=0x08"),
356+ INTEL_UNCORE_EVENT_DESC(ncb_data, "event=0x103,umask=0x04"),
357357 { /* end: all zeroes */ },
358358 };
359359
arch/x86/kernel/microcode_amd.c+13−14
@@ -145,10 +145,9 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) · 144 unmodified lines
145145 return 0;
146146 }
147147
148−static unsigned int verify_patch_size(int cpu, u32 patch_size,
148+static unsigned int verify_patch_size(u8 family, u32 patch_size,
149149 unsigned int size)
150150 {
151− struct cpuinfo_x86 *c = &cpu_data(cpu);
152151 u32 max_size;
153152
154153 #define F1XH_MPB_MAX_SIZE 2048
@@ -156,7 +155,7 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size, · 1 unmodified line
156155 #define F15H_MPB_MAX_SIZE 4096
157156 #define F16H_MPB_MAX_SIZE 3458
158157
159− switch (c->x86) {
158+ switch (family) {
160159 case 0x14:
161160 max_size = F14H_MPB_MAX_SIZE;
162161 break;
@@ -277,9 +276,8 @@ static void cleanup(void) · 114 unmodified lines
277276 * driver cannot continue functioning normally. In such cases, we tear
278277 * down everything we've used up so far and exit.
279278 */
280−static int verify_and_add_patch(unsigned int cpu, u8 *fw, unsigned int leftover)
279+static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover)
281280 {
282− struct cpuinfo_x86 *c = &cpu_data(cpu);
283281 struct microcode_header_amd *mc_hdr;
284282 struct ucode_patch *patch;
285283 unsigned int patch_size, crnt_size, ret;
@@ -299,7 +297,7 @@ static int verify_and_add_patch(unsigned int cpu, u8 *fw, unsigned int leftover) · 13 unmodified lines
299297
300298 /* check if patch is for the current family */
301299 proc_fam = ((proc_fam >> 8) & 0xf) + ((proc_fam >> 20) & 0xff);
302− if (proc_fam != c->x86)
300+ if (proc_fam != family)
303301 return crnt_size;
304302
305303 if (mc_hdr->nb_dev_id || mc_hdr->sb_dev_id) {
@@ -308,7 +306,7 @@ static int verify_and_add_patch(unsigned int cpu, u8 *fw, unsigned int leftover) · 2 unmodified lines
308306 return crnt_size;
309307 }
310308
311− ret = verify_patch_size(cpu, patch_size, leftover);
309+ ret = verify_patch_size(family, patch_size, leftover);
312310 if (!ret) {
313311 pr_err("Patch-ID 0x%08x: size mismatch.\n", mc_hdr->patch_id);
314312 return crnt_size;
@@ -339,7 +337,8 @@ static int verify_and_add_patch(unsigned int cpu, u8 *fw, unsigned int leftover) · 24 unmodified lines
339337 return crnt_size;
340338 }
341339
342−static enum ucode_state __load_microcode_amd(int cpu, const u8 *data, size_t size)
340+static enum ucode_state __load_microcode_amd(u8 family, const u8 *data,
341+ size_t size)
343342 {
344343 enum ucode_state ret = UCODE_ERROR;
345344 unsigned int leftover;
@@ -362,7 +361,7 @@ static enum ucode_state __load_microcode_amd(int cpu, const u8 *data, size_t siz · 16 unmodified lines
362361 }
363362
364363 while (leftover) {
365− crnt_size = verify_and_add_patch(cpu, fw, leftover);
364+ crnt_size = verify_and_add_patch(family, fw, leftover);
366365 if (crnt_size < 0)
367366 return ret;
368367
@@ -373,22 +372,22 @@ static enum ucode_state __load_microcode_amd(int cpu, const u8 *data, size_t siz · 4 unmodified lines
373372 return UCODE_OK;
374373 }
375374
376−enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size)
375+enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size)
377376 {
378377 enum ucode_state ret;
379378
380379 /* free old equiv table */
381380 free_equiv_cpu_table();
382381
383− ret = __load_microcode_amd(cpu, data, size);
382+ ret = __load_microcode_amd(family, data, size);
384383
385384 if (ret != UCODE_OK)
386385 cleanup();
387386
388387 #if defined(CONFIG_MICROCODE_AMD_EARLY) && defined(CONFIG_X86_32)
389388 /* save BSP's matching patch for early load */
390− if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) {
391− struct ucode_patch *p = find_patch(cpu);
389+ if (cpu_data(smp_processor_id()).cpu_index == boot_cpu_data.cpu_index) {
390+ struct ucode_patch *p = find_patch(smp_processor_id());
392391 if (p) {
393392 memset(amd_bsp_mpb, 0, MPB_MAX_SIZE);
394393 memcpy(amd_bsp_mpb, p->data, min_t(u32, ksize(p->data),
@@ -441,7 +440,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device, · 46 unmodified lines
441440 goto fw_release;
442441 }
443442
444− ret = load_microcode_amd(cpu, fw->data, fw->size);
443+ ret = load_microcode_amd(c->x86, fw->data, fw->size);
445444
446445 fw_release:
447446 release_firmware(fw);
arch/x86/kernel/microcode_amd_early.c+13−14
@@ -238,25 +238,17 @@ static void __init collect_cpu_sig_on_bsp(void *arg) · 237 unmodified lines
238238 uci->cpu_sig.sig = cpuid_eax(0x00000001);
239239 }
240240 #else
241−static void collect_cpu_info_amd_early(struct cpuinfo_x86 *c,
242− struct ucode_cpu_info *uci)
241+void load_ucode_amd_ap(void)
243242 {
243+ unsigned int cpu = smp_processor_id();
244+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
244245 u32 rev, eax;
245246
246247 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, eax);
247248 eax = cpuid_eax(0x00000001);
248249
249− uci->cpu_sig.sig = eax;
250250 uci->cpu_sig.rev = rev;
251− c->microcode = rev;
252− c->x86 = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
253−}
254−
255−void load_ucode_amd_ap(void)
256−{
257− unsigned int cpu = smp_processor_id();
258−
259− collect_cpu_info_amd_early(&cpu_data(cpu), ucode_cpu_info + cpu);
251+ uci->cpu_sig.sig = eax;
260252
261253 if (cpu && !ucode_loaded) {
262254 void *ucode;
@@ -265,8 +257,10 @@ void load_ucode_amd_ap(void) · 2 unmodified lines
265257 return;
266258
267259 ucode = (void *)(initrd_start + ucode_offset);
268− if (load_microcode_amd(0, ucode, ucode_size) != UCODE_OK)
260+ eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
261+ if (load_microcode_amd(eax, ucode, ucode_size) != UCODE_OK)
269262 return;
263+
270264 ucode_loaded = true;
271265 }
272266
@@ -278,6 +272,8 @@ int __init save_microcode_in_initrd_amd(void) · 5 unmodified lines
278272 {
279273 enum ucode_state ret;
280274 void *ucode;
275+ u32 eax;
276+
281277 #ifdef CONFIG_X86_32
282278 unsigned int bsp = boot_cpu_data.cpu_index;
283279 struct ucode_cpu_info *uci = ucode_cpu_info + bsp;
@@ -293,7 +289,10 @@ int __init save_microcode_in_initrd_amd(void) · 9 unmodified lines
293289 return 0;
294290
295291 ucode = (void *)(initrd_start + ucode_offset);
296− ret = load_microcode_amd(0, ucode, ucode_size);
292+ eax = cpuid_eax(0x00000001);
293+ eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
294+
295+ ret = load_microcode_amd(eax, ucode, ucode_size);
297296 if (ret != UCODE_OK)
298297 return -EINVAL;
299298
arch/x86/kernel/sys_x86_64.c+1−1
@@ -101,7 +101,7 @@ static void find_start_end(unsigned long flags, unsigned long *begin, · 100 unmodified lines
101101 *begin = new_begin;
102102 }
103103 } else {
104− *begin = TASK_UNMAPPED_BASE;
104+ *begin = current->mm->mmap_legacy_base;
105105 *end = TASK_SIZE;
106106 }
107107 }
arch/x86/mm/mmap.c+4−2
@@ -112,11 +112,13 @@ static unsigned long mmap_legacy_base(void) · 111 unmodified lines
112112 */
113113 void arch_pick_mmap_layout(struct mm_struct *mm)
114114 {
115+ mm->mmap_legacy_base = mmap_legacy_base();
116+ mm->mmap_base = mmap_base();
117+
115118 if (mmap_is_legacy()) {
116− mm->mmap_base = mmap_legacy_base();
119+ mm->mmap_base = mm->mmap_legacy_base;
117120 mm->get_unmapped_area = arch_get_unmapped_area;
118121 } else {
119− mm->mmap_base = mmap_base();
120122 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
121123 }
122124 }
arch/x86/xen/setup.c+22−0
@@ -313,6 +313,17 @@ static void xen_align_and_add_e820_region(u64 start, u64 size, int type) · 312 unmodified lines
313313 e820_add_region(start, end - start, type);
314314 }
315315
316+void xen_ignore_unusable(struct e820entry *list, size_t map_size)
317+{
318+ struct e820entry *entry;
319+ unsigned int i;
320+
321+ for (i = 0, entry = list; i < map_size; i++, entry++) {
322+ if (entry->type == E820_UNUSABLE)
323+ entry->type = E820_RAM;
324+ }
325+}
326+
316327 /**
317328 * machine_specific_memory_setup - Hook for machine specific memory setup.
318329 **/
@@ -353,6 +364,17 @@ char * __init xen_memory_setup(void) · 34 unmodified lines
353364 }
354365 BUG_ON(rc);
355366
367+ /*
368+ * Xen won't allow a 1:1 mapping to be created to UNUSABLE
369+ * regions, so if we're using the machine memory map leave the
370+ * region as RAM as it is in the pseudo-physical map.
371+ *
372+ * UNUSABLE regions in domUs are not handled and will need
373+ * a patch in the future.
374+ */
375+ if (xen_initial_domain())
376+ xen_ignore_unusable(map, memmap.nr_entries);
377+
356378 /* Make sure the Xen-supplied memory map is well-ordered. */
357379 sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries);
358380
arch/x86/xen/smp.c+9−2
@@ -694,8 +694,15 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus) · 693 unmodified lines
694694 static int xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle)
695695 {
696696 int rc;
697− rc = native_cpu_up(cpu, tidle);
698− WARN_ON (xen_smp_intr_init(cpu));
697+ /*
698+ * xen_smp_intr_init() needs to run before native_cpu_up()
699+ * so that IPI vectors are set up on the booting CPU before
700+ * it is marked online in native_cpu_up().
701+ */
702+ rc = xen_smp_intr_init(cpu);
703+ WARN_ON(rc);
704+ if (!rc)
705+ rc = native_cpu_up(cpu, tidle);
699706 return rc;
700707 }
701708
drivers/acpi/video.c+3−8
@@ -908,9 +908,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) · 907 unmodified lines
908908 device->cap._DDC = 1;
909909 }
910910
911− if (acpi_video_init_brightness(device))
912− return;
913−
914911 if (acpi_video_backlight_support()) {
915912 struct backlight_properties props;
916913 struct pci_dev *pdev;
@@ -920,6 +917,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) · 3 unmodified lines
920917 static int count = 0;
921918 char *name;
922919
920+ result = acpi_video_init_brightness(device);
921+ if (result)
922+ return;
923923 name = kasprintf(GFP_KERNEL, "acpi_video%d", count);
924924 if (!name)
925925 return;
@@ -979,11 +979,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) · 53 unmodified lines
979979 if (result)
980980 printk(KERN_ERR PREFIX "Create sysfs link\n");
981981
982− } else {
983− /* Remove the brightness object. */
984− kfree(device->brightness->levels);
985− kfree(device->brightness);
986− device->brightness = NULL;
987982 }
988983 }
989984
drivers/ata/libata-pmp.c+6−6
@@ -289,24 +289,24 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info) · 288 unmodified lines
289289
290290 /* Disable sending Early R_OK.
291291 * With "cached read" HDD testing and multiple ports busy on a SATA
292− * host controller, 3726 PMP will very rarely drop a deferred
292+ * host controller, 3x26 PMP will very rarely drop a deferred
293293 * R_OK that was intended for the host. Symptom will be all
294294 * 5 drives under test will timeout, get reset, and recover.
295295 */
296− if (vendor == 0x1095 && devid == 0x3726) {
296+ if (vendor == 0x1095 && (devid == 0x3726 || devid == 0x3826)) {
297297 u32 reg;
298298
299299 err_mask = sata_pmp_read(&ap->link, PMP_GSCR_SII_POL, &reg);
300300 if (err_mask) {
301301 rc = -EIO;
302− reason = "failed to read Sil3726 Private Register";
302+ reason = "failed to read Sil3x26 Private Register";
303303 goto fail;
304304 }
305305 reg &= ~0x1;
306306 err_mask = sata_pmp_write(&ap->link, PMP_GSCR_SII_POL, reg);
307307 if (err_mask) {
308308 rc = -EIO;
309− reason = "failed to write Sil3726 Private Register";
309+ reason = "failed to write Sil3x26 Private Register";
310310 goto fail;
311311 }
312312 }
@@ -383,8 +383,8 @@ static void sata_pmp_quirks(struct ata_port *ap) · 70 unmodified lines
383383 u16 devid = sata_pmp_gscr_devid(gscr);
384384 struct ata_link *link;
385385
386− if (vendor == 0x1095 && devid == 0x3726) {
387− /* sil3726 quirks */
386+ if (vendor == 0x1095 && (devid == 0x3726 || devid == 0x3826)) {
387+ /* sil3x26 quirks */
388388 ata_for_each_link(link, ap, EDGE) {
389389 /* link reports offline after LPM */
390390 link->flags |= ATA_LFLAG_NO_LPM;
drivers/ata/sata_fsl.c+3−2
@@ -293,6 +293,7 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host, · 292 unmodified lines
293293 {
294294 struct sata_fsl_host_priv *host_priv = host->private_data;
295295 void __iomem *hcr_base = host_priv->hcr_base;
296+ unsigned long flags;
296297
297298 if (count > ICC_MAX_INT_COUNT_THRESHOLD)
298299 count = ICC_MAX_INT_COUNT_THRESHOLD;
@@ -305,12 +306,12 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host, · 6 unmodified lines
305306 (count > ICC_MIN_INT_COUNT_THRESHOLD))
306307 ticks = ICC_SAFE_INT_TICKS;
307308
308− spin_lock(&host->lock);
309+ spin_lock_irqsave(&host->lock, flags);
309310 iowrite32((count << 24 | ticks), hcr_base + ICC);
310311
311312 intr_coalescing_count = count;
312313 intr_coalescing_ticks = ticks;
313− spin_unlock(&host->lock);
314+ spin_unlock_irqrestore(&host->lock, flags);
314315
315316 DPRINTK("interrupt coalescing, count = 0x%x, ticks = %x\n",
316317 intr_coalescing_count, intr_coalescing_ticks);
drivers/ata/sata_highbank.c+2−2
@@ -86,11 +86,11 @@ struct ecx_plat_data { · 85 unmodified lines
8686
8787 #define SGPIO_SIGNALS 3
8888 #define ECX_ACTIVITY_BITS 0x300000
89−#define ECX_ACTIVITY_SHIFT 2
89+#define ECX_ACTIVITY_SHIFT 0
9090 #define ECX_LOCATE_BITS 0x80000
9191 #define ECX_LOCATE_SHIFT 1
9292 #define ECX_FAULT_BITS 0x400000
93−#define ECX_FAULT_SHIFT 0
93+#define ECX_FAULT_SHIFT 2
9494 static inline int sgpio_bit_shift(struct ecx_plat_data *pdata, u32 port,
9595 u32 shift)
9696 {
drivers/base/memory.c+2−0
@@ -141,6 +141,8 @@ static ssize_t show_mem_removable(struct device *dev, · 140 unmodified lines
141141 container_of(dev, struct memory_block, dev);
142142
143143 for (i = 0; i < sections_per_block; i++) {
144+ if (!present_section_nr(mem->start_section_nr + i))
145+ continue;
144146 pfn = section_nr_to_pfn(mem->start_section_nr + i);
145147 ret &= is_mem_section_removable(pfn, PAGES_PER_SECTION);
146148 }
drivers/base/regmap/regcache-rbtree.c+1−1
@@ -332,7 +332,7 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) · 331 unmodified lines
332332 }
333333
334334 if (!rbnode->blklen) {
335− rbnode->blklen = sizeof(*rbnode);
335+ rbnode->blklen = 1;
336336 rbnode->base_reg = reg;
337337 }
338338
drivers/block/aoe/aoecmd.c+7−10
@@ -906,16 +906,10 @@ bio_pageinc(struct bio *bio) · 905 unmodified lines
906906 int i;
907907
908908 bio_for_each_segment(bv, bio, i) {
909− page = bv->bv_page;
910909 /* Non-zero page count for non-head members of
911− * compound pages is no longer allowed by the kernel,
912− * but this has never been seen here.
910+ * compound pages is no longer allowed by the kernel.
913911 */
914− if (unlikely(PageCompound(page)))
915− if (compound_trans_head(page) != page) {
916− pr_crit("page tail used for block I/O\n");
917− BUG();
918− }
912+ page = compound_trans_head(bv->bv_page);
919913 atomic_inc(&page->_count);
920914 }
921915 }
@@ -924,10 +918,13 @@ static void · 2 unmodified lines
924918 bio_pagedec(struct bio *bio)
925919 {
926920 struct bio_vec *bv;
921+ struct page *page;
927922 int i;
928923
929− bio_for_each_segment(bv, bio, i)
930− atomic_dec(&bv->bv_page->_count);
924+ bio_for_each_segment(bv, bio, i) {
925+ page = compound_trans_head(bv->bv_page);
926+ atomic_dec(&page->_count);
927+ }
931928 }
932929
933930 static void
drivers/clk/samsung/clk-exynos4.c+34−30
@@ -581,11 +581,15 @@ struct samsung_div_clock exynos4x12_div_clks[] __initdata = { · 580 unmodified lines
581581 DIV(none, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4),
582582 DIV(none, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8),
583583 DIV(none, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4),
584− DIV(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3),
585− DIV(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3),
584+ DIV_F(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3,
585+ CLK_GET_RATE_NOCACHE, 0),
586+ DIV_F(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3,
587+ CLK_GET_RATE_NOCACHE, 0),
586588 DIV(none, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3),
587− DIV(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1, 4, 3),
588− DIV(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, 8, 3),
589+ DIV_F(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1,
590+ 4, 3, CLK_GET_RATE_NOCACHE, 0),
591+ DIV_F(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1,
592+ 8, 3, CLK_GET_RATE_NOCACHE, 0),
589593 DIV(sclk_fimg2d, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4),
590594 };
591595
@@ -863,57 +867,57 @@ struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { · 271 unmodified lines
863867 GATE_DA(i2s0, "samsung-i2s.0", "i2s0", "aclk100",
864868 E4X12_GATE_IP_MAUDIO, 3, 0, 0, "iis"),
865869 GATE(fimc_isp, "isp", "aclk200", E4X12_GATE_ISP0, 0,
866− CLK_IGNORE_UNUSED, 0),
870+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
867871 GATE(fimc_drc, "drc", "aclk200", E4X12_GATE_ISP0, 1,
868− CLK_IGNORE_UNUSED, 0),
872+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
869873 GATE(fimc_fd, "fd", "aclk200", E4X12_GATE_ISP0, 2,
870− CLK_IGNORE_UNUSED, 0),
874+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
871875 GATE(fimc_lite0, "lite0", "aclk200", E4X12_GATE_ISP0, 3,
872− CLK_IGNORE_UNUSED, 0),
876+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
873877 GATE(fimc_lite1, "lite1", "aclk200", E4X12_GATE_ISP0, 4,
874− CLK_IGNORE_UNUSED, 0),
878+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
875879 GATE(mcuisp, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5,
876− CLK_IGNORE_UNUSED, 0),
880+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
877881 GATE(gicisp, "gicisp", "aclk200", E4X12_GATE_ISP0, 7,
878− CLK_IGNORE_UNUSED, 0),
882+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
879883 GATE(smmu_isp, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8,
880− CLK_IGNORE_UNUSED, 0),
884+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
881885 GATE(smmu_drc, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9,
882− CLK_IGNORE_UNUSED, 0),
886+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
883887 GATE(smmu_fd, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10,
884− CLK_IGNORE_UNUSED, 0),
888+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
885889 GATE(smmu_lite0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11,
886− CLK_IGNORE_UNUSED, 0),
890+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
887891 GATE(smmu_lite1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12,
888− CLK_IGNORE_UNUSED, 0),
892+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
889893 GATE(ppmuispmx, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20,
890− CLK_IGNORE_UNUSED, 0),
894+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
891895 GATE(ppmuispx, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21,
892− CLK_IGNORE_UNUSED, 0),
896+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
893897 GATE(mcuctl_isp, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23,
894− CLK_IGNORE_UNUSED, 0),
898+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
895899 GATE(mpwm_isp, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24,
896− CLK_IGNORE_UNUSED, 0),
900+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
897901 GATE(i2c0_isp, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25,
898− CLK_IGNORE_UNUSED, 0),
902+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
899903 GATE(i2c1_isp, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26,
900− CLK_IGNORE_UNUSED, 0),
904+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
901905 GATE(mtcadc_isp, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27,
902− CLK_IGNORE_UNUSED, 0),
906+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
903907 GATE(pwm_isp, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28,
904− CLK_IGNORE_UNUSED, 0),
908+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
905909 GATE(wdt_isp, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30,
906− CLK_IGNORE_UNUSED, 0),
910+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
907911 GATE(uart_isp, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31,
908− CLK_IGNORE_UNUSED, 0),
912+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
909913 GATE(asyncaxim, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0,
910− CLK_IGNORE_UNUSED, 0),
914+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
911915 GATE(smmu_ispcx, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4,
912− CLK_IGNORE_UNUSED, 0),
916+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
913917 GATE(spi0_isp, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12,
914− CLK_IGNORE_UNUSED, 0),
918+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
915919 GATE(spi1_isp, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13,
916− CLK_IGNORE_UNUSED, 0),
920+ CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
917921 GATE(g2d, "g2d", "aclk200", GATE_IP_DMC, 23, 0, 0),
918922 };
919923
drivers/clk/zynq/clkc.c+8−5
@@ -71,6 +71,7 @@ static DEFINE_SPINLOCK(armpll_lock); · 70 unmodified lines
7171 static DEFINE_SPINLOCK(ddrpll_lock);
7272 static DEFINE_SPINLOCK(iopll_lock);
7373 static DEFINE_SPINLOCK(armclk_lock);
74+static DEFINE_SPINLOCK(swdtclk_lock);
7475 static DEFINE_SPINLOCK(ddrclk_lock);
7576 static DEFINE_SPINLOCK(dciclk_lock);
7677 static DEFINE_SPINLOCK(gem0clk_lock);
@@ -293,7 +294,7 @@ static void __init zynq_clk_setup(struct device_node *np) · 216 unmodified lines
293294 }
294295 clks[swdt] = clk_register_mux(NULL, clk_output_name[swdt],
295296 swdt_ext_clk_mux_parents, 2, CLK_SET_RATE_PARENT,
296− SLCR_SWDT_CLK_SEL, 0, 1, 0, &gem0clk_lock);
297+ SLCR_SWDT_CLK_SEL, 0, 1, 0, &swdtclk_lock);
297298
298299 /* DDR clocks */
299300 clk = clk_register_divider(NULL, "ddr2x_div", "ddrpll", 0,
@@ -364,8 +365,9 @@ static void __init zynq_clk_setup(struct device_node *np) · 64 unmodified lines
364365 CLK_SET_RATE_PARENT, SLCR_GEM0_CLK_CTRL, 20, 6,
365366 CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO,
366367 &gem0clk_lock);
367− clk = clk_register_mux(NULL, "gem0_emio_mux", gem0_mux_parents, 2, 0,
368− SLCR_GEM0_CLK_CTRL, 6, 1, 0, &gem0clk_lock);
368+ clk = clk_register_mux(NULL, "gem0_emio_mux", gem0_mux_parents, 2,
369+ CLK_SET_RATE_PARENT, SLCR_GEM0_CLK_CTRL, 6, 1, 0,
370+ &gem0clk_lock);
369371 clks[gem0] = clk_register_gate(NULL, clk_output_name[gem0],
370372 "gem0_emio_mux", CLK_SET_RATE_PARENT,
371373 SLCR_GEM0_CLK_CTRL, 0, 0, &gem0clk_lock);
@@ -386,8 +388,9 @@ static void __init zynq_clk_setup(struct device_node *np) · 14 unmodified lines
386388 CLK_SET_RATE_PARENT, SLCR_GEM1_CLK_CTRL, 20, 6,
387389 CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO,
388390 &gem1clk_lock);
389− clk = clk_register_mux(NULL, "gem1_emio_mux", gem1_mux_parents, 2, 0,
390− SLCR_GEM1_CLK_CTRL, 6, 1, 0, &gem1clk_lock);
391+ clk = clk_register_mux(NULL, "gem1_emio_mux", gem1_mux_parents, 2,
392+ CLK_SET_RATE_PARENT, SLCR_GEM1_CLK_CTRL, 6, 1, 0,
393+ &gem1clk_lock);
391394 clks[gem1] = clk_register_gate(NULL, clk_output_name[gem1],
392395 "gem1_emio_mux", CLK_SET_RATE_PARENT,
393396 SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock);
drivers/gpu/drm/gma500/psb_intel_sdvo.c+2−1
@@ -500,7 +500,8 @@ static bool psb_intel_sdvo_read_response(struct psb_intel_sdvo *psb_intel_sdvo, · 499 unmodified lines
500500 &status))
501501 goto log_fail;
502502
503− while (status == SDVO_CMD_STATUS_PENDING && retry--) {
503+ while ((status == SDVO_CMD_STATUS_PENDING ||
504+ status == SDVO_CMD_STATUS_TARGET_NOT_SPECIFIED) && retry--) {
504505 udelay(15);
505506 if (!psb_intel_sdvo_read_byte(psb_intel_sdvo,
506507 SDVO_I2C_CMD_STATUS,
drivers/gpu/drm/i915/i915_gem_dmabuf.c+8−0
@@ -85,9 +85,17 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment, · 84 unmodified lines
8585 struct sg_table *sg,
8686 enum dma_data_direction dir)
8787 {
88+ struct drm_i915_gem_object *obj = attachment->dmabuf->priv;
89+
90+ mutex_lock(&obj->base.dev->struct_mutex);
91+
8892 dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir);
8993 sg_free_table(sg);
9094 kfree(sg);
95+
96+ i915_gem_object_unpin_pages(obj);
97+
98+ mutex_unlock(&obj->base.dev->struct_mutex);
9199 }
92100
93101 static void i915_gem_dmabuf_release(struct dma_buf *dma_buf)
drivers/gpu/drm/i915/i915_reg.h+2−0
@@ -752,6 +752,8 @@ · 751 unmodified lines
752752 will not assert AGPBUSY# and will only
753753 be delivered when out of C3. */
754754 #define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */
755+#define INSTPM_TLB_INVALIDATE (1<<9)
756+#define INSTPM_SYNC_FLUSH (1<<5)
755757 #define ACTHD 0x020c8
756758 #define FW_BLC 0x020d8
757759 #define FW_BLC2 0x020dc
drivers/gpu/drm/i915/intel_display.c+57−29
@@ -10042,6 +10042,8 @@ struct intel_display_error_state { · 10041 unmodified lines
1004210042
1004310043 u32 power_well_driver;
1004410044
10045+ int num_transcoders;
10046+
1004510047 struct intel_cursor_error_state {
1004610048 u32 control;
1004710049 u32 position;
@@ -10050,16 +10052,7 @@ struct intel_display_error_state { · 2 unmodified lines
1005010052 } cursor[I915_MAX_PIPES];
1005110053
1005210054 struct intel_pipe_error_state {
10053− enum transcoder cpu_transcoder;
10054− u32 conf;
1005510055 u32 source;
10056−
10057− u32 htotal;
10058− u32 hblank;
10059− u32 hsync;
10060− u32 vtotal;
10061− u32 vblank;
10062− u32 vsync;
1006310056 } pipe[I915_MAX_PIPES];
1006410057
1006510058 struct intel_plane_error_state {
@@ -10071,6 +10064,19 @@ struct intel_display_error_state { · 5 unmodified lines
1007110064 u32 surface;
1007210065 u32 tile_offset;
1007310066 } plane[I915_MAX_PIPES];
10067+
10068+ struct intel_transcoder_error_state {
10069+ enum transcoder cpu_transcoder;
10070+
10071+ u32 conf;
10072+
10073+ u32 htotal;
10074+ u32 hblank;
10075+ u32 hsync;
10076+ u32 vtotal;
10077+ u32 vblank;
10078+ u32 vsync;
10079+ } transcoder[4];
1007410080 };
1007510081
1007610082 struct intel_display_error_state *
@@ -10078,9 +10084,17 @@ intel_display_capture_error_state(struct drm_device *dev) · 1 unmodified line
1007810084 {
1007910085 drm_i915_private_t *dev_priv = dev->dev_private;
1008010086 struct intel_display_error_state *error;
10081− enum transcoder cpu_transcoder;
10087+ int transcoders[] = {
10088+ TRANSCODER_A,
10089+ TRANSCODER_B,
10090+ TRANSCODER_C,
10091+ TRANSCODER_EDP,
10092+ };
1008210093 int i;
1008310094
10095+ if (INTEL_INFO(dev)->num_pipes == 0)
10096+ return NULL;
10097+
1008410098 error = kmalloc(sizeof(*error), GFP_ATOMIC);
1008510099 if (error == NULL)
1008610100 return NULL;
@@ -10089,9 +10103,6 @@ intel_display_capture_error_state(struct drm_device *dev) · 2 unmodified lines
1008910103 error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER);
1009010104
1009110105 for_each_pipe(i) {
10092− cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
10093− error->pipe[i].cpu_transcoder = cpu_transcoder;
10094−
1009510106 if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) {
1009610107 error->cursor[i].control = I915_READ(CURCNTR(i));
1009710108 error->cursor[i].position = I915_READ(CURPOS(i));
@@ -10115,14 +10126,25 @@ intel_display_capture_error_state(struct drm_device *dev) · 17 unmodified lines
1011510126 error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i));
1011610127 }
1011710128
10118− error->pipe[i].conf = I915_READ(PIPECONF(cpu_transcoder));
1011910129 error->pipe[i].source = I915_READ(PIPESRC(i));
10120− error->pipe[i].htotal = I915_READ(HTOTAL(cpu_transcoder));
10121− error->pipe[i].hblank = I915_READ(HBLANK(cpu_transcoder));
10122− error->pipe[i].hsync = I915_READ(HSYNC(cpu_transcoder));
10123− error->pipe[i].vtotal = I915_READ(VTOTAL(cpu_transcoder));
10124− error->pipe[i].vblank = I915_READ(VBLANK(cpu_transcoder));
10125− error->pipe[i].vsync = I915_READ(VSYNC(cpu_transcoder));
10130+ }
10131+
10132+ error->num_transcoders = INTEL_INFO(dev)->num_pipes;
10133+ if (HAS_DDI(dev_priv->dev))
10134+ error->num_transcoders++; /* Account for eDP. */
10135+
10136+ for (i = 0; i < error->num_transcoders; i++) {
10137+ enum transcoder cpu_transcoder = transcoders[i];
10138+
10139+ error->transcoder[i].cpu_transcoder = cpu_transcoder;
10140+
10141+ error->transcoder[i].conf = I915_READ(PIPECONF(cpu_transcoder));
10142+ error->transcoder[i].htotal = I915_READ(HTOTAL(cpu_transcoder));
10143+ error->transcoder[i].hblank = I915_READ(HBLANK(cpu_transcoder));
10144+ error->transcoder[i].hsync = I915_READ(HSYNC(cpu_transcoder));
10145+ error->transcoder[i].vtotal = I915_READ(VTOTAL(cpu_transcoder));
10146+ error->transcoder[i].vblank = I915_READ(VBLANK(cpu_transcoder));
10147+ error->transcoder[i].vsync = I915_READ(VSYNC(cpu_transcoder));
1012610148 }
1012710149
1012810150 /* In the code above we read the registers without checking if the power
@@ -10144,22 +10166,16 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m, · 15 unmodified lines
1014410166 {
1014510167 int i;
1014610168
10169+ if (!error)
10170+ return;
10171+
1014710172 err_printf(m, "Num Pipes: %d\n", INTEL_INFO(dev)->num_pipes);
1014810173 if (HAS_POWER_WELL(dev))
1014910174 err_printf(m, "PWR_WELL_CTL2: %08x\n",
1015010175 error->power_well_driver);
1015110176 for_each_pipe(i) {
1015210177 err_printf(m, "Pipe [%d]:\n", i);
10153− err_printf(m, " CPU transcoder: %c\n",
10154− transcoder_name(error->pipe[i].cpu_transcoder));
10155− err_printf(m, " CONF: %08x\n", error->pipe[i].conf);
1015610178 err_printf(m, " SRC: %08x\n", error->pipe[i].source);
10157− err_printf(m, " HTOTAL: %08x\n", error->pipe[i].htotal);
10158− err_printf(m, " HBLANK: %08x\n", error->pipe[i].hblank);
10159− err_printf(m, " HSYNC: %08x\n", error->pipe[i].hsync);
10160− err_printf(m, " VTOTAL: %08x\n", error->pipe[i].vtotal);
10161− err_printf(m, " VBLANK: %08x\n", error->pipe[i].vblank);
10162− err_printf(m, " VSYNC: %08x\n", error->pipe[i].vsync);
1016310179
1016410180 err_printf(m, "Plane [%d]:\n", i);
1016510181 err_printf(m, " CNTR: %08x\n", error->plane[i].control);
@@ -10180,5 +10196,17 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m, · 14 unmodified lines
1018010196 err_printf(m, " POS: %08x\n", error->cursor[i].position);
1018110197 err_printf(m, " BASE: %08x\n", error->cursor[i].base);
1018210198 }
10199+
10200+ for (i = 0; i < error->num_transcoders; i++) {
10201+ err_printf(m, " CPU transcoder: %c\n",
10202+ transcoder_name(error->transcoder[i].cpu_transcoder));
10203+ err_printf(m, " CONF: %08x\n", error->transcoder[i].conf);
10204+ err_printf(m, " HTOTAL: %08x\n", error->transcoder[i].htotal);
10205+ err_printf(m, " HBLANK: %08x\n", error->transcoder[i].hblank);
10206+ err_printf(m, " HSYNC: %08x\n", error->transcoder[i].hsync);
10207+ err_printf(m, " VTOTAL: %08x\n", error->transcoder[i].vtotal);
10208+ err_printf(m, " VBLANK: %08x\n", error->transcoder[i].vblank);
10209+ err_printf(m, " VSYNC: %08x\n", error->transcoder[i].vsync);
10210+ }
1018310211 }
1018410212 #endif
drivers/gpu/drm/i915/intel_ringbuffer.c+12−0
@@ -968,6 +968,18 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring) · 967 unmodified lines
968968
969969 I915_WRITE(mmio, (u32)ring->status_page.gfx_addr);
970970 POSTING_READ(mmio);
971+
972+ /* Flush the TLB for this page */
973+ if (INTEL_INFO(dev)->gen >= 6) {
974+ u32 reg = RING_INSTPM(ring->mmio_base);
975+ I915_WRITE(reg,
976+ _MASKED_BIT_ENABLE(INSTPM_TLB_INVALIDATE |
977+ INSTPM_SYNC_FLUSH));
978+ if (wait_for((I915_READ(reg) & INSTPM_SYNC_FLUSH) == 0,
979+ 1000))
980+ DRM_ERROR("%s: wait for SyncFlush to complete for TLB invalidation timed out\n",
981+ ring->name);
982+ }
971983 }
972984
973985 static int
drivers/gpu/drm/nouveau/core/core/mm.c+4−0
@@ -98,6 +98,8 @@ nouveau_mm_head(struct nouveau_mm *mm, u8 type, u32 size_max, u32 size_min, · 97 unmodified lines
9898 u32 splitoff;
9999 u32 s, e;
100100
101+ BUG_ON(!type);
102+
101103 list_for_each_entry(this, &mm->free, fl_entry) {
102104 e = this->offset + this->length;
103105 s = this->offset;
@@ -162,6 +164,8 @@ nouveau_mm_tail(struct nouveau_mm *mm, u8 type, u32 size_max, u32 size_min, · 58 unmodified lines
162164 struct nouveau_mm_node *prev, *this, *next;
163165 u32 mask = align - 1;
164166
167+ BUG_ON(!type);
168+
165169 list_for_each_entry_reverse(this, &mm->free, fl_entry) {
166170 u32 e = this->offset + this->length;
167171 u32 s = this->offset;
drivers/gpu/drm/nouveau/core/include/subdev/mc.h+4−3
@@ -20,8 +20,8 @@ nouveau_mc(void *obj) · 19 unmodified lines
2020 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_MC];
2121 }
2222
23−#define nouveau_mc_create(p,e,o,d) \
24− nouveau_mc_create_((p), (e), (o), sizeof(**d), (void **)d)
23+#define nouveau_mc_create(p,e,o,m,d) \
24+ nouveau_mc_create_((p), (e), (o), (m), sizeof(**d), (void **)d)
2525 #define nouveau_mc_destroy(p) ({ \
2626 struct nouveau_mc *pmc = (p); _nouveau_mc_dtor(nv_object(pmc)); \
2727 })
@@ -33,7 +33,8 @@ nouveau_mc(void *obj) · 5 unmodified lines
3333 })
3434
3535 int nouveau_mc_create_(struct nouveau_object *, struct nouveau_object *,
36− struct nouveau_oclass *, int, void **);
36+ struct nouveau_oclass *, const struct nouveau_mc_intr *,
37+ int, void **);
3738 void _nouveau_mc_dtor(struct nouveau_object *);
3839 int _nouveau_mc_init(struct nouveau_object *);
3940 int _nouveau_mc_fini(struct nouveau_object *, bool);
drivers/gpu/drm/nouveau/core/subdev/fb/ramnv49.c+6−6
@@ -40,15 +40,15 @@ nv49_ram_create(struct nouveau_object *parent, struct nouveau_object *engine, · 39 unmodified lines
4040 return ret;
4141
4242 switch (pfb914 & 0x00000003) {
43− case 0x00000000: pfb->ram->type = NV_MEM_TYPE_DDR1; break;
44− case 0x00000001: pfb->ram->type = NV_MEM_TYPE_DDR2; break;
45− case 0x00000002: pfb->ram->type = NV_MEM_TYPE_GDDR3; break;
43+ case 0x00000000: ram->type = NV_MEM_TYPE_DDR1; break;
44+ case 0x00000001: ram->type = NV_MEM_TYPE_DDR2; break;
45+ case 0x00000002: ram->type = NV_MEM_TYPE_GDDR3; break;
4646 case 0x00000003: break;
4747 }
4848
49− pfb->ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
50− pfb->ram->parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
51− pfb->ram->tags = nv_rd32(pfb, 0x100320);
49+ ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
50+ ram->parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
51+ ram->tags = nv_rd32(pfb, 0x100320);
5252 return 0;
5353 }
5454
drivers/gpu/drm/nouveau/core/subdev/fb/ramnv4e.c+2−2
@@ -38,8 +38,8 @@ nv4e_ram_create(struct nouveau_object *parent, struct nouveau_object *engine, · 37 unmodified lines
3838 if (ret)
3939 return ret;
4040
41− pfb->ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
42− pfb->ram->type = NV_MEM_TYPE_STOLEN;
41+ ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
42+ ram->type = NV_MEM_TYPE_STOLEN;
4343 return 0;
4444 }
4545
drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c+24−10
@@ -30,8 +30,9 @@ struct nvc0_ltcg_priv { · 29 unmodified lines
3030 struct nouveau_ltcg base;
3131 u32 part_nr;
3232 u32 subp_nr;
33− struct nouveau_mm tags;
3433 u32 num_tags;
34+ u32 tag_base;
35+ struct nouveau_mm tags;
3536 struct nouveau_mm_node *tag_ram;
3637 };
3738
@@ -117,10 +118,6 @@ nvc0_ltcg_init_tag_ram(struct nouveau_fb *pfb, struct nvc0_ltcg_priv *priv) · 79 unmodified lines
117118 u32 tag_size, tag_margin, tag_align;
118119 int ret;
119120
120− nv_wr32(priv, 0x17e8d8, priv->part_nr);
121− if (nv_device(pfb)->card_type >= NV_E0)
122− nv_wr32(priv, 0x17e000, priv->part_nr);
123−
124121 /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */
125122 priv->num_tags = (pfb->ram->size >> 17) / 4;
126123 if (priv->num_tags > (1 << 17))
@@ -142,7 +139,7 @@ nvc0_ltcg_init_tag_ram(struct nouveau_fb *pfb, struct nvc0_ltcg_priv *priv) · 15 unmodified lines
142139 tag_size += tag_align;
143140 tag_size = (tag_size + 0xfff) >> 12; /* round up */
144141
145− ret = nouveau_mm_tail(&pfb->vram, 0, tag_size, tag_size, 1,
142+ ret = nouveau_mm_tail(&pfb->vram, 1, tag_size, tag_size, 1,
146143 &priv->tag_ram);
147144 if (ret) {
148145 priv->num_tags = 0;
@@ -152,7 +149,7 @@ nvc0_ltcg_init_tag_ram(struct nouveau_fb *pfb, struct nvc0_ltcg_priv *priv) · 3 unmodified lines
152149 tag_base += tag_align - 1;
153150 ret = do_div(tag_base, tag_align);
154151
155− nv_wr32(priv, 0x17e8d4, tag_base);
152+ priv->tag_base = tag_base;
156153 }
157154 ret = nouveau_mm_init(&priv->tags, 0, priv->num_tags, 1);
158155
@@ -182,8 +179,6 @@ nvc0_ltcg_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 23 unmodified lines
182179 }
183180 priv->subp_nr = nv_rd32(priv, 0x17e8dc) >> 28;
184181
185− nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */
186−
187182 ret = nvc0_ltcg_init_tag_ram(pfb, priv);
188183 if (ret)
189184 return ret;
@@ -209,13 +204,32 @@ nvc0_ltcg_dtor(struct nouveau_object *object) · 19 unmodified lines
209204 nouveau_ltcg_destroy(ltcg);
210205 }
211206
207+static int
208+nvc0_ltcg_init(struct nouveau_object *object)
209+{
210+ struct nouveau_ltcg *ltcg = (struct nouveau_ltcg *)object;
211+ struct nvc0_ltcg_priv *priv = (struct nvc0_ltcg_priv *)ltcg;
212+ int ret;
213+
214+ ret = nouveau_ltcg_init(ltcg);
215+ if (ret)
216+ return ret;
217+
218+ nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */
219+ nv_wr32(priv, 0x17e8d8, priv->part_nr);
220+ if (nv_device(ltcg)->card_type >= NV_E0)
221+ nv_wr32(priv, 0x17e000, priv->part_nr);
222+ nv_wr32(priv, 0x17e8d4, priv->tag_base);
223+ return 0;
224+}
225+
212226 struct nouveau_oclass
213227 nvc0_ltcg_oclass = {
214228 .handle = NV_SUBDEV(LTCG, 0xc0),
215229 .ofuncs = &(struct nouveau_ofuncs) {
216230 .ctor = nvc0_ltcg_ctor,
217231 .dtor = nvc0_ltcg_dtor,
218− .init = _nouveau_ltcg_init,
232+ .init = nvc0_ltcg_init,
219233 .fini = _nouveau_ltcg_fini,
220234 },
221235 };
drivers/gpu/drm/nouveau/core/subdev/mc/base.c+5−1
@@ -80,7 +80,9 @@ _nouveau_mc_dtor(struct nouveau_object *object) · 79 unmodified lines
8080
8181 int
8282 nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine,
83− struct nouveau_oclass *oclass, int length, void **pobject)
83+ struct nouveau_oclass *oclass,
84+ const struct nouveau_mc_intr *intr_map,
85+ int length, void **pobject)
8486 {
8587 struct nouveau_device *device = nv_device(parent);
8688 struct nouveau_mc *pmc;
@@ -92,6 +94,8 @@ nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine, · 5 unmodified lines
9294 if (ret)
9395 return ret;
9496
97+ pmc->intr_map = intr_map;
98+
9599 ret = request_irq(device->pdev->irq, nouveau_mc_intr,
96100 IRQF_SHARED, "nouveau", pmc);
97101 if (ret < 0)
drivers/gpu/drm/nouveau/core/subdev/mc/nv04.c+1−2
@@ -50,12 +50,11 @@ nv04_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 49 unmodified lines
5050 struct nv04_mc_priv *priv;
5151 int ret;
5252
53− ret = nouveau_mc_create(parent, engine, oclass, &priv);
53+ ret = nouveau_mc_create(parent, engine, oclass, nv04_mc_intr, &priv);
5454 *pobject = nv_object(priv);
5555 if (ret)
5656 return ret;
5757
58− priv->base.intr_map = nv04_mc_intr;
5958 return 0;
6059 }
6160
drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c+1−2
@@ -36,12 +36,11 @@ nv44_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 35 unmodified lines
3636 struct nv44_mc_priv *priv;
3737 int ret;
3838
39− ret = nouveau_mc_create(parent, engine, oclass, &priv);
39+ ret = nouveau_mc_create(parent, engine, oclass, nv04_mc_intr, &priv);
4040 *pobject = nv_object(priv);
4141 if (ret)
4242 return ret;
4343
44− priv->base.intr_map = nv04_mc_intr;
4544 return 0;
4645 }
4746
drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c+1−2
@@ -53,12 +53,11 @@ nv50_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 52 unmodified lines
5353 struct nv50_mc_priv *priv;
5454 int ret;
5555
56− ret = nouveau_mc_create(parent, engine, oclass, &priv);
56+ ret = nouveau_mc_create(parent, engine, oclass, nv50_mc_intr, &priv);
5757 *pobject = nv_object(priv);
5858 if (ret)
5959 return ret;
6060
61− priv->base.intr_map = nv50_mc_intr;
6261 return 0;
6362 }
6463
drivers/gpu/drm/nouveau/core/subdev/mc/nv98.c+1−2
@@ -54,12 +54,11 @@ nv98_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 53 unmodified lines
5454 struct nv98_mc_priv *priv;
5555 int ret;
5656
57− ret = nouveau_mc_create(parent, engine, oclass, &priv);
57+ ret = nouveau_mc_create(parent, engine, oclass, nv98_mc_intr, &priv);
5858 *pobject = nv_object(priv);
5959 if (ret)
6060 return ret;
6161
62− priv->base.intr_map = nv98_mc_intr;
6362 return 0;
6463 }
6564
drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c+1−2
@@ -57,12 +57,11 @@ nvc0_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 56 unmodified lines
5757 struct nvc0_mc_priv *priv;
5858 int ret;
5959
60− ret = nouveau_mc_create(parent, engine, oclass, &priv);
60+ ret = nouveau_mc_create(parent, engine, oclass, nvc0_mc_intr, &priv);
6161 *pobject = nv_object(priv);
6262 if (ret)
6363 return ret;
6464
65− priv->base.intr_map = nvc0_mc_intr;
6665 return 0;
6766 }
6867
drivers/gpu/drm/nouveau/dispnv04/crtc.c+43−15
@@ -606,6 +606,24 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode) · 605 unmodified lines
606606 regp->ramdac_a34 = 0x1;
607607 }
608608
609+static int
610+nv_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb)
611+{
612+ struct nv04_display *disp = nv04_display(crtc->dev);
613+ struct nouveau_framebuffer *nvfb = nouveau_framebuffer(crtc->fb);
614+ struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
615+ int ret;
616+
617+ ret = nouveau_bo_pin(nvfb->nvbo, TTM_PL_FLAG_VRAM);
618+ if (ret == 0) {
619+ if (disp->image[nv_crtc->index])
620+ nouveau_bo_unpin(disp->image[nv_crtc->index]);
621+ nouveau_bo_ref(nvfb->nvbo, &disp->image[nv_crtc->index]);
622+ }
623+
624+ return ret;
625+}
626+
609627 /**
610628 * Sets up registers for the given mode/adjusted_mode pair.
611629 *
@@ -622,10 +640,15 @@ nv_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, · 10 unmodified lines
622640 struct drm_device *dev = crtc->dev;
623641 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
624642 struct nouveau_drm *drm = nouveau_drm(dev);
643+ int ret;
625644
626645 NV_DEBUG(drm, "CTRC mode on CRTC %d:\n", nv_crtc->index);
627646 drm_mode_debug_printmodeline(adjusted_mode);
628647
648+ ret = nv_crtc_swap_fbs(crtc, old_fb);
649+ if (ret)
650+ return ret;
651+
629652 /* unlock must come after turning off FP_TG_CONTROL in output_prepare */
630653 nv_lock_vga_crtc_shadow(dev, nv_crtc->index, -1);
631654
@@ -722,6 +745,7 @@ static void nv_crtc_commit(struct drm_crtc *crtc) · 90 unmodified lines
722745
723746 static void nv_crtc_destroy(struct drm_crtc *crtc)
724747 {
748+ struct nv04_display *disp = nv04_display(crtc->dev);
725749 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
726750
727751 if (!nv_crtc)
@@ -729,6 +753,10 @@ static void nv_crtc_destroy(struct drm_crtc *crtc) · 1 unmodified line
729753
730754 drm_crtc_cleanup(crtc);
731755
756+ if (disp->image[nv_crtc->index])
757+ nouveau_bo_unpin(disp->image[nv_crtc->index]);
758+ nouveau_bo_ref(NULL, &disp->image[nv_crtc->index]);
759+
732760 nouveau_bo_unmap(nv_crtc->cursor.nvbo);
733761 nouveau_bo_unpin(nv_crtc->cursor.nvbo);
734762 nouveau_bo_ref(NULL, &nv_crtc->cursor.nvbo);
@@ -753,6 +781,16 @@ nv_crtc_gamma_load(struct drm_crtc *crtc) · 18 unmodified lines
753781 nouveau_hw_load_state_palette(dev, nv_crtc->index, &nv04_display(dev)->mode_reg);
754782 }
755783
784+static void
785+nv_crtc_disable(struct drm_crtc *crtc)
786+{
787+ struct nv04_display *disp = nv04_display(crtc->dev);
788+ struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
789+ if (disp->image[nv_crtc->index])
790+ nouveau_bo_unpin(disp->image[nv_crtc->index]);
791+ nouveau_bo_ref(NULL, &disp->image[nv_crtc->index]);
792+}
793+
756794 static void
757795 nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start,
758796 uint32_t size)
@@ -791,7 +829,6 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, · 32 unmodified lines
791829 struct drm_framebuffer *drm_fb;
792830 struct nouveau_framebuffer *fb;
793831 int arb_burst, arb_lwm;
794− int ret;
795832
796833 NV_DEBUG(drm, "index %d\n", nv_crtc->index);
797834
@@ -801,10 +838,8 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, · 3 unmodified lines
801838 return 0;
802839 }
803840
804−
805841 /* If atomic, we want to switch to the fb we were passed, so
806− * now we update pointers to do that. (We don't pin; just
807− * assume we're already pinned and update the base address.)
842+ * now we update pointers to do that.
808843 */
809844 if (atomic) {
810845 drm_fb = passed_fb;
@@ -812,17 +847,6 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, · 1 unmodified line
812847 } else {
813848 drm_fb = crtc->fb;
814849 fb = nouveau_framebuffer(crtc->fb);
815− /* If not atomic, we can go ahead and pin, and unpin the
816− * old fb we were passed.
817− */
818− ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM);
819− if (ret)
820− return ret;
821−
822− if (passed_fb) {
823− struct nouveau_framebuffer *ofb = nouveau_framebuffer(passed_fb);
824− nouveau_bo_unpin(ofb->nvbo);
825− }
826850 }
827851
828852 nv_crtc->fb.offset = fb->nvbo->bo.offset;
@@ -877,6 +901,9 @@ static int · 48 unmodified lines
877901 nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
878902 struct drm_framebuffer *old_fb)
879903 {
904+ int ret = nv_crtc_swap_fbs(crtc, old_fb);
905+ if (ret)
906+ return ret;
880907 return nv04_crtc_do_mode_set_base(crtc, old_fb, x, y, false);
881908 }
882909
@@ -1027,6 +1054,7 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = { · 144 unmodified lines
10271054 .mode_set_base = nv04_crtc_mode_set_base,
10281055 .mode_set_base_atomic = nv04_crtc_mode_set_base_atomic,
10291056 .load_lut = nv_crtc_gamma_load,
1057+ .disable = nv_crtc_disable,
10301058 };
10311059
10321060 int
drivers/gpu/drm/nouveau/dispnv04/disp.h+1−0
@@ -81,6 +81,7 @@ struct nv04_display { · 80 unmodified lines
8181 uint32_t saved_vga_font[4][16384];
8282 uint32_t dac_users[4];
8383 struct nouveau_object *core;
84+ struct nouveau_bo *image[2];
8485 };
8586
8687 static inline struct nv04_display *
drivers/gpu/drm/nouveau/nouveau_display.c+3−0
@@ -577,6 +577,9 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, · 576 unmodified lines
577577 ret = nv50_display_flip_next(crtc, fb, chan, 0);
578578 if (ret)
579579 goto fail_unreserve;
580+ } else {
581+ struct nv04_display *dispnv04 = nv04_display(dev);
582+ nouveau_bo_ref(new_bo, &dispnv04->image[nouveau_crtc(crtc)->index]);
580583 }
581584
582585 ret = nouveau_page_flip_emit(chan, old_bo, new_bo, s, &fence);
drivers/gpu/drm/nouveau/nv40_pm.c+1−1
@@ -131,7 +131,7 @@ nv40_calc_pll(struct drm_device *dev, u32 reg, struct nvbios_pll *pll, · 130 unmodified lines
131131 if (clk < pll->vco1.max_freq)
132132 pll->vco2.max_freq = 0;
133133
134− pclk->pll_calc(pclk, pll, clk, &coef);
134+ ret = pclk->pll_calc(pclk, pll, clk, &coef);
135135 if (ret == 0)
136136 return -ERANGE;
137137
drivers/gpu/drm/radeon/radeon.h+1−1
@@ -2163,7 +2163,7 @@ void cik_mm_wdoorbell(struct radeon_device *rdev, u32 offset, u32 v); · 2162 unmodified lines
21632163 WREG32(reg, tmp_); \
21642164 } while (0)
21652165 #define WREG32_AND(reg, and) WREG32_P(reg, 0, and)
2166−#define WREG32_OR(reg, or) WREG32_P(reg, or, ~or)
2166+#define WREG32_OR(reg, or) WREG32_P(reg, or, ~(or))
21672167 #define WREG32_PLL_P(reg, val, mask) \
21682168 do { \
21692169 uint32_t tmp_ = RREG32_PLL(reg); \
drivers/gpu/drm/radeon/radeon_uvd.c+8−0
@@ -356,6 +356,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, · 355 unmodified lines
356356 return -EINVAL;
357357 }
358358
359+ if (bo->tbo.sync_obj) {
360+ r = radeon_fence_wait(bo->tbo.sync_obj, false);
361+ if (r) {
362+ DRM_ERROR("Failed waiting for UVD message (%d)!\n", r);
363+ return r;
364+ }
365+ }
366+
359367 r = radeon_bo_kmap(bo, &ptr);
360368 if (r) {
361369 DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);
drivers/gpu/drm/radeon/rv770.c+6−6
@@ -744,10 +744,10 @@ static void rv770_init_golden_registers(struct radeon_device *rdev) · 743 unmodified lines
744744 (const u32)ARRAY_SIZE(r7xx_golden_dyn_gpr_registers));
745745 radeon_program_register_sequence(rdev,
746746 rv730_golden_registers,
747− (const u32)ARRAY_SIZE(rv770_golden_registers));
747+ (const u32)ARRAY_SIZE(rv730_golden_registers));
748748 radeon_program_register_sequence(rdev,
749749 rv730_mgcg_init,
750− (const u32)ARRAY_SIZE(rv770_mgcg_init));
750+ (const u32)ARRAY_SIZE(rv730_mgcg_init));
751751 break;
752752 case CHIP_RV710:
753753 radeon_program_register_sequence(rdev,
@@ -758,18 +758,18 @@ static void rv770_init_golden_registers(struct radeon_device *rdev) · 4 unmodified lines
758758 (const u32)ARRAY_SIZE(r7xx_golden_dyn_gpr_registers));
759759 radeon_program_register_sequence(rdev,
760760 rv710_golden_registers,
761− (const u32)ARRAY_SIZE(rv770_golden_registers));
761+ (const u32)ARRAY_SIZE(rv710_golden_registers));
762762 radeon_program_register_sequence(rdev,
763763 rv710_mgcg_init,
764− (const u32)ARRAY_SIZE(rv770_mgcg_init));
764+ (const u32)ARRAY_SIZE(rv710_mgcg_init));
765765 break;
766766 case CHIP_RV740:
767767 radeon_program_register_sequence(rdev,
768768 rv740_golden_registers,
769− (const u32)ARRAY_SIZE(rv770_golden_registers));
769+ (const u32)ARRAY_SIZE(rv740_golden_registers));
770770 radeon_program_register_sequence(rdev,
771771 rv740_mgcg_init,
772− (const u32)ARRAY_SIZE(rv770_mgcg_init));
772+ (const u32)ARRAY_SIZE(rv740_mgcg_init));
773773 break;
774774 default:
775775 break;
drivers/iio/light/adjd_s311.c+2−1
@@ -232,7 +232,8 @@ static int adjd_s311_read_raw(struct iio_dev *indio_dev, · 231 unmodified lines
232232
233233 switch (mask) {
234234 case IIO_CHAN_INFO_RAW:
235− ret = adjd_s311_read_data(indio_dev, chan->address, val);
235+ ret = adjd_s311_read_data(indio_dev,
236+ ADJD_S311_DATA_REG(chan->address), val);
236237 if (ret < 0)
237238 return ret;
238239 return IIO_VAL_INT;
drivers/md/dm-cache-policy-mq.c+7−9
@@ -959,23 +959,21 @@ out: · 958 unmodified lines
959959 return r;
960960 }
961961
962−static void remove_mapping(struct mq_policy *mq, dm_oblock_t oblock)
962+static void mq_remove_mapping(struct dm_cache_policy *p, dm_oblock_t oblock)
963963 {
964− struct entry *e = hash_lookup(mq, oblock);
964+ struct mq_policy *mq = to_mq_policy(p);
965+ struct entry *e;
966+
967+ mutex_lock(&mq->lock);
968+
969+ e = hash_lookup(mq, oblock);
965970
966971 BUG_ON(!e || !e->in_cache);
967972
968973 del(mq, e);
969974 e->in_cache = false;
970975 push(mq, e);
971−}
972976
973−static void mq_remove_mapping(struct dm_cache_policy *p, dm_oblock_t oblock)
974−{
975− struct mq_policy *mq = to_mq_policy(p);
976−
977− mutex_lock(&mq->lock);
978− remove_mapping(mq, oblock);
979977 mutex_unlock(&mq->lock);
980978 }
981979
drivers/net/bonding/bond_main.c+7−1
@@ -3714,11 +3714,17 @@ static int bond_neigh_init(struct neighbour *n) · 3713 unmodified lines
37143714 * The bonding ndo_neigh_setup is called at init time beofre any
37153715 * slave exists. So we must declare proxy setup function which will
37163716 * be used at run time to resolve the actual slave neigh param setup.
3717+ *
3718+ * It's also called by master devices (such as vlans) to setup their
3719+ * underlying devices. In that case - do nothing, we're already set up from
3720+ * our init.
37173721 */
37183722 static int bond_neigh_setup(struct net_device *dev,
37193723 struct neigh_parms *parms)
37203724 {
3721− parms->neigh_setup = bond_neigh_init;
3725+ /* modify only our neigh_parms */
3726+ if (parms->dev == dev)
3727+ parms->neigh_setup = bond_neigh_init;
37223728
37233729 return 0;
37243730 }
drivers/net/can/usb/peak_usb/pcan_usb.c+1−1
@@ -649,7 +649,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) · 648 unmodified lines
649649 if ((mc->ptr + rec_len) > mc->end)
650650 goto decode_failed;
651651
652− memcpy(cf->data, mc->ptr, rec_len);
652+ memcpy(cf->data, mc->ptr, cf->can_dlc);
653653 mc->ptr += rec_len;
654654 }
655655
drivers/net/ethernet/arc/emac_main.c+1−1
@@ -199,7 +199,7 @@ static int arc_emac_rx(struct net_device *ndev, int budget) · 198 unmodified lines
199199 struct arc_emac_priv *priv = netdev_priv(ndev);
200200 unsigned int work_done;
201201
202− for (work_done = 0; work_done <= budget; work_done++) {
202+ for (work_done = 0; work_done < budget; work_done++) {
203203 unsigned int *last_rx_bd = &priv->last_rx_bd;
204204 struct net_device_stats *stats = &priv->stats;
205205 struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+7−0
@@ -1333,6 +1333,8 @@ enum { · 1332 unmodified lines
13331333 BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
13341334 BNX2X_SP_RTNL_VFPF_STORM_RX_MODE,
13351335 BNX2X_SP_RTNL_HYPERVISOR_VLAN,
1336+ BNX2X_SP_RTNL_TX_STOP,
1337+ BNX2X_SP_RTNL_TX_RESUME,
13361338 };
13371339
13381340 struct bnx2x_prev_path_list {
@@ -1502,6 +1504,7 @@ struct bnx2x { · 163 unmodified lines
15021504 #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21)
15031505 #define IS_VF_FLAG (1 << 22)
15041506 #define INTERRUPTS_ENABLED_FLAG (1 << 23)
1507+#define BC_SUPPORTS_RMMOD_CMD (1 << 24)
15051508
15061509 #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG)
15071510
@@ -1830,6 +1833,8 @@ struct bnx2x { · 322 unmodified lines
18301833
18311834 int fp_array_size;
18321835 u32 dump_preset_idx;
1836+ bool stats_started;
1837+ struct semaphore stats_sema;
18331838 };
18341839
18351840 /* Tx queues may be less or equal to Rx queues */
@@ -2451,4 +2456,6 @@ enum bnx2x_pci_bus_speed { · 615 unmodified lines
24512456 BNX2X_PCI_LINK_SPEED_5000 = 5000,
24522457 BNX2X_PCI_LINK_SPEED_8000 = 8000
24532458 };
2459+
2460+void bnx2x_set_local_cmng(struct bnx2x *bp);
24542461 #endif /* bnx2x.h */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c+42−11
@@ -30,10 +30,8 @@ · 29 unmodified lines
3030 #include "bnx2x_dcb.h"
3131
3232 /* forward declarations of dcbx related functions */
33−static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp);
3433 static void bnx2x_pfc_set_pfc(struct bnx2x *bp);
3534 static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp);
36−static int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp);
3735 static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp,
3836 u32 *set_configuration_ets_pg,
3937 u32 *pri_pg_tbl);
@@ -425,30 +423,52 @@ static void bnx2x_pfc_set_pfc(struct bnx2x *bp) · 385 unmodified lines
425423 bnx2x_pfc_clear(bp);
426424 }
427425
428−static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp)
426+int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp)
429427 {
430428 struct bnx2x_func_state_params func_params = {NULL};
429+ int rc;
431430
432431 func_params.f_obj = &bp->func_obj;
433432 func_params.cmd = BNX2X_F_CMD_TX_STOP;
434433
434+ __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags);
435+ __set_bit(RAMROD_RETRY, &func_params.ramrod_flags);
436+
435437 DP(BNX2X_MSG_DCB, "STOP TRAFFIC\n");
436− return bnx2x_func_state_change(bp, &func_params);
438+
439+ rc = bnx2x_func_state_change(bp, &func_params);
440+ if (rc) {
441+ BNX2X_ERR("Unable to hold traffic for HW configuration\n");
442+ bnx2x_panic();
443+ }
444+
445+ return rc;
437446 }
438447
439−static int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp)
448+int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp)
440449 {
441450 struct bnx2x_func_state_params func_params = {NULL};
442451 struct bnx2x_func_tx_start_params *tx_params =
443452 &func_params.params.tx_start;
453+ int rc;
444454
445455 func_params.f_obj = &bp->func_obj;
446456 func_params.cmd = BNX2X_F_CMD_TX_START;
447457
458+ __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags);
459+ __set_bit(RAMROD_RETRY, &func_params.ramrod_flags);
460+
448461 bnx2x_dcbx_fw_struct(bp, tx_params);
449462
450463 DP(BNX2X_MSG_DCB, "START TRAFFIC\n");
451− return bnx2x_func_state_change(bp, &func_params);
464+
465+ rc = bnx2x_func_state_change(bp, &func_params);
466+ if (rc) {
467+ BNX2X_ERR("Unable to resume traffic after HW configuration\n");
468+ bnx2x_panic();
469+ }
470+
471+ return rc;
452472 }
453473
454474 static void bnx2x_dcbx_2cos_limit_update_ets_config(struct bnx2x *bp)
@@ -744,7 +764,9 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) · 289 unmodified lines
744764 if (IS_MF(bp))
745765 bnx2x_link_sync_notify(bp);
746766
747− bnx2x_dcbx_stop_hw_tx(bp);
767+ set_bit(BNX2X_SP_RTNL_TX_STOP, &bp->sp_rtnl_state);
768+
769+ schedule_delayed_work(&bp->sp_rtnl_task, 0);
748770
749771 return;
750772 }
@@ -753,7 +775,13 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) · 2 unmodified lines
753775 bnx2x_pfc_set_pfc(bp);
754776
755777 bnx2x_dcbx_update_ets_params(bp);
756− bnx2x_dcbx_resume_hw_tx(bp);
778+
779+ /* ets may affect cmng configuration: reinit it in hw */
780+ bnx2x_set_local_cmng(bp);
781+
782+ set_bit(BNX2X_SP_RTNL_TX_RESUME, &bp->sp_rtnl_state);
783+
784+ schedule_delayed_work(&bp->sp_rtnl_task, 0);
757785
758786 return;
759787 case BNX2X_DCBX_STATE_TX_RELEASED:
@@ -2363,21 +2391,24 @@ static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid, · 1603 unmodified lines
23632391 case DCB_FEATCFG_ATTR_PG:
23642392 if (bp->dcbx_local_feat.ets.enabled)
23652393 *flags |= DCB_FEATCFG_ENABLE;
2366− if (bp->dcbx_error & DCBX_LOCAL_ETS_ERROR)
2394+ if (bp->dcbx_error & (DCBX_LOCAL_ETS_ERROR |
2395+ DCBX_REMOTE_MIB_ERROR))
23672396 *flags |= DCB_FEATCFG_ERROR;
23682397 break;
23692398 case DCB_FEATCFG_ATTR_PFC:
23702399 if (bp->dcbx_local_feat.pfc.enabled)
23712400 *flags |= DCB_FEATCFG_ENABLE;
23722401 if (bp->dcbx_error & (DCBX_LOCAL_PFC_ERROR |
2373− DCBX_LOCAL_PFC_MISMATCH))
2402+ DCBX_LOCAL_PFC_MISMATCH |
2403+ DCBX_REMOTE_MIB_ERROR))
23742404 *flags |= DCB_FEATCFG_ERROR;
23752405 break;
23762406 case DCB_FEATCFG_ATTR_APP:
23772407 if (bp->dcbx_local_feat.app.enabled)
23782408 *flags |= DCB_FEATCFG_ENABLE;
23792409 if (bp->dcbx_error & (DCBX_LOCAL_APP_ERROR |
2380− DCBX_LOCAL_APP_MISMATCH))
2410+ DCBX_LOCAL_APP_MISMATCH |
2411+ DCBX_REMOTE_MIB_ERROR))
23812412 *flags |= DCB_FEATCFG_ERROR;
23822413 break;
23832414 default:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h+3−0
@@ -199,4 +199,7 @@ extern const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops; · 198 unmodified lines
199199 int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall);
200200 #endif /* BCM_DCBNL */
201201
202+int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp);
203+int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp);
204+
202205 #endif /* BNX2X_DCB_H */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h+5−0
@@ -1300,6 +1300,9 @@ struct drv_func_mb { · 1299 unmodified lines
13001300
13011301 #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000
13021302
1303+ #define DRV_MSG_CODE_RMMOD 0xdb000000
1304+ #define REQ_BC_VER_4_RMMOD_CMD 0x0007080f
1305+
13031306 #define DRV_MSG_CODE_SET_MF_BW 0xe0000000
13041307 #define REQ_BC_VER_4_SET_MF_BW 0x00060202
13051308 #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000
@@ -1372,6 +1375,8 @@ struct drv_func_mb { · 66 unmodified lines
13721375
13731376 #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000
13741377
1378+ #define FW_MSG_CODE_RMMOD_ACK 0xdb100000
1379+
13751380 #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000
13761381 #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000
13771382
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+61−27
@@ -2261,6 +2261,23 @@ static void bnx2x_set_requested_fc(struct bnx2x *bp) · 2260 unmodified lines
22612261 bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH;
22622262 }
22632263
2264+static void bnx2x_init_dropless_fc(struct bnx2x *bp)
2265+{
2266+ u32 pause_enabled = 0;
2267+
2268+ if (!CHIP_IS_E1(bp) && bp->dropless_fc && bp->link_vars.link_up) {
2269+ if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_TX)
2270+ pause_enabled = 1;
2271+
2272+ REG_WR(bp, BAR_USTRORM_INTMEM +
2273+ USTORM_ETH_PAUSE_ENABLED_OFFSET(BP_PORT(bp)),
2274+ pause_enabled);
2275+ }
2276+
2277+ DP(NETIF_MSG_IFUP | NETIF_MSG_LINK, "dropless_fc is %s\n",
2278+ pause_enabled ? "enabled" : "disabled");
2279+}
2280+
22642281 int bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode)
22652282 {
22662283 int rc, cfx_idx = bnx2x_get_link_cfg_idx(bp);
@@ -2294,6 +2311,8 @@ int bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode) · 27 unmodified lines
22942311
22952312 bnx2x_release_phy_lock(bp);
22962313
2314+ bnx2x_init_dropless_fc(bp);
2315+
22972316 bnx2x_calc_fc_adv(bp);
22982317
22992318 if (bp->link_vars.link_up) {
@@ -2315,6 +2334,8 @@ void bnx2x_link_set(struct bnx2x *bp) · 15 unmodified lines
23152334 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
23162335 bnx2x_release_phy_lock(bp);
23172336
2337+ bnx2x_init_dropless_fc(bp);
2338+
23182339 bnx2x_calc_fc_adv(bp);
23192340 } else
23202341 BNX2X_ERR("Bootcode is missing - can not set link\n");
@@ -2476,7 +2497,7 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type) · 155 unmodified lines
24762497
24772498 input.port_rate = bp->link_vars.line_speed;
24782499
2479− if (cmng_type == CMNG_FNS_MINMAX) {
2500+ if (cmng_type == CMNG_FNS_MINMAX && input.port_rate) {
24802501 int vn;
24812502
24822503 /* read mf conf from shmem */
@@ -2533,6 +2554,21 @@ static void storm_memset_cmng(struct bnx2x *bp, · 50 unmodified lines
25332554 }
25342555 }
25352556
2557+/* init cmng mode in HW according to local configuration */
2558+void bnx2x_set_local_cmng(struct bnx2x *bp)
2559+{
2560+ int cmng_fns = bnx2x_get_cmng_fns_mode(bp);
2561+
2562+ if (cmng_fns != CMNG_FNS_NONE) {
2563+ bnx2x_cmng_fns_init(bp, false, cmng_fns);
2564+ storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp));
2565+ } else {
2566+ /* rate shaping and fairness are disabled */
2567+ DP(NETIF_MSG_IFUP,
2568+ "single function mode without fairness\n");
2569+ }
2570+}
2571+
25362572 /* This function is called upon link interrupt */
25372573 static void bnx2x_link_attn(struct bnx2x *bp)
25382574 {
@@ -2541,20 +2577,9 @@ static void bnx2x_link_attn(struct bnx2x *bp) · 2 unmodified lines
25412577
25422578 bnx2x_link_update(&bp->link_params, &bp->link_vars);
25432579
2544− if (bp->link_vars.link_up) {
2580+ bnx2x_init_dropless_fc(bp);
25452581
2546− /* dropless flow control */
2547− if (!CHIP_IS_E1(bp) && bp->dropless_fc) {
2548− int port = BP_PORT(bp);
2549− u32 pause_enabled = 0;
2550−
2551− if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_TX)
2552− pause_enabled = 1;
2553−
2554− REG_WR(bp, BAR_USTRORM_INTMEM +
2555− USTORM_ETH_PAUSE_ENABLED_OFFSET(port),
2556− pause_enabled);
2557− }
2582+ if (bp->link_vars.link_up) {
25582583
25592584 if (bp->link_vars.mac_type != MAC_TYPE_EMAC) {
25602585 struct host_port_stats *pstats;
@@ -2568,17 +2593,8 @@ static void bnx2x_link_attn(struct bnx2x *bp) · 7 unmodified lines
25682593 bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);
25692594 }
25702595
2571− if (bp->link_vars.link_up && bp->link_vars.line_speed) {
2572− int cmng_fns = bnx2x_get_cmng_fns_mode(bp);
2573−
2574− if (cmng_fns != CMNG_FNS_NONE) {
2575− bnx2x_cmng_fns_init(bp, false, cmng_fns);
2576− storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp));
2577− } else
2578− /* rate shaping and fairness are disabled */
2579− DP(NETIF_MSG_IFUP,
2580− "single function mode without fairness\n");
2581− }
2596+ if (bp->link_vars.link_up && bp->link_vars.line_speed)
2597+ bnx2x_set_local_cmng(bp);
25822598
25832599 __bnx2x_link_report(bp);
25842600
@@ -9639,6 +9655,12 @@ sp_rtnl_not_reset: · 7054 unmodified lines
96399655 &bp->sp_rtnl_state))
96409656 bnx2x_pf_set_vfs_vlan(bp);
96419657
9658+ if (test_and_clear_bit(BNX2X_SP_RTNL_TX_STOP, &bp->sp_rtnl_state))
9659+ bnx2x_dcbx_stop_hw_tx(bp);
9660+
9661+ if (test_and_clear_bit(BNX2X_SP_RTNL_TX_RESUME, &bp->sp_rtnl_state))
9662+ bnx2x_dcbx_resume_hw_tx(bp);
9663+
96429664 /* work which needs rtnl lock not-taken (as it takes the lock itself and
96439665 * can be called from other contexts as well)
96449666 */
@@ -10362,6 +10384,10 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp) · 717 unmodified lines
1036210384
1036310385 bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ?
1036410386 BC_SUPPORTS_DCBX_MSG_NON_PMF : 0;
10387+
10388+ bp->flags |= (val >= REQ_BC_VER_4_RMMOD_CMD) ?
10389+ BC_SUPPORTS_RMMOD_CMD : 0;
10390+
1036510391 boot_mode = SHMEM_RD(bp,
1036610392 dev_info.port_feature_config[BP_PORT(bp)].mba_config) &
1036710393 PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK;
@@ -11137,6 +11163,9 @@ static bool bnx2x_get_dropless_info(struct bnx2x *bp) · 769 unmodified lines
1113711163 int tmp;
1113811164 u32 cfg;
1113911165
11166+ if (IS_VF(bp))
11167+ return 0;
11168+
1114011169 if (IS_MF(bp) && !CHIP_IS_E1x(bp)) {
1114111170 /* Take function: tmp = func */
1114211171 tmp = BP_ABS_FUNC(bp);
@@ -11524,6 +11553,7 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 381 unmodified lines
1152411553 mutex_init(&bp->port.phy_mutex);
1152511554 mutex_init(&bp->fw_mb_mutex);
1152611555 spin_lock_init(&bp->stats_lock);
11556+ sema_init(&bp->stats_sema, 1);
1152711557
1152811558 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
1152911559 INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task);
@@ -12817,13 +12847,17 @@ static void __bnx2x_remove(struct pci_dev *pdev, · 1287 unmodified lines
1281712847 bnx2x_dcbnl_update_applist(bp, true);
1281812848 #endif
1281912849
12850+ if (IS_PF(bp) &&
12851+ !BP_NOMCP(bp) &&
12852+ (bp->flags & BC_SUPPORTS_RMMOD_CMD))
12853+ bnx2x_fw_command(bp, DRV_MSG_CODE_RMMOD, 0);
12854+
1282012855 /* Close the interface - either directly or implicitly */
1282112856 if (remove_netdev) {
1282212857 unregister_netdev(dev);
1282312858 } else {
1282412859 rtnl_lock();
12825− if (netif_running(dev))
12826− bnx2x_close(dev);
12860+ dev_close(dev);
1282712861 rtnl_unlock();
1282812862 }
1282912863
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+34−24
@@ -1747,11 +1747,8 @@ void bnx2x_iov_init_dq(struct bnx2x *bp) · 1746 unmodified lines
17471747
17481748 void bnx2x_iov_init_dmae(struct bnx2x *bp)
17491749 {
1750− DP(BNX2X_MSG_IOV, "SRIOV is %s\n", IS_SRIOV(bp) ? "ON" : "OFF");
1751− if (!IS_SRIOV(bp))
1752− return;
1753−
1754− REG_WR(bp, DMAE_REG_BACKWARD_COMP_EN, 0);
1750+ if (pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV))
1751+ REG_WR(bp, DMAE_REG_BACKWARD_COMP_EN, 0);
17551752 }
17561753
17571754 static int bnx2x_vf_bus(struct bnx2x *bp, int vfid)
@@ -3084,8 +3081,9 @@ void bnx2x_disable_sriov(struct bnx2x *bp) · 1326 unmodified lines
30843081 pci_disable_sriov(bp->pdev);
30853082 }
30863083
3087−static int bnx2x_vf_ndo_sanity(struct bnx2x *bp, int vfidx,
3088− struct bnx2x_virtf *vf)
3084+static int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx,
3085+ struct bnx2x_virtf **vf,
3086+ struct pf_vf_bulletin_content **bulletin)
30893087 {
30903088 if (bp->state != BNX2X_STATE_OPEN) {
30913089 BNX2X_ERR("vf ndo called though PF is down\n");
@@ -3103,12 +3101,22 @@ static int bnx2x_vf_ndo_sanity(struct bnx2x *bp, int vfidx, · 11 unmodified lines
31033101 return -EINVAL;
31043102 }
31053103
3106− if (!vf) {
3104+ /* init members */
3105+ *vf = BP_VF(bp, vfidx);
3106+ *bulletin = BP_VF_BULLETIN(bp, vfidx);
3107+
3108+ if (!*vf) {
31073109 BNX2X_ERR("vf ndo called but vf was null. vfidx was %d\n",
31083110 vfidx);
31093111 return -EINVAL;
31103112 }
31113113
3114+ if (!*bulletin) {
3115+ BNX2X_ERR("vf ndo called but Bulletin Board struct is null. vfidx was %d\n",
3116+ vfidx);
3117+ return -EINVAL;
3118+ }
3119+
31123120 return 0;
31133121 }
31143122
@@ -3116,17 +3124,19 @@ int bnx2x_get_vf_config(struct net_device *dev, int vfidx, · 1 unmodified line
31163124 struct ifla_vf_info *ivi)
31173125 {
31183126 struct bnx2x *bp = netdev_priv(dev);
3119− struct bnx2x_virtf *vf = BP_VF(bp, vfidx);
3120− struct bnx2x_vlan_mac_obj *mac_obj = &bnx2x_vfq(vf, 0, mac_obj);
3121− struct bnx2x_vlan_mac_obj *vlan_obj = &bnx2x_vfq(vf, 0, vlan_obj);
3122− struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vfidx);
3127+ struct bnx2x_virtf *vf = NULL;
3128+ struct pf_vf_bulletin_content *bulletin = NULL;
3129+ struct bnx2x_vlan_mac_obj *mac_obj;
3130+ struct bnx2x_vlan_mac_obj *vlan_obj;
31233131 int rc;
31243132
3125− /* sanity */
3126− rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf);
3133+ /* sanity and init */
3134+ rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin);
31273135 if (rc)
31283136 return rc;
3129− if (!mac_obj || !vlan_obj || !bulletin) {
3137+ mac_obj = &bnx2x_vfq(vf, 0, mac_obj);
3138+ vlan_obj = &bnx2x_vfq(vf, 0, vlan_obj);
3139+ if (!mac_obj || !vlan_obj) {
31303140 BNX2X_ERR("VF partially initialized\n");
31313141 return -EINVAL;
31323142 }
@@ -3183,11 +3193,11 @@ int bnx2x_set_vf_mac(struct net_device *dev, int vfidx, u8 *mac) · 50 unmodified lines
31833193 {
31843194 struct bnx2x *bp = netdev_priv(dev);
31853195 int rc, q_logical_state;
3186− struct bnx2x_virtf *vf = BP_VF(bp, vfidx);
3187− struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vfidx);
3196+ struct bnx2x_virtf *vf = NULL;
3197+ struct pf_vf_bulletin_content *bulletin = NULL;
31883198
3189− /* sanity */
3190− rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf);
3199+ /* sanity and init */
3200+ rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin);
31913201 if (rc)
31923202 return rc;
31933203 if (!is_valid_ether_addr(mac)) {
@@ -3249,11 +3259,11 @@ int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos) · 55 unmodified lines
32493259 {
32503260 struct bnx2x *bp = netdev_priv(dev);
32513261 int rc, q_logical_state;
3252− struct bnx2x_virtf *vf = BP_VF(bp, vfidx);
3253− struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vfidx);
3262+ struct bnx2x_virtf *vf = NULL;
3263+ struct pf_vf_bulletin_content *bulletin = NULL;
32543264
3255− /* sanity */
3256− rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf);
3265+ /* sanity and init */
3266+ rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin);
32573267 if (rc)
32583268 return rc;
32593269
@@ -3463,7 +3473,7 @@ int bnx2x_vf_pci_alloc(struct bnx2x *bp) · 203 unmodified lines
34633473 alloc_mem_err:
34643474 BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,
34653475 sizeof(struct bnx2x_vf_mbx_msg));
3466− BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,
3476+ BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping,
34673477 sizeof(union pf_vf_bulletin));
34683478 return -ENOMEM;
34693479 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c+54−12
@@ -221,7 +221,8 @@ static int bnx2x_stats_comp(struct bnx2x *bp) · 220 unmodified lines
221221 * Statistics service functions
222222 */
223223
224−static void bnx2x_stats_pmf_update(struct bnx2x *bp)
224+/* should be called under stats_sema */
225+static void __bnx2x_stats_pmf_update(struct bnx2x *bp)
225226 {
226227 struct dmae_command *dmae;
227228 u32 opcode;
@@ -518,7 +519,8 @@ static void bnx2x_func_stats_init(struct bnx2x *bp) · 290 unmodified lines
518519 *stats_comp = 0;
519520 }
520521
521−static void bnx2x_stats_start(struct bnx2x *bp)
522+/* should be called under stats_sema */
523+static void __bnx2x_stats_start(struct bnx2x *bp)
522524 {
523525 /* vfs travel through here as part of the statistics FSM, but no action
524526 * is required
@@ -534,13 +536,34 @@ static void bnx2x_stats_start(struct bnx2x *bp) · 9 unmodified lines
534536
535537 bnx2x_hw_stats_post(bp);
536538 bnx2x_storm_stats_post(bp);
539+
540+ bp->stats_started = true;
541+}
542+
543+static void bnx2x_stats_start(struct bnx2x *bp)
544+{
545+ if (down_timeout(&bp->stats_sema, HZ/10))
546+ BNX2X_ERR("Unable to acquire stats lock\n");
547+ __bnx2x_stats_start(bp);
548+ up(&bp->stats_sema);
537549 }
538550
539551 static void bnx2x_stats_pmf_start(struct bnx2x *bp)
540552 {
553+ if (down_timeout(&bp->stats_sema, HZ/10))
554+ BNX2X_ERR("Unable to acquire stats lock\n");
541555 bnx2x_stats_comp(bp);
542− bnx2x_stats_pmf_update(bp);
543− bnx2x_stats_start(bp);
556+ __bnx2x_stats_pmf_update(bp);
557+ __bnx2x_stats_start(bp);
558+ up(&bp->stats_sema);
559+}
560+
561+static void bnx2x_stats_pmf_update(struct bnx2x *bp)
562+{
563+ if (down_timeout(&bp->stats_sema, HZ/10))
564+ BNX2X_ERR("Unable to acquire stats lock\n");
565+ __bnx2x_stats_pmf_update(bp);
566+ up(&bp->stats_sema);
544567 }
545568
546569 static void bnx2x_stats_restart(struct bnx2x *bp)
@@ -550,8 +573,11 @@ static void bnx2x_stats_restart(struct bnx2x *bp) · 3 unmodified lines
550573 */
551574 if (IS_VF(bp))
552575 return;
576+ if (down_timeout(&bp->stats_sema, HZ/10))
577+ BNX2X_ERR("Unable to acquire stats lock\n");
553578 bnx2x_stats_comp(bp);
554− bnx2x_stats_start(bp);
579+ __bnx2x_stats_start(bp);
580+ up(&bp->stats_sema);
555581 }
556582
557583 static void bnx2x_bmac_stats_update(struct bnx2x *bp)
@@ -888,9 +914,7 @@ static int bnx2x_storm_stats_validate_counters(struct bnx2x *bp) · 330 unmodified lines
888914 /* Make sure we use the value of the counter
889915 * used for sending the last stats ramrod.
890916 */
891− spin_lock_bh(&bp->stats_lock);
892917 cur_stats_counter = bp->stats_counter - 1;
893− spin_unlock_bh(&bp->stats_lock);
894918
895919 /* are storm stats valid? */
896920 if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) {
@@ -1227,12 +1251,18 @@ static void bnx2x_stats_update(struct bnx2x *bp) · 330 unmodified lines
12271251 {
12281252 u32 *stats_comp = bnx2x_sp(bp, stats_comp);
12291253
1230− if (bnx2x_edebug_stats_stopped(bp))
1254+ /* we run update from timer context, so give up
1255+ * if somebody is in the middle of transition
1256+ */
1257+ if (down_trylock(&bp->stats_sema))
12311258 return;
12321259
1260+ if (bnx2x_edebug_stats_stopped(bp) || !bp->stats_started)
1261+ goto out;
1262+
12331263 if (IS_PF(bp)) {
12341264 if (*stats_comp != DMAE_COMP_VAL)
1235− return;
1265+ goto out;
12361266
12371267 if (bp->port.pmf)
12381268 bnx2x_hw_stats_update(bp);
@@ -1242,7 +1272,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) · 3 unmodified lines
12421272 BNX2X_ERR("storm stats were not updated for 3 times\n");
12431273 bnx2x_panic();
12441274 }
1245− return;
1275+ goto out;
12461276 }
12471277 } else {
12481278 /* vf doesn't collect HW statistics, and doesn't get completions
@@ -1256,7 +1286,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) · 7 unmodified lines
12561286
12571287 /* vf is done */
12581288 if (IS_VF(bp))
1259− return;
1289+ goto out;
12601290
12611291 if (netif_msg_timer(bp)) {
12621292 struct bnx2x_eth_stats *estats = &bp->eth_stats;
@@ -1267,6 +1297,9 @@ static void bnx2x_stats_update(struct bnx2x *bp) · 4 unmodified lines
12671297
12681298 bnx2x_hw_stats_post(bp);
12691299 bnx2x_storm_stats_post(bp);
1300+
1301+out:
1302+ up(&bp->stats_sema);
12701303 }
12711304
12721305 static void bnx2x_port_stats_stop(struct bnx2x *bp)
@@ -1332,6 +1365,11 @@ static void bnx2x_stats_stop(struct bnx2x *bp) · 59 unmodified lines
13321365 {
13331366 int update = 0;
13341367
1368+ if (down_timeout(&bp->stats_sema, HZ/10))
1369+ BNX2X_ERR("Unable to acquire stats lock\n");
1370+
1371+ bp->stats_started = false;
1372+
13351373 bnx2x_stats_comp(bp);
13361374
13371375 if (bp->port.pmf)
@@ -1348,6 +1386,8 @@ static void bnx2x_stats_stop(struct bnx2x *bp) · 10 unmodified lines
13481386 bnx2x_hw_stats_post(bp);
13491387 bnx2x_stats_comp(bp);
13501388 }
1389+
1390+ up(&bp->stats_sema);
13511391 }
13521392
13531393 static void bnx2x_stats_do_nothing(struct bnx2x *bp)
@@ -1376,15 +1416,17 @@ static const struct { · 22 unmodified lines
13761416 void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
13771417 {
13781418 enum bnx2x_stats_state state;
1419+ void (*action)(struct bnx2x *bp);
13791420 if (unlikely(bp->panic))
13801421 return;
13811422
13821423 spin_lock_bh(&bp->stats_lock);
13831424 state = bp->stats_state;
13841425 bp->stats_state = bnx2x_stats_stm[state][event].next_state;
1426+ action = bnx2x_stats_stm[state][event].action;
13851427 spin_unlock_bh(&bp->stats_lock);
13861428
1387− bnx2x_stats_stm[state][event].action(bp);
1429+ action(bp);
13881430
13891431 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
13901432 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
drivers/net/ethernet/broadcom/tg3.c+8−5
@@ -17796,8 +17796,10 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, · 17795 unmodified lines
1779617796
1779717797 done:
1779817798 if (state == pci_channel_io_perm_failure) {
17799− tg3_napi_enable(tp);
17800− dev_close(netdev);
17799+ if (netdev) {
17800+ tg3_napi_enable(tp);
17801+ dev_close(netdev);
17802+ }
1780117803 err = PCI_ERS_RESULT_DISCONNECT;
1780217804 } else {
1780317805 pci_disable_device(pdev);
@@ -17827,7 +17829,8 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) · 23 unmodified lines
1782717829 rtnl_lock();
1782817830
1782917831 if (pci_enable_device(pdev)) {
17830− netdev_err(netdev, "Cannot re-enable PCI device after reset.\n");
17832+ dev_err(&pdev->dev,
17833+ "Cannot re-enable PCI device after reset.\n");
1783117834 goto done;
1783217835 }
1783317836
@@ -17835,7 +17838,7 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) · 1 unmodified line
1783517838 pci_restore_state(pdev);
1783617839 pci_save_state(pdev);
1783717840
17838− if (!netif_running(netdev)) {
17841+ if (!netdev || !netif_running(netdev)) {
1783917842 rc = PCI_ERS_RESULT_RECOVERED;
1784017843 goto done;
1784117844 }
@@ -17847,7 +17850,7 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) · 5 unmodified lines
1784717850 rc = PCI_ERS_RESULT_RECOVERED;
1784817851
1784917852 done:
17850− if (rc != PCI_ERS_RESULT_RECOVERED && netif_running(netdev)) {
17853+ if (rc != PCI_ERS_RESULT_RECOVERED && netdev && netif_running(netdev)) {
1785117854 tg3_napi_enable(tp);
1785217855 dev_close(netdev);
1785317856 }
drivers/net/ethernet/chelsio/cxgb3/sge.c+24−83
@@ -455,11 +455,6 @@ static int alloc_pg_chunk(struct adapter *adapter, struct sge_fl *q, · 454 unmodified lines
455455 q->pg_chunk.offset = 0;
456456 mapping = pci_map_page(adapter->pdev, q->pg_chunk.page,
457457 0, q->alloc_size, PCI_DMA_FROMDEVICE);
458− if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) {
459− __free_pages(q->pg_chunk.page, order);
460− q->pg_chunk.page = NULL;
461− return -EIO;
462− }
463458 q->pg_chunk.mapping = mapping;
464459 }
465460 sd->pg_chunk = q->pg_chunk;
@@ -954,75 +949,40 @@ static inline unsigned int calc_tx_descs(const struct sk_buff *skb) · 488 unmodified lines
954949 return flits_to_desc(flits);
955950 }
956951
957−
958−/* map_skb - map a packet main body and its page fragments
959− * @pdev: the PCI device
960− * @skb: the packet
961− * @addr: placeholder to save the mapped addresses
962− *
963− * map the main body of an sk_buff and its page fragments, if any.
964− */
965−static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb,
966− dma_addr_t *addr)
967−{
968− const skb_frag_t *fp, *end;
969− const struct skb_shared_info *si;
970−
971− *addr = pci_map_single(pdev, skb->data, skb_headlen(skb),
972− PCI_DMA_TODEVICE);
973− if (pci_dma_mapping_error(pdev, *addr))
974− goto out_err;
975−
976− si = skb_shinfo(skb);
977− end = &si->frags[si->nr_frags];
978−
979− for (fp = si->frags; fp < end; fp++) {
980− *++addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp),
981− DMA_TO_DEVICE);
982− if (pci_dma_mapping_error(pdev, *addr))
983− goto unwind;
984− }
985− return 0;
986−
987−unwind:
988− while (fp-- > si->frags)
989− dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp),
990− DMA_TO_DEVICE);
991−
992− pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE);
993−out_err:
994− return -ENOMEM;
995−}
996−
997952 /**
998− * write_sgl - populate a scatter/gather list for a packet
953+ * make_sgl - populate a scatter/gather list for a packet
999954 * @skb: the packet
1000955 * @sgp: the SGL to populate
1001956 * @start: start address of skb main body data to include in the SGL
1002957 * @len: length of skb main body data to include in the SGL
1003− * @addr: the list of the mapped addresses
958+ * @pdev: the PCI device
1004959 *
1005− * Copies the scatter/gather list for the buffers that make up a packet
960+ * Generates a scatter/gather list for the buffers that make up a packet
1006961 * and returns the SGL size in 8-byte words. The caller must size the SGL
1007962 * appropriately.
1008963 */
1009−static inline unsigned int write_sgl(const struct sk_buff *skb,
964+static inline unsigned int make_sgl(const struct sk_buff *skb,
1010965 struct sg_ent *sgp, unsigned char *start,
1011− unsigned int len, const dma_addr_t *addr)
966+ unsigned int len, struct pci_dev *pdev)
1012967 {
1013− unsigned int i, j = 0, k = 0, nfrags;
968+ dma_addr_t mapping;
969+ unsigned int i, j = 0, nfrags;
1014970
1015971 if (len) {
972+ mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE);
1016973 sgp->len[0] = cpu_to_be32(len);
1017− sgp->addr[j++] = cpu_to_be64(addr[k++]);
974+ sgp->addr[0] = cpu_to_be64(mapping);
975+ j = 1;
1018976 }
1019977
1020978 nfrags = skb_shinfo(skb)->nr_frags;
1021979 for (i = 0; i < nfrags; i++) {
1022980 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1023981
982+ mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag),
983+ DMA_TO_DEVICE);
1024984 sgp->len[j] = cpu_to_be32(skb_frag_size(frag));
1025− sgp->addr[j] = cpu_to_be64(addr[k++]);
985+ sgp->addr[j] = cpu_to_be64(mapping);
1026986 j ^= 1;
1027987 if (j == 0)
1028988 ++sgp;
@@ -1178,7 +1138,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 149 unmodified lines
11781138 const struct port_info *pi,
11791139 unsigned int pidx, unsigned int gen,
11801140 struct sge_txq *q, unsigned int ndesc,
1181− unsigned int compl, const dma_addr_t *addr)
1141+ unsigned int compl)
11821142 {
11831143 unsigned int flits, sgl_flits, cntrl, tso_info;
11841144 struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1];
@@ -1236,7 +1196,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 51 unmodified lines
12361196 }
12371197
12381198 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1239− sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr);
1199+ sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev);
12401200
12411201 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen,
12421202 htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl),
@@ -1267,7 +1227,6 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 24 unmodified lines
12671227 struct netdev_queue *txq;
12681228 struct sge_qset *qs;
12691229 struct sge_txq *q;
1270− dma_addr_t addr[MAX_SKB_FRAGS + 1];
12711230
12721231 /*
12731232 * The chip min packet length is 9 octets but play safe and reject
@@ -1296,11 +1255,6 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 22 unmodified lines
12961255 return NETDEV_TX_BUSY;
12971256 }
12981257
1299− if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) {
1300− dev_kfree_skb(skb);
1301− return NETDEV_TX_OK;
1302− }
1303−
13041258 q->in_use += ndesc;
13051259 if (unlikely(credits - ndesc < q->stop_thres)) {
13061260 t3_stop_tx_queue(txq, qs, q);
@@ -1358,7 +1312,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 51 unmodified lines
13581312 if (likely(!skb_shared(skb)))
13591313 skb_orphan(skb);
13601314
1361− write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr);
1315+ write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl);
13621316 check_ring_tx_db(adap, q);
13631317 return NETDEV_TX_OK;
13641318 }
@@ -1623,8 +1577,7 @@ static void setup_deferred_unmapping(struct sk_buff *skb, struct pci_dev *pdev, · 258 unmodified lines
16231577 */
16241578 static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
16251579 struct sge_txq *q, unsigned int pidx,
1626− unsigned int gen, unsigned int ndesc,
1627− const dma_addr_t *addr)
1580+ unsigned int gen, unsigned int ndesc)
16281581 {
16291582 unsigned int sgl_flits, flits;
16301583 struct work_request_hdr *from;
@@ -1645,9 +1598,9 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, · 14 unmodified lines
16451598
16461599 flits = skb_transport_offset(skb) / 8;
16471600 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1648− sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb),
1649− skb_tail_pointer(skb) -
1650− skb_transport_header(skb), addr);
1601+ sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),
1602+ skb->tail - skb->transport_header,
1603+ adap->pdev);
16511604 if (need_skb_unmap()) {
16521605 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);
16531606 skb->destructor = deferred_unmap_destructor;
@@ -1705,11 +1658,6 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 51 unmodified lines
17051658 goto again;
17061659 }
17071660
1708− if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) {
1709− spin_unlock(&q->lock);
1710− return NET_XMIT_SUCCESS;
1711− }
1712−
17131661 gen = q->gen;
17141662 q->in_use += ndesc;
17151663 pidx = q->pidx;
@@ -1720,7 +1668,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 4 unmodified lines
17201668 }
17211669 spin_unlock(&q->lock);
17221670
1723− write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head);
1671+ write_ofld_wr(adap, skb, q, pidx, gen, ndesc);
17241672 check_ring_tx_db(adap, q);
17251673 return NET_XMIT_SUCCESS;
17261674 }
@@ -1738,7 +1686,6 @@ static void restart_offloadq(unsigned long data) · 11 unmodified lines
17381686 struct sge_txq *q = &qs->txq[TXQ_OFLD];
17391687 const struct port_info *pi = netdev_priv(qs->netdev);
17401688 struct adapter *adap = pi->adapter;
1741− unsigned int written = 0;
17421689
17431690 spin_lock(&q->lock);
17441691 again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK);
@@ -1758,14 +1705,10 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 13 unmodified lines
17581705 break;
17591706 }
17601707
1761− if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head))
1762− break;
1763−
17641708 gen = q->gen;
17651709 q->in_use += ndesc;
17661710 pidx = q->pidx;
17671711 q->pidx += ndesc;
1768− written += ndesc;
17691712 if (q->pidx >= q->size) {
17701713 q->pidx -= q->size;
17711714 q->gen ^= 1;
@@ -1773,8 +1716,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 1 unmodified line
17731716 __skb_unlink(skb, &q->sendq);
17741717 spin_unlock(&q->lock);
17751718
1776− write_ofld_wr(adap, skb, q, pidx, gen, ndesc,
1777− (dma_addr_t *)skb->head);
1719+ write_ofld_wr(adap, skb, q, pidx, gen, ndesc);
17781720 spin_lock(&q->lock);
17791721 }
17801722 spin_unlock(&q->lock);
@@ -1784,9 +1726,8 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 3 unmodified lines
17841726 set_bit(TXQ_LAST_PKT_DB, &q->flags);
17851727 #endif
17861728 wmb();
1787− if (likely(written))
1788− t3_write_reg(adap, A_SG_KDOORBELL,
1789− F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));
1729+ t3_write_reg(adap, A_SG_KDOORBELL,
1730+ F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));
17901731 }
17911732
17921733 /**
drivers/net/ethernet/emulex/benet/be_cmds.c+3−0
@@ -3048,6 +3048,9 @@ int be_cmd_get_func_config(struct be_adapter *adapter) · 3047 unmodified lines
30483048
30493049 adapter->max_event_queues = le16_to_cpu(desc->eq_count);
30503050 adapter->if_cap_flags = le32_to_cpu(desc->cap_flags);
3051+
3052+ /* Clear flags that driver is not interested in */
3053+ adapter->if_cap_flags &= BE_IF_CAP_FLAGS_WANT;
30513054 }
30523055 err:
30533056 mutex_unlock(&adapter->mbox_lock);
drivers/net/ethernet/emulex/benet/be_cmds.h+6−0
@@ -563,6 +563,12 @@ enum be_if_flags { · 562 unmodified lines
563563 BE_IF_FLAGS_MULTICAST = 0x1000
564564 };
565565
566+#define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\
567+ BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\
568+ BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\
569+ BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\
570+ BE_IF_FLAGS_UNTAGGED)
571+
566572 /* An RX interface is an object with one or more MAC addresses and
567573 * filtering capabilities. */
568574 struct be_cmd_req_if_create {
drivers/net/ethernet/emulex/benet/be_main.c+1−1
@@ -2563,8 +2563,8 @@ static int be_close(struct net_device *netdev) · 2562 unmodified lines
25632563 /* Wait for all pending tx completions to arrive so that
25642564 * all tx skbs are freed.
25652565 */
2566− be_tx_compl_clean(adapter);
25672566 netif_tx_disable(netdev);
2567+ be_tx_compl_clean(adapter);
25682568
25692569 be_rx_qs_destroy(adapter);
25702570
drivers/net/ethernet/marvell/skge.c+53−15
@@ -931,17 +931,20 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base) · 930 unmodified lines
931931 }
932932
933933 /* Allocate and setup a new buffer for receiving */
934−static void skge_rx_setup(struct skge_port *skge, struct skge_element *e,
935− struct sk_buff *skb, unsigned int bufsize)
934+static int skge_rx_setup(struct skge_port *skge, struct skge_element *e,
935+ struct sk_buff *skb, unsigned int bufsize)
936936 {
937937 struct skge_rx_desc *rd = e->desc;
938− u64 map;
938+ dma_addr_t map;
939939
940940 map = pci_map_single(skge->hw->pdev, skb->data, bufsize,
941941 PCI_DMA_FROMDEVICE);
942942
943− rd->dma_lo = map;
944− rd->dma_hi = map >> 32;
943+ if (pci_dma_mapping_error(skge->hw->pdev, map))
944+ return -1;
945+
946+ rd->dma_lo = lower_32_bits(map);
947+ rd->dma_hi = upper_32_bits(map);
945948 e->skb = skb;
946949 rd->csum1_start = ETH_HLEN;
947950 rd->csum2_start = ETH_HLEN;
@@ -953,6 +956,7 @@ static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, · 5 unmodified lines
953956 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize;
954957 dma_unmap_addr_set(e, mapaddr, map);
955958 dma_unmap_len_set(e, maplen, bufsize);
959+ return 0;
956960 }
957961
958962 /* Resume receiving using existing skb,
@@ -1014,7 +1018,10 @@ static int skge_rx_fill(struct net_device *dev) · 55 unmodified lines
10141018 return -ENOMEM;
10151019
10161020 skb_reserve(skb, NET_IP_ALIGN);
1017− skge_rx_setup(skge, e, skb, skge->rx_buf_size);
1021+ if (skge_rx_setup(skge, e, skb, skge->rx_buf_size) < 0) {
1022+ dev_kfree_skb(skb);
1023+ return -EIO;
1024+ }
10181025 } while ((e = e->next) != ring->start);
10191026
10201027 ring->to_clean = ring->start;
@@ -2544,7 +2551,7 @@ static int skge_up(struct net_device *dev) · 1523 unmodified lines
25442551
25452552 BUG_ON(skge->dma & 7);
25462553
2547− if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) {
2554+ if (upper_32_bits(skge->dma) != upper_32_bits(skge->dma + skge->mem_size)) {
25482555 dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n");
25492556 err = -EINVAL;
25502557 goto free_pci_mem;
@@ -2729,7 +2736,7 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 178 unmodified lines
27292736 struct skge_tx_desc *td;
27302737 int i;
27312738 u32 control, len;
2732− u64 map;
2739+ dma_addr_t map;
27332740
27342741 if (skb_padto(skb, ETH_ZLEN))
27352742 return NETDEV_TX_OK;
@@ -2743,11 +2750,14 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 7 unmodified lines
27432750 e->skb = skb;
27442751 len = skb_headlen(skb);
27452752 map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
2753+ if (pci_dma_mapping_error(hw->pdev, map))
2754+ goto mapping_error;
2755+
27462756 dma_unmap_addr_set(e, mapaddr, map);
27472757 dma_unmap_len_set(e, maplen, len);
27482758
2749− td->dma_lo = map;
2750− td->dma_hi = map >> 32;
2759+ td->dma_lo = lower_32_bits(map);
2760+ td->dma_hi = upper_32_bits(map);
27512761
27522762 if (skb->ip_summed == CHECKSUM_PARTIAL) {
27532763 const int offset = skb_checksum_start_offset(skb);
@@ -2778,14 +2788,16 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 24 unmodified lines
27782788
27792789 map = skb_frag_dma_map(&hw->pdev->dev, frag, 0,
27802790 skb_frag_size(frag), DMA_TO_DEVICE);
2791+ if (dma_mapping_error(&hw->pdev->dev, map))
2792+ goto mapping_unwind;
27812793
27822794 e = e->next;
27832795 e->skb = skb;
27842796 tf = e->desc;
27852797 BUG_ON(tf->control & BMU_OWN);
27862798
2787− tf->dma_lo = map;
2788− tf->dma_hi = (u64) map >> 32;
2799+ tf->dma_lo = lower_32_bits(map);
2800+ tf->dma_hi = upper_32_bits(map);
27892801 dma_unmap_addr_set(e, mapaddr, map);
27902802 dma_unmap_len_set(e, maplen, skb_frag_size(frag));
27912803
@@ -2815,6 +2827,26 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 23 unmodified lines
28152827 }
28162828
28172829 return NETDEV_TX_OK;
2830+
2831+mapping_unwind:
2832+ e = skge->tx_ring.to_use;
2833+ pci_unmap_single(hw->pdev,
2834+ dma_unmap_addr(e, mapaddr),
2835+ dma_unmap_len(e, maplen),
2836+ PCI_DMA_TODEVICE);
2837+ while (i-- > 0) {
2838+ e = e->next;
2839+ pci_unmap_page(hw->pdev,
2840+ dma_unmap_addr(e, mapaddr),
2841+ dma_unmap_len(e, maplen),
2842+ PCI_DMA_TODEVICE);
2843+ }
2844+
2845+mapping_error:
2846+ if (net_ratelimit())
2847+ dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name);
2848+ dev_kfree_skb(skb);
2849+ return NETDEV_TX_OK;
28182850 }
28192851
28202852
@@ -3045,11 +3077,13 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, · 224 unmodified lines
30453077
30463078 pci_dma_sync_single_for_cpu(skge->hw->pdev,
30473079 dma_unmap_addr(e, mapaddr),
3048− len, PCI_DMA_FROMDEVICE);
3080+ dma_unmap_len(e, maplen),
3081+ PCI_DMA_FROMDEVICE);
30493082 skb_copy_from_linear_data(e->skb, skb->data, len);
30503083 pci_dma_sync_single_for_device(skge->hw->pdev,
30513084 dma_unmap_addr(e, mapaddr),
3052− len, PCI_DMA_FROMDEVICE);
3085+ dma_unmap_len(e, maplen),
3086+ PCI_DMA_FROMDEVICE);
30533087 skge_rx_reuse(e, skge->rx_buf_size);
30543088 } else {
30553089 struct sk_buff *nskb;
@@ -3058,13 +3092,17 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, · 2 unmodified lines
30583092 if (!nskb)
30593093 goto resubmit;
30603094
3095+ if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) {
3096+ dev_kfree_skb(nskb);
3097+ goto resubmit;
3098+ }
3099+
30613100 pci_unmap_single(skge->hw->pdev,
30623101 dma_unmap_addr(e, mapaddr),
30633102 dma_unmap_len(e, maplen),
30643103 PCI_DMA_FROMDEVICE);
30653104 skb = e->skb;
30663105 prefetch(skb->data);
3067− skge_rx_setup(skge, e, nskb, skge->rx_buf_size);
30683106 }
30693107
30703108 skb_put(skb, len);
drivers/net/ethernet/mellanox/mlx5/core/cmd.c+1−1
@@ -46,7 +46,7 @@ · 45 unmodified lines
4646 #include "mlx5_core.h"
4747
4848 enum {
49− CMD_IF_REV = 4,
49+ CMD_IF_REV = 5,
5050 };
5151
5252 enum {
drivers/net/ethernet/mellanox/mlx5/core/eq.c+1−1
@@ -268,7 +268,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) · 267 unmodified lines
268268 case MLX5_EVENT_TYPE_PAGE_REQUEST:
269269 {
270270 u16 func_id = be16_to_cpu(eqe->data.req_pages.func_id);
271− s16 npages = be16_to_cpu(eqe->data.req_pages.num_pages);
271+ s32 npages = be32_to_cpu(eqe->data.req_pages.num_pages);
272272
273273 mlx5_core_dbg(dev, "page request for func 0x%x, napges %d\n", func_id, npages);
274274 mlx5_core_req_pages_handler(dev, func_id, npages);
drivers/net/ethernet/mellanox/mlx5/core/fw.c+1−1
@@ -113,7 +113,7 @@ int mlx5_cmd_query_hca_cap(struct mlx5_core_dev *dev, · 112 unmodified lines
113113 caps->log_max_srq = out->hca_cap.log_max_srqs & 0x1f;
114114 caps->local_ca_ack_delay = out->hca_cap.local_ca_ack_delay & 0x1f;
115115 caps->log_max_mcg = out->hca_cap.log_max_mcg;
116− caps->max_qp_mcg = be16_to_cpu(out->hca_cap.max_qp_mcg);
116+ caps->max_qp_mcg = be32_to_cpu(out->hca_cap.max_qp_mcg) & 0xffffff;
117117 caps->max_ra_res_qp = 1 << (out->hca_cap.log_max_ra_res_qp & 0x3f);
118118 caps->max_ra_req_qp = 1 << (out->hca_cap.log_max_ra_req_qp & 0x3f);
119119 caps->max_srq_wqes = 1 << out->hca_cap.log_max_srq_sz;
drivers/net/ethernet/mellanox/mlx5/core/health.c+1−28
@@ -55,33 +55,9 @@ enum { · 54 unmodified lines
5555 };
5656
5757 static DEFINE_SPINLOCK(health_lock);
58−
5958 static LIST_HEAD(health_list);
6059 static struct work_struct health_work;
6160
62−static health_handler_t reg_handler;
63−int mlx5_register_health_report_handler(health_handler_t handler)
64−{
65− spin_lock_irq(&health_lock);
66− if (reg_handler) {
67− spin_unlock_irq(&health_lock);
68− return -EEXIST;
69− }
70− reg_handler = handler;
71− spin_unlock_irq(&health_lock);
72−
73− return 0;
74−}
75−EXPORT_SYMBOL(mlx5_register_health_report_handler);
76−
77−void mlx5_unregister_health_report_handler(void)
78−{
79− spin_lock_irq(&health_lock);
80− reg_handler = NULL;
81− spin_unlock_irq(&health_lock);
82−}
83−EXPORT_SYMBOL(mlx5_unregister_health_report_handler);
84−
8561 static void health_care(struct work_struct *work)
8662 {
8763 struct mlx5_core_health *health, *n;
@@ -98,11 +74,8 @@ static void health_care(struct work_struct *work) · 10 unmodified lines
9874 priv = container_of(health, struct mlx5_priv, health);
9975 dev = container_of(priv, struct mlx5_core_dev, priv);
10076 mlx5_core_warn(dev, "handling bad device here\n");
77+ /* nothing yet */
10178 spin_lock_irq(&health_lock);
102− if (reg_handler)
103− reg_handler(dev->pdev, health->health,
104− sizeof(health->health));
105−
10679 list_del_init(&health->list);
10780 spin_unlock_irq(&health_lock);
10881 }
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c+26−32
@@ -43,10 +43,16 @@ enum { · 42 unmodified lines
4343 MLX5_PAGES_TAKE = 2
4444 };
4545
46+enum {
47+ MLX5_BOOT_PAGES = 1,
48+ MLX5_INIT_PAGES = 2,
49+ MLX5_POST_INIT_PAGES = 3
50+};
51+
4652 struct mlx5_pages_req {
4753 struct mlx5_core_dev *dev;
4854 u32 func_id;
49− s16 npages;
55+ s32 npages;
5056 struct work_struct work;
5157 };
5258
@@ -64,27 +70,23 @@ struct mlx5_query_pages_inbox { · 11 unmodified lines
6470
6571 struct mlx5_query_pages_outbox {
6672 struct mlx5_outbox_hdr hdr;
67− __be16 num_boot_pages;
73+ __be16 rsvd;
6874 __be16 func_id;
69− __be16 init_pages;
70− __be16 num_pages;
75+ __be32 num_pages;
7176 };
7277
7378 struct mlx5_manage_pages_inbox {
7479 struct mlx5_inbox_hdr hdr;
75− __be16 rsvd0;
80+ __be16 rsvd;
7681 __be16 func_id;
77− __be16 rsvd1;
78− __be16 num_entries;
79− u8 rsvd2[16];
82+ __be32 num_entries;
8083 __be64 pas[0];
8184 };
8285
8386 struct mlx5_manage_pages_outbox {
8487 struct mlx5_outbox_hdr hdr;
85− u8 rsvd0[2];
86− __be16 num_entries;
87− u8 rsvd1[20];
88+ __be32 num_entries;
89+ u8 rsvd[4];
8890 __be64 pas[0];
8991 };
9092
@@ -146,7 +148,7 @@ static struct page *remove_page(struct mlx5_core_dev *dev, u64 addr) · 55 unmodified lines
146148 }
147149
148150 static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id,
149− s16 *pages, s16 *init_pages, u16 *boot_pages)
151+ s32 *npages, int boot)
150152 {
151153 struct mlx5_query_pages_inbox in;
152154 struct mlx5_query_pages_outbox out;
@@ -155,6 +157,8 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, · 2 unmodified lines
155157 memset(&in, 0, sizeof(in));
156158 memset(&out, 0, sizeof(out));
157159 in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_PAGES);
160+ in.hdr.opmod = boot ? cpu_to_be16(MLX5_BOOT_PAGES) : cpu_to_be16(MLX5_INIT_PAGES);
161+
158162 err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
159163 if (err)
160164 return err;
@@ -162,15 +166,7 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, · 1 unmodified line
162166 if (out.hdr.status)
163167 return mlx5_cmd_status_to_err(&out.hdr);
164168
165− if (pages)
166− *pages = be16_to_cpu(out.num_pages);
167−
168− if (init_pages)
169− *init_pages = be16_to_cpu(out.init_pages);
170−
171− if (boot_pages)
172− *boot_pages = be16_to_cpu(out.num_boot_pages);
173−
169+ *npages = be32_to_cpu(out.num_pages);
174170 *func_id = be16_to_cpu(out.func_id);
175171
176172 return err;
@@ -224,7 +220,7 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, · 47 unmodified lines
224220 in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES);
225221 in->hdr.opmod = cpu_to_be16(MLX5_PAGES_GIVE);
226222 in->func_id = cpu_to_be16(func_id);
227− in->num_entries = cpu_to_be16(npages);
223+ in->num_entries = cpu_to_be32(npages);
228224 err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out));
229225 mlx5_core_dbg(dev, "err %d\n", err);
230226 if (err) {
@@ -292,7 +288,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, · 61 unmodified lines
292288 in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES);
293289 in.hdr.opmod = cpu_to_be16(MLX5_PAGES_TAKE);
294290 in.func_id = cpu_to_be16(func_id);
295− in.num_entries = cpu_to_be16(npages);
291+ in.num_entries = cpu_to_be32(npages);
296292 mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen);
297293 err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen);
298294 if (err) {
@@ -306,7 +302,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, · 7 unmodified lines
306302 goto out_free;
307303 }
308304
309− num_claimed = be16_to_cpu(out->num_entries);
305+ num_claimed = be32_to_cpu(out->num_entries);
310306 if (nclaimed)
311307 *nclaimed = num_claimed;
312308
@@ -345,7 +341,7 @@ static void pages_work_handler(struct work_struct *work) · 32 unmodified lines
345341 }
346342
347343 void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
348− s16 npages)
344+ s32 npages)
349345 {
350346 struct mlx5_pages_req *req;
351347
@@ -364,20 +360,18 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, · 12 unmodified lines
364360
365361 int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot)
366362 {
367− u16 uninitialized_var(boot_pages);
368− s16 uninitialized_var(init_pages);
369363 u16 uninitialized_var(func_id);
364+ s32 uninitialized_var(npages);
370365 int err;
371366
372− err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages,
373− &boot_pages);
367+ err = mlx5_cmd_query_pages(dev, &func_id, &npages, boot);
374368 if (err)
375369 return err;
376370
371+ mlx5_core_dbg(dev, "requested %d %s pages for func_id 0x%x\n",
372+ npages, boot ? "boot" : "init", func_id);
377373
378− mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n",
379− init_pages, boot_pages, func_id);
380− return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0);
374+ return give_pages(dev, func_id, npages, 0);
381375 }
382376
383377 static int optimal_reclaimed_pages(void)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c+5−0
@@ -3266,6 +3266,11 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) · 3265 unmodified lines
32663266 u8 val;
32673267 int ret, max_sds_rings = adapter->max_sds_rings;
32683268
3269+ if (test_bit(__QLCNIC_RESETTING, &adapter->state)) {
3270+ netdev_info(netdev, "Device is resetting\n");
3271+ return -EBUSY;
3272+ }
3273+
32693274 if (qlcnic_get_diag_lock(adapter)) {
32703275 netdev_info(netdev, "Device in diagnostics mode\n");
32713276 return -EBUSY;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c+2−1
@@ -629,7 +629,8 @@ int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter) · 628 unmodified lines
629629 return -EIO;
630630 }
631631
632− qlcnic_set_drv_version(adapter);
632+ if (adapter->portnum == 0)
633+ qlcnic_set_drv_version(adapter);
633634 qlcnic_83xx_idc_attach_driver(adapter);
634635
635636 return 0;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+4−2
@@ -2165,7 +2165,8 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 2164 unmodified lines
21652165 if (err)
21662166 goto err_out_disable_mbx_intr;
21672167
2168− qlcnic_set_drv_version(adapter);
2168+ if (adapter->portnum == 0)
2169+ qlcnic_set_drv_version(adapter);
21692170
21702171 pci_set_drvdata(pdev, adapter);
21712172
@@ -3085,7 +3086,8 @@ done: · 913 unmodified lines
30853086 adapter->fw_fail_cnt = 0;
30863087 adapter->flags &= ~QLCNIC_FW_HANG;
30873088 clear_bit(__QLCNIC_RESETTING, &adapter->state);
3088− qlcnic_set_drv_version(adapter);
3089+ if (adapter->portnum == 0)
3090+ qlcnic_set_drv_version(adapter);
30893091
30903092 if (!qlcnic_clr_drv_state(adapter))
30913093 qlcnic_schedule_work(adapter, qlcnic_fw_poll_work,
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c+3−3
@@ -170,9 +170,9 @@ static int qlcnic_82xx_store_beacon(struct qlcnic_adapter *adapter, · 169 unmodified lines
170170
171171 if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) {
172172 err = qlcnic_get_beacon_state(adapter, &h_beacon_state);
173− if (!err) {
174− dev_info(&adapter->pdev->dev,
175− "Failed to get current beacon state\n");
173+ if (err) {
174+ netdev_err(adapter->netdev,
175+ "Failed to get current beacon state\n");
176176 } else {
177177 if (h_beacon_state == QLCNIC_BEACON_DISABLE)
178178 ahw->beacon_state = 0;
drivers/net/ethernet/realtek/8139cp.c+1−0
@@ -524,6 +524,7 @@ rx_status_loop: · 523 unmodified lines
524524 PCI_DMA_FROMDEVICE);
525525 if (dma_mapping_error(&cp->pdev->dev, new_mapping)) {
526526 dev->stats.rx_dropped++;
527+ kfree_skb(new_skb);
527528 goto rx_next;
528529 }
529530
drivers/net/ethernet/realtek/r8169.c+1−1
@@ -7088,7 +7088,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 7087 unmodified lines
70887088
70897089 RTL_W8(Cfg9346, Cfg9346_Unlock);
70907090 RTL_W8(Config1, RTL_R8(Config1) | PMEnable);
7091− RTL_W8(Config5, RTL_R8(Config5) & PMEStatus);
7091+ RTL_W8(Config5, RTL_R8(Config5) & (BWF | MWF | UWF | LanWake | PMEStatus));
70927092 if ((RTL_R8(Config3) & (LinkUp | MagicPacket)) != 0)
70937093 tp->features |= RTL_FEATURE_WOL;
70947094 if ((RTL_R8(Config5) & (UWF | BWF | MWF)) != 0)
drivers/net/ethernet/sfc/filter.c+1−1
@@ -675,7 +675,7 @@ s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, · 674 unmodified lines
675675 BUILD_BUG_ON(EFX_FILTER_INDEX_UC_DEF != 0);
676676 BUILD_BUG_ON(EFX_FILTER_INDEX_MC_DEF !=
677677 EFX_FILTER_MC_DEF - EFX_FILTER_UC_DEF);
678− rep_index = spec->type - EFX_FILTER_INDEX_UC_DEF;
678+ rep_index = spec->type - EFX_FILTER_UC_DEF;
679679 ins_index = rep_index;
680680
681681 spin_lock_bh(&state->lock);
drivers/net/ethernet/stmicro/stmmac/ring_mode.c+11−2
@@ -33,10 +33,15 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 32 unmodified lines
3333 struct stmmac_priv *priv = (struct stmmac_priv *)p;
3434 unsigned int txsize = priv->dma_tx_size;
3535 unsigned int entry = priv->cur_tx % txsize;
36− struct dma_desc *desc = priv->dma_tx + entry;
36+ struct dma_desc *desc;
3737 unsigned int nopaged_len = skb_headlen(skb);
3838 unsigned int bmax, len;
3939
40+ if (priv->extend_desc)
41+ desc = (struct dma_desc *)(priv->dma_etx + entry);
42+ else
43+ desc = priv->dma_tx + entry;
44+
4045 if (priv->plat->enh_desc)
4146 bmax = BUF_SIZE_8KiB;
4247 else
@@ -54,7 +59,11 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 11 unmodified lines
5459 STMMAC_RING_MODE);
5560 wmb();
5661 entry = (++priv->cur_tx) % txsize;
57− desc = priv->dma_tx + entry;
62+
63+ if (priv->extend_desc)
64+ desc = (struct dma_desc *)(priv->dma_etx + entry);
65+ else
66+ desc = priv->dma_tx + entry;
5867
5968 desc->des2 = dma_map_single(priv->device, skb->data + bmax,
6069 len, DMA_TO_DEVICE);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+92−19
@@ -939,15 +939,20 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, · 938 unmodified lines
939939
940940 skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN,
941941 GFP_KERNEL);
942− if (unlikely(skb == NULL)) {
942+ if (!skb) {
943943 pr_err("%s: Rx init fails; skb is NULL\n", __func__);
944− return 1;
944+ return -ENOMEM;
945945 }
946946 skb_reserve(skb, NET_IP_ALIGN);
947947 priv->rx_skbuff[i] = skb;
948948 priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data,
949949 priv->dma_buf_sz,
950950 DMA_FROM_DEVICE);
951+ if (dma_mapping_error(priv->device, priv->rx_skbuff_dma[i])) {
952+ pr_err("%s: DMA mapping error\n", __func__);
953+ dev_kfree_skb_any(skb);
954+ return -EINVAL;
955+ }
951956
952957 p->des2 = priv->rx_skbuff_dma[i];
953958
@@ -958,6 +963,16 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, · 4 unmodified lines
958963 return 0;
959964 }
960965
966+static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i)
967+{
968+ if (priv->rx_skbuff[i]) {
969+ dma_unmap_single(priv->device, priv->rx_skbuff_dma[i],
970+ priv->dma_buf_sz, DMA_FROM_DEVICE);
971+ dev_kfree_skb_any(priv->rx_skbuff[i]);
972+ }
973+ priv->rx_skbuff[i] = NULL;
974+}
975+
961976 /**
962977 * init_dma_desc_rings - init the RX/TX descriptor rings
963978 * @dev: net device structure
@@ -965,13 +980,14 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, · 1 unmodified line
965980 * and allocates the socket buffers. It suppors the chained and ring
966981 * modes.
967982 */
968−static void init_dma_desc_rings(struct net_device *dev)
983+static int init_dma_desc_rings(struct net_device *dev)
969984 {
970985 int i;
971986 struct stmmac_priv *priv = netdev_priv(dev);
972987 unsigned int txsize = priv->dma_tx_size;
973988 unsigned int rxsize = priv->dma_rx_size;
974989 unsigned int bfsize = 0;
990+ int ret = -ENOMEM;
975991
976992 /* Set the max buffer size according to the DESC mode
977993 * and the MTU. Note that RING mode allows 16KiB bsize.
@@ -992,34 +1008,60 @@ static void init_dma_desc_rings(struct net_device *dev) · 14 unmodified lines
9921008 dma_extended_desc),
9931009 &priv->dma_rx_phy,
9941010 GFP_KERNEL);
1011+ if (!priv->dma_erx)
1012+ goto err_dma;
1013+
9951014 priv->dma_etx = dma_alloc_coherent(priv->device, txsize *
9961015 sizeof(struct
9971016 dma_extended_desc),
9981017 &priv->dma_tx_phy,
9991018 GFP_KERNEL);
1000− if ((!priv->dma_erx) || (!priv->dma_etx))
1001− return;
1019+ if (!priv->dma_etx) {
1020+ dma_free_coherent(priv->device, priv->dma_rx_size *
1021+ sizeof(struct dma_extended_desc),
1022+ priv->dma_erx, priv->dma_rx_phy);
1023+ goto err_dma;
1024+ }
10021025 } else {
10031026 priv->dma_rx = dma_alloc_coherent(priv->device, rxsize *
10041027 sizeof(struct dma_desc),
10051028 &priv->dma_rx_phy,
10061029 GFP_KERNEL);
1030+ if (!priv->dma_rx)
1031+ goto err_dma;
1032+
10071033 priv->dma_tx = dma_alloc_coherent(priv->device, txsize *
10081034 sizeof(struct dma_desc),
10091035 &priv->dma_tx_phy,
10101036 GFP_KERNEL);
1011− if ((!priv->dma_rx) || (!priv->dma_tx))
1012− return;
1037+ if (!priv->dma_tx) {
1038+ dma_free_coherent(priv->device, priv->dma_rx_size *
1039+ sizeof(struct dma_desc),
1040+ priv->dma_rx, priv->dma_rx_phy);
1041+ goto err_dma;
1042+ }
10131043 }
10141044
10151045 priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t),
10161046 GFP_KERNEL);
1047+ if (!priv->rx_skbuff_dma)
1048+ goto err_rx_skbuff_dma;
1049+
10171050 priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *),
10181051 GFP_KERNEL);
1052+ if (!priv->rx_skbuff)
1053+ goto err_rx_skbuff;
1054+
10191055 priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t),
10201056 GFP_KERNEL);
1057+ if (!priv->tx_skbuff_dma)
1058+ goto err_tx_skbuff_dma;
1059+
10211060 priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *),
10221061 GFP_KERNEL);
1062+ if (!priv->tx_skbuff)
1063+ goto err_tx_skbuff;
1064+
10231065 if (netif_msg_probe(priv)) {
10241066 pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__,
10251067 (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy);
@@ -1034,8 +1076,9 @@ static void init_dma_desc_rings(struct net_device *dev) · 8 unmodified lines
10341076 else
10351077 p = priv->dma_rx + i;
10361078
1037− if (stmmac_init_rx_buffers(priv, p, i))
1038− break;
1079+ ret = stmmac_init_rx_buffers(priv, p, i);
1080+ if (ret)
1081+ goto err_init_rx_buffers;
10391082
10401083 if (netif_msg_probe(priv))
10411084 pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i],
@@ -1081,20 +1124,44 @@ static void init_dma_desc_rings(struct net_device *dev) · 39 unmodified lines
10811124
10821125 if (netif_msg_hw(priv))
10831126 stmmac_display_rings(priv);
1127+
1128+ return 0;
1129+err_init_rx_buffers:
1130+ while (--i >= 0)
1131+ stmmac_free_rx_buffers(priv, i);
1132+ kfree(priv->tx_skbuff);
1133+err_tx_skbuff:
1134+ kfree(priv->tx_skbuff_dma);
1135+err_tx_skbuff_dma:
1136+ kfree(priv->rx_skbuff);
1137+err_rx_skbuff:
1138+ kfree(priv->rx_skbuff_dma);
1139+err_rx_skbuff_dma:
1140+ if (priv->extend_desc) {
1141+ dma_free_coherent(priv->device, priv->dma_tx_size *
1142+ sizeof(struct dma_extended_desc),
1143+ priv->dma_etx, priv->dma_tx_phy);
1144+ dma_free_coherent(priv->device, priv->dma_rx_size *
1145+ sizeof(struct dma_extended_desc),
1146+ priv->dma_erx, priv->dma_rx_phy);
1147+ } else {
1148+ dma_free_coherent(priv->device,
1149+ priv->dma_tx_size * sizeof(struct dma_desc),
1150+ priv->dma_tx, priv->dma_tx_phy);
1151+ dma_free_coherent(priv->device,
1152+ priv->dma_rx_size * sizeof(struct dma_desc),
1153+ priv->dma_rx, priv->dma_rx_phy);
1154+ }
1155+err_dma:
1156+ return ret;
10841157 }
10851158
10861159 static void dma_free_rx_skbufs(struct stmmac_priv *priv)
10871160 {
10881161 int i;
10891162
1090− for (i = 0; i < priv->dma_rx_size; i++) {
1091− if (priv->rx_skbuff[i]) {
1092− dma_unmap_single(priv->device, priv->rx_skbuff_dma[i],
1093− priv->dma_buf_sz, DMA_FROM_DEVICE);
1094− dev_kfree_skb_any(priv->rx_skbuff[i]);
1095− }
1096− priv->rx_skbuff[i] = NULL;
1097− }
1163+ for (i = 0; i < priv->dma_rx_size; i++)
1164+ stmmac_free_rx_buffers(priv, i);
10981165 }
10991166
11001167 static void dma_free_tx_skbufs(struct stmmac_priv *priv)
@@ -1560,12 +1627,17 @@ static int stmmac_open(struct net_device *dev) · 459 unmodified lines
15601627 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
15611628 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
15621629 priv->dma_buf_sz = STMMAC_ALIGN(buf_sz);
1563− init_dma_desc_rings(dev);
1630+
1631+ ret = init_dma_desc_rings(dev);
1632+ if (ret < 0) {
1633+ pr_err("%s: DMA descriptors initialization failed\n", __func__);
1634+ goto dma_desc_error;
1635+ }
15641636
15651637 /* DMA initialization and SW reset */
15661638 ret = stmmac_init_dma_engine(priv);
15671639 if (ret < 0) {
1568− pr_err("%s: DMA initialization failed\n", __func__);
1640+ pr_err("%s: DMA engine initialization failed\n", __func__);
15691641 goto init_error;
15701642 }
15711643
@@ -1672,6 +1744,7 @@ wolirq_error: · 100 unmodified lines
16721744
16731745 init_error:
16741746 free_dma_desc_resources(priv);
1747+dma_desc_error:
16751748 if (priv->phydev)
16761749 phy_disconnect(priv->phydev);
16771750 phy_error:
drivers/net/ethernet/via/via-velocity.c+3−1
@@ -2100,7 +2100,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) · 2099 unmodified lines
21002100
21012101 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
21022102 }
2103− netif_rx(skb);
2103+ netif_receive_skb(skb);
21042104
21052105 stats->rx_bytes += pkt_len;
21062106 stats->rx_packets++;
@@ -2884,6 +2884,7 @@ out: · 777 unmodified lines
28842884 return ret;
28852885
28862886 err_iounmap:
2887+ netif_napi_del(&vptr->napi);
28872888 iounmap(regs);
28882889 err_free_dev:
28892890 free_netdev(netdev);
@@ -2904,6 +2905,7 @@ static int velocity_remove(struct device *dev) · 14 unmodified lines
29042905 struct velocity_info *vptr = netdev_priv(netdev);
29052906
29062907 unregister_netdev(netdev);
2908+ netif_napi_del(&vptr->napi);
29072909 iounmap(vptr->mac_regs);
29082910 free_netdev(netdev);
29092911 velocity_nics--;
drivers/net/irda/via-ircc.c+2−4
@@ -210,8 +210,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) · 209 unmodified lines
210210 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
211211 pci_write_config_byte(pcidev,0x5a,0xc0);
212212 WriteLPCReg(0x28, 0x70 );
213− if (via_ircc_open(pcidev, &info, 0x3076) == 0)
214− rc=0;
213+ rc = via_ircc_open(pcidev, &info, 0x3076);
215214 } else
216215 rc = -ENODEV; //IR not turn on
217216 } else { //Not VT1211
@@ -249,8 +248,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) · 31 unmodified lines
249248 info.irq=FirIRQ;
250249 info.dma=FirDRQ1;
251250 info.dma2=FirDRQ0;
252− if (via_ircc_open(pcidev, &info, 0x3096) == 0)
253− rc=0;
251+ rc = via_ircc_open(pcidev, &info, 0x3096);
254252 } else
255253 rc = -ENODEV; //IR not turn on !!!!!
256254 }//Not VT1211
drivers/net/macvlan.c+4−0
@@ -739,6 +739,10 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[]) · 738 unmodified lines
739739 return -EADDRNOTAVAIL;
740740 }
741741
742+ if (data && data[IFLA_MACVLAN_FLAGS] &&
743+ nla_get_u16(data[IFLA_MACVLAN_FLAGS]) & ~MACVLAN_FLAG_NOPROMISC)
744+ return -EINVAL;
745+
742746 if (data && data[IFLA_MACVLAN_MODE]) {
743747 switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) {
744748 case MACVLAN_MODE_PRIVATE:
drivers/net/macvtap.c+18−12
@@ -68,6 +68,8 @@ static const struct proto_ops macvtap_socket_ops; · 67 unmodified lines
6868 #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \
6969 NETIF_F_TSO6 | NETIF_F_UFO)
7070 #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO)
71+#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG)
72+
7173 /*
7274 * RCU usage:
7375 * The macvtap_queue and the macvlan_dev are loosely coupled, the
@@ -278,7 +280,8 @@ static int macvtap_forward(struct net_device *dev, struct sk_buff *skb) · 204 unmodified lines
278280 {
279281 struct macvlan_dev *vlan = netdev_priv(dev);
280282 struct macvtap_queue *q = macvtap_get_queue(dev, skb);
281− netdev_features_t features;
283+ netdev_features_t features = TAP_FEATURES;
284+
282285 if (!q)
283286 goto drop;
284287
@@ -287,9 +290,11 @@ static int macvtap_forward(struct net_device *dev, struct sk_buff *skb) · 2 unmodified lines
287290
288291 skb->dev = dev;
289292 /* Apply the forward feature mask so that we perform segmentation
290− * according to users wishes.
293+ * according to users wishes. This only works if VNET_HDR is
294+ * enabled.
291295 */
292− features = netif_skb_features(skb) & vlan->tap_features;
296+ if (q->flags & IFF_VNET_HDR)
297+ features |= vlan->tap_features;
293298 if (netif_needs_gso(skb, features)) {
294299 struct sk_buff *segs = __skb_gso_segment(skb, features, false);
295300
@@ -818,10 +823,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, · 522 unmodified lines
818823 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
819824 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
820825 }
821− if (vlan)
826+ if (vlan) {
827+ local_bh_disable();
822828 macvlan_start_xmit(skb, vlan->dev);
823− else
829+ local_bh_enable();
830+ } else {
824831 kfree_skb(skb);
832+ }
825833 rcu_read_unlock();
826834
827835 return total_len;
@@ -912,8 +920,11 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, · 84 unmodified lines
912920 done:
913921 rcu_read_lock();
914922 vlan = rcu_dereference(q->vlan);
915− if (vlan)
923+ if (vlan) {
924+ preempt_disable();
916925 macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0);
926+ preempt_enable();
927+ }
917928 rcu_read_unlock();
918929
919930 return ret ? ret : copied;
@@ -1058,8 +1069,7 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) · 138 unmodified lines
10581069 /* tap_features are the same as features on tun/tap and
10591070 * reflect user expectations.
10601071 */
1061− vlan->tap_features = vlan->dev->features &
1062− (feature_mask | ~TUN_OFFLOADS);
1072+ vlan->tap_features = feature_mask;
10631073 vlan->set_features = features;
10641074 netdev_update_features(vlan->dev);
10651075
@@ -1155,10 +1165,6 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, · 89 unmodified lines
11551165 TUN_F_TSO_ECN | TUN_F_UFO))
11561166 return -EINVAL;
11571167
1158− /* TODO: only accept frames with the features that
1159− got enabled for forwarded frames */
1160− if (!(q->flags & IFF_VNET_HDR))
1161− return -EINVAL;
11621168 rtnl_lock();
11631169 ret = set_offload(q, arg);
11641170 rtnl_unlock();
drivers/net/phy/realtek.c+2−2
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 #define RTL821x_INER_INIT 0x6400
2424 #define RTL821x_INSR 0x13
2525
26−#define RTL8211E_INER_LINK_STAT 0x10
26+#define RTL8211E_INER_LINK_STATUS 0x400
2727
2828 MODULE_DESCRIPTION("Realtek PHY driver");
2929 MODULE_AUTHOR("Johnson Leung");
@@ -57,7 +57,7 @@ static int rtl8211e_config_intr(struct phy_device *phydev) · 27 unmodified lines
5757
5858 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
5959 err = phy_write(phydev, RTL821x_INER,
60− RTL8211E_INER_LINK_STAT);
60+ RTL8211E_INER_LINK_STATUS);
6161 else
6262 err = phy_write(phydev, RTL821x_INER, 0);
6363
drivers/net/tun.c+4−2
@@ -1074,8 +1074,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 1073 unmodified lines
10741074 u32 rxhash;
10751075
10761076 if (!(tun->flags & TUN_NO_PI)) {
1077− if ((len -= sizeof(pi)) > total_len)
1077+ if (len < sizeof(pi))
10781078 return -EINVAL;
1079+ len -= sizeof(pi);
10791080
10801081 if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi)))
10811082 return -EFAULT;
@@ -1083,8 +1084,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 1 unmodified line
10831084 }
10841085
10851086 if (tun->flags & TUN_VNET_HDR) {
1086− if ((len -= tun->vnet_hdr_sz) > total_len)
1087+ if (len < tun->vnet_hdr_sz)
10871088 return -EINVAL;
1089+ len -= tun->vnet_hdr_sz;
10881090
10891091 if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso)))
10901092 return -EFAULT;
drivers/net/usb/hso.c+10−5
@@ -2816,13 +2816,16 @@ exit: · 2815 unmodified lines
28162816 static int hso_get_config_data(struct usb_interface *interface)
28172817 {
28182818 struct usb_device *usbdev = interface_to_usbdev(interface);
2819− u8 config_data[17];
2819+ u8 *config_data = kmalloc(17, GFP_KERNEL);
28202820 u32 if_num = interface->altsetting->desc.bInterfaceNumber;
28212821 s32 result;
28222822
2823+ if (!config_data)
2824+ return -ENOMEM;
28232825 if (usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
28242826 0x86, 0xC0, 0, 0, config_data, 17,
28252827 USB_CTRL_SET_TIMEOUT) != 0x11) {
2828+ kfree(config_data);
28262829 return -EIO;
28272830 }
28282831
@@ -2873,6 +2876,7 @@ static int hso_get_config_data(struct usb_interface *interface) · 44 unmodified lines
28732876 if (config_data[16] & 0x1)
28742877 result |= HSO_INFO_CRC_BUG;
28752878
2879+ kfree(config_data);
28762880 return result;
28772881 }
28782882
@@ -2886,6 +2890,11 @@ static int hso_probe(struct usb_interface *interface, · 7 unmodified lines
28862890 struct hso_shared_int *shared_int;
28872891 struct hso_device *tmp_dev = NULL;
28882892
2893+ if (interface->cur_altsetting->desc.bInterfaceClass != 0xFF) {
2894+ dev_err(&interface->dev, "Not our interface\n");
2895+ return -ENODEV;
2896+ }
2897+
28892898 if_num = interface->altsetting->desc.bInterfaceNumber;
28902899
28912900 /* Get the interface/port specification from either driver_info or from
@@ -2895,10 +2904,6 @@ static int hso_probe(struct usb_interface *interface, · 3 unmodified lines
28952904 else
28962905 port_spec = hso_get_config_data(interface);
28972906
2898− if (interface->cur_altsetting->desc.bInterfaceClass != 0xFF) {
2899− dev_err(&interface->dev, "Not our interface\n");
2900− return -ENODEV;
2901− }
29022907 /* Check if we need to switch to alt interfaces prior to port
29032908 * configuration */
29042909 if (interface->num_altsetting > 1)
drivers/net/vxlan.c+1−3
@@ -1386,7 +1386,7 @@ static int vxlan_open(struct net_device *dev) · 1385 unmodified lines
13861386 return -ENOTCONN;
13871387
13881388 if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) &&
1389− ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) {
1389+ vxlan_group_used(vn, vxlan->default_dst.remote_ip)) {
13901390 vxlan_sock_hold(vs);
13911391 dev_hold(dev);
13921392 queue_work(vxlan_wq, &vxlan->igmp_join);
@@ -1793,8 +1793,6 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head) · 400 unmodified lines
17931793 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
17941794 struct vxlan_dev *vxlan = netdev_priv(dev);
17951795
1796− flush_workqueue(vxlan_wq);
1797−
17981796 spin_lock(&vn->sock_lock);
17991797 hlist_del_rcu(&vxlan->hlist);
18001798 spin_unlock(&vn->sock_lock);
drivers/net/wireless/cw1200/sta.c+2−5
@@ -1406,11 +1406,8 @@ static void cw1200_do_unjoin(struct cw1200_common *priv) · 1405 unmodified lines
14061406 if (!priv->join_status)
14071407 goto done;
14081408
1409− if (priv->join_status > CW1200_JOIN_STATUS_IBSS) {
1410− wiphy_err(priv->hw->wiphy, "Unexpected: join status: %d\n",
1411− priv->join_status);
1412− BUG_ON(1);
1413− }
1409+ if (priv->join_status == CW1200_JOIN_STATUS_AP)
1410+ goto done;
14141411
14151412 cancel_work_sync(&priv->update_filtering_work);
14161413 cancel_work_sync(&priv->set_beacon_wakeup_period_work);
drivers/net/wireless/hostap/hostap_ioctl.c+2−2
@@ -523,9 +523,9 @@ static int prism2_ioctl_giwaplist(struct net_device *dev, · 522 unmodified lines
523523
524524 data->length = prism2_ap_get_sta_qual(local, addr, qual, IW_MAX_AP, 1);
525525
526− memcpy(extra, &addr, sizeof(struct sockaddr) * data->length);
526+ memcpy(extra, addr, sizeof(struct sockaddr) * data->length);
527527 data->flags = 1; /* has quality information */
528− memcpy(extra + sizeof(struct sockaddr) * data->length, &qual,
528+ memcpy(extra + sizeof(struct sockaddr) * data->length, qual,
529529 sizeof(struct iw_quality) * data->length);
530530
531531 kfree(addr);
drivers/net/wireless/iwlegacy/4965-mac.c+8−8
@@ -4460,12 +4460,12 @@ il4965_irq_tasklet(struct il_priv *il) · 4459 unmodified lines
44604460 * is killed. Hence update the killswitch state here. The
44614461 * rfkill handler will care about restarting if needed.
44624462 */
4463− if (!test_bit(S_ALIVE, &il->status)) {
4464− if (hw_rf_kill)
4465− set_bit(S_RFKILL, &il->status);
4466− else
4467− clear_bit(S_RFKILL, &il->status);
4463+ if (hw_rf_kill) {
4464+ set_bit(S_RFKILL, &il->status);
4465+ } else {
4466+ clear_bit(S_RFKILL, &il->status);
44684467 wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill);
4468+ il_force_reset(il, true);
44694469 }
44704470
44714471 handled |= CSR_INT_BIT_RF_KILL;
@@ -5334,6 +5334,9 @@ il4965_alive_start(struct il_priv *il) · 862 unmodified lines
53345334
53355335 il->active_rate = RATES_MASK;
53365336
5337+ il_power_update_mode(il, true);
5338+ D_INFO("Updated power mode\n");
5339+
53375340 if (il_is_associated(il)) {
53385341 struct il_rxon_cmd *active_rxon =
53395342 (struct il_rxon_cmd *)&il->active;
@@ -5364,9 +5367,6 @@ il4965_alive_start(struct il_priv *il) · 24 unmodified lines
53645367 D_INFO("ALIVE processing complete.\n");
53655368 wake_up(&il->wait_command_queue);
53665369
5367− il_power_update_mode(il, true);
5368− D_INFO("Updated power mode\n");
5369−
53705370 return;
53715371
53725372 restart:
drivers/net/wireless/iwlegacy/common.c+1−0
@@ -4660,6 +4660,7 @@ il_force_reset(struct il_priv *il, bool external) · 4659 unmodified lines
46604660
46614661 return 0;
46624662 }
4663+EXPORT_SYMBOL(il_force_reset);
46634664
46644665 int
46654666 il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
drivers/net/wireless/iwlwifi/dvm/mac80211.c+4−1
@@ -1068,7 +1068,10 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success) · 1067 unmodified lines
10681068 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
10691069 return;
10701070
1071− if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
1071+ if (!test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
1072+ return;
1073+
1074+ if (ctx->vif)
10721075 ieee80211_chswitch_done(ctx->vif, is_success);
10731076 }
10741077
drivers/net/wireless/iwlwifi/iwl-prph.h+0−2
@@ -97,8 +97,6 @@ · 96 unmodified lines
9797
9898 #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800)
9999
100−#define APMG_RTC_INT_STT_RFKILL (0x10000000)
101−
102100 /* Device system time */
103101 #define DEVICE_SYSTEM_TIME_REG 0xA0206C
104102
drivers/net/wireless/iwlwifi/mvm/time-event.c+23−10
@@ -138,6 +138,20 @@ static void iwl_mvm_roc_finished(struct iwl_mvm *mvm) · 137 unmodified lines
138138 schedule_work(&mvm->roc_done_wk);
139139 }
140140
141+static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm,
142+ struct ieee80211_vif *vif,
143+ const char *errmsg)
144+{
145+ if (vif->type != NL80211_IFTYPE_STATION)
146+ return false;
147+ if (vif->bss_conf.assoc && vif->bss_conf.dtim_period)
148+ return false;
149+ if (errmsg)
150+ IWL_ERR(mvm, "%s\n", errmsg);
151+ ieee80211_connection_loss(vif);
152+ return true;
153+}
154+
141155 /*
142156 * Handles a FW notification for an event that is known to the driver.
143157 *
@@ -163,8 +177,13 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, · 19 unmodified lines
163177 * P2P Device discoveribility, while there are other higher priority
164178 * events in the system).
165179 */
166− WARN_ONCE(!le32_to_cpu(notif->status),
167− "Failed to schedule time event\n");
180+ if (WARN_ONCE(!le32_to_cpu(notif->status),
181+ "Failed to schedule time event\n")) {
182+ if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, NULL)) {
183+ iwl_mvm_te_clear_data(mvm, te_data);
184+ return;
185+ }
186+ }
168187
169188 if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_END) {
170189 IWL_DEBUG_TE(mvm,
@@ -180,14 +199,8 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, · 9 unmodified lines
180199 * By now, we should have finished association
181200 * and know the dtim period.
182201 */
183− if (te_data->vif->type == NL80211_IFTYPE_STATION &&
184− (!te_data->vif->bss_conf.assoc ||
185− !te_data->vif->bss_conf.dtim_period)) {
186− IWL_ERR(mvm,
187− "No assocation and the time event is over already...\n");
188− ieee80211_connection_loss(te_data->vif);
189− }
190−
202+ iwl_mvm_te_check_disconnect(mvm, te_data->vif,
203+ "No assocation and the time event is over already...");
191204 iwl_mvm_te_clear_data(mvm, te_data);
192205 } else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) {
193206 te_data->running = true;
drivers/net/wireless/iwlwifi/pcie/rx.c+0−8
@@ -888,14 +888,6 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) · 887 unmodified lines
888888
889889 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
890890 if (hw_rfkill) {
891− /*
892− * Clear the interrupt in APMG if the NIC is going down.
893− * Note that when the NIC exits RFkill (else branch), we
894− * can't access prph and the NIC will be reset in
895− * start_hw anyway.
896− */
897− iwl_write_prph(trans, APMG_RTC_INT_STT_REG,
898− APMG_RTC_INT_STT_RFKILL);
899891 set_bit(STATUS_RFKILL, &trans_pcie->status);
900892 if (test_and_clear_bit(STATUS_HCMD_ACTIVE,
901893 &trans_pcie->status))
drivers/net/wireless/iwlwifi/pcie/trans.c+5−5
@@ -1502,16 +1502,16 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 1501 unmodified lines
15021502 spin_lock_init(&trans_pcie->reg_lock);
15031503 init_waitqueue_head(&trans_pcie->ucode_write_waitq);
15041504
1505− /* W/A - seems to solve weird behavior. We need to remove this if we
1506− * don't want to stay in L1 all the time. This wastes a lot of power */
1507− pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
1508− PCIE_LINK_STATE_CLKPM);
1509−
15101505 if (pci_enable_device(pdev)) {
15111506 err = -ENODEV;
15121507 goto out_no_pci;
15131508 }
15141509
1510+ /* W/A - seems to solve weird behavior. We need to remove this if we
1511+ * don't want to stay in L1 all the time. This wastes a lot of power */
1512+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
1513+ PCIE_LINK_STATE_CLKPM);
1514+
15151515 pci_set_master(pdev);
15161516
15171517 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36));
drivers/net/wireless/zd1201.c+3−1
@@ -98,10 +98,12 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw) · 97 unmodified lines
9898 goto exit;
9999
100100 err = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0x4,
101− USB_DIR_IN | 0x40, 0,0, &ret, sizeof(ret), ZD1201_FW_TIMEOUT);
101+ USB_DIR_IN | 0x40, 0, 0, buf, sizeof(ret), ZD1201_FW_TIMEOUT);
102102 if (err < 0)
103103 goto exit;
104104
105+ memcpy(&ret, buf, sizeof(ret));
106+
105107 if (ret & 0x80) {
106108 err = -EIO;
107109 goto exit;
drivers/of/fdt.c+2−0
@@ -392,6 +392,8 @@ static void __unflatten_device_tree(struct boot_param_header *blob, · 391 unmodified lines
392392 mem = (unsigned long)
393393 dt_alloc(size + 4, __alignof__(struct device_node));
394394
395+ memset((void *)mem, 0, size);
396+
395397 ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
396398
397399 pr_debug(" unflattening %lx...\n", mem);
drivers/pinctrl/pinctrl-sunxi.c+62−4
@@ -278,6 +278,7 @@ static int sunxi_pconf_group_set(struct pinctrl_dev *pctldev, · 277 unmodified lines
278278 {
279279 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
280280 struct sunxi_pinctrl_group *g = &pctl->groups[group];
281+ unsigned long flags;
281282 u32 val, mask;
282283 u16 strength;
283284 u8 dlevel;
@@ -295,22 +296,35 @@ static int sunxi_pconf_group_set(struct pinctrl_dev *pctldev, · 11 unmodified lines
295296 * 3: 40mA
296297 */
297298 dlevel = strength / 10 - 1;
299+
300+ spin_lock_irqsave(&pctl->lock, flags);
301+
298302 val = readl(pctl->membase + sunxi_dlevel_reg(g->pin));
299303 mask = DLEVEL_PINS_MASK << sunxi_dlevel_offset(g->pin);
300304 writel((val & ~mask) | dlevel << sunxi_dlevel_offset(g->pin),
301305 pctl->membase + sunxi_dlevel_reg(g->pin));
306+
307+ spin_unlock_irqrestore(&pctl->lock, flags);
302308 break;
303309 case PIN_CONFIG_BIAS_PULL_UP:
310+ spin_lock_irqsave(&pctl->lock, flags);
311+
304312 val = readl(pctl->membase + sunxi_pull_reg(g->pin));
305313 mask = PULL_PINS_MASK << sunxi_pull_offset(g->pin);
306314 writel((val & ~mask) | 1 << sunxi_pull_offset(g->pin),
307315 pctl->membase + sunxi_pull_reg(g->pin));
316+
317+ spin_unlock_irqrestore(&pctl->lock, flags);
308318 break;
309319 case PIN_CONFIG_BIAS_PULL_DOWN:
320+ spin_lock_irqsave(&pctl->lock, flags);
321+
310322 val = readl(pctl->membase + sunxi_pull_reg(g->pin));
311323 mask = PULL_PINS_MASK << sunxi_pull_offset(g->pin);
312324 writel((val & ~mask) | 2 << sunxi_pull_offset(g->pin),
313325 pctl->membase + sunxi_pull_reg(g->pin));
326+
327+ spin_unlock_irqrestore(&pctl->lock, flags);
314328 break;
315329 default:
316330 break;
@@ -360,11 +374,17 @@ static void sunxi_pmx_set(struct pinctrl_dev *pctldev, · 43 unmodified lines
360374 u8 config)
361375 {
362376 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
377+ unsigned long flags;
378+ u32 val, mask;
379+
380+ spin_lock_irqsave(&pctl->lock, flags);
363381
364− u32 val = readl(pctl->membase + sunxi_mux_reg(pin));
365− u32 mask = MUX_PINS_MASK << sunxi_mux_offset(pin);
382+ val = readl(pctl->membase + sunxi_mux_reg(pin));
383+ mask = MUX_PINS_MASK << sunxi_mux_offset(pin);
366384 writel((val & ~mask) | config << sunxi_mux_offset(pin),
367385 pctl->membase + sunxi_mux_reg(pin));
386+
387+ spin_unlock_irqrestore(&pctl->lock, flags);
368388 }
369389
370390 static int sunxi_pmx_enable(struct pinctrl_dev *pctldev,
@@ -464,8 +484,21 @@ static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip, · 93 unmodified lines
464484 struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
465485 u32 reg = sunxi_data_reg(offset);
466486 u8 index = sunxi_data_offset(offset);
487+ unsigned long flags;
488+ u32 regval;
489+
490+ spin_lock_irqsave(&pctl->lock, flags);
491+
492+ regval = readl(pctl->membase + reg);
467493
468− writel((value & DATA_PINS_MASK) << index, pctl->membase + reg);
494+ if (value)
495+ regval |= BIT(index);
496+ else
497+ regval &= ~(BIT(index));
498+
499+ writel(regval, pctl->membase + reg);
500+
501+ spin_unlock_irqrestore(&pctl->lock, flags);
469502 }
470503
471504 static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
@@ -526,6 +559,8 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, · 54 unmodified lines
526559 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
527560 u32 reg = sunxi_irq_cfg_reg(d->hwirq);
528561 u8 index = sunxi_irq_cfg_offset(d->hwirq);
562+ unsigned long flags;
563+ u32 regval;
529564 u8 mode;
530565
531566 switch (type) {
@@ -548,7 +583,13 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, · 16 unmodified lines
548583 return -EINVAL;
549584 }
550585
551− writel((mode & IRQ_CFG_IRQ_MASK) << index, pctl->membase + reg);
586+ spin_lock_irqsave(&pctl->lock, flags);
587+
588+ regval = readl(pctl->membase + reg);
589+ regval &= ~IRQ_CFG_IRQ_MASK;
590+ writel(regval | (mode << index), pctl->membase + reg);
591+
592+ spin_unlock_irqrestore(&pctl->lock, flags);
552593
553594 return 0;
554595 }
@@ -560,14 +601,19 @@ static void sunxi_pinctrl_irq_mask_ack(struct irq_data *d) · 5 unmodified lines
560601 u8 ctrl_idx = sunxi_irq_ctrl_offset(d->hwirq);
561602 u32 status_reg = sunxi_irq_status_reg(d->hwirq);
562603 u8 status_idx = sunxi_irq_status_offset(d->hwirq);
604+ unsigned long flags;
563605 u32 val;
564606
607+ spin_lock_irqsave(&pctl->lock, flags);
608+
565609 /* Mask the IRQ */
566610 val = readl(pctl->membase + ctrl_reg);
567611 writel(val & ~(1 << ctrl_idx), pctl->membase + ctrl_reg);
568612
569613 /* Clear the IRQ */
570614 writel(1 << status_idx, pctl->membase + status_reg);
615+
616+ spin_unlock_irqrestore(&pctl->lock, flags);
571617 }
572618
573619 static void sunxi_pinctrl_irq_mask(struct irq_data *d)
@@ -575,11 +621,16 @@ static void sunxi_pinctrl_irq_mask(struct irq_data *d) · 1 unmodified line
575621 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
576622 u32 reg = sunxi_irq_ctrl_reg(d->hwirq);
577623 u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
624+ unsigned long flags;
578625 u32 val;
579626
627+ spin_lock_irqsave(&pctl->lock, flags);
628+
580629 /* Mask the IRQ */
581630 val = readl(pctl->membase + reg);
582631 writel(val & ~(1 << idx), pctl->membase + reg);
632+
633+ spin_unlock_irqrestore(&pctl->lock, flags);
583634 }
584635
585636 static void sunxi_pinctrl_irq_unmask(struct irq_data *d)
@@ -588,6 +639,7 @@ static void sunxi_pinctrl_irq_unmask(struct irq_data *d) · 2 unmodified lines
588639 struct sunxi_desc_function *func;
589640 u32 reg = sunxi_irq_ctrl_reg(d->hwirq);
590641 u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
642+ unsigned long flags;
591643 u32 val;
592644
593645 func = sunxi_pinctrl_desc_find_function_by_pin(pctl,
@@ -597,9 +649,13 @@ static void sunxi_pinctrl_irq_unmask(struct irq_data *d) · 3 unmodified lines
597649 /* Change muxing to INT mode */
598650 sunxi_pmx_set(pctl->pctl_dev, pctl->irq_array[d->hwirq], func->muxval);
599651
652+ spin_lock_irqsave(&pctl->lock, flags);
653+
600654 /* Unmask the IRQ */
601655 val = readl(pctl->membase + reg);
602656 writel(val | (1 << idx), pctl->membase + reg);
657+
658+ spin_unlock_irqrestore(&pctl->lock, flags);
603659 }
604660
605661 static struct irq_chip sunxi_pinctrl_irq_chip = {
@@ -752,6 +808,8 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) · 146 unmodified lines
752808 return -ENOMEM;
753809 platform_set_drvdata(pdev, pctl);
754810
811+ spin_lock_init(&pctl->lock);
812+
755813 pctl->membase = of_iomap(node, 0);
756814 if (!pctl->membase)
757815 return -ENOMEM;
drivers/pinctrl/pinctrl-sunxi.h+2−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #define __PINCTRL_SUNXI_H
1515
1616 #include <linux/kernel.h>
17+#include <linux/spinlock.h>
1718
1819 #define PA_BASE 0
1920 #define PB_BASE 32
@@ -407,6 +408,7 @@ struct sunxi_pinctrl { · 387 unmodified lines
407408 unsigned ngroups;
408409 int irq;
409410 int irq_array[SUNXI_IRQ_NUMBER];
411+ spinlock_t lock;
410412 struct pinctrl_dev *pctl_dev;
411413 };
412414
drivers/platform/olpc/olpc-ec.c+1−1
@@ -330,7 +330,7 @@ static int __init olpc_ec_init_module(void) · 329 unmodified lines
330330 return platform_driver_register(&olpc_ec_plat_driver);
331331 }
332332
333−module_init(olpc_ec_init_module);
333+arch_initcall(olpc_ec_init_module);
334334
335335 MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
336336 MODULE_LICENSE("GPL");
drivers/platform/x86/hp-wmi.c+0−16
@@ -53,7 +53,6 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4"); · 52 unmodified lines
5353 #define HPWMI_ALS_QUERY 0x3
5454 #define HPWMI_HARDWARE_QUERY 0x4
5555 #define HPWMI_WIRELESS_QUERY 0x5
56−#define HPWMI_BIOS_QUERY 0x9
5756 #define HPWMI_HOTKEY_QUERY 0xc
5857 #define HPWMI_WIRELESS2_QUERY 0x1b
5958 #define HPWMI_POSTCODEERROR_QUERY 0x2a
@@ -293,19 +292,6 @@ static int hp_wmi_tablet_state(void) · 233 unmodified lines
293292 return (state & 0x4) ? 1 : 0;
294293 }
295294
296−static int hp_wmi_enable_hotkeys(void)
297−{
298− int ret;
299− int query = 0x6e;
300−
301− ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &query, sizeof(query),
302− 0);
303−
304− if (ret)
305− return -EINVAL;
306− return 0;
307−}
308−
309295 static int hp_wmi_set_block(void *data, bool blocked)
310296 {
311297 enum hp_wmi_radio r = (enum hp_wmi_radio) data;
@@ -1009,8 +995,6 @@ static int __init hp_wmi_init(void) · 697 unmodified lines
1009995 err = hp_wmi_input_setup();
1010996 if (err)
1011997 return err;
1012−
1013− hp_wmi_enable_hotkeys();
1014998 }
1015999
10161000 if (bios_capable) {
drivers/platform/x86/sony-laptop.c+6−2
@@ -2440,7 +2440,10 @@ static ssize_t sony_nc_gfx_switch_status_show(struct device *dev, · 2439 unmodified lines
24402440 if (pos < 0)
24412441 return pos;
24422442
2443− return snprintf(buffer, PAGE_SIZE, "%s\n", pos ? "speed" : "stamina");
2443+ return snprintf(buffer, PAGE_SIZE, "%s\n",
2444+ pos == SPEED ? "speed" :
2445+ pos == STAMINA ? "stamina" :
2446+ pos == AUTO ? "auto" : "unknown");
24442447 }
24452448
24462449 static int sony_nc_gfx_switch_setup(struct platform_device *pd,
@@ -4320,7 +4323,8 @@ static int sony_pic_add(struct acpi_device *device) · 1873 unmodified lines
43204323 goto err_free_resources;
43214324 }
43224325
4323− if (sonypi_compat_init())
4326+ result = sonypi_compat_init();
4327+ if (result)
43244328 goto err_remove_input;
43254329
43264330 /* request io port */
drivers/rtc/rtc-stmp3xxx.c+25−10
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <linux/init.h>
2424 #include <linux/platform_device.h>
2525 #include <linux/interrupt.h>
26+#include <linux/delay.h>
2627 #include <linux/rtc.h>
2728 #include <linux/slab.h>
2829 #include <linux/of_device.h>
@@ -119,24 +120,39 @@ static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev) · 90 unmodified lines
119120 }
120121 #endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */
121122
122−static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)
123+static int stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)
123124 {
125+ int timeout = 5000; /* 3ms according to i.MX28 Ref Manual */
124126 /*
125− * The datasheet doesn't say which way round the
126− * NEW_REGS/STALE_REGS bitfields go. In fact it's 0x1=P0,
127− * 0x2=P1, .., 0x20=P5, 0x40=ALARM, 0x80=SECONDS
127+ * The i.MX28 Applications Processor Reference Manual, Rev. 1, 2010
128+ * states:
129+ * | The order in which registers are updated is
130+ * | Persistent 0, 1, 2, 3, 4, 5, Alarm, Seconds.
131+ * | (This list is in bitfield order, from LSB to MSB, as they would
132+ * | appear in the STALE_REGS and NEW_REGS bitfields of the HW_RTC_STAT
133+ * | register. For example, the Seconds register corresponds to
134+ * | STALE_REGS or NEW_REGS containing 0x80.)
128135 */
129− while (readl(rtc_data->io + STMP3XXX_RTC_STAT) &
130− (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT))
131− cpu_relax();
136+ do {
137+ if (!(readl(rtc_data->io + STMP3XXX_RTC_STAT) &
138+ (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)))
139+ return 0;
140+ udelay(1);
141+ } while (--timeout > 0);
142+ return (readl(rtc_data->io + STMP3XXX_RTC_STAT) &
143+ (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)) ? -ETIME : 0;
132144 }
133145
134146 /* Time read/write */
135147 static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
136148 {
149+ int ret;
137150 struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);
138151
139− stmp3xxx_wait_time(rtc_data);
152+ ret = stmp3xxx_wait_time(rtc_data);
153+ if (ret)
154+ return ret;
155+
140156 rtc_time_to_tm(readl(rtc_data->io + STMP3XXX_RTC_SECONDS), rtc_tm);
141157 return 0;
142158 }
@@ -146,8 +162,7 @@ static int stmp3xxx_rtc_set_mmss(struct device *dev, unsigned long t) · 3 unmodified lines
146162 struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);
147163
148164 writel(t, rtc_data->io + STMP3XXX_RTC_SECONDS);
149− stmp3xxx_wait_time(rtc_data);
150− return 0;
165+ return stmp3xxx_wait_time(rtc_data);
151166 }
152167
153168 /* interrupt(s) handler */
drivers/s390/scsi/zfcp_erp.c+22−7
@@ -102,10 +102,13 @@ static void zfcp_erp_action_dismiss_port(struct zfcp_port *port) · 101 unmodified lines
102102
103103 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
104104 zfcp_erp_action_dismiss(&port->erp_action);
105− else
106− shost_for_each_device(sdev, port->adapter->scsi_host)
105+ else {
106+ spin_lock(port->adapter->scsi_host->host_lock);
107+ __shost_for_each_device(sdev, port->adapter->scsi_host)
107108 if (sdev_to_zfcp(sdev)->port == port)
108109 zfcp_erp_action_dismiss_lun(sdev);
110+ spin_unlock(port->adapter->scsi_host->host_lock);
111+ }
109112 }
110113
111114 static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
@@ -592,9 +595,11 @@ static void _zfcp_erp_lun_reopen_all(struct zfcp_port *port, int clear, · 480 unmodified lines
592595 {
593596 struct scsi_device *sdev;
594597
595− shost_for_each_device(sdev, port->adapter->scsi_host)
598+ spin_lock(port->adapter->scsi_host->host_lock);
599+ __shost_for_each_device(sdev, port->adapter->scsi_host)
596600 if (sdev_to_zfcp(sdev)->port == port)
597601 _zfcp_erp_lun_reopen(sdev, clear, id, 0);
602+ spin_unlock(port->adapter->scsi_host->host_lock);
598603 }
599604
600605 static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
@@ -1434,8 +1439,10 @@ void zfcp_erp_set_adapter_status(struct zfcp_adapter *adapter, u32 mask) · 833 unmodified lines
14341439 atomic_set_mask(common_mask, &port->status);
14351440 read_unlock_irqrestore(&adapter->port_list_lock, flags);
14361441
1437− shost_for_each_device(sdev, adapter->scsi_host)
1442+ spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
1443+ __shost_for_each_device(sdev, adapter->scsi_host)
14381444 atomic_set_mask(common_mask, &sdev_to_zfcp(sdev)->status);
1445+ spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
14391446 }
14401447
14411448 /**
@@ -1469,11 +1476,13 @@ void zfcp_erp_clear_adapter_status(struct zfcp_adapter *adapter, u32 mask) · 27 unmodified lines
14691476 }
14701477 read_unlock_irqrestore(&adapter->port_list_lock, flags);
14711478
1472− shost_for_each_device(sdev, adapter->scsi_host) {
1479+ spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
1480+ __shost_for_each_device(sdev, adapter->scsi_host) {
14731481 atomic_clear_mask(common_mask, &sdev_to_zfcp(sdev)->status);
14741482 if (clear_counter)
14751483 atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
14761484 }
1485+ spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
14771486 }
14781487
14791488 /**
@@ -1487,16 +1496,19 @@ void zfcp_erp_set_port_status(struct zfcp_port *port, u32 mask) · 7 unmodified lines
14871496 {
14881497 struct scsi_device *sdev;
14891498 u32 common_mask = mask & ZFCP_COMMON_FLAGS;
1499+ unsigned long flags;
14901500
14911501 atomic_set_mask(mask, &port->status);
14921502
14931503 if (!common_mask)
14941504 return;
14951505
1496− shost_for_each_device(sdev, port->adapter->scsi_host)
1506+ spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
1507+ __shost_for_each_device(sdev, port->adapter->scsi_host)
14971508 if (sdev_to_zfcp(sdev)->port == port)
14981509 atomic_set_mask(common_mask,
14991510 &sdev_to_zfcp(sdev)->status);
1511+ spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
15001512 }
15011513
15021514 /**
@@ -1511,6 +1523,7 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask) · 8 unmodified lines
15111523 struct scsi_device *sdev;
15121524 u32 common_mask = mask & ZFCP_COMMON_FLAGS;
15131525 u32 clear_counter = mask & ZFCP_STATUS_COMMON_ERP_FAILED;
1526+ unsigned long flags;
15141527
15151528 atomic_clear_mask(mask, &port->status);
15161529
@@ -1520,13 +1533,15 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask) · 3 unmodified lines
15201533 if (clear_counter)
15211534 atomic_set(&port->erp_counter, 0);
15221535
1523− shost_for_each_device(sdev, port->adapter->scsi_host)
1536+ spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
1537+ __shost_for_each_device(sdev, port->adapter->scsi_host)
15241538 if (sdev_to_zfcp(sdev)->port == port) {
15251539 atomic_clear_mask(common_mask,
15261540 &sdev_to_zfcp(sdev)->status);
15271541 if (clear_counter)
15281542 atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
15291543 }
1544+ spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
15301545 }
15311546
15321547 /**
drivers/s390/scsi/zfcp_qdio.c+2−6
@@ -224,11 +224,9 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req, · 223 unmodified lines
224224
225225 static int zfcp_qdio_sbal_check(struct zfcp_qdio *qdio)
226226 {
227− spin_lock_irq(&qdio->req_q_lock);
228227 if (atomic_read(&qdio->req_q_free) ||
229228 !(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
230229 return 1;
231− spin_unlock_irq(&qdio->req_q_lock);
232230 return 0;
233231 }
234232
@@ -246,9 +244,8 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio) · 11 unmodified lines
246244 {
247245 long ret;
248246
249− spin_unlock_irq(&qdio->req_q_lock);
250− ret = wait_event_interruptible_timeout(qdio->req_q_wq,
251− zfcp_qdio_sbal_check(qdio), 5 * HZ);
247+ ret = wait_event_interruptible_lock_irq_timeout(qdio->req_q_wq,
248+ zfcp_qdio_sbal_check(qdio), qdio->req_q_lock, 5 * HZ);
252249
253250 if (!(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
254251 return -EIO;
@@ -262,7 +259,6 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio) · 7 unmodified lines
262259 zfcp_erp_adapter_reopen(qdio->adapter, 0, "qdsbg_1");
263260 }
264261
265− spin_lock_irq(&qdio->req_q_lock);
266262 return -EIO;
267263 }
268264
drivers/s390/scsi/zfcp_sysfs.c+14−0
@@ -27,6 +27,16 @@ static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev, \ · 26 unmodified lines
2727 static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO, \
2828 zfcp_sysfs_##_feat##_##_name##_show, NULL);
2929
30+#define ZFCP_DEFINE_ATTR_CONST(_feat, _name, _format, _value) \
31+static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev, \
32+ struct device_attribute *at,\
33+ char *buf) \
34+{ \
35+ return sprintf(buf, _format, _value); \
36+} \
37+static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO, \
38+ zfcp_sysfs_##_feat##_##_name##_show, NULL);
39+
3040 #define ZFCP_DEFINE_A_ATTR(_name, _format, _value) \
3141 static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, \
3242 struct device_attribute *at,\
@@ -75,6 +85,8 @@ ZFCP_DEFINE_ATTR(zfcp_unit, unit, in_recovery, "%d\n", · 42 unmodified lines
7585 ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_denied, "%d\n",
7686 (zfcp_unit_sdev_status(unit) &
7787 ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
88+ZFCP_DEFINE_ATTR_CONST(unit, access_shared, "%d\n", 0);
89+ZFCP_DEFINE_ATTR_CONST(unit, access_readonly, "%d\n", 0);
7890
7991 static ssize_t zfcp_sysfs_port_failed_show(struct device *dev,
8092 struct device_attribute *attr,
@@ -347,6 +359,8 @@ static struct attribute *zfcp_unit_attrs[] = { · 266 unmodified lines
347359 &dev_attr_unit_in_recovery.attr,
348360 &dev_attr_unit_status.attr,
349361 &dev_attr_unit_access_denied.attr,
362+ &dev_attr_unit_access_shared.attr,
363+ &dev_attr_unit_access_readonly.attr,
350364 NULL
351365 };
352366 static struct attribute_group zfcp_unit_attr_group = {
drivers/scsi/Kconfig+0−1
@@ -1353,7 +1353,6 @@ config SCSI_LPFC · 1352 unmodified lines
13531353 tristate "Emulex LightPulse Fibre Channel Support"
13541354 depends on PCI && SCSI
13551355 select SCSI_FC_ATTRS
1356− select GENERIC_CSUM
13571356 select CRC_T10DIF
13581357 help
13591358 This lpfc driver supports the Emulex LightPulse
drivers/staging/comedi/drivers.c+1−1
@@ -482,7 +482,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) · 481 unmodified lines
482482 ret = comedi_device_postconfig(dev);
483483 if (ret < 0) {
484484 comedi_device_detach(dev);
485− module_put(dev->driver->module);
485+ module_put(driv->module);
486486 }
487487 /* On success, the driver module count has been incremented. */
488488 return ret;
drivers/tty/hvc/hvsi_lib.c+2−2
@@ -341,8 +341,8 @@ void hvsilib_establish(struct hvsi_priv *pv) · 340 unmodified lines
341341
342342 pr_devel("HVSI@%x: ... waiting handshake\n", pv->termno);
343343
344− /* Try for up to 200s */
345− for (timeout = 0; timeout < 20; timeout++) {
344+ /* Try for up to 400ms */
345+ for (timeout = 0; timeout < 40; timeout++) {
346346 if (pv->established)
347347 goto established;
348348 if (!hvsi_get_packet(pv))
drivers/usb/class/usbtmc.c+4−4
@@ -1119,11 +1119,11 @@ static int usbtmc_probe(struct usb_interface *intf, · 1118 unmodified lines
11191119 /* Determine if it is a Rigol or not */
11201120 data->rigol_quirk = 0;
11211121 dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n",
1122− data->usb_dev->descriptor.idVendor,
1123− data->usb_dev->descriptor.idProduct);
1122+ le16_to_cpu(data->usb_dev->descriptor.idVendor),
1123+ le16_to_cpu(data->usb_dev->descriptor.idProduct));
11241124 for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) {
1125− if ((usbtmc_id_quirk[n].idVendor == data->usb_dev->descriptor.idVendor) &&
1126− (usbtmc_id_quirk[n].idProduct == data->usb_dev->descriptor.idProduct)) {
1125+ if ((usbtmc_id_quirk[n].idVendor == le16_to_cpu(data->usb_dev->descriptor.idVendor)) &&
1126+ (usbtmc_id_quirk[n].idProduct == le16_to_cpu(data->usb_dev->descriptor.idProduct))) {
11271127 dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n");
11281128 data->rigol_quirk = 1;
11291129 break;
drivers/usb/core/quirks.c+6−0
@@ -78,6 +78,12 @@ static const struct usb_device_id usb_quirk_list[] = { · 77 unmodified lines
7878 { USB_DEVICE(0x04d8, 0x000c), .driver_info =
7979 USB_QUIRK_CONFIG_INTF_STRINGS },
8080
81+ /* CarrolTouch 4000U */
82+ { USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME },
83+
84+ /* CarrolTouch 4500U */
85+ { USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME },
86+
8187 /* Samsung Android phone modem - ID conflict with SPH-I500 */
8288 { USB_DEVICE(0x04e8, 0x6601), .driver_info =
8389 USB_QUIRK_CONFIG_INTF_STRINGS },
drivers/usb/host/ehci-sched.c+6−7
@@ -1391,21 +1391,20 @@ iso_stream_schedule ( · 1390 unmodified lines
13911391
13921392 /* Behind the scheduling threshold? */
13931393 if (unlikely(start < next)) {
1394+ unsigned now2 = (now - base) & (mod - 1);
13941395
13951396 /* USB_ISO_ASAP: Round up to the first available slot */
13961397 if (urb->transfer_flags & URB_ISO_ASAP)
13971398 start += (next - start + period - 1) & -period;
13981399
13991400 /*
1400− * Not ASAP: Use the next slot in the stream. If
1401− * the entire URB falls before the threshold, fail.
1401+ * Not ASAP: Use the next slot in the stream,
1402+ * no matter what.
14021403 */
1403− else if (start + span - period < next) {
1404− ehci_dbg(ehci, "iso urb late %p (%u+%u < %u)\n",
1404+ else if (start + span - period < now2) {
1405+ ehci_dbg(ehci, "iso underrun %p (%u+%u < %u)\n",
14051406 urb, start + base,
1406− span - period, next + base);
1407− status = -EXDEV;
1408− goto fail;
1407+ span - period, now2 + base);
14091408 }
14101409 }
14111410
drivers/usb/host/ohci-pci.c+7−0
@@ -304,6 +304,13 @@ static int __init ohci_pci_init(void) · 303 unmodified lines
304304 pr_info("%s: " DRIVER_DESC "\n", hcd_name);
305305
306306 ohci_init_driver(&ohci_pci_hc_driver, &pci_overrides);
307+
308+#ifdef CONFIG_PM
309+ /* Entries for the PCI suspend/resume callbacks are special */
310+ ohci_pci_hc_driver.pci_suspend = ohci_suspend;
311+ ohci_pci_hc_driver.pci_resume = ohci_resume;
312+#endif
313+
307314 return pci_register_driver(&ohci_pci_driver);
308315 }
309316 module_init(ohci_pci_init);
drivers/usb/misc/adutux.c+1−1
@@ -830,7 +830,7 @@ static int adu_probe(struct usb_interface *interface, · 829 unmodified lines
830830
831831 /* let the user know what node this device is now attached to */
832832 dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n",
833− udev->descriptor.idProduct, dev->serial_number,
833+ le16_to_cpu(udev->descriptor.idProduct), dev->serial_number,
834834 (dev->minor - ADU_MINOR_BASE));
835835 exit:
836836 dbg(2, " %s : leave, return value %p (dev)", __func__, dev);
drivers/usb/phy/phy-fsl-usb.h+1−1
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515 * 675 Mass Ave, Cambridge, MA 02139, USA.
1616 */
1717
18−#include "otg_fsm.h"
18+#include "phy-fsm-usb.h"
1919 #include <linux/usb/otg.h>
2020 #include <linux/ioctl.h>
2121
drivers/usb/phy/phy-fsm-usb.c+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include <linux/usb/gadget.h>
3030 #include <linux/usb/otg.h>
3131
32−#include "phy-otg-fsm.h"
32+#include "phy-fsm-usb.h"
3333
3434 /* Change USB protocol when there is a protocol change */
3535 static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
drivers/usb/serial/keyspan.c+1−1
@@ -2303,7 +2303,7 @@ static int keyspan_startup(struct usb_serial *serial) · 2302 unmodified lines
23032303 if (d_details == NULL) {
23042304 dev_err(&serial->dev->dev, "%s - unknown product id %x\n",
23052305 __func__, le16_to_cpu(serial->dev->descriptor.idProduct));
2306− return 1;
2306+ return -ENODEV;
23072307 }
23082308
23092309 /* Setup private data for serial driver */
drivers/usb/serial/mos7720.c+14−7
@@ -90,6 +90,7 @@ struct urbtracker { · 89 unmodified lines
9090 struct list_head urblist_entry;
9191 struct kref ref_count;
9292 struct urb *urb;
93+ struct usb_ctrlrequest *setup;
9394 };
9495
9596 enum mos7715_pp_modes {
@@ -271,6 +272,7 @@ static void destroy_urbtracker(struct kref *kref) · 175 unmodified lines
271272 struct mos7715_parport *mos_parport = urbtrack->mos_parport;
272273
273274 usb_free_urb(urbtrack->urb);
275+ kfree(urbtrack->setup);
274276 kfree(urbtrack);
275277 kref_put(&mos_parport->ref_count, destroy_mos_parport);
276278 }
@@ -355,7 +357,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, · 78 unmodified lines
355357 struct urbtracker *urbtrack;
356358 int ret_val;
357359 unsigned long flags;
358− struct usb_ctrlrequest setup;
359360 struct usb_serial *serial = mos_parport->serial;
360361 struct usb_device *usbdev = serial->dev;
361362
@@ -373,14 +374,20 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, · 11 unmodified lines
373374 kfree(urbtrack);
374375 return -ENOMEM;
375376 }
376− setup.bRequestType = (__u8)0x40;
377− setup.bRequest = (__u8)0x0e;
378− setup.wValue = get_reg_value(reg, dummy);
379− setup.wIndex = get_reg_index(reg);
380− setup.wLength = 0;
377+ urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_KERNEL);
378+ if (!urbtrack->setup) {
379+ usb_free_urb(urbtrack->urb);
380+ kfree(urbtrack);
381+ return -ENOMEM;
382+ }
383+ urbtrack->setup->bRequestType = (__u8)0x40;
384+ urbtrack->setup->bRequest = (__u8)0x0e;
385+ urbtrack->setup->wValue = get_reg_value(reg, dummy);
386+ urbtrack->setup->wIndex = get_reg_index(reg);
387+ urbtrack->setup->wLength = 0;
381388 usb_fill_control_urb(urbtrack->urb, usbdev,
382389 usb_sndctrlpipe(usbdev, 0),
383− (unsigned char *)&setup,
390+ (unsigned char *)urbtrack->setup,
384391 NULL, 0, async_complete, urbtrack);
385392 kref_init(&urbtrack->ref_count);
386393 INIT_LIST_HEAD(&urbtrack->urblist_entry);
drivers/usb/serial/mos7840.c+1−1
@@ -2193,7 +2193,7 @@ static int mos7810_check(struct usb_serial *serial) · 2192 unmodified lines
21932193 static int mos7840_probe(struct usb_serial *serial,
21942194 const struct usb_device_id *id)
21952195 {
2196− u16 product = serial->dev->descriptor.idProduct;
2196+ u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
21972197 u8 *buf;
21982198 int device_type;
21992199
drivers/usb/serial/ti_usb_3410_5052.c+5−4
@@ -1536,14 +1536,15 @@ static int ti_download_firmware(struct ti_device *tdev) · 1535 unmodified lines
15361536 char buf[32];
15371537
15381538 /* try ID specific firmware first, then try generic firmware */
1539− sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor,
1540− dev->descriptor.idProduct);
1539+ sprintf(buf, "ti_usb-v%04x-p%04x.fw",
1540+ le16_to_cpu(dev->descriptor.idVendor),
1541+ le16_to_cpu(dev->descriptor.idProduct));
15411542 status = request_firmware(&fw_p, buf, &dev->dev);
15421543
15431544 if (status != 0) {
15441545 buf[0] = '\0';
1545− if (dev->descriptor.idVendor == MTS_VENDOR_ID) {
1546− switch (dev->descriptor.idProduct) {
1546+ if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) {
1547+ switch (le16_to_cpu(dev->descriptor.idProduct)) {
15471548 case MTS_CDMA_PRODUCT_ID:
15481549 strcpy(buf, "mts_cdma.fw");
15491550 break;
drivers/usb/serial/usb_wwan.c+10−10
@@ -291,18 +291,18 @@ static void usb_wwan_indat_callback(struct urb *urb) · 290 unmodified lines
291291 tty_flip_buffer_push(&port->port);
292292 } else
293293 dev_dbg(dev, "%s: empty read urb received\n", __func__);
294−
295− /* Resubmit urb so we continue receiving */
296− err = usb_submit_urb(urb, GFP_ATOMIC);
297− if (err) {
298− if (err != -EPERM) {
299− dev_err(dev, "%s: resubmit read urb failed. (%d)\n", __func__, err);
300− /* busy also in error unless we are killed */
301− usb_mark_last_busy(port->serial->dev);
302− }
303− } else {
294+ }
295+ /* Resubmit urb so we continue receiving */
296+ err = usb_submit_urb(urb, GFP_ATOMIC);
297+ if (err) {
298+ if (err != -EPERM) {
299+ dev_err(dev, "%s: resubmit read urb failed. (%d)\n",
300+ __func__, err);
301+ /* busy also in error unless we are killed */
304302 usb_mark_last_busy(port->serial->dev);
305303 }
304+ } else {
305+ usb_mark_last_busy(port->serial->dev);
306306 }
307307 }
308308
drivers/usb/wusbcore/wa-xfer.c+7−2
@@ -1226,6 +1226,12 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb) · 1225 unmodified lines
12261226 }
12271227 spin_lock_irqsave(&xfer->lock, flags);
12281228 rpipe = xfer->ep->hcpriv;
1229+ if (rpipe == NULL) {
1230+ pr_debug("%s: xfer id 0x%08X has no RPIPE. %s",
1231+ __func__, wa_xfer_id(xfer),
1232+ "Probably already aborted.\n" );
1233+ goto out_unlock;
1234+ }
12291235 /* Check the delayed list -> if there, release and complete */
12301236 spin_lock_irqsave(&wa->xfer_list_lock, flags2);
12311237 if (!list_empty(&xfer->list_node) && xfer->seg == NULL)
@@ -1644,8 +1650,7 @@ static void wa_xfer_result_cb(struct urb *urb) · 412 unmodified lines
16441650 break;
16451651 }
16461652 usb_status = xfer_result->bTransferStatus & 0x3f;
1647− if (usb_status == WA_XFER_STATUS_ABORTED
1648− || usb_status == WA_XFER_STATUS_NOT_FOUND)
1653+ if (usb_status == WA_XFER_STATUS_NOT_FOUND)
16491654 /* taken care of already */
16501655 break;
16511656 xfer_id = xfer_result->dwTransferID;
drivers/xen/events.c+12−1
@@ -348,7 +348,7 @@ static void init_evtchn_cpu_bindings(void) · 347 unmodified lines
348348
349349 for_each_possible_cpu(i)
350350 memset(per_cpu(cpu_evtchn_mask, i),
351− (i == 0) ? ~0 : 0, sizeof(*per_cpu(cpu_evtchn_mask, i)));
351+ (i == 0) ? ~0 : 0, NR_EVENT_CHANNELS/8);
352352 }
353353
354354 static inline void clear_evtchn(int port)
@@ -1493,8 +1493,10 @@ void rebind_evtchn_irq(int evtchn, int irq) · 1138 unmodified lines
14931493 /* Rebind an evtchn so that it gets delivered to a specific cpu */
14941494 static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
14951495 {
1496+ struct shared_info *s = HYPERVISOR_shared_info;
14961497 struct evtchn_bind_vcpu bind_vcpu;
14971498 int evtchn = evtchn_from_irq(irq);
1499+ int masked;
14981500
14991501 if (!VALID_EVTCHN(evtchn))
15001502 return -1;
@@ -1510,6 +1512,12 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) · 9 unmodified lines
15101512 bind_vcpu.port = evtchn;
15111513 bind_vcpu.vcpu = tcpu;
15121514
1515+ /*
1516+ * Mask the event while changing the VCPU binding to prevent
1517+ * it being delivered on an unexpected VCPU.
1518+ */
1519+ masked = sync_test_and_set_bit(evtchn, BM(s->evtchn_mask));
1520+
15131521 /*
15141522 * If this fails, it usually just indicates that we're dealing with a
15151523 * virq or IPI channel, which don't actually need to be rebound. Ignore
@@ -1518,6 +1526,9 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) · 2 unmodified lines
15181526 if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0)
15191527 bind_evtchn_to_cpu(evtchn, tcpu);
15201528
1529+ if (!masked)
1530+ unmask_evtchn(evtchn);
1531+
15211532 return 0;
15221533 }
15231534
fs/bfs/inode.c+1−1
@@ -40,7 +40,7 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino) · 39 unmodified lines
4040 int block, off;
4141
4242 inode = iget_locked(sb, ino);
43− if (IS_ERR(inode))
43+ if (!inode)
4444 return ERR_PTR(-ENOMEM);
4545 if (!(inode->i_state & I_NEW))
4646 return inode;
fs/bio.c+15−5
@@ -1045,12 +1045,22 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, · 1044 unmodified lines
10451045 int bio_uncopy_user(struct bio *bio)
10461046 {
10471047 struct bio_map_data *bmd = bio->bi_private;
1048− int ret = 0;
1048+ struct bio_vec *bvec;
1049+ int ret = 0, i;
10491050
1050− if (!bio_flagged(bio, BIO_NULL_MAPPED))
1051− ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,
1052− bmd->nr_sgvecs, bio_data_dir(bio) == READ,
1053− 0, bmd->is_our_pages);
1051+ if (!bio_flagged(bio, BIO_NULL_MAPPED)) {
1052+ /*
1053+ * if we're in a workqueue, the request is orphaned, so
1054+ * don't copy into a random user address space, just free.
1055+ */
1056+ if (current->mm)
1057+ ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,
1058+ bmd->nr_sgvecs, bio_data_dir(bio) == READ,
1059+ 0, bmd->is_our_pages);
1060+ else if (bmd->is_our_pages)
1061+ bio_for_each_segment_all(bvec, bio, i)
1062+ __free_page(bvec->bv_page);
1063+ }
10541064 bio_free_map_data(bmd);
10551065 bio_put(bio);
10561066 return ret;
fs/cifs/cifsencrypt.c+9−5
@@ -43,17 +43,18 @@ cifs_crypto_shash_md5_allocate(struct TCP_Server_Info *server) · 42 unmodified lines
4343 server->secmech.md5 = crypto_alloc_shash("md5", 0, 0);
4444 if (IS_ERR(server->secmech.md5)) {
4545 cifs_dbg(VFS, "could not allocate crypto md5\n");
46− return PTR_ERR(server->secmech.md5);
46+ rc = PTR_ERR(server->secmech.md5);
47+ server->secmech.md5 = NULL;
48+ return rc;
4749 }
4850
4951 size = sizeof(struct shash_desc) +
5052 crypto_shash_descsize(server->secmech.md5);
5153 server->secmech.sdescmd5 = kmalloc(size, GFP_KERNEL);
5254 if (!server->secmech.sdescmd5) {
53− rc = -ENOMEM;
5455 crypto_free_shash(server->secmech.md5);
5556 server->secmech.md5 = NULL;
56− return rc;
57+ return -ENOMEM;
5758 }
5859 server->secmech.sdescmd5->shash.tfm = server->secmech.md5;
5960 server->secmech.sdescmd5->shash.flags = 0x0;
@@ -421,7 +422,7 @@ find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp) · 361 unmodified lines
421422 if (blobptr + attrsize > blobend)
422423 break;
423424 if (type == NTLMSSP_AV_NB_DOMAIN_NAME) {
424− if (!attrsize)
425+ if (!attrsize || attrsize >= CIFS_MAX_DOMAINNAME_LEN)
425426 break;
426427 if (!ses->domainName) {
427428 ses->domainName =
@@ -591,6 +592,7 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) · 163 unmodified lines
591592
592593 static int crypto_hmacmd5_alloc(struct TCP_Server_Info *server)
593594 {
595+ int rc;
594596 unsigned int size;
595597
596598 /* check if already allocated */
@@ -600,7 +602,9 @@ static int crypto_hmacmd5_alloc(struct TCP_Server_Info *server) · 3 unmodified lines
600602 server->secmech.hmacmd5 = crypto_alloc_shash("hmac(md5)", 0, 0);
601603 if (IS_ERR(server->secmech.hmacmd5)) {
602604 cifs_dbg(VFS, "could not allocate crypto hmacmd5\n");
603− return PTR_ERR(server->secmech.hmacmd5);
605+ rc = PTR_ERR(server->secmech.hmacmd5);
606+ server->secmech.hmacmd5 = NULL;
607+ return rc;
604608 }
605609
606610 size = sizeof(struct shash_desc) +
fs/cifs/cifsfs.c+5−6
@@ -147,18 +147,17 @@ cifs_read_super(struct super_block *sb) · 146 unmodified lines
147147 goto out_no_root;
148148 }
149149
150+ if (cifs_sb_master_tcon(cifs_sb)->nocase)
151+ sb->s_d_op = &cifs_ci_dentry_ops;
152+ else
153+ sb->s_d_op = &cifs_dentry_ops;
154+
150155 sb->s_root = d_make_root(inode);
151156 if (!sb->s_root) {
152157 rc = -ENOMEM;
153158 goto out_no_root;
154159 }
155160
156− /* do that *after* d_make_root() - we want NULL ->d_op for root here */
157− if (cifs_sb_master_tcon(cifs_sb)->nocase)
158− sb->s_d_op = &cifs_ci_dentry_ops;
159− else
160− sb->s_d_op = &cifs_dentry_ops;
161−
162161 #ifdef CONFIG_CIFS_NFSD_EXPORT
163162 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
164163 cifs_dbg(FYI, "export ops supported\n");
fs/cifs/cifsglob.h+4−0
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444 #define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)
4545 #define MAX_SERVER_SIZE 15
4646 #define MAX_SHARE_SIZE 80
47+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
4748 #define MAX_USERNAME_SIZE 256 /* reasonable maximum for current servers */
4849 #define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */
4950
@@ -369,6 +370,9 @@ struct smb_version_operations { · 319 unmodified lines
369370 void (*generate_signingkey)(struct TCP_Server_Info *server);
370371 int (*calc_signature)(struct smb_rqst *rqst,
371372 struct TCP_Server_Info *server);
373+ int (*query_mf_symlink)(const unsigned char *path, char *pbuf,
374+ unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,
375+ unsigned int xid);
372376 };
373377
374378 struct smb_version_values {
fs/cifs/cifsproto.h+3−1
@@ -497,5 +497,7 @@ void cifs_writev_complete(struct work_struct *work); · 496 unmodified lines
497497 struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
498498 work_func_t complete);
499499 void cifs_writedata_release(struct kref *refcount);
500−
500+int open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,
501+ unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,
502+ unsigned int xid);
501503 #endif /* _CIFSPROTO_H */
fs/cifs/connect.c+4−3
@@ -1675,7 +1675,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, · 1674 unmodified lines
16751675 if (string == NULL)
16761676 goto out_nomem;
16771677
1678− if (strnlen(string, 256) == 256) {
1678+ if (strnlen(string, CIFS_MAX_DOMAINNAME_LEN)
1679+ == CIFS_MAX_DOMAINNAME_LEN) {
16791680 printk(KERN_WARNING "CIFS: domain name too"
16801681 " long\n");
16811682 goto cifs_parse_mount_err;
@@ -2276,8 +2277,8 @@ cifs_put_smb_ses(struct cifs_ses *ses) · 594 unmodified lines
22762277
22772278 #ifdef CONFIG_KEYS
22782279
2279−/* strlen("cifs:a:") + INET6_ADDRSTRLEN + 1 */
2280−#define CIFSCREDS_DESC_SIZE (7 + INET6_ADDRSTRLEN + 1)
2280+/* strlen("cifs:a:") + CIFS_MAX_DOMAINNAME_LEN + 1 */
2281+#define CIFSCREDS_DESC_SIZE (7 + CIFS_MAX_DOMAINNAME_LEN + 1)
22812282
22822283 /* Populate username and pw fields from keyring if possible */
22832284 static int
fs/cifs/file.c+1−0
@@ -647,6 +647,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) · 646 unmodified lines
647647 oflags, &oplock, &cfile->fid.netfid, xid);
648648 if (rc == 0) {
649649 cifs_dbg(FYI, "posix reopen succeeded\n");
650+ oparms.reconnect = true;
650651 goto reopen_success;
651652 }
652653 /*
fs/cifs/link.c+53−31
@@ -305,67 +305,89 @@ CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr) · 304 unmodified lines
305305 }
306306
307307 int
308−CIFSCheckMFSymlink(struct cifs_fattr *fattr,
309− const unsigned char *path,
310− struct cifs_sb_info *cifs_sb, unsigned int xid)
308+open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,
309+ unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,
310+ unsigned int xid)
311311 {
312312 int rc;
313313 int oplock = 0;
314314 __u16 netfid = 0;
315315 struct tcon_link *tlink;
316− struct cifs_tcon *pTcon;
316+ struct cifs_tcon *ptcon;
317317 struct cifs_io_parms io_parms;
318− u8 *buf;
319− char *pbuf;
320− unsigned int bytes_read = 0;
321318 int buf_type = CIFS_NO_BUFFER;
322− unsigned int link_len = 0;
323319 FILE_ALL_INFO file_info;
324320
325− if (!CIFSCouldBeMFSymlink(fattr))
326− /* it's not a symlink */
327− return 0;
328−
329321 tlink = cifs_sb_tlink(cifs_sb);
330322 if (IS_ERR(tlink))
331323 return PTR_ERR(tlink);
332− pTcon = tlink_tcon(tlink);
324+ ptcon = tlink_tcon(tlink);
333325
334− rc = CIFSSMBOpen(xid, pTcon, path, FILE_OPEN, GENERIC_READ,
326+ rc = CIFSSMBOpen(xid, ptcon, path, FILE_OPEN, GENERIC_READ,
335327 CREATE_NOT_DIR, &netfid, &oplock, &file_info,
336328 cifs_sb->local_nls,
337329 cifs_sb->mnt_cifs_flags &
338330 CIFS_MOUNT_MAP_SPECIAL_CHR);
339− if (rc != 0)
340− goto out;
331+ if (rc != 0) {
332+ cifs_put_tlink(tlink);
333+ return rc;
334+ }
341335
342336 if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) {
343− CIFSSMBClose(xid, pTcon, netfid);
337+ CIFSSMBClose(xid, ptcon, netfid);
338+ cifs_put_tlink(tlink);
344339 /* it's not a symlink */
345− goto out;
340+ return rc;
346341 }
347342
348− buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
349− if (!buf) {
350− rc = -ENOMEM;
351− goto out;
352− }
353− pbuf = buf;
354343 io_parms.netfid = netfid;
355344 io_parms.pid = current->tgid;
356− io_parms.tcon = pTcon;
345+ io_parms.tcon = ptcon;
357346 io_parms.offset = 0;
358347 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE;
359348
360− rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, &buf_type);
361− CIFSSMBClose(xid, pTcon, netfid);
362− if (rc != 0) {
363− kfree(buf);
349+ rc = CIFSSMBRead(xid, &io_parms, pbytes_read, &pbuf, &buf_type);
350+ CIFSSMBClose(xid, ptcon, netfid);
351+ cifs_put_tlink(tlink);
352+ return rc;
353+}
354+
355+
356+int
357+CIFSCheckMFSymlink(struct cifs_fattr *fattr,
358+ const unsigned char *path,
359+ struct cifs_sb_info *cifs_sb, unsigned int xid)
360+{
361+ int rc = 0;
362+ u8 *buf = NULL;
363+ unsigned int link_len = 0;
364+ unsigned int bytes_read = 0;
365+ struct cifs_tcon *ptcon;
366+
367+ if (!CIFSCouldBeMFSymlink(fattr))
368+ /* it's not a symlink */
369+ return 0;
370+
371+ buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
372+ if (!buf) {
373+ rc = -ENOMEM;
364374 goto out;
365375 }
366376
377+ ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb));
378+ if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink))
379+ rc = ptcon->ses->server->ops->query_mf_symlink(path, buf,
380+ &bytes_read, cifs_sb, xid);
381+ else
382+ goto out;
383+
384+ if (rc != 0)
385+ goto out;
386+
387+ if (bytes_read == 0) /* not a symlink */
388+ goto out;
389+
367390 rc = CIFSParseMFSymlink(buf, bytes_read, &link_len, NULL);
368− kfree(buf);
369391 if (rc == -EINVAL) {
370392 /* it's not a symlink */
371393 rc = 0;
@@ -381,7 +403,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr, · 9 unmodified lines
381403 fattr->cf_mode |= S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO;
382404 fattr->cf_dtype = DT_LNK;
383405 out:
384− cifs_put_tlink(tlink);
406+ kfree(buf);
385407 return rc;
386408 }
387409
fs/cifs/readdir.c+8−0
@@ -111,6 +111,14 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, · 110 unmodified lines
111111 return;
112112 }
113113
114+ /*
115+ * If we know that the inode will need to be revalidated immediately,
116+ * then don't create a new dentry for it. We'll end up doing an on
117+ * the wire call either way and this spares us an invalidation.
118+ */
119+ if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
120+ return;
121+
114122 dentry = d_alloc(parent, name);
115123 if (!dentry)
116124 return;
fs/cifs/sess.c+3−3
@@ -197,7 +197,7 @@ static void unicode_domain_string(char **pbcc_area, struct cifs_ses *ses, · 196 unmodified lines
197197 bytes_ret = 0;
198198 } else
199199 bytes_ret = cifs_strtoUTF16((__le16 *) bcc_ptr, ses->domainName,
200− 256, nls_cp);
200+ CIFS_MAX_DOMAINNAME_LEN, nls_cp);
201201 bcc_ptr += 2 * bytes_ret;
202202 bcc_ptr += 2; /* account for null terminator */
203203
@@ -255,8 +255,8 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses, · 51 unmodified lines
255255
256256 /* copy domain */
257257 if (ses->domainName != NULL) {
258− strncpy(bcc_ptr, ses->domainName, 256);
259− bcc_ptr += strnlen(ses->domainName, 256);
258+ strncpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
259+ bcc_ptr += strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
260260 } /* else we will send a null domain name
261261 so the server will default to its own domain */
262262 *bcc_ptr = 0;
fs/cifs/smb1ops.c+1−0
@@ -944,6 +944,7 @@ struct smb_version_operations smb1_operations = { · 943 unmodified lines
944944 .mand_lock = cifs_mand_lock,
945945 .mand_unlock_range = cifs_unlock_range,
946946 .push_mand_locks = cifs_push_mandatory_locks,
947+ .query_mf_symlink = open_query_close_cifs_symlink,
947948 };
948949
949950 struct smb_version_values smb1_values = {
fs/cifs/smb2transport.c+7−2
@@ -42,6 +42,7 @@ · 41 unmodified lines
4242 static int
4343 smb2_crypto_shash_allocate(struct TCP_Server_Info *server)
4444 {
45+ int rc;
4546 unsigned int size;
4647
4748 if (server->secmech.sdeschmacsha256 != NULL)
@@ -50,7 +51,9 @@ smb2_crypto_shash_allocate(struct TCP_Server_Info *server) · 2 unmodified lines
5051 server->secmech.hmacsha256 = crypto_alloc_shash("hmac(sha256)", 0, 0);
5152 if (IS_ERR(server->secmech.hmacsha256)) {
5253 cifs_dbg(VFS, "could not allocate crypto hmacsha256\n");
53− return PTR_ERR(server->secmech.hmacsha256);
54+ rc = PTR_ERR(server->secmech.hmacsha256);
55+ server->secmech.hmacsha256 = NULL;
56+ return rc;
5457 }
5558
5659 size = sizeof(struct shash_desc) +
@@ -87,7 +90,9 @@ smb3_crypto_shash_allocate(struct TCP_Server_Info *server) · 30 unmodified lines
8790 server->secmech.sdeschmacsha256 = NULL;
8891 crypto_free_shash(server->secmech.hmacsha256);
8992 server->secmech.hmacsha256 = NULL;
90− return PTR_ERR(server->secmech.cmacaes);
93+ rc = PTR_ERR(server->secmech.cmacaes);
94+ server->secmech.cmacaes = NULL;
95+ return rc;
9196 }
9297
9398 size = sizeof(struct shash_desc) +
fs/dcache.c+34−34
@@ -229,7 +229,7 @@ static void __d_free(struct rcu_head *head) · 228 unmodified lines
229229 */
230230 static void d_free(struct dentry *dentry)
231231 {
232− BUG_ON(dentry->d_count);
232+ BUG_ON(dentry->d_lockref.count);
233233 this_cpu_dec(nr_dentry);
234234 if (dentry->d_op && dentry->d_op->d_release)
235235 dentry->d_op->d_release(dentry);
@@ -467,7 +467,7 @@ relock: · 231 unmodified lines
467467 }
468468
469469 if (ref)
470− dentry->d_count--;
470+ dentry->d_lockref.count--;
471471 /*
472472 * inform the fs via d_prune that this dentry is about to be
473473 * unhashed and destroyed.
@@ -513,15 +513,10 @@ void dput(struct dentry *dentry) · 39 unmodified lines
513513 return;
514514
515515 repeat:
516− if (dentry->d_count == 1)
516+ if (dentry->d_lockref.count == 1)
517517 might_sleep();
518− spin_lock(&dentry->d_lock);
519− BUG_ON(!dentry->d_count);
520− if (dentry->d_count > 1) {
521− dentry->d_count--;
522− spin_unlock(&dentry->d_lock);
518+ if (lockref_put_or_lock(&dentry->d_lockref))
523519 return;
524− }
525520
526521 if (dentry->d_flags & DCACHE_OP_DELETE) {
527522 if (dentry->d_op->d_delete(dentry))
@@ -535,7 +530,7 @@ repeat: · 7 unmodified lines
535530 dentry->d_flags |= DCACHE_REFERENCED;
536531 dentry_lru_add(dentry);
537532
538− dentry->d_count--;
533+ dentry->d_lockref.count--;
539534 spin_unlock(&dentry->d_lock);
540535 return;
541536
@@ -590,7 +585,7 @@ int d_invalidate(struct dentry * dentry) · 48 unmodified lines
590585 * We also need to leave mountpoints alone,
591586 * directory or not.
592587 */
593− if (dentry->d_count > 1 && dentry->d_inode) {
588+ if (dentry->d_lockref.count > 1 && dentry->d_inode) {
594589 if (S_ISDIR(dentry->d_inode->i_mode) || d_mountpoint(dentry)) {
595590 spin_unlock(&dentry->d_lock);
596591 return -EBUSY;
@@ -606,14 +601,12 @@ EXPORT_SYMBOL(d_invalidate); · 9 unmodified lines
606601 /* This must be called with d_lock held */
607602 static inline void __dget_dlock(struct dentry *dentry)
608603 {
609− dentry->d_count++;
604+ dentry->d_lockref.count++;
610605 }
611606
612607 static inline void __dget(struct dentry *dentry)
613608 {
614− spin_lock(&dentry->d_lock);
615− __dget_dlock(dentry);
616− spin_unlock(&dentry->d_lock);
609+ lockref_get(&dentry->d_lockref);
617610 }
618611
619612 struct dentry *dget_parent(struct dentry *dentry)
@@ -634,8 +627,8 @@ repeat: · 14 unmodified lines
634627 goto repeat;
635628 }
636629 rcu_read_unlock();
637− BUG_ON(!ret->d_count);
638− ret->d_count++;
630+ BUG_ON(!ret->d_lockref.count);
631+ ret->d_lockref.count++;
639632 spin_unlock(&ret->d_lock);
640633 return ret;
641634 }
@@ -718,7 +711,7 @@ restart: · 76 unmodified lines
718711 spin_lock(&inode->i_lock);
719712 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
720713 spin_lock(&dentry->d_lock);
721− if (!dentry->d_count) {
714+ if (!dentry->d_lockref.count) {
722715 __dget_dlock(dentry);
723716 __d_drop(dentry);
724717 spin_unlock(&dentry->d_lock);
@@ -763,12 +756,8 @@ static void try_prune_one_dentry(struct dentry *dentry) · 38 unmodified lines
763756 /* Prune ancestors. */
764757 dentry = parent;
765758 while (dentry) {
766− spin_lock(&dentry->d_lock);
767− if (dentry->d_count > 1) {
768− dentry->d_count--;
769− spin_unlock(&dentry->d_lock);
759+ if (lockref_put_or_lock(&dentry->d_lockref))
770760 return;
771− }
772761 dentry = dentry_kill(dentry, 1);
773762 }
774763 }
@@ -793,7 +782,7 @@ static void shrink_dentry_list(struct list_head *list) · 18 unmodified lines
793782 * the LRU because of laziness during lookup. Do not free
794783 * it - just keep it off the LRU list.
795784 */
796− if (dentry->d_count) {
785+ if (dentry->d_lockref.count) {
797786 dentry_lru_del(dentry);
798787 spin_unlock(&dentry->d_lock);
799788 continue;
@@ -913,7 +902,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) · 113 unmodified lines
913902 dentry_lru_del(dentry);
914903 __d_shrink(dentry);
915904
916− if (dentry->d_count != 0) {
905+ if (dentry->d_lockref.count != 0) {
917906 printk(KERN_ERR
918907 "BUG: Dentry %p{i=%lx,n=%s}"
919908 " still in use (%d)"
@@ -922,7 +911,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) · 2 unmodified lines
922911 dentry->d_inode ?
923912 dentry->d_inode->i_ino : 0UL,
924913 dentry->d_name.name,
925− dentry->d_count,
914+ dentry->d_lockref.count,
926915 dentry->d_sb->s_type->name,
927916 dentry->d_sb->s_id);
928917 BUG();
@@ -933,7 +922,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) · 4 unmodified lines
933922 list_del(&dentry->d_u.d_child);
934923 } else {
935924 parent = dentry->d_parent;
936− parent->d_count--;
925+ parent->d_lockref.count--;
937926 list_del(&dentry->d_u.d_child);
938927 }
939928
@@ -981,7 +970,7 @@ void shrink_dcache_for_umount(struct super_block *sb) · 41 unmodified lines
981970
982971 dentry = sb->s_root;
983972 sb->s_root = NULL;
984− dentry->d_count--;
973+ dentry->d_lockref.count--;
985974 shrink_dcache_for_umount_subtree(dentry);
986975
987976 while (!hlist_bl_empty(&sb->s_anon)) {
@@ -1147,7 +1136,7 @@ resume: · 159 unmodified lines
11471136 * loop in shrink_dcache_parent() might not make any progress
11481137 * and loop forever.
11491138 */
1150− if (dentry->d_count) {
1139+ if (dentry->d_lockref.count) {
11511140 dentry_lru_del(dentry);
11521141 } else if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {
11531142 dentry_lru_move_list(dentry, dispose);
@@ -1269,7 +1258,7 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) · 115 unmodified lines
12691258 smp_wmb();
12701259 dentry->d_name.name = dname;
12711260
1272− dentry->d_count = 1;
1261+ dentry->d_lockref.count = 1;
12731262 dentry->d_flags = 0;
12741263 spin_lock_init(&dentry->d_lock);
12751264 seqcount_init(&dentry->d_seq);
@@ -1970,7 +1959,7 @@ struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name) · 694 unmodified lines
19701959 goto next;
19711960 }
19721961
1973− dentry->d_count++;
1962+ dentry->d_lockref.count++;
19741963 found = dentry;
19751964 spin_unlock(&dentry->d_lock);
19761965 break;
@@ -2069,7 +2058,7 @@ again: · 92 unmodified lines
20692058 spin_lock(&dentry->d_lock);
20702059 inode = dentry->d_inode;
20712060 isdir = S_ISDIR(inode->i_mode);
2072− if (dentry->d_count == 1) {
2061+ if (dentry->d_lockref.count == 1) {
20732062 if (!spin_trylock(&inode->i_lock)) {
20742063 spin_unlock(&dentry->d_lock);
20752064 cpu_relax();
@@ -2724,6 +2713,17 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen, · 648 unmodified lines
27242713 return memcpy(buffer, temp, sz);
27252714 }
27262715
2716+char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
2717+{
2718+ char *end = buffer + buflen;
2719+ /* these dentries are never renamed, so d_lock is not needed */
2720+ if (prepend(&end, &buflen, " (deleted)", 11) ||
2721+ prepend_name(&end, &buflen, &dentry->d_name) ||
2722+ prepend(&end, &buflen, "/", 1))
2723+ end = ERR_PTR(-ENAMETOOLONG);
2724+ return end;
2725+}
2726+
27272727 /*
27282728 * Write full pathname from the root of the filesystem into the buffer.
27292729 */
@@ -2937,7 +2937,7 @@ resume: · 207 unmodified lines
29372937 }
29382938 if (!(dentry->d_flags & DCACHE_GENOCIDE)) {
29392939 dentry->d_flags |= DCACHE_GENOCIDE;
2940− dentry->d_count--;
2940+ dentry->d_lockref.count--;
29412941 }
29422942 spin_unlock(&dentry->d_lock);
29432943 }
@@ -2945,7 +2945,7 @@ resume: · 1 unmodified line
29452945 struct dentry *child = this_parent;
29462946 if (!(this_parent->d_flags & DCACHE_GENOCIDE)) {
29472947 this_parent->d_flags |= DCACHE_GENOCIDE;
2948− this_parent->d_count--;
2948+ this_parent->d_lockref.count--;
29492949 }
29502950 this_parent = try_to_ascend(this_parent, locked, seq);
29512951 if (!this_parent)
fs/efs/inode.c+1−1
@@ -57,7 +57,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino) · 56 unmodified lines
5757 struct inode *inode;
5858
5959 inode = iget_locked(super, ino);
60− if (IS_ERR(inode))
60+ if (!inode)
6161 return ERR_PTR(-ENOMEM);
6262 if (!(inode->i_state & I_NEW))
6363 return inode;
fs/exec.c+2−2
@@ -608,7 +608,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift) · 607 unmodified lines
608608 return -ENOMEM;
609609
610610 lru_add_drain();
611− tlb_gather_mmu(&tlb, mm, 0);
611+ tlb_gather_mmu(&tlb, mm, old_start, old_end);
612612 if (new_end > old_start) {
613613 /*
614614 * when the old and new regions overlap clear from new_end.
@@ -625,7 +625,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift) · 10 unmodified lines
625625 free_pgd_range(&tlb, old_start, old_end, new_end,
626626 vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
627627 }
628− tlb_finish_mmu(&tlb, new_end, old_end);
628+ tlb_finish_mmu(&tlb, old_start, old_end);
629629
630630 /*
631631 * Shrink the vma to just the new range. Always succeeds.
fs/ext4/ext4.h+1−0
@@ -2086,6 +2086,7 @@ extern int ext4_sync_inode(handle_t *, struct inode *); · 2085 unmodified lines
20862086 extern void ext4_dirty_inode(struct inode *, int);
20872087 extern int ext4_change_inode_journal_flag(struct inode *, int);
20882088 extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
2089+extern int ext4_inode_attach_jinode(struct inode *inode);
20892090 extern int ext4_can_truncate(struct inode *inode);
20902091 extern void ext4_truncate(struct inode *);
20912092 extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
fs/ext4/ext4_jbd2.c+4−4
@@ -255,10 +255,10 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, · 254 unmodified lines
255255 set_buffer_prio(bh);
256256 if (ext4_handle_valid(handle)) {
257257 err = jbd2_journal_dirty_metadata(handle, bh);
258− if (err) {
259− /* Errors can only happen if there is a bug */
260− handle->h_err = err;
261− __ext4_journal_stop(where, line, handle);
258+ /* Errors can only happen if there is a bug */
259+ if (WARN_ON_ONCE(err)) {
260+ ext4_journal_abort_handle(where, line, __func__, bh,
261+ handle, err);
262262 }
263263 } else {
264264 if (inode)
fs/ext4/file.c+4−17
@@ -219,7 +219,6 @@ static int ext4_file_open(struct inode * inode, struct file * filp) · 218 unmodified lines
219219 {
220220 struct super_block *sb = inode->i_sb;
221221 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
222− struct ext4_inode_info *ei = EXT4_I(inode);
223222 struct vfsmount *mnt = filp->f_path.mnt;
224223 struct path path;
225224 char buf[64], *cp;
@@ -259,22 +258,10 @@ static int ext4_file_open(struct inode * inode, struct file * filp) · 33 unmodified lines
259258 * Set up the jbd2_inode if we are opening the inode for
260259 * writing and the journal is present
261260 */
262− if (sbi->s_journal && !ei->jinode && (filp->f_mode & FMODE_WRITE)) {
263− struct jbd2_inode *jinode = jbd2_alloc_inode(GFP_KERNEL);
264−
265− spin_lock(&inode->i_lock);
266− if (!ei->jinode) {
267− if (!jinode) {
268− spin_unlock(&inode->i_lock);
269− return -ENOMEM;
270− }
271− ei->jinode = jinode;
272− jbd2_journal_init_jbd_inode(ei->jinode, inode);
273− jinode = NULL;
274− }
275− spin_unlock(&inode->i_lock);
276− if (unlikely(jinode != NULL))
277− jbd2_free_inode(jinode);
261+ if (filp->f_mode & FMODE_WRITE) {
262+ int ret = ext4_inode_attach_jinode(inode);
263+ if (ret < 0)
264+ return ret;
278265 }
279266 return dquot_file_open(inode, filp);
280267 }
fs/ext4/inode.c+43−0
@@ -3533,6 +3533,18 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) · 3532 unmodified lines
35333533 offset;
35343534 }
35353535
3536+ if (offset & (sb->s_blocksize - 1) ||
3537+ (offset + length) & (sb->s_blocksize - 1)) {
3538+ /*
3539+ * Attach jinode to inode for jbd2 if we do any zeroing of
3540+ * partial block
3541+ */
3542+ ret = ext4_inode_attach_jinode(inode);
3543+ if (ret < 0)
3544+ goto out_mutex;
3545+
3546+ }
3547+
35363548 first_block_offset = round_up(offset, sb->s_blocksize);
35373549 last_block_offset = round_down((offset + length), sb->s_blocksize) - 1;
35383550
@@ -3601,6 +3613,31 @@ out_mutex: · 62 unmodified lines
36013613 return ret;
36023614 }
36033615
3616+int ext4_inode_attach_jinode(struct inode *inode)
3617+{
3618+ struct ext4_inode_info *ei = EXT4_I(inode);
3619+ struct jbd2_inode *jinode;
3620+
3621+ if (ei->jinode || !EXT4_SB(inode->i_sb)->s_journal)
3622+ return 0;
3623+
3624+ jinode = jbd2_alloc_inode(GFP_KERNEL);
3625+ spin_lock(&inode->i_lock);
3626+ if (!ei->jinode) {
3627+ if (!jinode) {
3628+ spin_unlock(&inode->i_lock);
3629+ return -ENOMEM;
3630+ }
3631+ ei->jinode = jinode;
3632+ jbd2_journal_init_jbd_inode(ei->jinode, inode);
3633+ jinode = NULL;
3634+ }
3635+ spin_unlock(&inode->i_lock);
3636+ if (unlikely(jinode != NULL))
3637+ jbd2_free_inode(jinode);
3638+ return 0;
3639+}
3640+
36043641 /*
36053642 * ext4_truncate()
36063643 *
@@ -3661,6 +3698,12 @@ void ext4_truncate(struct inode *inode) · 54 unmodified lines
36613698 return;
36623699 }
36633700
3701+ /* If we zero-out tail of the page, we have to create jinode for jbd2 */
3702+ if (inode->i_size & (inode->i_sb->s_blocksize - 1)) {
3703+ if (ext4_inode_attach_jinode(inode) < 0)
3704+ return;
3705+ }
3706+
36643707 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
36653708 credits = ext4_writepage_trans_blocks(inode);
36663709 else
fs/ext4/ioctl.c+4−2
@@ -77,8 +77,10 @@ static void swap_inode_data(struct inode *inode1, struct inode *inode2) · 76 unmodified lines
7777 memswap(ei1->i_data, ei2->i_data, sizeof(ei1->i_data));
7878 memswap(&ei1->i_flags, &ei2->i_flags, sizeof(ei1->i_flags));
7979 memswap(&ei1->i_disksize, &ei2->i_disksize, sizeof(ei1->i_disksize));
80− memswap(&ei1->i_es_tree, &ei2->i_es_tree, sizeof(ei1->i_es_tree));
81− memswap(&ei1->i_es_lru_nr, &ei2->i_es_lru_nr, sizeof(ei1->i_es_lru_nr));
80+ ext4_es_remove_extent(inode1, 0, EXT_MAX_BLOCKS);
81+ ext4_es_remove_extent(inode2, 0, EXT_MAX_BLOCKS);
82+ ext4_es_lru_del(inode1);
83+ ext4_es_lru_del(inode2);
8284
8385 isize = i_size_read(inode1);
8486 i_size_write(inode1, i_size_read(inode2));
fs/ext4/super.c+17−2
@@ -1359,7 +1359,7 @@ static const struct mount_opts { · 1358 unmodified lines
13591359 {Opt_delalloc, EXT4_MOUNT_DELALLOC,
13601360 MOPT_EXT4_ONLY | MOPT_SET | MOPT_EXPLICIT},
13611361 {Opt_nodelalloc, EXT4_MOUNT_DELALLOC,
1362− MOPT_EXT4_ONLY | MOPT_CLEAR | MOPT_EXPLICIT},
1362+ MOPT_EXT4_ONLY | MOPT_CLEAR},
13631363 {Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM,
13641364 MOPT_EXT4_ONLY | MOPT_SET},
13651365 {Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT |
@@ -3483,7 +3483,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) · 2117 unmodified lines
34833483 }
34843484 if (test_opt(sb, DIOREAD_NOLOCK)) {
34853485 ext4_msg(sb, KERN_ERR, "can't mount with "
3486− "both data=journal and delalloc");
3486+ "both data=journal and dioread_nolock");
34873487 goto failed_mount;
34883488 }
34893489 if (test_opt(sb, DELALLOC))
@@ -4727,6 +4727,21 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) · 1237 unmodified lines
47274727 goto restore_opts;
47284728 }
47294729
4730+ if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
4731+ if (test_opt2(sb, EXPLICIT_DELALLOC)) {
4732+ ext4_msg(sb, KERN_ERR, "can't mount with "
4733+ "both data=journal and delalloc");
4734+ err = -EINVAL;
4735+ goto restore_opts;
4736+ }
4737+ if (test_opt(sb, DIOREAD_NOLOCK)) {
4738+ ext4_msg(sb, KERN_ERR, "can't mount with "
4739+ "both data=journal and dioread_nolock");
4740+ err = -EINVAL;
4741+ goto restore_opts;
4742+ }
4743+ }
4744+
47304745 if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
47314746 ext4_abort(sb, "Abort forced by user");
47324747
fs/gfs2/glock.c+4−4
@@ -1838,14 +1838,14 @@ int __init gfs2_glock_init(void) · 1837 unmodified lines
18381838
18391839 glock_workqueue = alloc_workqueue("glock_workqueue", WQ_MEM_RECLAIM |
18401840 WQ_HIGHPRI | WQ_FREEZABLE, 0);
1841− if (IS_ERR(glock_workqueue))
1842− return PTR_ERR(glock_workqueue);
1841+ if (!glock_workqueue)
1842+ return -ENOMEM;
18431843 gfs2_delete_workqueue = alloc_workqueue("delete_workqueue",
18441844 WQ_MEM_RECLAIM | WQ_FREEZABLE,
18451845 0);
1846− if (IS_ERR(gfs2_delete_workqueue)) {
1846+ if (!gfs2_delete_workqueue) {
18471847 destroy_workqueue(glock_workqueue);
1848− return PTR_ERR(gfs2_delete_workqueue);
1848+ return -ENOMEM;
18491849 }
18501850
18511851 register_shrinker(&glock_shrinker);
fs/gfs2/glops.c+13−5
@@ -47,7 +47,8 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) · 46 unmodified lines
4747 * None of the buffers should be dirty, locked, or pinned.
4848 */
4949
50−static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
50+static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
51+ unsigned int nr_revokes)
5152 {
5253 struct gfs2_sbd *sdp = gl->gl_sbd;
5354 struct list_head *head = &gl->gl_ail_list;
@@ -57,7 +58,9 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) · 3 unmodified lines
5758
5859 gfs2_log_lock(sdp);
5960 spin_lock(&sdp->sd_ail_lock);
60− list_for_each_entry_safe(bd, tmp, head, bd_ail_gl_list) {
61+ list_for_each_entry_safe_reverse(bd, tmp, head, bd_ail_gl_list) {
62+ if (nr_revokes == 0)
63+ break;
6164 bh = bd->bd_bh;
6265 if (bh->b_state & b_state) {
6366 if (fsync)
@@ -65,6 +68,7 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) · 1 unmodified line
6568 gfs2_ail_error(gl, bh);
6669 }
6770 gfs2_trans_add_revoke(sdp, bd);
71+ nr_revokes--;
6872 }
6973 GLOCK_BUG_ON(gl, !fsync && atomic_read(&gl->gl_ail_count));
7074 spin_unlock(&sdp->sd_ail_lock);
@@ -91,7 +95,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) · 20 unmodified lines
9195 WARN_ON_ONCE(current->journal_info);
9296 current->journal_info = &tr;
9397
94− __gfs2_ail_flush(gl, 0);
98+ __gfs2_ail_flush(gl, 0, tr.tr_revokes);
9599
96100 gfs2_trans_end(sdp);
97101 gfs2_log_flush(sdp, NULL);
@@ -101,15 +105,19 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) · 3 unmodified lines
101105 {
102106 struct gfs2_sbd *sdp = gl->gl_sbd;
103107 unsigned int revokes = atomic_read(&gl->gl_ail_count);
108+ unsigned int max_revokes = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64);
104109 int ret;
105110
106111 if (!revokes)
107112 return;
108113
109− ret = gfs2_trans_begin(sdp, 0, revokes);
114+ while (revokes > max_revokes)
115+ max_revokes += (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header)) / sizeof(u64);
116+
117+ ret = gfs2_trans_begin(sdp, 0, max_revokes);
110118 if (ret)
111119 return;
112− __gfs2_ail_flush(gl, fsync);
120+ __gfs2_ail_flush(gl, fsync, max_revokes);
113121 gfs2_trans_end(sdp);
114122 gfs2_log_flush(sdp, NULL);
115123 }
fs/gfs2/inode.c+5−1
@@ -594,7 +594,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, · 593 unmodified lines
594594 }
595595 gfs2_glock_dq_uninit(ghs);
596596 if (IS_ERR(d))
597− return PTR_RET(d);
597+ return PTR_ERR(d);
598598 return error;
599599 } else if (error != -ENOENT) {
600600 goto fail_gunlock;
@@ -1750,6 +1750,10 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, · 1149 unmodified lines
17501750 struct gfs2_holder gh;
17511751 int ret;
17521752
1753+ /* For selinux during lookup */
1754+ if (gfs2_glock_is_locked_by_me(ip->i_gl))
1755+ return generic_getxattr(dentry, name, data, size);
1756+
17531757 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
17541758 ret = gfs2_glock_nq(&gh);
17551759 if (ret == 0) {
fs/gfs2/main.c+1−1
@@ -155,7 +155,7 @@ static int __init init_gfs2_fs(void) · 154 unmodified lines
155155 goto fail_wq;
156156
157157 gfs2_control_wq = alloc_workqueue("gfs2_control",
158− WQ_NON_REENTRANT | WQ_UNBOUND | WQ_FREEZABLE, 0);
158+ WQ_UNBOUND | WQ_FREEZABLE, 0);
159159 if (!gfs2_control_wq)
160160 goto fail_recovery;
161161
fs/hugetlbfs/inode.c+11−7
@@ -463,6 +463,14 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb, · 462 unmodified lines
463463 return inode;
464464 }
465465
466+/*
467+ * Hugetlbfs is not reclaimable; therefore its i_mmap_mutex will never
468+ * be taken from reclaim -- unlike regular filesystems. This needs an
469+ * annotation because huge_pmd_share() does an allocation under
470+ * i_mmap_mutex.
471+ */
472+struct lock_class_key hugetlbfs_i_mmap_mutex_key;
473+
466474 static struct inode *hugetlbfs_get_inode(struct super_block *sb,
467475 struct inode *dir,
468476 umode_t mode, dev_t dev)
@@ -474,6 +482,8 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, · 5 unmodified lines
474482 struct hugetlbfs_inode_info *info;
475483 inode->i_ino = get_next_ino();
476484 inode_init_owner(inode, dir, mode);
485+ lockdep_set_class(&inode->i_mapping->i_mmap_mutex,
486+ &hugetlbfs_i_mmap_mutex_key);
477487 inode->i_mapping->a_ops = &hugetlbfs_aops;
478488 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
479489 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
@@ -916,14 +926,8 @@ static int get_hstate_idx(int page_size_log) · 436 unmodified lines
916926 return h - hstates;
917927 }
918928
919−static char *hugetlb_dname(struct dentry *dentry, char *buffer, int buflen)
920−{
921− return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",
922− dentry->d_name.name);
923−}
924−
925929 static struct dentry_operations anon_ops = {
926− .d_dname = hugetlb_dname
930+ .d_dname = simple_dname
927931 };
928932
929933 /*
fs/jfs/jfs_dtree.c+23−8
@@ -3047,6 +3047,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) · 3046 unmodified lines
30473047
30483048 dir_index = (u32) ctx->pos;
30493049
3050+ /*
3051+ * NFSv4 reserves cookies 1 and 2 for . and .. so the value
3052+ * we return to the vfs is one greater than the one we use
3053+ * internally.
3054+ */
3055+ if (dir_index)
3056+ dir_index--;
3057+
30503058 if (dir_index > 1) {
30513059 struct dir_table_slot dirtab_slot;
30523060
@@ -3086,7 +3094,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) · 33 unmodified lines
30863094 if (p->header.flag & BT_INTERNAL) {
30873095 jfs_err("jfs_readdir: bad index table");
30883096 DT_PUTPAGE(mp);
3089− ctx->pos = -1;
3097+ ctx->pos = DIREND;
30903098 return 0;
30913099 }
30923100 } else {
@@ -3094,14 +3102,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) · 1 unmodified line
30943102 /*
30953103 * self "."
30963104 */
3097− ctx->pos = 0;
3105+ ctx->pos = 1;
30983106 if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))
30993107 return 0;
31003108 }
31013109 /*
31023110 * parent ".."
31033111 */
3104− ctx->pos = 1;
3112+ ctx->pos = 2;
31053113 if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))
31063114 return 0;
31073115
@@ -3122,22 +3130,23 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) · 14 unmodified lines
31223130 /*
31233131 * Legacy filesystem - OS/2 & Linux JFS < 0.3.6
31243132 *
3125− * pn = index = 0: First entry "."
3126− * pn = 0; index = 1: Second entry ".."
3133+ * pn = 0; index = 1: First entry "."
3134+ * pn = 0; index = 2: Second entry ".."
31273135 * pn > 0: Real entries, pn=1 -> leftmost page
31283136 * pn = index = -1: No more entries
31293137 */
31303138 dtpos = ctx->pos;
3131− if (dtpos == 0) {
3139+ if (dtpos < 2) {
31323140 /* build "." entry */
3141+ ctx->pos = 1;
31333142 if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))
31343143 return 0;
3135− dtoffset->index = 1;
3144+ dtoffset->index = 2;
31363145 ctx->pos = dtpos;
31373146 }
31383147
31393148 if (dtoffset->pn == 0) {
3140− if (dtoffset->index == 1) {
3149+ if (dtoffset->index == 2) {
31413150 /* build ".." entry */
31423151 if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))
31433152 return 0;
@@ -3228,6 +3237,12 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) · 84 unmodified lines
32283237 }
32293238 jfs_dirent->position = unique_pos++;
32303239 }
3240+ /*
3241+ * We add 1 to the index because we may
3242+ * use a value of 2 internally, and NFSv4
3243+ * doesn't like that.
3244+ */
3245+ jfs_dirent->position++;
32313246 } else {
32323247 jfs_dirent->position = dtpos;
32333248 len = min(d_namleft, DTLHDRDATALEN_LEGACY);
fs/namei.c+10−6
@@ -536,8 +536,8 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry) · 535 unmodified lines
536536 * a reference at this point.
537537 */
538538 BUG_ON(!IS_ROOT(dentry) && dentry->d_parent != parent);
539− BUG_ON(!parent->d_count);
540− parent->d_count++;
539+ BUG_ON(!parent->d_lockref.count);
540+ parent->d_lockref.count++;
541541 spin_unlock(&dentry->d_lock);
542542 }
543543 spin_unlock(&parent->d_lock);
@@ -3327,7 +3327,7 @@ void dentry_unhash(struct dentry *dentry) · 2783 unmodified lines
33273327 {
33283328 shrink_dcache_parent(dentry);
33293329 spin_lock(&dentry->d_lock);
3330− if (dentry->d_count == 1)
3330+ if (dentry->d_lockref.count == 1)
33313331 __d_drop(dentry);
33323332 spin_unlock(&dentry->d_lock);
33333333 }
@@ -3671,11 +3671,15 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, · 337 unmodified lines
36713671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)
36723672 return -EINVAL;
36733673 /*
3674− * Using empty names is equivalent to using AT_SYMLINK_FOLLOW
3675− * on /proc/self/fd/<fd>.
3674+ * To use null names we require CAP_DAC_READ_SEARCH
3675+ * This ensures that not everyone will be able to create
3676+ * handlink using the passed filedescriptor.
36763677 */
3677− if (flags & AT_EMPTY_PATH)
3678+ if (flags & AT_EMPTY_PATH) {
3679+ if (!capable(CAP_DAC_READ_SEARCH))
3680+ return -ENOENT;
36783681 how = LOOKUP_EMPTY;
3682+ }
36793683
36803684 if (flags & AT_SYMLINK_FOLLOW)
36813685 how |= LOOKUP_FOLLOW;
fs/namespace.c+1−1
@@ -1429,7 +1429,7 @@ struct vfsmount *collect_mounts(struct path *path) · 1428 unmodified lines
14291429 CL_COPY_ALL | CL_PRIVATE);
14301430 namespace_unlock();
14311431 if (IS_ERR(tree))
1432− return NULL;
1432+ return ERR_CAST(tree);
14331433 return &tree->mnt;
14341434 }
14351435
fs/nilfs2/segbuf.c+2−3
@@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err) · 344 unmodified lines
345345
346346 if (err == -EOPNOTSUPP) {
347347 set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
348− bio_put(bio);
349− /* to be detected by submit_seg_bio() */
348+ /* to be detected by nilfs_segbuf_submit_bio() */
350349 }
351350
352351 if (!uptodate)
@@ -377,12 +376,12 @@ static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf, · 24 unmodified lines
377376 bio->bi_private = segbuf;
378377 bio_get(bio);
379378 submit_bio(mode, bio);
379+ segbuf->sb_nbio++;
380380 if (bio_flagged(bio, BIO_EOPNOTSUPP)) {
381381 bio_put(bio);
382382 err = -EOPNOTSUPP;
383383 goto failed;
384384 }
385− segbuf->sb_nbio++;
386385 bio_put(bio);
387386
388387 wi->bio = NULL;
fs/ocfs2/aops.c+1−1
@@ -1757,7 +1757,7 @@ try_again: · 1756 unmodified lines
17571757 goto out;
17581758 } else if (ret == 1) {
17591759 clusters_need = wc->w_clen;
1760− ret = ocfs2_refcount_cow(inode, filp, di_bh,
1760+ ret = ocfs2_refcount_cow(inode, di_bh,
17611761 wc->w_cpos, wc->w_clen, UINT_MAX);
17621762 if (ret) {
17631763 mlog_errno(ret);
fs/ocfs2/dir.c+1−3
@@ -2153,11 +2153,9 @@ int ocfs2_empty_dir(struct inode *inode) · 2152 unmodified lines
21532153 {
21542154 int ret;
21552155 struct ocfs2_empty_dir_priv priv = {
2156− .ctx.actor = ocfs2_empty_dir_filldir
2156+ .ctx.actor = ocfs2_empty_dir_filldir,
21572157 };
21582158
2159− memset(&priv, 0, sizeof(priv));
2160−
21612159 if (ocfs2_dir_indexed(inode)) {
21622160 ret = ocfs2_empty_dir_dx(inode, &priv);
21632161 if (ret)
fs/ocfs2/file.c+3−3
@@ -370,7 +370,7 @@ static int ocfs2_cow_file_pos(struct inode *inode, · 369 unmodified lines
370370 if (!(ext_flags & OCFS2_EXT_REFCOUNTED))
371371 goto out;
372372
373− return ocfs2_refcount_cow(inode, NULL, fe_bh, cpos, 1, cpos+1);
373+ return ocfs2_refcount_cow(inode, fe_bh, cpos, 1, cpos+1);
374374
375375 out:
376376 return status;
@@ -899,7 +899,7 @@ static int ocfs2_zero_extend_get_range(struct inode *inode, · 522 unmodified lines
899899 zero_clusters = last_cpos - zero_cpos;
900900
901901 if (needs_cow) {
902− rc = ocfs2_refcount_cow(inode, NULL, di_bh, zero_cpos,
902+ rc = ocfs2_refcount_cow(inode, di_bh, zero_cpos,
903903 zero_clusters, UINT_MAX);
904904 if (rc) {
905905 mlog_errno(rc);
@@ -2078,7 +2078,7 @@ static int ocfs2_prepare_inode_for_refcount(struct inode *inode, · 1172 unmodified lines
20782078
20792079 *meta_level = 1;
20802080
2081− ret = ocfs2_refcount_cow(inode, file, di_bh, cpos, clusters, UINT_MAX);
2081+ ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX);
20822082 if (ret)
20832083 mlog_errno(ret);
20842084 out:
fs/ocfs2/journal.h+1−1
@@ -537,7 +537,7 @@ static inline int ocfs2_calc_extend_credits(struct super_block *sb, · 536 unmodified lines
537537 extent_blocks = 1 + 1 + le16_to_cpu(root_el->l_tree_depth);
538538
539539 return bitmap_blocks + sysfile_bitmap_blocks + extent_blocks +
540− ocfs2_quota_trans_credits(sb) + bits_wanted;
540+ ocfs2_quota_trans_credits(sb);
541541 }
542542
543543 static inline int ocfs2_calc_symlink_credits(struct super_block *sb)
fs/ocfs2/move_extents.c+1−1
@@ -69,7 +69,7 @@ static int __ocfs2_move_extent(handle_t *handle, · 68 unmodified lines
6969 u64 ino = ocfs2_metadata_cache_owner(context->et.et_ci);
7070 u64 old_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cpos);
7171
72− ret = ocfs2_duplicate_clusters_by_page(handle, context->file, cpos,
72+ ret = ocfs2_duplicate_clusters_by_page(handle, inode, cpos,
7373 p_cpos, new_p_cpos, len);
7474 if (ret) {
7575 mlog_errno(ret);
fs/ocfs2/refcounttree.c+8−45
@@ -49,7 +49,6 @@ · 48 unmodified lines
4949
5050 struct ocfs2_cow_context {
5151 struct inode *inode;
52− struct file *file;
5352 u32 cow_start;
5453 u32 cow_len;
5554 struct ocfs2_extent_tree data_et;
@@ -66,7 +65,7 @@ struct ocfs2_cow_context { · 10 unmodified lines
6665 u32 *num_clusters,
6766 unsigned int *extent_flags);
6867 int (*cow_duplicate_clusters)(handle_t *handle,
69− struct file *file,
68+ struct inode *inode,
7069 u32 cpos, u32 old_cluster,
7170 u32 new_cluster, u32 new_len);
7271 };
@@ -2922,14 +2921,12 @@ static int ocfs2_clear_cow_buffer(handle_t *handle, struct buffer_head *bh) · 2849 unmodified lines
29222921 }
29232922
29242923 int ocfs2_duplicate_clusters_by_page(handle_t *handle,
2925− struct file *file,
2924+ struct inode *inode,
29262925 u32 cpos, u32 old_cluster,
29272926 u32 new_cluster, u32 new_len)
29282927 {
29292928 int ret = 0, partial;
2930− struct inode *inode = file_inode(file);
2931− struct ocfs2_caching_info *ci = INODE_CACHE(inode);
2932− struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
2929+ struct super_block *sb = inode->i_sb;
29332930 u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster);
29342931 struct page *page;
29352932 pgoff_t page_index;
@@ -2978,13 +2975,6 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, · 42 unmodified lines
29782975 if (PAGE_CACHE_SIZE <= OCFS2_SB(sb)->s_clustersize)
29792976 BUG_ON(PageDirty(page));
29802977
2981− if (PageReadahead(page)) {
2982− page_cache_async_readahead(mapping,
2983− &file->f_ra, file,
2984− page, page_index,
2985− readahead_pages);
2986− }
2987−
29882978 if (!PageUptodate(page)) {
29892979 ret = block_read_full_page(page, ocfs2_get_block);
29902980 if (ret) {
@@ -3004,7 +2994,8 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, · 13 unmodified lines
30042994 }
30052995 }
30062996
3007− ocfs2_map_and_dirty_page(inode, handle, from, to,
2997+ ocfs2_map_and_dirty_page(inode,
2998+ handle, from, to,
30082999 page, 0, &new_block);
30093000 mark_page_accessed(page);
30103001 unlock:
@@ -3020,12 +3011,11 @@ unlock: · 9 unmodified lines
30203011 }
30213012
30223013 int ocfs2_duplicate_clusters_by_jbd(handle_t *handle,
3023− struct file *file,
3014+ struct inode *inode,
30243015 u32 cpos, u32 old_cluster,
30253016 u32 new_cluster, u32 new_len)
30263017 {
30273018 int ret = 0;
3028− struct inode *inode = file_inode(file);
30293019 struct super_block *sb = inode->i_sb;
30303020 struct ocfs2_caching_info *ci = INODE_CACHE(inode);
30313021 int i, blocks = ocfs2_clusters_to_blocks(sb, new_len);
@@ -3150,7 +3140,7 @@ static int ocfs2_replace_clusters(handle_t *handle, · 118 unmodified lines
31503140
31513141 /*If the old clusters is unwritten, no need to duplicate. */
31523142 if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) {
3153− ret = context->cow_duplicate_clusters(handle, context->file,
3143+ ret = context->cow_duplicate_clusters(handle, context->inode,
31543144 cpos, old, new, len);
31553145 if (ret) {
31563146 mlog_errno(ret);
@@ -3428,35 +3418,12 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context) · 271 unmodified lines
34283418 return ret;
34293419 }
34303420
3431−static void ocfs2_readahead_for_cow(struct inode *inode,
3432− struct file *file,
3433− u32 start, u32 len)
3434−{
3435− struct address_space *mapping;
3436− pgoff_t index;
3437− unsigned long num_pages;
3438− int cs_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits;
3439−
3440− if (!file)
3441− return;
3442−
3443− mapping = file->f_mapping;
3444− num_pages = (len << cs_bits) >> PAGE_CACHE_SHIFT;
3445− if (!num_pages)
3446− num_pages = 1;
3447−
3448− index = ((loff_t)start << cs_bits) >> PAGE_CACHE_SHIFT;
3449− page_cache_sync_readahead(mapping, &file->f_ra, file,
3450− index, num_pages);
3451−}
3452−
34533421 /*
34543422 * Starting at cpos, try to CoW write_len clusters. Don't CoW
34553423 * past max_cpos. This will stop when it runs into a hole or an
34563424 * unrefcounted extent.
34573425 */
34583426 static int ocfs2_refcount_cow_hunk(struct inode *inode,
3459− struct file *file,
34603427 struct buffer_head *di_bh,
34613428 u32 cpos, u32 write_len, u32 max_cpos)
34623429 {
@@ -3485,8 +3452,6 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode, · 22 unmodified lines
34853452
34863453 BUG_ON(cow_len == 0);
34873454
3488− ocfs2_readahead_for_cow(inode, file, cow_start, cow_len);
3489−
34903455 context = kzalloc(sizeof(struct ocfs2_cow_context), GFP_NOFS);
34913456 if (!context) {
34923457 ret = -ENOMEM;
@@ -3508,7 +3473,6 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode, · 15 unmodified lines
35083473 context->ref_root_bh = ref_root_bh;
35093474 context->cow_duplicate_clusters = ocfs2_duplicate_clusters_by_page;
35103475 context->get_clusters = ocfs2_di_get_clusters;
3511− context->file = file;
35123476
35133477 ocfs2_init_dinode_extent_tree(&context->data_et,
35143478 INODE_CACHE(inode), di_bh);
@@ -3537,7 +3501,6 @@ out: · 22 unmodified lines
35373501 * clusters between cpos and cpos+write_len are safe to modify.
35383502 */
35393503 int ocfs2_refcount_cow(struct inode *inode,
3540− struct file *file,
35413504 struct buffer_head *di_bh,
35423505 u32 cpos, u32 write_len, u32 max_cpos)
35433506 {
@@ -3557,7 +3520,7 @@ int ocfs2_refcount_cow(struct inode *inode, · 13 unmodified lines
35573520 num_clusters = write_len;
35583521
35593522 if (ext_flags & OCFS2_EXT_REFCOUNTED) {
3560− ret = ocfs2_refcount_cow_hunk(inode, file, di_bh, cpos,
3523+ ret = ocfs2_refcount_cow_hunk(inode, di_bh, cpos,
35613524 num_clusters, max_cpos);
35623525 if (ret) {
35633526 mlog_errno(ret);
fs/ocfs2/refcounttree.h+3−3
@@ -53,7 +53,7 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, · 52 unmodified lines
5353 int *credits,
5454 int *ref_blocks);
5555 int ocfs2_refcount_cow(struct inode *inode,
56− struct file *filep, struct buffer_head *di_bh,
56+ struct buffer_head *di_bh,
5757 u32 cpos, u32 write_len, u32 max_cpos);
5858
5959 typedef int (ocfs2_post_refcount_func)(struct inode *inode,
@@ -85,11 +85,11 @@ int ocfs2_refcount_cow_xattr(struct inode *inode, · 25 unmodified lines
8585 u32 cpos, u32 write_len,
8686 struct ocfs2_post_refcount *post);
8787 int ocfs2_duplicate_clusters_by_page(handle_t *handle,
88− struct file *file,
88+ struct inode *inode,
8989 u32 cpos, u32 old_cluster,
9090 u32 new_cluster, u32 new_len);
9191 int ocfs2_duplicate_clusters_by_jbd(handle_t *handle,
92− struct file *file,
92+ struct inode *inode,
9393 u32 cpos, u32 old_cluster,
9494 u32 new_cluster, u32 new_len);
9595 int ocfs2_cow_sync_writeback(struct super_block *sb,
fs/ocfs2/super.c+1−1
@@ -1022,7 +1022,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) · 1021 unmodified lines
10221022 struct inode *inode = NULL;
10231023 struct ocfs2_super *osb = NULL;
10241024 struct buffer_head *bh = NULL;
1025− char nodestr[8];
1025+ char nodestr[12];
10261026 struct ocfs2_blockcheck_stats stats;
10271027
10281028 trace_ocfs2_fill_super(sb, data, silent);
fs/proc/fd.c+0−2
@@ -228,8 +228,6 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx, · 227 unmodified lines
228228 if (!p)
229229 return -ENOENT;
230230
231− if (!dir_emit_dots(file, ctx))
232− goto out;
233231 if (!dir_emit_dots(file, ctx))
234232 goto out;
235233 files = get_files_struct(p);
fs/proc/generic.c+1−1
@@ -271,7 +271,7 @@ int proc_readdir_de(struct proc_dir_entry *de, struct file *file, · 270 unmodified lines
271271 de = next;
272272 } while (de);
273273 spin_unlock(&proc_subdir_lock);
274− return 0;
274+ return 1;
275275 }
276276
277277 int proc_readdir(struct file *file, struct dir_context *ctx)
fs/proc/root.c+3−1
@@ -205,7 +205,9 @@ static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentr · 204 unmodified lines
205205 static int proc_root_readdir(struct file *file, struct dir_context *ctx)
206206 {
207207 if (ctx->pos < FIRST_PROCESS_ENTRY) {
208− proc_readdir(file, ctx);
208+ int error = proc_readdir(file, ctx);
209+ if (unlikely(error <= 0))
210+ return error;
209211 ctx->pos = FIRST_PROCESS_ENTRY;
210212 }
211213
fs/proc/task_mmu.c+21−10
@@ -730,8 +730,16 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma, · 729 unmodified lines
730730 * of how soft-dirty works.
731731 */
732732 pte_t ptent = *pte;
733− ptent = pte_wrprotect(ptent);
734− ptent = pte_clear_flags(ptent, _PAGE_SOFT_DIRTY);
733+
734+ if (pte_present(ptent)) {
735+ ptent = pte_wrprotect(ptent);
736+ ptent = pte_clear_flags(ptent, _PAGE_SOFT_DIRTY);
737+ } else if (is_swap_pte(ptent)) {
738+ ptent = pte_swp_clear_soft_dirty(ptent);
739+ } else if (pte_file(ptent)) {
740+ ptent = pte_file_clear_soft_dirty(ptent);
741+ }
742+
735743 set_pte_at(vma->vm_mm, addr, pte, ptent);
736744 #endif
737745 }
@@ -752,14 +760,15 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, · 14 unmodified lines
752760 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
753761 for (; addr != end; pte++, addr += PAGE_SIZE) {
754762 ptent = *pte;
755− if (!pte_present(ptent))
756− continue;
757763
758764 if (cp->type == CLEAR_REFS_SOFT_DIRTY) {
759765 clear_soft_dirty(vma, addr, pte);
760766 continue;
761767 }
762768
769+ if (!pte_present(ptent))
770+ continue;
771+
763772 page = vm_normal_page(vma, addr, ptent);
764773 if (!page)
765774 continue;
@@ -859,7 +868,7 @@ typedef struct { · 93 unmodified lines
859868 } pagemap_entry_t;
860869
861870 struct pagemapread {
862− int pos, len;
871+ int pos, len; /* units: PM_ENTRY_BYTES, not bytes */
863872 pagemap_entry_t *buffer;
864873 bool v2;
865874 };
@@ -867,7 +876,7 @@ struct pagemapread { · 1 unmodified line
867876 #define PAGEMAP_WALK_SIZE (PMD_SIZE)
868877 #define PAGEMAP_WALK_MASK (PMD_MASK)
869878
870−#define PM_ENTRY_BYTES sizeof(u64)
879+#define PM_ENTRY_BYTES sizeof(pagemap_entry_t)
871880 #define PM_STATUS_BITS 3
872881 #define PM_STATUS_OFFSET (64 - PM_STATUS_BITS)
873882 #define PM_STATUS_MASK (((1LL << PM_STATUS_BITS) - 1) << PM_STATUS_OFFSET)
@@ -930,8 +939,10 @@ static void pte_to_pagemap_entry(pagemap_entry_t *pme, struct pagemapread *pm, · 56 unmodified lines
930939 flags = PM_PRESENT;
931940 page = vm_normal_page(vma, addr, pte);
932941 } else if (is_swap_pte(pte)) {
933− swp_entry_t entry = pte_to_swp_entry(pte);
934−
942+ swp_entry_t entry;
943+ if (pte_swp_soft_dirty(pte))
944+ flags2 |= __PM_SOFT_DIRTY;
945+ entry = pte_to_swp_entry(pte);
935946 frame = swp_type(entry) |
936947 (swp_offset(entry) << MAX_SWAPFILES_SHIFT);
937948 flags = PM_SWAP;
@@ -1116,8 +1127,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, · 178 unmodified lines
11161127 goto out_task;
11171128
11181129 pm.v2 = soft_dirty_cleared;
1119− pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
1120− pm.buffer = kmalloc(pm.len, GFP_TEMPORARY);
1130+ pm.len = (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
1131+ pm.buffer = kmalloc(pm.len * PM_ENTRY_BYTES, GFP_TEMPORARY);
11211132 ret = -ENOMEM;
11221133 if (!pm.buffer)
11231134 goto out_task;
include/asm-generic/pgtable.h+30−0
@@ -417,6 +417,36 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd) · 416 unmodified lines
417417 {
418418 return pmd;
419419 }
420+
421+static inline pte_t pte_swp_mksoft_dirty(pte_t pte)
422+{
423+ return pte;
424+}
425+
426+static inline int pte_swp_soft_dirty(pte_t pte)
427+{
428+ return 0;
429+}
430+
431+static inline pte_t pte_swp_clear_soft_dirty(pte_t pte)
432+{
433+ return pte;
434+}
435+
436+static inline pte_t pte_file_clear_soft_dirty(pte_t pte)
437+{
438+ return pte;
439+}
440+
441+static inline pte_t pte_file_mksoft_dirty(pte_t pte)
442+{
443+ return pte;
444+}
445+
446+static inline int pte_file_soft_dirty(pte_t pte)
447+{
448+ return 0;
449+}
420450 #endif
421451
422452 #ifndef __HAVE_PFNMAP_TRACKING
include/asm-generic/tlb.h+1−1
@@ -112,7 +112,7 @@ struct mmu_gather { · 111 unmodified lines
112112
113113 #define HAVE_GENERIC_MMU_GATHER
114114
115−void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm);
115+void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end);
116116 void tlb_flush_mmu(struct mmu_gather *tlb);
117117 void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start,
118118 unsigned long end);
include/linux/dcache.h+10−10
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/seqlock.h>
1010 #include <linux/cache.h>
1111 #include <linux/rcupdate.h>
12+#include <linux/lockref.h>
1213
1314 struct nameidata;
1415 struct path;
@@ -100,6 +101,8 @@ extern unsigned int full_name_hash(const unsigned char *, unsigned int); · 85 unmodified lines
100101 # endif
101102 #endif
102103
104+#define d_lock d_lockref.lock
105+
103106 struct dentry {
104107 /* RCU lookup touched fields */
105108 unsigned int d_flags; /* protected by d_lock */
@@ -112,8 +115,7 @@ struct dentry { · 6 unmodified lines
112115 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
113116
114117 /* Ref lookup also touches following */
115− unsigned int d_count; /* protected by d_lock */
116− spinlock_t d_lock; /* per dentry lock */
118+ struct lockref d_lockref; /* per-dentry lock and refcount */
117119 const struct dentry_operations *d_op;
118120 struct super_block *d_sb; /* The root of the dentry tree */
119121 unsigned long d_time; /* used by d_revalidate */
@@ -318,7 +320,7 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq) · 198 unmodified lines
318320 assert_spin_locked(&dentry->d_lock);
319321 if (!read_seqcount_retry(&dentry->d_seq, seq)) {
320322 ret = 1;
321− dentry->d_count++;
323+ dentry->d_lockref.count++;
322324 }
323325
324326 return ret;
@@ -326,7 +328,7 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq) · 1 unmodified line
326328
327329 static inline unsigned d_count(const struct dentry *dentry)
328330 {
329− return dentry->d_count;
331+ return dentry->d_lockref.count;
330332 }
331333
332334 /* validate "insecure" dentry pointer */
@@ -336,6 +338,7 @@ extern int d_validate(struct dentry *, struct dentry *); · 3 unmodified lines
336338 * helper function for dentry_operations.d_dname() members
337339 */
338340 extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
341+extern char *simple_dname(struct dentry *, char *, int);
339342
340343 extern char *__d_path(const struct path *, const struct path *, char *, int);
341344 extern char *d_absolute_path(const struct path *, char *, int);
@@ -356,17 +359,14 @@ extern char *dentry_path(struct dentry *, char *, int); · 14 unmodified lines
356359 static inline struct dentry *dget_dlock(struct dentry *dentry)
357360 {
358361 if (dentry)
359− dentry->d_count++;
362+ dentry->d_lockref.count++;
360363 return dentry;
361364 }
362365
363366 static inline struct dentry *dget(struct dentry *dentry)
364367 {
365− if (dentry) {
366− spin_lock(&dentry->d_lock);
367− dget_dlock(dentry);
368− spin_unlock(&dentry->d_lock);
369− }
368+ if (dentry)
369+ lockref_get(&dentry->d_lockref);
370370 return dentry;
371371 }
372372
include/linux/inetdevice.h+1−33
@@ -5,45 +5,13 @@ · 4 unmodified lines
55
66 #include <linux/bitmap.h>
77 #include <linux/if.h>
8+#include <linux/ip.h>
89 #include <linux/netdevice.h>
910 #include <linux/rcupdate.h>
1011 #include <linux/timer.h>
1112 #include <linux/sysctl.h>
1213 #include <linux/rtnetlink.h>
1314
14−enum
15−{
16− IPV4_DEVCONF_FORWARDING=1,
17− IPV4_DEVCONF_MC_FORWARDING,
18− IPV4_DEVCONF_PROXY_ARP,
19− IPV4_DEVCONF_ACCEPT_REDIRECTS,
20− IPV4_DEVCONF_SECURE_REDIRECTS,
21− IPV4_DEVCONF_SEND_REDIRECTS,
22− IPV4_DEVCONF_SHARED_MEDIA,
23− IPV4_DEVCONF_RP_FILTER,
24− IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE,
25− IPV4_DEVCONF_BOOTP_RELAY,
26− IPV4_DEVCONF_LOG_MARTIANS,
27− IPV4_DEVCONF_TAG,
28− IPV4_DEVCONF_ARPFILTER,
29− IPV4_DEVCONF_MEDIUM_ID,
30− IPV4_DEVCONF_NOXFRM,
31− IPV4_DEVCONF_NOPOLICY,
32− IPV4_DEVCONF_FORCE_IGMP_VERSION,
33− IPV4_DEVCONF_ARP_ANNOUNCE,
34− IPV4_DEVCONF_ARP_IGNORE,
35− IPV4_DEVCONF_PROMOTE_SECONDARIES,
36− IPV4_DEVCONF_ARP_ACCEPT,
37− IPV4_DEVCONF_ARP_NOTIFY,
38− IPV4_DEVCONF_ACCEPT_LOCAL,
39− IPV4_DEVCONF_SRC_VMARK,
40− IPV4_DEVCONF_PROXY_ARP_PVLAN,
41− IPV4_DEVCONF_ROUTE_LOCALNET,
42− __IPV4_DEVCONF_MAX
43−};
44−
45−#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1)
46−
4715 struct ipv4_devconf {
4816 void *sysctl;
4917 int data[IPV4_DEVCONF_MAX];
include/linux/ipv6.h+1−0
@@ -101,6 +101,7 @@ struct inet6_skb_parm { · 100 unmodified lines
101101 #define IP6SKB_FORWARDED 2
102102 #define IP6SKB_REROUTED 4
103103 #define IP6SKB_ROUTERALERT 8
104+#define IP6SKB_FRAGMENTED 16
104105 };
105106
106107 #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
include/linux/lockref.h+71−0
@@ -0,0 +1,71 @@
1+#ifndef __LINUX_LOCKREF_H
2+#define __LINUX_LOCKREF_H
3+
4+/*
5+ * Locked reference counts.
6+ *
7+ * These are different from just plain atomic refcounts in that they
8+ * are atomic with respect to the spinlock that goes with them. In
9+ * particular, there can be implementations that don't actually get
10+ * the spinlock for the common decrement/increment operations, but they
11+ * still have to check that the operation is done semantically as if
12+ * the spinlock had been taken (using a cmpxchg operation that covers
13+ * both the lock and the count word, or using memory transactions, for
14+ * example).
15+ */
16+
17+#include <linux/spinlock.h>
18+
19+struct lockref {
20+ spinlock_t lock;
21+ unsigned int count;
22+};
23+
24+/**
25+ * lockref_get - Increments reference count unconditionally
26+ * @lockcnt: pointer to lockref structure
27+ *
28+ * This operation is only valid if you already hold a reference
29+ * to the object, so you know the count cannot be zero.
30+ */
31+static inline void lockref_get(struct lockref *lockref)
32+{
33+ spin_lock(&lockref->lock);
34+ lockref->count++;
35+ spin_unlock(&lockref->lock);
36+}
37+
38+/**
39+ * lockref_get_not_zero - Increments count unless the count is 0
40+ * @lockcnt: pointer to lockref structure
41+ * Return: 1 if count updated successfully or 0 if count is 0
42+ */
43+static inline int lockref_get_not_zero(struct lockref *lockref)
44+{
45+ int retval = 0;
46+
47+ spin_lock(&lockref->lock);
48+ if (lockref->count) {
49+ lockref->count++;
50+ retval = 1;
51+ }
52+ spin_unlock(&lockref->lock);
53+ return retval;
54+}
55+
56+/**
57+ * lockref_put_or_lock - decrements count unless count <= 1 before decrement
58+ * @lockcnt: pointer to lockref structure
59+ * Return: 1 if count updated successfully or 0 if count <= 1 and lock taken
60+ */
61+static inline int lockref_put_or_lock(struct lockref *lockref)
62+{
63+ spin_lock(&lockref->lock);
64+ if (lockref->count <= 1)
65+ return 0;
66+ lockref->count--;
67+ spin_unlock(&lockref->lock);
68+ return 1;
69+}
70+
71+#endif /* __LINUX_LOCKREF_H */
include/linux/mlx5/device.h+10−12
@@ -309,21 +309,20 @@ struct mlx5_hca_cap { · 308 unmodified lines
309309 __be16 max_desc_sz_rq;
310310 u8 rsvd21[2];
311311 __be16 max_desc_sz_sq_dc;
312− u8 rsvd22[4];
313− __be16 max_qp_mcg;
314− u8 rsvd23;
312+ __be32 max_qp_mcg;
313+ u8 rsvd22[3];
315314 u8 log_max_mcg;
316− u8 rsvd24;
315+ u8 rsvd23;
317316 u8 log_max_pd;
318− u8 rsvd25;
317+ u8 rsvd24;
319318 u8 log_max_xrcd;
320− u8 rsvd26[42];
319+ u8 rsvd25[42];
321320 __be16 log_uar_page_sz;
322− u8 rsvd27[28];
321+ u8 rsvd26[28];
323322 u8 log_msx_atomic_size_qp;
324− u8 rsvd28[2];
323+ u8 rsvd27[2];
325324 u8 log_msx_atomic_size_dc;
326− u8 rsvd29[76];
325+ u8 rsvd28[76];
327326 };
328327
329328
@@ -472,9 +471,8 @@ struct mlx5_eqe_cmd { · 142 unmodified lines
472471 struct mlx5_eqe_page_req {
473472 u8 rsvd0[2];
474473 __be16 func_id;
475− u8 rsvd1[2];
476− __be16 num_pages;
477− __be32 rsvd2[5];
474+ __be32 num_pages;
475+ __be32 rsvd1[5];
478476 };
479477
480478 union ev_data {
include/linux/mlx5/driver.h+2−5
@@ -358,7 +358,7 @@ struct mlx5_caps { · 357 unmodified lines
358358 u32 reserved_lkey;
359359 u8 local_ca_ack_delay;
360360 u8 log_max_mcg;
361− u16 max_qp_mcg;
361+ u32 max_qp_mcg;
362362 int min_page_sz;
363363 };
364364
@@ -691,7 +691,7 @@ void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); · 326 unmodified lines
691691 int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
692692 void mlx5_pagealloc_stop(struct mlx5_core_dev *dev);
693693 void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
694− s16 npages);
694+ s32 npages);
695695 int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot);
696696 int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev);
697697 void mlx5_register_debugfs(void);
@@ -731,9 +731,6 @@ void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev); · 33 unmodified lines
731731 int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db);
732732 void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
733733
734−typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size);
735−int mlx5_register_health_report_handler(health_handler_t handler);
736−void mlx5_unregister_health_report_handler(void);
737734 const char *mlx5_command_str(int command);
738735 int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
739736 void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
include/linux/mm_types.h+1−0
@@ -332,6 +332,7 @@ struct mm_struct { · 331 unmodified lines
332332 unsigned long pgoff, unsigned long flags);
333333 #endif
334334 unsigned long mmap_base; /* base of mmap area */
335+ unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */
335336 unsigned long task_size; /* size of task vm space */
336337 unsigned long highest_vm_end; /* highest vma end address */
337338 pgd_t * pgd;
include/linux/regmap.h+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/list.h>
1717 #include <linux/rbtree.h>
1818 #include <linux/err.h>
19+#include <linux/bug.h>
1920
2021 struct module;
2122 struct device;
include/linux/sched.h+6−0
@@ -1535,6 +1535,8 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk) · 1534 unmodified lines
15351535 * Test if a process is not yet dead (at most zombie state)
15361536 * If pid_alive fails, then pointers within the task structure
15371537 * can be stale and must not be dereferenced.
1538+ *
1539+ * Return: 1 if the process is alive. 0 otherwise.
15381540 */
15391541 static inline int pid_alive(struct task_struct *p)
15401542 {
@@ -1546,6 +1548,8 @@ static inline int pid_alive(struct task_struct *p) · 5 unmodified lines
15461548 * @tsk: Task structure to be checked.
15471549 *
15481550 * Check if a task structure is the first user space task the kernel created.
1551+ *
1552+ * Return: 1 if the task structure is init. 0 otherwise.
15491553 */
15501554 static inline int is_global_init(struct task_struct *tsk)
15511555 {
@@ -1897,6 +1901,8 @@ extern struct task_struct *idle_task(int cpu); · 345 unmodified lines
18971901 /**
18981902 * is_idle_task - is the specified task an idle task?
18991903 * @p: the task in question.
1904+ *
1905+ * Return: 1 if @p is an idle task. 0 otherwise.
19001906 */
19011907 static inline bool is_idle_task(const struct task_struct *p)
19021908 {
include/linux/spinlock.h+11−3
@@ -117,9 +117,17 @@ do { \ · 116 unmodified lines
117117 #endif /*arch_spin_is_contended*/
118118 #endif
119119
120−/* The lock does not imply full memory barrier. */
121−#ifndef ARCH_HAS_SMP_MB_AFTER_LOCK
122−static inline void smp_mb__after_lock(void) { smp_mb(); }
120+/*
121+ * Despite its name it doesn't necessarily has to be a full barrier.
122+ * It should only guarantee that a STORE before the critical section
123+ * can not be reordered with a LOAD inside this section.
124+ * spin_lock() is the one-way barrier, this LOAD can not escape out
125+ * of the region. So the default implementation simply ensures that
126+ * a STORE can not move into the critical section, smp_wmb() should
127+ * serialize it with another STORE done by spin_lock().
128+ */
129+#ifndef smp_mb__before_spinlock
130+#define smp_mb__before_spinlock() smp_wmb()
123131 #endif
124132
125133 /**
include/linux/swapops.h+2−0
@@ -67,6 +67,8 @@ static inline swp_entry_t pte_to_swp_entry(pte_t pte) · 66 unmodified lines
6767 swp_entry_t arch_entry;
6868
6969 BUG_ON(pte_file(pte));
70+ if (pte_swp_soft_dirty(pte))
71+ pte = pte_swp_clear_soft_dirty(pte);
7072 arch_entry = __pte_to_swp_entry(pte);
7173 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));
7274 }
include/linux/syscalls.h+5−0
@@ -802,9 +802,14 @@ asmlinkage long sys_vfork(void); · 801 unmodified lines
802802 asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
803803 int __user *);
804804 #else
805+#ifdef CONFIG_CLONE_BACKWARDS3
806+asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *,
807+ int __user *, int);
808+#else
805809 asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
806810 int __user *, int);
807811 #endif
812+#endif
808813
809814 asmlinkage long sys_execve(const char __user *filename,
810815 const char __user *const __user *argv,
include/linux/wait.h+57−0
@@ -811,6 +811,63 @@ do { \ · 810 unmodified lines
811811 __ret; \
812812 })
813813
814+#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \
815+ lock, ret) \
816+do { \
817+ DEFINE_WAIT(__wait); \
818+ \
819+ for (;;) { \
820+ prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
821+ if (condition) \
822+ break; \
823+ if (signal_pending(current)) { \
824+ ret = -ERESTARTSYS; \
825+ break; \
826+ } \
827+ spin_unlock_irq(&lock); \
828+ ret = schedule_timeout(ret); \
829+ spin_lock_irq(&lock); \
830+ if (!ret) \
831+ break; \
832+ } \
833+ finish_wait(&wq, &__wait); \
834+} while (0)
835+
836+/**
837+ * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses.
838+ * The condition is checked under the lock. This is expected
839+ * to be called with the lock taken.
840+ * @wq: the waitqueue to wait on
841+ * @condition: a C expression for the event to wait for
842+ * @lock: a locked spinlock_t, which will be released before schedule()
843+ * and reacquired afterwards.
844+ * @timeout: timeout, in jiffies
845+ *
846+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the
847+ * @condition evaluates to true or signal is received. The @condition is
848+ * checked each time the waitqueue @wq is woken up.
849+ *
850+ * wake_up() has to be called after changing any variable that could
851+ * change the result of the wait condition.
852+ *
853+ * This is supposed to be called while holding the lock. The lock is
854+ * dropped before going to sleep and is reacquired afterwards.
855+ *
856+ * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
857+ * was interrupted by a signal, and the remaining jiffies otherwise
858+ * if the condition evaluated to true before the timeout elapsed.
859+ */
860+#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \
861+ timeout) \
862+({ \
863+ int __ret = timeout; \
864+ \
865+ if (!(condition)) \
866+ __wait_event_interruptible_lock_irq_timeout( \
867+ wq, condition, lock, __ret); \
868+ __ret; \
869+})
870+
814871
815872 /*
816873 * These are the old interfaces to sleep waiting for an event.
include/net/busy_poll.h+1−6
@@ -122,7 +122,7 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock) · 121 unmodified lines
122122 if (rc > 0)
123123 /* local bh are disabled so it is ok to use _BH */
124124 NET_ADD_STATS_BH(sock_net(sk),
125− LINUX_MIB_LOWLATENCYRXPACKETS, rc);
125+ LINUX_MIB_BUSYPOLLRXPACKETS, rc);
126126
127127 } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
128128 !need_resched() && !busy_loop_timeout(end_time));
@@ -162,11 +162,6 @@ static inline bool sk_can_busy_loop(struct sock *sk) · 33 unmodified lines
162162 return false;
163163 }
164164
165−static inline bool sk_busy_poll(struct sock *sk, int nonblock)
166−{
167− return false;
168−}
169−
170165 static inline void skb_mark_napi_id(struct sk_buff *skb,
171166 struct napi_struct *napi)
172167 {
include/net/ip6_route.h+2−0
@@ -135,6 +135,8 @@ extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, · 134 unmodified lines
135135 extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,
136136 __be32 mtu);
137137 extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);
138+extern void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
139+ u32 mark);
138140 extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
139141
140142 struct netlink_callback;
include/net/ip_tunnels.h+0−14
@@ -145,20 +145,6 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, · 144 unmodified lines
145145 return INET_ECN_encapsulate(tos, inner);
146146 }
147147
148−static inline void tunnel_ip_select_ident(struct sk_buff *skb,
149− const struct iphdr *old_iph,
150− struct dst_entry *dst)
151−{
152− struct iphdr *iph = ip_hdr(skb);
153−
154− /* Use inner packet iph-id if possible. */
155− if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
156− iph->id = old_iph->id;
157− else
158− __ip_select_ident(iph, dst,
159− (skb_shinfo(skb)->gso_segs ?: 1) - 1);
160−}
161−
162148 int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
163149 int iptunnel_xmit(struct net *net, struct rtable *rt,
164150 struct sk_buff *skb,
include/net/sch_generic.h+8−1
@@ -683,13 +683,19 @@ struct psched_ratecfg { · 682 unmodified lines
683683 u64 rate_bytes_ps; /* bytes per second */
684684 u32 mult;
685685 u16 overhead;
686+ u8 linklayer;
686687 u8 shift;
687688 };
688689
689690 static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
690691 unsigned int len)
691692 {
692− return ((u64)(len + r->overhead) * r->mult) >> r->shift;
693+ len += r->overhead;
694+
695+ if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
696+ return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift;
697+
698+ return ((u64)len * r->mult) >> r->shift;
693699 }
694700
695701 extern void psched_ratecfg_precompute(struct psched_ratecfg *r, const struct tc_ratespec *conf);
@@ -700,6 +706,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, · 4 unmodified lines
700706 memset(res, 0, sizeof(*res));
701707 res->rate = r->rate_bytes_ps;
702708 res->overhead = r->overhead;
709+ res->linklayer = (r->linklayer & TC_LINKLAYER_MASK);
703710 }
704711
705712 #endif
include/uapi/linux/cm4000_cs.h+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #define _UAPI_CM4000_H_
33
44 #include <linux/types.h>
5+#include <linux/ioctl.h>
56
67 #define MAX_ATR 33
78
include/uapi/linux/ip.h+34−0
@@ -133,4 +133,38 @@ struct ip_beet_phdr { · 132 unmodified lines
133133 __u8 reserved;
134134 };
135135
136+/* index values for the variables in ipv4_devconf */
137+enum
138+{
139+ IPV4_DEVCONF_FORWARDING=1,
140+ IPV4_DEVCONF_MC_FORWARDING,
141+ IPV4_DEVCONF_PROXY_ARP,
142+ IPV4_DEVCONF_ACCEPT_REDIRECTS,
143+ IPV4_DEVCONF_SECURE_REDIRECTS,
144+ IPV4_DEVCONF_SEND_REDIRECTS,
145+ IPV4_DEVCONF_SHARED_MEDIA,
146+ IPV4_DEVCONF_RP_FILTER,
147+ IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE,
148+ IPV4_DEVCONF_BOOTP_RELAY,
149+ IPV4_DEVCONF_LOG_MARTIANS,
150+ IPV4_DEVCONF_TAG,
151+ IPV4_DEVCONF_ARPFILTER,
152+ IPV4_DEVCONF_MEDIUM_ID,
153+ IPV4_DEVCONF_NOXFRM,
154+ IPV4_DEVCONF_NOPOLICY,
155+ IPV4_DEVCONF_FORCE_IGMP_VERSION,
156+ IPV4_DEVCONF_ARP_ANNOUNCE,
157+ IPV4_DEVCONF_ARP_IGNORE,
158+ IPV4_DEVCONF_PROMOTE_SECONDARIES,
159+ IPV4_DEVCONF_ARP_ACCEPT,
160+ IPV4_DEVCONF_ARP_NOTIFY,
161+ IPV4_DEVCONF_ACCEPT_LOCAL,
162+ IPV4_DEVCONF_SRC_VMARK,
163+ IPV4_DEVCONF_PROXY_ARP_PVLAN,
164+ IPV4_DEVCONF_ROUTE_LOCALNET,
165+ __IPV4_DEVCONF_MAX
166+};
167+
168+#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1)
169+
136170 #endif /* _UAPI_LINUX_IP_H */
include/uapi/linux/pkt_sched.h+9−1
@@ -73,9 +73,17 @@ struct tc_estimator { · 72 unmodified lines
7373 #define TC_H_ROOT (0xFFFFFFFFU)
7474 #define TC_H_INGRESS (0xFFFFFFF1U)
7575
76+/* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */
77+enum tc_link_layer {
78+ TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */
79+ TC_LINKLAYER_ETHERNET,
80+ TC_LINKLAYER_ATM,
81+};
82+#define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */
83+
7684 struct tc_ratespec {
7785 unsigned char cell_log;
78− unsigned char __reserved;
86+ __u8 linklayer; /* lower 4 bits */
7987 unsigned short overhead;
8088 short cell_align;
8189 unsigned short mpu;
include/uapi/linux/snmp.h+1−1
@@ -253,7 +253,7 @@ enum · 252 unmodified lines
253253 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
254254 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */
255255 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
256− LINUX_MIB_LOWLATENCYRXPACKETS, /* LowLatencyRxPackets */
256+ LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */
257257 __LINUX_MIB_MAX
258258 };
259259
init/Kconfig+1−1
@@ -955,7 +955,7 @@ config MEMCG_SWAP_ENABLED · 954 unmodified lines
955955 Memory Resource Controller Swap Extension comes with its price in
956956 a bigger memory consumption. General purpose distribution kernels
957957 which want to enable the feature but keep it disabled by default
958− and let the user enable it by swapaccount boot command line
958+ and let the user enable it by swapaccount=1 boot command line
959959 parameter should have this option unselected.
960960 For those who want to have the feature enabled by default should
961961 select this option (if, for some reason, they need to disable it
ipc/msg.c+3−2
@@ -839,7 +839,7 @@ static inline void free_copy(struct msg_msg *copy) · 838 unmodified lines
839839
840840 static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode)
841841 {
842− struct msg_msg *msg;
842+ struct msg_msg *msg, *found = NULL;
843843 long count = 0;
844844
845845 list_for_each_entry(msg, &msq->q_messages, m_list) {
@@ -848,6 +848,7 @@ static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode) · 2 unmodified lines
848848 *msgtyp, mode)) {
849849 if (mode == SEARCH_LESSEQUAL && msg->m_type != 1) {
850850 *msgtyp = msg->m_type - 1;
851+ found = msg;
851852 } else if (mode == SEARCH_NUMBER) {
852853 if (*msgtyp == count)
853854 return msg;
@@ -857,7 +858,7 @@ static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode) · 3 unmodified lines
857858 }
858859 }
859860
860− return ERR_PTR(-EAGAIN);
861+ return found ?: ERR_PTR(-EAGAIN);
861862 }
862863
863864 long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgflg,
kernel/cpuset.c+13−7
@@ -475,13 +475,17 @@ static int validate_change(const struct cpuset *cur, const struct cpuset *trial) · 474 unmodified lines
475475
476476 /*
477477 * Cpusets with tasks - existing or newly being attached - can't
478− * have empty cpus_allowed or mems_allowed.
478+ * be changed to have empty cpus_allowed or mems_allowed.
479479 */
480480 ret = -ENOSPC;
481− if ((cgroup_task_count(cur->css.cgroup) || cur->attach_in_progress) &&
482− (cpumask_empty(trial->cpus_allowed) &&
483− nodes_empty(trial->mems_allowed)))
484− goto out;
481+ if ((cgroup_task_count(cur->css.cgroup) || cur->attach_in_progress)) {
482+ if (!cpumask_empty(cur->cpus_allowed) &&
483+ cpumask_empty(trial->cpus_allowed))
484+ goto out;
485+ if (!nodes_empty(cur->mems_allowed) &&
486+ nodes_empty(trial->mems_allowed))
487+ goto out;
488+ }
485489
486490 ret = 0;
487491 out:
@@ -1608,11 +1612,13 @@ static int cpuset_write_u64(struct cgroup *cgrp, struct cftype *cft, u64 val) · 1120 unmodified lines
16081612 {
16091613 struct cpuset *cs = cgroup_cs(cgrp);
16101614 cpuset_filetype_t type = cft->private;
1611− int retval = -ENODEV;
1615+ int retval = 0;
16121616
16131617 mutex_lock(&cpuset_mutex);
1614− if (!is_cpuset_online(cs))
1618+ if (!is_cpuset_online(cs)) {
1619+ retval = -ENODEV;
16151620 goto out_unlock;
1621+ }
16161622
16171623 switch (type) {
16181624 case FILE_CPU_EXCLUSIVE:
kernel/fork.c+6−0
@@ -1679,6 +1679,12 @@ SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags, · 1678 unmodified lines
16791679 int __user *, parent_tidptr,
16801680 int __user *, child_tidptr,
16811681 int, tls_val)
1682+#elif defined(CONFIG_CLONE_BACKWARDS3)
1683+SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp,
1684+ int, stack_size,
1685+ int __user *, parent_tidptr,
1686+ int __user *, child_tidptr,
1687+ int, tls_val)
16821688 #else
16831689 SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
16841690 int __user *, parent_tidptr,
kernel/mutex.c+2−2
@@ -686,7 +686,7 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) · 685 unmodified lines
686686 might_sleep();
687687 ret = __mutex_lock_common(&lock->base, TASK_UNINTERRUPTIBLE,
688688 0, &ctx->dep_map, _RET_IP_, ctx);
689− if (!ret && ctx->acquired > 0)
689+ if (!ret && ctx->acquired > 1)
690690 return ww_mutex_deadlock_injection(lock, ctx);
691691
692692 return ret;
@@ -702,7 +702,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) · 9 unmodified lines
702702 ret = __mutex_lock_common(&lock->base, TASK_INTERRUPTIBLE,
703703 0, &ctx->dep_map, _RET_IP_, ctx);
704704
705− if (!ret && ctx->acquired > 0)
705+ if (!ret && ctx->acquired > 1)
706706 return ww_mutex_deadlock_injection(lock, ctx);
707707
708708 return ret;
kernel/power/qos.c+13−7
@@ -296,6 +296,17 @@ int pm_qos_request_active(struct pm_qos_request *req) · 295 unmodified lines
296296 }
297297 EXPORT_SYMBOL_GPL(pm_qos_request_active);
298298
299+static void __pm_qos_update_request(struct pm_qos_request *req,
300+ s32 new_value)
301+{
302+ trace_pm_qos_update_request(req->pm_qos_class, new_value);
303+
304+ if (new_value != req->node.prio)
305+ pm_qos_update_target(
306+ pm_qos_array[req->pm_qos_class]->constraints,
307+ &req->node, PM_QOS_UPDATE_REQ, new_value);
308+}
309+
299310 /**
300311 * pm_qos_work_fn - the timeout handler of pm_qos_update_request_timeout
301312 * @work: work struct for the delayed work (timeout)
@@ -308,7 +319,7 @@ static void pm_qos_work_fn(struct work_struct *work) · 6 unmodified lines
308319 struct pm_qos_request,
309320 work);
310321
311− pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE);
322+ __pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE);
312323 }
313324
314325 /**
@@ -364,12 +375,7 @@ void pm_qos_update_request(struct pm_qos_request *req, · 49 unmodified lines
364375 }
365376
366377 cancel_delayed_work_sync(&req->work);
367−
368− trace_pm_qos_update_request(req->pm_qos_class, new_value);
369− if (new_value != req->node.prio)
370− pm_qos_update_target(
371− pm_qos_array[req->pm_qos_class]->constraints,
372− &req->node, PM_QOS_UPDATE_REQ, new_value);
378+ __pm_qos_update_request(req, new_value);
373379 }
374380 EXPORT_SYMBOL_GPL(pm_qos_update_request);
375381
kernel/sched/core.c+74−22
@@ -933,6 +933,8 @@ static int effective_prio(struct task_struct *p) · 932 unmodified lines
933933 /**
934934 * task_curr - is this task currently executing on a CPU?
935935 * @p: the task in question.
936+ *
937+ * Return: 1 if the task is currently executing. 0 otherwise.
936938 */
937939 inline int task_curr(const struct task_struct *p)
938940 {
@@ -1482,7 +1484,7 @@ static void ttwu_queue(struct task_struct *p, int cpu) · 543 unmodified lines
14821484 * the simpler "current->state = TASK_RUNNING" to mark yourself
14831485 * runnable without the overhead of this.
14841486 *
1485− * Returns %true if @p was woken up, %false if it was already running
1487+ * Return: %true if @p was woken up, %false if it was already running.
14861488 * or @state didn't match @p's state.
14871489 */
14881490 static int
@@ -1491,7 +1493,13 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) · 2 unmodified lines
14911493 unsigned long flags;
14921494 int cpu, success = 0;
14931495
1494− smp_wmb();
1496+ /*
1497+ * If we are going to wake up a thread waiting for CONDITION we
1498+ * need to ensure that CONDITION=1 done by the caller can not be
1499+ * reordered with p->state check below. This pairs with mb() in
1500+ * set_current_state() the waiting thread does.
1501+ */
1502+ smp_mb__before_spinlock();
14951503 raw_spin_lock_irqsave(&p->pi_lock, flags);
14961504 if (!(p->state & state))
14971505 goto out;
@@ -1577,8 +1585,9 @@ out: · 79 unmodified lines
15771585 * @p: The process to be woken up.
15781586 *
15791587 * Attempt to wake up the nominated process and move it to the set of runnable
1580− * processes. Returns 1 if the process was woken up, 0 if it was already
1581− * running.
1588+ * processes.
1589+ *
1590+ * Return: 1 if the process was woken up, 0 if it was already running.
15821591 *
15831592 * It may be assumed that this function implies a write memory barrier before
15841593 * changing the task state if and only if any tasks are woken up.
@@ -2191,6 +2200,8 @@ void scheduler_tick(void) · 606 unmodified lines
21912200 * This makes sure that uptime, CFS vruntime, load
21922201 * balancing, etc... continue to move forward, even
21932202 * with a very low granularity.
2203+ *
2204+ * Return: Maximum deferment in nanoseconds.
21942205 */
21952206 u64 scheduler_tick_max_deferment(void)
21962207 {
@@ -2394,6 +2405,12 @@ need_resched: · 197 unmodified lines
23942405 if (sched_feat(HRTICK))
23952406 hrtick_clear(rq);
23962407
2408+ /*
2409+ * Make sure that signal_pending_state()->signal_pending() below
2410+ * can't be reordered with __set_current_state(TASK_INTERRUPTIBLE)
2411+ * done by the caller to avoid the race with signal_wake_up().
2412+ */
2413+ smp_mb__before_spinlock();
23972414 raw_spin_lock_irq(&rq->lock);
23982415
23992416 switch_count = &prev->nivcsw;
@@ -2796,8 +2813,8 @@ EXPORT_SYMBOL(wait_for_completion); · 396 unmodified lines
27962813 * specified timeout to expire. The timeout is in jiffies. It is not
27972814 * interruptible.
27982815 *
2799− * The return value is 0 if timed out, and positive (at least 1, or number of
2800− * jiffies left till timeout) if completed.
2816+ * Return: 0 if timed out, and positive (at least 1, or number of jiffies left
2817+ * till timeout) if completed.
28012818 */
28022819 unsigned long __sched
28032820 wait_for_completion_timeout(struct completion *x, unsigned long timeout)
@@ -2829,8 +2846,8 @@ EXPORT_SYMBOL(wait_for_completion_io); · 25 unmodified lines
28292846 * specified timeout to expire. The timeout is in jiffies. It is not
28302847 * interruptible. The caller is accounted as waiting for IO.
28312848 *
2832− * The return value is 0 if timed out, and positive (at least 1, or number of
2833− * jiffies left till timeout) if completed.
2849+ * Return: 0 if timed out, and positive (at least 1, or number of jiffies left
2850+ * till timeout) if completed.
28342851 */
28352852 unsigned long __sched
28362853 wait_for_completion_io_timeout(struct completion *x, unsigned long timeout)
@@ -2846,7 +2863,7 @@ EXPORT_SYMBOL(wait_for_completion_io_timeout); · 9 unmodified lines
28462863 * This waits for completion of a specific task to be signaled. It is
28472864 * interruptible.
28482865 *
2849− * The return value is -ERESTARTSYS if interrupted, 0 if completed.
2866+ * Return: -ERESTARTSYS if interrupted, 0 if completed.
28502867 */
28512868 int __sched wait_for_completion_interruptible(struct completion *x)
28522869 {
@@ -2865,8 +2882,8 @@ EXPORT_SYMBOL(wait_for_completion_interruptible); · 12 unmodified lines
28652882 * This waits for either a completion of a specific task to be signaled or for a
28662883 * specified timeout to expire. It is interruptible. The timeout is in jiffies.
28672884 *
2868− * The return value is -ERESTARTSYS if interrupted, 0 if timed out,
2869− * positive (at least 1, or number of jiffies left till timeout) if completed.
2885+ * Return: -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1,
2886+ * or number of jiffies left till timeout) if completed.
28702887 */
28712888 long __sched
28722889 wait_for_completion_interruptible_timeout(struct completion *x,
@@ -2883,7 +2900,7 @@ EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); · 10 unmodified lines
28832900 * This waits to be signaled for completion of a specific task. It can be
28842901 * interrupted by a kill signal.
28852902 *
2886− * The return value is -ERESTARTSYS if interrupted, 0 if completed.
2903+ * Return: -ERESTARTSYS if interrupted, 0 if completed.
28872904 */
28882905 int __sched wait_for_completion_killable(struct completion *x)
28892906 {
@@ -2903,8 +2920,8 @@ EXPORT_SYMBOL(wait_for_completion_killable); · 13 unmodified lines
29032920 * signaled or for a specified timeout to expire. It can be
29042921 * interrupted by a kill signal. The timeout is in jiffies.
29052922 *
2906− * The return value is -ERESTARTSYS if interrupted, 0 if timed out,
2907− * positive (at least 1, or number of jiffies left till timeout) if completed.
2923+ * Return: -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1,
2924+ * or number of jiffies left till timeout) if completed.
29082925 */
29092926 long __sched
29102927 wait_for_completion_killable_timeout(struct completion *x,
@@ -2918,7 +2935,7 @@ EXPORT_SYMBOL(wait_for_completion_killable_timeout); · 7 unmodified lines
29182935 * try_wait_for_completion - try to decrement a completion without blocking
29192936 * @x: completion structure
29202937 *
2921− * Returns: 0 if a decrement cannot be done without blocking
2938+ * Return: 0 if a decrement cannot be done without blocking
29222939 * 1 if a decrement succeeded.
29232940 *
29242941 * If a completion is being used as a counting completion,
@@ -2945,7 +2962,7 @@ EXPORT_SYMBOL(try_wait_for_completion); · 20 unmodified lines
29452962 * completion_done - Test to see if a completion has any waiters
29462963 * @x: completion structure
29472964 *
2948− * Returns: 0 if there are waiters (wait_for_completion() in progress)
2965+ * Return: 0 if there are waiters (wait_for_completion() in progress)
29492966 * 1 if there are no waiters.
29502967 *
29512968 */
@@ -3182,7 +3199,7 @@ SYSCALL_DEFINE1(nice, int, increment) · 230 unmodified lines
31823199 * task_prio - return the priority value of a given task.
31833200 * @p: the task in question.
31843201 *
3185− * This is the priority value as seen by users in /proc.
3202+ * Return: The priority value as seen by users in /proc.
31863203 * RT tasks are offset by -200. Normal tasks are centered
31873204 * around 0, value goes from -16 to +15.
31883205 */
@@ -3194,6 +3211,8 @@ int task_prio(const struct task_struct *p) · 5 unmodified lines
31943211 /**
31953212 * task_nice - return the nice value of a given task.
31963213 * @p: the task in question.
3214+ *
3215+ * Return: The nice value [ -20 ... 0 ... 19 ].
31973216 */
31983217 int task_nice(const struct task_struct *p)
31993218 {
@@ -3204,6 +3223,8 @@ EXPORT_SYMBOL(task_nice); · 4 unmodified lines
32043223 /**
32053224 * idle_cpu - is a given cpu idle currently?
32063225 * @cpu: the processor in question.
3226+ *
3227+ * Return: 1 if the CPU is currently idle. 0 otherwise.
32073228 */
32083229 int idle_cpu(int cpu)
32093230 {
@@ -3226,6 +3247,8 @@ int idle_cpu(int cpu) · 16 unmodified lines
32263247 /**
32273248 * idle_task - return the idle task for a given cpu.
32283249 * @cpu: the processor in question.
3250+ *
3251+ * Return: The idle task for the cpu @cpu.
32293252 */
32303253 struct task_struct *idle_task(int cpu)
32313254 {
@@ -3235,6 +3258,8 @@ struct task_struct *idle_task(int cpu) · 3 unmodified lines
32353258 /**
32363259 * find_process_by_pid - find a process with a matching PID value.
32373260 * @pid: the pid in question.
3261+ *
3262+ * The task of @pid, if found. %NULL otherwise.
32383263 */
32393264 static struct task_struct *find_process_by_pid(pid_t pid)
32403265 {
@@ -3432,6 +3457,8 @@ recheck: · 191 unmodified lines
34323457 * @policy: new policy.
34333458 * @param: structure containing the new RT priority.
34343459 *
3460+ * Return: 0 on success. An error code otherwise.
3461+ *
34353462 * NOTE that the task may be already dead.
34363463 */
34373464 int sched_setscheduler(struct task_struct *p, int policy,
@@ -3451,6 +3478,8 @@ EXPORT_SYMBOL_GPL(sched_setscheduler); · 13 unmodified lines
34513478 * current context has permission. For example, this is needed in
34523479 * stop_machine(): we create temporary high priority worker threads,
34533480 * but our caller might not have that capability.
3481+ *
3482+ * Return: 0 on success. An error code otherwise.
34543483 */
34553484 int sched_setscheduler_nocheck(struct task_struct *p, int policy,
34563485 const struct sched_param *param)
@@ -3485,6 +3514,8 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) · 28 unmodified lines
34853514 * @pid: the pid in question.
34863515 * @policy: new policy.
34873516 * @param: structure containing the new RT priority.
3517+ *
3518+ * Return: 0 on success. An error code otherwise.
34883519 */
34893520 SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,
34903521 struct sched_param __user *, param)
@@ -3500,6 +3531,8 @@ SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, · 9 unmodified lines
35003531 * sys_sched_setparam - set/change the RT priority of a thread
35013532 * @pid: the pid in question.
35023533 * @param: structure containing the new RT priority.
3534+ *
3535+ * Return: 0 on success. An error code otherwise.
35033536 */
35043537 SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
35053538 {
@@ -3509,6 +3542,9 @@ SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param) · 3 unmodified lines
35093542 /**
35103543 * sys_sched_getscheduler - get the policy (scheduling class) of a thread
35113544 * @pid: the pid in question.
3545+ *
3546+ * Return: On success, the policy of the thread. Otherwise, a negative error
3547+ * code.
35123548 */
35133549 SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
35143550 {
@@ -3535,6 +3571,9 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid) · 20 unmodified lines
35353571 * sys_sched_getparam - get the RT priority of a thread
35363572 * @pid: the pid in question.
35373573 * @param: structure containing the RT priority.
3574+ *
3575+ * Return: On success, 0 and the RT priority is in @param. Otherwise, an error
3576+ * code.
35383577 */
35393578 SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
35403579 {
@@ -3659,6 +3698,8 @@ static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, · 118 unmodified lines
36593698 * @pid: pid of the process
36603699 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
36613700 * @user_mask_ptr: user-space pointer to the new cpu mask
3701+ *
3702+ * Return: 0 on success. An error code otherwise.
36623703 */
36633704 SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
36643705 unsigned long __user *, user_mask_ptr)
@@ -3710,6 +3751,8 @@ out_unlock: · 45 unmodified lines
37103751 * @pid: pid of the process
37113752 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
37123753 * @user_mask_ptr: user-space pointer to hold the current cpu mask
3754+ *
3755+ * Return: 0 on success. An error code otherwise.
37133756 */
37143757 SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
37153758 unsigned long __user *, user_mask_ptr)
@@ -3744,6 +3787,8 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len, · 28 unmodified lines
37443787 *
37453788 * This function yields the current CPU to other tasks. If there are no
37463789 * other threads running on this CPU then this function will return.
3790+ *
3791+ * Return: 0.
37473792 */
37483793 SYSCALL_DEFINE0(sched_yield)
37493794 {
@@ -3869,7 +3914,7 @@ EXPORT_SYMBOL(yield); · 119 unmodified lines
38693914 * It's the caller's job to ensure that the target task struct
38703915 * can't go away on us before we can do any checks.
38713916 *
3872− * Returns:
3917+ * Return:
38733918 * true (>0) if we indeed boosted the target task.
38743919 * false (0) if we failed to boost the target.
38753920 * -ESRCH if there's no task to yield to.
@@ -3972,8 +4017,9 @@ long __sched io_schedule_timeout(long timeout) · 96 unmodified lines
39724017 * sys_sched_get_priority_max - return maximum RT priority.
39734018 * @policy: scheduling class.
39744019 *
3975− * this syscall returns the maximum rt_priority that can be used
3976− * by a given scheduling class.
4020+ * Return: On success, this syscall returns the maximum
4021+ * rt_priority that can be used by a given scheduling class.
4022+ * On failure, a negative error code is returned.
39774023 */
39784024 SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
39794025 {
@@ -3997,8 +4043,9 @@ SYSCALL_DEFINE1(sched_get_priority_max, int, policy) · 17 unmodified lines
39974043 * sys_sched_get_priority_min - return minimum RT priority.
39984044 * @policy: scheduling class.
39994045 *
4000− * this syscall returns the minimum rt_priority that can be used
4001− * by a given scheduling class.
4046+ * Return: On success, this syscall returns the minimum
4047+ * rt_priority that can be used by a given scheduling class.
4048+ * On failure, a negative error code is returned.
40024049 */
40034050 SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
40044051 {
@@ -4024,6 +4071,9 @@ SYSCALL_DEFINE1(sched_get_priority_min, int, policy) · 19 unmodified lines
40244071 *
40254072 * this syscall writes the default timeslice value of a given process
40264073 * into the user-space timespec buffer. A value of '0' means infinity.
4074+ *
4075+ * Return: On success, 0 and the timeslice is in @interval. Otherwise,
4076+ * an error code.
40274077 */
40284078 SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
40294079 struct timespec __user *, interval)
@@ -6637,6 +6687,8 @@ void normalize_rt_tasks(void) · 2607 unmodified lines
66376687 * @cpu: the processor in question.
66386688 *
66396689 * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!
6690+ *
6691+ * Return: The current task for @cpu.
66406692 */
66416693 struct task_struct *curr_task(int cpu)
66426694 {
kernel/sched/cpupri.c+2−2
@@ -62,7 +62,7 @@ static int convert_prio(int prio) · 61 unmodified lines
6262 * any discrepancies created by racing against the uncertainty of the current
6363 * priority configuration.
6464 *
65− * Returns: (int)bool - CPUs were found
65+ * Return: (int)bool - CPUs were found
6666 */
6767 int cpupri_find(struct cpupri *cp, struct task_struct *p,
6868 struct cpumask *lowest_mask)
@@ -203,7 +203,7 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) · 134 unmodified lines
203203 * cpupri_init - initialize the cpupri structure
204204 * @cp: The cpupri context
205205 *
206− * Returns: -ENOMEM if memory fails.
206+ * Return: -ENOMEM on memory allocation failure.
207207 */
208208 int cpupri_init(struct cpupri *cp)
209209 {
kernel/sched/fair.c+8−2
@@ -2032,6 +2032,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) · 2031 unmodified lines
20322032 */
20332033 update_entity_load_avg(curr, 1);
20342034 update_cfs_rq_blocked_load(cfs_rq, 1);
2035+ update_cfs_shares(cfs_rq);
20352036
20362037 #ifdef CONFIG_SCHED_HRTICK
20372038 /*
@@ -4324,6 +4325,8 @@ struct sg_lb_stats { · 2286 unmodified lines
43244325 * get_sd_load_idx - Obtain the load index for a given sched domain.
43254326 * @sd: The sched_domain whose load_idx is to be obtained.
43264327 * @idle: The Idle status of the CPU for whose sd load_icx is obtained.
4328+ *
4329+ * Return: The load index.
43274330 */
43284331 static inline int get_sd_load_idx(struct sched_domain *sd,
43294332 enum cpu_idle_type idle)
@@ -4618,6 +4621,9 @@ static inline void update_sg_lb_stats(struct lb_env *env, · 288 unmodified lines
46184621 *
46194622 * Determine if @sg is a busier group than the previously selected
46204623 * busiest group.
4624+ *
4625+ * Return: %true if @sg is a busier group than the previously selected
4626+ * busiest group. %false otherwise.
46214627 */
46224628 static bool update_sd_pick_busiest(struct lb_env *env,
46234629 struct sd_lb_stats *sds,
@@ -4735,7 +4741,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, · 111 unmodified lines
47354741 * assuming lower CPU number will be equivalent to lower a SMT thread
47364742 * number.
47374743 *
4738− * Returns 1 when packing is required and a task should be moved to
4744+ * Return: 1 when packing is required and a task should be moved to
47394745 * this CPU. The amount of the imbalance is returned in *imbalance.
47404746 *
47414747 * @env: The load balancing environment.
@@ -4913,7 +4919,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s · 171 unmodified lines
49134919 * @balance: Pointer to a variable indicating if this_cpu
49144920 * is the appropriate cpu to perform load balancing at this_level.
49154921 *
4916− * Returns: - the busiest group if imbalance exists.
4922+ * Return: - The busiest group if imbalance exists.
49174923 * - If no imbalance and user has opted for power-savings balance,
49184924 * return the least loaded group whose CPUs can be
49194925 * put to idle by rebalancing its tasks onto our group.
kernel/time/sched_clock.c+1−1
@@ -121,7 +121,7 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate) · 120 unmodified lines
121121 BUG_ON(bits > 32);
122122 WARN_ON(!irqs_disabled());
123123 read_sched_clock = read;
124− sched_clock_mask = (1 << bits) - 1;
124+ sched_clock_mask = (1ULL << bits) - 1;
125125 cd.rate = rate;
126126
127127 /* calculate the mult/shift to convert counter ticks to ns. */
kernel/time/tick-sched.c+2−3
@@ -182,7 +182,8 @@ static bool can_stop_full_tick(void) · 181 unmodified lines
182182 * Don't allow the user to think they can get
183183 * full NO_HZ with this machine.
184184 */
185− WARN_ONCE(1, "NO_HZ FULL will not work with unstable sched clock");
185+ WARN_ONCE(have_nohz_full_mask,
186+ "NO_HZ FULL will not work with unstable sched clock");
186187 return false;
187188 }
188189 #endif
@@ -343,8 +344,6 @@ static int tick_nohz_init_all(void) · 154 unmodified lines
343344
344345 void __init tick_nohz_init(void)
345346 {
346− int cpu;
347−
348347 if (!have_nohz_full_mask) {
349348 if (tick_nohz_init_all() < 0)
350349 return;
kernel/time/timer_list.c+24−17
@@ -265,10 +265,9 @@ static inline void timer_list_header(struct seq_file *m, u64 now) · 264 unmodified lines
265265 static int timer_list_show(struct seq_file *m, void *v)
266266 {
267267 struct timer_list_iter *iter = v;
268− u64 now = ktime_to_ns(ktime_get());
269268
270269 if (iter->cpu == -1 && !iter->second_pass)
271− timer_list_header(m, now);
270+ timer_list_header(m, iter->now);
272271 else if (!iter->second_pass)
273272 print_cpu(m, iter->cpu, iter->now);
274273 #ifdef CONFIG_GENERIC_CLOCKEVENTS
@@ -298,33 +297,41 @@ void sysrq_timer_list_show(void) · 23 unmodified lines
298297 return;
299298 }
300299
301−static void *timer_list_start(struct seq_file *file, loff_t *offset)
300+static void *move_iter(struct timer_list_iter *iter, loff_t offset)
302301 {
303− struct timer_list_iter *iter = file->private;
304−
305− if (!*offset) {
306− iter->cpu = -1;
307− iter->now = ktime_to_ns(ktime_get());
308− } else if (iter->cpu >= nr_cpu_ids) {
302+ for (; offset; offset--) {
303+ iter->cpu = cpumask_next(iter->cpu, cpu_online_mask);
304+ if (iter->cpu >= nr_cpu_ids) {
309305 #ifdef CONFIG_GENERIC_CLOCKEVENTS
310− if (!iter->second_pass) {
311− iter->cpu = -1;
312− iter->second_pass = true;
313− } else
314− return NULL;
306+ if (!iter->second_pass) {
307+ iter->cpu = -1;
308+ iter->second_pass = true;
309+ } else
310+ return NULL;
315311 #else
316− return NULL;
312+ return NULL;
317313 #endif
314+ }
318315 }
319316 return iter;
320317 }
321318
319+static void *timer_list_start(struct seq_file *file, loff_t *offset)
320+{
321+ struct timer_list_iter *iter = file->private;
322+
323+ if (!*offset)
324+ iter->now = ktime_to_ns(ktime_get());
325+ iter->cpu = -1;
326+ iter->second_pass = false;
327+ return move_iter(iter, *offset);
328+}
329+
322330 static void *timer_list_next(struct seq_file *file, void *v, loff_t *offset)
323331 {
324332 struct timer_list_iter *iter = file->private;
325− iter->cpu = cpumask_next(iter->cpu, cpu_online_mask);
326333 ++*offset;
327− return timer_list_start(file, offset);
334+ return move_iter(iter, 1);
328335 }
329336
330337 static void timer_list_stop(struct seq_file *seq, void *v)
kernel/wait.c+1−2
@@ -363,8 +363,7 @@ EXPORT_SYMBOL(out_of_line_wait_on_atomic_t); · 362 unmodified lines
363363
364364 /**
365365 * wake_up_atomic_t - Wake up a waiter on a atomic_t
366− * @word: The word being waited on, a kernel virtual address
367− * @bit: The bit of the word being waited on
366+ * @p: The atomic_t being waited on, a kernel virtual address
368367 *
369368 * Wake up anyone waiting for the atomic_t to go to zero.
370369 *
lib/lz4/lz4_compress.c+2−2
@@ -437,7 +437,7 @@ int lz4_compress(const unsigned char *src, size_t src_len, · 436 unmodified lines
437437 exit:
438438 return ret;
439439 }
440−EXPORT_SYMBOL_GPL(lz4_compress);
440+EXPORT_SYMBOL(lz4_compress);
441441
442−MODULE_LICENSE("GPL");
442+MODULE_LICENSE("Dual BSD/GPL");
443443 MODULE_DESCRIPTION("LZ4 compressor");
lib/lz4/lz4_decompress.c+3−3
@@ -299,7 +299,7 @@ exit_0: · 298 unmodified lines
299299 return ret;
300300 }
301301 #ifndef STATIC
302−EXPORT_SYMBOL_GPL(lz4_decompress);
302+EXPORT_SYMBOL(lz4_decompress);
303303 #endif
304304
305305 int lz4_decompress_unknownoutputsize(const char *src, size_t src_len,
@@ -319,8 +319,8 @@ exit_0: · 13 unmodified lines
319319 return ret;
320320 }
321321 #ifndef STATIC
322−EXPORT_SYMBOL_GPL(lz4_decompress_unknownoutputsize);
322+EXPORT_SYMBOL(lz4_decompress_unknownoutputsize);
323323
324−MODULE_LICENSE("GPL");
324+MODULE_LICENSE("Dual BSD/GPL");
325325 MODULE_DESCRIPTION("LZ4 Decompressor");
326326 #endif
lib/lz4/lz4hc_compress.c+2−2
@@ -533,7 +533,7 @@ int lz4hc_compress(const unsigned char *src, size_t src_len, · 532 unmodified lines
533533 exit:
534534 return ret;
535535 }
536−EXPORT_SYMBOL_GPL(lz4hc_compress);
536+EXPORT_SYMBOL(lz4hc_compress);
537537
538−MODULE_LICENSE("GPL");
538+MODULE_LICENSE("Dual BSD/GPL");
539539 MODULE_DESCRIPTION("LZ4HC compressor");
mm/fremap.c+8−3
@@ -57,17 +57,22 @@ static int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, · 56 unmodified lines
5757 unsigned long addr, unsigned long pgoff, pgprot_t prot)
5858 {
5959 int err = -ENOMEM;
60− pte_t *pte;
60+ pte_t *pte, ptfile;
6161 spinlock_t *ptl;
6262
6363 pte = get_locked_pte(mm, addr, &ptl);
6464 if (!pte)
6565 goto out;
6666
67− if (!pte_none(*pte))
67+ ptfile = pgoff_to_pte(pgoff);
68+
69+ if (!pte_none(*pte)) {
70+ if (pte_present(*pte) && pte_soft_dirty(*pte))
71+ pte_file_mksoft_dirty(ptfile);
6872 zap_pte(mm, vma, addr, pte);
73+ }
6974
70− set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff));
75+ set_pte_at(mm, addr, pte, ptfile);
7176 /*
7277 * We don't need to run update_mmu_cache() here because the "file pte"
7378 * being installed by install_file_pte() is not a real pte - it's a
mm/hugetlb.c+1−1
@@ -2490,7 +2490,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, · 2489 unmodified lines
24902490
24912491 mm = vma->vm_mm;
24922492
2493− tlb_gather_mmu(&tlb, mm, 0);
2493+ tlb_gather_mmu(&tlb, mm, start, end);
24942494 __unmap_hugepage_range(&tlb, vma, start, end, ref_page);
24952495 tlb_finish_mmu(&tlb, start, end);
24962496 }
mm/memcontrol.c+2−3
@@ -3195,11 +3195,11 @@ int memcg_register_cache(struct mem_cgroup *memcg, struct kmem_cache *s, · 3194 unmodified lines
31953195 if (!s->memcg_params)
31963196 return -ENOMEM;
31973197
3198− INIT_WORK(&s->memcg_params->destroy,
3199− kmem_cache_destroy_work_func);
32003198 if (memcg) {
32013199 s->memcg_params->memcg = memcg;
32023200 s->memcg_params->root_cache = root_cache;
3201+ INIT_WORK(&s->memcg_params->destroy,
3202+ kmem_cache_destroy_work_func);
32033203 } else
32043204 s->memcg_params->is_root_cache = true;
32053205
@@ -6969,7 +6969,6 @@ struct cgroup_subsys mem_cgroup_subsys = { · 3763 unmodified lines
69696969 #ifdef CONFIG_MEMCG_SWAP
69706970 static int __init enable_swap_account(char *s)
69716971 {
6972− /* consider enabled if no parameter or 1 is given */
69736972 if (!strcmp(s, "1"))
69746973 really_do_swap_account = 1;
69756974 else if (!strcmp(s, "0"))
mm/memory.c+31−18
@@ -209,14 +209,15 @@ static int tlb_next_batch(struct mmu_gather *tlb) · 208 unmodified lines
209209 * tear-down from @mm. The @fullmm argument is used when @mm is without
210210 * users and we're going to destroy the full address space (exit/execve).
211211 */
212−void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm)
212+void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
213213 {
214214 tlb->mm = mm;
215215
216− tlb->fullmm = fullmm;
216+ /* Is it from 0 to ~0? */
217+ tlb->fullmm = !(start | (end+1));
217218 tlb->need_flush_all = 0;
218− tlb->start = -1UL;
219− tlb->end = 0;
219+ tlb->start = start;
220+ tlb->end = end;
220221 tlb->need_flush = 0;
221222 tlb->local.next = NULL;
222223 tlb->local.nr = 0;
@@ -256,8 +257,6 @@ void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long e · 33 unmodified lines
256257 {
257258 struct mmu_gather_batch *batch, *next;
258259
259− tlb->start = start;
260− tlb->end = end;
261260 tlb_flush_mmu(tlb);
262261
263262 /* keep the page table cache within bounds */
@@ -1099,7 +1098,6 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, · 835 unmodified lines
10991098 spinlock_t *ptl;
11001099 pte_t *start_pte;
11011100 pte_t *pte;
1102− unsigned long range_start = addr;
11031101
11041102 again:
11051103 init_rss_vec(rss);
@@ -1141,9 +1139,12 @@ again: · 35 unmodified lines
11411139 continue;
11421140 if (unlikely(details) && details->nonlinear_vma
11431141 && linear_page_index(details->nonlinear_vma,
1144− addr) != page->index)
1145− set_pte_at(mm, addr, pte,
1146− pgoff_to_pte(page->index));
1142+ addr) != page->index) {
1143+ pte_t ptfile = pgoff_to_pte(page->index);
1144+ if (pte_soft_dirty(ptent))
1145+ pte_file_mksoft_dirty(ptfile);
1146+ set_pte_at(mm, addr, pte, ptfile);
1147+ }
11471148 if (PageAnon(page))
11481149 rss[MM_ANONPAGES]--;
11491150 else {
@@ -1202,17 +1203,25 @@ again: · 52 unmodified lines
12021203 * and page-free while holding it.
12031204 */
12041205 if (force_flush) {
1206+ unsigned long old_end;
1207+
12051208 force_flush = 0;
12061209
1207−#ifdef HAVE_GENERIC_MMU_GATHER
1208− tlb->start = range_start;
1210+ /*
1211+ * Flush the TLB just for the previous segment,
1212+ * then update the range to be the remaining
1213+ * TLB range.
1214+ */
1215+ old_end = tlb->end;
12091216 tlb->end = addr;
1210−#endif
1217+
12111218 tlb_flush_mmu(tlb);
1212− if (addr != end) {
1213− range_start = addr;
1219+
1220+ tlb->start = addr;
1221+ tlb->end = old_end;
1222+
1223+ if (addr != end)
12141224 goto again;
1215− }
12161225 }
12171226
12181227 return addr;
@@ -1397,7 +1406,7 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long start, · 178 unmodified lines
13971406 unsigned long end = start + size;
13981407
13991408 lru_add_drain();
1400− tlb_gather_mmu(&tlb, mm, 0);
1409+ tlb_gather_mmu(&tlb, mm, start, end);
14011410 update_hiwater_rss(mm);
14021411 mmu_notifier_invalidate_range_start(mm, start, end);
14031412 for ( ; vma && vma->vm_start < end; vma = vma->vm_next)
@@ -1423,7 +1432,7 @@ static void zap_page_range_single(struct vm_area_struct *vma, unsigned long addr · 19 unmodified lines
14231432 unsigned long end = address + size;
14241433
14251434 lru_add_drain();
1426− tlb_gather_mmu(&tlb, mm, 0);
1435+ tlb_gather_mmu(&tlb, mm, address, end);
14271436 update_hiwater_rss(mm);
14281437 mmu_notifier_invalidate_range_start(mm, address, end);
14291438 unmap_single_vma(&tlb, vma, address, end, details);
@@ -3115,6 +3124,8 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, · 1685 unmodified lines
31153124 exclusive = 1;
31163125 }
31173126 flush_icache_page(vma, page);
3127+ if (pte_swp_soft_dirty(orig_pte))
3128+ pte = pte_mksoft_dirty(pte);
31183129 set_pte_at(mm, address, page_table, pte);
31193130 if (page == swapcache)
31203131 do_page_add_anon_rmap(page, vma, address, exclusive);
@@ -3408,6 +3419,8 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, · 287 unmodified lines
34083419 entry = mk_pte(page, vma->vm_page_prot);
34093420 if (flags & FAULT_FLAG_WRITE)
34103421 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
3422+ else if (pte_file(orig_pte) && pte_file_soft_dirty(orig_pte))
3423+ pte_mksoft_dirty(entry);
34113424 if (anon) {
34123425 inc_mm_counter_fast(mm, MM_ANONPAGES);
34133426 page_add_new_anon_rmap(page, vma, address);
mm/mmap.c+2−2
@@ -2336,7 +2336,7 @@ static void unmap_region(struct mm_struct *mm, · 2335 unmodified lines
23362336 struct mmu_gather tlb;
23372337
23382338 lru_add_drain();
2339− tlb_gather_mmu(&tlb, mm, 0);
2339+ tlb_gather_mmu(&tlb, mm, start, end);
23402340 update_hiwater_rss(mm);
23412341 unmap_vmas(&tlb, vma, start, end);
23422342 free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
@@ -2709,7 +2709,7 @@ void exit_mmap(struct mm_struct *mm) · 366 unmodified lines
27092709
27102710 lru_add_drain();
27112711 flush_cache_mm(mm);
2712− tlb_gather_mmu(&tlb, mm, 1);
2712+ tlb_gather_mmu(&tlb, mm, 0, -1);
27132713 /* update_hiwater_rss(mm) here? but nobody should be looking */
27142714 /* Use -1 here to ensure all VMAs in the mm are unmapped */
27152715 unmap_vmas(&tlb, vma, 0, -1);
mm/mremap.c+20−1
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/swap.h>
1616 #include <linux/capability.h>
1717 #include <linux/fs.h>
18+#include <linux/swapops.h>
1819 #include <linux/highmem.h>
1920 #include <linux/security.h>
2021 #include <linux/syscalls.h>
@@ -69,6 +70,23 @@ static pmd_t *alloc_new_pmd(struct mm_struct *mm, struct vm_area_struct *vma, · 48 unmodified lines
6970 return pmd;
7071 }
7172
73+static pte_t move_soft_dirty_pte(pte_t pte)
74+{
75+ /*
76+ * Set soft dirty bit so we can notice
77+ * in userspace the ptes were moved.
78+ */
79+#ifdef CONFIG_MEM_SOFT_DIRTY
80+ if (pte_present(pte))
81+ pte = pte_mksoft_dirty(pte);
82+ else if (is_swap_pte(pte))
83+ pte = pte_swp_mksoft_dirty(pte);
84+ else if (pte_file(pte))
85+ pte = pte_file_mksoft_dirty(pte);
86+#endif
87+ return pte;
88+}
89+
7290 static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
7391 unsigned long old_addr, unsigned long old_end,
7492 struct vm_area_struct *new_vma, pmd_t *new_pmd,
@@ -126,7 +144,8 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, · 51 unmodified lines
126144 continue;
127145 pte = ptep_get_and_clear(mm, old_addr, old_pte);
128146 pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
129− set_pte_at(mm, new_addr, new_pte, pte_mksoft_dirty(pte));
147+ pte = move_soft_dirty_pte(pte);
148+ set_pte_at(mm, new_addr, new_pte, pte);
130149 }
131150
132151 arch_leave_lazy_mmu_mode();
mm/rmap.c+11−3
@@ -1236,6 +1236,7 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 1235 unmodified lines
12361236 swp_entry_to_pte(make_hwpoison_entry(page)));
12371237 } else if (PageAnon(page)) {
12381238 swp_entry_t entry = { .val = page_private(page) };
1239+ pte_t swp_pte;
12391240
12401241 if (PageSwapCache(page)) {
12411242 /*
@@ -1264,7 +1265,10 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 22 unmodified lines
12641265 BUG_ON(TTU_ACTION(flags) != TTU_MIGRATION);
12651266 entry = make_migration_entry(page, pte_write(pteval));
12661267 }
1267− set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
1268+ swp_pte = swp_entry_to_pte(entry);
1269+ if (pte_soft_dirty(pteval))
1270+ swp_pte = pte_swp_mksoft_dirty(swp_pte);
1271+ set_pte_at(mm, address, pte, swp_pte);
12681272 BUG_ON(pte_file(*pte));
12691273 } else if (IS_ENABLED(CONFIG_MIGRATION) &&
12701274 (TTU_ACTION(flags) == TTU_MIGRATION)) {
@@ -1401,8 +1405,12 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount, · 130 unmodified lines
14011405 pteval = ptep_clear_flush(vma, address, pte);
14021406
14031407 /* If nonlinear, store the file page offset in the pte. */
1404− if (page->index != linear_page_index(vma, address))
1405− set_pte_at(mm, address, pte, pgoff_to_pte(page->index));
1408+ if (page->index != linear_page_index(vma, address)) {
1409+ pte_t ptfile = pgoff_to_pte(page->index);
1410+ if (pte_soft_dirty(pteval))
1411+ pte_file_mksoft_dirty(ptfile);
1412+ set_pte_at(mm, address, pte, ptfile);
1413+ }
14061414
14071415 /* Move the dirty bit to the physical page now the pte is gone. */
14081416 if (pte_dirty(pteval))
mm/shmem.c+1−7
@@ -2909,14 +2909,8 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); · 2908 unmodified lines
29092909
29102910 /* common code */
29112911
2912−static char *shmem_dname(struct dentry *dentry, char *buffer, int buflen)
2913−{
2914− return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",
2915− dentry->d_name.name);
2916−}
2917−
29182912 static struct dentry_operations anon_ops = {
2919− .d_dname = shmem_dname
2913+ .d_dname = simple_dname
29202914 };
29212915
29222916 /**
mm/slab.h+2−0
@@ -162,6 +162,8 @@ static inline const char *cache_name(struct kmem_cache *s) · 161 unmodified lines
162162
163163 static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx)
164164 {
165+ if (!s->memcg_params)
166+ return NULL;
165167 return s->memcg_params->memcg_caches[idx];
166168 }
167169
mm/swapfile.c+17−2
@@ -866,6 +866,21 @@ unsigned int count_swap_pages(int type, int free) · 865 unmodified lines
866866 }
867867 #endif /* CONFIG_HIBERNATION */
868868
869+static inline int maybe_same_pte(pte_t pte, pte_t swp_pte)
870+{
871+#ifdef CONFIG_MEM_SOFT_DIRTY
872+ /*
873+ * When pte keeps soft dirty bit the pte generated
874+ * from swap entry does not has it, still it's same
875+ * pte from logical point of view.
876+ */
877+ pte_t swp_pte_dirty = pte_swp_mksoft_dirty(swp_pte);
878+ return pte_same(pte, swp_pte) || pte_same(pte, swp_pte_dirty);
879+#else
880+ return pte_same(pte, swp_pte);
881+#endif
882+}
883+
869884 /*
870885 * No need to decide whether this PTE shares the swap entry with others,
871886 * just let do_wp_page work it out if a write is requested later - to
@@ -892,7 +907,7 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, · 20 unmodified lines
892907 }
893908
894909 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
895− if (unlikely(!pte_same(*pte, swp_entry_to_pte(entry)))) {
910+ if (unlikely(!maybe_same_pte(*pte, swp_entry_to_pte(entry)))) {
896911 mem_cgroup_cancel_charge_swapin(memcg);
897912 ret = 0;
898913 goto out;
@@ -947,7 +962,7 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 48 unmodified lines
947962 * swapoff spends a _lot_ of time in this loop!
948963 * Test inline before going to call unuse_pte.
949964 */
950− if (unlikely(pte_same(*pte, swp_pte))) {
965+ if (unlikely(maybe_same_pte(*pte, swp_pte))) {
951966 pte_unmap(pte);
952967 ret = unuse_pte(vma, pmd, addr, entry, page);
953968 if (ret)
net/8021q/vlan_core.c+6−1
@@ -91,7 +91,12 @@ EXPORT_SYMBOL(__vlan_find_dev_deep); · 90 unmodified lines
9191
9292 struct net_device *vlan_dev_real_dev(const struct net_device *dev)
9393 {
94− return vlan_dev_priv(dev)->real_dev;
94+ struct net_device *ret = vlan_dev_priv(dev)->real_dev;
95+
96+ while (is_vlan_dev(ret))
97+ ret = vlan_dev_priv(ret)->real_dev;
98+
99+ return ret;
95100 }
96101 EXPORT_SYMBOL(vlan_dev_real_dev);
97102
net/batman-adv/bridge_loop_avoidance.c+2−0
@@ -1529,6 +1529,8 @@ out: · 1528 unmodified lines
15291529 * in these cases, the skb is further handled by this function and
15301530 * returns 1, otherwise it returns 0 and the caller shall further
15311531 * process the skb.
1532+ *
1533+ * This call might reallocate skb data.
15321534 */
15331535 int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
15341536 unsigned short vid)
net/batman-adv/gateway_client.c+12−1
@@ -508,6 +508,7 @@ out: · 507 unmodified lines
508508 return 0;
509509 }
510510
511+/* this call might reallocate skb data */
511512 static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len)
512513 {
513514 int ret = false;
@@ -568,6 +569,7 @@ out: · 54 unmodified lines
568569 return ret;
569570 }
570571
572+/* this call might reallocate skb data */
571573 bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
572574 {
573575 struct ethhdr *ethhdr;
@@ -619,6 +621,12 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) · 45 unmodified lines
619621
620622 if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr)))
621623 return false;
624+
625+ /* skb->data might have been reallocated by pskb_may_pull() */
626+ ethhdr = (struct ethhdr *)skb->data;
627+ if (ntohs(ethhdr->h_proto) == ETH_P_8021Q)
628+ ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN);
629+
622630 udphdr = (struct udphdr *)(skb->data + *header_len);
623631 *header_len += sizeof(*udphdr);
624632
@@ -634,12 +642,14 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) · 9 unmodified lines
634642 return true;
635643 }
636644
645+/* this call might reallocate skb data */
637646 bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
638− struct sk_buff *skb, struct ethhdr *ethhdr)
647+ struct sk_buff *skb)
639648 {
640649 struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL;
641650 struct batadv_orig_node *orig_dst_node = NULL;
642651 struct batadv_gw_node *curr_gw = NULL;
652+ struct ethhdr *ethhdr;
643653 bool ret, out_of_range = false;
644654 unsigned int header_len = 0;
645655 uint8_t curr_tq_avg;
@@ -648,6 +658,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, · 2 unmodified lines
648658 if (!ret)
649659 goto out;
650660
661+ ethhdr = (struct ethhdr *)skb->data;
651662 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
652663 ethhdr->h_dest);
653664 if (!orig_dst_node)
net/batman-adv/gateway_client.h+1−2
@@ -34,7 +34,6 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv, · 33 unmodified lines
3434 void batadv_gw_node_purge(struct batadv_priv *bat_priv);
3535 int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset);
3636 bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len);
37−bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
38− struct sk_buff *skb, struct ethhdr *ethhdr);
37+bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb);
3938
4039 #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
net/batman-adv/soft-interface.c+8−1
@@ -180,6 +180,9 @@ static int batadv_interface_tx(struct sk_buff *skb, · 179 unmodified lines
180180 if (batadv_bla_tx(bat_priv, skb, vid))
181181 goto dropped;
182182
183+ /* skb->data might have been reallocated by batadv_bla_tx() */
184+ ethhdr = (struct ethhdr *)skb->data;
185+
183186 /* Register the client MAC in the transtable */
184187 if (!is_multicast_ether_addr(ethhdr->h_source))
185188 batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif);
@@ -220,6 +223,10 @@ static int batadv_interface_tx(struct sk_buff *skb, · 34 unmodified lines
220223 default:
221224 break;
222225 }
226+
227+ /* reminder: ethhdr might have become unusable from here on
228+ * (batadv_gw_is_dhcp_target() might have reallocated skb data)
229+ */
223230 }
224231
225232 /* ethernet packet should be broadcasted */
@@ -266,7 +273,7 @@ static int batadv_interface_tx(struct sk_buff *skb, · 40 unmodified lines
266273 /* unicast packet */
267274 } else {
268275 if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) {
269− ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr);
276+ ret = batadv_gw_out_of_range(bat_priv, skb);
270277 if (ret)
271278 goto dropped;
272279 }
net/batman-adv/unicast.c+17−6
@@ -326,7 +326,9 @@ static bool batadv_unicast_push_and_fill_skb(struct sk_buff *skb, int hdr_size, · 325 unmodified lines
326326 * @skb: the skb containing the payload to encapsulate
327327 * @orig_node: the destination node
328328 *
329− * Returns false if the payload could not be encapsulated or true otherwise
329+ * Returns false if the payload could not be encapsulated or true otherwise.
330+ *
331+ * This call might reallocate skb data.
330332 */
331333 static bool batadv_unicast_prepare_skb(struct sk_buff *skb,
332334 struct batadv_orig_node *orig_node)
@@ -343,7 +345,9 @@ static bool batadv_unicast_prepare_skb(struct sk_buff *skb, · 10 unmodified lines
343345 * @orig_node: the destination node
344346 * @packet_subtype: the batman 4addr packet subtype to use
345347 *
346− * Returns false if the payload could not be encapsulated or true otherwise
348+ * Returns false if the payload could not be encapsulated or true otherwise.
349+ *
350+ * This call might reallocate skb data.
347351 */
348352 bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv,
349353 struct sk_buff *skb,
@@ -401,7 +405,7 @@ int batadv_unicast_generic_send_skb(struct batadv_priv *bat_priv, · 51 unmodified lines
401405 struct batadv_neigh_node *neigh_node;
402406 int data_len = skb->len;
403407 int ret = NET_RX_DROP;
404− unsigned int dev_mtu;
408+ unsigned int dev_mtu, header_len;
405409
406410 /* get routing information */
407411 if (is_multicast_ether_addr(ethhdr->h_dest)) {
@@ -428,11 +432,17 @@ find_router: · 20 unmodified lines
428432
429433 switch (packet_type) {
430434 case BATADV_UNICAST:
431− batadv_unicast_prepare_skb(skb, orig_node);
435+ if (!batadv_unicast_prepare_skb(skb, orig_node))
436+ goto out;
437+
438+ header_len = sizeof(struct batadv_unicast_packet);
432439 break;
433440 case BATADV_UNICAST_4ADDR:
434− batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
435− packet_subtype);
441+ if (!batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
442+ packet_subtype))
443+ goto out;
444+
445+ header_len = sizeof(struct batadv_unicast_4addr_packet);
436446 break;
437447 default:
438448 /* this function supports UNICAST and UNICAST_4ADDR only. It
@@ -441,6 +451,7 @@ find_router: · 2 unmodified lines
441451 goto out;
442452 }
443453
454+ ethhdr = (struct ethhdr *)(skb->data + header_len);
444455 unicast_packet = (struct batadv_unicast_packet *)skb->data;
445456
446457 /* inform the destination node that we are still missing a correct route
net/bridge/br_fdb.c+5−5
@@ -161,7 +161,7 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr) · 160 unmodified lines
161161 if (!pv)
162162 return;
163163
164− for_each_set_bit_from(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
164+ for_each_set_bit_from(vid, pv->vlan_bitmap, VLAN_N_VID) {
165165 f = __br_fdb_get(br, br->dev->dev_addr, vid);
166166 if (f && f->is_local && !f->dst)
167167 fdb_delete(br, f);
@@ -730,7 +730,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], · 562 unmodified lines
730730 /* VID was specified, so use it. */
731731 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
732732 } else {
733− if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN)) {
733+ if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) {
734734 err = __br_fdb_add(ndm, p, addr, nlh_flags, 0);
735735 goto out;
736736 }
@@ -739,7 +739,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], · 2 unmodified lines
739739 * specify a VLAN. To be nice, add/update entry for every
740740 * vlan on this port.
741741 */
742− for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
742+ for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
743743 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
744744 if (err)
745745 goto out;
@@ -817,7 +817,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], · 71 unmodified lines
817817
818818 err = __br_fdb_delete(p, addr, vid);
819819 } else {
820− if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN)) {
820+ if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) {
821821 err = __br_fdb_delete(p, addr, 0);
822822 goto out;
823823 }
@@ -827,7 +827,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], · 3 unmodified lines
827827 * vlan on this port.
828828 */
829829 err = -ENOENT;
830− for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
830+ for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
831831 err &= __br_fdb_delete(p, addr, vid);
832832 }
833833 }
net/bridge/br_multicast.c+1−1
@@ -1195,7 +1195,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, · 1194 unmodified lines
11951195 max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay));
11961196 if (max_delay)
11971197 group = &mld->mld_mca;
1198− } else if (skb->len >= sizeof(*mld2q)) {
1198+ } else {
11991199 if (!pskb_may_pull(skb, sizeof(*mld2q))) {
12001200 err = -EINVAL;
12011201 goto out;
net/bridge/br_netlink.c+2−2
@@ -132,7 +132,7 @@ static int br_fill_ifinfo(struct sk_buff *skb, · 131 unmodified lines
132132 else
133133 pv = br_get_vlan_info(br);
134134
135− if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN))
135+ if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID))
136136 goto done;
137137
138138 af = nla_nest_start(skb, IFLA_AF_SPEC);
@@ -140,7 +140,7 @@ static int br_fill_ifinfo(struct sk_buff *skb, · 1 unmodified line
140140 goto nla_put_failure;
141141
142142 pvid = br_get_pvid(pv);
143− for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
143+ for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
144144 vinfo.vid = vid;
145145 vinfo.flags = 0;
146146 if (vid == pvid)
net/bridge/br_sysfs_br.c+1−1
@@ -1,5 +1,5 @@
11 /*
2− * Sysfs attributes of bridge ports
2+ * Sysfs attributes of bridge
33 * Linux ethernet bridge
44 *
55 * Authors:
net/bridge/br_vlan.c+2−2
@@ -108,7 +108,7 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid) · 107 unmodified lines
108108
109109 clear_bit(vid, v->vlan_bitmap);
110110 v->num_vlans--;
111− if (bitmap_empty(v->vlan_bitmap, BR_VLAN_BITMAP_LEN)) {
111+ if (bitmap_empty(v->vlan_bitmap, VLAN_N_VID)) {
112112 if (v->port_idx)
113113 rcu_assign_pointer(v->parent.port->vlan_info, NULL);
114114 else
@@ -122,7 +122,7 @@ static void __vlan_flush(struct net_port_vlans *v) · 7 unmodified lines
122122 {
123123 smp_wmb();
124124 v->pvid = 0;
125− bitmap_zero(v->vlan_bitmap, BR_VLAN_BITMAP_LEN);
125+ bitmap_zero(v->vlan_bitmap, VLAN_N_VID);
126126 if (v->port_idx)
127127 rcu_assign_pointer(v->parent.port->vlan_info, NULL);
128128 else
net/core/flow_dissector.c+1−0
@@ -65,6 +65,7 @@ ipv6: · 64 unmodified lines
6565 nhoff += sizeof(struct ipv6hdr);
6666 break;
6767 }
68+ case __constant_htons(ETH_P_8021AD):
6869 case __constant_htons(ETH_P_8021Q): {
6970 const struct vlan_hdr *vlan;
7071 struct vlan_hdr _vlan;
net/core/neighbour.c+6−4
@@ -1441,16 +1441,18 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, · 1440 unmodified lines
14411441 atomic_set(&p->refcnt, 1);
14421442 p->reachable_time =
14431443 neigh_rand_reach_time(p->base_reachable_time);
1444+ dev_hold(dev);
1445+ p->dev = dev;
1446+ write_pnet(&p->net, hold_net(net));
1447+ p->sysctl_table = NULL;
14441448
14451449 if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) {
1450+ release_net(net);
1451+ dev_put(dev);
14461452 kfree(p);
14471453 return NULL;
14481454 }
14491455
1450− dev_hold(dev);
1451− p->dev = dev;
1452− write_pnet(&p->net, hold_net(net));
1453− p->sysctl_table = NULL;
14541456 write_lock_bh(&tbl->lock);
14551457 p->next = tbl->parms.next;
14561458 tbl->parms.next = p;
net/core/rtnetlink.c+2−2
@@ -2156,7 +2156,7 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm, · 2155 unmodified lines
21562156 /* If aging addresses are supported device will need to
21572157 * implement its own handler for this.
21582158 */
2159− if (ndm->ndm_state & NUD_PERMANENT) {
2159+ if (!(ndm->ndm_state & NUD_PERMANENT)) {
21602160 pr_info("%s: FDB only supports static addresses\n", dev->name);
21612161 return -EINVAL;
21622162 }
@@ -2384,7 +2384,7 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) · 221 unmodified lines
23842384 struct nlattr *extfilt;
23852385 u32 filter_mask = 0;
23862386
2387− extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct rtgenmsg),
2387+ extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg),
23882388 IFLA_EXT_MASK);
23892389 if (extfilt)
23902390 filter_mask = nla_get_u32(extfilt);
net/ipv4/esp4.c+1−1
@@ -477,7 +477,7 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) · 476 unmodified lines
477477 }
478478
479479 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
480− net_adj) & ~(align - 1)) + (net_adj - 2);
480+ net_adj) & ~(align - 1)) + net_adj - 2;
481481 }
482482
483483 static void esp4_err(struct sk_buff *skb, u32 info)
net/ipv4/fib_trie.c+1−4
@@ -71,7 +71,6 @@ · 70 unmodified lines
7171 #include <linux/init.h>
7272 #include <linux/list.h>
7373 #include <linux/slab.h>
74−#include <linux/prefetch.h>
7574 #include <linux/export.h>
7675 #include <net/net_namespace.h>
7776 #include <net/ip.h>
@@ -1761,10 +1760,8 @@ static struct leaf *leaf_walk_rcu(struct tnode *p, struct rt_trie_node *c) · 1683 unmodified lines
17611760 if (!c)
17621761 continue;
17631762
1764− if (IS_LEAF(c)) {
1765− prefetch(rcu_dereference_rtnl(p->child[idx]));
1763+ if (IS_LEAF(c))
17661764 return (struct leaf *) c;
1767− }
17681765
17691766 /* Rescan start scanning in new node */
17701767 p = (struct tnode *) c;
net/ipv4/ip_gre.c+1−1
@@ -383,7 +383,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, · 382 unmodified lines
383383 if (daddr)
384384 memcpy(&iph->daddr, daddr, 4);
385385 if (iph->daddr)
386− return t->hlen;
386+ return t->hlen + sizeof(*iph);
387387
388388 return -(t->hlen + sizeof(*iph));
389389 }
net/ipv4/ip_tunnel_core.c+1−3
@@ -76,9 +76,7 @@ int iptunnel_xmit(struct net *net, struct rtable *rt, · 75 unmodified lines
7676 iph->daddr = dst;
7777 iph->saddr = src;
7878 iph->ttl = ttl;
79− tunnel_ip_select_ident(skb,
80− (const struct iphdr *)skb_inner_network_header(skb),
81− &rt->dst);
79+ __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1);
8280
8381 err = ip_local_out(skb);
8482 if (unlikely(net_xmit_eval(err)))
net/ipv4/proc.c+1−1
@@ -273,7 +273,7 @@ static const struct snmp_mib snmp4_net_list[] = { · 272 unmodified lines
273273 SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW),
274274 SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD),
275275 SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES),
276− SNMP_MIB_ITEM("LowLatencyRxPackets", LINUX_MIB_LOWLATENCYRXPACKETS),
276+ SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS),
277277 SNMP_MIB_SENTINEL
278278 };
279279
net/ipv4/tcp.c+7−0
@@ -1120,6 +1120,13 @@ new_segment: · 1119 unmodified lines
11201120 if (!skb)
11211121 goto wait_for_memory;
11221122
1123+ /*
1124+ * All packets are restored as if they have
1125+ * already been sent.
1126+ */
1127+ if (tp->repair)
1128+ TCP_SKB_CB(skb)->when = tcp_time_stamp;
1129+
11231130 /*
11241131 * Check whether we can use HW checksum.
11251132 */
net/ipv4/tcp_cubic.c+7−5
@@ -206,8 +206,8 @@ static u32 cubic_root(u64 a) · 205 unmodified lines
206206 */
207207 static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
208208 {
209− u64 offs;
210− u32 delta, t, bic_target, max_cnt;
209+ u32 delta, bic_target, max_cnt;
210+ u64 offs, t;
211211
212212 ca->ack_cnt++; /* count the number of ACKs */
213213
@@ -250,9 +250,11 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) · 36 unmodified lines
250250 * if the cwnd < 1 million packets !!!
251251 */
252252
253+ t = (s32)(tcp_time_stamp - ca->epoch_start);
254+ t += msecs_to_jiffies(ca->delay_min >> 3);
253255 /* change the unit from HZ to bictcp_HZ */
254− t = ((tcp_time_stamp + msecs_to_jiffies(ca->delay_min>>3)
255− - ca->epoch_start) << BICTCP_HZ) / HZ;
256+ t <<= BICTCP_HZ;
257+ do_div(t, HZ);
256258
257259 if (t < ca->bic_K) /* t - K */
258260 offs = ca->bic_K - t;
@@ -414,7 +416,7 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) · 155 unmodified lines
414416 return;
415417
416418 /* Discard delay samples right after fast recovery */
417− if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ)
419+ if (ca->epoch_start && (s32)(tcp_time_stamp - ca->epoch_start) < HZ)
418420 return;
419421
420422 delay = (rtt_us << 3) / USEC_PER_MSEC;
net/ipv6/addrconf.c+4−6
@@ -1126,12 +1126,10 @@ retry: · 1125 unmodified lines
11261126 if (ifp->flags & IFA_F_OPTIMISTIC)
11271127 addr_flags |= IFA_F_OPTIMISTIC;
11281128
1129− ift = !max_addresses ||
1130− ipv6_count_addresses(idev) < max_addresses ?
1131− ipv6_add_addr(idev, &addr, NULL, tmp_plen,
1132− ipv6_addr_scope(&addr), addr_flags,
1133− tmp_valid_lft, tmp_prefered_lft) : NULL;
1134− if (IS_ERR_OR_NULL(ift)) {
1129+ ift = ipv6_add_addr(idev, &addr, NULL, tmp_plen,
1130+ ipv6_addr_scope(&addr), addr_flags,
1131+ tmp_valid_lft, tmp_prefered_lft);
1132+ if (IS_ERR(ift)) {
11351133 in6_ifa_put(ifp);
11361134 in6_dev_put(idev);
11371135 pr_info("%s: retry temporary address regeneration\n", __func__);
net/ipv6/esp6.c+1−1
@@ -425,7 +425,7 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu) · 424 unmodified lines
425425 net_adj = 0;
426426
427427 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
428− net_adj) & ~(align - 1)) + (net_adj - 2);
428+ net_adj) & ~(align - 1)) + net_adj - 2;
429429 }
430430
431431 static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
net/ipv6/ip6_fib.c+12−4
@@ -993,14 +993,22 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root, · 992 unmodified lines
993993
994994 if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) {
995995 #ifdef CONFIG_IPV6_SUBTREES
996− if (fn->subtree)
997− fn = fib6_lookup_1(fn->subtree, args + 1);
996+ if (fn->subtree) {
997+ struct fib6_node *sfn;
998+ sfn = fib6_lookup_1(fn->subtree,
999+ args + 1);
1000+ if (!sfn)
1001+ goto backtrack;
1002+ fn = sfn;
1003+ }
9981004 #endif
999− if (!fn || fn->fn_flags & RTN_RTINFO)
1005+ if (fn->fn_flags & RTN_RTINFO)
10001006 return fn;
10011007 }
10021008 }
1003−
1009+#ifdef CONFIG_IPV6_SUBTREES
1010+backtrack:
1011+#endif
10041012 if (fn->fn_flags & RTN_ROOT)
10051013 break;
10061014
net/ipv6/ndisc.c+3−1
@@ -1369,8 +1369,10 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) · 1368 unmodified lines
13691369 if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts))
13701370 return;
13711371
1372− if (!ndopts.nd_opts_rh)
1372+ if (!ndopts.nd_opts_rh) {
1373+ ip6_redirect_no_header(skb, dev_net(skb->dev), 0, 0);
13731374 return;
1375+ }
13741376
13751377 hdr = (u8 *)ndopts.nd_opts_rh;
13761378 hdr += 8;
net/ipv6/reassembly.c+5−0
@@ -490,6 +490,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, · 489 unmodified lines
490490 ipv6_hdr(head)->payload_len = htons(payload_len);
491491 ipv6_change_dsfield(ipv6_hdr(head), 0xff, ecn);
492492 IP6CB(head)->nhoff = nhoff;
493+ IP6CB(head)->flags |= IP6SKB_FRAGMENTED;
493494
494495 /* Yes, and fold redundant checksum back. 8) */
495496 if (head->ip_summed == CHECKSUM_COMPLETE)
@@ -524,6 +525,9 @@ static int ipv6_frag_rcv(struct sk_buff *skb) · 28 unmodified lines
524525 struct net *net = dev_net(skb_dst(skb)->dev);
525526 int evicted;
526527
528+ if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED)
529+ goto fail_hdr;
530+
527531 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS);
528532
529533 /* Jumbo payload inhibits frag. header */
@@ -544,6 +548,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) · 14 unmodified lines
544548 ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMOKS);
545549
546550 IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb);
551+ IP6CB(skb)->flags |= IP6SKB_FRAGMENTED;
547552 return 1;
548553 }
549554
net/ipv6/route.c+21−0
@@ -1178,6 +1178,27 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark) · 1177 unmodified lines
11781178 }
11791179 EXPORT_SYMBOL_GPL(ip6_redirect);
11801180
1181+void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
1182+ u32 mark)
1183+{
1184+ const struct ipv6hdr *iph = ipv6_hdr(skb);
1185+ const struct rd_msg *msg = (struct rd_msg *)icmp6_hdr(skb);
1186+ struct dst_entry *dst;
1187+ struct flowi6 fl6;
1188+
1189+ memset(&fl6, 0, sizeof(fl6));
1190+ fl6.flowi6_oif = oif;
1191+ fl6.flowi6_mark = mark;
1192+ fl6.flowi6_flags = 0;
1193+ fl6.daddr = msg->dest;
1194+ fl6.saddr = iph->daddr;
1195+
1196+ dst = ip6_route_output(net, NULL, &fl6);
1197+ if (!dst->error)
1198+ rt6_do_redirect(dst, NULL, skb);
1199+ dst_release(dst);
1200+}
1201+
11811202 void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk)
11821203 {
11831204 ip6_redirect(skb, sock_net(sk), sk->sk_bound_dev_if, sk->sk_mark);
net/mac80211/mlme.c+36−18
@@ -31,10 +31,12 @@ · 30 unmodified lines
3131 #include "led.h"
3232
3333 #define IEEE80211_AUTH_TIMEOUT (HZ / 5)
34+#define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2)
3435 #define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10)
3536 #define IEEE80211_AUTH_MAX_TRIES 3
3637 #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5)
3738 #define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
39+#define IEEE80211_ASSOC_TIMEOUT_LONG (HZ / 2)
3840 #define IEEE80211_ASSOC_TIMEOUT_SHORT (HZ / 10)
3941 #define IEEE80211_ASSOC_MAX_TRIES 3
4042
@@ -209,8 +211,9 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · 168 unmodified lines
209211 struct ieee80211_channel *channel,
210212 const struct ieee80211_ht_operation *ht_oper,
211213 const struct ieee80211_vht_operation *vht_oper,
212− struct cfg80211_chan_def *chandef, bool verbose)
214+ struct cfg80211_chan_def *chandef, bool tracking)
213215 {
216+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
214217 struct cfg80211_chan_def vht_chandef;
215218 u32 ht_cfreq, ret;
216219
@@ -229,7 +232,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · 12 unmodified lines
229232 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan,
230233 channel->band);
231234 /* check that channel matches the right operating channel */
232− if (channel->center_freq != ht_cfreq) {
235+ if (!tracking && channel->center_freq != ht_cfreq) {
233236 /*
234237 * It's possible that some APs are confused here;
235238 * Netgear WNDR3700 sometimes reports 4 higher than
@@ -237,11 +240,10 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · 1 unmodified line
237240 * since we look at probe response/beacon data here
238241 * it should be OK.
239242 */
240− if (verbose)
241− sdata_info(sdata,
242− "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n",
243− channel->center_freq, ht_cfreq,
244− ht_oper->primary_chan, channel->band);
243+ sdata_info(sdata,
244+ "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n",
245+ channel->center_freq, ht_cfreq,
246+ ht_oper->primary_chan, channel->band);
245247 ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT;
246248 goto out;
247249 }
@@ -295,7 +297,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · 47 unmodified lines
295297 channel->band);
296298 break;
297299 default:
298− if (verbose)
300+ if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
299301 sdata_info(sdata,
300302 "AP VHT operation IE has invalid channel width (%d), disable VHT\n",
301303 vht_oper->chan_width);
@@ -304,7 +306,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · 2 unmodified lines
304306 }
305307
306308 if (!cfg80211_chandef_valid(&vht_chandef)) {
307− if (verbose)
309+ if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
308310 sdata_info(sdata,
309311 "AP VHT information is invalid, disable VHT\n");
310312 ret = IEEE80211_STA_DISABLE_VHT;
@@ -317,7 +319,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · 6 unmodified lines
317319 }
318320
319321 if (!cfg80211_chandef_compatible(chandef, &vht_chandef)) {
320− if (verbose)
322+ if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
321323 sdata_info(sdata,
322324 "AP VHT information doesn't match HT, disable VHT\n");
323325 ret = IEEE80211_STA_DISABLE_VHT;
@@ -333,18 +335,27 @@ out: · 9 unmodified lines
333335 if (ret & IEEE80211_STA_DISABLE_VHT)
334336 vht_chandef = *chandef;
335337
338+ /*
339+ * Ignore the DISABLED flag when we're already connected and only
340+ * tracking the APs beacon for bandwidth changes - otherwise we
341+ * might get disconnected here if we connect to an AP, update our
342+ * regulatory information based on the AP's country IE and the
343+ * information we have is wrong/outdated and disables the channel
344+ * that we're actually using for the connection to the AP.
345+ */
336346 while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef,
337− IEEE80211_CHAN_DISABLED)) {
347+ tracking ? 0 :
348+ IEEE80211_CHAN_DISABLED)) {
338349 if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) {
339350 ret = IEEE80211_STA_DISABLE_HT |
340351 IEEE80211_STA_DISABLE_VHT;
341− goto out;
352+ break;
342353 }
343354
344355 ret |= chandef_downgrade(chandef);
345356 }
346357
347− if (chandef->width != vht_chandef.width && verbose)
358+ if (chandef->width != vht_chandef.width && !tracking)
348359 sdata_info(sdata,
349360 "capabilities/regulatory prevented using AP HT/VHT configuration, downgraded\n");
350361
@@ -384,7 +395,7 @@ static int ieee80211_config_bw(struct ieee80211_sub_if_data *sdata, · 33 unmodified lines
384395
385396 /* calculate new channel (type) based on HT/VHT operation IEs */
386397 flags = ieee80211_determine_chantype(sdata, sband, chan, ht_oper,
387− vht_oper, &chandef, false);
398+ vht_oper, &chandef, true);
388399
389400 /*
390401 * Downgrade the new channel if we associated with restricted
@@ -3394,10 +3405,13 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) · 3003 unmodified lines
33943405
33953406 if (tx_flags == 0) {
33963407 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
3397− ifmgd->auth_data->timeout_started = true;
3408+ auth_data->timeout_started = true;
33983409 run_again(sdata, auth_data->timeout);
33993410 } else {
3400− auth_data->timeout_started = false;
3411+ auth_data->timeout =
3412+ round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG);
3413+ auth_data->timeout_started = true;
3414+ run_again(sdata, auth_data->timeout);
34013415 }
34023416
34033417 return 0;
@@ -3434,7 +3448,11 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) · 30 unmodified lines
34343448 assoc_data->timeout_started = true;
34353449 run_again(sdata, assoc_data->timeout);
34363450 } else {
3437− assoc_data->timeout_started = false;
3451+ assoc_data->timeout =
3452+ round_jiffies_up(jiffies +
3453+ IEEE80211_ASSOC_TIMEOUT_LONG);
3454+ assoc_data->timeout_started = true;
3455+ run_again(sdata, assoc_data->timeout);
34383456 }
34393457
34403458 return 0;
@@ -3829,7 +3847,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 388 unmodified lines
38293847 ifmgd->flags |= ieee80211_determine_chantype(sdata, sband,
38303848 cbss->channel,
38313849 ht_oper, vht_oper,
3832− &chandef, true);
3850+ &chandef, false);
38333851
38343852 sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss),
38353853 local->rx_chains);
net/netfilter/nf_conntrack_proto_tcp.c+8−4
@@ -526,7 +526,7 @@ static bool tcp_in_window(const struct nf_conn *ct, · 525 unmodified lines
526526 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
527527 __u32 seq, ack, sack, end, win, swin;
528528 s16 receiver_offset;
529− bool res;
529+ bool res, in_recv_win;
530530
531531 /*
532532 * Get the required data from the packet.
@@ -649,14 +649,18 @@ static bool tcp_in_window(const struct nf_conn *ct, · 116 unmodified lines
649649 receiver->td_end, receiver->td_maxend, receiver->td_maxwin,
650650 receiver->td_scale);
651651
652+ /* Is the ending sequence in the receive window (if available)? */
653+ in_recv_win = !receiver->td_maxwin ||
654+ after(end, sender->td_end - receiver->td_maxwin - 1);
655+
652656 pr_debug("tcp_in_window: I=%i II=%i III=%i IV=%i\n",
653657 before(seq, sender->td_maxend + 1),
654− after(end, sender->td_end - receiver->td_maxwin - 1),
658+ (in_recv_win ? 1 : 0),
655659 before(sack, receiver->td_end + 1),
656660 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1));
657661
658662 if (before(seq, sender->td_maxend + 1) &&
659− after(end, sender->td_end - receiver->td_maxwin - 1) &&
663+ in_recv_win &&
660664 before(sack, receiver->td_end + 1) &&
661665 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)) {
662666 /*
@@ -725,7 +729,7 @@ static bool tcp_in_window(const struct nf_conn *ct, · 62 unmodified lines
725729 nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL,
726730 "nf_ct_tcp: %s ",
727731 before(seq, sender->td_maxend + 1) ?
728− after(end, sender->td_end - receiver->td_maxwin - 1) ?
732+ in_recv_win ?
729733 before(sack, receiver->td_end + 1) ?
730734 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1) ? "BUG"
731735 : "ACK is under the lower bound (possible overly delayed ACK)"
net/netfilter/nfnetlink_log.c+5−1
@@ -419,6 +419,7 @@ __build_packet_message(struct nfnl_log_net *log, · 418 unmodified lines
419419 nfmsg->version = NFNETLINK_V0;
420420 nfmsg->res_id = htons(inst->group_num);
421421
422+ memset(&pmsg, 0, sizeof(pmsg));
422423 pmsg.hw_protocol = skb->protocol;
423424 pmsg.hook = hooknum;
424425
@@ -498,7 +499,10 @@ __build_packet_message(struct nfnl_log_net *log, · 73 unmodified lines
498499 if (indev && skb->dev &&
499500 skb->mac_header != skb->network_header) {
500501 struct nfulnl_msg_packet_hw phw;
501− int len = dev_parse_header(skb, phw.hw_addr);
502+ int len;
503+
504+ memset(&phw, 0, sizeof(phw));
505+ len = dev_parse_header(skb, phw.hw_addr);
502506 if (len > 0) {
503507 phw.hw_addrlen = htons(len);
504508 if (nla_put(inst->skb, NFULA_HWADDR, sizeof(phw), &phw))
net/netfilter/nfnetlink_queue_core.c+4−1
@@ -463,7 +463,10 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, · 462 unmodified lines
463463 if (indev && entskb->dev &&
464464 entskb->mac_header != entskb->network_header) {
465465 struct nfqnl_msg_packet_hw phw;
466− int len = dev_parse_header(entskb, phw.hw_addr);
466+ int len;
467+
468+ memset(&phw, 0, sizeof(phw));
469+ len = dev_parse_header(entskb, phw.hw_addr);
467470 if (len) {
468471 phw.hw_addrlen = htons(len);
469472 if (nla_put(skb, NFQA_HWADDR, sizeof(phw), &phw))
net/netfilter/xt_TCPMSS.c+16−12
@@ -52,7 +52,8 @@ tcpmss_mangle_packet(struct sk_buff *skb, · 51 unmodified lines
5252 {
5353 const struct xt_tcpmss_info *info = par->targinfo;
5454 struct tcphdr *tcph;
55− unsigned int tcplen, i;
55+ int len, tcp_hdrlen;
56+ unsigned int i;
5657 __be16 oldval;
5758 u16 newmss;
5859 u8 *opt;
@@ -64,11 +65,14 @@ tcpmss_mangle_packet(struct sk_buff *skb, · 5 unmodified lines
6465 if (!skb_make_writable(skb, skb->len))
6566 return -1;
6667
67− tcplen = skb->len - tcphoff;
68+ len = skb->len - tcphoff;
69+ if (len < (int)sizeof(struct tcphdr))
70+ return -1;
71+
6872 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);
73+ tcp_hdrlen = tcph->doff * 4;
6974
70− /* Header cannot be larger than the packet */
71− if (tcplen < tcph->doff*4)
75+ if (len < tcp_hdrlen)
7276 return -1;
7377
7478 if (info->mss == XT_TCPMSS_CLAMP_PMTU) {
@@ -87,9 +91,8 @@ tcpmss_mangle_packet(struct sk_buff *skb, · 12 unmodified lines
8791 newmss = info->mss;
8892
8993 opt = (u_int8_t *)tcph;
90− for (i = sizeof(struct tcphdr); i < tcph->doff*4; i += optlen(opt, i)) {
91− if (opt[i] == TCPOPT_MSS && tcph->doff*4 - i >= TCPOLEN_MSS &&
92− opt[i+1] == TCPOLEN_MSS) {
94+ for (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) {
95+ if (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) {
9396 u_int16_t oldmss;
9497
9598 oldmss = (opt[i+2] << 8) | opt[i+3];
@@ -112,9 +115,10 @@ tcpmss_mangle_packet(struct sk_buff *skb, · 16 unmodified lines
112115 }
113116
114117 /* There is data after the header so the option can't be added
115− without moving it, and doing so may make the SYN packet
116− itself too large. Accept the packet unmodified instead. */
117− if (tcplen > tcph->doff*4)
118+ * without moving it, and doing so may make the SYN packet
119+ * itself too large. Accept the packet unmodified instead.
120+ */
121+ if (len > tcp_hdrlen)
118122 return 0;
119123
120124 /*
@@ -143,10 +147,10 @@ tcpmss_mangle_packet(struct sk_buff *skb, · 22 unmodified lines
143147 newmss = min(newmss, (u16)1220);
144148
145149 opt = (u_int8_t *)tcph + sizeof(struct tcphdr);
146− memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));
150+ memmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr));
147151
148152 inet_proto_csum_replace2(&tcph->check, skb,
149− htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1);
153+ htons(len), htons(len + TCPOLEN_MSS), 1);
150154 opt[0] = TCPOPT_MSS;
151155 opt[1] = TCPOLEN_MSS;
152156 opt[2] = (newmss & 0xff00) >> 8;
net/netfilter/xt_TCPOPTSTRIP.c+6−4
@@ -38,7 +38,7 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb, · 37 unmodified lines
3838 struct tcphdr *tcph;
3939 u_int16_t n, o;
4040 u_int8_t *opt;
41− int len;
41+ int len, tcp_hdrlen;
4242
4343 /* This is a fragment, no TCP header is available */
4444 if (par->fragoff != 0)
@@ -52,7 +52,9 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb, · 7 unmodified lines
5252 return NF_DROP;
5353
5454 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);
55− if (tcph->doff * 4 > len)
55+ tcp_hdrlen = tcph->doff * 4;
56+
57+ if (len < tcp_hdrlen)
5658 return NF_DROP;
5759
5860 opt = (u_int8_t *)tcph;
@@ -61,10 +63,10 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb, · 2 unmodified lines
6163 * Walk through all TCP options - if we find some option to remove,
6264 * set all octets to %TCPOPT_NOP and adjust checksum.
6365 */
64− for (i = sizeof(struct tcphdr); i < tcp_hdrlen(skb); i += optl) {
66+ for (i = sizeof(struct tcphdr); i < tcp_hdrlen - 1; i += optl) {
6567 optl = optlen(opt, i);
6668
67− if (i + optl > tcp_hdrlen(skb))
69+ if (i + optl > tcp_hdrlen)
6870 break;
6971
7072 if (!tcpoptstrip_test_bit(info->strip_bmap, opt[i]))
net/openvswitch/actions.c+1−0
@@ -535,6 +535,7 @@ int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb) · 534 unmodified lines
535535 {
536536 struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts);
537537
538+ OVS_CB(skb)->tun_key = NULL;
538539 return do_execute_actions(dp, skb, acts->actions,
539540 acts->actions_len, false);
540541 }
net/openvswitch/datapath.c+0−3
@@ -2076,9 +2076,6 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) · 2075 unmodified lines
20762076 ovs_notify(reply, info, &ovs_dp_vport_multicast_group);
20772077 return 0;
20782078
2079− rtnl_unlock();
2080− return 0;
2081−
20822079 exit_free:
20832080 kfree_skb(reply);
20842081 exit_unlock:
net/openvswitch/flow.c+1−1
@@ -240,7 +240,7 @@ static struct flex_array *alloc_buckets(unsigned int n_buckets) · 239 unmodified lines
240240 struct flex_array *buckets;
241241 int i, err;
242242
243− buckets = flex_array_alloc(sizeof(struct hlist_head *),
243+ buckets = flex_array_alloc(sizeof(struct hlist_head),
244244 n_buckets, GFP_KERNEL);
245245 if (!buckets)
246246 return NULL;
net/packet/af_packet.c+2−0
@@ -3259,9 +3259,11 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, · 3258 unmodified lines
32593259
32603260 if (po->tp_version == TPACKET_V3) {
32613261 lv = sizeof(struct tpacket_stats_v3);
3262+ st.stats3.tp_packets += st.stats3.tp_drops;
32623263 data = &st.stats3;
32633264 } else {
32643265 lv = sizeof(struct tpacket_stats);
3266+ st.stats1.tp_packets += st.stats1.tp_drops;
32653267 data = &st.stats1;
32663268 }
32673269
net/sched/sch_api.c+41−0
@@ -285,6 +285,45 @@ static struct Qdisc_ops *qdisc_lookup_ops(struct nlattr *kind) · 284 unmodified lines
285285 return q;
286286 }
287287
288+/* The linklayer setting were not transferred from iproute2, in older
289+ * versions, and the rate tables lookup systems have been dropped in
290+ * the kernel. To keep backward compatible with older iproute2 tc
291+ * utils, we detect the linklayer setting by detecting if the rate
292+ * table were modified.
293+ *
294+ * For linklayer ATM table entries, the rate table will be aligned to
295+ * 48 bytes, thus some table entries will contain the same value. The
296+ * mpu (min packet unit) is also encoded into the old rate table, thus
297+ * starting from the mpu, we find low and high table entries for
298+ * mapping this cell. If these entries contain the same value, when
299+ * the rate tables have been modified for linklayer ATM.
300+ *
301+ * This is done by rounding mpu to the nearest 48 bytes cell/entry,
302+ * and then roundup to the next cell, calc the table entry one below,
303+ * and compare.
304+ */
305+static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab)
306+{
307+ int low = roundup(r->mpu, 48);
308+ int high = roundup(low+1, 48);
309+ int cell_low = low >> r->cell_log;
310+ int cell_high = (high >> r->cell_log) - 1;
311+
312+ /* rtab is too inaccurate at rates > 100Mbit/s */
313+ if ((r->rate > (100000000/8)) || (rtab[0] == 0)) {
314+ pr_debug("TC linklayer: Giving up ATM detection\n");
315+ return TC_LINKLAYER_ETHERNET;
316+ }
317+
318+ if ((cell_high > cell_low) && (cell_high < 256)
319+ && (rtab[cell_low] == rtab[cell_high])) {
320+ pr_debug("TC linklayer: Detected ATM, low(%d)=high(%d)=%u\n",
321+ cell_low, cell_high, rtab[cell_high]);
322+ return TC_LINKLAYER_ATM;
323+ }
324+ return TC_LINKLAYER_ETHERNET;
325+}
326+
288327 static struct qdisc_rate_table *qdisc_rtab_list;
289328
290329 struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *tab)
@@ -308,6 +347,8 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *ta · 17 unmodified lines
308347 rtab->rate = *r;
309348 rtab->refcnt = 1;
310349 memcpy(rtab->data, nla_data(tab), 1024);
350+ if (r->linklayer == TC_LINKLAYER_UNAWARE)
351+ r->linklayer = __detect_linklayer(r, rtab->data);
311352 rtab->next = qdisc_rtab_list;
312353 qdisc_rtab_list = rtab;
313354 }
net/sched/sch_generic.c+7−1
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/rcupdate.h>
2626 #include <linux/list.h>
2727 #include <linux/slab.h>
28+#include <linux/if_vlan.h>
2829 #include <net/sch_generic.h>
2930 #include <net/pkt_sched.h>
3031 #include <net/dst.h>
@@ -207,15 +208,19 @@ void __qdisc_run(struct Qdisc *q) · 176 unmodified lines
207208
208209 unsigned long dev_trans_start(struct net_device *dev)
209210 {
210− unsigned long val, res = dev->trans_start;
211+ unsigned long val, res;
211212 unsigned int i;
212213
214+ if (is_vlan_dev(dev))
215+ dev = vlan_dev_real_dev(dev);
216+ res = dev->trans_start;
213217 for (i = 0; i < dev->num_tx_queues; i++) {
214218 val = netdev_get_tx_queue(dev, i)->trans_start;
215219 if (val && time_after(val, res))
216220 res = val;
217221 }
218222 dev->trans_start = res;
223+
219224 return res;
220225 }
221226 EXPORT_SYMBOL(dev_trans_start);
@@ -904,6 +909,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, · 682 unmodified lines
904909 memset(r, 0, sizeof(*r));
905910 r->overhead = conf->overhead;
906911 r->rate_bytes_ps = conf->rate;
912+ r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK);
907913 r->mult = 1;
908914 /*
909915 * The deal here is to replace a divide by a reciprocal one
net/sched/sch_htb.c+13−0
@@ -1329,6 +1329,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, · 1328 unmodified lines
13291329 struct htb_sched *q = qdisc_priv(sch);
13301330 struct htb_class *cl = (struct htb_class *)*arg, *parent;
13311331 struct nlattr *opt = tca[TCA_OPTIONS];
1332+ struct qdisc_rate_table *rtab = NULL, *ctab = NULL;
13321333 struct nlattr *tb[TCA_HTB_MAX + 1];
13331334 struct tc_htb_opt *hopt;
13341335
@@ -1350,6 +1351,18 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, · 15 unmodified lines
13501351 if (!hopt->rate.rate || !hopt->ceil.rate)
13511352 goto failure;
13521353
1354+ /* Keeping backward compatible with rate_table based iproute2 tc */
1355+ if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE) {
1356+ rtab = qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB]);
1357+ if (rtab)
1358+ qdisc_put_rtab(rtab);
1359+ }
1360+ if (hopt->ceil.linklayer == TC_LINKLAYER_UNAWARE) {
1361+ ctab = qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB]);
1362+ if (ctab)
1363+ qdisc_put_rtab(ctab);
1364+ }
1365+
13531366 if (!cl) { /* new class */
13541367 struct Qdisc *new_q;
13551368 int prio;
net/sctp/associola.c+2−2
@@ -846,12 +846,12 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, · 845 unmodified lines
846846 else
847847 spc_state = SCTP_ADDR_AVAILABLE;
848848 /* Don't inform ULP about transition from PF to
849− * active state and set cwnd to 1, see SCTP
849+ * active state and set cwnd to 1 MTU, see SCTP
850850 * Quick failover draft section 5.1, point 5
851851 */
852852 if (transport->state == SCTP_PF) {
853853 ulp_notify = false;
854− transport->cwnd = 1;
854+ transport->cwnd = asoc->pathmtu;
855855 }
856856 transport->state = SCTP_ACTIVE;
857857 break;
net/sctp/transport.c+2−2
@@ -181,12 +181,12 @@ static void sctp_transport_destroy(struct sctp_transport *transport) · 180 unmodified lines
181181 return;
182182 }
183183
184− call_rcu(&transport->rcu, sctp_transport_destroy_rcu);
185−
186184 sctp_packet_free(&transport->packet);
187185
188186 if (transport->asoc)
189187 sctp_association_put(transport->asoc);
188+
189+ call_rcu(&transport->rcu, sctp_transport_destroy_rcu);
190190 }
191191
192192 /* Start T3_rtx timer if it is not already running and update the heartbeat
net/tipc/bearer.c+7−2
@@ -460,6 +460,7 @@ static void bearer_disable(struct tipc_bearer *b_ptr) · 459 unmodified lines
460460 {
461461 struct tipc_link *l_ptr;
462462 struct tipc_link *temp_l_ptr;
463+ struct tipc_link_req *temp_req;
463464
464465 pr_info("Disabling bearer <%s>\n", b_ptr->name);
465466 spin_lock_bh(&b_ptr->lock);
@@ -468,9 +469,13 @@ static void bearer_disable(struct tipc_bearer *b_ptr) · 2 unmodified lines
468469 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
469470 tipc_link_delete(l_ptr);
470471 }
471− if (b_ptr->link_req)
472− tipc_disc_delete(b_ptr->link_req);
472+ temp_req = b_ptr->link_req;
473+ b_ptr->link_req = NULL;
473474 spin_unlock_bh(&b_ptr->lock);
475+
476+ if (temp_req)
477+ tipc_disc_delete(temp_req);
478+
474479 memset(b_ptr, 0, sizeof(struct tipc_bearer));
475480 }
476481
net/vmw_vsock/af_vsock.c+1−1
@@ -347,7 +347,7 @@ void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)) · 346 unmodified lines
347347 for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) {
348348 struct vsock_sock *vsk;
349349 list_for_each_entry(vsk, &vsock_connected_table[i],
350− connected_table);
350+ connected_table)
351351 fn(sk_vsock(vsk));
352352 }
353353
net/wireless/core.c+1−0
@@ -765,6 +765,7 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev, · 764 unmodified lines
765765 cfg80211_leave_mesh(rdev, dev);
766766 break;
767767 case NL80211_IFTYPE_AP:
768+ case NL80211_IFTYPE_P2P_GO:
768769 cfg80211_stop_ap(rdev, dev);
769770 break;
770771 default:
net/wireless/nl80211.c+15−13
@@ -441,10 +441,12 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, · 440 unmodified lines
441441 goto out_unlock;
442442 }
443443 *rdev = wiphy_to_dev((*wdev)->wiphy);
444− cb->args[0] = (*rdev)->wiphy_idx;
444+ /* 0 is the first index - add 1 to parse only once */
445+ cb->args[0] = (*rdev)->wiphy_idx + 1;
445446 cb->args[1] = (*wdev)->identifier;
446447 } else {
447− struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0]);
448+ /* subtract the 1 again here */
449+ struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
448450 struct wireless_dev *tmp;
449451
450452 if (!wiphy) {
@@ -2620,8 +2622,8 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) · 2169 unmodified lines
26202622
26212623 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
26222624 NL80211_CMD_NEW_KEY);
2623− if (IS_ERR(hdr))
2624− return PTR_ERR(hdr);
2625+ if (!hdr)
2626+ return -ENOBUFS;
26252627
26262628 cookie.msg = msg;
26272629 cookie.idx = key_idx;
@@ -6505,6 +6507,9 @@ static int nl80211_testmode_dump(struct sk_buff *skb, · 3877 unmodified lines
65056507 NL80211_CMD_TESTMODE);
65066508 struct nlattr *tmdata;
65076509
6510+ if (!hdr)
6511+ break;
6512+
65086513 if (nla_put_u32(skb, NL80211_ATTR_WIPHY, phy_idx)) {
65096514 genlmsg_cancel(skb, hdr);
65106515 break;
@@ -6949,9 +6954,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, · 438 unmodified lines
69496954
69506955 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
69516956 NL80211_CMD_REMAIN_ON_CHANNEL);
6952−
6953− if (IS_ERR(hdr)) {
6954− err = PTR_ERR(hdr);
6957+ if (!hdr) {
6958+ err = -ENOBUFS;
69556959 goto free_msg;
69566960 }
69576961
@@ -7249,9 +7253,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) · 291 unmodified lines
72497253
72507254 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
72517255 NL80211_CMD_FRAME);
7252−
7253− if (IS_ERR(hdr)) {
7254− err = PTR_ERR(hdr);
7256+ if (!hdr) {
7257+ err = -ENOBUFS;
72557258 goto free_msg;
72567259 }
72577260 }
@@ -8130,9 +8133,8 @@ static int nl80211_probe_client(struct sk_buff *skb, · 872 unmodified lines
81308133
81318134 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
81328135 NL80211_CMD_PROBE_CLIENT);
8133−
8134− if (IS_ERR(hdr)) {
8135− err = PTR_ERR(hdr);
8136+ if (!hdr) {
8137+ err = -ENOBUFS;
81368138 goto free_msg;
81378139 }
81388140
net/wireless/sme.c+4−6
@@ -976,21 +976,19 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev, · 975 unmodified lines
976976 struct net_device *dev, u16 reason, bool wextev)
977977 {
978978 struct wireless_dev *wdev = dev->ieee80211_ptr;
979− int err;
979+ int err = 0;
980980
981981 ASSERT_WDEV_LOCK(wdev);
982982
983983 kfree(wdev->connect_keys);
984984 wdev->connect_keys = NULL;
985985
986− if (wdev->conn) {
986+ if (wdev->conn)
987987 err = cfg80211_sme_disconnect(wdev, reason);
988− } else if (!rdev->ops->disconnect) {
988+ else if (!rdev->ops->disconnect)
989989 cfg80211_mlme_down(rdev, dev);
990− err = 0;
991− } else {
990+ else if (wdev->current_bss)
992991 err = rdev_disconnect(rdev, dev, reason);
993− }
994992
995993 return err;
996994 }
sound/pci/hda/hda_generic.c+3−3
@@ -522,7 +522,7 @@ static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1, · 521 unmodified lines
522522 }
523523
524524 #define nid_has_mute(codec, nid, dir) \
525− check_amp_caps(codec, nid, dir, AC_AMPCAP_MUTE)
525+ check_amp_caps(codec, nid, dir, (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE))
526526 #define nid_has_volume(codec, nid, dir) \
527527 check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS)
528528
@@ -624,7 +624,7 @@ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, · 95 unmodified lines
624624 if (enable)
625625 val = (caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
626626 }
627− if (caps & AC_AMPCAP_MUTE) {
627+ if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) {
628628 if (!enable)
629629 val |= HDA_AMP_MUTE;
630630 }
@@ -648,7 +648,7 @@ static unsigned int get_amp_mask_to_modify(struct hda_codec *codec, · 17 unmodified lines
648648 {
649649 unsigned int mask = 0xff;
650650
651− if (caps & AC_AMPCAP_MUTE) {
651+ if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) {
652652 if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_MUTE_CTL))
653653 mask &= ~0x80;
654654 }
sound/pci/hda/patch_realtek.c+11−0
@@ -1031,6 +1031,7 @@ enum { · 1030 unmodified lines
10311031 ALC880_FIXUP_GPIO2,
10321032 ALC880_FIXUP_MEDION_RIM,
10331033 ALC880_FIXUP_LG,
1034+ ALC880_FIXUP_LG_LW25,
10341035 ALC880_FIXUP_W810,
10351036 ALC880_FIXUP_EAPD_COEF,
10361037 ALC880_FIXUP_TCL_S700,
@@ -1089,6 +1090,14 @@ static const struct hda_fixup alc880_fixups[] = { · 52 unmodified lines
10891090 { }
10901091 }
10911092 },
1093+ [ALC880_FIXUP_LG_LW25] = {
1094+ .type = HDA_FIXUP_PINS,
1095+ .v.pins = (const struct hda_pintbl[]) {
1096+ { 0x1a, 0x0181344f }, /* line-in */
1097+ { 0x1b, 0x0321403f }, /* headphone */
1098+ { }
1099+ }
1100+ },
10921101 [ALC880_FIXUP_W810] = {
10931102 .type = HDA_FIXUP_PINS,
10941103 .v.pins = (const struct hda_pintbl[]) {
@@ -1341,6 +1350,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = { · 246 unmodified lines
13411350 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
13421351 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
13431352 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1353+ SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
13441354 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
13451355
13461356 /* Below is the copied entries from alc880_quirks.c.
@@ -4329,6 +4339,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { · 2982 unmodified lines
43294339 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
43304340 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
43314341 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
4342+ SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
43324343 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
43334344 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
43344345 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
sound/soc/codecs/cs42l52.c+4−1
@@ -195,6 +195,8 @@ static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0); · 194 unmodified lines
195195
196196 static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0);
197197
198+static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0);
199+
198200 static const unsigned int limiter_tlv[] = {
199201 TLV_DB_RANGE_HEAD(2),
200202 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0),
@@ -451,7 +453,8 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { · 250 unmodified lines
451453 SOC_ENUM("Beep Pitch", beep_pitch_enum),
452454 SOC_ENUM("Beep on Time", beep_ontime_enum),
453455 SOC_ENUM("Beep off Time", beep_offtime_enum),
454− SOC_SINGLE_TLV("Beep Volume", CS42L52_BEEP_VOL, 0, 0x1f, 0x07, hl_tlv),
456+ SOC_SINGLE_SX_TLV("Beep Volume", CS42L52_BEEP_VOL,
457+ 0, 0x07, 0x1f, beep_tlv),
455458 SOC_SINGLE("Beep Mixer Switch", CS42L52_BEEP_TONE_CTL, 5, 1, 1),
456459 SOC_ENUM("Beep Treble Corner Freq", beep_treble_enum),
457460 SOC_ENUM("Beep Bass Corner Freq", beep_bass_enum),
sound/soc/codecs/sgtl5000.c+14−4
@@ -153,6 +153,8 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, · 152 unmodified lines
153153 static int power_vag_event(struct snd_soc_dapm_widget *w,
154154 struct snd_kcontrol *kcontrol, int event)
155155 {
156+ const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP;
157+
156158 switch (event) {
157159 case SND_SOC_DAPM_POST_PMU:
158160 snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
@@ -160,9 +162,17 @@ static int power_vag_event(struct snd_soc_dapm_widget *w, · 1 unmodified line
160162 break;
161163
162164 case SND_SOC_DAPM_PRE_PMD:
163− snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
164− SGTL5000_VAG_POWERUP, 0);
165− msleep(400);
165+ /*
166+ * Don't clear VAG_POWERUP, when both DAC and ADC are
167+ * operational to prevent inadvertently starving the
168+ * other one of them.
169+ */
170+ if ((snd_soc_read(w->codec, SGTL5000_CHIP_ANA_POWER) &
171+ mask) != mask) {
172+ snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
173+ SGTL5000_VAG_POWERUP, 0);
174+ msleep(400);
175+ }
166176 break;
167177 default:
168178 break;
@@ -388,7 +398,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = { · 219 unmodified lines
388398 SOC_DOUBLE("Capture Volume", SGTL5000_CHIP_ANA_ADC_CTRL, 0, 4, 0xf, 0),
389399 SOC_SINGLE_TLV("Capture Attenuate Switch (-6dB)",
390400 SGTL5000_CHIP_ANA_ADC_CTRL,
391− 8, 2, 0, capture_6db_attenuate),
401+ 8, 1, 0, capture_6db_attenuate),
392402 SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL, 1, 1, 0),
393403
394404 SOC_DOUBLE_TLV("Headphone Playback Volume",
sound/soc/soc-dapm.c+4−3
@@ -679,13 +679,14 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) · 678 unmodified lines
679679 return -EINVAL;
680680 }
681681
682− path = list_first_entry(&w->sources, struct snd_soc_dapm_path,
683− list_sink);
684− if (!path) {
682+ if (list_empty(&w->sources)) {
685683 dev_err(dapm->dev, "ASoC: mux %s has no paths\n", w->name);
686684 return -EINVAL;
687685 }
688686
687+ path = list_first_entry(&w->sources, struct snd_soc_dapm_path,
688+ list_sink);
689+
689690 ret = dapm_create_or_share_mixmux_kcontrol(w, 0, path);
690691 if (ret < 0)
691692 return ret;
sound/soc/tegra/tegra30_i2s.c+1−1
@@ -228,7 +228,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, · 227 unmodified lines
228228 reg = TEGRA30_I2S_CIF_RX_CTRL;
229229 } else {
230230 val |= TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX;
231− reg = TEGRA30_I2S_CIF_RX_CTRL;
231+ reg = TEGRA30_I2S_CIF_TX_CTRL;
232232 }
233233
234234 regmap_write(i2s->regmap, reg, val);
sound/usb/6fire/midi.c+15−1
@@ -19,6 +19,10 @@ · 18 unmodified lines
1919 #include "chip.h"
2020 #include "comm.h"
2121
22+enum {
23+ MIDI_BUFSIZE = 64
24+};
25+
2226 static void usb6fire_midi_out_handler(struct urb *urb)
2327 {
2428 struct midi_runtime *rt = urb->context;
@@ -156,6 +160,12 @@ int usb6fire_midi_init(struct sfire_chip *chip) · 131 unmodified lines
156160 if (!rt)
157161 return -ENOMEM;
158162
163+ rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL);
164+ if (!rt->out_buffer) {
165+ kfree(rt);
166+ return -ENOMEM;
167+ }
168+
159169 rt->chip = chip;
160170 rt->in_received = usb6fire_midi_in_received;
161171 rt->out_buffer[0] = 0x80; /* 'send midi' command */
@@ -169,6 +179,7 @@ int usb6fire_midi_init(struct sfire_chip *chip) · 7 unmodified lines
169179
170180 ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance);
171181 if (ret < 0) {
182+ kfree(rt->out_buffer);
172183 kfree(rt);
173184 snd_printk(KERN_ERR PREFIX "unable to create midi.\n");
174185 return ret;
@@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip) · 22 unmodified lines
197208
198209 void usb6fire_midi_destroy(struct sfire_chip *chip)
199210 {
200− kfree(chip->midi);
211+ struct midi_runtime *rt = chip->midi;
212+
213+ kfree(rt->out_buffer);
214+ kfree(rt);
201215 chip->midi = NULL;
202216 }
sound/usb/6fire/midi.h+1−5
@@ -16,10 +16,6 @@ · 15 unmodified lines
1616
1717 #include "common.h"
1818
19−enum {
20− MIDI_BUFSIZE = 64
21−};
22−
2319 struct midi_runtime {
2420 struct sfire_chip *chip;
2521 struct snd_rawmidi *instance;
@@ -32,7 +28,7 @@ struct midi_runtime { · 6 unmodified lines
3228 struct snd_rawmidi_substream *out;
3329 struct urb out_urb;
3430 u8 out_serial; /* serial number of out packet */
35− u8 out_buffer[MIDI_BUFSIZE];
31+ u8 *out_buffer;
3632 int buffer_offset;
3733
3834 void (*in_received)(struct midi_runtime *rt, u8 *data, int length);
sound/usb/6fire/pcm.c+40−1
@@ -582,6 +582,33 @@ static void usb6fire_pcm_init_urb(struct pcm_urb *urb, · 581 unmodified lines
582582 urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB;
583583 }
584584
585+static int usb6fire_pcm_buffers_init(struct pcm_runtime *rt)
586+{
587+ int i;
588+
589+ for (i = 0; i < PCM_N_URBS; i++) {
590+ rt->out_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB
591+ * PCM_MAX_PACKET_SIZE, GFP_KERNEL);
592+ if (!rt->out_urbs[i].buffer)
593+ return -ENOMEM;
594+ rt->in_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB
595+ * PCM_MAX_PACKET_SIZE, GFP_KERNEL);
596+ if (!rt->in_urbs[i].buffer)
597+ return -ENOMEM;
598+ }
599+ return 0;
600+}
601+
602+static void usb6fire_pcm_buffers_destroy(struct pcm_runtime *rt)
603+{
604+ int i;
605+
606+ for (i = 0; i < PCM_N_URBS; i++) {
607+ kfree(rt->out_urbs[i].buffer);
608+ kfree(rt->in_urbs[i].buffer);
609+ }
610+}
611+
585612 int usb6fire_pcm_init(struct sfire_chip *chip)
586613 {
587614 int i;
@@ -593,6 +620,13 @@ int usb6fire_pcm_init(struct sfire_chip *chip) · 5 unmodified lines
593620 if (!rt)
594621 return -ENOMEM;
595622
623+ ret = usb6fire_pcm_buffers_init(rt);
624+ if (ret) {
625+ usb6fire_pcm_buffers_destroy(rt);
626+ kfree(rt);
627+ return ret;
628+ }
629+
596630 rt->chip = chip;
597631 rt->stream_state = STREAM_DISABLED;
598632 rt->rate = ARRAY_SIZE(rates);
@@ -614,6 +648,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip) · 15 unmodified lines
614648
615649 ret = snd_pcm_new(chip->card, "DMX6FireUSB", 0, 1, 1, &pcm);
616650 if (ret < 0) {
651+ usb6fire_pcm_buffers_destroy(rt);
617652 kfree(rt);
618653 snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n");
619654 return ret;
@@ -625,6 +660,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip) · 5 unmodified lines
625660 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops);
626661
627662 if (ret) {
663+ usb6fire_pcm_buffers_destroy(rt);
628664 kfree(rt);
629665 snd_printk(KERN_ERR PREFIX
630666 "error preallocating pcm buffers.\n");
@@ -669,6 +705,9 @@ void usb6fire_pcm_abort(struct sfire_chip *chip) · 38 unmodified lines
669705
670706 void usb6fire_pcm_destroy(struct sfire_chip *chip)
671707 {
672− kfree(chip->pcm);
708+ struct pcm_runtime *rt = chip->pcm;
709+
710+ usb6fire_pcm_buffers_destroy(rt);
711+ kfree(rt);
673712 chip->pcm = NULL;
674713 }
sound/usb/6fire/pcm.h+1−1
@@ -32,7 +32,7 @@ struct pcm_urb { · 31 unmodified lines
3232 struct urb instance;
3333 struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB];
3434 /* END DO NOT SEPARATE */
35− u8 buffer[PCM_N_PACKETS_PER_URB * PCM_MAX_PACKET_SIZE];
35+ u8 *buffer;
3636
3737 struct pcm_urb *peer;
3838 };
sound/usb/mixer.c+1−0
@@ -888,6 +888,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, · 887 unmodified lines
888888 case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */
889889 case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */
890890 case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */
891+ case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */
891892 case USB_ID(0x046d, 0x0991):
892893 /* Most audio usb devices lie about volume resolution.
893894 * Most Logitech webcams have res = 384.
sound/usb/quirks.c+3−3
@@ -319,19 +319,19 @@ static int create_auto_midi_quirk(struct snd_usb_audio *chip, · 318 unmodified lines
319319 if (altsd->bNumEndpoints < 1)
320320 return -ENODEV;
321321 epd = get_endpoint(alts, 0);
322− if (!usb_endpoint_xfer_bulk(epd) ||
322+ if (!usb_endpoint_xfer_bulk(epd) &&
323323 !usb_endpoint_xfer_int(epd))
324324 return -ENODEV;
325325
326326 switch (USB_ID_VENDOR(chip->usb_id)) {
327327 case 0x0499: /* Yamaha */
328328 err = create_yamaha_midi_quirk(chip, iface, driver, alts);
329− if (err < 0 && err != -ENODEV)
329+ if (err != -ENODEV)
330330 return err;
331331 break;
332332 case 0x0582: /* Roland */
333333 err = create_roland_midi_quirk(chip, iface, driver, alts);
334− if (err < 0 && err != -ENODEV)
334+ if (err != -ENODEV)
335335 return err;
336336 break;
337337 }