···33Contact: Kay Sievers <kay.sievers@vrfy.org>44Description:55 Shows the list of currently configured66- tty devices used for the console,77- like 'tty1 ttyS0'.66+ console devices, like 'tty1 ttyS0'.87 The last entry in the file is the active98 device connected to /dev/console.109 The file supports poll() to detect virtual
+109-10
Documentation/PCI/MSI-HOWTO.txt
···8282has to request that the PCI layer set up the MSI capability for this8383device.84848585-4.2.1 pci_enable_msi_range8585+4.2.1 pci_enable_msi8686+8787+int pci_enable_msi(struct pci_dev *dev)8888+8989+A successful call allocates ONE interrupt to the device, regardless9090+of how many MSIs the device supports. The device is switched from9191+pin-based interrupt mode to MSI mode. The dev->irq number is changed9292+to a new number which represents the message signaled interrupt;9393+consequently, this function should be called before the driver calls9494+request_irq(), because an MSI is delivered via a vector that is9595+different from the vector of a pin-based interrupt.9696+9797+4.2.2 pci_enable_msi_range86988799int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec)88100···159147 return pci_enable_msi_range(pdev, nvec, nvec);160148}161149150150+Note, unlike pci_enable_msi_exact() function, which could be also used to151151+enable a particular number of MSI-X interrupts, pci_enable_msi_range()152152+returns either a negative errno or 'nvec' (not negative errno or 0 - as153153+pci_enable_msi_exact() does).154154+1621554.2.1.3 Single MSI mode163156164157The most notorious example of the request type described above is···175158 return pci_enable_msi_range(pdev, 1, 1);176159}177160178178-4.2.2 pci_disable_msi161161+Note, unlike pci_enable_msi() function, which could be also used to162162+enable the single MSI mode, pci_enable_msi_range() returns either a163163+negative errno or 1 (not negative errno or 0 - as pci_enable_msi()164164+does).165165+166166+4.2.3 pci_enable_msi_exact167167+168168+int pci_enable_msi_exact(struct pci_dev *dev, int nvec)169169+170170+This variation on pci_enable_msi_range() call allows a device driver to171171+request exactly 'nvec' MSIs.172172+173173+If this function returns a negative number, it indicates an error and174174+the driver should not attempt to request any more MSI interrupts for175175+this device.176176+177177+By contrast with pci_enable_msi_range() function, pci_enable_msi_exact()178178+returns zero in case of success, which indicates MSI interrupts have been179179+successfully allocated.180180+181181+4.2.4 pci_disable_msi179182180183void pci_disable_msi(struct pci_dev *dev)181184···209172Failure to do so results in a BUG_ON(), leaving the device with210173MSI enabled and thus leaking its vector.211174212212-4.2.3 pci_msi_vec_count175175+4.2.4 pci_msi_vec_count213176214177int pci_msi_vec_count(struct pci_dev *dev)215178···294257295258static int foo_driver_enable_msix(struct foo_adapter *adapter, int nvec)296259{297297- return pci_enable_msi_range(adapter->pdev, adapter->msix_entries,298298- 1, nvec);260260+ return pci_enable_msix_range(adapter->pdev, adapter->msix_entries,261261+ 1, nvec);299262}300263301264Note the value of 'minvec' parameter is 1. As 'minvec' is inclusive,···306269307270static int foo_driver_enable_msix(struct foo_adapter *adapter, int nvec)308271{309309- return pci_enable_msi_range(adapter->pdev, adapter->msix_entries,310310- FOO_DRIVER_MINIMUM_NVEC, nvec);272272+ return pci_enable_msix_range(adapter->pdev, adapter->msix_entries,273273+ FOO_DRIVER_MINIMUM_NVEC, nvec);311274}3122753132764.3.1.2 Exact number of MSI-X interrupts···319282320283static int foo_driver_enable_msix(struct foo_adapter *adapter, int nvec)321284{322322- return pci_enable_msi_range(adapter->pdev, adapter->msix_entries,323323- nvec, nvec);285285+ return pci_enable_msix_range(adapter->pdev, adapter->msix_entries,286286+ nvec, nvec);324287}288288+289289+Note, unlike pci_enable_msix_exact() function, which could be also used to290290+enable a particular number of MSI-X interrupts, pci_enable_msix_range()291291+returns either a negative errno or 'nvec' (not negative errno or 0 - as292292+pci_enable_msix_exact() does).3252933262944.3.1.3 Specific requirements to the number of MSI-X interrupts327295···374332any error code other than -ENOSPC indicates a fatal error and should not375333be retried.376334377377-4.3.2 pci_disable_msix335335+4.3.2 pci_enable_msix_exact336336+337337+int pci_enable_msix_exact(struct pci_dev *dev,338338+ struct msix_entry *entries, int nvec)339339+340340+This variation on pci_enable_msix_range() call allows a device driver to341341+request exactly 'nvec' MSI-Xs.342342+343343+If this function returns a negative number, it indicates an error and344344+the driver should not attempt to allocate any more MSI-X interrupts for345345+this device.346346+347347+By contrast with pci_enable_msix_range() function, pci_enable_msix_exact()348348+returns zero in case of success, which indicates MSI-X interrupts have been349349+successfully allocated.350350+351351+Another version of a routine that enables MSI-X mode for a device with352352+specific requirements described in chapter 4.3.1.3 might look like this:353353+354354+/*355355+ * Assume 'minvec' and 'maxvec' are non-zero356356+ */357357+static int foo_driver_enable_msix(struct foo_adapter *adapter,358358+ int minvec, int maxvec)359359+{360360+ int rc;361361+362362+ minvec = roundup_pow_of_two(minvec);363363+ maxvec = rounddown_pow_of_two(maxvec);364364+365365+ if (minvec > maxvec)366366+ return -ERANGE;367367+368368+retry:369369+ rc = pci_enable_msix_exact(adapter->pdev,370370+ adapter->msix_entries, maxvec);371371+372372+ /*373373+ * -ENOSPC is the only error code allowed to be analyzed374374+ */375375+ if (rc == -ENOSPC) {376376+ if (maxvec == 1)377377+ return -ENOSPC;378378+379379+ maxvec /= 2;380380+381381+ if (minvec > maxvec)382382+ return -ENOSPC;383383+384384+ goto retry;385385+ } else if (rc < 0) {386386+ return rc;387387+ }388388+389389+ return maxvec;390390+}391391+392392+4.3.3 pci_disable_msix378393379394void pci_disable_msix(struct pci_dev *dev)380395
+5-6
Documentation/device-mapper/cache.txt
···124124Updating on-disk metadata125125-------------------------126126127127-On-disk metadata is committed every time a REQ_SYNC or REQ_FUA bio is128128-written. If no such requests are made then commits will occur every129129-second. This means the cache behaves like a physical disk that has a130130-write cache (the same is true of the thin-provisioning target). If131131-power is lost you may lose some recent writes. The metadata should132132-always be consistent in spite of any crash.127127+On-disk metadata is committed every time a FLUSH or FUA bio is written.128128+If no such requests are made then commits will occur every second. This129129+means the cache behaves like a physical disk that has a volatile write130130+cache. If power is lost you may lose some recent writes. The metadata131131+should always be consistent in spite of any crash.133132134133The 'dirty' state for a cache block changes far too frequently for us135134to keep updating it on the fly. So we treat it as a hint. In normal
+31-3
Documentation/device-mapper/thin-provisioning.txt
···116116userspace daemon can use this to detect a situation where a new table117117already exceeds the threshold.118118119119+A low water mark for the metadata device is maintained in the kernel and120120+will trigger a dm event if free space on the metadata device drops below121121+it.122122+123123+Updating on-disk metadata124124+-------------------------125125+126126+On-disk metadata is committed every time a FLUSH or FUA bio is written.127127+If no such requests are made then commits will occur every second. This128128+means the thin-provisioning target behaves like a physical disk that has129129+a volatile write cache. If power is lost you may lose some recent130130+writes. The metadata should always be consistent in spite of any crash.131131+132132+If data space is exhausted the pool will either error or queue IO133133+according to the configuration (see: error_if_no_space). If metadata134134+space is exhausted or a metadata operation fails: the pool will error IO135135+until the pool is taken offline and repair is performed to 1) fix any136136+potential inconsistencies and 2) clear the flag that imposes repair.137137+Once the pool's metadata device is repaired it may be resized, which138138+will allow the pool to return to normal operation. Note that if a pool139139+is flagged as needing repair, the pool's data and metadata devices140140+cannot be resized until repair is performed. It should also be noted141141+that when the pool's metadata space is exhausted the current metadata142142+transaction is aborted. Given that the pool will cache IO whose143143+completion may have already been acknowledged to upper IO layers144144+(e.g. filesystem) it is strongly suggested that consistency checks145145+(e.g. fsck) be performed on those layers when repair of the pool is146146+required.147147+119148Thin provisioning120149-----------------121150···287258 should register for the event and then check the target's status.288259289260 held metadata root:290290- The location, in sectors, of the metadata root that has been261261+ The location, in blocks, of the metadata root that has been291262 'held' for userspace read access. '-' indicates there is no292292- held root. This feature is not yet implemented so '-' is293293- always returned.263263+ held root.294264295265 discard_passdown|no_discard_passdown296266 Whether or not discards are actually being passed down to the
···2121 must appear in the same order as the output clocks.2222 - #clock-cells: Must be 12323 - clock-output-names: The name of the clocks as free-form strings2424- - renesas,indices: Indices of the gate clocks into the group (0 to 31)2424+ - renesas,clock-indices: Indices of the gate clocks into the group (0 to 31)25252626-The clocks, clock-output-names and renesas,indices properties contain one2626+The clocks, clock-output-names and renesas,clock-indices properties contain one2727entry per gate clock. The MSTP groups are sparsely populated. Unimplemented2828gate clocks must not be declared.2929
···11* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX2233Required properties:44-- compatible : Should be "fsl,imx31-sdma", "fsl,imx31-to1-sdma",55- "fsl,imx31-to2-sdma", "fsl,imx35-sdma", "fsl,imx35-to1-sdma",66- "fsl,imx35-to2-sdma", "fsl,imx51-sdma", "fsl,imx53-sdma" or77- "fsl,imx6q-sdma". The -to variants should be preferred since they88- allow to determnine the correct ROM script addresses needed for99- the driver to work without additional firmware.44+- compatible : Should be one of55+ "fsl,imx25-sdma"66+ "fsl,imx31-sdma", "fsl,imx31-to1-sdma", "fsl,imx31-to2-sdma"77+ "fsl,imx35-sdma", "fsl,imx35-to1-sdma", "fsl,imx35-to2-sdma"88+ "fsl,imx51-sdma"99+ "fsl,imx53-sdma"1010+ "fsl,imx6q-sdma"1111+ The -to variants should be preferred since they allow to determnine the1212+ correct ROM script addresses needed for the driver to work without additional1313+ firmware.1014- reg : Should contain SDMA registers location and length1115- interrupts : Should contain SDMA interrupt1216- #dma-cells : Must be <3>.
···11+* OpenCores MAC 10/100 Mbps22+33+Required properties:44+- compatible: Should be "opencores,ethoc".55+- reg: two memory regions (address and length),66+ first region is for the device registers and descriptor rings,77+ second is for the device packet memory.88+- interrupts: interrupt for the device.99+1010+Optional properties:1111+- clocks: phandle to refer to the clk used as per1212+ Documentation/devicetree/bindings/clock/clock-bindings.txt1313+1414+Examples:1515+1616+ enet0: ethoc@fd030000 {1717+ compatible = "opencores,ethoc";1818+ reg = <0xfd030000 0x4000 0xfd800000 0x4000>;1919+ interrupts = <1>;2020+ local-mac-address = [00 50 c2 13 6f 00];2121+ clocks = <&osc>;2222+ };
···11+STMicroelectronics SoC DWMAC glue layer controller22+33+The device node has following properties.44+55+Required properties:66+ - compatible : Can be "st,stih415-dwmac", "st,stih416-dwmac" or77+ "st,stid127-dwmac".88+ - reg : Offset of the glue configuration register map in system99+ configuration regmap pointed by st,syscon property and size.1010+1111+ - reg-names : Should be "sti-ethconf".1212+1313+ - st,syscon : Should be phandle to system configuration node which1414+ encompases this glue registers.1515+1616+ - st,tx-retime-src: On STi Parts for Giga bit speeds, 125Mhz clocks can be1717+ wired up in from different sources. One via TXCLK pin and other via CLK_1251818+ pin. This wiring is totally board dependent. However the retiming glue1919+ logic should be configured accordingly. Possible values for this property2020+2121+ "txclk" - if 125Mhz clock is wired up via txclk line.2222+ "clk_125" - if 125Mhz clock is wired up via clk_125 line.2323+2424+ This property is only valid for Giga bit setup( GMII, RGMII), and it is2525+ un-used for non-giga bit (MII and RMII) setups. Also note that internal2626+ clockgen can not generate stable 125Mhz clock.2727+2828+ - st,ext-phyclk: This boolean property indicates who is generating the clock2929+ for tx and rx. This property is only valid for RMII case where the clock can3030+ be generated from the MAC or PHY.3131+3232+ - clock-names: should be "sti-ethclk".3333+ - clocks: Should point to ethernet clockgen which can generate phyclk.3434+3535+3636+Example:3737+3838+ethernet0: dwmac@fe810000 {3939+ device_type = "network";4040+ compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710";4141+ reg = <0xfe810000 0x8000>, <0x8bc 0x4>;4242+ reg-names = "stmmaceth", "sti-ethconf";4343+ interrupts = <0 133 0>, <0 134 0>, <0 135 0>;4444+ interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";4545+ phy-mode = "mii";4646+4747+ st,syscon = <&syscfg_rear>;4848+4949+ snps,pbl = <32>;5050+ snps,mixed-burst;5151+5252+ resets = <&softreset STIH416_ETH0_SOFTRESET>;5353+ reset-names = "stmmaceth";5454+ pinctrl-0 = <&pinctrl_mii0>;5555+ pinctrl-names = "default";5656+ clocks = <&CLK_S_GMAC0_PHY>;5757+ clock-names = "stmmaceth";5858+};
···11-Broadcom Capri Pin Controller11+Broadcom BCM281xx Pin Controller2233This is a pin controller for the Broadcom BCM281xx SoC family, which includes44BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs.···7788Required Properties:991010-- compatible: Must be "brcm,capri-pinctrl".1010+- compatible: Must be "brcm,bcm11351-pinctrl"1111- reg: Base address of the PAD Controller register block and the size1212 of the block.13131414For example, the following is the bare minimum node:15151616 pinctrl@35004800 {1717- compatible = "brcm,capri-pinctrl";1717+ compatible = "brcm,bcm11351-pinctrl";1818 reg = <0x35004800 0x430>;1919 };2020···119119Example:120120// pin controller node121121pinctrl@35004800 {122122- compatible = "brcm,capri-pinctrl";122122+ compatible = "brcmbcm11351-pinctrl";123123 reg = <0x35004800 0x430>;124124125125 // pin configuration node
-45
Documentation/networking/3c505.txt
···11-The 3Com Etherlink Plus (3c505) driver.22-33-This driver now uses DMA. There is currently no support for PIO operation.44-The default DMA channel is 6; this is _not_ autoprobed, so you must55-make sure you configure it correctly. If loading the driver as a66-module, you can do this with "modprobe 3c505 dma=n". If the driver is77-linked statically into the kernel, you must either use an "ether="88-statement on the command line, or change the definition of ELP_DMA in 3c505.h.99-1010-The driver will warn you if it has to fall back on the compiled in1111-default DMA channel. 1212-1313-If no base address is given at boot time, the driver will autoprobe1414-ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver1515-will try to probe for it.1616-1717-The driver can be used as a loadable module.1818-1919-Theoretically, one instance of the driver can now run multiple cards,2020-in the standard way (when loading a module, say "modprobe 3c5052121-io=0x300,0x340 irq=10,11 dma=6,7" or whatever). I have not tested2222-this, though.2323-2424-The driver may now support revision 2 hardware; the dependency on2525-being able to read the host control register has been removed. This2626-is also untested, since I don't have a suitable card.2727-2828-Known problems:2929- I still see "DMA upload timed out" messages from time to time. These3030-seem to be fairly non-fatal though.3131- The card is old and slow.3232-3333-To do:3434- Improve probe/setup code3535- Test multicast and promiscuous operation3636-3737-Authors:3838- The driver is mainly written by Craig Southeren, email3939- <craigs@ineluki.apana.org.au>.4040- Parts of the driver (adapting the driver to 1.1.4+ kernels,4141- IRQ/address detection, some changes) and this README by4242- Juha Laiho <jlaiho@ichaos.nullnet.fi>.4343- DMA mode, more fixes, etc, by Philip Blundell <pjb27@cam.ac.uk>4444- Multicard support, Software configurable DMA, etc., by4545- Christopher Collins <ccollins@pcug.org.au>
-6
Documentation/networking/can.txt
···554554 not specified in the struct can_frame and therefore it is only valid in555555 CANFD_MTU sized CAN FD frames.556556557557- As long as the payload length is <=8 the received CAN frames from CAN FD558558- capable CAN devices can be received and read by legacy sockets too. When559559- user-generated CAN FD frames have a payload length <=8 these can be send560560- by legacy CAN network interfaces too. Sending CAN FD frames with payload561561- length > 8 to a legacy CAN network interface returns an -EMSGSIZE error.562562-563557 Implementation hint for new CAN applications:564558565559 To build a CAN FD aware application use struct canfd_frame as basic CAN
+95-57
MAINTAINERS
···7373 L: Mailing list that is relevant to this area7474 W: Web-page with status/info7575 Q: Patchwork web based patch tracking system site7676- T: SCM tree type and location. Type is one of: git, hg, quilt, stgit, topgit.7676+ T: SCM tree type and location.7777+ Type is one of: git, hg, quilt, stgit, topgit7778 S: Status, one of the following:7879 Supported: Someone is actually paid to look after this.7980 Maintained: Someone actually looks after it.···474473475474AGPGART DRIVER476475M: David Airlie <airlied@linux.ie>477477-T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git476476+T: git git://people.freedesktop.org/~airlied/linux (part of drm maint)478477S: Maintained479478F: drivers/char/agp/480479F: include/linux/agp*···539538ALTERA UART/JTAG UART SERIAL DRIVERS540539M: Tobias Klauser <tklauser@distanz.ch>541540L: linux-serial@vger.kernel.org542542-L: nios2-dev@sopc.et.ntust.edu.tw (moderated for non-subscribers)541541+L: nios2-dev@lists.rocketboards.org (moderated for non-subscribers)543542S: Maintained544543F: drivers/tty/serial/altera_uart.c545544F: drivers/tty/serial/altera_jtaguart.c···16131612F: drivers/net/wireless/atmel*1614161316151614ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER16161616-M: Bradley Grove <linuxdrivers@attotech.com>16171617-L: linux-scsi@vger.kernel.org16181618-W: http://www.attotech.com16191619-S: Supported16201620-F: drivers/scsi/esas2r16151615+M: Bradley Grove <linuxdrivers@attotech.com>16161616+L: linux-scsi@vger.kernel.org16171617+W: http://www.attotech.com16181618+S: Supported16191619+F: drivers/scsi/esas2r1621162016221621AUDIT SUBSYSTEM16231622M: Eric Paris <eparis@redhat.com>···1861186018621861BROADCOM BCM281XX/BCM11XXX ARM ARCHITECTURE18631862M: Christian Daudt <bcm@fixthebug.org>18631863+M: Matt Porter <mporter@linaro.org>18641864L: bcm-kernel-feedback-list@broadcom.com18651865T: git git://git.github.com/broadcom/bcm1135118661866S: Maintained···2160215821612159CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER21622160M: Peter Chen <Peter.Chen@freescale.com>21632163-T: git://github.com/hzpeterchen/linux-usb.git21612161+T: git git://github.com/hzpeterchen/linux-usb.git21642162L: linux-usb@vger.kernel.org21652163S: Maintained21662164F: drivers/usb/chipidea/···21802178F: drivers/net/ethernet/cisco/enic/2181217921822180CISCO VIC LOW LATENCY NIC DRIVER21832183-M: Upinder Malhi <umalhi@cisco.com>21842184-S: Supported21852185-F: drivers/infiniband/hw/usnic21812181+M: Upinder Malhi <umalhi@cisco.com>21822182+S: Supported21832183+F: drivers/infiniband/hw/usnic2186218421872185CIRRUS LOGIC EP93XX ETHERNET DRIVER21882186M: Hartley Sweeten <hsweeten@visionengravers.com>···23792377F: drivers/cpufreq/arm_big_little_dt.c2380237823812379CPUIDLE DRIVER - ARM BIG LITTLE23822382-M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>23832383-M: Daniel Lezcano <daniel.lezcano@linaro.org>23842384-L: linux-pm@vger.kernel.org23852385-L: linux-arm-kernel@lists.infradead.org23862386-T: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git23872387-S: Maintained23882388-F: drivers/cpuidle/cpuidle-big_little.c23802380+M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>23812381+M: Daniel Lezcano <daniel.lezcano@linaro.org>23822382+L: linux-pm@vger.kernel.org23832383+L: linux-arm-kernel@lists.infradead.org23842384+T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git23852385+S: Maintained23862386+F: drivers/cpuidle/cpuidle-big_little.c2389238723902388CPUIDLE DRIVERS23912389M: Rafael J. Wysocki <rjw@rjwysocki.net>23922390M: Daniel Lezcano <daniel.lezcano@linaro.org>23932391L: linux-pm@vger.kernel.org23942392S: Maintained23952395-T: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git23932393+T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git23962394F: drivers/cpuidle/*23972395F: include/linux/cpuidle.h23982396···2410240824112409CPUSETS24122410M: Li Zefan <lizefan@huawei.com>24112411+L: cgroups@vger.kernel.org24132412W: http://www.bullopensource.org/cpuset/24142413W: http://oss.sgi.com/projects/cpusets/24142414+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git24152415S: Maintained24162416F: Documentation/cgroups/cpusets.txt24172417F: include/linux/cpuset.h···24592455F: sound/pci/cs5535audio/2460245624612457CW1200 WLAN driver24622462-M: Solomon Peachy <pizza@shaftnet.org>24632463-S: Maintained24642464-F: drivers/net/wireless/cw1200/24582458+M: Solomon Peachy <pizza@shaftnet.org>24592459+S: Maintained24602460+F: drivers/net/wireless/cw1200/2465246124662462CX18 VIDEO4LINUX DRIVER24672463M: Andy Walls <awalls@md.metrocast.net>···26122608M: Oliver Neukum <oliver@neukum.org>26132609M: Ali Akcaagac <aliakc@web.de>26142610M: Jamie Lenehan <lenehan@twibble.org>26152615-W: http://twibble.org/dist/dc395x/26162611L: dc395x@twibble.org26172617-L: http://lists.twibble.org/mailman/listinfo/dc395x/26122612+W: http://twibble.org/dist/dc395x/26132613+W: http://lists.twibble.org/mailman/listinfo/dc395x/26182614S: Maintained26192615F: Documentation/scsi/dc395x.txt26202616F: drivers/scsi/dc395x.*···28492845DRM DRIVERS28502846M: David Airlie <airlied@linux.ie>28512847L: dri-devel@lists.freedesktop.org28522852-T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git28482848+T: git git://people.freedesktop.org/~airlied/linux28532849S: Maintained28542850F: drivers/gpu/drm/28552851F: include/drm/28562852F: include/uapi/drm/28532853+28542854+RADEON DRM DRIVERS28552855+M: Alex Deucher <alexander.deucher@amd.com>28562856+M: Christian König <christian.koenig@amd.com>28572857+L: dri-devel@lists.freedesktop.org28582858+T: git git://people.freedesktop.org/~agd5f/linux28592859+S: Supported28602860+F: drivers/gpu/drm/radeon/28612861+F: include/drm/radeon*28622862+F: include/uapi/drm/radeon*2857286328582864INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)28592865M: Daniel Vetter <daniel.vetter@ffwll.ch>···3096308230973083EDAC-CORE30983084M: Doug Thompson <dougthompson@xmission.com>30853085+M: Borislav Petkov <bp@alien8.de>30863086+M: Mauro Carvalho Chehab <m.chehab@samsung.com>30993087L: linux-edac@vger.kernel.org31003088W: bluesmoke.sourceforge.net31013089S: Supported···33393323S: Maintained33403324F: include/linux/netfilter_bridge/33413325F: net/bridge/33263326+33273327+ETHERNET PHY LIBRARY33283328+M: Florian Fainelli <f.fainelli@gmail.com>33293329+L: netdev@vger.kernel.org33303330+S: Maintained33313331+F: include/linux/phy.h33323332+F: include/linux/phy_fixed.h33333333+F: drivers/net/phy/33343334+F: Documentation/networking/phy.txt33353335+F: drivers/of/of_mdio.c33363336+F: drivers/of/of_net.c3342333733433338EXT2 FILE SYSTEM33443339M: Jan Kara <jack@suse.cz>···45614534F: Documentation/networking/i40e.txt45624535F: Documentation/networking/i40evf.txt45634536F: drivers/net/ethernet/intel/45374537+F: drivers/net/ethernet/intel/*/4564453845654539INTEL-MID GPIO DRIVER45664540M: David Cohen <david.a.cohen@linux.intel.com>···49184890KCONFIG49194891M: "Yann E. MORIN" <yann.morin.1998@free.fr>49204892L: linux-kbuild@vger.kernel.org49214921-T: git://gitorious.org/linux-kconfig/linux-kconfig48934893+T: git git://gitorious.org/linux-kconfig/linux-kconfig49224894S: Maintained49234895F: Documentation/kbuild/kconfig-language.txt49244896F: scripts/kconfig/···54755447F: drivers/media/tuners/m88ts2022*5476544854775449MA901 MASTERKIT USB FM RADIO DRIVER54785478-M: Alexey Klimov <klimov.linux@gmail.com>54795479-L: linux-media@vger.kernel.org54805480-T: git git://linuxtv.org/media_tree.git54815481-S: Maintained54825482-F: drivers/media/radio/radio-ma901.c54505450+M: Alexey Klimov <klimov.linux@gmail.com>54515451+L: linux-media@vger.kernel.org54525452+T: git git://linuxtv.org/media_tree.git54535453+S: Maintained54545454+F: drivers/media/radio/radio-ma901.c5483545554845456MAC8021154855457M: Johannes Berg <johannes@sipsolutions.net>···55145486W: http://www.kernel.org/doc/man-pages55155487L: linux-man@vger.kernel.org55165488S: Maintained54895489+54905490+MARVELL ARMADA DRM SUPPORT54915491+M: Russell King <rmk+kernel@arm.linux.org.uk>54925492+S: Maintained54935493+F: drivers/gpu/drm/armada/5517549455185495MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2)55195496M: Mirko Lindner <mlindner@marvell.com>···5640560756415608MELLANOX ETHERNET DRIVER (mlx4_en)56425609M: Amir Vadai <amirv@mellanox.com>56435643-L: netdev@vger.kernel.org56105610+L: netdev@vger.kernel.org56445611S: Supported56455612W: http://www.mellanox.com56465613Q: http://patchwork.ozlabs.org/project/netdev/list/···56815648F: include/uapi/mtd/5682564956835650MEN A21 WATCHDOG DRIVER56845684-M: Johannes Thumshirn <johannes.thumshirn@men.de>56515651+M: Johannes Thumshirn <johannes.thumshirn@men.de>56855652L: linux-watchdog@vger.kernel.org56865653S: Supported56875654F: drivers/watchdog/mena21_wdt.c···57375704W: http://www.mellanox.com57385705Q: http://patchwork.ozlabs.org/project/netdev/list/57395706Q: http://patchwork.kernel.org/project/linux-rdma/list/57405740-T: git://openfabrics.org/~eli/connect-ib.git57075707+T: git git://openfabrics.org/~eli/connect-ib.git57415708S: Supported57425709F: drivers/net/ethernet/mellanox/mlx5/core/57435710F: include/linux/mlx5/5744571157455712Mellanox MLX5 IB driver57465746-M: Eli Cohen <eli@mellanox.com>57475747-L: linux-rdma@vger.kernel.org57485748-W: http://www.mellanox.com57495749-Q: http://patchwork.kernel.org/project/linux-rdma/list/57505750-T: git://openfabrics.org/~eli/connect-ib.git57515751-S: Supported57525752-F: include/linux/mlx5/57535753-F: drivers/infiniband/hw/mlx5/57135713+M: Eli Cohen <eli@mellanox.com>57145714+L: linux-rdma@vger.kernel.org57155715+W: http://www.mellanox.com57165716+Q: http://patchwork.kernel.org/project/linux-rdma/list/57175717+T: git git://openfabrics.org/~eli/connect-ib.git57185718+S: Supported57195719+F: include/linux/mlx5/57205720+F: drivers/infiniband/hw/mlx5/5754572157555722MODULE SUPPORT57565723M: Rusty Russell <rusty@rustcorp.com.au>···61746141S: Supported61756142F: drivers/block/nvme*61766143F: include/linux/nvme.h61446144+61456145+NXP TDA998X DRM DRIVER61466146+M: Russell King <rmk+kernel@arm.linux.org.uk>61476147+S: Supported61486148+F: drivers/gpu/drm/i2c/tda998x_drv.c61496149+F: include/drm/i2c/tda998x.h6177615061786151OMAP SUPPORT61796152M: Tony Lindgren <tony@atomide.com>···84688429M: Nicholas A. Bellinger <nab@linux-iscsi.org>84698430L: linux-scsi@vger.kernel.org84708431L: target-devel@vger.kernel.org84718471-L: http://groups.google.com/group/linux-iscsi-target-dev84728432W: http://www.linux-iscsi.org84338433+W: http://groups.google.com/group/linux-iscsi-target-dev84738434T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master84748435S: Supported84758436F: drivers/target/···87108671F: drivers/media/radio/radio-raremono.c8711867287128673THERMAL87138713-M: Zhang Rui <rui.zhang@intel.com>87148714-M: Eduardo Valentin <eduardo.valentin@ti.com>87158715-L: linux-pm@vger.kernel.org87168716-T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git87178717-T: git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git87188718-Q: https://patchwork.kernel.org/project/linux-pm/list/87198719-S: Supported87208720-F: drivers/thermal/87218721-F: include/linux/thermal.h87228722-F: include/linux/cpu_cooling.h87238723-F: Documentation/devicetree/bindings/thermal/86748674+M: Zhang Rui <rui.zhang@intel.com>86758675+M: Eduardo Valentin <eduardo.valentin@ti.com>86768676+L: linux-pm@vger.kernel.org86778677+T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git86788678+T: git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git86798679+Q: https://patchwork.kernel.org/project/linux-pm/list/86808680+S: Supported86818681+F: drivers/thermal/86828682+F: include/linux/thermal.h86838683+F: include/linux/cpu_cooling.h86848684+F: Documentation/devicetree/bindings/thermal/8724868587258686THINGM BLINK(1) USB RGB LED DRIVER87268687M: Vivien Didelot <vivien.didelot@savoirfairelinux.com>···97549715XFS FILESYSTEM97559716P: Silicon Graphics Inc97569717M: Dave Chinner <david@fromorbit.com>97579757-M: Ben Myers <bpm@sgi.com>97589718M: xfs@oss.sgi.com97599719L: xfs@oss.sgi.com97609720W: http://oss.sgi.com/projects/xfs···98229784L: mjpeg-users@lists.sourceforge.net98239785L: linux-media@vger.kernel.org98249786W: http://mjpeg.sourceforge.net/driver-zoran/98259825-T: Mercurial http://linuxtv.org/hg/v4l-dvb97879787+T: hg http://linuxtv.org/hg/v4l-dvb98269788S: Odd Fixes98279789F: drivers/media/pci/zoran/98289790
+6-4
Makefile
···11VERSION = 322PATCHLEVEL = 1433SUBLEVEL = 044-EXTRAVERSION = -rc344+EXTRAVERSION = -rc655NAME = Shuffling Zombie Juror6677# *DOCUMENTATION*···605605ifdef CONFIG_CC_STACKPROTECTOR_REGULAR606606 stackp-flag := -fstack-protector607607 ifeq ($(call cc-option, $(stackp-flag)),)608608- $(warning Cannot use CONFIG_CC_STACKPROTECTOR: \609609- -fstack-protector not supported by compiler))608608+ $(warning Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: \609609+ -fstack-protector not supported by compiler)610610 endif611611-else ifdef CONFIG_CC_STACKPROTECTOR_STRONG611611+else612612+ifdef CONFIG_CC_STACKPROTECTOR_STRONG612613 stackp-flag := -fstack-protector-strong613614 ifeq ($(call cc-option, $(stackp-flag)),)614615 $(warning Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: \···618617else619618 # Force off for distro compilers that enable stack protector by default.620619 stackp-flag := $(call cc-option, -fno-stack-protector)620620+endif621621endif622622KBUILD_CFLAGS += $(stackp-flag)623623
+2-2
arch/arc/mm/cache_arc700.c
···282282#else283283 /* if V-P const for loop, PTAG can be written once outside loop */284284 if (full_page_op)285285- write_aux_reg(ARC_REG_DC_PTAG, paddr);285285+ write_aux_reg(aux_tag, paddr);286286#endif287287288288 while (num_lines-- > 0) {···296296 write_aux_reg(aux_cmd, vaddr);297297 vaddr += L1_CACHE_BYTES;298298#else299299- write_aux_reg(aux, paddr);299299+ write_aux_reg(aux_cmd, paddr);300300 paddr += L1_CACHE_BYTES;301301#endif302302 }
···11/*22 * Copyright (C) 2013 Pavel Machek <pavel@ucw.cz>33- * Copyright 2013 Aaro Koskinen <aaro.koskinen@iki.fi>33+ * Copyright (C) 2013-2014 Aaro Koskinen <aaro.koskinen@iki.fi>44 *55 * This program is free software; you can redistribute it and/or modify66 * it under the terms of the GNU General Public License version 2 (or later) as···13131414/ {1515 model = "Nokia N900";1616- compatible = "nokia,omap3-n900", "ti,omap3";1616+ compatible = "nokia,omap3-n900", "ti,omap3430", "ti,omap3";17171818 cpus {1919 cpu@0 {
···11+/*22+ * Copyright (C) 2012 Florian Vaussard, EPFL Mobots group33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License version 2 as66+ * published by the Free Software Foundation.77+ */88+99+/*1010+ * Tobi expansion board is manufactured by Gumstix Inc.1111+ */1212+1313+/dts-v1/;1414+1515+#include "omap36xx.dtsi"1616+#include "omap3-overo-tobi-common.dtsi"1717+1818+/ {1919+ model = "OMAP36xx/AM37xx/DM37xx Gumstix Overo on Tobi";2020+ compatible = "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,omap36xx", "ti,omap3";2121+};2222+
+22
arch/arm/boot/dts/omap3-overo-tobi.dts
···11+/*22+ * Copyright (C) 2012 Florian Vaussard, EPFL Mobots group33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License version 2 as66+ * published by the Free Software Foundation.77+ */88+99+/*1010+ * Tobi expansion board is manufactured by Gumstix Inc.1111+ */1212+1313+/dts-v1/;1414+1515+#include "omap34xx.dtsi"1616+#include "omap3-overo-tobi-common.dtsi"1717+1818+/ {1919+ model = "OMAP35xx Gumstix Overo on Tobi";2020+ compatible = "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,omap3430", "ti,omap3";2121+};2222+
-3
arch/arm/boot/dts/omap3-overo.dtsi
···99/*1010 * The Gumstix Overo must be combined with an expansion board.1111 */1212-/dts-v1/;1313-1414-#include "omap34xx.dtsi"15121613/ {1714 pwmleds {
···3030 */3131#define UL(x) _AC(x, UL)32323333+/* PAGE_OFFSET - the virtual address of the start of the kernel image */3434+#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)3535+3336#ifdef CONFIG_MMU34373538/*3636- * PAGE_OFFSET - the virtual address of the start of the kernel image3739 * TASK_SIZE - the maximum size of a user space task.3840 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area3941 */4040-#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)4142#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M))4243#define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M)4344···103102104103#ifndef END_MEM105104#define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE)106106-#endif107107-108108-#ifndef PAGE_OFFSET109109-#define PAGE_OFFSET PLAT_PHYS_OFFSET110105#endif111106112107/*
···177177 .long __proc_info_end178178 .size __lookup_processor_type_data, . - __lookup_processor_type_data179179180180+__error_lpae:181181+#ifdef CONFIG_DEBUG_LL182182+ adr r0, str_lpae183183+ bl printascii184184+ b __error185185+str_lpae: .asciz "\nError: Kernel with LPAE support, but CPU does not support LPAE.\n"186186+#else187187+ b __error188188+#endif189189+ .align190190+ENDPROC(__error_lpae)191191+180192__error_p:181193#ifdef CONFIG_DEBUG_LL182194 adr r0, str_p1
+1-1
arch/arm/kernel/head.S
···102102 and r3, r3, #0xf @ extract VMSA support103103 cmp r3, #5 @ long-descriptor translation table format?104104 THUMB( it lo ) @ force fixup-able long branch encoding105105- blo __error_p @ only classic page table format105105+ blo __error_lpae @ only classic page table format106106#endif107107108108#ifndef CONFIG_XIP_KERNEL
···878878 unsigned long cmd,879879 void *v)880880{881881- if (cmd == CPU_PM_EXIT) {881881+ if (cmd == CPU_PM_EXIT &&882882+ __hyp_get_vectors() == hyp_default_vectors) {882883 cpu_init_hyp_mode(NULL);883884 return NOTIFY_OK;884885 }
+10-1
arch/arm/kvm/interrupts.S
···220220 * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are221221 * passed in r0 and r1.222222 *223223+ * A function pointer with a value of 0xffffffff has a special meaning,224224+ * and is used to implement __hyp_get_vectors in the same way as in225225+ * arch/arm/kernel/hyp_stub.S.226226+ *223227 * The calling convention follows the standard AAPCS:224228 * r0 - r3: caller save225229 * r12: caller save···367363host_switch_to_hyp:368364 pop {r0, r1, r2}369365366366+ /* Check for __hyp_get_vectors */367367+ cmp r0, #-1368368+ mrceq p15, 4, r0, c12, c0, 0 @ get HVBAR369369+ beq 1f370370+370371 push {lr}371372 mrs lr, SPSR372373 push {lr}···387378 pop {lr}388379 msr SPSR_csxf, lr389380 pop {lr}390390- eret381381+1: eret391382392383guest_trap:393384 load_vcpu @ Load VCPU pointer to r0
···623623624624/* Clock control for DPLL outputs */625625626626-/**627627- * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate628628- * @clk: DPLL output struct clk629629- *630630- * Using parent clock DPLL data, look up DPLL state. If locked, set our631631- * rate to the dpll_clk * 2; otherwise, just use dpll_clk.632632- */633633-unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,634634- unsigned long parent_rate)626626+/* Find the parent DPLL for the given clkoutx2 clock */627627+static struct clk_hw_omap *omap3_find_clkoutx2_dpll(struct clk_hw *hw)635628{636636- const struct dpll_data *dd;637637- unsigned long rate;638638- u32 v;639629 struct clk_hw_omap *pclk = NULL;640630 struct clk *parent;641641-642642- if (!parent_rate)643643- return 0;644631645632 /* Walk up the parents of clk, looking for a DPLL */646633 do {···643656 /* clk does not have a DPLL as a parent? error in the clock data */644657 if (!pclk) {645658 WARN_ON(1);646646- return 0;659659+ return NULL;647660 }661661+662662+ return pclk;663663+}664664+665665+/**666666+ * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate667667+ * @clk: DPLL output struct clk668668+ *669669+ * Using parent clock DPLL data, look up DPLL state. If locked, set our670670+ * rate to the dpll_clk * 2; otherwise, just use dpll_clk.671671+ */672672+unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,673673+ unsigned long parent_rate)674674+{675675+ const struct dpll_data *dd;676676+ unsigned long rate;677677+ u32 v;678678+ struct clk_hw_omap *pclk = NULL;679679+680680+ if (!parent_rate)681681+ return 0;682682+683683+ pclk = omap3_find_clkoutx2_dpll(hw);684684+685685+ if (!pclk)686686+ return 0;648687649688 dd = pclk->dpll_data;650689···683670 else684671 rate = parent_rate * 2;685672 return rate;673673+}674674+675675+int omap3_clkoutx2_set_rate(struct clk_hw *hw, unsigned long rate,676676+ unsigned long parent_rate)677677+{678678+ return 0;679679+}680680+681681+long omap3_clkoutx2_round_rate(struct clk_hw *hw, unsigned long rate,682682+ unsigned long *prate)683683+{684684+ const struct dpll_data *dd;685685+ u32 v;686686+ struct clk_hw_omap *pclk = NULL;687687+688688+ if (!*prate)689689+ return 0;690690+691691+ pclk = omap3_find_clkoutx2_dpll(hw);692692+693693+ if (!pclk)694694+ return 0;695695+696696+ dd = pclk->dpll_data;697697+698698+ /* TYPE J does not have a clkoutx2 */699699+ if (dd->flags & DPLL_J_TYPE) {700700+ *prate = __clk_round_rate(__clk_get_parent(pclk->hw.clk), rate);701701+ return *prate;702702+ }703703+704704+ WARN_ON(!dd->enable_mask);705705+706706+ v = omap2_clk_readl(pclk, dd->control_reg) & dd->enable_mask;707707+ v >>= __ffs(dd->enable_mask);708708+709709+ /* If in bypass, the rate is fixed to the bypass rate*/710710+ if (v != OMAP3XXX_EN_DPLL_LOCKED)711711+ return *prate;712712+713713+ if (__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT) {714714+ unsigned long best_parent;715715+716716+ best_parent = (rate / 2);717717+ *prate = __clk_round_rate(__clk_get_parent(hw->clk),718718+ best_parent);719719+ }720720+721721+ return *prate * 2;686722}687723688724/* OMAP3/4 non-CORE DPLL clkops */
···48484949 frame->sp = fp + 0x10;5050 frame->fp = *(unsigned long *)(fp);5151- frame->pc = *(unsigned long *)(fp + 8);5151+ /*5252+ * -4 here because we care about the PC at time of bl,5353+ * not where the return will go.5454+ */5555+ frame->pc = *(unsigned long *)(fp + 8) - 4;52565357 return 0;5458}
+25-2
arch/arm64/kvm/hyp.S
···694694695695 .align 2696696697697+/*698698+ * u64 kvm_call_hyp(void *hypfn, ...);699699+ *700700+ * This is not really a variadic function in the classic C-way and care must701701+ * be taken when calling this to ensure parameters are passed in registers702702+ * only, since the stack will change between the caller and the callee.703703+ *704704+ * Call the function with the first argument containing a pointer to the705705+ * function you wish to call in Hyp mode, and subsequent arguments will be706706+ * passed as x0, x1, and x2 (a maximum of 3 arguments in addition to the707707+ * function pointer can be passed). The function being called must be mapped708708+ * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are709709+ * passed in r0 and r1.710710+ *711711+ * A function pointer with a value of 0 has a special meaning, and is712712+ * used to implement __hyp_get_vectors in the same way as in713713+ * arch/arm64/kernel/hyp_stub.S.714714+ */697715ENTRY(kvm_call_hyp)698716 hvc #0699717 ret···755737 pop x2, x3756738 pop x0, x1757739758758- push lr, xzr740740+ /* Check for __hyp_get_vectors */741741+ cbnz x0, 1f742742+ mrs x0, vbar_el2743743+ b 2f744744+745745+1: push lr, xzr759746760747 /*761748 * Compute the function address in EL2, and shuffle the parameters.···773750 blr lr774751775752 pop lr, xzr776776- eret753753+2: eret777754778755el1_trap:779756 /*
···200200201201 /*202202 * We can't access below the stack pointer in the 32bit ABI and203203- * can access 288 bytes in the 64bit ABI203203+ * can access 288 bytes in the 64bit big-endian ABI,204204+ * or 512 bytes with the new ELFv2 little-endian ABI.204205 */205206 if (!is_32bit_task())206206- usp -= 288;207207+ usp -= USER_REDZONE_SIZE;207208208209 return (void __user *) (usp - len);209210}
+19-2
arch/powerpc/include/asm/eeh.h
···172172};173173174174extern struct eeh_ops *eeh_ops;175175-extern int eeh_subsystem_enabled;175175+extern bool eeh_subsystem_enabled;176176extern raw_spinlock_t confirm_error_lock;177177extern int eeh_probe_mode;178178+179179+static inline bool eeh_enabled(void)180180+{181181+ return eeh_subsystem_enabled;182182+}183183+184184+static inline void eeh_set_enable(bool mode)185185+{186186+ eeh_subsystem_enabled = mode;187187+}178188179189#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */180190#define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */···256246 * If this macro yields TRUE, the caller relays to eeh_check_failure()257247 * which does further tests out of line.258248 */259259-#define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_subsystem_enabled)249249+#define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_enabled())260250261251/*262252 * Reads from a device which has been isolated by EEH will return···266256#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8))267257268258#else /* !CONFIG_EEH */259259+260260+static inline bool eeh_enabled(void)261261+{262262+ return false;263263+}264264+265265+static inline void eeh_set_enable(bool mode) { }269266270267static inline int eeh_init(void)271268{
···28282929#ifdef __powerpc64__30303131+/*3232+ * Size of redzone that userspace is allowed to use below the stack3333+ * pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in3434+ * the new ELFv2 little-endian ABI, so we allow the larger amount.3535+ *3636+ * For kernel code we allow a 288-byte redzone, in order to conserve3737+ * kernel stack space; gcc currently only uses 288 bytes, and will3838+ * hopefully allow explicit control of the redzone size in future.3939+ */4040+#define USER_REDZONE_SIZE 5124141+#define KERNEL_REDZONE_SIZE 2884242+3143#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */3244#define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */3345#define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265)3446#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \3535- STACK_FRAME_OVERHEAD + 288)4747+ STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)3648#define STACK_FRAME_MARKER 1237493850/* Size of dummy stack frame allocated when calling signal handler. */···53415442#else /* __powerpc64__ */55434444+#define USER_REDZONE_SIZE 04545+#define KERNEL_REDZONE_SIZE 05646#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */5747#define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */5848#define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773)
+3-3
arch/powerpc/include/asm/vdso.h
···44#ifdef __KERNEL__5566/* Default link addresses for the vDSOs */77-#define VDSO32_LBASE 0x10000088-#define VDSO64_LBASE 0x10000077+#define VDSO32_LBASE 0x088+#define VDSO64_LBASE 0x0991010/* Default map addresses for 32bit vDSO */1111-#define VDSO32_MBASE VDSO32_LBASE1111+#define VDSO32_MBASE 0x10000012121313#define VDSO_VERSION_STRING LINUX_2.6.151414
···2828#include <linux/pci.h>2929#include <linux/proc_fs.h>3030#include <linux/rbtree.h>3131+#include <linux/reboot.h>3132#include <linux/seq_file.h>3233#include <linux/spinlock.h>3334#include <linux/export.h>···9089/* Platform dependent EEH operations */9190struct eeh_ops *eeh_ops = NULL;92919393-int eeh_subsystem_enabled;9292+bool eeh_subsystem_enabled = false;9493EXPORT_SYMBOL(eeh_subsystem_enabled);95949695/*···365364366365 eeh_stats.total_mmio_ffs++;367366368368- if (!eeh_subsystem_enabled)367367+ if (!eeh_enabled())369368 return 0;370369371370 if (!edev) {···748747 return -EEXIST;749748}750749750750+static int eeh_reboot_notifier(struct notifier_block *nb,751751+ unsigned long action, void *unused)752752+{753753+ eeh_set_enable(false);754754+ return NOTIFY_DONE;755755+}756756+757757+static struct notifier_block eeh_reboot_nb = {758758+ .notifier_call = eeh_reboot_notifier,759759+};760760+751761/**752762 * eeh_init - EEH initialization753763 *···789777 */790778 if (machine_is(powernv) && cnt++ <= 0)791779 return ret;780780+781781+ /* Register reboot notifier */782782+ ret = register_reboot_notifier(&eeh_reboot_nb);783783+ if (ret) {784784+ pr_warn("%s: Failed to register notifier (%d)\n",785785+ __func__, ret);786786+ return ret;787787+ }792788793789 /* call platform initialization function */794790 if (!eeh_ops) {···842822 return ret;843823 }844824845845- if (eeh_subsystem_enabled)825825+ if (eeh_enabled())846826 pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n");847827 else848828 pr_warning("EEH: No capable adapters found\n");···917897 struct device_node *dn;918898 struct eeh_dev *edev;919899920920- if (!dev || !eeh_subsystem_enabled)900900+ if (!dev || !eeh_enabled())921901 return;922902923903 pr_debug("EEH: Adding device %s\n", pci_name(dev));···10251005{10261006 struct eeh_dev *edev;1027100710281028- if (!dev || !eeh_subsystem_enabled)10081008+ if (!dev || !eeh_enabled())10291009 return;10301010 edev = pci_dev_to_eeh_dev(dev);10311011···1065104510661046static int proc_eeh_show(struct seq_file *m, void *v)10671047{10681068- if (0 == eeh_subsystem_enabled) {10481048+ if (!eeh_enabled()) {10691049 seq_printf(m, "EEH Subsystem is globally disabled\n");10701050 seq_printf(m, "eeh_total_mmio_ffs=%llu\n", eeh_stats.total_mmio_ffs);10711051 } else {
+1
arch/powerpc/kernel/ftrace.c
···7474 */7575static int test_24bit_addr(unsigned long ip, unsigned long addr)7676{7777+ addr = ppc_function_entry((void *)addr);77787879 /* use the create_branch to verify that this offset can be branched */7980 return create_branch((unsigned int *)ip, addr, 0);
···10481048 flush_altivec_to_thread(src);10491049 flush_vsx_to_thread(src);10501050 flush_spe_to_thread(src);10511051+ /*10521052+ * Flush TM state out so we can copy it. __switch_to_tm() does this10531053+ * flush but it removes the checkpointed state from the current CPU and10541054+ * transitions the CPU out of TM mode. Hence we need to call10551055+ * tm_recheckpoint_new_task() (on the same task) to restore the10561056+ * checkpointed state back and the TM mode.10571057+ */10581058+ __switch_to_tm(src);10591059+ tm_recheckpoint_new_task(src);1051106010521061 *dst = *src;10531062
···44444545 /* We simply send special EEH event */4646 if ((changed_evts & OPAL_EVENT_PCI_ERROR) &&4747- (events & OPAL_EVENT_PCI_ERROR))4747+ (events & OPAL_EVENT_PCI_ERROR) &&4848+ eeh_enabled())4849 eeh_send_failure_event(NULL);49505051 return 0;···113112DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get,114113 ioda_eeh_inbB_dbgfs_set, "0x%llx\n");115114#endif /* CONFIG_DEBUG_FS */115115+116116117117/**118118 * ioda_eeh_post_init - Chip dependent post initialization···222220 return ret;223221}224222223223+static void ioda_eeh_phb_diag(struct pci_controller *hose)224224+{225225+ struct pnv_phb *phb = hose->private_data;226226+ long rc;227227+228228+ rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,229229+ PNV_PCI_DIAG_BUF_SIZE);230230+ if (rc != OPAL_SUCCESS) {231231+ pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",232232+ __func__, hose->global_number, rc);233233+ return;234234+ }235235+236236+ pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);237237+}238238+225239/**226240 * ioda_eeh_get_state - Retrieve the state of PE227241 * @pe: EEH PE···289271 result |= EEH_STATE_DMA_ACTIVE;290272 result |= EEH_STATE_MMIO_ENABLED;291273 result |= EEH_STATE_DMA_ENABLED;274274+ } else if (!(pe->state & EEH_PE_ISOLATED)) {275275+ eeh_pe_state_mark(pe, EEH_PE_ISOLATED);276276+ ioda_eeh_phb_diag(hose);292277 }293278294279 return result;···333312 pr_warning("%s: Unexpected EEH status 0x%x "334313 "on PHB#%x-PE#%x\n",335314 __func__, fstate, hose->global_number, pe_no);315315+ }316316+317317+ /* Dump PHB diag-data for frozen PE */318318+ if (result != EEH_STATE_NOT_SUPPORT &&319319+ (result & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) !=320320+ (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE) &&321321+ !(pe->state & EEH_PE_ISOLATED)) {322322+ eeh_pe_state_mark(pe, EEH_PE_ISOLATED);323323+ ioda_eeh_phb_diag(hose);336324 }337325338326 return result;···519489static int ioda_eeh_reset(struct eeh_pe *pe, int option)520490{521491 struct pci_controller *hose = pe->phb;522522- struct eeh_dev *edev;523523- struct pci_dev *dev;492492+ struct pci_bus *bus;524493 int ret;525494526495 /*···548519 if (pe->type & EEH_PE_PHB) {549520 ret = ioda_eeh_phb_reset(hose, option);550521 } else {551551- if (pe->type & EEH_PE_DEVICE) {552552- /*553553- * If it's device PE, we didn't refer to the parent554554- * PCI bus yet. So we have to figure it out indirectly.555555- */556556- edev = list_first_entry(&pe->edevs,557557- struct eeh_dev, list);558558- dev = eeh_dev_to_pci_dev(edev);559559- dev = dev->bus->self;560560- } else {561561- /*562562- * If it's bus PE, the parent PCI bus is already there563563- * and just pick it up.564564- */565565- dev = pe->bus->self;566566- }567567-568568- /*569569- * Do reset based on the fact that the direct upstream bridge570570- * is root bridge (port) or not.571571- */572572- if (dev->bus->number == 0)522522+ bus = eeh_pe_bus_get(pe);523523+ if (pci_is_root_bus(bus))573524 ret = ioda_eeh_root_reset(hose, option);574525 else575575- ret = ioda_eeh_bridge_reset(hose, dev, option);526526+ ret = ioda_eeh_bridge_reset(hose, bus->self, option);576527 }577528578529 return ret;579579-}580580-581581-/**582582- * ioda_eeh_get_log - Retrieve error log583583- * @pe: EEH PE584584- * @severity: Severity level of the log585585- * @drv_log: buffer to store the log586586- * @len: space of the log buffer587587- *588588- * The function is used to retrieve error log from P7IOC.589589- */590590-static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,591591- char *drv_log, unsigned long len)592592-{593593- s64 ret;594594- unsigned long flags;595595- struct pci_controller *hose = pe->phb;596596- struct pnv_phb *phb = hose->private_data;597597-598598- spin_lock_irqsave(&phb->lock, flags);599599-600600- ret = opal_pci_get_phb_diag_data2(phb->opal_id,601601- phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE);602602- if (ret) {603603- spin_unlock_irqrestore(&phb->lock, flags);604604- pr_warning("%s: Can't get log for PHB#%x-PE#%x (%lld)\n",605605- __func__, hose->global_number, pe->addr, ret);606606- return -EIO;607607- }608608-609609- /* The PHB diag-data is always indicative */610610- pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);611611-612612- spin_unlock_irqrestore(&phb->lock, flags);613613-614614- return 0;615530}616531617532/**···637664 pr_warning("%s: Invalid type of HUB#%llx diag-data (%d)\n",638665 __func__, phb->hub_id, data->type);639666 }640640-}641641-642642-static void ioda_eeh_phb_diag(struct pci_controller *hose)643643-{644644- struct pnv_phb *phb = hose->private_data;645645- long rc;646646-647647- rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,648648- PNV_PCI_DIAG_BUF_SIZE);649649- if (rc != OPAL_SUCCESS) {650650- pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",651651- __func__, hose->global_number, rc);652652- return;653653- }654654-655655- pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);656667}657668658669static int ioda_eeh_get_phb_pe(struct pci_controller *hose,···812855 }813856814857 /*858858+ * EEH core will try recover from fenced PHB or859859+ * frozen PE. In the time for frozen PE, EEH core860860+ * enable IO path for that before collecting logs,861861+ * but it ruins the site. So we have to dump the862862+ * log in advance here.863863+ */864864+ if ((ret == EEH_NEXT_ERR_FROZEN_PE ||865865+ ret == EEH_NEXT_ERR_FENCED_PHB) &&866866+ !((*pe)->state & EEH_PE_ISOLATED)) {867867+ eeh_pe_state_mark(*pe, EEH_PE_ISOLATED);868868+ ioda_eeh_phb_diag(hose);869869+ }870870+871871+ /*815872 * If we have no errors on the specific PHB or only816873 * informative error there, we continue poking it.817874 * Otherwise, we need actions to be taken by upper···843872 .set_option = ioda_eeh_set_option,844873 .get_state = ioda_eeh_get_state,845874 .reset = ioda_eeh_reset,846846- .get_log = ioda_eeh_get_log,847875 .configure_bridge = ioda_eeh_configure_bridge,848876 .next_error = ioda_eeh_next_error849877};
+1-1
arch/powerpc/platforms/powernv/eeh-powernv.c
···145145 * Enable EEH explicitly so that we will do EEH check146146 * while accessing I/O stuff147147 */148148- eeh_subsystem_enabled = 1;148148+ eeh_set_enable(true);149149150150 /* Save memory bars */151151 eeh_save_bars(edev);
+12-9
arch/powerpc/platforms/powernv/opal-xscom.c
···7171 }7272}73737474-static u64 opal_scom_unmangle(u64 reg)7474+static u64 opal_scom_unmangle(u64 addr)7575{7676 /*7777 * XSCOM indirect addresses have the top bit set. Additionally7878- * the reset of the top 3 nibbles is always 0.7878+ * the rest of the top 3 nibbles is always 0.7979 *8080 * Because the debugfs interface uses signed offsets and shifts8181 * the address left by 3, we basically cannot use the top 4 bits···8686 * conversion here. To leave room for further xscom address8787 * expansion, we only clear out the top byte8888 *8989+ * For in-kernel use, we also support the real indirect bit, so9090+ * we test for any of the top 5 bits9191+ *8992 */9090- if (reg & (1ull << 59))9191- reg = (reg & ~(0xffull << 56)) | (1ull << 63);9292- return reg;9393+ if (addr & (0x1full << 59))9494+ addr = (addr & ~(0xffull << 56)) | (1ull << 63);9595+ return addr;9396}94979598static int opal_scom_read(scom_map_t map, u64 reg, u64 *value)···10198 int64_t rc;10299 __be64 v;103100104104- reg = opal_scom_unmangle(reg);105105- rc = opal_xscom_read(m->chip, m->addr + reg, (__be64 *)__pa(&v));101101+ reg = opal_scom_unmangle(m->addr + reg);102102+ rc = opal_xscom_read(m->chip, reg, (__be64 *)__pa(&v));106103 *value = be64_to_cpu(v);107104 return opal_xscom_err_xlate(rc);108105}···112109 struct opal_scom_map *m = map;113110 int64_t rc;114111115115- reg = opal_scom_unmangle(reg);116116- rc = opal_xscom_write(m->chip, m->addr + reg, value);112112+ reg = opal_scom_unmangle(m->addr + reg);113113+ rc = opal_xscom_write(m->chip, reg, value);117114 return opal_xscom_err_xlate(rc);118115}119116
···112112 unsigned long ccr, flags;113113114114 jump_to_uncached();115115- ccr = __raw_readl(CCR);115115+ ccr = __raw_readl(SH_CCR);116116117117 /*118118 * At this point we don't know whether the cache is enabled or not - a···189189190190 l2_cache_init();191191192192- __raw_writel(flags, CCR);192192+ __raw_writel(flags, SH_CCR);193193 back_to_cached();194194}195195#else
···134134135135 /* If there are too many pages then just blow the cache */136136 if (((end - begin) >> PAGE_SHIFT) >= MAX_OCACHE_PAGES) {137137- __raw_writel(__raw_readl(CCR) | CCR_OCACHE_INVALIDATE, CCR);137137+ __raw_writel(__raw_readl(SH_CCR) | CCR_OCACHE_INVALIDATE,138138+ SH_CCR);138139 } else {139140 for (v = begin; v < end; v += L1_CACHE_BYTES)140141 sh2a_invalidate_line(CACHE_OC_ADDRESS_ARRAY, v);···168167 /* I-Cache invalidate */169168 /* If there are too many pages then just blow the cache */170169 if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) {171171- __raw_writel(__raw_readl(CCR) | CCR_ICACHE_INVALIDATE, CCR);170170+ __raw_writel(__raw_readl(SH_CCR) | CCR_ICACHE_INVALIDATE,171171+ SH_CCR);172172 } else {173173 for (v = start; v < end; v += L1_CACHE_BYTES)174174 sh2a_invalidate_line(CACHE_IC_ADDRESS_ARRAY, v);
+2-2
arch/sh/mm/cache-sh4.c
···133133 jump_to_uncached();134134135135 /* Flush I-cache */136136- ccr = __raw_readl(CCR);136136+ ccr = __raw_readl(SH_CCR);137137 ccr |= CCR_CACHE_ICI;138138- __raw_writel(ccr, CCR);138138+ __raw_writel(ccr, SH_CCR);139139140140 /*141141 * back_to_cached() will take care of the barrier for us, don't add
+2-2
arch/sh/mm/cache-shx3.c
···1919{2020 unsigned int ccr;21212222- ccr = __raw_readl(CCR);2222+ ccr = __raw_readl(SH_CCR);23232424 /*2525 * If we've got cache aliases, resolve them in hardware.···4040 ccr |= CCR_CACHE_IBE;4141#endif42424343- writel_uncached(ccr, CCR);4343+ writel_uncached(ccr, SH_CCR);4444}
···6666extern void tsc_restore_sched_clock_state(void);67676868/* MSR based TSC calibration for Intel Atom SoC platforms */6969-int try_msr_calibrate_tsc(unsigned long *fast_calibrate);6969+unsigned long try_msr_calibrate_tsc(void);70707171#endif /* _ASM_X86_TSC_H */
+9-2
arch/x86/kernel/cpu/perf_event.c
···11921192 for (i = 0; i < cpuc->n_events; i++) {11931193 if (event == cpuc->event_list[i]) {1194119411951195+ if (i >= cpuc->n_events - cpuc->n_added)11961196+ --cpuc->n_added;11971197+11951198 if (x86_pmu.put_event_constraints)11961199 x86_pmu.put_event_constraints(cpuc, event);11971200···1524152115251522 pr_cont("%s PMU driver.\n", x86_pmu.name);1526152315241524+ x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */15251525+15271526 for (quirk = x86_pmu.quirks; quirk; quirk = quirk->next)15281527 quirk->func();15291528···15391534 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1,15401535 0, x86_pmu.num_counters, 0, 0);1541153615421542- x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */15431537 x86_pmu_format_group.attrs = x86_pmu.format_attrs;1544153815451539 if (x86_pmu.event_attrs)···18241820 if (ret)18251821 return ret;1826182218231823+ if (x86_pmu.attr_rdpmc_broken)18241824+ return -ENOTSUPP;18251825+18271826 if (!!val != !!x86_pmu.attr_rdpmc) {18281827 x86_pmu.attr_rdpmc = !!val;18291829- smp_call_function(change_rdpmc, (void *)val, 1);18281828+ on_each_cpu(change_rdpmc, (void *)val, 1);18301829 }1831183018321831 return count;
+1
arch/x86/kernel/cpu/perf_event.h
···409409 /*410410 * sysfs attrs411411 */412412+ int attr_rdpmc_broken;412413 int attr_rdpmc;413414 struct attribute **format_attrs;414415 struct attribute **event_attrs;
+3-8
arch/x86/kernel/cpu/perf_event_intel.c
···13611361 intel_pmu_disable_all();13621362 handled = intel_pmu_drain_bts_buffer();13631363 status = intel_pmu_get_status();13641364- if (!status) {13651365- intel_pmu_enable_all(0);13661366- return handled;13671367- }13641364+ if (!status)13651365+ goto done;1368136613691367 loops = 0;13701368again:···23082310 if (version > 1)23092311 x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3);2310231223112311- /*23122312- * v2 and above have a perf capabilities MSR23132313- */23142314- if (version > 1) {23132313+ if (boot_cpu_has(X86_FEATURE_PDCM)) {23152314 u64 capabilities;2316231523172316 rdmsrl(MSR_IA32_PERF_CAPABILITIES, capabilities);
···231231232232};233233234234+static __init void p6_pmu_rdpmc_quirk(void)235235+{236236+ if (boot_cpu_data.x86_mask < 9) {237237+ /*238238+ * PPro erratum 26; fixed in stepping 9 and above.239239+ */240240+ pr_warn("Userspace RDPMC support disabled due to a CPU erratum\n");241241+ x86_pmu.attr_rdpmc_broken = 1;242242+ x86_pmu.attr_rdpmc = 0;243243+ }244244+}245245+234246__init int p6_pmu_init(void)235247{248248+ x86_pmu = p6_pmu;249249+236250 switch (boot_cpu_data.x86_model) {237237- case 1:238238- case 3: /* Pentium Pro */239239- case 5:240240- case 6: /* Pentium II */241241- case 7:242242- case 8:243243- case 11: /* Pentium III */244244- case 9:245245- case 13:246246- /* Pentium M */251251+ case 1: /* Pentium Pro */252252+ x86_add_quirk(p6_pmu_rdpmc_quirk);247253 break;254254+255255+ case 3: /* Pentium II - Klamath */256256+ case 5: /* Pentium II - Deschutes */257257+ case 6: /* Pentium II - Mendocino */258258+ break;259259+260260+ case 7: /* Pentium III - Katmai */261261+ case 8: /* Pentium III - Coppermine */262262+ case 10: /* Pentium III Xeon */263263+ case 11: /* Pentium III - Tualatin */264264+ break;265265+266266+ case 9: /* Pentium M - Banias */267267+ case 13: /* Pentium M - Dothan */268268+ break;269269+248270 default:249249- pr_cont("unsupported p6 CPU model %d ",250250- boot_cpu_data.x86_model);271271+ pr_cont("unsupported p6 CPU model %d ", boot_cpu_data.x86_model);251272 return -ENODEV;252273 }253274254254- x86_pmu = p6_pmu;255255-256275 memcpy(hw_cache_event_ids, p6_hw_cache_event_ids,257276 sizeof(hw_cache_event_ids));258258-259277260278 return 0;261279}
+6-1
arch/x86/kernel/head_32.S
···544544 /* This is global to keep gas from relaxing the jumps */545545ENTRY(early_idt_handler)546546 cld547547+548548+ cmpl $2,(%esp) # X86_TRAP_NMI549549+ je is_nmi # Ignore NMI550550+547551 cmpl $2,%ss:early_recursion_flag548552 je hlt_loop549553 incl %ss:early_recursion_flag···598594 pop %edx599595 pop %ecx600596 pop %eax601601- addl $8,%esp /* drop vector number and error code */602597 decl %ss:early_recursion_flag598598+is_nmi:599599+ addl $8,%esp /* drop vector number and error code */603600 iret604601ENDPROC(early_idt_handler)605602
+5-1
arch/x86/kernel/head_64.S
···343343ENTRY(early_idt_handler)344344 cld345345346346+ cmpl $2,(%rsp) # X86_TRAP_NMI347347+ je is_nmi # Ignore NMI348348+346349 cmpl $2,early_recursion_flag(%rip)347350 jz 1f348351 incl early_recursion_flag(%rip)···408405 popq %rdx409406 popq %rcx410407 popq %rax411411- addq $16,%rsp # drop vector number and error code412408 decl early_recursion_flag(%rip)409409+is_nmi:410410+ addq $16,%rsp # drop vector number and error code413411 INTERRUPT_RETURN414412ENDPROC(early_idt_handler)415413
···100100 flag |= __GFP_ZERO;101101again:102102 page = NULL;103103- if (!(flag & GFP_ATOMIC))103103+ /* CMA can be used only in the context which permits sleeping */104104+ if (flag & __GFP_WAIT)104105 page = dma_alloc_from_contiguous(dev, count, get_order(size));106106+ /* fallback */105107 if (!page)106108 page = alloc_pages_node(dev_to_node(dev), flag, get_order(size));107109 if (!page)
+2-8
arch/x86/kernel/setup.c
···12391239 register_refined_jiffies(CLOCK_TICK_RATE);1240124012411241#ifdef CONFIG_EFI12421242- /* Once setup is done above, unmap the EFI memory map on12431243- * mismatched firmware/kernel archtectures since there is no12441244- * support for runtime services.12451245- */12461246- if (efi_enabled(EFI_BOOT) && !efi_is_native()) {12471247- pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");12481248- efi_unmap_memmap();12491249- }12421242+ if (efi_enabled(EFI_BOOT))12431243+ efi_apply_memmap_quirks();12501244#endif12511245}12521246
+2-5
arch/x86/kernel/tsc.c
···653653654654 /* Calibrate TSC using MSR for Intel Atom SoCs */655655 local_irq_save(flags);656656- i = try_msr_calibrate_tsc(&fast_calibrate);656656+ fast_calibrate = try_msr_calibrate_tsc();657657 local_irq_restore(flags);658658- if (i >= 0) {659659- if (i == 0)660660- pr_warn("Fast TSC calibration using MSR failed\n");658658+ if (fast_calibrate)661659 return fast_calibrate;662662- }663660664661 local_irq_save(flags);665662 fast_calibrate = quick_pit_calibrate();
+15-15
arch/x86/kernel/tsc_msr.c
···5353 /* TNG */5454 { 6, 0x4a, 1, { 0, FREQ_100, FREQ_133, 0, 0, 0, 0, 0 } },5555 /* VLV2 */5656- { 6, 0x37, 1, { 0, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } },5656+ { 6, 0x37, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } },5757 /* ANN */5858 { 6, 0x5a, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_100, 0, 0, 0, 0 } },5959};···77777878/*7979 * Do MSR calibration only for known/supported CPUs.8080- * Return values:8181- * -1: CPU is unknown/unsupported for MSR based calibration8282- * 0: CPU is known/supported, but calibration failed8383- * 1: CPU is known/supported, and calibration succeeded8080+ *8181+ * Returns the calibration value or 0 if MSR calibration failed.8482 */8585-int try_msr_calibrate_tsc(unsigned long *fast_calibrate)8383+unsigned long try_msr_calibrate_tsc(void)8684{8787- int cpu_index;8885 u32 lo, hi, ratio, freq_id, freq;8686+ unsigned long res;8787+ int cpu_index;89889089 cpu_index = match_cpu(boot_cpu_data.x86, boot_cpu_data.x86_model);9190 if (cpu_index < 0)9292- return -1;9393-9494- *fast_calibrate = 0;9191+ return 0;95929693 if (freq_desc_tables[cpu_index].msr_plat) {9794 rdmsr(MSR_PLATFORM_INFO, lo, hi);···100103 pr_info("Maximum core-clock to bus-clock ratio: 0x%x\n", ratio);101104102105 if (!ratio)103103- return 0;106106+ goto fail;104107105108 /* Get FSB FREQ ID */106109 rdmsr(MSR_FSB_FREQ, lo, hi);···109112 pr_info("Resolved frequency ID: %u, frequency: %u KHz\n",110113 freq_id, freq);111114 if (!freq)112112- return 0;115115+ goto fail;113116114117 /* TSC frequency = maximum resolved freq * maximum resolved bus ratio */115115- *fast_calibrate = freq * ratio;116116- pr_info("TSC runs at %lu KHz\n", *fast_calibrate);118118+ res = freq * ratio;119119+ pr_info("TSC runs at %lu KHz\n", res);117120118121#ifdef CONFIG_X86_LOCAL_APIC119122 lapic_timer_frequency = (freq * 1000) / HZ;120123 pr_info("lapic_timer_frequency = %d\n", lapic_timer_frequency);121124#endif125125+ return res;122126123123- return 1;127127+fail:128128+ pr_warn("Fast TSC calibration using MSR failed\n");129129+ return 0;124130}
···61866186 frag->len -= len;61876187 }6188618861896189- if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) {61896189+ if (vcpu->mmio_cur_fragment >= vcpu->mmio_nr_fragments) {61906190 vcpu->mmio_needed = 0;6191619161926192 /* FIXME: return into emulator if single-stepping. */
+33-14
arch/x86/mm/fault.c
···10201020 * This routine handles page faults. It determines the address,10211021 * and the problem, and then passes it off to one of the appropriate10221022 * routines.10231023+ *10241024+ * This function must have noinline because both callers10251025+ * {,trace_}do_page_fault() have notrace on. Having this an actual function10261026+ * guarantees there's a function trace entry.10231027 */10241024-static void __kprobes10251025-__do_page_fault(struct pt_regs *regs, unsigned long error_code)10281028+static void __kprobes noinline10291029+__do_page_fault(struct pt_regs *regs, unsigned long error_code,10301030+ unsigned long address)10261031{10271032 struct vm_area_struct *vma;10281033 struct task_struct *tsk;10291029- unsigned long address;10301034 struct mm_struct *mm;10311035 int fault;10321036 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;1033103710341038 tsk = current;10351039 mm = tsk->mm;10361036-10371037- /* Get the faulting address: */10381038- address = read_cr2();1039104010401041 /*10411042 * Detect and handle instructions that would cause a page fault for···12491248 up_read(&mm->mmap_sem);12501249}1251125012521252-dotraplinkage void __kprobes12511251+dotraplinkage void __kprobes notrace12531252do_page_fault(struct pt_regs *regs, unsigned long error_code)12541253{12541254+ unsigned long address = read_cr2(); /* Get the faulting address */12551255 enum ctx_state prev_state;1256125612571257+ /*12581258+ * We must have this function tagged with __kprobes, notrace and call12591259+ * read_cr2() before calling anything else. To avoid calling any kind12601260+ * of tracing machinery before we've observed the CR2 value.12611261+ *12621262+ * exception_{enter,exit}() contain all sorts of tracepoints.12631263+ */12641264+12571265 prev_state = exception_enter();12581258- __do_page_fault(regs, error_code);12661266+ __do_page_fault(regs, error_code, address);12591267 exception_exit(prev_state);12601268}1261126912621262-static void trace_page_fault_entries(struct pt_regs *regs,12701270+#ifdef CONFIG_TRACING12711271+static void trace_page_fault_entries(unsigned long address, struct pt_regs *regs,12631272 unsigned long error_code)12641273{12651274 if (user_mode(regs))12661266- trace_page_fault_user(read_cr2(), regs, error_code);12751275+ trace_page_fault_user(address, regs, error_code);12671276 else12681268- trace_page_fault_kernel(read_cr2(), regs, error_code);12771277+ trace_page_fault_kernel(address, regs, error_code);12691278}1270127912711271-dotraplinkage void __kprobes12801280+dotraplinkage void __kprobes notrace12721281trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)12731282{12831283+ /*12841284+ * The exception_enter and tracepoint processing could12851285+ * trigger another page faults (user space callchain12861286+ * reading) and destroy the original cr2 value, so read12871287+ * the faulting address now.12881288+ */12891289+ unsigned long address = read_cr2();12741290 enum ctx_state prev_state;1275129112761292 prev_state = exception_enter();12771277- trace_page_fault_entries(regs, error_code);12781278- __do_page_fault(regs, error_code);12931293+ trace_page_fault_entries(address, regs, error_code);12941294+ __do_page_fault(regs, error_code, address);12791295 exception_exit(prev_state);12801296}12971297+#endif /* CONFIG_TRACING */
+20
arch/x86/platform/efi/efi.c
···5252#include <asm/tlbflush.h>5353#include <asm/x86_init.h>5454#include <asm/rtc.h>5555+#include <asm/uv/uv.h>55565657#define EFI_DEBUG5758···12111210 return 0;12121211}12131212early_param("efi", parse_efi_cmdline);12131213+12141214+void __init efi_apply_memmap_quirks(void)12151215+{12161216+ /*12171217+ * Once setup is done earlier, unmap the EFI memory map on mismatched12181218+ * firmware/kernel architectures since there is no support for runtime12191219+ * services.12201220+ */12211221+ if (!efi_is_native()) {12221222+ pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");12231223+ efi_unmap_memmap();12241224+ }12251225+12261226+ /*12271227+ * UV doesn't support the new EFI pagetable mapping yet.12281228+ */12291229+ if (is_uv_system())12301230+ set_bit(EFI_OLD_MEMMAP, &x86_efi_facility);12311231+}
+1-2
arch/xtensa/Kconfig
···2020 select HAVE_FUNCTION_TRACER2121 select HAVE_IRQ_TIME_ACCOUNTING2222 select HAVE_PERF_EVENTS2323+ select COMMON_CLK2324 help2425 Xtensa processors are 32-bit RISC machines designed by Tensilica2526 primarily for embedded systems. These processors are both···8180config XTENSA_VARIANT_FSF8281 bool "fsf - default (not generic) configuration"8382 select MMU8484- select HAVE_XTENSA_GPIO3285838684config XTENSA_VARIANT_DC232B8785 bool "dc232b - Diamond 232L Standard Core Rev.B (LE)"···135135config SMP136136 bool "Enable Symmetric multi-processing support"137137 depends on HAVE_SMP138138- select USE_GENERIC_SMP_HELPERS139138 select GENERIC_SMP_IDLE_THREAD140139 help141140 Enabled SMP Software; allows more than one CPU/CORE
···1081108110821082 rsr a0, sar10831083 s32i a3, a2, PT_AREG310841084+ s32i a0, a2, PT_SAR10851085+10861086+ /* The spill routine might clobber a4, a7, a8, a11, a12, and a15. */10871087+10841088 s32i a4, a2, PT_AREG410851085- s32i a0, a2, PT_AREG5 # store SAR to PT_AREG510861086-10871087- /* The spill routine might clobber a7, a11, and a15. */10881088-10891089 s32i a7, a2, PT_AREG710901090+ s32i a8, a2, PT_AREG810901091 s32i a11, a2, PT_AREG1110921092+ s32i a12, a2, PT_AREG1210911093 s32i a15, a2, PT_AREG151092109410931093- call0 _spill_registers # destroys a3, a4, and SAR10951095+ /*10961096+ * Rotate ws so that the current windowbase is at bit 0.10971097+ * Assume ws = xxxwww1yy (www1 current window frame).10981098+ * Rotate ws right so that a4 = yyxxxwww1.10991099+ */11001100+11011101+ rsr a0, windowbase11021102+ rsr a3, windowstart # a3 = xxxwww1yy11031103+ ssr a0 # holds WB11041104+ slli a0, a3, WSBITS11051105+ or a3, a3, a0 # a3 = xxxwww1yyxxxwww1yy11061106+ srl a3, a3 # a3 = 00xxxwww1yyxxxwww111071107+11081108+ /* We are done if there are no more than the current register frame. */11091109+11101110+ extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww11111111+ movi a0, (1 << (WSBITS-1))11121112+ _beqz a3, .Lnospill # only one active frame? jump11131113+11141114+ /* We want 1 at the top, so that we return to the current windowbase */11151115+11161116+ or a3, a3, a0 # 1yyxxxwww11171117+11181118+ /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */11191119+11201120+ wsr a3, windowstart # save shifted windowstart11211121+ neg a0, a311221122+ and a3, a0, a3 # first bit set from right: 00001000011231123+11241124+ ffs_ws a0, a3 # a0: shifts to skip empty frames11251125+ movi a3, WSBITS11261126+ sub a0, a3, a0 # WSBITS-a0:number of 0-bits from right11271127+ ssr a0 # save in SAR for later.11281128+11291129+ rsr a3, windowbase11301130+ add a3, a3, a011311131+ wsr a3, windowbase11321132+ rsync11331133+11341134+ rsr a3, windowstart11351135+ srl a3, a3 # shift windowstart11361136+11371137+ /* WB is now just one frame below the oldest frame in the register11381138+ window. WS is shifted so the oldest frame is in bit 0, thus, WB11391139+ and WS differ by one 4-register frame. */11401140+11411141+ /* Save frames. Depending what call was used (call4, call8, call12),11421142+ * we have to save 4,8. or 12 registers.11431143+ */11441144+11451145+11461146+.Lloop: _bbsi.l a3, 1, .Lc411471147+ _bbci.l a3, 2, .Lc1211481148+11491149+.Lc8: s32e a4, a13, -1611501150+ l32e a4, a5, -1211511151+ s32e a8, a4, -3211521152+ s32e a5, a13, -1211531153+ s32e a6, a13, -811541154+ s32e a7, a13, -411551155+ s32e a9, a4, -2811561156+ s32e a10, a4, -2411571157+ s32e a11, a4, -2011581158+ srli a11, a3, 2 # shift windowbase by 211591159+ rotw 211601160+ _bnei a3, 1, .Lloop11611161+ j .Lexit11621162+11631163+.Lc4: s32e a4, a9, -1611641164+ s32e a5, a9, -1211651165+ s32e a6, a9, -811661166+ s32e a7, a9, -411671167+11681168+ srli a7, a3, 111691169+ rotw 111701170+ _bnei a3, 1, .Lloop11711171+ j .Lexit11721172+11731173+.Lc12: _bbci.l a3, 3, .Linvalid_mask # bit 2 shouldn't be zero!11741174+11751175+ /* 12-register frame (call12) */11761176+11771177+ l32e a0, a5, -1211781178+ s32e a8, a0, -4811791179+ mov a8, a011801180+11811181+ s32e a9, a8, -4411821182+ s32e a10, a8, -4011831183+ s32e a11, a8, -3611841184+ s32e a12, a8, -3211851185+ s32e a13, a8, -2811861186+ s32e a14, a8, -2411871187+ s32e a15, a8, -2011881188+ srli a15, a3, 311891189+11901190+ /* The stack pointer for a4..a7 is out of reach, so we rotate the11911191+ * window, grab the stackpointer, and rotate back.11921192+ * Alternatively, we could also use the following approach, but that11931193+ * makes the fixup routine much more complicated:11941194+ * rotw 111951195+ * s32e a0, a13, -1611961196+ * ...11971197+ * rotw 211981198+ */11991199+12001200+ rotw 112011201+ mov a4, a1312021202+ rotw -112031203+12041204+ s32e a4, a8, -1612051205+ s32e a5, a8, -1212061206+ s32e a6, a8, -812071207+ s32e a7, a8, -412081208+12091209+ rotw 312101210+12111211+ _beqi a3, 1, .Lexit12121212+ j .Lloop12131213+12141214+.Lexit:12151215+12161216+ /* Done. Do the final rotation and set WS */12171217+12181218+ rotw 112191219+ rsr a3, windowbase12201220+ ssl a312211221+ movi a3, 112221222+ sll a3, a312231223+ wsr a3, windowstart12241224+.Lnospill:1094122510951226 /* Advance PC, restore registers and SAR, and return from exception. */1096122710971097- l32i a3, a2, PT_AREG510981098- l32i a4, a2, PT_AREG412281228+ l32i a3, a2, PT_SAR10991229 l32i a0, a2, PT_AREG011001230 wsr a3, sar11011231 l32i a3, a2, PT_AREG31102123211031233 /* Restore clobbered registers. */1104123412351235+ l32i a4, a2, PT_AREG411051236 l32i a7, a2, PT_AREG712371237+ l32i a8, a2, PT_AREG811061238 l32i a11, a2, PT_AREG1112391239+ l32i a12, a2, PT_AREG1211071240 l32i a15, a2, PT_AREG151108124111091242 movi a2, 011101243 rfe12441244+12451245+.Linvalid_mask:12461246+12471247+ /* We get here because of an unrecoverable error in the window12481248+ * registers, so set up a dummy frame and kill the user application.12491249+ * Note: We assume EXC_TABLE_KSTK contains a valid stack pointer.12501250+ */12511251+12521252+ movi a0, 112531253+ movi a1, 012541254+12551255+ wsr a0, windowstart12561256+ wsr a1, windowbase12571257+ rsync12581258+12591259+ movi a0, 012601260+12611261+ rsr a3, excsave112621262+ l32i a1, a3, EXC_TABLE_KSTK12631263+12641264+ movi a4, (1 << PS_WOE_BIT) | LOCKLEVEL12651265+ wsr a4, ps12661266+ rsync12671267+12681268+ movi a6, SIGSEGV12691269+ movi a4, do_exit12701270+ callx4 a412711271+12721272+ /* shouldn't return, so panic */12731273+12741274+ wsr a0, excsave112751275+ movi a0, unrecoverable_exception12761276+ callx0 a0 # should not return12771277+1: j 1b12781278+1111127911121280ENDPROC(fast_syscall_spill_registers)11131281···12841116 * We get here if the spill routine causes an exception, e.g. tlb miss.12851117 * We basically restore WINDOWBASE and WINDOWSTART to the condition when12861118 * we entered the spill routine and jump to the user exception handler.11191119+ *11201120+ * Note that we only need to restore the bits in windowstart that have not11211121+ * been spilled yet by the _spill_register routine. Luckily, a3 contains a11221122+ * rotated windowstart with only those bits set for frames that haven't been11231123+ * spilled yet. Because a3 is rotated such that bit 0 represents the register11241124+ * frame for the current windowbase - 1, we need to rotate a3 left by the11251125+ * value of the current windowbase + 1 and move it to windowstart.12871126 *12881127 * a0: value of depc, original value in depc12891128 * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE···13061131 /* We need to make sure the current registers (a0-a3) are preserved.13071132 * To do this, we simply set the bit for the current window frame13081133 * in WS, so that the exception handlers save them to the task stack.11341134+ *11351135+ * Note: we use a3 to set the windowbase, so we take a special care11361136+ * of it, saving it in the original _spill_registers frame across11371137+ * the exception handler call.13091138 */1310113913111140 xsr a3, excsave1 # get spill-mask13121141 slli a3, a3, 1 # shift left by one11421142+ addi a3, a3, 1 # set the bit for the current window frame1313114313141144 slli a2, a3, 32-WSBITS13151145 src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy......···13991219 rfde1400122014011221ENDPROC(fast_syscall_spill_registers_fixup_return)14021402-14031403-/*14041404- * spill all registers.14051405- *14061406- * This is not a real function. The following conditions must be met:14071407- *14081408- * - must be called with call0.14091409- * - uses a3, a4 and SAR.14101410- * - the last 'valid' register of each frame are clobbered.14111411- * - the caller must have registered a fixup handler14121412- * (or be inside a critical section)14131413- * - PS_EXCM must be set (PS_WOE cleared?)14141414- */14151415-14161416-ENTRY(_spill_registers)14171417-14181418- /*14191419- * Rotate ws so that the current windowbase is at bit 0.14201420- * Assume ws = xxxwww1yy (www1 current window frame).14211421- * Rotate ws right so that a4 = yyxxxwww1.14221422- */14231423-14241424- rsr a4, windowbase14251425- rsr a3, windowstart # a3 = xxxwww1yy14261426- ssr a4 # holds WB14271427- slli a4, a3, WSBITS14281428- or a3, a3, a4 # a3 = xxxwww1yyxxxwww1yy14291429- srl a3, a3 # a3 = 00xxxwww1yyxxxwww114301430-14311431- /* We are done if there are no more than the current register frame. */14321432-14331433- extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww14341434- movi a4, (1 << (WSBITS-1))14351435- _beqz a3, .Lnospill # only one active frame? jump14361436-14371437- /* We want 1 at the top, so that we return to the current windowbase */14381438-14391439- or a3, a3, a4 # 1yyxxxwww14401440-14411441- /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */14421442-14431443- wsr a3, windowstart # save shifted windowstart14441444- neg a4, a314451445- and a3, a4, a3 # first bit set from right: 00001000014461446-14471447- ffs_ws a4, a3 # a4: shifts to skip empty frames14481448- movi a3, WSBITS14491449- sub a4, a3, a4 # WSBITS-a4:number of 0-bits from right14501450- ssr a4 # save in SAR for later.14511451-14521452- rsr a3, windowbase14531453- add a3, a3, a414541454- wsr a3, windowbase14551455- rsync14561456-14571457- rsr a3, windowstart14581458- srl a3, a3 # shift windowstart14591459-14601460- /* WB is now just one frame below the oldest frame in the register14611461- window. WS is shifted so the oldest frame is in bit 0, thus, WB14621462- and WS differ by one 4-register frame. */14631463-14641464- /* Save frames. Depending what call was used (call4, call8, call12),14651465- * we have to save 4,8. or 12 registers.14661466- */14671467-14681468- _bbsi.l a3, 1, .Lc414691469- _bbsi.l a3, 2, .Lc814701470-14711471- /* Special case: we have a call12-frame starting at a4. */14721472-14731473- _bbci.l a3, 3, .Lc12 # bit 3 shouldn't be zero! (Jump to Lc12 first)14741474-14751475- s32e a4, a1, -16 # a1 is valid with an empty spill area14761476- l32e a4, a5, -1214771477- s32e a8, a4, -4814781478- mov a8, a414791479- l32e a4, a1, -1614801480- j .Lc12c14811481-14821482-.Lnospill:14831483- ret14841484-14851485-.Lloop: _bbsi.l a3, 1, .Lc414861486- _bbci.l a3, 2, .Lc1214871487-14881488-.Lc8: s32e a4, a13, -1614891489- l32e a4, a5, -1214901490- s32e a8, a4, -3214911491- s32e a5, a13, -1214921492- s32e a6, a13, -814931493- s32e a7, a13, -414941494- s32e a9, a4, -2814951495- s32e a10, a4, -2414961496- s32e a11, a4, -2014971497-14981498- srli a11, a3, 2 # shift windowbase by 214991499- rotw 215001500- _bnei a3, 1, .Lloop15011501-15021502-.Lexit: /* Done. Do the final rotation, set WS, and return. */15031503-15041504- rotw 115051505- rsr a3, windowbase15061506- ssl a315071507- movi a3, 115081508- sll a3, a315091509- wsr a3, windowstart15101510- ret15111511-15121512-.Lc4: s32e a4, a9, -1615131513- s32e a5, a9, -1215141514- s32e a6, a9, -815151515- s32e a7, a9, -415161516-15171517- srli a7, a3, 115181518- rotw 115191519- _bnei a3, 1, .Lloop15201520- j .Lexit15211521-15221522-.Lc12: _bbci.l a3, 3, .Linvalid_mask # bit 2 shouldn't be zero!15231523-15241524- /* 12-register frame (call12) */15251525-15261526- l32e a2, a5, -1215271527- s32e a8, a2, -4815281528- mov a8, a215291529-15301530-.Lc12c: s32e a9, a8, -4415311531- s32e a10, a8, -4015321532- s32e a11, a8, -3615331533- s32e a12, a8, -3215341534- s32e a13, a8, -2815351535- s32e a14, a8, -2415361536- s32e a15, a8, -2015371537- srli a15, a3, 315381538-15391539- /* The stack pointer for a4..a7 is out of reach, so we rotate the15401540- * window, grab the stackpointer, and rotate back.15411541- * Alternatively, we could also use the following approach, but that15421542- * makes the fixup routine much more complicated:15431543- * rotw 115441544- * s32e a0, a13, -1615451545- * ...15461546- * rotw 215471547- */15481548-15491549- rotw 115501550- mov a5, a1315511551- rotw -115521552-15531553- s32e a4, a9, -1615541554- s32e a5, a9, -1215551555- s32e a6, a9, -815561556- s32e a7, a9, -415571557-15581558- rotw 315591559-15601560- _beqi a3, 1, .Lexit15611561- j .Lloop15621562-15631563-.Linvalid_mask:15641564-15651565- /* We get here because of an unrecoverable error in the window15661566- * registers. If we are in user space, we kill the application,15671567- * however, this condition is unrecoverable in kernel space.15681568- */15691569-15701570- rsr a0, ps15711571- _bbci.l a0, PS_UM_BIT, 1f15721572-15731573- /* User space: Setup a dummy frame and kill application.15741574- * Note: We assume EXC_TABLE_KSTK contains a valid stack pointer.15751575- */15761576-15771577- movi a0, 115781578- movi a1, 015791579-15801580- wsr a0, windowstart15811581- wsr a1, windowbase15821582- rsync15831583-15841584- movi a0, 015851585-15861586- rsr a3, excsave115871587- l32i a1, a3, EXC_TABLE_KSTK15881588-15891589- movi a4, (1 << PS_WOE_BIT) | LOCKLEVEL15901590- wsr a4, ps15911591- rsync15921592-15931593- movi a6, SIGSEGV15941594- movi a4, do_exit15951595- callx4 a415961596-15971597-1: /* Kernel space: PANIC! */15981598-15991599- wsr a0, excsave116001600- movi a0, unrecoverable_exception16011601- callx0 a0 # should not return16021602-1: j 1b16031603-16041604-ENDPROC(_spill_registers)1605122216061223#ifdef CONFIG_MMU16071224/*···1771179417721795ENDPROC(system_call)1773179617971797+/*17981798+ * Spill live registers on the kernel stack macro.17991799+ *18001800+ * Entry condition: ps.woe is set, ps.excm is cleared18011801+ * Exit condition: windowstart has single bit set18021802+ * May clobber: a12, a1318031803+ */18041804+ .macro spill_registers_kernel18051805+18061806+#if XCHAL_NUM_AREGS > 1618071807+ call12 1f18081808+ _j 2f18091809+ retw18101810+ .align 418111811+1:18121812+ _entry a1, 4818131813+ addi a12, a0, 318141814+#if XCHAL_NUM_AREGS > 3218151815+ .rept (XCHAL_NUM_AREGS - 32) / 1218161816+ _entry a1, 4818171817+ mov a12, a018181818+ .endr18191819+#endif18201820+ _entry a1, 4818211821+#if XCHAL_NUM_AREGS % 12 == 018221822+ mov a8, a818231823+#elif XCHAL_NUM_AREGS % 12 == 418241824+ mov a12, a1218251825+#elif XCHAL_NUM_AREGS % 12 == 818261826+ mov a4, a418271827+#endif18281828+ retw18291829+2:18301830+#else18311831+ mov a12, a1218321832+#endif18331833+ .endm1774183417751835/*17761836 * Task switch.···1820180618211807 entry a1, 161822180818231823- mov a12, a2 # preserve 'prev' (a2)18241824- mov a13, a3 # and 'next' (a3)18091809+ mov a10, a2 # preserve 'prev' (a2)18101810+ mov a11, a3 # and 'next' (a3)1825181118261812 l32i a4, a2, TASK_THREAD_INFO18271813 l32i a5, a3, TASK_THREAD_INFO1828181418291829- save_xtregs_user a4 a6 a8 a9 a10 a11 THREAD_XTREGS_USER18151815+ save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER1830181618311831- s32i a0, a12, THREAD_RA # save return address18321832- s32i a1, a12, THREAD_SP # save stack pointer18171817+ s32i a0, a10, THREAD_RA # save return address18181818+ s32i a1, a10, THREAD_SP # save stack pointer1833181918341820 /* Disable ints while we manipulate the stack pointer. */1835182118361836- movi a14, (1 << PS_EXCM_BIT) | LOCKLEVEL18371837- xsr a14, ps18221822+ rsil a14, LOCKLEVEL18381823 rsr a3, excsave118391824 rsync18401825 s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */···1848183518491836 /* Flush register file. */1850183718511851- call0 _spill_registers # destroys a3, a4, and SAR18381838+ spill_registers_kernel1852183918531840 /* Set kernel stack (and leave critical section)18541841 * Note: It's save to set it here. The stack will not be overwritten···1864185118651852 /* restore context of the task 'next' */1866185318671867- l32i a0, a13, THREAD_RA # restore return address18681868- l32i a1, a13, THREAD_SP # restore stack pointer18541854+ l32i a0, a11, THREAD_RA # restore return address18551855+ l32i a1, a11, THREAD_SP # restore stack pointer1869185618701870- load_xtregs_user a5 a6 a8 a9 a10 a11 THREAD_XTREGS_USER18571857+ load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER1871185818721859 wsr a14, ps18731873- mov a2, a12 # return 'prev'18601860+ mov a2, a10 # return 'prev'18741861 rsync1875186218761863 retw
···122122EXPORT_SYMBOL(insl);123123124124extern long common_exception_return;125125-extern long _spill_registers;126125EXPORT_SYMBOL(common_exception_return);127127-EXPORT_SYMBOL(_spill_registers);128126129127#ifdef CONFIG_FUNCTION_TRACER130128EXPORT_SYMBOL(_mcount);
+9-4
arch/xtensa/mm/init.c
···909091919292/*9393- * Initialize the bootmem system and give it all the memory we have available.9393+ * Initialize the bootmem system and give it all low memory we have available.9494 */95959696void __init bootmem_init(void)···142142143143 /* Add all remaining memory pieces into the bootmem map */144144145145- for (i=0; i<sysmem.nr_banks; i++)146146- free_bootmem(sysmem.bank[i].start,147147- sysmem.bank[i].end - sysmem.bank[i].start);145145+ for (i = 0; i < sysmem.nr_banks; i++) {146146+ if (sysmem.bank[i].start >> PAGE_SHIFT < max_low_pfn) {147147+ unsigned long end = min(max_low_pfn << PAGE_SHIFT,148148+ sysmem.bank[i].end);149149+ free_bootmem(sysmem.bank[i].start,150150+ end - sysmem.bank[i].start);151151+ }152152+ }148153149154}150155
+1-1
arch/xtensa/mm/mmu.c
···3939 set_itlbcfg_register(0);4040 set_dtlbcfg_register(0);4141#endif4242-#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF4242+#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF)4343 /*4444 * Update the IO area mapping in case xtensa_kio_paddr has changed4545 */
+4-3
arch/xtensa/platforms/xtfpga/setup.c
···135135136136static int __init machine_setup(void)137137{138138- struct device_node *serial;138138+ struct device_node *clock;139139 struct device_node *eth = NULL;140140141141- for_each_compatible_node(serial, NULL, "ns16550a")142142- update_clock_frequency(serial);141141+ for_each_node_by_name(clock, "main-oscillator")142142+ update_clock_frequency(clock);143143144144 if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc")))145145 update_local_mac(eth);···290290 * knows whether they set it correctly on the DIP switches.291291 */292292 pr_info("XTFPGA: Ethernet MAC %pM\n", ethoc_pdata.hwaddr);293293+ ethoc_pdata.eth_clkfreq = *(long *)XTFPGA_CLKFRQ_VADDR;293294294295 return 0;295296}
+2-7
arch/xtensa/variants/fsf/include/variant/tie.h
···1818#define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */1919#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */20202121-/* Basic parameters of each coprocessor: */2222-#define XCHAL_CP7_NAME "XTIOP"2323-#define XCHAL_CP7_IDENT XTIOP2424-#define XCHAL_CP7_SA_SIZE 0 /* size of state save area */2525-#define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */2626-#define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */2727-2821/* Filler info for unassigned coprocessors, to simplify arrays etc: */2922#define XCHAL_NCP_SA_SIZE 03023#define XCHAL_NCP_SA_ALIGN 1···3542#define XCHAL_CP5_SA_ALIGN 13643#define XCHAL_CP6_SA_SIZE 03744#define XCHAL_CP6_SA_ALIGN 14545+#define XCHAL_CP7_SA_SIZE 04646+#define XCHAL_CP7_SA_ALIGN 138473948/* Save area for non-coprocessor optional and custom (TIE) state: */4049#define XCHAL_NCP_SA_SIZE 0
+1-1
block/blk-exec.c
···6565 * be resued after dying flag is set6666 */6767 if (q->mq_ops) {6868- blk_mq_insert_request(q, rq, at_head, true);6868+ blk_mq_insert_request(rq, at_head, true, false);6969 return;7070 }7171
···6767#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */6868#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */6969#define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */7070+#define ACPI_EC_CLEAR_MAX 100 /* Maximum number of events to query7171+ * when trying to clear the EC */70727173enum {7274 EC_FLAGS_QUERY_PENDING, /* Query is pending */···118116static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */119117static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */120118static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */119119+static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */121120122121/* --------------------------------------------------------------------------123122 Transaction Management···443440444441EXPORT_SYMBOL(ec_get_handle);445442443443+static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data);444444+445445+/*446446+ * Clears stale _Q events that might have accumulated in the EC.447447+ * Run with locked ec mutex.448448+ */449449+static void acpi_ec_clear(struct acpi_ec *ec)450450+{451451+ int i, status;452452+ u8 value = 0;453453+454454+ for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {455455+ status = acpi_ec_query_unlocked(ec, &value);456456+ if (status || !value)457457+ break;458458+ }459459+460460+ if (unlikely(i == ACPI_EC_CLEAR_MAX))461461+ pr_warn("Warning: Maximum of %d stale EC events cleared\n", i);462462+ else463463+ pr_info("%d stale EC events cleared\n", i);464464+}465465+446466void acpi_ec_block_transactions(void)447467{448468 struct acpi_ec *ec = first_ec;···489463 mutex_lock(&ec->mutex);490464 /* Allow transactions to be carried out again */491465 clear_bit(EC_FLAGS_BLOCKED, &ec->flags);466466+467467+ if (EC_FLAGS_CLEAR_ON_RESUME)468468+ acpi_ec_clear(ec);469469+492470 mutex_unlock(&ec->mutex);493471}494472···851821852822 /* EC is fully operational, allow queries */853823 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);824824+825825+ /* Clear stale _Q events if hardware might require that */826826+ if (EC_FLAGS_CLEAR_ON_RESUME) {827827+ mutex_lock(&ec->mutex);828828+ acpi_ec_clear(ec);829829+ mutex_unlock(&ec->mutex);830830+ }854831 return ret;855832}856833···959922 return 0;960923}961924925925+/*926926+ * On some hardware it is necessary to clear events accumulated by the EC during927927+ * sleep. These ECs stop reporting GPEs until they are manually polled, if too928928+ * many events are accumulated. (e.g. Samsung Series 5/9 notebooks)929929+ *930930+ * https://bugzilla.kernel.org/show_bug.cgi?id=44161931931+ *932932+ * Ideally, the EC should also be instructed NOT to accumulate events during933933+ * sleep (which Windows seems to do somehow), but the interface to control this934934+ * behaviour is not known at this time.935935+ *936936+ * Models known to be affected are Samsung 530Uxx/535Uxx/540Uxx/550Pxx/900Xxx,937937+ * however it is very likely that other Samsung models are affected.938938+ *939939+ * On systems which don't accumulate _Q events during sleep, this extra check940940+ * should be harmless.941941+ */942942+static int ec_clear_on_resume(const struct dmi_system_id *id)943943+{944944+ pr_debug("Detected system needing EC poll on resume.\n");945945+ EC_FLAGS_CLEAR_ON_RESUME = 1;946946+ return 0;947947+}948948+962949static struct dmi_system_id ec_dmi_table[] __initdata = {963950 {964951 ec_skip_dsdt_scan, "Compal JFL92", {···1026965 ec_validate_ecdt, "ASUS hardware", {1027966 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer Inc."),1028967 DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),}, NULL},968968+ {969969+ ec_clear_on_resume, "Samsung hardware", {970970+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL},1029971 {},1030972};1031973
+3
drivers/acpi/fan.c
···5555#ifdef CONFIG_PM_SLEEP5656static int acpi_fan_suspend(struct device *dev);5757static int acpi_fan_resume(struct device *dev);5858+#else5959+#define acpi_fan_suspend NULL6060+#define acpi_fan_resume NULL5861#endif5962static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume);6063
···5656 int target_state; /* target T-state */5757};58585959+struct acpi_processor_throttling_arg {6060+ struct acpi_processor *pr;6161+ int target_state;6262+ bool force;6363+};6464+5965#define THROTTLING_PRECHANGE (1)6066#define THROTTLING_POSTCHANGE (2)6167···10661060 return 0;10671061}1068106210631063+static long acpi_processor_throttling_fn(void *data)10641064+{10651065+ struct acpi_processor_throttling_arg *arg = data;10661066+ struct acpi_processor *pr = arg->pr;10671067+10681068+ return pr->throttling.acpi_processor_set_throttling(pr,10691069+ arg->target_state, arg->force);10701070+}10711071+10691072int acpi_processor_set_throttling(struct acpi_processor *pr,10701073 int state, bool force)10711074{10721072- cpumask_var_t saved_mask;10731075 int ret = 0;10741076 unsigned int i;10751077 struct acpi_processor *match_pr;10761078 struct acpi_processor_throttling *p_throttling;10791079+ struct acpi_processor_throttling_arg arg;10771080 struct throttling_tstate t_state;10781078- cpumask_var_t online_throttling_cpus;1079108110801082 if (!pr)10811083 return -EINVAL;···10941080 if ((state < 0) || (state > (pr->throttling.state_count - 1)))10951081 return -EINVAL;1096108210971097- if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))10981098- return -ENOMEM;10991099-11001100- if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) {11011101- free_cpumask_var(saved_mask);11021102- return -ENOMEM;11031103- }11041104-11051083 if (cpu_is_offline(pr->id)) {11061084 /*11071085 * the cpu pointed by pr->id is offline. Unnecessary to change···11021096 return -ENODEV;11031097 }1104109811051105- cpumask_copy(saved_mask, ¤t->cpus_allowed);11061099 t_state.target_state = state;11071100 p_throttling = &(pr->throttling);11081108- cpumask_and(online_throttling_cpus, cpu_online_mask,11091109- p_throttling->shared_cpu_map);11011101+11101102 /*11111103 * The throttling notifier will be called for every11121104 * affected cpu in order to get one proper T-state.11131105 * The notifier event is THROTTLING_PRECHANGE.11141106 */11151115- for_each_cpu(i, online_throttling_cpus) {11071107+ for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) {11161108 t_state.cpu = i;11171109 acpi_processor_throttling_notifier(THROTTLING_PRECHANGE,11181110 &t_state);···11221118 * it can be called only for the cpu pointed by pr.11231119 */11241120 if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {11251125- /* FIXME: use work_on_cpu() */11261126- if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) {11271127- /* Can't migrate to the pr->id CPU. Exit */11281128- ret = -ENODEV;11291129- goto exit;11301130- }11311131- ret = p_throttling->acpi_processor_set_throttling(pr,11321132- t_state.target_state, force);11211121+ arg.pr = pr;11221122+ arg.target_state = state;11231123+ arg.force = force;11241124+ ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg);11331125 } else {11341126 /*11351127 * When the T-state coordination is SW_ALL or HW_ALL,11361128 * it is necessary to set T-state for every affected11371129 * cpus.11381130 */11391139- for_each_cpu(i, online_throttling_cpus) {11311131+ for_each_cpu_and(i, cpu_online_mask,11321132+ p_throttling->shared_cpu_map) {11401133 match_pr = per_cpu(processors, i);11411134 /*11421135 * If the pointer is invalid, we will report the···11541153 "on CPU %d\n", i));11551154 continue;11561155 }11571157- t_state.cpu = i;11581158- /* FIXME: use work_on_cpu() */11591159- if (set_cpus_allowed_ptr(current, cpumask_of(i)))11601160- continue;11611161- ret = match_pr->throttling.11621162- acpi_processor_set_throttling(11631163- match_pr, t_state.target_state, force);11561156+11571157+ arg.pr = match_pr;11581158+ arg.target_state = state;11591159+ arg.force = force;11601160+ ret = work_on_cpu(pr->id, acpi_processor_throttling_fn,11611161+ &arg);11641162 }11651163 }11661164 /*···11681168 * affected cpu to update the T-states.11691169 * The notifier event is THROTTLING_POSTCHANGE11701170 */11711171- for_each_cpu(i, online_throttling_cpus) {11711171+ for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) {11721172 t_state.cpu = i;11731173 acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE,11741174 &t_state);11751175 }11761176- /* restore the previous state */11771177- /* FIXME: use work_on_cpu() */11781178- set_cpus_allowed_ptr(current, saved_mask);11791179-exit:11801180- free_cpumask_var(online_throttling_cpus);11811181- free_cpumask_var(saved_mask);11761176+11821177 return ret;11831178}11841179
+10
drivers/acpi/resource.c
···7777 switch (ares->type) {7878 case ACPI_RESOURCE_TYPE_MEMORY24:7979 memory24 = &ares->data.memory24;8080+ if (!memory24->address_length)8181+ return false;8082 acpi_dev_get_memresource(res, memory24->minimum,8183 memory24->address_length,8284 memory24->write_protect);8385 break;8486 case ACPI_RESOURCE_TYPE_MEMORY32:8587 memory32 = &ares->data.memory32;8888+ if (!memory32->address_length)8989+ return false;8690 acpi_dev_get_memresource(res, memory32->minimum,8791 memory32->address_length,8892 memory32->write_protect);8993 break;9094 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:9195 fixed_memory32 = &ares->data.fixed_memory32;9696+ if (!fixed_memory32->address_length)9797+ return false;9298 acpi_dev_get_memresource(res, fixed_memory32->address,9399 fixed_memory32->address_length,94100 fixed_memory32->write_protect);···150144 switch (ares->type) {151145 case ACPI_RESOURCE_TYPE_IO:152146 io = &ares->data.io;147147+ if (!io->address_length)148148+ return false;153149 acpi_dev_get_ioresource(res, io->minimum,154150 io->address_length,155151 io->io_decode);156152 break;157153 case ACPI_RESOURCE_TYPE_FIXED_IO:158154 fixed_io = &ares->data.fixed_io;155155+ if (!fixed_io->address_length)156156+ return false;159157 acpi_dev_get_ioresource(res, fixed_io->address,160158 fixed_io->address_length,161159 ACPI_DECODE_10);
+3-1
drivers/acpi/sbs.c
···450450{451451 unsigned long x;452452 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));453453- if (sscanf(buf, "%ld\n", &x) == 1)453453+ if (sscanf(buf, "%lu\n", &x) == 1)454454 battery->alarm_capacity = x /455455 (1000 * acpi_battery_scale(battery));456456 if (battery->present)···668668 acpi_sbs_callback(sbs);669669 return 0;670670}671671+#else672672+#define acpi_sbs_resume NULL671673#endif672674673675static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
···247247248248config SATA_MV249249 tristate "Marvell SATA support"250250+ select GENERIC_PHY250251 help251252 This option enables support for the Marvell Serial ATA family.252253 Currently supports 88SX[56]0[48][01] PCI(-X) chips,
···4175417541764176 /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */41774177 { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },41784178+ { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA },4178417941794180 /* Blacklist entries taken from Silicon Image 3124/313241804181 Windows driver .inf file - also several Linux problem reports */···42264225 /* devices that don't properly handle queued TRIM commands */42274226 { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },42284227 { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },42284228+ { "Crucial_CT???M500SSD3", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },4229422942304230 /*42314231 * Some WD SATA-I drives spin up and down erratically when the link
+5-2
drivers/ata/libata-pmp.c
···447447 * otherwise. Don't try hard to recover it.448448 */449449 ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY;450450- } else if (vendor == 0x197b && devid == 0x2352) {451451- /* chip found in Thermaltake BlackX Duet, jmicron JMB350? */450450+ } else if (vendor == 0x197b && (devid == 0x2352 || devid == 0x0325)) {451451+ /*452452+ * 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350?453453+ * 0x0325: jmicron JMB394.454454+ */452455 ata_for_each_link(link, ap, EDGE) {453456 /* SRST breaks detection and disks get misclassified454457 * LPM disabled to avoid potential problems
+6-2
drivers/ata/pata_imx.c
···119119 return PTR_ERR(priv->clk);120120 }121121122122- clk_prepare_enable(priv->clk);122122+ ret = clk_prepare_enable(priv->clk);123123+ if (ret)124124+ return ret;123125124126 host = ata_host_alloc(&pdev->dev, 1);125127 if (!host) {···214212 struct ata_host *host = dev_get_drvdata(dev);215213 struct pata_imx_priv *priv = host->private_data;216214217217- clk_prepare_enable(priv->clk);215215+ int ret = clk_prepare_enable(priv->clk);216216+ if (ret)217217+ return ret;218218219219 __raw_writel(priv->ata_ctl, priv->host_regs + PATA_IMX_ATA_CONTROL);220220
+8-4
drivers/ata/sata_mv.c
···41044104 if (!hpriv->port_phys)41054105 return -ENOMEM;41064106 host->private_data = hpriv;41074107- hpriv->n_ports = n_ports;41084107 hpriv->board_idx = chip_soc;4109410841104109 host->iomap = NULL;···41314132 rc = PTR_ERR(hpriv->port_phys[port]);41324133 hpriv->port_phys[port] = NULL;41334134 if (rc != -EPROBE_DEFER)41344134- dev_warn(&pdev->dev, "error getting phy %d",41354135- rc);41354135+ dev_warn(&pdev->dev, "error getting phy %d", rc);41364136+41374137+ /* Cleanup only the initialized ports */41384138+ hpriv->n_ports = port;41364139 goto err;41374140 } else41384141 phy_power_on(hpriv->port_phys[port]);41394142 }41434143+41444144+ /* All the ports have been initialized */41454145+ hpriv->n_ports = n_ports;4140414641414147 /*41424148 * (Re-)program MBUS remapping windows if we are asked to.···41804176 clk_disable_unprepare(hpriv->clk);41814177 clk_put(hpriv->clk);41824178 }41834183- for (port = 0; port < n_ports; port++) {41794179+ for (port = 0; port < hpriv->n_ports; port++) {41844180 if (!IS_ERR(hpriv->port_clks[port])) {41854181 clk_disable_unprepare(hpriv->port_clks[port]);41864182 clk_put(hpriv->port_clks[port]);
···15801580 switch (mode) {15811581 case PM_HIBERNATION_PREPARE:15821582 case PM_SUSPEND_PREPARE:15831583+ case PM_RESTORE_PREPARE:15831584 kill_requests_without_uevent();15841585 device_cache_fw_images();15851586 break;
+2-2
drivers/block/aoe/aoecmd.c
···874874 /* Non-zero page count for non-head members of875875 * compound pages is no longer allowed by the kernel.876876 */877877- page = compound_trans_head(bv.bv_page);877877+ page = compound_head(bv.bv_page);878878 atomic_inc(&page->_count);879879 }880880}···887887 struct bvec_iter iter;888888889889 bio_for_each_segment(bv, bio, iter) {890890- page = compound_trans_head(bv.bv_page);890890+ page = compound_head(bv.bv_page);891891 atomic_dec(&page->_count);892892 }893893}
+1-1
drivers/block/mtip32xx/mtip32xx.h
···5353#define MTIP_FTL_REBUILD_TIMEOUT_MS 240000054545555/* unaligned IO handling */5656-#define MTIP_MAX_UNALIGNED_SLOTS 85656+#define MTIP_MAX_UNALIGNED_SLOTS 257575858/* Macro to extract the tag bit number from a tag value. */5959#define MTIP_TAG_BIT(tag) (tag & 0x1F)
+2
drivers/block/zram/zram_drv.c
···612612613613 disksize = PAGE_ALIGN(disksize);614614 meta = zram_meta_alloc(disksize);615615+ if (!meta)616616+ return -ENOMEM;615617 down_write(&zram->init_lock);616618 if (zram->init_done) {617619 up_write(&zram->init_lock);
···10761076{10771077 struct powernow_k8_data *data;10781078 struct init_on_cpu init_on_cpu;10791079- int rc;10791079+ int rc, cpu;1080108010811081 smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1);10821082 if (rc)···11401140 pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n",11411141 data->currfid, data->currvid);1142114211431143- per_cpu(powernow_data, pol->cpu) = data;11431143+ /* Point all the CPUs in this policy to the same data */11441144+ for_each_cpu(cpu, pol->cpus)11451145+ per_cpu(powernow_data, cpu) = data;1144114611451147 return 0;11461148···11571155static int powernowk8_cpu_exit(struct cpufreq_policy *pol)11581156{11591157 struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);11581158+ int cpu;1160115911611160 if (!data)11621161 return -EINVAL;···1168116511691166 kfree(data->powernow_table);11701167 kfree(data);11711171- per_cpu(powernow_data, pol->cpu) = NULL;11681168+ for_each_cpu(cpu, pol->cpus)11691169+ per_cpu(powernow_data, cpu) = NULL;1172117011731171 return 0;11741172}
···943943944944 /* Attempt to 'get' the MCH register we want */945945 pdev = NULL;946946- while (!pvt->pci_dev_16_1_fsb_addr_map ||947947- !pvt->pci_dev_16_2_fsb_err_regs) {948948- pdev = pci_get_device(PCI_VENDOR_ID_INTEL,949949- PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, pdev);950950- if (!pdev) {951951- /* End of list, leave */952952- i7300_printk(KERN_ERR,953953- "'system address,Process Bus' "954954- "device not found:"955955- "vendor 0x%x device 0x%x ERR funcs "956956- "(broken BIOS?)\n",957957- PCI_VENDOR_ID_INTEL,958958- PCI_DEVICE_ID_INTEL_I7300_MCH_ERR);959959- goto error;960960- }961961-946946+ while ((pdev = pci_get_device(PCI_VENDOR_ID_INTEL,947947+ PCI_DEVICE_ID_INTEL_I7300_MCH_ERR,948948+ pdev))) {962949 /* Store device 16 funcs 1 and 2 */963950 switch (PCI_FUNC(pdev->devfn)) {964951 case 1:965965- pvt->pci_dev_16_1_fsb_addr_map = pdev;952952+ if (!pvt->pci_dev_16_1_fsb_addr_map)953953+ pvt->pci_dev_16_1_fsb_addr_map =954954+ pci_dev_get(pdev);966955 break;967956 case 2:968968- pvt->pci_dev_16_2_fsb_err_regs = pdev;957957+ if (!pvt->pci_dev_16_2_fsb_err_regs)958958+ pvt->pci_dev_16_2_fsb_err_regs =959959+ pci_dev_get(pdev);969960 break;970961 }962962+ }963963+964964+ if (!pvt->pci_dev_16_1_fsb_addr_map ||965965+ !pvt->pci_dev_16_2_fsb_err_regs) {966966+ /* At least one device was not found */967967+ i7300_printk(KERN_ERR,968968+ "'system address,Process Bus' device not found:"969969+ "vendor 0x%x device 0x%x ERR funcs (broken BIOS?)\n",970970+ PCI_VENDOR_ID_INTEL,971971+ PCI_DEVICE_ID_INTEL_I7300_MCH_ERR);972972+ goto error;971973 }972974973975 edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n",
+7-2
drivers/edac/i7core_edac.c
···13341334 * is at addr 8086:2c40, instead of 8086:2c41. So, we need13351335 * to probe for the alternate address in case of failure13361336 */13371337- if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev)13371337+ if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) {13381338+ pci_dev_get(*prev); /* pci_get_device will put it */13381339 pdev = pci_get_device(PCI_VENDOR_ID_INTEL,13391340 PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev);13411341+ }1340134213411341- if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev)13431343+ if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE &&13441344+ !pdev) {13451345+ pci_dev_get(*prev); /* pci_get_device will put it */13421346 pdev = pci_get_device(PCI_VENDOR_ID_INTEL,13431347 PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT,13441348 *prev);13491349+ }1345135013461351 if (!pdev) {13471352 if (*prev) {
-12
drivers/extcon/extcon-arizona.c
···222222 struct snd_soc_dapm_context *dapm = arizona->dapm;223223 int ret;224224225225- mutex_lock(&dapm->card->dapm_mutex);226226-227225 ret = snd_soc_dapm_force_enable_pin(dapm, widget);228226 if (ret != 0)229227 dev_warn(arizona->dev, "Failed to enable %s: %d\n",230228 widget, ret);231229232232- mutex_unlock(&dapm->card->dapm_mutex);233233-234230 snd_soc_dapm_sync(dapm);235231236232 if (!arizona->pdata.micd_force_micbias) {237237- mutex_lock(&dapm->card->dapm_mutex);238238-239233 ret = snd_soc_dapm_disable_pin(arizona->dapm, widget);240234 if (ret != 0)241235 dev_warn(arizona->dev, "Failed to disable %s: %d\n",242236 widget, ret);243243-244244- mutex_unlock(&dapm->card->dapm_mutex);245237246238 snd_soc_dapm_sync(dapm);247239 }···296304 ARIZONA_MICD_ENA, 0,297305 &change);298306299299- mutex_lock(&dapm->card->dapm_mutex);300300-301307 ret = snd_soc_dapm_disable_pin(dapm, widget);302308 if (ret != 0)303309 dev_warn(arizona->dev,304310 "Failed to disable %s: %d\n",305311 widget, ret);306306-307307- mutex_unlock(&dapm->card->dapm_mutex);308312309313 snd_soc_dapm_sync(dapm);310314
···290290#define QUIRK_NO_MSI 0x10291291#define QUIRK_TI_SLLZ059 0x20292292#define QUIRK_IR_WAKE 0x40293293-#define QUIRK_PHY_LCTRL_TIMEOUT 0x80294293295294/* In case of multiple matches in ohci_quirks[], only the first one is used. */296295static const struct {···302303 QUIRK_BE_HEADERS},303304304305 {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,305305- QUIRK_PHY_LCTRL_TIMEOUT | QUIRK_NO_MSI},306306-307307- {PCI_VENDOR_ID_ATT, PCI_ANY_ID, PCI_ANY_ID,308308- QUIRK_PHY_LCTRL_TIMEOUT},306306+ QUIRK_NO_MSI},309307310308 {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID,311309 QUIRK_RESET_PACKET},···349353 ", disable MSI = " __stringify(QUIRK_NO_MSI)350354 ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059)351355 ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE)352352- ", phy LCtrl timeout = " __stringify(QUIRK_PHY_LCTRL_TIMEOUT)353356 ")");354357355358#define OHCI_PARAM_DEBUG_AT_AR 1···22942299 * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but22952300 * cannot actually use the phy at that time. These need tens of22962301 * millisecods pause between LPS write and first phy access too.22972297- *22982298- * But do not wait for 50msec on Agere/LSI cards. Their phy22992299- * arbitration state machine may time out during such a long wait.23002302 */2301230323022304 reg_write(ohci, OHCI1394_HCControlSet,···23012309 OHCI1394_HCControl_postedWriteEnable);23022310 flush_writes(ohci);2303231123042304- if (!(ohci->quirks & QUIRK_PHY_LCTRL_TIMEOUT))23122312+ for (lps = 0, i = 0; !lps && i < 3; i++) {23052313 msleep(50);23062306-23072307- for (lps = 0, i = 0; !lps && i < 150; i++) {23082308- msleep(1);23092314 lps = reg_read(ohci, OHCI1394_HCControlSet) &23102315 OHCI1394_HCControl_LPS;23112316 }
+13-4
drivers/firewire/sbp2.c
···146146 */147147 int generation;148148 int retries;149149+ work_func_t workfn;149150 struct delayed_work work;150151 bool has_sdev;151152 bool blocked;···865864 /* set appropriate retry limit(s) in BUSY_TIMEOUT register */866865 sbp2_set_busy_timeout(lu);867866868868- PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect);867867+ lu->workfn = sbp2_reconnect;869868 sbp2_agent_reset(lu);870869871870 /* This was a re-login. */···919918 * If a bus reset happened, sbp2_update will have requeued920919 * lu->work already. Reset the work from reconnect to login.921920 */922922- PREPARE_DELAYED_WORK(&lu->work, sbp2_login);921921+ lu->workfn = sbp2_login;923922}924923925924static void sbp2_reconnect(struct work_struct *work)···953952 lu->retries++ >= 5) {954953 dev_err(tgt_dev(tgt), "failed to reconnect\n");955954 lu->retries = 0;956956- PREPARE_DELAYED_WORK(&lu->work, sbp2_login);955955+ lu->workfn = sbp2_login;957956 }958957 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));959958···971970 sbp2_agent_reset(lu);972971 sbp2_cancel_orbs(lu);973972 sbp2_conditionally_unblock(lu);973973+}974974+975975+static void sbp2_lu_workfn(struct work_struct *work)976976+{977977+ struct sbp2_logical_unit *lu = container_of(to_delayed_work(work),978978+ struct sbp2_logical_unit, work);979979+ lu->workfn(work);974980}975981976982static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)···1006998 lu->blocked = false;1007999 ++tgt->dont_block;10081000 INIT_LIST_HEAD(&lu->orb_list);10091009- INIT_DELAYED_WORK(&lu->work, sbp2_login);10011001+ lu->workfn = sbp2_login;10021002+ INIT_DELAYED_WORK(&lu->work, sbp2_lu_workfn);1010100310111004 list_add_tail(&lu->link, &tgt->lu_list);10121005 return 0;
+1-1
drivers/fmc/fmc-write-eeprom.c
···2727/* The "file=" is like the generic "gateware=" used elsewhere */2828static char *fwe_file[FMC_MAX_CARDS];2929static int fwe_file_n;3030-module_param_array_named(file, fwe_file, charp, &fwe_file_n, 444);3030+module_param_array_named(file, fwe_file, charp, &fwe_file_n, 0444);31313232static int fwe_run_tlv(struct fmc_device *fmc, const struct firmware *fw,3333 int write)
+1-9
drivers/gpu/drm/armada/armada_drv.c
···6868{6969 struct armada_private *priv = dev->dev_private;70707171- /*7272- * Yes, we really must jump through these hoops just to store a7373- * _pointer_ to something into the kfifo. This is utterly insane7474- * and idiotic, because it kfifo requires the _data_ pointed to by7575- * the pointer const, not the pointer itself. Not only that, but7676- * you have to pass a pointer _to_ the pointer you want stored.7777- */7878- const struct drm_framebuffer *silly_api_alert = fb;7979- WARN_ON(!kfifo_put(&priv->fb_unref, &silly_api_alert));7171+ WARN_ON(!kfifo_put(&priv->fb_unref, fb));8072 schedule_work(&priv->fb_unref_work);8173}8274
+1
drivers/gpu/drm/bochs/Kconfig
···22 tristate "DRM Support for bochs dispi vga interface (qemu stdvga)"33 depends on DRM && PCI44 select DRM_KMS_HELPER55+ select DRM_KMS_FB_HELPER56 select FB_SYS_FILLRECT67 select FB_SYS_COPYAREA78 select FB_SYS_IMAGEBLIT
+12
drivers/gpu/drm/drm_ioctl.c
···296296 case DRM_CAP_ASYNC_PAGE_FLIP:297297 req->value = dev->mode_config.async_page_flip;298298 break;299299+ case DRM_CAP_CURSOR_WIDTH:300300+ if (dev->mode_config.cursor_width)301301+ req->value = dev->mode_config.cursor_width;302302+ else303303+ req->value = 64;304304+ break;305305+ case DRM_CAP_CURSOR_HEIGHT:306306+ if (dev->mode_config.cursor_height)307307+ req->value = dev->mode_config.cursor_height;308308+ else309309+ req->value = 64;310310+ break;299311 default:300312 return -EINVAL;301313 }
···403403void intel_detect_pch(struct drm_device *dev)404404{405405 struct drm_i915_private *dev_priv = dev->dev_private;406406- struct pci_dev *pch;406406+ struct pci_dev *pch = NULL;407407408408 /* In all current cases, num_pipes is equivalent to the PCH_NOP setting409409 * (which really amounts to a PCH but no South Display).···424424 * all the ISA bridge devices and check for the first match, instead425425 * of only checking the first one.426426 */427427- pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);428428- while (pch) {429429- struct pci_dev *curr = pch;427427+ while ((pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, pch))) {430428 if (pch->vendor == PCI_VENDOR_ID_INTEL) {431431- unsigned short id;432432- id = pch->device & INTEL_PCH_DEVICE_ID_MASK;429429+ unsigned short id = pch->device & INTEL_PCH_DEVICE_ID_MASK;433430 dev_priv->pch_id = id;434431435432 if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) {···458461 DRM_DEBUG_KMS("Found LynxPoint LP PCH\n");459462 WARN_ON(!IS_HASWELL(dev));460463 WARN_ON(!IS_ULT(dev));461461- } else {462462- goto check_next;463463- }464464- pci_dev_put(pch);464464+ } else465465+ continue;466466+465467 break;466468 }467467-check_next:468468- pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, curr);469469- pci_dev_put(curr);470469 }471470 if (!pch)472472- DRM_DEBUG_KMS("No PCH found?\n");471471+ DRM_DEBUG_KMS("No PCH found.\n");472472+473473+ pci_dev_put(pch);473474}474475475476bool i915_semaphore_is_enabled(struct drm_device *dev)
+16-3
drivers/gpu/drm/i915/i915_gem_stolen.c
···8282 r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,8383 "Graphics Stolen Memory");8484 if (r == NULL) {8585- DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",8686- base, base + (uint32_t)dev_priv->gtt.stolen_size);8787- base = 0;8585+ /*8686+ * One more attempt but this time requesting region from8787+ * base + 1, as we have seen that this resolves the region8888+ * conflict with the PCI Bus.8989+ * This is a BIOS w/a: Some BIOS wrap stolen in the root9090+ * PCI bus, but have an off-by-one error. Hence retry the9191+ * reservation starting from 1 instead of 0.9292+ */9393+ r = devm_request_mem_region(dev->dev, base + 1,9494+ dev_priv->gtt.stolen_size - 1,9595+ "Graphics Stolen Memory");9696+ if (r == NULL) {9797+ DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",9898+ base, base + (uint32_t)dev_priv->gtt.stolen_size);9999+ base = 0;100100+ }88101 }8910290103 return base;
+18-4
drivers/gpu/drm/i915/intel_display.c
···10921092 struct drm_device *dev = dev_priv->dev;10931093 bool cur_state;1094109410951095- if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))10961096- cur_state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE;10971097- else if (IS_845G(dev) || IS_I865G(dev))10951095+ if (IS_845G(dev) || IS_I865G(dev))10981096 cur_state = I915_READ(_CURACNTR) & CURSOR_ENABLE;10991099- else10971097+ else if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev))11001098 cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE;10991099+ else11001100+ cur_state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE;1101110111021102 WARN(cur_state != state,11031103 "cursor on pipe %c assertion failure (expected %s, current %s)\n",···85858585 len = 4;85868586 if (ring->id == RCS)85878587 len += 6;85888588+85898589+ /*85908590+ * BSpec MI_DISPLAY_FLIP for IVB:85918591+ * "The full packet must be contained within the same cache line."85928592+ *85938593+ * Currently the LRI+SRM+MI_DISPLAY_FLIP all fit within the same85948594+ * cacheline, if we ever start emitting more commands before85958595+ * the MI_DISPLAY_FLIP we may need to first emit everything else,85968596+ * then do the cacheline alignment, and finally emit the85978597+ * MI_DISPLAY_FLIP.85988598+ */85998599+ ret = intel_ring_cacheline_align(ring);86008600+ if (ret)86018601+ goto err_unpin;8588860285898603 ret = intel_ring_begin(ring, len);85908604 if (ret)
+13-6
drivers/gpu/drm/i915/intel_dp.c
···537537 uint8_t msg[20];538538 int msg_bytes;539539 uint8_t ack;540540+ int retry;540541541542 if (WARN_ON(send_bytes > 16))542543 return -E2BIG;···549548 msg[3] = send_bytes - 1;550549 memcpy(&msg[4], send, send_bytes);551550 msg_bytes = send_bytes + 4;552552- for (;;) {551551+ for (retry = 0; retry < 7; retry++) {553552 ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1);554553 if (ret < 0)555554 return ret;556555 ack >>= 4;557556 if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK)558558- break;557557+ return send_bytes;559558 else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)560560- udelay(100);559559+ usleep_range(400, 500);561560 else562561 return -EIO;563562 }564564- return send_bytes;563563+564564+ DRM_ERROR("too many retries, giving up\n");565565+ return -EIO;565566}566567567568/* Write a single byte to the aux channel in native mode */···585582 int reply_bytes;586583 uint8_t ack;587584 int ret;585585+ int retry;588586589587 if (WARN_ON(recv_bytes > 19))590588 return -E2BIG;···599595 msg_bytes = 4;600596 reply_bytes = recv_bytes + 1;601597602602- for (;;) {598598+ for (retry = 0; retry < 7; retry++) {603599 ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes,604600 reply, reply_bytes);605601 if (ret == 0)···612608 return ret - 1;613609 }614610 else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)615615- udelay(100);611611+ usleep_range(400, 500);616612 else617613 return -EIO;618614 }615615+616616+ DRM_ERROR("too many retries, giving up\n");617617+ return -EIO;619618}620619621620static int
+3-3
drivers/gpu/drm/i915/intel_hdmi.c
···845845{846846 struct drm_device *dev = intel_hdmi_to_dev(hdmi);847847848848- if (IS_G4X(dev))848848+ if (!hdmi->has_hdmi_sink || IS_G4X(dev))849849 return 165000;850850 else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8)851851 return 300000;···899899 * outputs. We also need to check that the higher clock still fits900900 * within limits.901901 */902902- if (pipe_config->pipe_bpp > 8*3 && clock_12bpc <= portclock_limit903903- && HAS_PCH_SPLIT(dev)) {902902+ if (pipe_config->pipe_bpp > 8*3 && intel_hdmi->has_hdmi_sink &&903903+ clock_12bpc <= portclock_limit && HAS_PCH_SPLIT(dev)) {904904 DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");905905 desired_bpp = 12*3;906906
+2-2
drivers/gpu/drm/i915/intel_panel.c
···698698 freq /= 0xff;699699700700 ctl = freq << 17;701701- if (IS_GEN2(dev) && panel->backlight.combination_mode)701701+ if (panel->backlight.combination_mode)702702 ctl |= BLM_LEGACY_MODE;703703 if (IS_PINEVIEW(dev) && panel->backlight.active_low_pwm)704704 ctl |= BLM_POLARITY_PNV;···979979980980 ctl = I915_READ(BLC_PWM_CTL);981981982982- if (IS_GEN2(dev))982982+ if (IS_GEN2(dev) || IS_I915GM(dev) || IS_I945GM(dev))983983 panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE;984984985985 if (IS_PINEVIEW(dev))
+4-2
drivers/gpu/drm/i915/intel_pm.c
···34933493 u32 pcbr;34943494 int pctx_size = 24*1024;3495349534963496+ WARN_ON(!mutex_is_locked(&dev->struct_mutex));34973497+34963498 pcbr = I915_READ(VLV_PCBR);34973499 if (pcbr) {34983500 /* BIOS set it up already, grab the pre-alloc'd space */···35433541 gtfifodbg);35443542 I915_WRITE(GTFIFODBG, gtfifodbg);35453543 }35463546-35473547- valleyview_setup_pctx(dev);3548354435493545 /* If VLV, Forcewake all wells, else re-direct to regular path */35503546 gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL);···43954395 ironlake_enable_rc6(dev);43964396 intel_init_emon(dev);43974397 } else if (IS_GEN6(dev) || IS_GEN7(dev)) {43984398+ if (IS_VALLEYVIEW(dev))43994399+ valleyview_setup_pctx(dev);43984400 /*43994401 * PCU communication is slow and this doesn't need to be44004402 * done at any specific time, so do this out of our fast path
+21
drivers/gpu/drm/i915/intel_ringbuffer.c
···16531653 return 0;16541654}1655165516561656+/* Align the ring tail to a cacheline boundary */16571657+int intel_ring_cacheline_align(struct intel_ring_buffer *ring)16581658+{16591659+ int num_dwords = (64 - (ring->tail & 63)) / sizeof(uint32_t);16601660+ int ret;16611661+16621662+ if (num_dwords == 0)16631663+ return 0;16641664+16651665+ ret = intel_ring_begin(ring, num_dwords);16661666+ if (ret)16671667+ return ret;16681668+16691669+ while (num_dwords--)16701670+ intel_ring_emit(ring, MI_NOOP);16711671+16721672+ intel_ring_advance(ring);16731673+16741674+ return 0;16751675+}16761676+16561677void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno)16571678{16581679 struct drm_i915_private *dev_priv = ring->dev->dev_private;
···130130 u16 pcir;131131 int i;132132133133+ /* there is no prom on nv4x IGP's */134134+ if (device->card_type == NV_40 && device->chipset >= 0x4c)135135+ return;136136+133137 /* enable access to rom */134138 if (device->card_type >= NV_50)135139 pcireg = 0x088050;
···11+/*22+ * Copyright 2014 Ilia Mirkin33+ *44+ * Permission is hereby granted, free of charge, to any person obtaining a55+ * copy of this software and associated documentation files (the "Software"),66+ * to deal in the Software without restriction, including without limitation77+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,88+ * and/or sell copies of the Software, and to permit persons to whom the99+ * Software is furnished to do so, subject to the following conditions:1010+ *1111+ * The above copyright notice and this permission notice shall be included in1212+ * all copies or substantial portions of the Software.1313+ *1414+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1515+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1616+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL1717+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR1818+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,1919+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR2020+ * OTHER DEALINGS IN THE SOFTWARE.2121+ *2222+ * Authors: Ilia Mirkin2323+ */2424+2525+#include "nv04.h"2626+2727+static void2828+nv4c_mc_msi_rearm(struct nouveau_mc *pmc)2929+{3030+ struct nv04_mc_priv *priv = (void *)pmc;3131+ nv_wr08(priv, 0x088050, 0xff);3232+}3333+3434+struct nouveau_oclass *3535+nv4c_mc_oclass = &(struct nouveau_mc_oclass) {3636+ .base.handle = NV_SUBDEV(MC, 0x4c),3737+ .base.ofuncs = &(struct nouveau_ofuncs) {3838+ .ctor = nv04_mc_ctor,3939+ .dtor = _nouveau_mc_dtor,4040+ .init = nv44_mc_init,4141+ .fini = _nouveau_mc_fini,4242+ },4343+ .intr = nv04_mc_intr,4444+ .msi_rearm = nv4c_mc_msi_rearm,4545+}.base;
+24-2
drivers/gpu/drm/nouveau/nouveau_acpi.c
···106106 return 0;107107}108108109109+/*110110+ * On some platforms, _DSM(nouveau_op_dsm_muid, func0) has special111111+ * requirements on the fourth parameter, so a private implementation112112+ * instead of using acpi_check_dsm().113113+ */114114+static int nouveau_check_optimus_dsm(acpi_handle handle)115115+{116116+ int result;117117+118118+ /*119119+ * Function 0 returns a Buffer containing available functions.120120+ * The args parameter is ignored for function 0, so just put 0 in it121121+ */122122+ if (nouveau_optimus_dsm(handle, 0, 0, &result))123123+ return 0;124124+125125+ /*126126+ * ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported.127127+ * If the n-th bit is enabled, function n is supported128128+ */129129+ return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS);130130+}131131+109132static int nouveau_dsm(acpi_handle handle, int func, int arg)110133{111134 int ret = 0;···230207 1 << NOUVEAU_DSM_POWER))231208 retval |= NOUVEAU_DSM_HAS_MUX;232209233233- if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x00000100,234234- 1 << NOUVEAU_DSM_OPTIMUS_CAPS))210210+ if (nouveau_check_optimus_dsm(dhandle))235211 retval |= NOUVEAU_DSM_HAS_OPT;236212237213 if (retval & NOUVEAU_DSM_HAS_OPT) {
···376376 if (ret)377377 goto fail_device;378378379379+ dev->irq_enabled = true;380380+379381 /* workaround an odd issue on nvc1 by disabling the device's380382 * nosnoop capability. hopefully won't cause issues until a381383 * better fix is found - assuming there is one...···477475 struct nouveau_drm *drm = nouveau_drm(dev);478476 struct nouveau_object *device;479477478478+ dev->irq_enabled = false;480479 device = drm->client.base.device;481480 drm_put_dev(dev);482481
···559559 u32 adjusted_clock = mode->clock;560560 int encoder_mode = atombios_get_encoder_mode(encoder);561561 u32 dp_clock = mode->clock;562562- int bpc = radeon_get_monitor_bpc(connector);562562+ int bpc = radeon_crtc->bpc;563563 bool is_duallink = radeon_dig_monitor_is_duallink(encoder, mode->clock);564564565565 /* reset the pll flags */···11761176 evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split);1177117711781178 /* Set NUM_BANKS. */11791179- if (rdev->family >= CHIP_BONAIRE) {11791179+ if (rdev->family >= CHIP_TAHITI) {11801180 unsigned tileb, index, num_banks, tile_split_bytes;1181118111821182 /* Calculate the macrotile mode index. */···11941194 return -EINVAL;11951195 }1196119611971197- num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3;11971197+ if (rdev->family >= CHIP_BONAIRE)11981198+ num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3;11991199+ else12001200+ num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3;11981201 fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks);11991202 } else {12001200- /* SI and older. */12011201- if (rdev->family >= CHIP_TAHITI)12021202- tmp = rdev->config.si.tile_config;12031203- else if (rdev->family >= CHIP_CAYMAN)12031203+ /* NI and older. */12041204+ if (rdev->family >= CHIP_CAYMAN)12041205 tmp = rdev->config.cayman.tile_config;12051206 else12061207 tmp = rdev->config.evergreen.tile_config;···17741773 return ATOM_PPLL1;17751774 DRM_ERROR("unable to allocate a PPLL\n");17761775 return ATOM_PPLL_INVALID;17761776+ } else if (ASIC_IS_DCE41(rdev)) {17771777+ /* Don't share PLLs on DCE4.1 chips */17781778+ if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {17791779+ if (rdev->clock.dp_extclk)17801780+ /* skip PPLL programming if using ext clock */17811781+ return ATOM_PPLL_INVALID;17821782+ }17831783+ pll_in_use = radeon_get_pll_use_mask(crtc);17841784+ if (!(pll_in_use & (1 << ATOM_PPLL1)))17851785+ return ATOM_PPLL1;17861786+ if (!(pll_in_use & (1 << ATOM_PPLL2)))17871787+ return ATOM_PPLL2;17881788+ DRM_ERROR("unable to allocate a PPLL\n");17891789+ return ATOM_PPLL_INVALID;17771790 } else if (ASIC_IS_DCE4(rdev)) {17781791 /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock,17791792 * depending on the asic:···18151800 if (pll != ATOM_PPLL_INVALID)18161801 return pll;18171802 }18181818- } else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on DCE4.1 chips */18031803+ } else {18191804 /* use the same PPLL for all monitors with the same clock */18201805 pll = radeon_get_shared_nondp_ppll(crtc);18211806 if (pll != ATOM_PPLL_INVALID)
+5-4
drivers/gpu/drm/radeon/atombios_encoders.c
···464464465465static u8 radeon_atom_get_bpc(struct drm_encoder *encoder)466466{467467- struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);468467 int bpc = 8;469468470470- if (connector)471471- bpc = radeon_get_monitor_bpc(connector);469469+ if (encoder->crtc) {470470+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);471471+ bpc = radeon_crtc->bpc;472472+ }472473473474 switch (bpc) {474475 case 0:···13141313 }13151314 if (is_dp)13161315 args.v5.ucLaneNum = dp_lane_count;13171317- else if (radeon_encoder->pixel_clock > 165000)13161316+ else if (radeon_dig_monitor_is_duallink(encoder, radeon_encoder->pixel_clock))13181317 args.v5.ucLaneNum = 8;13191318 else13201319 args.v5.ucLaneNum = 4;
+3-2
drivers/gpu/drm/radeon/cik.c
···30463046}3047304730483048/**30493049- * cik_select_se_sh - select which SE, SH to address30493049+ * cik_get_rb_disabled - computes the mask of disabled RBs30503050 *30513051 * @rdev: radeon_device pointer30523052 * @max_rb_num: max RBs (render backends) for the asic···79027902 /* init golden registers */79037903 cik_init_golden_registers(rdev);7904790479057905- radeon_pm_resume(rdev);79057905+ if (rdev->pm.pm_method == PM_METHOD_DPM)79067906+ radeon_pm_resume(rdev);7906790779077908 rdev->accel_working = true;79087909 r = cik_startup(rdev);
···15211521 if (r)15221522 DRM_ERROR("ib ring test failed (%d).\n", r);1523152315241524- if (rdev->pm.dpm_enabled) {15241524+ if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) {15251525 /* do dpm late init */15261526 r = radeon_pm_late_init(rdev);15271527 if (r) {15281528 rdev->pm.dpm_enabled = false;15291529 DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n");15301530 }15311531+ } else {15321532+ /* resume old pm late */15331533+ radeon_pm_resume(rdev);15311534 }1532153515331536 radeon_restore_bios_scratch_regs(rdev);
···169169 SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */170170 SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */171171 SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */172172+ SVGA_REG_COMMAND_LOW = 48, /* Lower 32 bits and submits commands */173173+ SVGA_REG_COMMAND_HIGH = 49, /* Upper 32 bits of command buffer PA */172174 SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, /* Max primary memory */173175 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, /* Suggested limit on mob mem */174176 SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */175175- SVGA_REG_TOP = 53, /* Must be 1 more than the last register */177177+ SVGA_REG_CMD_PREPEND_LOW = 53,178178+ SVGA_REG_CMD_PREPEND_HIGH = 54,179179+ SVGA_REG_SCREENTARGET_MAX_WIDTH = 55,180180+ SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56,181181+ SVGA_REG_MOB_MAX_SIZE = 57,182182+ SVGA_REG_TOP = 58, /* Must be 1 more than the last register */176183177184 SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */178185 /* Next 768 (== 256*3) registers exist for colormap */
···582582 int ret;583583 int len = i2c_hid_get_report_length(rep) - 2;584584585585- buf = kzalloc(len, GFP_KERNEL);585585+ buf = hid_alloc_report_buf(rep, GFP_KERNEL);586586 if (!buf)587587 return;588588
···7070 select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)7171 help7272 Say yes here to build support for STMicroelectronics gyroscopes:7373- L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330.7373+ L3G4200D, LSM330DL, L3GD20, LSM330DLC, L3G4IS, LSM330.74747575 This driver can also be built as a module. If so, these modules7676 will be created:
···103103/**104104 * cm32181_read_als_it() - Get sensor integration time (ms)105105 * @cm32181: pointer of struct cm32181106106- * @val: pointer of int to load the als_it value.106106+ * @val2: pointer of int to load the als_it value.107107 *108108 * Report the current integartion time by millisecond.109109 *110110- * Return: IIO_VAL_INT for success, otherwise -EINVAL.110110+ * Return: IIO_VAL_INT_PLUS_MICRO for success, otherwise -EINVAL.111111 */112112-static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val)112112+static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2)113113{114114 u16 als_it;115115 int i;···119119 als_it >>= CM32181_CMD_ALS_IT_SHIFT;120120 for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) {121121 if (als_it == als_it_bits[i]) {122122- *val = als_it_value[i];123123- return IIO_VAL_INT;122122+ *val2 = als_it_value[i];123123+ return IIO_VAL_INT_PLUS_MICRO;124124 }125125 }126126···221221 *val = cm32181->calibscale;222222 return IIO_VAL_INT;223223 case IIO_CHAN_INFO_INT_TIME:224224- ret = cm32181_read_als_it(cm32181, val);224224+ ret = cm32181_read_als_it(cm32181, val2);225225 return ret;226226 }227227···240240 cm32181->calibscale = val;241241 return val;242242 case IIO_CHAN_INFO_INT_TIME:243243- ret = cm32181_write_als_it(cm32181, val);243243+ ret = cm32181_write_als_it(cm32181, val2);244244 return ret;245245 }246246···264264265265 n = ARRAY_SIZE(als_it_value);266266 for (i = 0, len = 0; i < n; i++)267267- len += sprintf(buf + len, "%d ", als_it_value[i]);267267+ len += sprintf(buf + len, "0.%06u ", als_it_value[i]);268268 return len + sprintf(buf + len, "\n");269269}270270
+23-22
drivers/iio/light/cm36651.c
···5050#define CM36651_CS_CONF2_DEFAULT_BIT 0x0851515252/* CS_CONF3 channel integration time */5353-#define CM36651_CS_IT1 0x00 /* Integration time 80000 usec */5454-#define CM36651_CS_IT2 0x40 /* Integration time 160000 usec */5555-#define CM36651_CS_IT3 0x80 /* Integration time 320000 usec */5656-#define CM36651_CS_IT4 0xC0 /* Integration time 640000 usec */5353+#define CM36651_CS_IT1 0x00 /* Integration time 80 msec */5454+#define CM36651_CS_IT2 0x40 /* Integration time 160 msec */5555+#define CM36651_CS_IT3 0x80 /* Integration time 320 msec */5656+#define CM36651_CS_IT4 0xC0 /* Integration time 640 msec */57575858/* PS_CONF1 command code */5959#define CM36651_PS_ENABLE 0x00···6464#define CM36651_PS_PERS4 0x0C65656666/* PS_CONF1 command code: integration time */6767-#define CM36651_PS_IT1 0x00 /* Integration time 320 usec */6868-#define CM36651_PS_IT2 0x10 /* Integration time 420 usec */6969-#define CM36651_PS_IT3 0x20 /* Integration time 520 usec */7070-#define CM36651_PS_IT4 0x30 /* Integration time 640 usec */6767+#define CM36651_PS_IT1 0x00 /* Integration time 0.32 msec */6868+#define CM36651_PS_IT2 0x10 /* Integration time 0.42 msec */6969+#define CM36651_PS_IT3 0x20 /* Integration time 0.52 msec */7070+#define CM36651_PS_IT4 0x30 /* Integration time 0.64 msec */71717272/* PS_CONF1 command code: duty ratio */7373#define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */···9393#define CM36651_CLOSE_PROXIMITY 0x329494#define CM36651_FAR_PROXIMITY 0x3395959696-#define CM36651_CS_INT_TIME_AVAIL "80000 160000 320000 640000"9797-#define CM36651_PS_INT_TIME_AVAIL "320 420 520 640"9696+#define CM36651_CS_INT_TIME_AVAIL "0.08 0.16 0.32 0.64"9797+#define CM36651_PS_INT_TIME_AVAIL "0.000320 0.000420 0.000520 0.000640"98989999enum cm36651_operation_mode {100100 CM36651_LIGHT_EN,···356356}357357358358static int cm36651_read_int_time(struct cm36651_data *cm36651,359359- struct iio_chan_spec const *chan, int *val)359359+ struct iio_chan_spec const *chan, int *val2)360360{361361 switch (chan->type) {362362 case IIO_LIGHT:363363 if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1)364364- *val = 80000;364364+ *val2 = 80000;365365 else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2)366366- *val = 160000;366366+ *val2 = 160000;367367 else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3)368368- *val = 320000;368368+ *val2 = 320000;369369 else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4)370370- *val = 640000;370370+ *val2 = 640000;371371 else372372 return -EINVAL;373373 break;374374 case IIO_PROXIMITY:375375 if (cm36651->ps_int_time == CM36651_PS_IT1)376376- *val = 320;376376+ *val2 = 320;377377 else if (cm36651->ps_int_time == CM36651_PS_IT2)378378- *val = 420;378378+ *val2 = 420;379379 else if (cm36651->ps_int_time == CM36651_PS_IT3)380380- *val = 520;380380+ *val2 = 520;381381 else if (cm36651->ps_int_time == CM36651_PS_IT4)382382- *val = 640;382382+ *val2 = 640;383383 else384384 return -EINVAL;385385 break;···387387 return -EINVAL;388388 }389389390390- return IIO_VAL_INT;390390+ return IIO_VAL_INT_PLUS_MICRO;391391}392392393393static int cm36651_write_int_time(struct cm36651_data *cm36651,···459459 ret = cm36651_read_channel(cm36651, chan, val);460460 break;461461 case IIO_CHAN_INFO_INT_TIME:462462- ret = cm36651_read_int_time(cm36651, chan, val);462462+ *val = 0;463463+ ret = cm36651_read_int_time(cm36651, chan, val2);463464 break;464465 default:465466 ret = -EINVAL;···480479 int ret = -EINVAL;481480482481 if (mask == IIO_CHAN_INFO_INT_TIME) {483483- ret = cm36651_write_int_time(cm36651, chan, val);482482+ ret = cm36651_write_int_time(cm36651, chan, val2);484483 if (ret < 0)485484 dev_err(&client->dev, "Integration time write failed\n");486485 }
···515515 * one cpu (the interrupt code doesn't support it), so we just516516 * pick the first cpu we find in 'cpumask'.517517 */518518- cpu = cpumask_any(cpumask);518518+ cpu = cpumask_any_and(cpumask, cpu_online_mask);519519 thread = cpu_2_hwthread_id[cpu];520520521521 metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr);
+1-1
drivers/irqchip/irq-metag.c
···201201 * one cpu (the interrupt code doesn't support it), so we just202202 * pick the first cpu we find in 'cpumask'.203203 */204204- cpu = cpumask_any(cpumask);204204+ cpu = cpumask_any_and(cpumask, cpu_online_mask);205205 thread = cpu_2_hwthread_id[cpu];206206207207 metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)),
+19-3
drivers/irqchip/irq-orion.c
···111111static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc)112112{113113 struct irq_domain *d = irq_get_handler_data(irq);114114- struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, irq);114114+115115+ struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, 0);115116 u32 stat = readl_relaxed(gc->reg_base + ORION_BRIDGE_IRQ_CAUSE) &116117 gc->mask_cache;117118···122121 generic_handle_irq(irq_find_mapping(d, gc->irq_base + hwirq));123122 stat &= ~(1 << hwirq);124123 }124124+}125125+126126+/*127127+ * Bridge IRQ_CAUSE is asserted regardless of IRQ_MASK register.128128+ * To avoid interrupt events on stale irqs, we clear them before unmask.129129+ */130130+static unsigned int orion_bridge_irq_startup(struct irq_data *d)131131+{132132+ struct irq_chip_type *ct = irq_data_get_chip_type(d);133133+134134+ ct->chip.irq_ack(d);135135+ ct->chip.irq_unmask(d);136136+ return 0;125137}126138127139static int __init orion_bridge_irq_init(struct device_node *np,···157143 }158144159145 ret = irq_alloc_domain_generic_chips(domain, nrirqs, 1, np->name,160160- handle_level_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE);146146+ handle_edge_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE);161147 if (ret) {162148 pr_err("%s: unable to alloc irq domain gc\n", np->name);163149 return ret;···190176191177 gc->chip_types[0].regs.ack = ORION_BRIDGE_IRQ_CAUSE;192178 gc->chip_types[0].regs.mask = ORION_BRIDGE_IRQ_MASK;179179+ gc->chip_types[0].chip.irq_startup = orion_bridge_irq_startup;193180 gc->chip_types[0].chip.irq_ack = irq_gc_ack_clr_bit;194181 gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;195182 gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;196183197197- /* mask all interrupts */184184+ /* mask and clear all interrupts */198185 writel(0, gc->reg_base + ORION_BRIDGE_IRQ_MASK);186186+ writel(0, gc->reg_base + ORION_BRIDGE_IRQ_CAUSE);199187200188 irq_set_handler_data(irq, domain);201189 irq_set_chained_handler(irq, orion_bridge_irq_handler);
-10
drivers/md/Kconfig
···254254 ---help---255255 Provides thin provisioning and snapshots that share a data store.256256257257-config DM_DEBUG_BLOCK_STACK_TRACING258258- boolean "Keep stack trace of persistent data block lock holders"259259- depends on STACKTRACE_SUPPORT && DM_PERSISTENT_DATA260260- select STACKTRACE261261- ---help---262262- Enable this for messages that may help debug problems with the263263- block manager locking used by thin provisioning and caching.264264-265265- If unsure, say N.266266-267257config DM_CACHE268258 tristate "Cache target (EXPERIMENTAL)"269259 depends on BLK_DEV_DM
···16261626 /*16271627 * Only pass ioctls through if the device sizes match exactly.16281628 */16291629- if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT)16301630- r = scsi_verify_blk_ioctl(NULL, cmd);16291629+ if (!bdev || ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) {16301630+ int err = scsi_verify_blk_ioctl(NULL, cmd);16311631+ if (err)16321632+ r = err;16331633+ }1631163416321635 if (r == -ENOTCONN && !fatal_signal_pending(current))16331636 queue_work(kmultipathd, &m->process_queued_ios);
···991010#include "persistent-data/dm-block-manager.h"1111#include "persistent-data/dm-space-map.h"1212+#include "persistent-data/dm-space-map-metadata.h"12131313-#define THIN_METADATA_BLOCK_SIZE 40961414+#define THIN_METADATA_BLOCK_SIZE DM_SM_METADATA_BLOCK_SIZE14151516/*1617 * The metadata device is currently limited in size.1717- *1818- * We have one block of index, which can hold 255 index entries. Each1919- * index entry contains allocation info about 16k metadata blocks.2018 */2121-#define THIN_METADATA_MAX_SECTORS (255 * (1 << 14) * (THIN_METADATA_BLOCK_SIZE / (1 << SECTOR_SHIFT)))1919+#define THIN_METADATA_MAX_SECTORS DM_SM_METADATA_MAX_SECTORS22202321/*2422 * A metadata device larger than 16GB triggers a warning.···2426#define THIN_METADATA_MAX_SECTORS_WARNING (16 * (1024 * 1024 * 1024 >> SECTOR_SHIFT))25272628/*----------------------------------------------------------------*/2929+3030+/*3131+ * Thin metadata superblock flags.3232+ */3333+#define THIN_METADATA_NEEDS_CHECK_FLAG (1 << 0)27342835struct dm_pool_metadata;2936struct dm_thin_device;···164161 */165162bool dm_thin_changed_this_transaction(struct dm_thin_device *td);166163164164+bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd);165165+167166bool dm_thin_aborted_changes(struct dm_thin_device *td);168167169168int dm_thin_get_highest_mapped_block(struct dm_thin_device *td,···206201 dm_block_t threshold,207202 dm_sm_threshold_fn fn,208203 void *context);204204+205205+/*206206+ * Updates the superblock immediately.207207+ */208208+int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd);209209+bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd);209210210211/*----------------------------------------------------------------*/211212
+260-83
drivers/md/dm-thin.c
···130130struct dm_thin_new_mapping;131131132132/*133133- * The pool runs in 3 modes. Ordered in degraded order for comparisons.133133+ * The pool runs in 4 modes. Ordered in degraded order for comparisons.134134 */135135enum pool_mode {136136 PM_WRITE, /* metadata may be changed */137137+ PM_OUT_OF_DATA_SPACE, /* metadata may be changed, though data may not be allocated */137138 PM_READ_ONLY, /* metadata may not be changed */138139 PM_FAIL, /* all I/O fails */139140};···199198};200199201200static enum pool_mode get_pool_mode(struct pool *pool);202202-static void out_of_data_space(struct pool *pool);203201static void metadata_operation_failed(struct pool *pool, const char *op, int r);204202205203/*···226226227227 struct pool *pool;228228 struct dm_thin_device *td;229229+ bool requeue_mode:1;229230};230231231232/*----------------------------------------------------------------*/···370369 struct dm_thin_new_mapping *overwrite_mapping;371370};372371373373-static void __requeue_bio_list(struct thin_c *tc, struct bio_list *master)372372+static void requeue_bio_list(struct thin_c *tc, struct bio_list *master)374373{375374 struct bio *bio;376375 struct bio_list bios;376376+ unsigned long flags;377377378378 bio_list_init(&bios);379379+380380+ spin_lock_irqsave(&tc->pool->lock, flags);379381 bio_list_merge(&bios, master);380382 bio_list_init(master);383383+ spin_unlock_irqrestore(&tc->pool->lock, flags);381384382385 while ((bio = bio_list_pop(&bios))) {383386 struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook));···396391static void requeue_io(struct thin_c *tc)397392{398393 struct pool *pool = tc->pool;394394+395395+ requeue_bio_list(tc, &pool->deferred_bios);396396+ requeue_bio_list(tc, &pool->retry_on_resume_list);397397+}398398+399399+static void error_retry_list(struct pool *pool)400400+{401401+ struct bio *bio;399402 unsigned long flags;403403+ struct bio_list bios;404404+405405+ bio_list_init(&bios);400406401407 spin_lock_irqsave(&pool->lock, flags);402402- __requeue_bio_list(tc, &pool->deferred_bios);403403- __requeue_bio_list(tc, &pool->retry_on_resume_list);408408+ bio_list_merge(&bios, &pool->retry_on_resume_list);409409+ bio_list_init(&pool->retry_on_resume_list);404410 spin_unlock_irqrestore(&pool->lock, flags);411411+412412+ while ((bio = bio_list_pop(&bios)))413413+ bio_io_error(bio);405414}406415407416/*···944925 }945926}946927928928+static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);929929+947930static int alloc_data_block(struct thin_c *tc, dm_block_t *result)948931{949932 int r;950933 dm_block_t free_blocks;951934 struct pool *pool = tc->pool;952935953953- if (get_pool_mode(pool) != PM_WRITE)936936+ if (WARN_ON(get_pool_mode(pool) != PM_WRITE))954937 return -EINVAL;955938956939 r = dm_pool_get_free_block_count(pool->pmd, &free_blocks);···979958 }980959981960 if (!free_blocks) {982982- out_of_data_space(pool);961961+ set_pool_mode(pool, PM_OUT_OF_DATA_SPACE);983962 return -ENOSPC;984963 }985964 }···1009988 spin_unlock_irqrestore(&pool->lock, flags);1010989}1011990991991+static bool should_error_unserviceable_bio(struct pool *pool)992992+{993993+ enum pool_mode m = get_pool_mode(pool);994994+995995+ switch (m) {996996+ case PM_WRITE:997997+ /* Shouldn't get here */998998+ DMERR_LIMIT("bio unserviceable, yet pool is in PM_WRITE mode");999999+ return true;10001000+10011001+ case PM_OUT_OF_DATA_SPACE:10021002+ return pool->pf.error_if_no_space;10031003+10041004+ case PM_READ_ONLY:10051005+ case PM_FAIL:10061006+ return true;10071007+ default:10081008+ /* Shouldn't get here */10091009+ DMERR_LIMIT("bio unserviceable, yet pool has an unknown mode");10101010+ return true;10111011+ }10121012+}10131013+10121014static void handle_unserviceable_bio(struct pool *pool, struct bio *bio)10131015{10141014- /*10151015- * When pool is read-only, no cell locking is needed because10161016- * nothing is changing.10171017- */10181018- WARN_ON_ONCE(get_pool_mode(pool) != PM_READ_ONLY);10191019-10201020- if (pool->pf.error_if_no_space)10161016+ if (should_error_unserviceable_bio(pool))10211017 bio_io_error(bio);10221018 else10231019 retry_on_resume(bio);···10451007 struct bio *bio;10461008 struct bio_list bios;1047100910101010+ if (should_error_unserviceable_bio(pool)) {10111011+ cell_error(pool, cell);10121012+ return;10131013+ }10141014+10481015 bio_list_init(&bios);10491016 cell_release(pool, cell, &bios);1050101710511051- while ((bio = bio_list_pop(&bios)))10521052- handle_unserviceable_bio(pool, bio);10181018+ if (should_error_unserviceable_bio(pool))10191019+ while ((bio = bio_list_pop(&bios)))10201020+ bio_io_error(bio);10211021+ else10221022+ while ((bio = bio_list_pop(&bios)))10231023+ retry_on_resume(bio);10531024}1054102510551026static void process_discard(struct thin_c *tc, struct bio *bio)···13431296 }13441297}1345129812991299+static void process_bio_success(struct thin_c *tc, struct bio *bio)13001300+{13011301+ bio_endio(bio, 0);13021302+}13031303+13461304static void process_bio_fail(struct thin_c *tc, struct bio *bio)13471305{13481306 bio_io_error(bio);···13801328 struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook));13811329 struct thin_c *tc = h->tc;1382133013311331+ if (tc->requeue_mode) {13321332+ bio_endio(bio, DM_ENDIO_REQUEUE);13331333+ continue;13341334+ }13351335+13831336 /*13841337 * If we've got no free new_mapping structs, and processing13851338 * this bio might require one, we pause until there are some···14141357 bio_list_init(&pool->deferred_flush_bios);14151358 spin_unlock_irqrestore(&pool->lock, flags);1416135914171417- if (bio_list_empty(&bios) && !need_commit_due_to_time(pool))13601360+ if (bio_list_empty(&bios) &&13611361+ !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool)))14181362 return;1419136314201364 if (commit(pool)) {···1451139314521394/*----------------------------------------------------------------*/1453139513961396+struct noflush_work {13971397+ struct work_struct worker;13981398+ struct thin_c *tc;13991399+14001400+ atomic_t complete;14011401+ wait_queue_head_t wait;14021402+};14031403+14041404+static void complete_noflush_work(struct noflush_work *w)14051405+{14061406+ atomic_set(&w->complete, 1);14071407+ wake_up(&w->wait);14081408+}14091409+14101410+static void do_noflush_start(struct work_struct *ws)14111411+{14121412+ struct noflush_work *w = container_of(ws, struct noflush_work, worker);14131413+ w->tc->requeue_mode = true;14141414+ requeue_io(w->tc);14151415+ complete_noflush_work(w);14161416+}14171417+14181418+static void do_noflush_stop(struct work_struct *ws)14191419+{14201420+ struct noflush_work *w = container_of(ws, struct noflush_work, worker);14211421+ w->tc->requeue_mode = false;14221422+ complete_noflush_work(w);14231423+}14241424+14251425+static void noflush_work(struct thin_c *tc, void (*fn)(struct work_struct *))14261426+{14271427+ struct noflush_work w;14281428+14291429+ INIT_WORK(&w.worker, fn);14301430+ w.tc = tc;14311431+ atomic_set(&w.complete, 0);14321432+ init_waitqueue_head(&w.wait);14331433+14341434+ queue_work(tc->pool->wq, &w.worker);14351435+14361436+ wait_event(w.wait, atomic_read(&w.complete));14371437+}14381438+14391439+/*----------------------------------------------------------------*/14401440+14541441static enum pool_mode get_pool_mode(struct pool *pool)14551442{14561443 return pool->pf.mode;14571444}1458144514461446+static void notify_of_pool_mode_change(struct pool *pool, const char *new_mode)14471447+{14481448+ dm_table_event(pool->ti->table);14491449+ DMINFO("%s: switching pool to %s mode",14501450+ dm_device_name(pool->pool_md), new_mode);14511451+}14521452+14591453static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)14601454{14611461- int r;14621462- enum pool_mode old_mode = pool->pf.mode;14551455+ struct pool_c *pt = pool->ti->private;14561456+ bool needs_check = dm_pool_metadata_needs_check(pool->pmd);14571457+ enum pool_mode old_mode = get_pool_mode(pool);14581458+14591459+ /*14601460+ * Never allow the pool to transition to PM_WRITE mode if user14611461+ * intervention is required to verify metadata and data consistency.14621462+ */14631463+ if (new_mode == PM_WRITE && needs_check) {14641464+ DMERR("%s: unable to switch pool to write mode until repaired.",14651465+ dm_device_name(pool->pool_md));14661466+ if (old_mode != new_mode)14671467+ new_mode = old_mode;14681468+ else14691469+ new_mode = PM_READ_ONLY;14701470+ }14711471+ /*14721472+ * If we were in PM_FAIL mode, rollback of metadata failed. We're14731473+ * not going to recover without a thin_repair. So we never let the14741474+ * pool move out of the old mode.14751475+ */14761476+ if (old_mode == PM_FAIL)14771477+ new_mode = old_mode;1463147814641479 switch (new_mode) {14651480 case PM_FAIL:14661481 if (old_mode != new_mode)14671467- DMERR("%s: switching pool to failure mode",14681468- dm_device_name(pool->pool_md));14821482+ notify_of_pool_mode_change(pool, "failure");14691483 dm_pool_metadata_read_only(pool->pmd);14701484 pool->process_bio = process_bio_fail;14711485 pool->process_discard = process_bio_fail;14721486 pool->process_prepared_mapping = process_prepared_mapping_fail;14731487 pool->process_prepared_discard = process_prepared_discard_fail;14881488+14891489+ error_retry_list(pool);14741490 break;1475149114761492 case PM_READ_ONLY:14771493 if (old_mode != new_mode)14781478- DMERR("%s: switching pool to read-only mode",14791479- dm_device_name(pool->pool_md));14801480- r = dm_pool_abort_metadata(pool->pmd);14811481- if (r) {14821482- DMERR("%s: aborting transaction failed",14831483- dm_device_name(pool->pool_md));14841484- new_mode = PM_FAIL;14851485- set_pool_mode(pool, new_mode);14861486- } else {14871487- dm_pool_metadata_read_only(pool->pmd);14881488- pool->process_bio = process_bio_read_only;14891489- pool->process_discard = process_discard;14901490- pool->process_prepared_mapping = process_prepared_mapping_fail;14911491- pool->process_prepared_discard = process_prepared_discard_passdown;14921492- }14941494+ notify_of_pool_mode_change(pool, "read-only");14951495+ dm_pool_metadata_read_only(pool->pmd);14961496+ pool->process_bio = process_bio_read_only;14971497+ pool->process_discard = process_bio_success;14981498+ pool->process_prepared_mapping = process_prepared_mapping_fail;14991499+ pool->process_prepared_discard = process_prepared_discard_passdown;15001500+15011501+ error_retry_list(pool);15021502+ break;15031503+15041504+ case PM_OUT_OF_DATA_SPACE:15051505+ /*15061506+ * Ideally we'd never hit this state; the low water mark15071507+ * would trigger userland to extend the pool before we15081508+ * completely run out of data space. However, many small15091509+ * IOs to unprovisioned space can consume data space at an15101510+ * alarming rate. Adjust your low water mark if you're15111511+ * frequently seeing this mode.15121512+ */15131513+ if (old_mode != new_mode)15141514+ notify_of_pool_mode_change(pool, "out-of-data-space");15151515+ pool->process_bio = process_bio_read_only;15161516+ pool->process_discard = process_discard;15171517+ pool->process_prepared_mapping = process_prepared_mapping;15181518+ pool->process_prepared_discard = process_prepared_discard_passdown;14931519 break;1494152014951521 case PM_WRITE:14961522 if (old_mode != new_mode)14971497- DMINFO("%s: switching pool to write mode",14981498- dm_device_name(pool->pool_md));15231523+ notify_of_pool_mode_change(pool, "write");14991524 dm_pool_metadata_read_write(pool->pmd);15001525 pool->process_bio = process_bio;15011526 pool->process_discard = process_discard;···15881447 }1589144815901449 pool->pf.mode = new_mode;14501450+ /*14511451+ * The pool mode may have changed, sync it so bind_control_target()14521452+ * doesn't cause an unexpected mode transition on resume.14531453+ */14541454+ pt->adjusted_pf.mode = new_mode;15911455}1592145615931593-/*15941594- * Rather than calling set_pool_mode directly, use these which describe the15951595- * reason for mode degradation.15961596- */15971597-static void out_of_data_space(struct pool *pool)14571457+static void abort_transaction(struct pool *pool)15981458{15991599- DMERR_LIMIT("%s: no free data space available.",16001600- dm_device_name(pool->pool_md));16011601- set_pool_mode(pool, PM_READ_ONLY);14591459+ const char *dev_name = dm_device_name(pool->pool_md);14601460+14611461+ DMERR_LIMIT("%s: aborting current metadata transaction", dev_name);14621462+ if (dm_pool_abort_metadata(pool->pmd)) {14631463+ DMERR("%s: failed to abort metadata transaction", dev_name);14641464+ set_pool_mode(pool, PM_FAIL);14651465+ }14661466+14671467+ if (dm_pool_metadata_set_needs_check(pool->pmd)) {14681468+ DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name);14691469+ set_pool_mode(pool, PM_FAIL);14701470+ }16021471}1603147216041473static void metadata_operation_failed(struct pool *pool, const char *op, int r)16051474{16061606- dm_block_t free_blocks;16071607-16081475 DMERR_LIMIT("%s: metadata operation '%s' failed: error = %d",16091476 dm_device_name(pool->pool_md), op, r);1610147716111611- if (r == -ENOSPC &&16121612- !dm_pool_get_free_metadata_block_count(pool->pmd, &free_blocks) &&16131613- !free_blocks)16141614- DMERR_LIMIT("%s: no free metadata space available.",16151615- dm_device_name(pool->pool_md));16161616-14781478+ abort_transaction(pool);16171479 set_pool_mode(pool, PM_READ_ONLY);16181480}16191481···16661522 struct dm_cell_key key;1667152316681524 thin_hook_bio(tc, bio);15251525+15261526+ if (tc->requeue_mode) {15271527+ bio_endio(bio, DM_ENDIO_REQUEUE);15281528+ return DM_MAPIO_SUBMITTED;15291529+ }1669153016701531 if (get_pool_mode(tc->pool) == PM_FAIL) {16711532 bio_io_error(bio);···18351686 /*18361687 * We want to make sure that a pool in PM_FAIL mode is never upgraded.18371688 */18381838- enum pool_mode old_mode = pool->pf.mode;16891689+ enum pool_mode old_mode = get_pool_mode(pool);18391690 enum pool_mode new_mode = pt->adjusted_pf.mode;1840169118411692 /*···18481699 pool->ti = ti;18491700 pool->pf = pt->adjusted_pf;18501701 pool->low_water_blocks = pt->low_water_blocks;18511851-18521852- /*18531853- * If we were in PM_FAIL mode, rollback of metadata failed. We're18541854- * not going to recover without a thin_repair. So we never let the18551855- * pool move out of the old mode. On the other hand a PM_READ_ONLY18561856- * may have been due to a lack of metadata or data space, and may18571857- * now work (ie. if the underlying devices have been resized).18581858- */18591859- if (old_mode == PM_FAIL)18601860- new_mode = old_mode;1861170218621703 set_pool_mode(pool, new_mode);18631704···21381999 dm_table_event(pool->ti->table);21392000}2140200121412141-static sector_t get_metadata_dev_size(struct block_device *bdev)20022002+static sector_t get_dev_size(struct block_device *bdev)21422003{21432143- sector_t metadata_dev_size = i_size_read(bdev->bd_inode) >> SECTOR_SHIFT;20042004+ return i_size_read(bdev->bd_inode) >> SECTOR_SHIFT;20052005+}20062006+20072007+static void warn_if_metadata_device_too_big(struct block_device *bdev)20082008+{20092009+ sector_t metadata_dev_size = get_dev_size(bdev);21442010 char buffer[BDEVNAME_SIZE];2145201121462146- if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING) {20122012+ if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING)21472013 DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.",21482014 bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS);21492149- metadata_dev_size = THIN_METADATA_MAX_SECTORS_WARNING;21502150- }20152015+}20162016+20172017+static sector_t get_metadata_dev_size(struct block_device *bdev)20182018+{20192019+ sector_t metadata_dev_size = get_dev_size(bdev);20202020+20212021+ if (metadata_dev_size > THIN_METADATA_MAX_SECTORS)20222022+ metadata_dev_size = THIN_METADATA_MAX_SECTORS;2151202321522024 return metadata_dev_size;21532025}···21672017{21682018 sector_t metadata_dev_size = get_metadata_dev_size(bdev);2169201921702170- sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE >> SECTOR_SHIFT);20202020+ sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE);2171202121722022 return metadata_dev_size;21732023}···22452095 ti->error = "Error opening metadata block device";22462096 goto out_unlock;22472097 }22482248-22492249- /*22502250- * Run for the side-effect of possibly issuing a warning if the22512251- * device is too big.22522252- */22532253- (void) get_metadata_dev_size(metadata_dev->bdev);20982098+ warn_if_metadata_device_too_big(metadata_dev->bdev);2254209922552100 r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &data_dev);22562101 if (r) {···23912246 return -EINVAL;2392224723932248 } else if (data_size > sb_data_size) {22492249+ if (dm_pool_metadata_needs_check(pool->pmd)) {22502250+ DMERR("%s: unable to grow the data device until repaired.",22512251+ dm_device_name(pool->pool_md));22522252+ return 0;22532253+ }22542254+23942255 if (sb_data_size)23952256 DMINFO("%s: growing the data device from %llu to %llu blocks",23962257 dm_device_name(pool->pool_md),···24382287 return -EINVAL;2439228824402289 } else if (metadata_dev_size > sb_metadata_dev_size) {22902290+ if (dm_pool_metadata_needs_check(pool->pmd)) {22912291+ DMERR("%s: unable to grow the metadata device until repaired.",22922292+ dm_device_name(pool->pool_md));22932293+ return 0;22942294+ }22952295+22962296+ warn_if_metadata_device_too_big(pool->md_dev);24412297 DMINFO("%s: growing the metadata device from %llu to %llu blocks",24422298 dm_device_name(pool->pool_md),24432299 sb_metadata_dev_size, metadata_dev_size);···28312673 else28322674 DMEMIT("- ");2833267528342834- if (pool->pf.mode == PM_READ_ONLY)26762676+ if (pool->pf.mode == PM_OUT_OF_DATA_SPACE)26772677+ DMEMIT("out_of_data_space ");26782678+ else if (pool->pf.mode == PM_READ_ONLY)28352679 DMEMIT("ro ");28362680 else28372681 DMEMIT("rw ");···29472787 .name = "thin-pool",29482788 .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE |29492789 DM_TARGET_IMMUTABLE,29502950- .version = {1, 10, 0},27902790+ .version = {1, 11, 0},29512791 .module = THIS_MODULE,29522792 .ctr = pool_ctr,29532793 .dtr = pool_dtr,···3054289430552895 if (get_pool_mode(tc->pool) == PM_FAIL) {30562896 ti->error = "Couldn't open thin device, Pool is in fail mode";28972897+ r = -EINVAL;30572898 goto bad_thin_open;30582899 }30592900···3066290530672906 r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block);30682907 if (r)30693069- goto bad_thin_open;29082908+ goto bad_target_max_io_len;3070290930712910 ti->num_flush_bios = 1;30722911 ti->flush_supported = true;···3087292630882927 return 0;3089292829292929+bad_target_max_io_len:29302930+ dm_pool_close_thin_device(tc->td);30902931bad_thin_open:30912932 __pool_dec(tc->pool);30922933bad_pool_lookup:···31492986 return 0;31502987}3151298829892989+static void thin_presuspend(struct dm_target *ti)29902990+{29912991+ struct thin_c *tc = ti->private;29922992+29932993+ if (dm_noflush_suspending(ti))29942994+ noflush_work(tc, do_noflush_start);29952995+}29962996+31522997static void thin_postsuspend(struct dm_target *ti)31532998{31543154- if (dm_noflush_suspending(ti))31553155- requeue_io((struct thin_c *)ti->private);29992999+ struct thin_c *tc = ti->private;30003000+30013001+ /*30023002+ * The dm_noflush_suspending flag has been cleared by now, so30033003+ * unfortunately we must always run this.30043004+ */30053005+ noflush_work(tc, do_noflush_stop);31563006}3157300731583008/*···3250307432513075static struct target_type thin_target = {32523076 .name = "thin",32533253- .version = {1, 10, 0},30773077+ .version = {1, 11, 0},32543078 .module = THIS_MODULE,32553079 .ctr = thin_ctr,32563080 .dtr = thin_dtr,32573081 .map = thin_map,32583082 .end_io = thin_endio,30833083+ .presuspend = thin_presuspend,32593084 .postsuspend = thin_postsuspend,32603085 .status = thin_status,32613086 .iterate_devices = thin_iterate_devices,
+10
drivers/md/persistent-data/Kconfig
···66 ---help---77 Library providing immutable on-disk data structure support for88 device-mapper targets such as the thin provisioning target.99+1010+config DM_DEBUG_BLOCK_STACK_TRACING1111+ boolean "Keep stack trace of persistent data block lock holders"1212+ depends on STACKTRACE_SUPPORT && DM_PERSISTENT_DATA1313+ select STACKTRACE1414+ ---help---1515+ Enable this for messages that may help debug problems with the1616+ block manager locking used by thin provisioning and caching.1717+1818+ If unsure, say N.
···991010#include "dm-transaction-manager.h"11111212+#define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT)1313+1414+/*1515+ * The metadata device is currently limited in size.1616+ *1717+ * We have one block of index, which can hold 255 index entries. Each1818+ * index entry contains allocation info about ~16k metadata blocks.1919+ */2020+#define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64))2121+#define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE)2222+1223/*1324 * Unfortunately we have to use two-phase construction due to the cycle1425 * between the tm and sm.
+10-2
drivers/mfd/da9055-i2c.c
···5353 return 0;5454}55555656+/*5757+ * DO NOT change the device Ids. The naming is intentionally specific as both5858+ * the PMIC and CODEC parts of this chip are instantiated separately as I2C5959+ * devices (both have configurable I2C addresses, and are to all intents and6060+ * purposes separate). As a result there are specific DA9055 ids for PMIC6161+ * and CODEC, which must be different to operate together.6262+ */5663static struct i2c_device_id da9055_i2c_id[] = {5757- {"da9055", 0},6464+ {"da9055-pmic", 0},5865 { }5966};6767+MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);60686169static struct i2c_driver da9055_i2c_driver = {6270 .probe = da9055_i2c_probe,6371 .remove = da9055_i2c_remove,6472 .id_table = da9055_i2c_id,6573 .driver = {6666- .name = "da9055",7474+ .name = "da9055-pmic",6775 .owner = THIS_MODULE,6876 },6977};
···139139 This adds a specialized tap character device driver that is based140140 on the MAC-VLAN network interface, called macvtap. A macvtap device141141 can be added in the same way as a macvlan device, using 'type142142- macvlan', and then be accessed through the tap user space interface.142142+ macvtap', and then be accessed through the tap user space interface.143143144144 To compile this driver as a module, choose M here: the module145145 will be called macvtap.
···350350 u32 roce_drops_crc;351351};352352353353+/* A vlan-id of 0xFFFF must be used to clear transparent vlan-tagging */354354+#define BE_RESET_VLAN_TAG_ID 0xFFFF355355+353356struct be_vf_cfg {354357 unsigned char mac_addr[ETH_ALEN];355358 int if_handle;356359 int pmac_id;357357- u16 def_vid;358360 u16 vlan_tag;359361 u32 tx_rate;360362};
+48-38
drivers/net/ethernet/emulex/benet/be_main.c
···913913 return BE3_chip(adapter) && be_ipv6_exthdr_check(skb);914914}915915916916-static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,917917- struct sk_buff *skb,918918- bool *skip_hw_vlan)916916+static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter,917917+ struct sk_buff *skb,918918+ bool *skip_hw_vlan)919919{920920 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;921921 unsigned int eth_hdr_len;922922 struct iphdr *ip;923923-924924- /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or less925925- * may cause a transmit stall on that port. So the work-around is to926926- * pad short packets (<= 32 bytes) to a 36-byte length.927927- */928928- if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) {929929- if (skb_padto(skb, 36))930930- goto tx_drop;931931- skb->len = 36;932932- }933923934924 /* For padded packets, BE HW modifies tot_len field in IP header935925 * incorrecly when VLAN tag is inserted by HW.···949959 vlan_tx_tag_present(skb)) {950960 skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan);951961 if (unlikely(!skb))952952- goto tx_drop;962962+ goto err;953963 }954964955965 /* HW may lockup when VLAN HW tagging is requested on···971981 be_vlan_tag_tx_chk(adapter, skb)) {972982 skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan);973983 if (unlikely(!skb))974974- goto tx_drop;984984+ goto err;975985 }976986977987 return skb;978988tx_drop:979989 dev_kfree_skb_any(skb);990990+err:980991 return NULL;992992+}993993+994994+static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,995995+ struct sk_buff *skb,996996+ bool *skip_hw_vlan)997997+{998998+ /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or999999+ * less may cause a transmit stall on that port. So the work-around is10001000+ * to pad short packets (<= 32 bytes) to a 36-byte length.10011001+ */10021002+ if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) {10031003+ if (skb_padto(skb, 36))10041004+ return NULL;10051005+ skb->len = 36;10061006+ }10071007+10081008+ if (BEx_chip(adapter) || lancer_chip(adapter)) {10091009+ skb = be_lancer_xmit_workarounds(adapter, skb, skip_hw_vlan);10101010+ if (!skb)10111011+ return NULL;10121012+ }10131013+10141014+ return skb;9811015}98210169831017static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)···11711157 return status;11721158}1173115911601160+static void be_clear_promisc(struct be_adapter *adapter)11611161+{11621162+ adapter->promiscuous = false;11631163+ adapter->flags &= ~BE_FLAGS_VLAN_PROMISC;11641164+11651165+ be_cmd_rx_filter(adapter, IFF_PROMISC, OFF);11661166+}11671167+11741168static void be_set_rx_mode(struct net_device *netdev)11751169{11761170 struct be_adapter *adapter = netdev_priv(netdev);···1192117011931171 /* BE was previously in promiscuous mode; disable it */11941172 if (adapter->promiscuous) {11951195- adapter->promiscuous = false;11961196- be_cmd_rx_filter(adapter, IFF_PROMISC, OFF);11971197-11731173+ be_clear_promisc(adapter);11981174 if (adapter->vlans_added)11991175 be_vid_config(adapter);12001176 }···1307128713081288 if (vlan || qos) {13091289 vlan |= qos << VLAN_PRIO_SHIFT;13101310- if (vf_cfg->vlan_tag != vlan) {13111311- /* If this is new value, program it. Else skip. */13121312- vf_cfg->vlan_tag = vlan;12901290+ if (vf_cfg->vlan_tag != vlan)13131291 status = be_cmd_set_hsw_config(adapter, vlan, vf + 1,13141292 vf_cfg->if_handle, 0);13151315- }13161293 } else {13171294 /* Reset Transparent Vlan Tagging. */13181318- vf_cfg->vlan_tag = 0;13191319- vlan = vf_cfg->def_vid;13201320- status = be_cmd_set_hsw_config(adapter, vlan, vf + 1,13211321- vf_cfg->if_handle, 0);12951295+ status = be_cmd_set_hsw_config(adapter, BE_RESET_VLAN_TAG_ID,12961296+ vf + 1, vf_cfg->if_handle, 0);13221297 }1323129813241324-13251325- if (status)12991299+ if (!status)13001300+ vf_cfg->vlan_tag = vlan;13011301+ else13261302 dev_info(&adapter->pdev->dev,13271327- "VLAN %d config on VF %d failed\n", vlan, vf);13031303+ "VLAN %d config on VF %d failed\n", vlan, vf);13281304 return status;13291305}13301306···3029301330303014static int be_vf_setup(struct be_adapter *adapter)30313015{30323032- struct be_vf_cfg *vf_cfg;30333033- u16 def_vlan, lnk_speed;30343034- int status, old_vfs, vf;30353016 struct device *dev = &adapter->pdev->dev;30173017+ struct be_vf_cfg *vf_cfg;30183018+ int status, old_vfs, vf;30363019 u32 privileges;30203020+ u16 lnk_speed;3037302130383022 old_vfs = pci_num_vf(adapter->pdev);30393023 if (old_vfs) {···30993083 NULL, vf + 1);31003084 if (!status)31013085 vf_cfg->tx_rate = lnk_speed;31023102-31033103- status = be_cmd_get_hsw_config(adapter, &def_vlan,31043104- vf + 1, vf_cfg->if_handle, NULL);31053105- if (status)31063106- goto err;31073107- vf_cfg->def_vid = def_vlan;3108308631093087 if (!old_vfs)31103088 be_cmd_enable_vf(adapter, vf + 1);
+9-8
drivers/net/ethernet/freescale/fec_main.c
···389389 netdev_err(ndev, "Tx DMA memory map failed\n");390390 return NETDEV_TX_OK;391391 }392392- /* Send it on its way. Tell FEC it's ready, interrupt when done,393393- * it's the last BD of the frame, and to put the CRC on the end.394394- */395395- status |= (BD_ENET_TX_READY | BD_ENET_TX_INTR396396- | BD_ENET_TX_LAST | BD_ENET_TX_TC);397397- bdp->cbd_sc = status;398392399393 if (fep->bufdesc_ex) {400394···409415 ebdp->cbd_esc |= BD_ENET_TX_PINS;410416 }411417 }418418+419419+ /* Send it on its way. Tell FEC it's ready, interrupt when done,420420+ * it's the last BD of the frame, and to put the CRC on the end.421421+ */422422+ status |= (BD_ENET_TX_READY | BD_ENET_TX_INTR423423+ | BD_ENET_TX_LAST | BD_ENET_TX_TC);424424+ bdp->cbd_sc = status;412425413426 bdp_pre = fec_enet_get_prevdesc(bdp, fep);414427 if ((id_entry->driver_data & FEC_QUIRK_ERR006358) &&···17791778 struct fec_enet_private *fep = netdev_priv(ndev);17801779 int ret;1781178017821782- napi_enable(&fep->napi);17831783-17841781 /* I should reset the ring buffers here, but I don't yet know17851782 * a simple way to do that.17861783 */···17931794 fec_enet_free_buffers(ndev);17941795 return ret;17951796 }17971797+17981798+ napi_enable(&fep->napi);17961799 phy_start(fep->phy_dev);17971800 netif_start_queue(ndev);17981801 fep->opened = 1;
···619619620620static u16621621ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb,622622- void *accel_priv)622622+ void *accel_priv, select_queue_fallback_t fallback)623623{624624 /* we are currently only using the first queue */625625 return 0;
+3-3
drivers/net/ethernet/marvell/Kconfig
···4343 This driver is used by the MV643XX_ETH and MVNETA drivers.44444545config MVNETA4646- tristate "Marvell Armada 370/XP network interface support"4747- depends on MACH_ARMADA_370_XP4646+ tristate "Marvell Armada 370/38x/XP network interface support"4747+ depends on PLAT_ORION4848 select MVMDIO4949 ---help---5050 This driver supports the network interface units in the5151- Marvell ARMADA XP and ARMADA 370 SoC family.5151+ Marvell ARMADA XP, ARMADA 370 and ARMADA 38x SoC family.52525353 Note that this driver is distinct from the mv643xx_eth5454 driver, which should be used for the older Marvell SoCs
···71187118 }7119711971207120 mutex_init(&tp->wk.mutex);71217121+ u64_stats_init(&tp->rx_stats.syncp);71227122+ u64_stats_init(&tp->tx_stats.syncp);7121712371227124 /* Get MAC address */71237125 for (i = 0; i < ETH_ALEN; i++)
+7
drivers/net/ethernet/sfc/ptp.c
···16681668 struct efx_ptp_data *ptp = efx->ptp_data;16691669 int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE);1670167016711671+ if (!ptp) {16721672+ if (net_ratelimit())16731673+ netif_warn(efx, drv, efx->net_dev,16741674+ "Received PTP event but PTP not set up\n");16751675+ return;16761676+ }16771677+16711678 if (!ptp->enabled)16721679 return;16731680
+11
drivers/net/ethernet/stmicro/stmmac/Kconfig
···3737 stmmac device driver. This driver is used for A20/A313838 GMAC ethernet controller.39394040+config DWMAC_STI4141+ bool "STi GMAC support"4242+ depends on STMMAC_PLATFORM && ARCH_STI4343+ default y4444+ ---help---4545+ Support for ethernet controller on STi SOCs.4646+4747+ This selects STi SoC glue layer support for the stmmac4848+ device driver. This driver is used on for the STi series4949+ SOCs GMAC ethernet controller.5050+4051config STMMAC_PCI4152 bool "STMMAC PCI bus support"4253 depends on STMMAC_ETH && PCI
···554554 * common for both the interface as the interface shares555555 * the same hardware resource.556556 */557557- for (i = 0; i <= priv->data.slaves; i++)557557+ for (i = 0; i < priv->data.slaves; i++)558558 if (priv->slaves[i].ndev->flags & IFF_PROMISC)559559 flag = true;560560···578578 unsigned long timeout = jiffies + HZ;579579580580 /* Disable Learn for all ports */581581- for (i = 0; i <= priv->data.slaves; i++) {581581+ for (i = 0; i < priv->data.slaves; i++) {582582 cpsw_ale_control_set(ale, i,583583 ALE_PORT_NOLEARN, 1);584584 cpsw_ale_control_set(ale, i,···606606 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0);607607608608 /* Enable Learn for all ports */609609- for (i = 0; i <= priv->data.slaves; i++) {609609+ for (i = 0; i < priv->data.slaves; i++) {610610 cpsw_ale_control_set(ale, i,611611 ALE_PORT_NOLEARN, 0);612612 cpsw_ale_control_set(ale, i,···1164116411651165static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv)11661166{11671167+ u32 slave_port;11681168+11691169+ slave_port = cpsw_get_slave_port(priv, slave->slave_num);11701170+11671171 if (!slave->phy)11681172 return;11691173 phy_stop(slave->phy);11701174 phy_disconnect(slave->phy);11711175 slave->phy = NULL;11761176+ cpsw_ale_control_set(priv->ale, slave_port,11771177+ ALE_PORT_STATE, ALE_PORT_STATE_DISABLE);11721178}1173117911741180static int cpsw_ndo_open(struct net_device *ndev)···19021896 memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);1903189719041898 slave_data->phy_if = of_get_phy_mode(slave_node);18991899+ if (slave_data->phy_if < 0) {19001900+ pr_err("Missing or malformed slave[%d] phy-mode property\n",19011901+ i);19021902+ return slave_data->phy_if;19031903+ }1905190419061905 if (data->dual_emac) {19071906 if (of_property_read_u32(slave_node, "dual_emac_res_vlan",
+1-1
drivers/net/ethernet/tile/tilegx.c
···2071207120722072/* Return subqueue id on this core (one per core). */20732073static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb,20742074- void *accel_priv)20742074+ void *accel_priv, select_queue_fallback_t fallback)20752075{20762076 return smp_processor_id();20772077}
···916916 int err;917917 int lpa;918918 int lpagb = 0;919919+ int common_adv;920920+ int common_adv_gb = 0;919921920922 /* Update the link, but return if there was an error */921923 err = genphy_update_link(phydev);···939937940938 phydev->lp_advertising =941939 mii_stat1000_to_ethtool_lpa_t(lpagb);942942- lpagb &= adv << 2;940940+ common_adv_gb = lpagb & adv << 2;943941 }944942945943 lpa = phy_read(phydev, MII_LPA);···952950 if (adv < 0)953951 return adv;954952955955- lpa &= adv;953953+ common_adv = lpa & adv;956954957955 phydev->speed = SPEED_10;958956 phydev->duplex = DUPLEX_HALF;959957 phydev->pause = 0;960958 phydev->asym_pause = 0;961959962962- if (lpagb & (LPA_1000FULL | LPA_1000HALF)) {960960+ if (common_adv_gb & (LPA_1000FULL | LPA_1000HALF)) {963961 phydev->speed = SPEED_1000;964962965965- if (lpagb & LPA_1000FULL)963963+ if (common_adv_gb & LPA_1000FULL)966964 phydev->duplex = DUPLEX_FULL;967967- } else if (lpa & (LPA_100FULL | LPA_100HALF)) {965965+ } else if (common_adv & (LPA_100FULL | LPA_100HALF)) {968966 phydev->speed = SPEED_100;969967970970- if (lpa & LPA_100FULL)968968+ if (common_adv & LPA_100FULL)971969 phydev->duplex = DUPLEX_FULL;972970 } else973973- if (lpa & LPA_10FULL)971971+ if (common_adv & LPA_10FULL)974972 phydev->duplex = DUPLEX_FULL;975973976974 if (phydev->duplex == DUPLEX_FULL) {
+1-1
drivers/net/team/team.c
···16481648}1649164916501650static u16 team_select_queue(struct net_device *dev, struct sk_buff *skb,16511651- void *accel_priv)16511651+ void *accel_priv, select_queue_fallback_t fallback)16521652{16531653 /*16541654 * This helper function exists to help dev_pick_tx get the correct
···296296 tristate "CoreChip-sz SR9800 based USB 2.0 10/100 ethernet devices"297297 depends on USB_USBNET298298 select CRC32299299- default y300299 ---help---301300 Say Y if you want to use one of the following 100Mbps USB Ethernet302301 device based on the CoreChip-sz SR9800 chip.
···8484 u32 size;8585 u32 count;86868787+ /* This check is no longer done by usbnet */8888+ if (skb->len < dev->net->hard_header_len)8989+ return 0;9090+8791 header = (struct gl_header *) skb->data;88928993 // get the packet count of the received skb
+3-2
drivers/net/usb/mcs7830.c
···526526{527527 u8 status;528528529529- if (skb->len == 0) {530530- dev_err(&dev->udev->dev, "unexpected empty rx frame\n");529529+ /* This check is no longer done by usbnet */530530+ if (skb->len < dev->net->hard_header_len) {531531+ dev_err(&dev->udev->dev, "unexpected tiny rx frame\n");531532 return 0;532533 }533534
+4
drivers/net/usb/net1080.c
···364364 struct nc_trailer *trailer;365365 u16 hdr_len, packet_len;366366367367+ /* This check is no longer done by usbnet */368368+ if (skb->len < dev->net->hard_header_len)369369+ return 0;370370+367371 if (!(skb->len & 0x01)) {368372 netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n",369373 skb->len, dev->net->hard_header_len, dev->hard_mtu,
+5-4
drivers/net/usb/qmi_wwan.c
···8080{8181 __be16 proto;82828383- /* usbnet rx_complete guarantees that skb->len is at least8484- * hard_header_len, so we can inspect the dest address without8585- * checking skb->len8686- */8383+ /* This check is no longer done by usbnet */8484+ if (skb->len < dev->net->hard_header_len)8585+ return 0;8686+8787 switch (skb->data[0] & 0xf0) {8888 case 0x40:8989 proto = htons(ETH_P_IP);···732732 {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */733733 {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */734734 {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */735735+ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */735736736737 /* 4. Gobi 1000 devices */737738 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+4
drivers/net/usb/rndis_host.c
···492492 */493493int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)494494{495495+ /* This check is no longer done by usbnet */496496+ if (skb->len < dev->net->hard_header_len)497497+ return 0;498498+495499 /* peripheral may have batched packets to us... */496500 while (likely(skb->len)) {497501 struct rndis_data_hdr *hdr = (void *)skb->data;
+4
drivers/net/usb/smsc75xx.c
···2106210621072107static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)21082108{21092109+ /* This check is no longer done by usbnet */21102110+ if (skb->len < dev->net->hard_header_len)21112111+ return 0;21122112+21092113 while (skb->len > 0) {21102114 u32 rx_cmd_a, rx_cmd_b, align_count, size;21112115 struct sk_buff *ax_skb;
+4
drivers/net/usb/smsc95xx.c
···1723172317241724static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)17251725{17261726+ /* This check is no longer done by usbnet */17271727+ if (skb->len < dev->net->hard_header_len)17281728+ return 0;17291729+17261730 while (skb->len > 0) {17271731 u32 header, align_count;17281732 struct sk_buff *ax_skb;
+5-1
drivers/net/usb/sr9800.c
···6363{6464 int offset = 0;65656666+ /* This check is no longer done by usbnet */6767+ if (skb->len < dev->net->hard_header_len)6868+ return 0;6969+6670 while (offset + sizeof(u32) < skb->len) {6771 struct sk_buff *sr_skb;6872 u16 size;···827823 dev->rx_urb_size =828824 SR9800_BULKIN_SIZE[SR9800_MAX_BULKIN_2K].size;829825 }830830- netdev_dbg(dev->net, "%s : setting rx_urb_size with : %ld\n", __func__,826826+ netdev_dbg(dev->net, "%s : setting rx_urb_size with : %zu\n", __func__,831827 dev->rx_urb_size);832828 return 0;833829
+10-15
drivers/net/usb/usbnet.c
···542542 }543543 // else network stack removes extra byte if we forced a short packet544544545545- if (skb->len) {546546- /* all data was already cloned from skb inside the driver */547547- if (dev->driver_info->flags & FLAG_MULTI_PACKET)548548- dev_kfree_skb_any(skb);549549- else550550- usbnet_skb_return(dev, skb);545545+ /* all data was already cloned from skb inside the driver */546546+ if (dev->driver_info->flags & FLAG_MULTI_PACKET)547547+ goto done;548548+549549+ if (skb->len < ETH_HLEN) {550550+ dev->net->stats.rx_errors++;551551+ dev->net->stats.rx_length_errors++;552552+ netif_dbg(dev, rx_err, dev->net, "rx length %d\n", skb->len);553553+ } else {554554+ usbnet_skb_return(dev, skb);551555 return;552556 }553557554554- netif_dbg(dev, rx_err, dev->net, "drop\n");555555- dev->net->stats.rx_errors++;556558done:557559 skb_queue_tail(&dev->done, skb);558560}···576574 switch (urb_status) {577575 /* success */578576 case 0:579579- if (skb->len < dev->net->hard_header_len) {580580- state = rx_cleanup;581581- dev->net->stats.rx_errors++;582582- dev->net->stats.rx_length_errors++;583583- netif_dbg(dev, rx_err, dev->net,584584- "rx length %d\n", skb->len);585585- }586577 break;587578588579 /* stalls need manual reset. this is rare ... except that
···17111711 /* If we can receive ANY GSO packets, we must allocate large ones. */17121712 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||17131713 virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) ||17141714- virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN))17141714+ virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) ||17151715+ virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO))17151716 vi->big_packets = true;1716171717171718 if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
···732732 return NULL;733733734734 /*735735- * mark descriptor as zero-length and set the 'more'736736- * flag to ensure that both buffers get discarded735735+ * Re-check previous descriptor, in case it has been filled736736+ * in the mean time.737737 */738738- rs->rs_datalen = 0;739739- rs->rs_more = true;738738+ ret = ath9k_hw_rxprocdesc(ah, ds, rs);739739+ if (ret == -EINPROGRESS) {740740+ /*741741+ * mark descriptor as zero-length and set the 'more'742742+ * flag to ensure that both buffers get discarded743743+ */744744+ rs->rs_datalen = 0;745745+ rs->rs_more = true;746746+ }740747 }741748742749 list_del(&bf->list);···992985 struct ath_common *common = ath9k_hw_common(ah);993986 struct ieee80211_hdr *hdr;994987 bool discard_current = sc->rx.discard_next;995995- int ret = 0;996988997989 /*998990 * Discard corrupt descriptors which are marked in999991 * ath_get_next_rx_buf().1000992 */10011001- sc->rx.discard_next = rx_stats->rs_more;1002993 if (discard_current)10031003- return -EINVAL;994994+ goto corrupt;995995+996996+ sc->rx.discard_next = false;10049971005998 /*1006999 * Discard zero-length packets.10071000 */10081001 if (!rx_stats->rs_datalen) {10091002 RX_STAT_INC(rx_len_err);10101010- return -EINVAL;10031003+ goto corrupt;10111004 }1012100510131013- /*10141014- * rs_status follows rs_datalen so if rs_datalen is too large10151015- * we can take a hint that hardware corrupted it, so ignore10161016- * those frames.10171017- */10061006+ /*10071007+ * rs_status follows rs_datalen so if rs_datalen is too large10081008+ * we can take a hint that hardware corrupted it, so ignore10091009+ * those frames.10101010+ */10181011 if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) {10191012 RX_STAT_INC(rx_len_err);10201020- return -EINVAL;10131013+ goto corrupt;10211014 }1022101510231016 /* Only use status info from the last fragment */···10311024 * This is different from the other corrupt descriptor10321025 * condition handled above.10331026 */10341034- if (rx_stats->rs_status & ATH9K_RXERR_CORRUPT_DESC) {10351035- ret = -EINVAL;10361036- goto exit;10371037- }10271027+ if (rx_stats->rs_status & ATH9K_RXERR_CORRUPT_DESC)10281028+ goto corrupt;1038102910391030 hdr = (struct ieee80211_hdr *) (skb->data + ah->caps.rx_status_len);10401031···10481043 if (ath_process_fft(sc, hdr, rx_stats, rx_status->mactime))10491044 RX_STAT_INC(rx_spectral);1050104510511051- ret = -EINVAL;10521052- goto exit;10461046+ return -EINVAL;10531047 }1054104810551049 /*10561050 * everything but the rate is checked here, the rate check is done10571051 * separately to avoid doing two lookups for a rate for each frame.10581052 */10591059- if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) {10601060- ret = -EINVAL;10611061- goto exit;10621062- }10531053+ if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error))10541054+ return -EINVAL;1063105510641056 if (ath_is_mybeacon(common, hdr)) {10651057 RX_STAT_INC(rx_beacons);···10661064 /*10671065 * This shouldn't happen, but have a safety check anyway.10681066 */10691069- if (WARN_ON(!ah->curchan)) {10701070- ret = -EINVAL;10711071- goto exit;10721072- }10671067+ if (WARN_ON(!ah->curchan))10681068+ return -EINVAL;1073106910741074- if (ath9k_process_rate(common, hw, rx_stats, rx_status)) {10751075- ret =-EINVAL;10761076- goto exit;10771077- }10701070+ if (ath9k_process_rate(common, hw, rx_stats, rx_status))10711071+ return -EINVAL;1078107210791073 ath9k_process_rssi(common, hw, rx_stats, rx_status);10801074···10851087 sc->rx.num_pkts++;10861088#endif1087108910881088-exit:10891089- sc->rx.discard_next = false;10901090- return ret;10901090+ return 0;10911091+10921092+corrupt:10931093+ sc->rx.discard_next = rx_stats->rs_more;10941094+ return -EINVAL;10911095}1092109610931097static void ath9k_rx_skb_postprocess(struct ath_common *common,
+8-5
drivers/net/wireless/ath/ath9k/xmit.c
···14441444 for (tidno = 0, tid = &an->tid[tidno];14451445 tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {1446144614471447- if (!tid->sched)14481448- continue;14491449-14501447 ac = tid->ac;14511448 txq = ac->txq;1452144914531450 ath_txq_lock(sc, txq);14511451+14521452+ if (!tid->sched) {14531453+ ath_txq_unlock(sc, txq);14541454+ continue;14551455+ }1454145614551457 buffered = ath_tid_has_buffered(tid);14561458···21862184 txq->stopped = true;21872185 }2188218621872187+ if (txctl->an)21882188+ tid = ath_get_skb_tid(sc, txctl->an, skb);21892189+21892190 if (info->flags & IEEE80211_TX_CTL_PS_RESPONSE) {21902191 ath_txq_unlock(sc, txq);21912192 txq = sc->tx.uapsdq;21922193 ath_txq_lock(sc, txq);21932194 } else if (txctl->an &&21942195 ieee80211_is_data_present(hdr->frame_control)) {21952195- tid = ath_get_skb_tid(sc, txctl->an, skb);21962196-21972196 WARN_ON(tid->ac->txq != txctl->txq);2198219721992198 if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
···12911291 struct iwl_compressed_ba_resp *ba_resp = (void *)pkt->data;12921292 struct iwl_ht_agg *agg;12931293 struct sk_buff_head reclaimed_skbs;12941294- struct ieee80211_tx_info *info;12951295- struct ieee80211_hdr *hdr;12961294 struct sk_buff *skb;12971295 int sta_id;12981296 int tid;···13771379 freed = 0;1378138013791381 skb_queue_walk(&reclaimed_skbs, skb) {13801380- hdr = (struct ieee80211_hdr *)skb->data;13821382+ struct ieee80211_hdr *hdr = (void *)skb->data;13831383+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);1381138413821385 if (ieee80211_is_data_qos(hdr->frame_control))13831386 freed++;13841387 else13851388 WARN_ON_ONCE(1);1386138913871387- info = IEEE80211_SKB_CB(skb);13881390 iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]);13911391+13921392+ memset(&info->status, 0, sizeof(info->status));13931393+ /* Packet was transmitted successfully, failures come as single13941394+ * frames because before failing a frame the firmware transmits13951395+ * it without aggregation at least once.13961396+ */13971397+ info->flags |= IEEE80211_TX_STAT_ACK;1389139813901399 if (freed == 1) {13911400 /* this is the first skb we deliver in this batch */13921401 /* put the rate scaling data there */13931402 info = IEEE80211_SKB_CB(skb);13941403 memset(&info->status, 0, sizeof(info->status));13951395- info->flags |= IEEE80211_TX_STAT_ACK;13961404 info->flags |= IEEE80211_TX_STAT_AMPDU;13971405 info->status.ampdu_ack_len = ba_resp->txed_2_done;13981406 info->status.ampdu_len = ba_resp->txed;
···937937 bool is92c;938938 int err;939939 u8 tmp_u1b;940940+ unsigned long flags;940941941942 rtlpci->being_init_adapter = true;943943+944944+ /* Since this function can take a very long time (up to 350 ms)945945+ * and can be called with irqs disabled, reenable the irqs946946+ * to let the other devices continue being serviced.947947+ *948948+ * It is safe doing so since our own interrupts will only be enabled949949+ * in a subsequent step.950950+ */951951+ local_save_flags(flags);952952+ local_irq_enable();953953+942954 rtlpriv->intf_ops->disable_aspm(hw);943955 rtstatus = _rtl92ce_init_mac(hw);944956 if (!rtstatus) {945957 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n");946958 err = 1;947947- return err;959959+ goto exit;948960 }949961950962 err = rtl92c_download_fw(hw);···964952 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,965953 "Failed to download FW. Init HW without FW now..\n");966954 err = 1;967967- return err;955955+ goto exit;968956 }969957970958 rtlhal->last_hmeboxnum = 0;···10441032 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "under 1.5V\n");10451033 }10461034 rtl92c_dm_init(hw);10351035+exit:10361036+ local_irq_restore(flags);10471037 rtlpci->being_init_adapter = false;10481038 return err;10491039}
+1
drivers/net/xen-netfront.c
···907907908908 /* Ethernet work: Delayed to here as it peeks the header. */909909 skb->protocol = eth_type_trans(skb, dev);910910+ skb_reset_network_header(skb);910911911912 if (checksum_setup(dev, skb)) {912913 kfree_skb(skb);
+74-76
drivers/of/base.c
···342342}343343EXPORT_SYMBOL(of_get_cpu_node);344344345345-/** Checks if the given "compat" string matches one of the strings in346346- * the device's "compatible" property345345+/**346346+ * __of_device_is_compatible() - Check if the node matches given constraints347347+ * @device: pointer to node348348+ * @compat: required compatible string, NULL or "" for any match349349+ * @type: required device_type value, NULL or "" for any match350350+ * @name: required node name, NULL or "" for any match351351+ *352352+ * Checks if the given @compat, @type and @name strings match the353353+ * properties of the given @device. A constraints can be skipped by354354+ * passing NULL or an empty string as the constraint.355355+ *356356+ * Returns 0 for no match, and a positive integer on match. The return357357+ * value is a relative score with larger values indicating better358358+ * matches. The score is weighted for the most specific compatible value359359+ * to get the highest score. Matching type is next, followed by matching360360+ * name. Practically speaking, this results in the following priority361361+ * order for matches:362362+ *363363+ * 1. specific compatible && type && name364364+ * 2. specific compatible && type365365+ * 3. specific compatible && name366366+ * 4. specific compatible367367+ * 5. general compatible && type && name368368+ * 6. general compatible && type369369+ * 7. general compatible && name370370+ * 8. general compatible371371+ * 9. type && name372372+ * 10. type373373+ * 11. name347374 */348375static int __of_device_is_compatible(const struct device_node *device,349349- const char *compat)376376+ const char *compat, const char *type, const char *name)350377{351351- const char* cp;352352- int cplen, l;378378+ struct property *prop;379379+ const char *cp;380380+ int index = 0, score = 0;353381354354- cp = __of_get_property(device, "compatible", &cplen);355355- if (cp == NULL)356356- return 0;357357- while (cplen > 0) {358358- if (of_compat_cmp(cp, compat, strlen(compat)) == 0)359359- return 1;360360- l = strlen(cp) + 1;361361- cp += l;362362- cplen -= l;382382+ /* Compatible match has highest priority */383383+ if (compat && compat[0]) {384384+ prop = __of_find_property(device, "compatible", NULL);385385+ for (cp = of_prop_next_string(prop, NULL); cp;386386+ cp = of_prop_next_string(prop, cp), index++) {387387+ if (of_compat_cmp(cp, compat, strlen(compat)) == 0) {388388+ score = INT_MAX/2 - (index << 2);389389+ break;390390+ }391391+ }392392+ if (!score)393393+ return 0;363394 }364395365365- return 0;396396+ /* Matching type is better than matching name */397397+ if (type && type[0]) {398398+ if (!device->type || of_node_cmp(type, device->type))399399+ return 0;400400+ score += 2;401401+ }402402+403403+ /* Matching name is a bit better than not */404404+ if (name && name[0]) {405405+ if (!device->name || of_node_cmp(name, device->name))406406+ return 0;407407+ score++;408408+ }409409+410410+ return score;366411}367412368413/** Checks if the given "compat" string matches one of the strings in···420375 int res;421376422377 raw_spin_lock_irqsave(&devtree_lock, flags);423423- res = __of_device_is_compatible(device, compat);378378+ res = __of_device_is_compatible(device, compat, NULL, NULL);424379 raw_spin_unlock_irqrestore(&devtree_lock, flags);425380 return res;426381}···726681 raw_spin_lock_irqsave(&devtree_lock, flags);727682 np = from ? from->allnext : of_allnodes;728683 for (; np; np = np->allnext) {729729- if (type730730- && !(np->type && (of_node_cmp(np->type, type) == 0)))731731- continue;732732- if (__of_device_is_compatible(np, compatible) &&684684+ if (__of_device_is_compatible(np, compatible, type, NULL) &&733685 of_node_get(np))734686 break;735687 }···772730}773731EXPORT_SYMBOL(of_find_node_with_property);774732775775-static const struct of_device_id *776776-of_match_compatible(const struct of_device_id *matches,777777- const struct device_node *node)778778-{779779- const char *cp;780780- int cplen, l;781781- const struct of_device_id *m;782782-783783- cp = __of_get_property(node, "compatible", &cplen);784784- while (cp && (cplen > 0)) {785785- m = matches;786786- while (m->name[0] || m->type[0] || m->compatible[0]) {787787- /* Only match for the entries without type and name */788788- if (m->name[0] || m->type[0] ||789789- of_compat_cmp(m->compatible, cp,790790- strlen(m->compatible)))791791- m++;792792- else793793- return m;794794- }795795-796796- /* Get node's next compatible string */797797- l = strlen(cp) + 1;798798- cp += l;799799- cplen -= l;800800- }801801-802802- return NULL;803803-}804804-805733static806734const struct of_device_id *__of_match_node(const struct of_device_id *matches,807735 const struct device_node *node)808736{809809- const struct of_device_id *m;737737+ const struct of_device_id *best_match = NULL;738738+ int score, best_score = 0;810739811740 if (!matches)812741 return NULL;813742814814- m = of_match_compatible(matches, node);815815- if (m)816816- return m;817817-818818- while (matches->name[0] || matches->type[0] || matches->compatible[0]) {819819- int match = 1;820820- if (matches->name[0])821821- match &= node->name822822- && !strcmp(matches->name, node->name);823823- if (matches->type[0])824824- match &= node->type825825- && !strcmp(matches->type, node->type);826826- if (matches->compatible[0])827827- match &= __of_device_is_compatible(node,828828- matches->compatible);829829- if (match)830830- return matches;831831- matches++;743743+ for (; matches->name[0] || matches->type[0] || matches->compatible[0]; matches++) {744744+ score = __of_device_is_compatible(node, matches->compatible,745745+ matches->type, matches->name);746746+ if (score > best_score) {747747+ best_match = matches;748748+ best_score = score;749749+ }832750 }833833- return NULL;751751+752752+ return best_match;834753}835754836755/**···799796 * @matches: array of of device match structures to search in800797 * @node: the of device structure to match against801798 *802802- * Low level utility function used by device matching. We have two ways803803- * of matching:804804- * - Try to find the best compatible match by comparing each compatible805805- * string of device node with all the given matches respectively.806806- * - If the above method failed, then try to match the compatible by using807807- * __of_device_is_compatible() besides the match in type and name.799799+ * Low level utility function used by device matching.808800 */809801const struct of_device_id *of_match_node(const struct of_device_id *matches,810802 const struct device_node *node)
+14-8
drivers/of/of_mdio.c
···24242525static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed)2626{2727- phydev->supported |= PHY_DEFAULT_FEATURES;2727+ /* The default values for phydev->supported are provided by the PHY2828+ * driver "features" member, we want to reset to sane defaults fist2929+ * before supporting higher speeds.3030+ */3131+ phydev->supported &= PHY_DEFAULT_FEATURES;28322933 switch (max_speed) {3034 default:···4844{4945 struct phy_device *phy;5046 bool is_c45;5151- int rc, prev_irq;4747+ int rc;5248 u32 max_speed = 0;53495450 is_c45 = of_device_is_compatible(child,···5854 if (!phy || IS_ERR(phy))5955 return 1;60566161- if (mdio->irq) {6262- prev_irq = mdio->irq[addr];6363- mdio->irq[addr] =6464- irq_of_parse_and_map(child, 0);6565- if (!mdio->irq[addr])6666- mdio->irq[addr] = prev_irq;5757+ rc = irq_of_parse_and_map(child, 0);5858+ if (rc > 0) {5959+ phy->irq = rc;6060+ if (mdio->irq)6161+ mdio->irq[addr] = rc;6262+ } else {6363+ if (mdio->irq)6464+ phy->irq = mdio->irq[addr];6765 }68666967 /* Associate the OF node with the device structure so it
···6060#define PCIE_DEBUG_CTRL 0x1a606161#define PCIE_DEBUG_SOFT_RESET BIT(20)62626363-/*6464- * This product ID is registered by Marvell, and used when the Marvell6565- * SoC is not the root complex, but an endpoint on the PCIe bus. It is6666- * therefore safe to re-use this PCI ID for our emulated PCI-to-PCI6767- * bridge.6868- */6969-#define MARVELL_EMULATED_PCI_PCI_BRIDGE_ID 0x78467070-7163/* PCI configuration space of a PCI-to-PCI bridge */7264struct mvebu_sw_pci_bridge {7365 u16 vendor;···380388381389 bridge->class = PCI_CLASS_BRIDGE_PCI;382390 bridge->vendor = PCI_VENDOR_ID_MARVELL;383383- bridge->device = MARVELL_EMULATED_PCI_PCI_BRIDGE_ID;391391+ bridge->device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16;392392+ bridge->revision = mvebu_readl(port, PCIE_DEV_REV_OFF) & 0xff;384393 bridge->header_type = PCI_HEADER_TYPE_BRIDGE;385394 bridge->cache_line_size = 0x10;386395
+9-3
drivers/pci/msi.c
···545545 return -ENOMEM;546546 list_for_each_entry(entry, &pdev->msi_list, list) {547547 char *name = kmalloc(20, GFP_KERNEL);548548- msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);549549- if (!msi_dev_attr)548548+ if (!name)550549 goto error_attrs;550550+551551+ msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);552552+ if (!msi_dev_attr) {553553+ kfree(name);554554+ goto error_attrs;555555+ }556556+551557 sprintf(name, "%d", entry->irq);552558 sysfs_attr_init(&msi_dev_attr->attr);553559 msi_dev_attr->attr.name = name;···595589 ++count;596590 msi_attr = msi_attrs[count];597591 }592592+ kfree(msi_attrs);598593 return ret;599594}600595···966959/**967960 * pci_msix_vec_count - return the number of device's MSI-X table entries968961 * @dev: pointer to the pci_dev data structure of MSI-X device function969969-970962 * This function returns the number of device's MSI-X table entries and971963 * therefore the number of MSI-X vectors device is capable of sending.972964 * It returns a negative errno if the device is not capable of sending MSI-X
+10
drivers/pci/pci.c
···11811181static int do_pci_enable_device(struct pci_dev *dev, int bars)11821182{11831183 int err;11841184+ u16 cmd;11851185+ u8 pin;1184118611851187 err = pci_set_power_state(dev, PCI_D0);11861188 if (err < 0 && err != -EIO)···11911189 if (err < 0)11921190 return err;11931191 pci_fixup_device(pci_fixup_enable, dev);11921192+11931193+ pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);11941194+ if (pin) {11951195+ pci_read_config_word(dev, PCI_COMMAND, &cmd);11961196+ if (cmd & PCI_COMMAND_INTX_DISABLE)11971197+ pci_write_config_word(dev, PCI_COMMAND,11981198+ cmd & ~PCI_COMMAND_INTX_DISABLE);11991199+ }1194120011951201 return 0;11961202}
+2-1
drivers/phy/Kconfig
···55menu "PHY Subsystem"6677config GENERIC_PHY88- tristate "PHY Core"88+ bool "PHY Core"99 help1010 Generic PHY support.1111···6161config BCM_KONA_USB2_PHY6262 tristate "Broadcom Kona USB2 PHY Driver"6363 depends on GENERIC_PHY6464+ depends on HAS_IOMEM6465 help6566 Enable this to support the Broadcom Kona USB 2.0 PHY.6667
+6-8
drivers/phy/phy-core.c
···176176 dev_err(&phy->dev, "phy init failed --> %d\n", ret);177177 goto out;178178 }179179+ } else {180180+ ret = 0; /* Override possible ret == -ENOTSUPP */179181 }180182 ++phy->init_count;181183···234232 dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);235233 goto out;236234 }235235+ } else {236236+ ret = 0; /* Override possible ret == -ENOTSUPP */237237 }238238 ++phy->power_count;239239 mutex_unlock(&phy->mutex);···408404 index = of_property_match_string(dev->of_node, "phy-names",409405 string);410406 phy = of_phy_get(dev, index);411411- if (IS_ERR(phy)) {412412- dev_err(dev, "unable to find phy\n");413413- return phy;414414- }415407 } else {416408 phy = phy_lookup(dev, string);417417- if (IS_ERR(phy)) {418418- dev_err(dev, "unable to find phy\n");419419- return phy;420420- }421409 }410410+ if (IS_ERR(phy))411411+ return phy;422412423413 if (!try_module_get(phy->ops->owner))424414 return ERR_PTR(-EPROBE_DEFER);
+4-4
drivers/phy/phy-exynos-dp-video.c
···7676 if (IS_ERR(state->regs))7777 return PTR_ERR(state->regs);78787979- phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);8080- if (IS_ERR(phy_provider))8181- return PTR_ERR(phy_provider);8282-8379 phy = devm_phy_create(dev, &exynos_dp_video_phy_ops, NULL);8480 if (IS_ERR(phy)) {8581 dev_err(dev, "failed to create Display Port PHY\n");8682 return PTR_ERR(phy);8783 }8884 phy_set_drvdata(phy, state);8585+8686+ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);8787+ if (IS_ERR(phy_provider))8888+ return PTR_ERR(phy_provider);89899090 return 0;9191}
+5-5
drivers/phy/phy-exynos-mipi-video.c
···134134 dev_set_drvdata(dev, state);135135 spin_lock_init(&state->slock);136136137137- phy_provider = devm_of_phy_provider_register(dev,138138- exynos_mipi_video_phy_xlate);139139- if (IS_ERR(phy_provider))140140- return PTR_ERR(phy_provider);141141-142137 for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) {143138 struct phy *phy = devm_phy_create(dev,144139 &exynos_mipi_video_phy_ops, NULL);···146151 state->phys[i].index = i;147152 phy_set_drvdata(phy, &state->phys[i]);148153 }154154+155155+ phy_provider = devm_of_phy_provider_register(dev,156156+ exynos_mipi_video_phy_xlate);157157+ if (IS_ERR(phy_provider))158158+ return PTR_ERR(phy_provider);149159150160 return 0;151161}
+5-5
drivers/phy/phy-mvebu-sata.c
···9999 if (IS_ERR(priv->clk))100100 return PTR_ERR(priv->clk);101101102102- phy_provider = devm_of_phy_provider_register(&pdev->dev,103103- of_phy_simple_xlate);104104- if (IS_ERR(phy_provider))105105- return PTR_ERR(phy_provider);106106-107102 phy = devm_phy_create(&pdev->dev, &phy_mvebu_sata_ops, NULL);108103 if (IS_ERR(phy))109104 return PTR_ERR(phy);110105111106 phy_set_drvdata(phy, priv);107107+108108+ phy_provider = devm_of_phy_provider_register(&pdev->dev,109109+ of_phy_simple_xlate);110110+ if (IS_ERR(phy_provider))111111+ return PTR_ERR(phy_provider);112112113113 /* The boot loader may of left it on. Turn it off. */114114 phy_mvebu_sata_power_off(phy);
+5-5
drivers/phy/phy-omap-usb2.c
···177177 phy->phy.otg = otg;178178 phy->phy.type = USB_PHY_TYPE_USB2;179179180180- phy_provider = devm_of_phy_provider_register(phy->dev,181181- of_phy_simple_xlate);182182- if (IS_ERR(phy_provider))183183- return PTR_ERR(phy_provider);184184-185180 control_node = of_parse_phandle(node, "ctrl-module", 0);186181 if (!control_node) {187182 dev_err(&pdev->dev, "Failed to get control device phandle\n");···208213 return PTR_ERR(generic_phy);209214210215 phy_set_drvdata(generic_phy, phy);216216+217217+ phy_provider = devm_of_phy_provider_register(phy->dev,218218+ of_phy_simple_xlate);219219+ if (IS_ERR(phy_provider))220220+ return PTR_ERR(phy_provider);211221212222 phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");213223 if (IS_ERR(phy->wkupclk)) {
+5-5
drivers/phy/phy-twl4030-usb.c
···695695 otg->set_host = twl4030_set_host;696696 otg->set_peripheral = twl4030_set_peripheral;697697698698- phy_provider = devm_of_phy_provider_register(twl->dev,699699- of_phy_simple_xlate);700700- if (IS_ERR(phy_provider))701701- return PTR_ERR(phy_provider);702702-703698 phy = devm_phy_create(twl->dev, &ops, init_data);704699 if (IS_ERR(phy)) {705700 dev_dbg(&pdev->dev, "Failed to create PHY\n");···702707 }703708704709 phy_set_drvdata(phy, twl);710710+711711+ phy_provider = devm_of_phy_provider_register(twl->dev,712712+ of_phy_simple_xlate);713713+ if (IS_ERR(phy_provider))714714+ return PTR_ERR(phy_provider);705715706716 /* init spinlock for workqueue */707717 spin_lock_init(&twl->lock);
···5252 offset = pwm_map->output[i];53535454 /* Return an error if the pin is already assigned */5555- if (test_and_set_bit(offset, &lp3943->pin_used))5555+ if (test_and_set_bit(offset, &lp3943->pin_used)) {5656+ kfree(pwm_map);5657 return ERR_PTR(-EBUSY);5858+ }5759 }58605961 return pwm_map;
···953953 return 0;954954}955955956956+static int _regulator_do_enable(struct regulator_dev *rdev);957957+956958/**957959 * set_machine_constraints - sets regulator constraints958960 * @rdev: regulator source···10151013 /* If the constraints say the regulator should be on at this point10161014 * and we have control then make sure it is enabled.10171015 */10181018- if ((rdev->constraints->always_on || rdev->constraints->boot_on) &&10191019- ops->enable) {10201020- ret = ops->enable(rdev);10211021- if (ret < 0) {10161016+ if (rdev->constraints->always_on || rdev->constraints->boot_on) {10171017+ ret = _regulator_do_enable(rdev);10181018+ if (ret < 0 && ret != -EINVAL) {10221019 rdev_err(rdev, "failed to enable\n");10231020 goto out;10241021 }···13601359 goto found;13611360 /* Don't log an error when called from regulator_get_optional() */13621361 } else if (!have_full_constraints() || exclusive) {13631363- dev_err(dev, "dummy supplies not allowed\n");13621362+ dev_warn(dev, "dummy supplies not allowed\n");13641363 }1365136413661365 mutex_unlock(®ulator_list_mutex);···1908190719091908 trace_regulator_disable_complete(rdev_get_name(rdev));1910190919111911- _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,19121912- NULL);19131910 return 0;19141911}19151912···19311932 rdev_err(rdev, "failed to disable\n");19321933 return ret;19331934 }19351935+ _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,19361936+ NULL);19341937 }1935193819361939 rdev->use_count = 0;···19851984{19861985 int ret = 0;1987198619881988- /* force disable */19891989- if (rdev->desc->ops->disable) {19901990- /* ah well, who wants to live forever... */19911991- ret = rdev->desc->ops->disable(rdev);19921992- if (ret < 0) {19931993- rdev_err(rdev, "failed to force disable\n");19941994- return ret;19951995- }19961996- /* notify other consumers that power has been forced off */19971997- _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |19981998- REGULATOR_EVENT_DISABLE, NULL);19871987+ ret = _regulator_do_disable(rdev);19881988+ if (ret < 0) {19891989+ rdev_err(rdev, "failed to force disable\n");19901990+ return ret;19991991 }2000199220012001- return ret;19931993+ _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |19941994+ REGULATOR_EVENT_DISABLE, NULL);19951995+19961996+ return 0;20021997}2003199820041999/**···3627363036283631 mutex_lock(®ulator_list_mutex);36293632 list_for_each_entry(rdev, ®ulator_list, list) {36303630- struct regulator_ops *ops = rdev->desc->ops;36313631-36323633 mutex_lock(&rdev->mutex);36333633- if ((rdev->use_count > 0 || rdev->constraints->always_on) &&36343634- ops->enable) {36353635- error = ops->enable(rdev);36343634+ if (rdev->use_count > 0 || rdev->constraints->always_on) {36353635+ error = _regulator_do_enable(rdev);36363636 if (error)36373637 ret = error;36383638 } else {36393639 if (!have_full_constraints())36403640 goto unlock;36413641- if (!ops->disable)36423642- goto unlock;36433641 if (!_regulator_is_enabled(rdev))36443642 goto unlock;3645364336463646- error = ops->disable(rdev);36443644+ error = _regulator_do_disable(rdev);36473645 if (error)36483646 ret = error;36493647 }···38123820 ops = rdev->desc->ops;38133821 c = rdev->constraints;3814382238153815- if (!ops->disable || (c && c->always_on))38233823+ if (c && c->always_on)38163824 continue;3817382538183826 mutex_lock(&rdev->mutex);···38333841 /* We log since this may kill the system if it38343842 * goes wrong. */38353843 rdev_info(rdev, "disabling\n");38363836- ret = ops->disable(rdev);38443844+ ret = _regulator_do_disable(rdev);38373845 if (ret != 0)38383846 rdev_err(rdev, "couldn't disable: %d\n", ret);38393847 } else {
···311311 } __packed * msg = ap_msg->message;312312313313 int rcblen = CEIL4(xcRB->request_control_blk_length);314314- int replylen;314314+ int replylen, req_sumlen, resp_sumlen;315315 char *req_data = ap_msg->message + sizeof(struct type6_hdr) + rcblen;316316 char *function_code;317317···321321 xcRB->request_data_length;322322 if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE)323323 return -EINVAL;324324+325325+ /* Overflow check326326+ sum must be greater (or equal) than the largest operand */327327+ req_sumlen = CEIL4(xcRB->request_control_blk_length) +328328+ xcRB->request_data_length;329329+ if ((CEIL4(xcRB->request_control_blk_length) <=330330+ xcRB->request_data_length) ?331331+ (req_sumlen < xcRB->request_data_length) :332332+ (req_sumlen < CEIL4(xcRB->request_control_blk_length))) {333333+ return -EINVAL;334334+ }335335+324336 replylen = sizeof(struct type86_fmt2_msg) +325337 CEIL4(xcRB->reply_control_blk_length) +326338 xcRB->reply_data_length;327339 if (replylen > MSGTYPE06_MAX_MSG_SIZE)328340 return -EINVAL;341341+342342+ /* Overflow check343343+ sum must be greater (or equal) than the largest operand */344344+ resp_sumlen = CEIL4(xcRB->reply_control_blk_length) +345345+ xcRB->reply_data_length;346346+ if ((CEIL4(xcRB->reply_control_blk_length) <= xcRB->reply_data_length) ?347347+ (resp_sumlen < xcRB->reply_data_length) :348348+ (resp_sumlen < CEIL4(xcRB->reply_control_blk_length))) {349349+ return -EINVAL;350350+ }329351330352 /* prepare type6 header */331353 msg->hdr = static_type6_hdrX;
+3-2
drivers/s390/net/qeth_core_main.c
···16601660 QDIO_FLAG_CLEANUP_USING_CLEAR);16611661 if (rc)16621662 QETH_CARD_TEXT_(card, 3, "1err%d", rc);16631663- qdio_free(CARD_DDEV(card));16641663 atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED);16651664 break;16661665 case QETH_QDIO_CLEANING:···26042605 return 0;26052606out_qdio:26062607 qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);26082608+ qdio_free(CARD_DDEV(card));26072609 return rc;26082610}26092611···49064906 if (retries < 3)49074907 QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",49084908 dev_name(&card->gdev->dev));49094909+ rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);49094910 ccw_device_set_offline(CARD_DDEV(card));49104911 ccw_device_set_offline(CARD_WDEV(card));49114912 ccw_device_set_offline(CARD_RDEV(card));49134913+ qdio_free(CARD_DDEV(card));49124914 rc = ccw_device_set_online(CARD_RDEV(card));49134915 if (rc)49144916 goto retriable;···49204918 rc = ccw_device_set_online(CARD_DDEV(card));49214919 if (rc)49224920 goto retriable;49234923- rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);49244921retriable:49254922 if (rc == -ERESTARTSYS) {49264923 QETH_DBF_TEXT(SETUP, 2, "break1");
+3
drivers/s390/net/qeth_l2_main.c
···10911091 ccw_device_set_offline(CARD_DDEV(card));10921092 ccw_device_set_offline(CARD_WDEV(card));10931093 ccw_device_set_offline(CARD_RDEV(card));10941094+ qdio_free(CARD_DDEV(card));10941095 if (recover_flag == CARD_STATE_RECOVER)10951096 card->state = CARD_STATE_RECOVER;10961097 else···11331132 rc = (rc2) ? rc2 : rc3;11341133 if (rc)11351134 QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);11351135+ qdio_free(CARD_DDEV(card));11361136 if (recover_flag == CARD_STATE_UP)11371137 card->state = CARD_STATE_RECOVER;11381138 /* let user_space know that device is offline */···11961194 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);11971195 qeth_qdio_clear_card(card, 0);11981196 qeth_clear_qdio_buffers(card);11971197+ qdio_free(CARD_DDEV(card));11991198}1200119912011200static int qeth_l2_pm_suspend(struct ccwgroup_device *gdev)
+3
drivers/s390/net/qeth_l3_main.c
···34473447 ccw_device_set_offline(CARD_DDEV(card));34483448 ccw_device_set_offline(CARD_WDEV(card));34493449 ccw_device_set_offline(CARD_RDEV(card));34503450+ qdio_free(CARD_DDEV(card));34503451 if (recover_flag == CARD_STATE_RECOVER)34513452 card->state = CARD_STATE_RECOVER;34523453 else···34943493 rc = (rc2) ? rc2 : rc3;34953494 if (rc)34963495 QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);34963496+ qdio_free(CARD_DDEV(card));34973497 if (recover_flag == CARD_STATE_UP)34983498 card->state = CARD_STATE_RECOVER;34993499 /* let user_space know that device is offline */···35473545 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);35483546 qeth_qdio_clear_card(card, 0);35493547 qeth_clear_qdio_buffers(card);35483548+ qdio_free(CARD_DDEV(card));35503549}3551355035523551static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev)
-1
drivers/sbus/char/jsflash.c
···507507 }508508509509 /* Let us be really paranoid for modifications to probing code. */510510- /* extern enum sparc_cpu sparc_cpu_model; */ /* in <asm/system.h> */511510 if (sparc_cpu_model != sun4m) {512511 /* We must be on sun4m because we use MMU Bypass ASI. */513512 return -ENXIO;
+36-6
drivers/scsi/qla2xxx/qla_target.c
···790790}791791792792/* Called by tcm_qla2xxx configfs code */793793-void qlt_stop_phase1(struct qla_tgt *tgt)793793+int qlt_stop_phase1(struct qla_tgt *tgt)794794{795795 struct scsi_qla_host *vha = tgt->vha;796796 struct qla_hw_data *ha = tgt->ha;797797 unsigned long flags;798798799799+ mutex_lock(&qla_tgt_mutex);800800+ if (!vha->fc_vport) {801801+ struct Scsi_Host *sh = vha->host;802802+ struct fc_host_attrs *fc_host = shost_to_fc_host(sh);803803+ bool npiv_vports;804804+805805+ spin_lock_irqsave(sh->host_lock, flags);806806+ npiv_vports = (fc_host->npiv_vports_inuse);807807+ spin_unlock_irqrestore(sh->host_lock, flags);808808+809809+ if (npiv_vports) {810810+ mutex_unlock(&qla_tgt_mutex);811811+ return -EPERM;812812+ }813813+ }799814 if (tgt->tgt_stop || tgt->tgt_stopped) {800815 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf04e,801816 "Already in tgt->tgt_stop or tgt_stopped state\n");802802- dump_stack();803803- return;817817+ mutex_unlock(&qla_tgt_mutex);818818+ return -EPERM;804819 }805820806821 ql_dbg(ql_dbg_tgt, vha, 0xe003, "Stopping target for host %ld(%p)\n",···830815 qlt_clear_tgt_db(tgt, true);831816 spin_unlock_irqrestore(&ha->hardware_lock, flags);832817 mutex_unlock(&vha->vha_tgt.tgt_mutex);818818+ mutex_unlock(&qla_tgt_mutex);833819834820 flush_delayed_work(&tgt->sess_del_work);835821···857841858842 /* Wait for sessions to clear out (just in case) */859843 wait_event(tgt->waitQ, test_tgt_sess_count(tgt));844844+ return 0;860845}861846EXPORT_SYMBOL(qlt_stop_phase1);862847···32023185 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c,32033186 "SRR cmd %p (se_cmd %p, tag %d, op %x), "32043187 "sg_cnt=%d, offset=%d", cmd, &cmd->se_cmd, cmd->tag,32053205- se_cmd->t_task_cdb[0], cmd->sg_cnt, cmd->offset);31883188+ se_cmd->t_task_cdb ? se_cmd->t_task_cdb[0] : 0,31893189+ cmd->sg_cnt, cmd->offset);3206319032073191 qlt_handle_srr(vha, sctio, imm);32083192···41994181 tgt->datasegs_per_cmd = QLA_TGT_DATASEGS_PER_CMD_24XX;42004182 tgt->datasegs_per_cont = QLA_TGT_DATASEGS_PER_CONT_24XX;4201418341844184+ if (base_vha->fc_vport)41854185+ return 0;41864186+42024187 mutex_lock(&qla_tgt_mutex);42034188 list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist);42044189 mutex_unlock(&qla_tgt_mutex);···42154194 if (!vha->vha_tgt.qla_tgt)42164195 return 0;4217419641974197+ if (vha->fc_vport) {41984198+ qlt_release(vha->vha_tgt.qla_tgt);41994199+ return 0;42004200+ }42184201 mutex_lock(&qla_tgt_mutex);42194202 list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry);42204203 mutex_unlock(&qla_tgt_mutex);···42904265 spin_unlock_irqrestore(&ha->hardware_lock, flags);42914266 continue;42924267 }42684268+ if (tgt->tgt_stop) {42694269+ pr_debug("MODE_TARGET in shutdown on qla2xxx(%d)\n",42704270+ host->host_no);42714271+ spin_unlock_irqrestore(&ha->hardware_lock, flags);42724272+ continue;42734273+ }42934274 spin_unlock_irqrestore(&ha->hardware_lock, flags);4294427542954276 if (!scsi_host_get(host)) {···43104279 scsi_host_put(host);43114280 continue;43124281 }43134313- mutex_unlock(&qla_tgt_mutex);43144314-43154282 rc = (*callback)(vha, target_lport_ptr, npiv_wwpn, npiv_wwnn);43164283 if (rc != 0)43174284 scsi_host_put(host);4318428542864286+ mutex_unlock(&qla_tgt_mutex);43194287 return rc;43204288 }43214289 mutex_unlock(&qla_tgt_mutex);
···44#define TCM_QLA2XXX_VERSION "v0.1"55/* length of ASCII WWPNs including pad */66#define TCM_QLA2XXX_NAMELEN 3277-/* lenth of ASCII NPIV 'WWPN+WWNN' including pad */88-#define TCM_QLA2XXX_NPIV_NAMELEN 6697108#include "qla_target.h"119···4143 struct tcm_qla2xxx_tpg_attrib tpg_attrib;4244 /* Returned by tcm_qla2xxx_make_tpg() */4345 struct se_portal_group se_tpg;4646+ /* Items for dealing with configfs_depend_item */4747+ struct completion tpg_base_comp;4848+ struct work_struct tpg_base_work;4449};45504651struct tcm_qla2xxx_fc_loopid {···6362 char lport_name[TCM_QLA2XXX_NAMELEN];6463 /* ASCII formatted naa WWPN for VPD page 83 etc */6564 char lport_naa_name[TCM_QLA2XXX_NAMELEN];6666- /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */6767- char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];6865 /* map for fc_port pointers in 24-bit FC Port ID space */6966 struct btree_head32 lport_fcport_map;7067 /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
···866866 _IOC_SIZE (iocmd));867867#endif868868 iolen = _IOC_SIZE (iocmd);869869+ if (iolen > sizeof(arg))870870+ return -EFAULT;869871 data = ifr->ifr_data + sizeof (iocmd);870872 if (copy_from_user (&arg, data, iolen))871873 return -EFAULT;
+1
drivers/staging/iio/adc/mxs-lradc.c
···757757 }758758759759 /* if it is released, wait for the next touch via IRQ */760760+ lradc->cur_plate = LRADC_TOUCH;760761 mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);761762 mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);762763}
···16011601 case TCM_CHECK_CONDITION_ABORT_CMD:16021602 case TCM_CHECK_CONDITION_UNIT_ATTENTION:16031603 case TCM_CHECK_CONDITION_NOT_READY:16041604+ case TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED:16051605+ case TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED:16061606+ case TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED:16041607 break;16051608 case TCM_OUT_OF_RESOURCES:16061609 sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+11-2
drivers/thermal/Kconfig
···136136config RCAR_THERMAL137137 tristate "Renesas R-Car thermal driver"138138 depends on ARCH_SHMOBILE || COMPILE_TEST139139+ depends on HAS_IOMEM139140 help140141 Enable this to plug the R-Car thermal sensor driver into the Linux141142 thermal framework.···211210 tristate "ACPI INT3403 thermal driver"212211 depends on X86 && ACPI213212 help214214- This driver uses ACPI INT3403 device objects. If present, it will215215- register each INT3403 thermal sensor as a thermal zone.213213+ Newer laptops and tablets that use ACPI may have thermal sensors214214+ outside the core CPU/SOC for thermal safety reasons. These215215+ temperature sensors are also exposed for the OS to use via the so216216+ called INT3403 ACPI object. This driver will, on devices that have217217+ such sensors, expose the temperature information from these sensors218218+ to userspace via the normal thermal framework. This means that a wide219219+ range of applications and GUI widgets can show this information to220220+ the user or use this information for making decisions. For example,221221+ the Intel Thermal Daemon can use this information to allow the user222222+ to select his laptop to run without turning on the fans.216223217224menu "Texas Instruments thermal drivers"218225source "drivers/thermal/ti-soc-thermal/Kconfig"
+19-8
drivers/thermal/thermal_core.c
···5656static DEFINE_MUTEX(thermal_list_lock);5757static DEFINE_MUTEX(thermal_governor_lock);58585959+static struct thermal_governor *def_governor;6060+5961static struct thermal_governor *__find_governor(const char *name)6062{6163 struct thermal_governor *pos;6464+6565+ if (!name || !name[0])6666+ return def_governor;62676368 list_for_each_entry(pos, &thermal_governor_list, governor_list)6469 if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH))···8782 if (__find_governor(governor->name) == NULL) {8883 err = 0;8984 list_add(&governor->governor_list, &thermal_governor_list);8585+ if (!def_governor && !strncmp(governor->name,8686+ DEFAULT_THERMAL_GOVERNOR, THERMAL_NAME_LENGTH))8787+ def_governor = governor;9088 }91899290 mutex_lock(&thermal_list_lock);93919492 list_for_each_entry(pos, &thermal_tz_list, node) {9393+ /*9494+ * only thermal zones with specified tz->tzp->governor_name9595+ * may run with tz->govenor unset9696+ */9597 if (pos->governor)9698 continue;9797- if (pos->tzp)9898- name = pos->tzp->governor_name;9999- else100100- name = DEFAULT_THERMAL_GOVERNOR;9999+100100+ name = pos->tzp->governor_name;101101+101102 if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH))102103 pos->governor = governor;103104 }···353342static void handle_non_critical_trips(struct thermal_zone_device *tz,354343 int trip, enum thermal_trip_type trip_type)355344{356356- if (tz->governor)357357- tz->governor->throttle(tz, trip);345345+ tz->governor ? tz->governor->throttle(tz, trip) :346346+ def_governor->throttle(tz, trip);358347}359348360349static void handle_critical_trips(struct thermal_zone_device *tz,···11181107 INIT_LIST_HEAD(&cdev->thermal_instances);11191108 cdev->np = np;11201109 cdev->ops = ops;11211121- cdev->updated = true;11101110+ cdev->updated = false;11221111 cdev->device.class = &thermal_class;11231112 cdev->devdata = devdata;11241113 dev_set_name(&cdev->device, "cooling_device%d", cdev->id);···15441533 if (tz->tzp)15451534 tz->governor = __find_governor(tz->tzp->governor_name);15461535 else15471547- tz->governor = __find_governor(DEFAULT_THERMAL_GOVERNOR);15361536+ tz->governor = def_governor;1548153715491538 mutex_unlock(&thermal_governor_lock);15501539
···585585 char __user *buf, size_t len, int read)586586{587587 struct ffs_epfile *epfile = file->private_data;588588- struct usb_gadget *gadget = epfile->ffs->gadget;589588 struct ffs_ep *ep;590589 char *data = NULL;591590 ssize_t ret, data_len;···620621621622 /* Allocate & copy */622623 if (!halt) {624624+ /*625625+ * if we _do_ wait above, the epfile->ffs->gadget might be NULL626626+ * before the waiting completes, so do not assign to 'gadget' earlier627627+ */628628+ struct usb_gadget *gadget = epfile->ffs->gadget;629629+623630 /*624631 * Controller may require buffer size to be aligned to625632 * maxpacketsize of an out endpoint.
+1-1
drivers/usb/gadget/printer.c
···1157115711581158 usb_gadget_set_selfpowered(gadget);1159115911601160- if (gadget->is_otg) {11601160+ if (gadget_is_otg(gadget)) {11611161 otg_descriptor.bmAttributes |= USB_OTG_HNP;11621162 printer_cfg_driver.descriptors = otg_desc;11631163 printer_cfg_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
···685685 struct ehci_hcd *ehci = hcd_to_ehci (hcd);686686 u32 status, masked_status, pcd_status = 0, cmd;687687 int bh;688688+ unsigned long flags;688689689689- spin_lock (&ehci->lock);690690+ /*691691+ * For threadirqs option we use spin_lock_irqsave() variant to prevent692692+ * deadlock with ehci hrtimer callback, because hrtimer callbacks run693693+ * in interrupt context even when threadirqs is specified. We can go694694+ * back to spin_lock() variant when hrtimer callbacks become threaded.695695+ */696696+ spin_lock_irqsave(&ehci->lock, flags);690697691698 status = ehci_readl(ehci, &ehci->regs->status);692699···711704712705 /* Shared IRQ? */713706 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {714714- spin_unlock(&ehci->lock);707707+ spin_unlock_irqrestore(&ehci->lock, flags);715708 return IRQ_NONE;716709 }717710···822815823816 if (bh)824817 ehci_work (ehci);825825- spin_unlock (&ehci->lock);818818+ spin_unlock_irqrestore(&ehci->lock, flags);826819 if (pcd_status)827820 usb_hcd_poll_rh_status(hcd);828821 return IRQ_HANDLED;
+22-4
drivers/usb/host/ehci-hub.c
···238238 int port;239239 int mask;240240 int changed;241241+ bool fs_idle_delay;241242242243 ehci_dbg(ehci, "suspend root hub\n");243244···273272 ehci->bus_suspended = 0;274273 ehci->owned_ports = 0;275274 changed = 0;275275+ fs_idle_delay = false;276276 port = HCS_N_PORTS(ehci->hcs_params);277277 while (port--) {278278 u32 __iomem *reg = &ehci->regs->port_status [port];···302300 }303301304302 if (t1 != t2) {303303+ /*304304+ * On some controllers, Wake-On-Disconnect will305305+ * generate false wakeup signals until the bus306306+ * switches over to full-speed idle. For their307307+ * sake, add a delay if we need one.308308+ */309309+ if ((t2 & PORT_WKDISC_E) &&310310+ ehci_port_speed(ehci, t2) ==311311+ USB_PORT_STAT_HIGH_SPEED)312312+ fs_idle_delay = true;305313 ehci_writel(ehci, t2, reg);306314 changed = 1;307315 }308316 }317317+ spin_unlock_irq(&ehci->lock);318318+319319+ if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) {320320+ /*321321+ * Wait for HCD to enter low-power mode or for the bus322322+ * to switch to full-speed idle.323323+ */324324+ usleep_range(5000, 5500);325325+ }309326310327 if (changed && ehci->has_tdi_phy_lpm) {311311- spin_unlock_irq(&ehci->lock);312312- msleep(5); /* 5 ms for HCD to enter low-power mode */313328 spin_lock_irq(&ehci->lock);314314-315329 port = HCS_N_PORTS(ehci->hcs_params);316330 while (port--) {317331 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port];···340322 port, (t3 & HOSTPC_PHCD) ?341323 "succeeded" : "failed");342324 }325325+ spin_unlock_irq(&ehci->lock);343326 }344344- spin_unlock_irq(&ehci->lock);345327346328 /* Apparently some devices need a >= 1-uframe delay here */347329 if (ehci->bus_suspended)
+3-11
drivers/usb/host/xhci.c
···47334733 /* Accept arbitrarily long scatter-gather lists */47344734 hcd->self.sg_tablesize = ~0;4735473547364736+ /* support to build packet from discontinuous buffers */47374737+ hcd->self.no_sg_constraint = 1;47384738+47364739 /* XHCI controllers don't stop the ep queue on short packets :| */47374740 hcd->self.no_stop_on_short = 1;47384741···47604757 /* xHCI private pointer was set in xhci_pci_probe for the second47614758 * registered roothub.47624759 */47634763- xhci = hcd_to_xhci(hcd);47644764- /*47654765- * Support arbitrarily aligned sg-list entries on hosts without47664766- * TD fragment rules (which are currently unsupported).47674767- */47684768- if (xhci->hci_version < 0x100)47694769- hcd->self.no_sg_constraint = 1;47704770-47714760 return 0;47724761 }47734762···47874792 */47884793 if (xhci->hci_version > 0x96)47894794 xhci->quirks |= XHCI_SPURIOUS_SUCCESS;47904790-47914791- if (xhci->hci_version < 0x100)47924792- hcd->self.no_sg_constraint = 1;4793479547944796 /* Make sure the HC is halted. */47954797 retval = xhci_halt(xhci);
···11831183 csr = MUSB_CSR0_H_STATUSPKT11841184 | MUSB_CSR0_TXPKTRDY;1185118511861186+ /* disable ping token in status phase */11871187+ csr |= MUSB_CSR0_H_DIS_PING;11881188+11861189 /* flag status stage */11871190 musb->ep0_stage = MUSB_EP0_STATUS;11881191
+19-7
drivers/usb/musb/musb_virthub.c
···135135136136 /* later, GetPortStatus will stop RESUME signaling */137137 musb->port1_status |= MUSB_PORT_STAT_RESUME;138138- schedule_delayed_work(&musb->finish_resume_work, 20);138138+ schedule_delayed_work(&musb->finish_resume_work,139139+ msecs_to_jiffies(20));139140 }140141}141142···159158 */160159 power = musb_readb(mbase, MUSB_POWER);161160 if (do_reset) {162162-163161 /*164162 * If RESUME is set, we must make sure it stays minimum 20 ms.165163 * Then we must clear RESUME and wait a bit to let musb start···167167 * detected".168168 */169169 if (power & MUSB_POWER_RESUME) {170170- while (time_before(jiffies, musb->rh_timer))171171- msleep(1);170170+ long remain = (unsigned long) musb->rh_timer - jiffies;171171+172172+ if (musb->rh_timer > 0 && remain > 0) {173173+ /* take into account the minimum delay after resume */174174+ schedule_delayed_work(175175+ &musb->deassert_reset_work, remain);176176+ return;177177+ }178178+172179 musb_writeb(mbase, MUSB_POWER,173173- power & ~MUSB_POWER_RESUME);174174- msleep(1);180180+ power & ~MUSB_POWER_RESUME);181181+182182+ /* Give the core 1 ms to clear MUSB_POWER_RESUME */183183+ schedule_delayed_work(&musb->deassert_reset_work,184184+ msecs_to_jiffies(1));185185+ return;175186 }176187177188 power &= 0xf0;···191180192181 musb->port1_status |= USB_PORT_STAT_RESET;193182 musb->port1_status &= ~USB_PORT_STAT_ENABLE;194194- schedule_delayed_work(&musb->deassert_reset_work, 50);183183+ schedule_delayed_work(&musb->deassert_reset_work,184184+ msecs_to_jiffies(50));195185 } else {196186 dev_dbg(musb->controller, "root port reset stopped\n");197187 musb_writeb(mbase, MUSB_POWER,
···186186 if (pfn_valid(pfn)) {187187 bool reserved;188188 struct page *tail = pfn_to_page(pfn);189189- struct page *head = compound_trans_head(tail);189189+ struct page *head = compound_head(tail);190190 reserved = !!(PageReserved(head));191191 if (head != tail) {192192 /*193193 * "head" is not a dangling pointer194194- * (compound_trans_head takes care of that)194194+ * (compound_head takes care of that)195195 * but the hugepage may have been split196196 * from under us (and we may not hold a197197 * reference count on the head page so it can
+26-21
drivers/vhost/net.c
···7070};71717272struct vhost_net_ubuf_ref {7373- struct kref kref;7373+ /* refcount follows semantics similar to kref:7474+ * 0: object is released7575+ * 1: no outstanding ubufs7676+ * >1: outstanding ubufs7777+ */7878+ atomic_t refcount;7479 wait_queue_head_t wait;7580 struct vhost_virtqueue *vq;7681};···121116 vhost_net_zcopy_mask |= 0x1 << vq;122117}123118124124-static void vhost_net_zerocopy_done_signal(struct kref *kref)125125-{126126- struct vhost_net_ubuf_ref *ubufs;127127-128128- ubufs = container_of(kref, struct vhost_net_ubuf_ref, kref);129129- wake_up(&ubufs->wait);130130-}131131-132119static struct vhost_net_ubuf_ref *133120vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy)134121{···131134 ubufs = kmalloc(sizeof(*ubufs), GFP_KERNEL);132135 if (!ubufs)133136 return ERR_PTR(-ENOMEM);134134- kref_init(&ubufs->kref);137137+ atomic_set(&ubufs->refcount, 1);135138 init_waitqueue_head(&ubufs->wait);136139 ubufs->vq = vq;137140 return ubufs;138141}139142140140-static void vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs)143143+static int vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs)141144{142142- kref_put(&ubufs->kref, vhost_net_zerocopy_done_signal);145145+ int r = atomic_sub_return(1, &ubufs->refcount);146146+ if (unlikely(!r))147147+ wake_up(&ubufs->wait);148148+ return r;143149}144150145151static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs)146152{147147- kref_put(&ubufs->kref, vhost_net_zerocopy_done_signal);148148- wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));153153+ vhost_net_ubuf_put(ubufs);154154+ wait_event(ubufs->wait, !atomic_read(&ubufs->refcount));149155}150156151157static void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs)···306306{307307 struct vhost_net_ubuf_ref *ubufs = ubuf->ctx;308308 struct vhost_virtqueue *vq = ubufs->vq;309309- int cnt = atomic_read(&ubufs->kref.refcount);309309+ int cnt;310310+311311+ rcu_read_lock_bh();310312311313 /* set len to mark this desc buffers done DMA */312314 vq->heads[ubuf->desc].len = success ?313315 VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;314314- vhost_net_ubuf_put(ubufs);316316+ cnt = vhost_net_ubuf_put(ubufs);315317316318 /*317319 * Trigger polling thread if guest stopped submitting new buffers:318318- * in this case, the refcount after decrement will eventually reach 1319319- * so here it is 2.320320+ * in this case, the refcount after decrement will eventually reach 1.320321 * We also trigger polling periodically after each 16 packets321322 * (the value 16 here is more or less arbitrary, it's tuned to trigger322323 * less than 10% of times).323324 */324324- if (cnt <= 2 || !(cnt % 16))325325+ if (cnt <= 1 || !(cnt % 16))325326 vhost_poll_queue(&vq->poll);327327+328328+ rcu_read_unlock_bh();326329}327330328331/* Expects to be always run from workqueue - which acts as···423420 msg.msg_control = ubuf;424421 msg.msg_controllen = sizeof(ubuf);425422 ubufs = nvq->ubufs;426426- kref_get(&ubufs->kref);423423+ atomic_inc(&ubufs->refcount);427424 nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV;428425 } else {429426 msg.msg_control = NULL;···783780 vhost_net_ubuf_put_and_wait(n->vqs[VHOST_NET_VQ_TX].ubufs);784781 mutex_lock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex);785782 n->tx_flush = false;786786- kref_init(&n->vqs[VHOST_NET_VQ_TX].ubufs->kref);783783+ atomic_set(&n->vqs[VHOST_NET_VQ_TX].ubufs->refcount, 1);787784 mutex_unlock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex);788785 }789786}···803800 fput(tx_sock->file);804801 if (rx_sock)805802 fput(rx_sock->file);803803+ /* Make sure no callbacks are outstanding */804804+ synchronize_rcu_bh();806805 /* We do an extra flush before freeing memory,807806 * since jobs can re-queue themselves. */808807 vhost_net_flush(n);
+6
drivers/vhost/scsi.c
···10011001 break;10021002 }1003100310041004+ /* virtio-scsi spec requires byte 0 of the lun to be 1 */10051005+ if (unlikely(v_req.lun[0] != 1)) {10061006+ vhost_scsi_send_bad_target(vs, vq, head, out);10071007+ continue;10081008+ }10091009+10041010 /* Extract the tpgt */10051011 target = v_req.lun[1];10061012 tpg = ACCESS_ONCE(vs_tpg[target]);
···244244 xid);245245 else246246 rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,247247- xid, &fid->netfid);247247+ xid, fid);248248249249out:250250 kfree(buf);···23892389 unsigned long nr_segs, loff_t *poffset)23902390{23912391 unsigned long nr_pages, i;23922392- size_t copied, len, cur_len;23922392+ size_t bytes, copied, len, cur_len;23932393 ssize_t total_written = 0;23942394 loff_t offset;23952395 struct iov_iter it;···2444244424452445 save_len = cur_len;24462446 for (i = 0; i < nr_pages; i++) {24472447- copied = min_t(const size_t, cur_len, PAGE_SIZE);24472447+ bytes = min_t(const size_t, cur_len, PAGE_SIZE);24482448 copied = iov_iter_copy_from_user(wdata->pages[i], &it,24492449- 0, copied);24492449+ 0, bytes);24502450 cur_len -= copied;24512451 iov_iter_advance(&it, copied);24522452+ /*24532453+ * If we didn't copy as much as we expected, then that24542454+ * may mean we trod into an unmapped area. Stop copying24552455+ * at that point. On the next pass through the big24562456+ * loop, we'll likely end up getting a zero-length24572457+ * write and bailing out of it.24582458+ */24592459+ if (copied < bytes)24602460+ break;24522461 }24532462 cur_len = save_len - cur_len;24632463+24642464+ /*24652465+ * If we have no data to send, then that probably means that24662466+ * the copy above failed altogether. That's most likely because24672467+ * the address in the iovec was bogus. Set the rc to -EFAULT,24682468+ * free anything we allocated and bail out.24692469+ */24702470+ if (!cur_len) {24712471+ for (i = 0; i < nr_pages; i++)24722472+ put_page(wdata->pages[i]);24732473+ kfree(wdata);24742474+ rc = -EFAULT;24752475+ break;24762476+ }24772477+24782478+ /*24792479+ * i + 1 now represents the number of pages we actually used in24802480+ * the copy phase above. Bring nr_pages down to that, and free24812481+ * any pages that we didn't use.24822482+ */24832483+ for ( ; nr_pages > i + 1; nr_pages--)24842484+ put_page(wdata->pages[nr_pages - 1]);2454248524552486 wdata->sync_mode = WB_SYNC_ALL;24562487 wdata->nr_pages = nr_pages;
···5757#define SMB2_CMACAES_SIZE (16)5858#define SMB3_SIGNKEY_SIZE (16)59596060+/* Maximum buffer size value we can send with 1 credit */6161+#define SMB2_MAX_BUFFER_SIZE 655366262+6063#endif /* _SMB2_GLOB_H */
+4-10
fs/cifs/smb2ops.c
···182182 /* start with specified wsize, or default */183183 wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE;184184 wsize = min_t(unsigned int, wsize, server->max_write);185185- /*186186- * limit write size to 2 ** 16, because we don't support multicredit187187- * requests now.188188- */189189- wsize = min_t(unsigned int, wsize, 2 << 15);185185+ /* set it to the maximum buffer size value we can send with 1 credit */186186+ wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE);190187191188 return wsize;192189}···197200 /* start with specified rsize, or default */198201 rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE;199202 rsize = min_t(unsigned int, rsize, server->max_read);200200- /*201201- * limit write size to 2 ** 16, because we don't support multicredit202202- * requests now.203203- */204204- rsize = min_t(unsigned int, rsize, 2 << 15);203203+ /* set it to the maximum buffer size value we can send with 1 credit */204204+ rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE);205205206206 return rsize;207207}
+3-1
fs/cifs/smb2pdu.c
···413413414414 /* SMB2 only has an extended negflavor */415415 server->negflavor = CIFS_NEGFLAVOR_EXTENDED;416416- server->maxBuf = le32_to_cpu(rsp->MaxTransactSize);416416+ /* set it to the maximum buffer size value we can send with 1 credit */417417+ server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),418418+ SMB2_MAX_BUFFER_SIZE);417419 server->max_read = le32_to_cpu(rsp->MaxReadSize);418420 server->max_write = le32_to_cpu(rsp->MaxWriteSize);419421 /* BB Do we need to validate the SecurityMode? */
···9494 * @fs_type: file_system_type of the fs being mounted9595 * @flags: mount flags specified for the mount9696 * @root: kernfs_root of the hierarchy being mounted9797+ * @new_sb_created: tell the caller if we allocated a new superblock9798 * @ns: optional namespace tag of the mount9899 *99100 * This is to be called from each kernfs user's file_system_type->mount()···105104 * The return value can be passed to the vfs layer verbatim.106105 */107106struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,108108- struct kernfs_root *root, const void *ns)107107+ struct kernfs_root *root, bool *new_sb_created,108108+ const void *ns)109109{110110 struct super_block *sb;111111 struct kernfs_super_info *info;···124122 kfree(info);125123 if (IS_ERR(sb))126124 return ERR_CAST(sb);125125+126126+ if (new_sb_created)127127+ *new_sb_created = !sb->s_root;128128+127129 if (!sb->s_root) {128130 error = kernfs_fill_super(sb);129131 if (error) {
···2398239823992399 if (nfs4_copy_delegation_stateid(&arg.stateid, inode, fmode)) {24002400 /* Use that stateid */24012401- } else if (truncate && state != NULL && nfs4_valid_open_stateid(state)) {24012401+ } else if (truncate && state != NULL) {24022402 struct nfs_lockowner lockowner = {24032403 .l_owner = current->files,24042404 .l_pid = current->tgid,24052405 };24062406- nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE,24072407- &lockowner);24062406+ if (!nfs4_valid_open_stateid(state))24072407+ return -EBADF;24082408+ if (nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE,24092409+ &lockowner) == -EIO)24102410+ return -EBADF;24082411 } else24092412 nfs4_stateid_copy(&arg.stateid, &zero_stateid);24102413···40144011{40154012 nfs4_stateid current_stateid;4016401340174017- if (nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode))40184018- return false;40144014+ /* If the current stateid represents a lost lock, then exit */40154015+ if (nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode) == -EIO)40164016+ return true;40194017 return nfs4_stateid_match(stateid, ¤t_stateid);40204018}40214019···58325828 struct nfs4_lock_state *lsp;58335829 struct nfs_server *server;58345830 struct nfs_release_lockowner_args args;58355835- struct nfs4_sequence_args seq_args;58365836- struct nfs4_sequence_res seq_res;58315831+ struct nfs_release_lockowner_res res;58375832 unsigned long timestamp;58385833};58395834···58405837{58415838 struct nfs_release_lockowner_data *data = calldata;58425839 nfs40_setup_sequence(data->server,58435843- &data->seq_args, &data->seq_res, task);58405840+ &data->args.seq_args, &data->res.seq_res, task);58445841 data->timestamp = jiffies;58455842}58465843···58495846 struct nfs_release_lockowner_data *data = calldata;58505847 struct nfs_server *server = data->server;5851584858525852- nfs40_sequence_done(task, &data->seq_res);58495849+ nfs40_sequence_done(task, &data->res.seq_res);5853585058545851 switch (task->tk_status) {58555852 case 0:···58905887 data = kmalloc(sizeof(*data), GFP_NOFS);58915888 if (!data)58925889 return -ENOMEM;58935893- nfs4_init_sequence(&data->seq_args, &data->seq_res, 0);58945890 data->lsp = lsp;58955891 data->server = server;58965892 data->args.lock_owner.clientid = server->nfs_client->cl_clientid;···58975895 data->args.lock_owner.s_dev = server->s_dev;5898589658995897 msg.rpc_argp = &data->args;58985898+ msg.rpc_resp = &data->res;58995899+ nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0);59005900 rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, data);59015901 return 0;59025902}
+7-12
fs/nfs/nfs4state.c
···974974 else if (lsp != NULL && test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) != 0) {975975 nfs4_stateid_copy(dst, &lsp->ls_stateid);976976 ret = 0;977977- smp_rmb();978978- if (!list_empty(&lsp->ls_seqid.list))979979- ret = -EWOULDBLOCK;980977 }981978 spin_unlock(&state->state_lock);982979 nfs4_put_lock_state(lsp);···981984 return ret;982985}983986984984-static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state)987987+static void nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state)985988{986989 const nfs4_stateid *src;987987- int ret;988990 int seq;989991990992 do {···992996 if (test_bit(NFS_OPEN_STATE, &state->flags))993997 src = &state->open_stateid;994998 nfs4_stateid_copy(dst, src);995995- ret = 0;996996- smp_rmb();997997- if (!list_empty(&state->owner->so_seqid.list))998998- ret = -EWOULDBLOCK;999999 } while (read_seqretry(&state->seqlock, seq));10001000- return ret;10011000}1002100110031002/*···10061015 if (ret == -EIO)10071016 /* A lost lock - don't even consider delegations */10081017 goto out;10091009- if (nfs4_copy_delegation_stateid(dst, state->inode, fmode))10181018+ /* returns true if delegation stateid found and copied */10191019+ if (nfs4_copy_delegation_stateid(dst, state->inode, fmode)) {10201020+ ret = 0;10101021 goto out;10221022+ }10111023 if (ret != -ENOENT)10121024 /* nfs4_copy_delegation_stateid() didn't over-write10131025 * dst, so it still has the lock stateid which we now10141026 * choose to use.10151027 */10161028 goto out;10171017- ret = nfs4_copy_open_stateid(dst, state);10291029+ nfs4_copy_open_stateid(dst, state);10301030+ ret = 0;10181031out:10191032 if (nfs_server_capable(state->inode, NFS_CAP_STATEID_NFSV41))10201033 dst->seqid = 0;
···495495496496 /* Queue ignore event for the watch */497497 inotify_handle_event(group, NULL, fsn_mark, NULL, FS_IN_IGNORED,498498- NULL, FSNOTIFY_EVENT_NONE, NULL);498498+ NULL, FSNOTIFY_EVENT_NONE, NULL, 0);499499500500 i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);501501 /* remove this mark from the idr */···633633static struct fsnotify_group *inotify_new_group(unsigned int max_events)634634{635635 struct fsnotify_group *group;636636+ struct inotify_event_info *oevent;636637637638 group = fsnotify_alloc_group(&inotify_fsnotify_ops);638639 if (IS_ERR(group))639640 return group;641641+642642+ oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL);643643+ if (unlikely(!oevent)) {644644+ fsnotify_destroy_group(group);645645+ return ERR_PTR(-ENOMEM);646646+ }647647+ group->overflow_event = &oevent->fse;648648+ fsnotify_init_event(group->overflow_event, NULL, FS_Q_OVERFLOW);649649+ oevent->wd = -1;650650+ oevent->sync_cookie = 0;651651+ oevent->name_len = 0;640652641653 group->max_events = max_events;642654
+15-5
fs/notify/notification.c
···8080/*8181 * Add an event to the group notification queue. The group can later pull this8282 * event off the queue to deal with. The function returns 0 if the event was8383- * added to the queue, 1 if the event was merged with some other queued event.8383+ * added to the queue, 1 if the event was merged with some other queued event,8484+ * 2 if the queue of events has overflown.8485 */8586int fsnotify_add_notify_event(struct fsnotify_group *group,8687 struct fsnotify_event *event,···9695 mutex_lock(&group->notification_mutex);97969897 if (group->q_len >= group->max_events) {9898+ ret = 2;9999 /* Queue overflow event only if it isn't already queued */100100- if (list_empty(&group->overflow_event.list))101101- event = &group->overflow_event;102102- ret = 1;100100+ if (!list_empty(&group->overflow_event->list)) {101101+ mutex_unlock(&group->notification_mutex);102102+ return ret;103103+ }104104+ event = group->overflow_event;105105+ goto queue;103106 }104107105108 if (!list_empty(list) && merge) {···114109 }115110 }116111112112+queue:117113 group->q_len++;118114 list_add_tail(&event->list, list);119115 mutex_unlock(&group->notification_mutex);···138132139133 event = list_first_entry(&group->notification_list,140134 struct fsnotify_event, list);141141- list_del(&event->list);135135+ /*136136+ * We need to init list head for the case of overflow event so that137137+ * check in fsnotify_add_notify_events() works138138+ */139139+ list_del_init(&event->list);142140 group->q_len--;143141144142 return event;
+17-10
fs/ocfs2/quota_global.c
···717717 */718718 if (status < 0)719719 mlog_errno(status);720720+ /*721721+ * Clear dq_off so that we search for the structure in quota file next722722+ * time we acquire it. The structure might be deleted and reallocated723723+ * elsewhere by another node while our dquot structure is on freelist.724724+ */725725+ dquot->dq_off = 0;720726 clear_bit(DQ_ACTIVE_B, &dquot->dq_flags);721727out_trans:722728 ocfs2_commit_trans(osb, handle);···762756 status = ocfs2_lock_global_qf(info, 1);763757 if (status < 0)764758 goto out;765765- if (!test_bit(DQ_READ_B, &dquot->dq_flags)) {766766- status = ocfs2_qinfo_lock(info, 0);767767- if (status < 0)768768- goto out_dq;769769- status = qtree_read_dquot(&info->dqi_gi, dquot);770770- ocfs2_qinfo_unlock(info, 0);771771- if (status < 0)772772- goto out_dq;773773- }774774- set_bit(DQ_READ_B, &dquot->dq_flags);759759+ status = ocfs2_qinfo_lock(info, 0);760760+ if (status < 0)761761+ goto out_dq;762762+ /*763763+ * We always want to read dquot structure from disk because we don't764764+ * know what happened with it while it was on freelist.765765+ */766766+ status = qtree_read_dquot(&info->dqi_gi, dquot);767767+ ocfs2_qinfo_unlock(info, 0);768768+ if (status < 0)769769+ goto out_dq;775770776771 OCFS2_DQUOT(dquot)->dq_use_count++;777772 OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace;
-4
fs/ocfs2/quota_local.c
···13031303 ocfs2_journal_dirty(handle, od->dq_chunk->qc_headerbh);1304130413051305out:13061306- /* Clear the read bit so that next time someone uses this13071307- * dquot he reads fresh info from disk and allocates local13081308- * dquot structure */13091309- clear_bit(DQ_READ_B, &dquot->dq_flags);13101306 return status;13111307}13121308
+2-3
fs/proc/page.c
···121121 * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon122122 * to make sure a given page is a thp, not a non-huge compound page.123123 */124124- else if (PageTransCompound(page) &&125125- (PageLRU(compound_trans_head(page)) ||126126- PageAnon(compound_trans_head(page))))124124+ else if (PageTransCompound(page) && (PageLRU(compound_head(page)) ||125125+ PageAnon(compound_head(page))))127126 u |= 1 << KPF_THP;128127129128 /*
+11-3
fs/quota/dquot.c
···581581 dqstats_inc(DQST_LOOKUPS);582582 dqput(old_dquot);583583 old_dquot = dquot;584584- ret = fn(dquot, priv);585585- if (ret < 0)586586- goto out;584584+ /*585585+ * ->release_dquot() can be racing with us. Our reference586586+ * protects us from new calls to it so just wait for any587587+ * outstanding call and recheck the DQ_ACTIVE_B after that.588588+ */589589+ wait_on_dquot(dquot);590590+ if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {591591+ ret = fn(dquot, priv);592592+ if (ret < 0)593593+ goto out;594594+ }587595 spin_lock(&dq_list_lock);588596 /* We are safe to continue now because our dquot could not589597 * be moved out of the inuse list while we hold the reference */
+190-695
fs/reiserfs/do_balan.c
···324324 switch (flag) {325325 case M_INSERT: /* insert item into L[0] */326326327327- if (item_pos == tb->lnum[0] - 1328328- && tb->lbytes != -1) {327327+ if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) {329328 /* part of new item falls into L[0] */330329 int new_item_len;331330 int version;332331333333- ret_val =334334- leaf_shift_left(tb, tb->lnum[0] - 1,335335- -1);332332+ ret_val = leaf_shift_left(tb, tb->lnum[0] - 1, -1);336333337334 /* Calculate item length to insert to S[0] */338338- new_item_len =339339- ih_item_len(ih) - tb->lbytes;335335+ new_item_len = ih_item_len(ih) - tb->lbytes;340336 /* Calculate and check item length to insert to L[0] */341341- put_ih_item_len(ih,342342- ih_item_len(ih) -343343- new_item_len);337337+ put_ih_item_len(ih, ih_item_len(ih) - new_item_len);344338345339 RFALSE(ih_item_len(ih) <= 0,346340 "PAP-12080: there is nothing to insert into L[0]: ih_item_len=%d",···343349 /* Insert new item into L[0] */344350 buffer_info_init_left(tb, &bi);345351 leaf_insert_into_buf(&bi,346346- n + item_pos -347347- ret_val, ih, body,348348- zeros_num >349349- ih_item_len(ih) ?350350- ih_item_len(ih) :351351- zeros_num);352352+ n + item_pos - ret_val, ih, body,353353+ zeros_num > ih_item_len(ih) ? ih_item_len(ih) : zeros_num);352354353355 version = ih_version(ih);354356355357 /* Calculate key component, item length and body to insert into S[0] */356356- set_le_ih_k_offset(ih,357357- le_ih_k_offset(ih) +358358- (tb->359359- lbytes <<360360- (is_indirect_le_ih361361- (ih) ? tb->tb_sb->362362- s_blocksize_bits -363363- UNFM_P_SHIFT :364364- 0)));358358+ set_le_ih_k_offset(ih, le_ih_k_offset(ih) +359359+ (tb-> lbytes << (is_indirect_le_ih(ih) ? tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT : 0)));365360366361 put_ih_item_len(ih, new_item_len);367362 if (tb->lbytes > zeros_num) {368368- body +=369369- (tb->lbytes - zeros_num);363363+ body += (tb->lbytes - zeros_num);370364 zeros_num = 0;371365 } else372366 zeros_num -= tb->lbytes;···365383 } else {366384 /* new item in whole falls into L[0] */367385 /* Shift lnum[0]-1 items to L[0] */368368- ret_val =369369- leaf_shift_left(tb, tb->lnum[0] - 1,370370- tb->lbytes);386386+ ret_val = leaf_shift_left(tb, tb->lnum[0] - 1, tb->lbytes);371387 /* Insert new item into L[0] */372388 buffer_info_init_left(tb, &bi);373373- leaf_insert_into_buf(&bi,374374- n + item_pos -375375- ret_val, ih, body,376376- zeros_num);389389+ leaf_insert_into_buf(&bi, n + item_pos - ret_val, ih, body, zeros_num);377390 tb->insert_size[0] = 0;378391 zeros_num = 0;379392 }···376399377400 case M_PASTE: /* append item in L[0] */378401379379- if (item_pos == tb->lnum[0] - 1380380- && tb->lbytes != -1) {402402+ if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) {381403 /* we must shift the part of the appended item */382382- if (is_direntry_le_ih383383- (B_N_PITEM_HEAD(tbS0, item_pos))) {404404+ if (is_direntry_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) {384405385406 RFALSE(zeros_num,386407 "PAP-12090: invalid parameter in case of a directory");387408 /* directory item */388409 if (tb->lbytes > pos_in_item) {389410 /* new directory entry falls into L[0] */390390- struct item_head391391- *pasted;392392- int l_pos_in_item =393393- pos_in_item;411411+ struct item_head *pasted;412412+ int l_pos_in_item = pos_in_item;394413395414 /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 entries from given directory item */396396- ret_val =397397- leaf_shift_left(tb,398398- tb->399399- lnum400400- [0],401401- tb->402402- lbytes403403- -404404- 1);405405- if (ret_val406406- && !item_pos) {407407- pasted =408408- B_N_PITEM_HEAD409409- (tb->L[0],410410- B_NR_ITEMS411411- (tb->412412- L[0]) -413413- 1);414414- l_pos_in_item +=415415- I_ENTRY_COUNT416416- (pasted) -417417- (tb->418418- lbytes -419419- 1);415415+ ret_val = leaf_shift_left(tb, tb->lnum[0], tb->lbytes-1);416416+ if (ret_val && !item_pos) {417417+ pasted = B_N_PITEM_HEAD(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1);418418+ l_pos_in_item += I_ENTRY_COUNT(pasted) - (tb->lbytes -1);420419 }421420422421 /* Append given directory entry to directory item */423422 buffer_info_init_left(tb, &bi);424424- leaf_paste_in_buffer425425- (&bi,426426- n + item_pos -427427- ret_val,428428- l_pos_in_item,429429- tb->insert_size[0],430430- body, zeros_num);423423+ leaf_paste_in_buffer(&bi, n + item_pos - ret_val, l_pos_in_item, tb->insert_size[0], body, zeros_num);431424432425 /* previous string prepared space for pasting new entry, following string pastes this entry */433426434427 /* when we have merge directory item, pos_in_item has been changed too */435428436429 /* paste new directory entry. 1 is entry number */437437- leaf_paste_entries(&bi,438438- n +439439- item_pos440440- -441441- ret_val,442442- l_pos_in_item,443443- 1,444444- (struct445445- reiserfs_de_head446446- *)447447- body,448448- body449449- +450450- DEH_SIZE,451451- tb->452452- insert_size453453- [0]454454- );430430+ leaf_paste_entries(&bi, n + item_pos - ret_val, l_pos_in_item,431431+ 1, (struct reiserfs_de_head *) body,432432+ body + DEH_SIZE, tb->insert_size[0]);455433 tb->insert_size[0] = 0;456434 } else {457435 /* new directory item doesn't fall into L[0] */458436 /* Shift lnum[0]-1 items in whole. Shift lbytes directory entries from directory item number lnum[0] */459459- leaf_shift_left(tb,460460- tb->461461- lnum[0],462462- tb->463463- lbytes);437437+ leaf_shift_left(tb, tb->lnum[0], tb->lbytes);464438 }465439 /* Calculate new position to append in item body */466440 pos_in_item -= tb->lbytes;467441 } else {468442 /* regular object */469469- RFALSE(tb->lbytes <= 0,470470- "PAP-12095: there is nothing to shift to L[0]. lbytes=%d",471471- tb->lbytes);472472- RFALSE(pos_in_item !=473473- ih_item_len474474- (B_N_PITEM_HEAD475475- (tbS0, item_pos)),443443+ RFALSE(tb->lbytes <= 0, "PAP-12095: there is nothing to shift to L[0]. lbytes=%d", tb->lbytes);444444+ RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),476445 "PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d",477477- ih_item_len478478- (B_N_PITEM_HEAD479479- (tbS0, item_pos)),480480- pos_in_item);446446+ ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),pos_in_item);481447482448 if (tb->lbytes >= pos_in_item) {483449 /* appended item will be in L[0] in whole */484450 int l_n;485451486452 /* this bytes number must be appended to the last item of L[h] */487487- l_n =488488- tb->lbytes -489489- pos_in_item;453453+ l_n = tb->lbytes - pos_in_item;490454491455 /* Calculate new insert_size[0] */492492- tb->insert_size[0] -=493493- l_n;456456+ tb->insert_size[0] -= l_n;494457495495- RFALSE(tb->496496- insert_size[0] <=497497- 0,458458+ RFALSE(tb->insert_size[0] <= 0,498459 "PAP-12105: there is nothing to paste into L[0]. insert_size=%d",499499- tb->500500- insert_size[0]);501501- ret_val =502502- leaf_shift_left(tb,503503- tb->504504- lnum505505- [0],506506- ih_item_len507507- (B_N_PITEM_HEAD508508- (tbS0,509509- item_pos)));460460+ tb->insert_size[0]);461461+ ret_val = leaf_shift_left(tb, tb->lnum[0], ih_item_len462462+ (B_N_PITEM_HEAD(tbS0, item_pos)));510463 /* Append to body of item in L[0] */511464 buffer_info_init_left(tb, &bi);512465 leaf_paste_in_buffer513513- (&bi,514514- n + item_pos -515515- ret_val,516516- ih_item_len517517- (B_N_PITEM_HEAD518518- (tb->L[0],519519- n + item_pos -520520- ret_val)), l_n,521521- body,522522- zeros_num >523523- l_n ? l_n :524524- zeros_num);466466+ (&bi, n + item_pos - ret_val, ih_item_len467467+ (B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val)),468468+ l_n, body,469469+ zeros_num > l_n ? l_n : zeros_num);525470 /* 0-th item in S0 can be only of DIRECT type when l_n != 0 */526471 {527472 int version;528528- int temp_l =529529- l_n;473473+ int temp_l = l_n;530474531531- RFALSE532532- (ih_item_len533533- (B_N_PITEM_HEAD534534- (tbS0,535535- 0)),475475+ RFALSE(ih_item_len(B_N_PITEM_HEAD(tbS0, 0)),536476 "PAP-12106: item length must be 0");537537- RFALSE538538- (comp_short_le_keys539539- (B_N_PKEY540540- (tbS0, 0),541541- B_N_PKEY542542- (tb->L[0],543543- n +544544- item_pos545545- -546546- ret_val)),477477+ RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY478478+ (tb->L[0], n + item_pos - ret_val)),547479 "PAP-12107: items must be of the same file");548480 if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val))) {549549- temp_l =550550- l_n551551- <<552552- (tb->553553- tb_sb->554554- s_blocksize_bits555555- -556556- UNFM_P_SHIFT);481481+ temp_l = l_n << (tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT);557482 }558483 /* update key of first item in S0 */559559- version =560560- ih_version561561- (B_N_PITEM_HEAD562562- (tbS0, 0));563563- set_le_key_k_offset564564- (version,565565- B_N_PKEY566566- (tbS0, 0),567567- le_key_k_offset568568- (version,569569- B_N_PKEY570570- (tbS0,571571- 0)) +572572- temp_l);484484+ version = ih_version(B_N_PITEM_HEAD(tbS0, 0));485485+ set_le_key_k_offset(version, B_N_PKEY(tbS0, 0),486486+ le_key_k_offset(version,B_N_PKEY(tbS0, 0)) + temp_l);573487 /* update left delimiting key */574574- set_le_key_k_offset575575- (version,576576- B_N_PDELIM_KEY577577- (tb->578578- CFL[0],579579- tb->580580- lkey[0]),581581- le_key_k_offset582582- (version,583583- B_N_PDELIM_KEY584584- (tb->585585- CFL[0],586586- tb->587587- lkey[0]))588588- + temp_l);488488+ set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),489489+ le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0])) + temp_l);589490 }590491591492 /* Calculate new body, position in item and insert_size[0] */592493 if (l_n > zeros_num) {593593- body +=594594- (l_n -595595- zeros_num);494494+ body += (l_n - zeros_num);596495 zeros_num = 0;597496 } else598598- zeros_num -=599599- l_n;497497+ zeros_num -= l_n;600498 pos_in_item = 0;601499602602- RFALSE603603- (comp_short_le_keys604604- (B_N_PKEY(tbS0, 0),605605- B_N_PKEY(tb->L[0],606606- B_NR_ITEMS607607- (tb->608608- L[0]) -609609- 1))610610- ||611611- !op_is_left_mergeable612612- (B_N_PKEY(tbS0, 0),613613- tbS0->b_size)614614- ||615615- !op_is_left_mergeable616616- (B_N_PDELIM_KEY617617- (tb->CFL[0],618618- tb->lkey[0]),619619- tbS0->b_size),500500+ RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1))501501+ || !op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)502502+ || !op_is_left_mergeable(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), tbS0->b_size),620503 "PAP-12120: item must be merge-able with left neighboring item");621504 } else { /* only part of the appended item will be in L[0] */622505623506 /* Calculate position in item for append in S[0] */624624- pos_in_item -=625625- tb->lbytes;507507+ pos_in_item -= tb->lbytes;626508627627- RFALSE(pos_in_item <= 0,628628- "PAP-12125: no place for paste. pos_in_item=%d",629629- pos_in_item);509509+ RFALSE(pos_in_item <= 0, "PAP-12125: no place for paste. pos_in_item=%d", pos_in_item);630510631511 /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */632632- leaf_shift_left(tb,633633- tb->634634- lnum[0],635635- tb->636636- lbytes);512512+ leaf_shift_left(tb, tb->lnum[0], tb->lbytes);637513 }638514 }639515 } else { /* appended item will be in L[0] in whole */···495665496666 if (!item_pos && op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)) { /* if we paste into first item of S[0] and it is left mergable */497667 /* then increment pos_in_item by the size of the last item in L[0] */498498- pasted =499499- B_N_PITEM_HEAD(tb->L[0],500500- n - 1);668668+ pasted = B_N_PITEM_HEAD(tb->L[0], n - 1);501669 if (is_direntry_le_ih(pasted))502502- pos_in_item +=503503- ih_entry_count504504- (pasted);670670+ pos_in_item += ih_entry_count(pasted);505671 else506506- pos_in_item +=507507- ih_item_len(pasted);672672+ pos_in_item += ih_item_len(pasted);508673 }509674510675 /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */511511- ret_val =512512- leaf_shift_left(tb, tb->lnum[0],513513- tb->lbytes);676676+ ret_val = leaf_shift_left(tb, tb->lnum[0], tb->lbytes);514677 /* Append to body of item in L[0] */515678 buffer_info_init_left(tb, &bi);516516- leaf_paste_in_buffer(&bi,517517- n + item_pos -518518- ret_val,679679+ leaf_paste_in_buffer(&bi, n + item_pos - ret_val,519680 pos_in_item,520681 tb->insert_size[0],521682 body, zeros_num);522683523684 /* if appended item is directory, paste entry */524524- pasted =525525- B_N_PITEM_HEAD(tb->L[0],526526- n + item_pos -527527- ret_val);685685+ pasted = B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val);528686 if (is_direntry_le_ih(pasted))529529- leaf_paste_entries(&bi,530530- n +531531- item_pos -532532- ret_val,533533- pos_in_item,534534- 1,535535- (struct536536- reiserfs_de_head537537- *)body,538538- body +539539- DEH_SIZE,540540- tb->541541- insert_size542542- [0]543543- );687687+ leaf_paste_entries(&bi, n + item_pos - ret_val,688688+ pos_in_item, 1,689689+ (struct reiserfs_de_head *) body,690690+ body + DEH_SIZE,691691+ tb->insert_size[0]);544692 /* if appended item is indirect item, put unformatted node into un list */545693 if (is_indirect_le_ih(pasted))546694 set_ih_free_space(pasted, 0);···530722 reiserfs_panic(tb->tb_sb, "PAP-12130",531723 "lnum > 0: unexpected mode: "532724 " %s(%d)",533533- (flag ==534534- M_DELETE) ? "DELETE" : ((flag ==535535- M_CUT)536536- ? "CUT"537537- :538538- "UNKNOWN"),539539- flag);725725+ (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);540726 }541727 } else {542728 /* new item doesn't fall into L[0] */···550748 case M_INSERT: /* insert item */551749 if (n - tb->rnum[0] < item_pos) { /* new item or its part falls to R[0] */552750 if (item_pos == n - tb->rnum[0] + 1 && tb->rbytes != -1) { /* part of new item falls into R[0] */553553- loff_t old_key_comp, old_len,554554- r_zeros_number;751751+ loff_t old_key_comp, old_len, r_zeros_number;555752 const char *r_body;556753 int version;557754 loff_t offset;558755559559- leaf_shift_right(tb, tb->rnum[0] - 1,560560- -1);756756+ leaf_shift_right(tb, tb->rnum[0] - 1, -1);561757562758 version = ih_version(ih);563759 /* Remember key component and item length */···563763 old_len = ih_item_len(ih);564764565765 /* Calculate key component and item length to insert into R[0] */566566- offset =567567- le_ih_k_offset(ih) +568568- ((old_len -569569- tb->570570- rbytes) << (is_indirect_le_ih(ih)571571- ? tb->tb_sb->572572- s_blocksize_bits -573573- UNFM_P_SHIFT : 0));766766+ offset = le_ih_k_offset(ih) + ((old_len - tb->rbytes) << (is_indirect_le_ih(ih) ? tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT : 0));574767 set_le_ih_k_offset(ih, offset);575768 put_ih_item_len(ih, tb->rbytes);576769 /* Insert part of the item into R[0] */577770 buffer_info_init_right(tb, &bi);578771 if ((old_len - tb->rbytes) > zeros_num) {579772 r_zeros_number = 0;580580- r_body =581581- body + (old_len -582582- tb->rbytes) -583583- zeros_num;773773+ r_body = body + (old_len - tb->rbytes) - zeros_num;584774 } else {585775 r_body = body;586586- r_zeros_number =587587- zeros_num - (old_len -588588- tb->rbytes);776776+ r_zeros_number = zeros_num - (old_len - tb->rbytes);589777 zeros_num -= r_zeros_number;590778 }591779···586798587799 /* Calculate key component and item length to insert into S[0] */588800 set_le_ih_k_offset(ih, old_key_comp);589589- put_ih_item_len(ih,590590- old_len - tb->rbytes);801801+ put_ih_item_len(ih, old_len - tb->rbytes);591802592803 tb->insert_size[0] -= tb->rbytes;593804594805 } else { /* whole new item falls into R[0] */595806596807 /* Shift rnum[0]-1 items to R[0] */597597- ret_val =598598- leaf_shift_right(tb,599599- tb->rnum[0] - 1,600600- tb->rbytes);808808+ ret_val = leaf_shift_right(tb, tb->rnum[0] - 1, tb->rbytes);601809 /* Insert new item into R[0] */602810 buffer_info_init_right(tb, &bi);603603- leaf_insert_into_buf(&bi,604604- item_pos - n +605605- tb->rnum[0] - 1,606606- ih, body,607607- zeros_num);811811+ leaf_insert_into_buf(&bi, item_pos - n + tb->rnum[0] - 1,812812+ ih, body, zeros_num);608813609814 if (item_pos - n + tb->rnum[0] - 1 == 0) {610815 replace_key(tb, tb->CFR[0],···622841623842 RFALSE(zeros_num,624843 "PAP-12145: invalid parameter in case of a directory");625625- entry_count =626626- I_ENTRY_COUNT(B_N_PITEM_HEAD627627- (tbS0,628628- item_pos));844844+ entry_count = I_ENTRY_COUNT(B_N_PITEM_HEAD845845+ (tbS0, item_pos));629846 if (entry_count - tb->rbytes <630847 pos_in_item)631848 /* new directory entry falls into R[0] */632849 {633850 int paste_entry_position;634851635635- RFALSE(tb->rbytes - 1 >=636636- entry_count637637- || !tb->638638- insert_size[0],852852+ RFALSE(tb->rbytes - 1 >= entry_count || !tb-> insert_size[0],639853 "PAP-12150: no enough of entries to shift to R[0]: rbytes=%d, entry_count=%d",640640- tb->rbytes,641641- entry_count);854854+ tb->rbytes, entry_count);642855 /* Shift rnum[0]-1 items in whole. Shift rbytes-1 directory entries from directory item number rnum[0] */643643- leaf_shift_right(tb,644644- tb->645645- rnum646646- [0],647647- tb->648648- rbytes649649- - 1);856856+ leaf_shift_right(tb, tb->rnum[0], tb->rbytes - 1);650857 /* Paste given directory entry to directory item */651651- paste_entry_position =652652- pos_in_item -653653- entry_count +654654- tb->rbytes - 1;858858+ paste_entry_position = pos_in_item - entry_count + tb->rbytes - 1;655859 buffer_info_init_right(tb, &bi);656656- leaf_paste_in_buffer657657- (&bi, 0,658658- paste_entry_position,659659- tb->insert_size[0],660660- body, zeros_num);860860+ leaf_paste_in_buffer(&bi, 0, paste_entry_position, tb->insert_size[0], body, zeros_num);661861 /* paste entry */662662- leaf_paste_entries(&bi,663663- 0,664664- paste_entry_position,665665- 1,666666- (struct667667- reiserfs_de_head668668- *)669669- body,670670- body671671- +672672- DEH_SIZE,673673- tb->674674- insert_size675675- [0]676676- );862862+ leaf_paste_entries(&bi, 0, paste_entry_position, 1,863863+ (struct reiserfs_de_head *) body,864864+ body + DEH_SIZE, tb->insert_size[0]);677865678678- if (paste_entry_position679679- == 0) {866866+ if (paste_entry_position == 0) {680867 /* change delimiting keys */681681- replace_key(tb,682682- tb->683683- CFR684684- [0],685685- tb->686686- rkey687687- [0],688688- tb->689689- R690690- [0],691691- 0);868868+ replace_key(tb, tb->CFR[0], tb->rkey[0], tb->R[0],0);692869 }693870694871 tb->insert_size[0] = 0;695872 pos_in_item++;696873 } else { /* new directory entry doesn't fall into R[0] */697874698698- leaf_shift_right(tb,699699- tb->700700- rnum701701- [0],702702- tb->703703- rbytes);875875+ leaf_shift_right(tb, tb->rnum[0], tb->rbytes);704876 }705877 } else { /* regular object */706878707707- int n_shift, n_rem,708708- r_zeros_number;879879+ int n_shift, n_rem, r_zeros_number;709880 const char *r_body;710881711882 /* Calculate number of bytes which must be shifted from appended item */712712- if ((n_shift =713713- tb->rbytes -714714- tb->insert_size[0]) < 0)883883+ if ((n_shift = tb->rbytes - tb->insert_size[0]) < 0)715884 n_shift = 0;716885717717- RFALSE(pos_in_item !=718718- ih_item_len719719- (B_N_PITEM_HEAD720720- (tbS0, item_pos)),886886+ RFALSE(pos_in_item != ih_item_len887887+ (B_N_PITEM_HEAD(tbS0, item_pos)),721888 "PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d",722722- pos_in_item,723723- ih_item_len724724- (B_N_PITEM_HEAD725725- (tbS0, item_pos)));889889+ pos_in_item, ih_item_len890890+ (B_N_PITEM_HEAD(tbS0, item_pos)));726891727727- leaf_shift_right(tb,728728- tb->rnum[0],729729- n_shift);892892+ leaf_shift_right(tb, tb->rnum[0], n_shift);730893 /* Calculate number of bytes which must remain in body after appending to R[0] */731731- if ((n_rem =732732- tb->insert_size[0] -733733- tb->rbytes) < 0)894894+ if ((n_rem = tb->insert_size[0] - tb->rbytes) < 0)734895 n_rem = 0;735896736897 {737898 int version;738738- unsigned long temp_rem =739739- n_rem;899899+ unsigned long temp_rem = n_rem;740900741741- version =742742- ih_version743743- (B_N_PITEM_HEAD744744- (tb->R[0], 0));745745- if (is_indirect_le_key746746- (version,747747- B_N_PKEY(tb->R[0],748748- 0))) {749749- temp_rem =750750- n_rem <<751751- (tb->tb_sb->752752- s_blocksize_bits753753- -754754- UNFM_P_SHIFT);901901+ version = ih_version(B_N_PITEM_HEAD(tb->R[0], 0));902902+ if (is_indirect_le_key(version, B_N_PKEY(tb->R[0], 0))) {903903+ temp_rem = n_rem << (tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT);755904 }756756- set_le_key_k_offset757757- (version,758758- B_N_PKEY(tb->R[0],759759- 0),760760- le_key_k_offset761761- (version,762762- B_N_PKEY(tb->R[0],763763- 0)) +764764- temp_rem);765765- set_le_key_k_offset766766- (version,767767- B_N_PDELIM_KEY(tb->768768- CFR769769- [0],770770- tb->771771- rkey772772- [0]),773773- le_key_k_offset774774- (version,775775- B_N_PDELIM_KEY776776- (tb->CFR[0],777777- tb->rkey[0])) +778778- temp_rem);905905+ set_le_key_k_offset(version, B_N_PKEY(tb->R[0], 0),906906+ le_key_k_offset(version, B_N_PKEY(tb->R[0], 0)) + temp_rem);907907+ set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]),908908+ le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])) + temp_rem);779909 }780910/* k_offset (B_N_PKEY(tb->R[0],0)) += n_rem;781911 k_offset (B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0])) += n_rem;*/782782- do_balance_mark_internal_dirty783783- (tb, tb->CFR[0], 0);912912+ do_balance_mark_internal_dirty(tb, tb->CFR[0], 0);784913785914 /* Append part of body into R[0] */786915 buffer_info_init_right(tb, &bi);787916 if (n_rem > zeros_num) {788917 r_zeros_number = 0;789789- r_body =790790- body + n_rem -791791- zeros_num;918918+ r_body = body + n_rem - zeros_num;792919 } else {793920 r_body = body;794794- r_zeros_number =795795- zeros_num - n_rem;796796- zeros_num -=797797- r_zeros_number;921921+ r_zeros_number = zeros_num - n_rem;922922+ zeros_num -= r_zeros_number;798923 }799924800800- leaf_paste_in_buffer(&bi, 0,801801- n_shift,802802- tb->803803- insert_size804804- [0] -805805- n_rem,806806- r_body,807807- r_zeros_number);925925+ leaf_paste_in_buffer(&bi, 0, n_shift,926926+ tb->insert_size[0] - n_rem,927927+ r_body, r_zeros_number);808928809809- if (is_indirect_le_ih810810- (B_N_PITEM_HEAD811811- (tb->R[0], 0))) {929929+ if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->R[0], 0))) {812930#if 0813931 RFALSE(n_rem,814932 "PAP-12160: paste more than one unformatted node pointer");815933#endif816816- set_ih_free_space817817- (B_N_PITEM_HEAD818818- (tb->R[0], 0), 0);934934+ set_ih_free_space(B_N_PITEM_HEAD(tb->R[0], 0), 0);819935 }820936 tb->insert_size[0] = n_rem;821937 if (!n_rem)···72210447231045 struct item_head *pasted;7241046725725- ret_val =726726- leaf_shift_right(tb, tb->rnum[0],727727- tb->rbytes);10471047+ ret_val = leaf_shift_right(tb, tb->rnum[0], tb->rbytes);7281048 /* append item in R[0] */7291049 if (pos_in_item >= 0) {7301050 buffer_info_init_right(tb, &bi);731731- leaf_paste_in_buffer(&bi,732732- item_pos -733733- n +734734- tb->735735- rnum[0],736736- pos_in_item,737737- tb->738738- insert_size739739- [0], body,740740- zeros_num);10511051+ leaf_paste_in_buffer(&bi, item_pos - n + tb->rnum[0], pos_in_item,10521052+ tb->insert_size[0], body, zeros_num);7411053 }74210547431055 /* paste new entry, if item is directory item */744744- pasted =745745- B_N_PITEM_HEAD(tb->R[0],746746- item_pos - n +747747- tb->rnum[0]);748748- if (is_direntry_le_ih(pasted)749749- && pos_in_item >= 0) {750750- leaf_paste_entries(&bi,751751- item_pos -752752- n +753753- tb->rnum[0],754754- pos_in_item,755755- 1,756756- (struct757757- reiserfs_de_head758758- *)body,759759- body +760760- DEH_SIZE,761761- tb->762762- insert_size763763- [0]764764- );10561056+ pasted = B_N_PITEM_HEAD(tb->R[0], item_pos - n + tb->rnum[0]);10571057+ if (is_direntry_le_ih(pasted) && pos_in_item >= 0) {10581058+ leaf_paste_entries(&bi, item_pos - n + tb->rnum[0],10591059+ pos_in_item, 1,10601060+ (struct reiserfs_de_head *) body,10611061+ body + DEH_SIZE, tb->insert_size[0]);7651062 if (!pos_in_item) {7661063767767- RFALSE(item_pos - n +768768- tb->rnum[0],10641064+ RFALSE(item_pos - n + tb->rnum[0],7691065 "PAP-12165: directory item must be first item of node when pasting is in 0th position");77010667711067 /* update delimiting keys */772772- replace_key(tb,773773- tb->CFR[0],774774- tb->rkey[0],775775- tb->R[0],776776- 0);10681068+ replace_key(tb, tb->CFR[0], tb->rkey[0], tb->R[0], 0);7771069 }7781070 }7791071···7591111 default: /* cases d and t */7601112 reiserfs_panic(tb->tb_sb, "PAP-12175",7611113 "rnum > 0: unexpected mode: %s(%d)",762762- (flag ==763763- M_DELETE) ? "DELETE" : ((flag ==764764- M_CUT) ? "CUT"765765- : "UNKNOWN"),766766- flag);11141114+ (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);7671115 }76811167691117 }77011187711119 /* tb->rnum[0] > 0 */7721120 RFALSE(tb->blknum[0] > 3,773773- "PAP-12180: blknum can not be %d. It must be <= 3",774774- tb->blknum[0]);11211121+ "PAP-12180: blknum can not be %d. It must be <= 3", tb->blknum[0]);7751122 RFALSE(tb->blknum[0] < 0,776776- "PAP-12185: blknum can not be %d. It must be >= 0",777777- tb->blknum[0]);11231123+ "PAP-12185: blknum can not be %d. It must be >= 0", tb->blknum[0]);77811247791125 /* if while adding to a node we discover that it is possible to split7801126 it in two, and merge the left part into the left neighbor and the···81911778201178 if (n - snum[i] < item_pos) { /* new item or it's part falls to first new node S_new[i] */8211179 if (item_pos == n - snum[i] + 1 && sbytes[i] != -1) { /* part of new item falls into S_new[i] */822822- int old_key_comp, old_len,823823- r_zeros_number;11801180+ int old_key_comp, old_len, r_zeros_number;8241181 const char *r_body;8251182 int version;8261183···8331192 old_len = ih_item_len(ih);83411938351194 /* Calculate key component and item length to insert into S_new[i] */836836- set_le_ih_k_offset(ih,837837- le_ih_k_offset(ih) +838838- ((old_len -839839- sbytes[i]) <<840840- (is_indirect_le_ih841841- (ih) ? tb->tb_sb->842842- s_blocksize_bits -843843- UNFM_P_SHIFT :844844- 0)));11951195+ set_le_ih_k_offset(ih, le_ih_k_offset(ih) +11961196+ ((old_len - sbytes[i]) << (is_indirect_le_ih(ih) ? tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT : 0)));84511978461198 put_ih_item_len(ih, sbytes[i]);8471199···84312098441210 if ((old_len - sbytes[i]) > zeros_num) {8451211 r_zeros_number = 0;846846- r_body =847847- body + (old_len -848848- sbytes[i]) -849849- zeros_num;12121212+ r_body = body + (old_len - sbytes[i]) - zeros_num;8501213 } else {8511214 r_body = body;852852- r_zeros_number =853853- zeros_num - (old_len -854854- sbytes[i]);12151215+ r_zeros_number = zeros_num - (old_len - sbytes[i]);8551216 zeros_num -= r_zeros_number;8561217 }8571218858858- leaf_insert_into_buf(&bi, 0, ih, r_body,859859- r_zeros_number);12191219+ leaf_insert_into_buf(&bi, 0, ih, r_body, r_zeros_number);86012208611221 /* Calculate key component and item length to insert into S[i] */8621222 set_le_ih_k_offset(ih, old_key_comp);863863- put_ih_item_len(ih,864864- old_len - sbytes[i]);12231223+ put_ih_item_len(ih, old_len - sbytes[i]);8651224 tb->insert_size[0] -= sbytes[i];8661225 } else { /* whole new item falls into S_new[i] */86712268681227 /* Shift snum[0] - 1 items to S_new[i] (sbytes[i] of split item) */8691228 leaf_move_items(LEAF_FROM_S_TO_SNEW, tb,870870- snum[i] - 1, sbytes[i],871871- S_new[i]);12291229+ snum[i] - 1, sbytes[i], S_new[i]);87212308731231 /* Insert new item into S_new[i] */8741232 buffer_info_init_bh(tb, &bi, S_new[i]);875875- leaf_insert_into_buf(&bi,876876- item_pos - n +877877- snum[i] - 1, ih,878878- body, zeros_num);12331233+ leaf_insert_into_buf(&bi, item_pos - n + snum[i] - 1,12341234+ ih, body, zeros_num);87912358801236 zeros_num = tb->insert_size[0] = 0;8811237 }···89212688931269 int entry_count;8941270895895- entry_count =896896- ih_entry_count(aux_ih);12711271+ entry_count = ih_entry_count(aux_ih);8971272898898- if (entry_count - sbytes[i] <899899- pos_in_item900900- && pos_in_item <=901901- entry_count) {12731273+ if (entry_count - sbytes[i] < pos_in_item && pos_in_item <= entry_count) {9021274 /* new directory entry falls into S_new[i] */9031275904904- RFALSE(!tb->905905- insert_size[0],906906- "PAP-12215: insert_size is already 0");907907- RFALSE(sbytes[i] - 1 >=908908- entry_count,12761276+ RFALSE(!tb->insert_size[0], "PAP-12215: insert_size is already 0");12771277+ RFALSE(sbytes[i] - 1 >= entry_count,9091278 "PAP-12220: there are no so much entries (%d), only %d",910910- sbytes[i] - 1,911911- entry_count);12791279+ sbytes[i] - 1, entry_count);91212809131281 /* Shift snum[i]-1 items in whole. Shift sbytes[i] directory entries from directory item number snum[i] */914914- leaf_move_items915915- (LEAF_FROM_S_TO_SNEW,916916- tb, snum[i],917917- sbytes[i] - 1,918918- S_new[i]);12821282+ leaf_move_items(LEAF_FROM_S_TO_SNEW, tb, snum[i], sbytes[i] - 1, S_new[i]);9191283 /* Paste given directory entry to directory item */9201284 buffer_info_init_bh(tb, &bi, S_new[i]);921921- leaf_paste_in_buffer922922- (&bi, 0,923923- pos_in_item -924924- entry_count +925925- sbytes[i] - 1,926926- tb->insert_size[0],927927- body, zeros_num);12851285+ leaf_paste_in_buffer(&bi, 0, pos_in_item - entry_count + sbytes[i] - 1,12861286+ tb->insert_size[0], body, zeros_num);9281287 /* paste new directory entry */929929- leaf_paste_entries(&bi,930930- 0,931931- pos_in_item932932- -933933- entry_count934934- +935935- sbytes936936- [i] -937937- 1, 1,938938- (struct939939- reiserfs_de_head940940- *)941941- body,942942- body943943- +944944- DEH_SIZE,945945- tb->946946- insert_size947947- [0]948948- );12881288+ leaf_paste_entries(&bi, 0, pos_in_item - entry_count + sbytes[i] - 1, 1,12891289+ (struct reiserfs_de_head *) body,12901290+ body + DEH_SIZE, tb->insert_size[0]);9491291 tb->insert_size[0] = 0;9501292 pos_in_item++;9511293 } else { /* new directory entry doesn't fall into S_new[i] */952952- leaf_move_items953953- (LEAF_FROM_S_TO_SNEW,954954- tb, snum[i],955955- sbytes[i],956956- S_new[i]);12941294+ leaf_move_items(LEAF_FROM_S_TO_SNEW,tb, snum[i], sbytes[i], S_new[i]);9571295 }9581296 } else { /* regular object */9591297960960- int n_shift, n_rem,961961- r_zeros_number;12981298+ int n_shift, n_rem, r_zeros_number;9621299 const char *r_body;9631300964964- RFALSE(pos_in_item !=965965- ih_item_len966966- (B_N_PITEM_HEAD967967- (tbS0, item_pos))968968- || tb->insert_size[0] <=969969- 0,13011301+ RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)) || tb->insert_size[0] <= 0,9701302 "PAP-12225: item too short or insert_size <= 0");97113039721304 /* Calculate number of bytes which must be shifted from appended item */973973- n_shift =974974- sbytes[i] -975975- tb->insert_size[0];13051305+ n_shift = sbytes[i] - tb->insert_size[0];9761306 if (n_shift < 0)9771307 n_shift = 0;978978- leaf_move_items979979- (LEAF_FROM_S_TO_SNEW, tb,980980- snum[i], n_shift,981981- S_new[i]);13081308+ leaf_move_items(LEAF_FROM_S_TO_SNEW, tb, snum[i], n_shift, S_new[i]);98213099831310 /* Calculate number of bytes which must remain in body after append to S_new[i] */984984- n_rem =985985- tb->insert_size[0] -986986- sbytes[i];13111311+ n_rem = tb->insert_size[0] - sbytes[i];9871312 if (n_rem < 0)9881313 n_rem = 0;9891314 /* Append part of body into S_new[0] */9901315 buffer_info_init_bh(tb, &bi, S_new[i]);9911316 if (n_rem > zeros_num) {9921317 r_zeros_number = 0;993993- r_body =994994- body + n_rem -995995- zeros_num;13181318+ r_body = body + n_rem - zeros_num;9961319 } else {9971320 r_body = body;998998- r_zeros_number =999999- zeros_num - n_rem;10001000- zeros_num -=10011001- r_zeros_number;13211321+ r_zeros_number = zeros_num - n_rem;13221322+ zeros_num -= r_zeros_number;10021323 }1003132410041004- leaf_paste_in_buffer(&bi, 0,10051005- n_shift,10061006- tb->10071007- insert_size10081008- [0] -10091009- n_rem,10101010- r_body,10111011- r_zeros_number);13251325+ leaf_paste_in_buffer(&bi, 0, n_shift,13261326+ tb->insert_size[0] - n_rem,13271327+ r_body, r_zeros_number);10121328 {10131329 struct item_head *tmp;1014133010151015- tmp =10161016- B_N_PITEM_HEAD(S_new10171017- [i],10181018- 0);13311331+ tmp = B_N_PITEM_HEAD(S_new[i], 0);10191332 if (is_indirect_le_ih10201333 (tmp)) {10211021- set_ih_free_space10221022- (tmp, 0);10231023- set_le_ih_k_offset10241024- (tmp,10251025- le_ih_k_offset10261026- (tmp) +10271027- (n_rem <<10281028- (tb->10291029- tb_sb->10301030- s_blocksize_bits10311031- -10321032- UNFM_P_SHIFT)));13341334+ set_ih_free_space(tmp, 0);13351335+ set_le_ih_k_offset(tmp, le_ih_k_offset(tmp) + (n_rem << (tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT)));10331336 } else {10341034- set_le_ih_k_offset10351035- (tmp,10361036- le_ih_k_offset10371037- (tmp) +10381038- n_rem);13371337+ set_le_ih_k_offset(tmp, le_ih_k_offset(tmp) + n_rem);10391338 }10401339 }10411340···9731426 struct item_head *pasted;97414279751428#ifdef CONFIG_REISERFS_CHECK976976- struct item_head *ih_check =977977- B_N_PITEM_HEAD(tbS0, item_pos);14291429+ struct item_head *ih_check = B_N_PITEM_HEAD(tbS0, item_pos);97814309791431 if (!is_direntry_le_ih(ih_check)9801432 && (pos_in_item != ih_item_len(ih_check)···9851439 "to ih_item_len");9861440#endif /* CONFIG_REISERFS_CHECK */9871441988988- leaf_mi =989989- leaf_move_items(LEAF_FROM_S_TO_SNEW,14421442+ leaf_mi = leaf_move_items(LEAF_FROM_S_TO_SNEW,9901443 tb, snum[i],9911444 sbytes[i],9921445 S_new[i]);···9971452 /* paste into item */9981453 buffer_info_init_bh(tb, &bi, S_new[i]);9991454 leaf_paste_in_buffer(&bi,10001000- item_pos - n +10011001- snum[i],14551455+ item_pos - n + snum[i],10021456 pos_in_item,10031457 tb->insert_size[0],10041458 body, zeros_num);1005145910061006- pasted =10071007- B_N_PITEM_HEAD(S_new[i],10081008- item_pos - n +10091009- snum[i]);14601460+ pasted = B_N_PITEM_HEAD(S_new[i], item_pos - n + snum[i]);10101461 if (is_direntry_le_ih(pasted)) {10111462 leaf_paste_entries(&bi,10121012- item_pos -10131013- n + snum[i],10141014- pos_in_item,10151015- 1,10161016- (struct10171017- reiserfs_de_head10181018- *)body,10191019- body +10201020- DEH_SIZE,10211021- tb->10221022- insert_size10231023- [0]14631463+ item_pos - n + snum[i],14641464+ pos_in_item, 1,14651465+ (struct reiserfs_de_head *)body,14661466+ body + DEH_SIZE,14671467+ tb->insert_size[0]10241468 );10251469 }10261470···10291495 default: /* cases d and t */10301496 reiserfs_panic(tb->tb_sb, "PAP-12245",10311497 "blknum > 2: unexpected mode: %s(%d)",10321032- (flag ==10331033- M_DELETE) ? "DELETE" : ((flag ==10341034- M_CUT) ? "CUT"10351035- : "UNKNOWN"),10361036- flag);14981498+ (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);10371499 }1038150010391501 memcpy(insert_key + i, B_N_PKEY(S_new[i], 0), KEY_SIZE);···10541524 /* If we insert the first key change the delimiting key */10551525 if (item_pos == 0) {10561526 if (tb->CFL[0]) /* can be 0 in reiserfsck */10571057- replace_key(tb, tb->CFL[0], tb->lkey[0],10581058- tbS0, 0);10591059-15271527+ replace_key(tb, tb->CFL[0], tb->lkey[0], tbS0, 0);10601528 }10611529 break;10621530···10641536 pasted = B_N_PITEM_HEAD(tbS0, item_pos);10651537 /* when directory, may be new entry already pasted */10661538 if (is_direntry_le_ih(pasted)) {10671067- if (pos_in_item >= 0 &&10681068- pos_in_item <=10691069- ih_entry_count(pasted)) {15391539+ if (pos_in_item >= 0 && pos_in_item <= ih_entry_count(pasted)) {1070154010711541 RFALSE(!tb->insert_size[0],10721542 "PAP-12260: insert_size is 0 already");1073154310741544 /* prepare space */10751545 buffer_info_init_tbS0(tb, &bi);10761076- leaf_paste_in_buffer(&bi,10771077- item_pos,10781078- pos_in_item,10791079- tb->10801080- insert_size10811081- [0], body,15461546+ leaf_paste_in_buffer(&bi, item_pos, pos_in_item,15471547+ tb->insert_size[0], body,10821548 zeros_num);1083154910841550 /* paste entry */10851085- leaf_paste_entries(&bi,10861086- item_pos,10871087- pos_in_item,10881088- 1,10891089- (struct10901090- reiserfs_de_head10911091- *)body,10921092- body +10931093- DEH_SIZE,10941094- tb->10951095- insert_size10961096- [0]10971097- );15511551+ leaf_paste_entries(&bi, item_pos, pos_in_item, 1,15521552+ (struct reiserfs_de_head *)body,15531553+ body + DEH_SIZE,15541554+ tb->insert_size[0]);10981555 if (!item_pos && !pos_in_item) {10991099- RFALSE(!tb->CFL[0]11001100- || !tb->L[0],15561556+ RFALSE(!tb->CFL[0] || !tb->L[0],11011557 "PAP-12270: CFL[0]/L[0] must be specified");11021102- if (tb->CFL[0]) {11031103- replace_key(tb,11041104- tb->11051105- CFL11061106- [0],11071107- tb->11081108- lkey11091109- [0],11101110- tbS0,11111111- 0);11121112-11131113- }15581558+ if (tb->CFL[0])15591559+ replace_key(tb, tb->CFL[0], tb->lkey[0], tbS0, 0);11141560 }11151561 tb->insert_size[0] = 0;11161562 }···10951593 "PAP-12275: insert size must not be %d",10961594 tb->insert_size[0]);10971595 buffer_info_init_tbS0(tb, &bi);10981098- leaf_paste_in_buffer(&bi,10991099- item_pos,11001100- pos_in_item,11011101- tb->11021102- insert_size11031103- [0], body,11041104- zeros_num);15961596+ leaf_paste_in_buffer(&bi, item_pos, pos_in_item,15971597+ tb->insert_size[0], body, zeros_num);1105159811061599 if (is_indirect_le_ih(pasted)) {11071600#if 0···11081611 tb->11091612 insert_size[0]);11101613#endif11111111- set_ih_free_space11121112- (pasted, 0);16141614+ set_ih_free_space(pasted, 0);11131615 }11141616 tb->insert_size[0] = 0;11151617 }···11161620 else {11171621 if (tb->insert_size[0]) {11181622 print_cur_tb("12285");11191119- reiserfs_panic(tb->11201120- tb_sb,16231623+ reiserfs_panic(tb->tb_sb,11211624 "PAP-12285",11221625 "insert_size "11231626 "must be 0 "
+6-9
fs/sync.c
···2727 * wait == 1 case since in that case write_inode() functions do2828 * sync_dirty_buffer() and thus effectively write one block at a time.2929 */3030-static int __sync_filesystem(struct super_block *sb, int wait,3131- unsigned long start)3030+static int __sync_filesystem(struct super_block *sb, int wait)3231{3332 if (wait)3434- sync_inodes_sb(sb, start);3333+ sync_inodes_sb(sb);3534 else3635 writeback_inodes_sb(sb, WB_REASON_SYNC);3736···4748int sync_filesystem(struct super_block *sb)4849{4950 int ret;5050- unsigned long start = jiffies;51515252 /*5353 * We need to be protected against the filesystem going from···6062 if (sb->s_flags & MS_RDONLY)6163 return 0;62646363- ret = __sync_filesystem(sb, 0, start);6565+ ret = __sync_filesystem(sb, 0);6466 if (ret < 0)6567 return ret;6666- return __sync_filesystem(sb, 1, start);6868+ return __sync_filesystem(sb, 1);6769}6870EXPORT_SYMBOL_GPL(sync_filesystem);69717072static void sync_inodes_one_sb(struct super_block *sb, void *arg)7173{7274 if (!(sb->s_flags & MS_RDONLY))7373- sync_inodes_sb(sb, *((unsigned long *)arg));7575+ sync_inodes_sb(sb);7476}75777678static void sync_fs_one_sb(struct super_block *sb, void *arg)···102104SYSCALL_DEFINE0(sync)103105{104106 int nowait = 0, wait = 1;105105- unsigned long start = jiffies;106107107108 wakeup_flusher_threads(0, WB_REASON_SYNC);108108- iterate_supers(sync_inodes_one_sb, &start);109109+ iterate_supers(sync_inodes_one_sb, NULL);109110 iterate_supers(sync_fs_one_sb, &nowait);110111 iterate_supers(sync_fs_one_sb, &wait);111112 iterate_bdevs(fdatawrite_one_bdev, NULL);
···265265 .nr_to_write = 1,266266 };267267268268+ WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex));268269 if (!iinfo->i_lenAlloc) {269270 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))270271 iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
+8-8
fs/xfs/xfs_iops.c
···705705{706706 struct xfs_mount *mp = ip->i_mount;707707 struct inode *inode = VFS_I(ip);708708- int mask = iattr->ia_valid;709708 xfs_off_t oldsize, newsize;710709 struct xfs_trans *tp;711710 int error;···725726726727 ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));727728 ASSERT(S_ISREG(ip->i_d.di_mode));728728- ASSERT((mask & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET|729729- ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);729729+ ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET|730730+ ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);730731731732 oldsize = inode->i_size;732733 newsize = iattr->ia_size;···735736 * Short circuit the truncate case for zero length files.736737 */737738 if (newsize == 0 && oldsize == 0 && ip->i_d.di_nextents == 0) {738738- if (!(mask & (ATTR_CTIME|ATTR_MTIME)))739739+ if (!(iattr->ia_valid & (ATTR_CTIME|ATTR_MTIME)))739740 return 0;740741741742 /*···823824 * these flags set. For all other operations the VFS set these flags824825 * explicitly if it wants a timestamp update.825826 */826826- if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME)))) {827827+ if (newsize != oldsize &&828828+ !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {827829 iattr->ia_ctime = iattr->ia_mtime =828830 current_fs_time(inode->i_sb);829829- mask |= ATTR_CTIME | ATTR_MTIME;831831+ iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;830832 }831833832834 /*···863863 xfs_inode_clear_eofblocks_tag(ip);864864 }865865866866- if (mask & ATTR_MODE)866866+ if (iattr->ia_valid & ATTR_MODE)867867 xfs_setattr_mode(ip, iattr);868868- if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))868868+ if (iattr->ia_valid & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))869869 xfs_setattr_time(ip, iattr);870870871871 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+15-4
fs/xfs/xfs_log_cil.c
···205205 /*206206 * We 64-bit align the length of each iovec so that the start207207 * of the next one is naturally aligned. We'll need to208208- * account for that slack space here.208208+ * account for that slack space here. Then round nbytes up209209+ * to 64-bit alignment so that the initial buffer alignment is210210+ * easy to calculate and verify.209211 */210212 nbytes += niovecs * sizeof(uint64_t);213213+ nbytes = round_up(nbytes, sizeof(uint64_t));211214212215 /* grab the old item if it exists for reservation accounting */213216 old_lv = lip->li_lv;214217215215- /* calc buffer size */216216- buf_size = sizeof(struct xfs_log_vec) + nbytes +217217- niovecs * sizeof(struct xfs_log_iovec);218218+ /*219219+ * The data buffer needs to start 64-bit aligned, so round up220220+ * that space to ensure we can align it appropriately and not221221+ * overrun the buffer.222222+ */223223+ buf_size = nbytes +224224+ round_up((sizeof(struct xfs_log_vec) +225225+ niovecs * sizeof(struct xfs_log_iovec)),226226+ sizeof(uint64_t));218227219228 /* compare to existing item size */220229 if (lip->li_lv && buf_size <= lip->li_lv->lv_size) {···260251 /* The allocated data region lies beyond the iovec region */261252 lv->lv_buf_len = 0;262253 lv->lv_buf = (char *)lv + buf_size - nbytes;254254+ ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));255255+263256 lip->li_ops->iop_format(lip, lv);264257insert:265258 ASSERT(lv->lv_buf_len <= nbytes);
+16-8
fs/xfs/xfs_mount.c
···282282 struct xfs_sb *sbp = &mp->m_sb;283283 int error;284284 int loud = !(flags & XFS_MFSI_QUIET);285285+ const struct xfs_buf_ops *buf_ops;285286286287 ASSERT(mp->m_sb_bp == NULL);287288 ASSERT(mp->m_ddev_targp != NULL);289289+290290+ /*291291+ * For the initial read, we must guess at the sector292292+ * size based on the block device. It's enough to293293+ * get the sb_sectsize out of the superblock and294294+ * then reread with the proper length.295295+ * We don't verify it yet, because it may not be complete.296296+ */297297+ sector_size = xfs_getsize_buftarg(mp->m_ddev_targp);298298+ buf_ops = NULL;288299289300 /*290301 * Allocate a (locked) buffer to hold the superblock.291302 * This will be kept around at all times to optimize292303 * access to the superblock.293304 */294294- sector_size = xfs_getsize_buftarg(mp->m_ddev_targp);295295-296305reread:297306 bp = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR,298298- BTOBB(sector_size), 0,299299- loud ? &xfs_sb_buf_ops300300- : &xfs_sb_quiet_buf_ops);307307+ BTOBB(sector_size), 0, buf_ops);301308 if (!bp) {302309 if (loud)303310 xfs_warn(mp, "SB buffer read failed");···335328 }336329337330 /*338338- * If device sector size is smaller than the superblock size,339339- * re-read the superblock so the buffer is correctly sized.331331+ * Re-read the superblock so the buffer is correctly sized,332332+ * and properly verified.340333 */341341- if (sector_size < sbp->sb_sectsize) {334334+ if (buf_ops == NULL) {342335 xfs_buf_relse(bp);343336 sector_size = sbp->sb_sectsize;337337+ buf_ops = loud ? &xfs_sb_buf_ops : &xfs_sb_quiet_buf_ops;344338 goto reread;345339 }346340
+4-6
fs/xfs/xfs_sb.c
···295295 sbp->sb_dblocks == 0 ||296296 sbp->sb_dblocks > XFS_MAX_DBLOCKS(sbp) ||297297 sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp))) {298298- XFS_CORRUPTION_ERROR("SB sanity check failed",299299- XFS_ERRLEVEL_LOW, mp, sbp);298298+ xfs_notice(mp, "SB sanity check failed");300299 return XFS_ERROR(EFSCORRUPTED);301300 }302301···610611 XFS_SB_VERSION_5) ||611612 dsb->sb_crc != 0)) {612613613613- if (!xfs_verify_cksum(bp->b_addr, be16_to_cpu(dsb->sb_sectsize),614614+ if (!xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),614615 offsetof(struct xfs_sb, sb_crc))) {615616 /* Only fail bad secondaries on a known V5 filesystem */616616- if (bp->b_bn != XFS_SB_DADDR &&617617+ if (bp->b_bn == XFS_SB_DADDR ||617618 xfs_sb_version_hascrc(&mp->m_sb)) {618619 error = EFSCORRUPTED;619620 goto out_error;···624625625626out_error:626627 if (error) {627627- if (error != EWRONGFS)628628+ if (error == EFSCORRUPTED)628629 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW,629630 mp, bp->b_addr);630631 xfs_buf_ioerror(bp, error);···642643 struct xfs_buf *bp)643644{644645 struct xfs_dsb *dsb = XFS_BUF_TO_SBP(bp);645645-646646647647 if (dsb->sb_magicnum == cpu_to_be32(XFS_SB_MAGIC)) {648648 /* XFS filesystem, verify noisily! */
···166166 *167167 * The ID of the root cgroup is always 0, and a new cgroup168168 * will be assigned with a smallest available ID.169169+ *170170+ * Allocating/Removing ID must be protected by cgroup_mutex.169171 */170172 int id;171173
+4
include/linux/clk/ti.h
···245245void omap2_init_clk_clkdm(struct clk_hw *clk);246246unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,247247 unsigned long parent_rate);248248+int omap3_clkoutx2_set_rate(struct clk_hw *hw, unsigned long rate,249249+ unsigned long parent_rate);250250+long omap3_clkoutx2_round_rate(struct clk_hw *hw, unsigned long rate,251251+ unsigned long *prate);248252int omap2_clkops_enable_clkdm(struct clk_hw *hw);249253void omap2_clkops_disable_clkdm(struct clk_hw *hw);250254int omap2_clk_disable_autoidle_all(void);
···9999 struct fsnotify_mark *inode_mark,100100 struct fsnotify_mark *vfsmount_mark,101101 u32 mask, void *data, int data_type,102102- const unsigned char *file_name);102102+ const unsigned char *file_name, u32 cookie);103103 void (*free_group_priv)(struct fsnotify_group *group);104104 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);105105 void (*free_event)(struct fsnotify_event *event);···160160161161 struct fasync_struct *fsn_fa; /* async notification */162162163163- struct fsnotify_event overflow_event; /* Event we queue when the163163+ struct fsnotify_event *overflow_event; /* Event we queue when the164164 * notification list is too165165 * full */166166
-41
include/linux/huge_mm.h
···157157 return HPAGE_PMD_NR;158158 return 1;159159}160160-/*161161- * compound_trans_head() should be used instead of compound_head(),162162- * whenever the "page" passed as parameter could be the tail of a163163- * transparent hugepage that could be undergoing a164164- * __split_huge_page_refcount(). The page structure layout often165165- * changes across releases and it makes extensive use of unions. So if166166- * the page structure layout will change in a way that167167- * page->first_page gets clobbered by __split_huge_page_refcount, the168168- * implementation making use of smp_rmb() will be required.169169- *170170- * Currently we define compound_trans_head as compound_head, because171171- * page->private is in the same union with page->first_page, and172172- * page->private isn't clobbered. However this also means we're173173- * currently leaving dirt into the page->private field of anonymous174174- * pages resulting from a THP split, instead of setting page->private175175- * to zero like for every other page that has PG_private not set. But176176- * anonymous pages don't use page->private so this is not a problem.177177- */178178-#if 0179179-/* This will be needed if page->private will be clobbered in split_huge_page */180180-static inline struct page *compound_trans_head(struct page *page)181181-{182182- if (PageTail(page)) {183183- struct page *head;184184- head = page->first_page;185185- smp_rmb();186186- /*187187- * head may be a dangling pointer.188188- * __split_huge_page_refcount clears PageTail before189189- * overwriting first_page, so if PageTail is still190190- * there it means the head pointer isn't dangling.191191- */192192- if (PageTail(page))193193- return head;194194- }195195- return page;196196-}197197-#else198198-#define compound_trans_head(page) compound_head(page)199199-#endif200160201161extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,202162 unsigned long addr, pmd_t pmd, pmd_t *pmdp);···186226 do { } while (0)187227#define split_huge_page_pmd_mm(__mm, __address, __pmd) \188228 do { } while (0)189189-#define compound_trans_head(page) compound_head(page)190229static inline int hugepage_madvise(struct vm_area_struct *vma,191230 unsigned long *vm_flags, int advice)192231{
-2
include/linux/ipc_namespace.h
···118118 * the new maximum will handle anyone else. I may have to revisit this119119 * in the future.120120 */121121-#define MIN_QUEUESMAX 1122121#define DFLT_QUEUESMAX 256123123-#define HARD_QUEUESMAX 1024124122#define MIN_MSGMAX 1125123#define DFLT_MSG 10U126124#define DFLT_MSGMAX 10
+6
include/linux/irq.h
···303303 * @irq_pm_shutdown: function called from core code on shutdown once per chip304304 * @irq_calc_mask: Optional function to set irq_data.mask for special cases305305 * @irq_print_chip: optional to print special chip info in show_interrupts306306+ * @irq_request_resources: optional to request resources before calling307307+ * any other callback related to this irq308308+ * @irq_release_resources: optional to release resources acquired with309309+ * irq_request_resources306310 * @flags: chip specific flags307311 */308312struct irq_chip {···340336 void (*irq_calc_mask)(struct irq_data *data);341337342338 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);339339+ int (*irq_request_resources)(struct irq_data *data);340340+ void (*irq_release_resources)(struct irq_data *data);343341344342 unsigned long flags;345343};
···387387 struct i2c_client *muic; /* slave addr 0x4a */388388 struct mutex iolock;389389390390- int type;390390+ unsigned long type;391391 struct platform_device *battery; /* battery control (not fuel gauge) */392392393393 int irq;
+1-1
include/linux/mfd/max8998-private.h
···163163 int ono;164164 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];165165 u8 irq_masks_cache[MAX8998_NUM_IRQ_REGS];166166- int type;166166+ unsigned long type;167167 bool wakeup;168168};169169
+2-2
include/linux/mfd/tps65217.h
···252252struct tps65217 {253253 struct device *dev;254254 struct tps65217_board *pdata;255255- unsigned int id;255255+ unsigned long id;256256 struct regulator_desc desc[TPS65217_NUM_REGULATOR];257257 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];258258 struct regmap *regmap;···263263 return dev_get_drvdata(dev);264264}265265266266-static inline int tps65217_chip_id(struct tps65217 *tps65217)266266+static inline unsigned long tps65217_chip_id(struct tps65217 *tps65217)267267{268268 return tps65217->id;269269}
+15-5
include/linux/mm.h
···175175 * Special vmas that are non-mergable, non-mlock()able.176176 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.177177 */178178-#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP)178178+#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)179179180180/*181181 * mapping from the currently active vm_flags protection bits (the···399399400400static inline struct page *compound_head(struct page *page)401401{402402- if (unlikely(PageTail(page)))403403- return page->first_page;402402+ if (unlikely(PageTail(page))) {403403+ struct page *head = page->first_page;404404+405405+ /*406406+ * page->first_page may be a dangling pointer to an old407407+ * compound page, so recheck that it is still a tail408408+ * page before returning.409409+ */410410+ smp_rmb();411411+ if (likely(PageTail(page)))412412+ return head;413413+ }404414 return page;405415}406416···767757#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS768758static inline int page_cpupid_xchg_last(struct page *page, int cpupid)769759{770770- return xchg(&page->_last_cpupid, cpupid);760760+ return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK);771761}772762773763static inline int page_cpupid_last(struct page *page)···776766}777767static inline void page_cpupid_reset_last(struct page *page)778768{779779- page->_last_cpupid = -1;769769+ page->_last_cpupid = -1 & LAST_CPUPID_MASK;780770}781771#else782772static inline int page_cpupid_last(struct page *page)
+32-4
include/linux/netdevice.h
···752752 unsigned char id_len;753753};754754755755+typedef u16 (*select_queue_fallback_t)(struct net_device *dev,756756+ struct sk_buff *skb);757757+755758/*756759 * This structure defines the management hooks for network devices.757760 * The following hooks can be defined; unless noted otherwise, they are···786783 * Required can not be NULL.787784 *788785 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,789789- * void *accel_priv);786786+ * void *accel_priv, select_queue_fallback_t fallback);790787 * Called to decide which queue to when device supports multiple791788 * transmit queues.792789 *···10081005 struct net_device *dev);10091006 u16 (*ndo_select_queue)(struct net_device *dev,10101007 struct sk_buff *skb,10111011- void *accel_priv);10081008+ void *accel_priv,10091009+ select_queue_fallback_t fallback);10121010 void (*ndo_change_rx_flags)(struct net_device *dev,10131011 int flags);10141012 void (*ndo_set_rx_mode)(struct net_device *dev);···15551551struct netdev_queue *netdev_pick_tx(struct net_device *dev,15561552 struct sk_buff *skb,15571553 void *accel_priv);15581558-u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);1559155415601555/*15611556 * Net namespace inlines···22762273static inline void netdev_reset_queue(struct net_device *dev_queue)22772274{22782275 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));22762276+}22772277+22782278+/**22792279+ * netdev_cap_txqueue - check if selected tx queue exceeds device queues22802280+ * @dev: network device22812281+ * @queue_index: given tx queue index22822282+ *22832283+ * Returns 0 if given tx queue index >= number of device tx queues,22842284+ * otherwise returns the originally passed tx queue index.22852285+ */22862286+static inline u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index)22872287+{22882288+ if (unlikely(queue_index >= dev->real_num_tx_queues)) {22892289+ net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n",22902290+ dev->name, queue_index,22912291+ dev->real_num_tx_queues);22922292+ return 0;22932293+ }22942294+22952295+ return queue_index;22792296}2280229722812298/**···30913068void netif_stacked_transfer_operstate(const struct net_device *rootdev,30923069 struct net_device *dev);3093307030943094-netdev_features_t netif_skb_features(struct sk_buff *skb);30713071+netdev_features_t netif_skb_dev_features(struct sk_buff *skb,30723072+ const struct net_device *dev);30733073+static inline netdev_features_t netif_skb_features(struct sk_buff *skb)30743074+{30753075+ return netif_skb_dev_features(skb, skb->dev);30763076+}3095307730963078static inline bool net_gso_ok(netdev_features_t features, int gso_type)30973079{
···11691169void pci_restore_msi_state(struct pci_dev *dev);11701170int pci_msi_enabled(void);11711171int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);11721172+static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec)11731173+{11741174+ int rc = pci_enable_msi_range(dev, nvec, nvec);11751175+ if (rc < 0)11761176+ return rc;11771177+ return 0;11781178+}11721179int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,11731180 int minvec, int maxvec);11811181+static inline int pci_enable_msix_exact(struct pci_dev *dev,11821182+ struct msix_entry *entries, int nvec)11831183+{11841184+ int rc = pci_enable_msix_range(dev, entries, nvec, nvec);11851185+ if (rc < 0)11861186+ return rc;11871187+ return 0;11881188+}11741189#else11751190static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }11761191static inline int pci_enable_msi_block(struct pci_dev *dev, int nvec)···12041189static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,12051190 int maxvec)12061191{ return -ENOSYS; }11921192+static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec)11931193+{ return -ENOSYS; }12071194static inline int pci_enable_msix_range(struct pci_dev *dev,12081195 struct msix_entry *entries, int minvec, int maxvec)11961196+{ return -ENOSYS; }11971197+static inline int pci_enable_msix_exact(struct pci_dev *dev,11981198+ struct msix_entry *entries, int nvec)12091199{ return -ENOSYS; }12101200#endif12111201
+21-1
include/linux/skbuff.h
···2725272527262726static inline void nf_reset_trace(struct sk_buff *skb)27272727{27282728-#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE)27282728+#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES)27292729 skb->nf_trace = 0;27302730#endif27312731}···27412741#ifdef CONFIG_BRIDGE_NETFILTER27422742 dst->nf_bridge = src->nf_bridge;27432743 nf_bridge_get(src->nf_bridge);27442744+#endif27452745+#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES)27462746+ dst->nf_trace = src->nf_trace;27442747#endif27452748}27462749···29182915static inline bool skb_head_is_locked(const struct sk_buff *skb)29192916{29202917 return !skb->head_frag || skb_cloned(skb);29182918+}29192919+29202920+/**29212921+ * skb_gso_network_seglen - Return length of individual segments of a gso packet29222922+ *29232923+ * @skb: GSO skb29242924+ *29252925+ * skb_gso_network_seglen is used to determine the real size of the29262926+ * individual segments, including Layer3 (IP, IPv6) and L4 headers (TCP/UDP).29272927+ *29282928+ * The MAC/L2 header is not accounted for.29292929+ */29302930+static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb)29312931+{29322932+ unsigned int hdr_len = skb_transport_header(skb) -29332933+ skb_network_header(skb);29342934+ return hdr_len + skb_gso_transport_seglen(skb);29212935}29222936#endif /* __KERNEL__ */29232937#endif /* _LINUX_SKBUFF_H */
+4-2
include/linux/syscalls.h
···281281asmlinkage long sys_sched_setparam(pid_t pid,282282 struct sched_param __user *param);283283asmlinkage long sys_sched_setattr(pid_t pid,284284- struct sched_attr __user *attr);284284+ struct sched_attr __user *attr,285285+ unsigned int flags);285286asmlinkage long sys_sched_getscheduler(pid_t pid);286287asmlinkage long sys_sched_getparam(pid_t pid,287288 struct sched_param __user *param);288289asmlinkage long sys_sched_getattr(pid_t pid,289290 struct sched_attr __user *attr,290290- unsigned int size);291291+ unsigned int size,292292+ unsigned int flags);291293asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,292294 unsigned long __user *user_mask_ptr);293295asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
···16531653 /* This is the last advertised value of rwnd over a SACK chunk. */16541654 __u32 a_rwnd;1655165516561656- /* Number of bytes by which the rwnd has slopped. The rwnd is allowed16571657- * to slop over a maximum of the association's frag_point.16581658- */16591659- __u32 rwnd_over;16601660-16611661- /* Keeps treack of rwnd pressure. This happens when we have16621662- * a window, but not recevie buffer (i.e small packets). This one16631663- * is releases slowly (1 PMTU at a time ).16641664- */16651665- __u32 rwnd_press;16661666-16671656 /* This is the sndbuf size in use for the association.16681657 * This corresponds to the sndbuf size for the association,16691658 * as specified in the sk->sndbuf.···18811892__u32 sctp_association_get_next_tsn(struct sctp_association *);1882189318831894void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);18841884-void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);18851885-void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);18951895+void sctp_assoc_rwnd_update(struct sctp_association *, bool);18861896void sctp_assoc_set_primary(struct sctp_association *,18871897 struct sctp_transport *);18881898void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
+2-1
include/net/tcp.h
···13031303 /* Fast Open cookie. Size 0 means a cookie request */13041304 struct tcp_fastopen_cookie cookie;13051305 struct msghdr *data; /* data in MSG_FASTOPEN */13061306- u16 copied; /* queued in tcp_connect() */13061306+ size_t size;13071307+ int copied; /* queued in tcp_connect() */13071308};13081309void tcp_free_fastopen_req(struct tcp_sock *tp);13091310
···886886 * per-subsystem and moved to css->id so that lookups are887887 * successful until the target css is released.888888 */889889+ mutex_lock(&cgroup_mutex);889890 idr_remove(&cgrp->root->cgroup_idr, cgrp->id);891891+ mutex_unlock(&cgroup_mutex);890892 cgrp->id = -1;891893892894 call_rcu(&cgrp->rcu_head, cgroup_free_rcu);···15681566 mutex_lock(&cgroup_mutex);15691567 mutex_lock(&cgroup_root_mutex);1570156815711571- root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,15721572- 0, 1, GFP_KERNEL);15731573- if (root_cgrp->id < 0)15691569+ ret = idr_alloc(&root->cgroup_idr, root_cgrp, 0, 1, GFP_KERNEL);15701570+ if (ret < 0)15741571 goto unlock_drop;15721572+ root_cgrp->id = ret;1575157315761574 /* Check for name clashes with existing mounts */15771575 ret = -EBUSY;···27652763 */27662764 update_before = cgroup_serial_nr_next;2767276527682768- mutex_unlock(&cgroup_mutex);27692769-27702766 /* add/rm files for all cgroups created before */27712771- rcu_read_lock();27722767 css_for_each_descendant_pre(css, cgroup_css(root, ss)) {27732768 struct cgroup *cgrp = css->cgroup;27742769···2774277527752776 inode = cgrp->dentry->d_inode;27762777 dget(cgrp->dentry);27772777- rcu_read_unlock();27782778-27792778 dput(prev);27802779 prev = cgrp->dentry;2781278027812781+ mutex_unlock(&cgroup_mutex);27822782 mutex_lock(&inode->i_mutex);27832783 mutex_lock(&cgroup_mutex);27842784 if (cgrp->serial_nr < update_before && !cgroup_is_dead(cgrp))27852785 ret = cgroup_addrm_files(cgrp, cfts, is_add);27862786- mutex_unlock(&cgroup_mutex);27872786 mutex_unlock(&inode->i_mutex);27882788-27892789- rcu_read_lock();27902787 if (ret)27912788 break;27922789 }27932793- rcu_read_unlock();27902790+ mutex_unlock(&cgroup_mutex);27942791 dput(prev);27952792 deactivate_super(sb);27962793 return ret;···29052910 * We should check if the process is exiting, otherwise29062911 * it will race with cgroup_exit() in that the list29072912 * entry won't be deleted though the process has exited.29132913+ * Do it while holding siglock so that we don't end up29142914+ * racing against cgroup_exit().29082915 */29162916+ spin_lock_irq(&p->sighand->siglock);29092917 if (!(p->flags & PF_EXITING) && list_empty(&p->cg_list))29102918 list_add(&p->cg_list, &task_css_set(p)->tasks);29192919+ spin_unlock_irq(&p->sighand->siglock);29202920+29112921 task_unlock(p);29122922 } while_each_thread(g, p);29132923 read_unlock(&tasklist_lock);···41584158 struct cgroup *cgrp;41594159 struct cgroup_name *name;41604160 struct cgroupfs_root *root = parent->root;41614161- int ssid, err = 0;41614161+ int ssid, err;41624162 struct cgroup_subsys *ss;41634163 struct super_block *sb = root->sb;41644164···41684168 return -ENOMEM;4169416941704170 name = cgroup_alloc_name(dentry);41714171- if (!name)41714171+ if (!name) {41724172+ err = -ENOMEM;41724173 goto err_free_cgrp;41744174+ }41734175 rcu_assign_pointer(cgrp->name, name);41744174-41754175- /*41764176- * Temporarily set the pointer to NULL, so idr_find() won't return41774177- * a half-baked cgroup.41784178- */41794179- cgrp->id = idr_alloc(&root->cgroup_idr, NULL, 1, 0, GFP_KERNEL);41804180- if (cgrp->id < 0)41814181- goto err_free_name;4182417641834177 /*41844178 * Only live parents can have children. Note that the liveliness···41834189 */41844190 if (!cgroup_lock_live_group(parent)) {41854191 err = -ENODEV;41864186- goto err_free_id;41924192+ goto err_free_name;41934193+ }41944194+41954195+ /*41964196+ * Temporarily set the pointer to NULL, so idr_find() won't return41974197+ * a half-baked cgroup.41984198+ */41994199+ cgrp->id = idr_alloc(&root->cgroup_idr, NULL, 1, 0, GFP_KERNEL);42004200+ if (cgrp->id < 0) {42014201+ err = -ENOMEM;42024202+ goto err_unlock;41874203 }4188420441894205 /* Grab a reference on the superblock so the hierarchy doesn't···42254221 */42264222 err = cgroup_create_file(dentry, S_IFDIR | mode, sb);42274223 if (err < 0)42284228- goto err_unlock;42244224+ goto err_free_id;42294225 lockdep_assert_held(&dentry->d_inode->i_mutex);4230422642314227 cgrp->serial_nr = cgroup_serial_nr_next++;···4261425742624258 return 0;4263425942644264-err_unlock:42654265- mutex_unlock(&cgroup_mutex);42664266- /* Release the reference count that we took on the superblock */42674267- deactivate_super(sb);42684260err_free_id:42694261 idr_remove(&root->cgroup_idr, cgrp->id);42624262+ /* Release the reference count that we took on the superblock */42634263+ deactivate_super(sb);42644264+err_unlock:42654265+ mutex_unlock(&cgroup_mutex);42704266err_free_name:42714267 kfree(rcu_dereference_raw(cgrp->name));42724268err_free_cgrp:
+3-7
kernel/cpuset.c
···974974 * Temporarilly set tasks mems_allowed to target nodes of migration,975975 * so that the migration code can allocate pages on these nodes.976976 *977977- * Call holding cpuset_mutex, so current's cpuset won't change978978- * during this call, as manage_mutex holds off any cpuset_attach()979979- * calls. Therefore we don't need to take task_lock around the980980- * call to guarantee_online_mems(), as we know no one is changing981981- * our task's cpuset.982982- *983977 * While the mm_struct we are migrating is typically from some984978 * other task, the task_struct mems_allowed that we are hacking985979 * is for our current task, which must allocate new pages for that···990996991997 do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL);992998999999+ rcu_read_lock();9931000 mems_cs = effective_nodemask_cpuset(task_cs(tsk));9941001 guarantee_online_mems(mems_cs, &tsk->mems_allowed);10021002+ rcu_read_unlock();9951003}99610049971005/*···2482248624832487 task_lock(current);24842488 cs = nearest_hardwall_ancestor(task_cs(current));24892489+ allowed = node_isset(node, cs->mems_allowed);24852490 task_unlock(current);2486249124872487- allowed = node_isset(node, cs->mems_allowed);24882492 mutex_unlock(&callback_mutex);24892493 return allowed;24902494}
···121121122122static void update_dl_migration(struct dl_rq *dl_rq)123123{124124- if (dl_rq->dl_nr_migratory && dl_rq->dl_nr_total > 1) {124124+ if (dl_rq->dl_nr_migratory && dl_rq->dl_nr_running > 1) {125125 if (!dl_rq->overloaded) {126126 dl_set_overload(rq_of_dl_rq(dl_rq));127127 dl_rq->overloaded = 1;···135135static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)136136{137137 struct task_struct *p = dl_task_of(dl_se);138138- dl_rq = &rq_of_dl_rq(dl_rq)->dl;139138140140- dl_rq->dl_nr_total++;141139 if (p->nr_cpus_allowed > 1)142140 dl_rq->dl_nr_migratory++;143141···145147static void dec_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)146148{147149 struct task_struct *p = dl_task_of(dl_se);148148- dl_rq = &rq_of_dl_rq(dl_rq)->dl;149150150150- dl_rq->dl_nr_total--;151151 if (p->nr_cpus_allowed > 1)152152 dl_rq->dl_nr_migratory--;153153···562566 return 1;563567}564568569569+extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);570570+565571/*566572 * Update the current task's runtime statistics (provided it is still567573 * a -deadline task and has not been removed from the dl_rq).···627629 struct rt_rq *rt_rq = &rq->rt;628630629631 raw_spin_lock(&rt_rq->rt_runtime_lock);630630- rt_rq->rt_time += delta_exec;631632 /*632633 * We'll let actual RT tasks worry about the overflow here, we633633- * have our own CBS to keep us inline -- see above.634634+ * have our own CBS to keep us inline; only account when RT635635+ * bandwidth is relevant.634636 */637637+ if (sched_rt_bandwidth_account(rt_rq))638638+ rt_rq->rt_time += delta_exec;635639 raw_spin_unlock(&rt_rq->rt_runtime_lock);636640 }637641}···717717718718 WARN_ON(!dl_prio(prio));719719 dl_rq->dl_nr_running++;720720+ inc_nr_running(rq_of_dl_rq(dl_rq));720721721722 inc_dl_deadline(dl_rq, deadline);722723 inc_dl_migration(dl_se, dl_rq);···731730 WARN_ON(!dl_prio(prio));732731 WARN_ON(!dl_rq->dl_nr_running);733732 dl_rq->dl_nr_running--;733733+ dec_nr_running(rq_of_dl_rq(dl_rq));734734735735 dec_dl_deadline(dl_rq, dl_se->deadline);736736 dec_dl_migration(dl_se, dl_rq);···838836839837 if (!task_current(rq, p) && p->nr_cpus_allowed > 1)840838 enqueue_pushable_dl_task(rq, p);841841-842842- inc_nr_running(rq);843839}844840845841static void __dequeue_task_dl(struct rq *rq, struct task_struct *p, int flags)···850850{851851 update_curr_dl(rq);852852 __dequeue_task_dl(rq, p, flags);853853-854854- dec_nr_running(rq);855853}856854857855/*
+6-4
kernel/sched/fair.c
···17571757 start = end;17581758 if (pages <= 0)17591759 goto out;17601760+17611761+ cond_resched();17601762 } while (end != vma->vm_end);17611763 }17621764···70016999 struct cfs_rq *cfs_rq = cfs_rq_of(se);7002700070037001 /*70047004- * Ensure the task's vruntime is normalized, so that when its70027002+ * Ensure the task's vruntime is normalized, so that when it's70057003 * switched back to the fair class the enqueue_entity(.flags=0) will70067004 * do the right thing.70077005 *70087008- * If it was on_rq, then the dequeue_entity(.flags=0) will already70097009- * have normalized the vruntime, if it was !on_rq, then only when70067006+ * If it's on_rq, then the dequeue_entity(.flags=0) will already70077007+ * have normalized the vruntime, if it's !on_rq, then only when70107008 * the task is sleeping will it still have non-normalized vruntime.70117009 */70127012- if (!se->on_rq && p->state != TASK_RUNNING) {70107010+ if (!p->on_rq && p->state != TASK_RUNNING) {70137011 /*70147012 * Fix up our vruntime so that the current sleep doesn't70157013 * cause 'unlimited' sleep bonus.
+8
kernel/sched/rt.c
···538538539539#endif /* CONFIG_RT_GROUP_SCHED */540540541541+bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)542542+{543543+ struct rt_bandwidth *rt_b = sched_rt_bandwidth(rt_rq);544544+545545+ return (hrtimer_active(&rt_b->rt_period_timer) ||546546+ rt_rq->rt_time < rt_b->rt_runtime);547547+}548548+541549#ifdef CONFIG_SMP542550/*543551 * We ran out of runtime, see if we can borrow some from our neighbours.
···116116void __init sched_clock_register(u64 (*read)(void), int bits,117117 unsigned long rate)118118{119119+ u64 res, wrap, new_mask, new_epoch, cyc, ns;120120+ u32 new_mult, new_shift;121121+ ktime_t new_wrap_kt;119122 unsigned long r;120120- u64 res, wrap;121123 char r_unit;122124123125 if (cd.rate > rate)124126 return;125127126128 WARN_ON(!irqs_disabled());127127- read_sched_clock = read;128128- sched_clock_mask = CLOCKSOURCE_MASK(bits);129129- cd.rate = rate;130129131130 /* calculate the mult/shift to convert counter ticks to ns. */132132- clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 3600);131131+ clocks_calc_mult_shift(&new_mult, &new_shift, rate, NSEC_PER_SEC, 3600);132132+133133+ new_mask = CLOCKSOURCE_MASK(bits);134134+135135+ /* calculate how many ns until we wrap */136136+ wrap = clocks_calc_max_nsecs(new_mult, new_shift, 0, new_mask);137137+ new_wrap_kt = ns_to_ktime(wrap - (wrap >> 3));138138+139139+ /* update epoch for new counter and update epoch_ns from old counter*/140140+ new_epoch = read();141141+ cyc = read_sched_clock();142142+ ns = cd.epoch_ns + cyc_to_ns((cyc - cd.epoch_cyc) & sched_clock_mask,143143+ cd.mult, cd.shift);144144+145145+ raw_write_seqcount_begin(&cd.seq);146146+ read_sched_clock = read;147147+ sched_clock_mask = new_mask;148148+ cd.rate = rate;149149+ cd.wrap_kt = new_wrap_kt;150150+ cd.mult = new_mult;151151+ cd.shift = new_shift;152152+ cd.epoch_cyc = new_epoch;153153+ cd.epoch_ns = ns;154154+ raw_write_seqcount_end(&cd.seq);133155134156 r = rate;135157 if (r >= 4000000) {···163141 } else164142 r_unit = ' ';165143166166- /* calculate how many ns until we wrap */167167- wrap = clocks_calc_max_nsecs(cd.mult, cd.shift, 0, sched_clock_mask);168168- cd.wrap_kt = ns_to_ktime(wrap - (wrap >> 3));169169-170144 /* calculate the ns resolution of this counter */171171- res = cyc_to_ns(1ULL, cd.mult, cd.shift);145145+ res = cyc_to_ns(1ULL, new_mult, new_shift);146146+172147 pr_info("sched_clock: %u bits at %lu%cHz, resolution %lluns, wraps every %lluns\n",173148 bits, r, r_unit, res, wrap);174174-175175- update_sched_clock();176176-177177- /*178178- * Ensure that sched_clock() starts off at 0ns179179- */180180- cd.epoch_ns = 0;181149182150 /* Enable IRQ time accounting if we have a fast enough sched_clock */183151 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
+10
kernel/trace/trace_events.c
···17771777{17781778 struct ftrace_event_call **call, **start, **end;1779177917801780+ if (!mod->num_trace_events)17811781+ return;17821782+17831783+ /* Don't add infrastructure for mods without tracepoints */17841784+ if (trace_module_has_bad_taint(mod)) {17851785+ pr_err("%s: module has bad taint, not creating trace events\n",17861786+ mod->name);17871787+ return;17881788+ }17891789+17801790 start = mod->trace_events;17811791 end = mod->trace_events + mod->num_trace_events;17821792
+6-1
kernel/tracepoint.c
···631631EXPORT_SYMBOL_GPL(tracepoint_iter_reset);632632633633#ifdef CONFIG_MODULES634634+bool trace_module_has_bad_taint(struct module *mod)635635+{636636+ return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP));637637+}638638+634639static int tracepoint_module_coming(struct module *mod)635640{636641 struct tp_module *tp_mod, *iter;···646641 * module headers (for forced load), to make sure we don't cause a crash.647642 * Staging and out-of-tree GPL modules are fine.648643 */649649- if (mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP)))644644+ if (trace_module_has_bad_taint(mod))650645 return 0;651646 mutex_lock(&tracepoints_mutex);652647 tp_mod = kmalloc(sizeof(struct tp_module), GFP_KERNEL);
+1-1
kernel/user_namespace.c
···225225 *226226 * When there is no mapping defined for the user-namespace uid227227 * pair INVALID_UID is returned. Callers are expected to test228228- * for and handle handle INVALID_UID being returned. INVALID_UID228228+ * for and handle INVALID_UID being returned. INVALID_UID229229 * may be tested for using uid_valid().230230 */231231kuid_t make_kuid(struct user_namespace *ns, uid_t uid)
+7
kernel/workqueue.c
···18511851 if (worker->flags & WORKER_IDLE)18521852 pool->nr_idle--;1853185318541854+ /*18551855+ * Once WORKER_DIE is set, the kworker may destroy itself at any18561856+ * point. Pin to ensure the task stays until we're done with it.18571857+ */18581858+ get_task_struct(worker->task);18591859+18541860 list_del_init(&worker->entry);18551861 worker->flags |= WORKER_DIE;18561862···18651859 spin_unlock_irq(&pool->lock);1866186018671861 kthread_stop(worker->task);18621862+ put_task_struct(worker->task);18681863 kfree(worker);1869186418701865 spin_lock_irq(&pool->lock);
+85-46
lib/dma-debug.c
···424424EXPORT_SYMBOL(debug_dma_dump_mappings);425425426426/*427427- * For each page mapped (initial page in the case of428428- * dma_alloc_coherent/dma_map_{single|page}, or each page in a429429- * scatterlist) insert into this tree using the pfn as the key. At427427+ * For each mapping (initial cacheline in the case of428428+ * dma_alloc_coherent/dma_map_page, initial cacheline in each page of a429429+ * scatterlist, or the cacheline specified in dma_map_single) insert430430+ * into this tree using the cacheline as the key. At430431 * dma_unmap_{single|sg|page} or dma_free_coherent delete the entry. If431431- * the pfn already exists at insertion time add a tag as a reference432432+ * the entry already exists at insertion time add a tag as a reference432433 * count for the overlapping mappings. For now, the overlap tracking433433- * just ensures that 'unmaps' balance 'maps' before marking the pfn434434- * idle, but we should also be flagging overlaps as an API violation.434434+ * just ensures that 'unmaps' balance 'maps' before marking the435435+ * cacheline idle, but we should also be flagging overlaps as an API436436+ * violation.435437 *436438 * Memory usage is mostly constrained by the maximum number of available437439 * dma-debug entries in that we need a free dma_debug_entry before438438- * inserting into the tree. In the case of dma_map_{single|page} and439439- * dma_alloc_coherent there is only one dma_debug_entry and one pfn to440440- * track per event. dma_map_sg(), on the other hand,441441- * consumes a single dma_debug_entry, but inserts 'nents' entries into442442- * the tree.440440+ * inserting into the tree. In the case of dma_map_page and441441+ * dma_alloc_coherent there is only one dma_debug_entry and one442442+ * dma_active_cacheline entry to track per event. dma_map_sg(), on the443443+ * other hand, consumes a single dma_debug_entry, but inserts 'nents'444444+ * entries into the tree.443445 *444446 * At any time debug_dma_assert_idle() can be called to trigger a445445- * warning if the given page is in the active set.447447+ * warning if any cachelines in the given page are in the active set.446448 */447447-static RADIX_TREE(dma_active_pfn, GFP_NOWAIT);449449+static RADIX_TREE(dma_active_cacheline, GFP_NOWAIT);448450static DEFINE_SPINLOCK(radix_lock);449449-#define ACTIVE_PFN_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)451451+#define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)452452+#define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT)453453+#define CACHELINES_PER_PAGE (1 << CACHELINE_PER_PAGE_SHIFT)450454451451-static int active_pfn_read_overlap(unsigned long pfn)455455+static phys_addr_t to_cacheline_number(struct dma_debug_entry *entry)456456+{457457+ return (entry->pfn << CACHELINE_PER_PAGE_SHIFT) +458458+ (entry->offset >> L1_CACHE_SHIFT);459459+}460460+461461+static int active_cacheline_read_overlap(phys_addr_t cln)452462{453463 int overlap = 0, i;454464455465 for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--)456456- if (radix_tree_tag_get(&dma_active_pfn, pfn, i))466466+ if (radix_tree_tag_get(&dma_active_cacheline, cln, i))457467 overlap |= 1 << i;458468 return overlap;459469}460470461461-static int active_pfn_set_overlap(unsigned long pfn, int overlap)471471+static int active_cacheline_set_overlap(phys_addr_t cln, int overlap)462472{463473 int i;464474465465- if (overlap > ACTIVE_PFN_MAX_OVERLAP || overlap < 0)475475+ if (overlap > ACTIVE_CACHELINE_MAX_OVERLAP || overlap < 0)466476 return overlap;467477468478 for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--)469479 if (overlap & 1 << i)470470- radix_tree_tag_set(&dma_active_pfn, pfn, i);480480+ radix_tree_tag_set(&dma_active_cacheline, cln, i);471481 else472472- radix_tree_tag_clear(&dma_active_pfn, pfn, i);482482+ radix_tree_tag_clear(&dma_active_cacheline, cln, i);473483474484 return overlap;475485}476486477477-static void active_pfn_inc_overlap(unsigned long pfn)487487+static void active_cacheline_inc_overlap(phys_addr_t cln)478488{479479- int overlap = active_pfn_read_overlap(pfn);489489+ int overlap = active_cacheline_read_overlap(cln);480490481481- overlap = active_pfn_set_overlap(pfn, ++overlap);491491+ overlap = active_cacheline_set_overlap(cln, ++overlap);482492483493 /* If we overflowed the overlap counter then we're potentially484494 * leaking dma-mappings. Otherwise, if maps and unmaps are485495 * balanced then this overflow may cause false negatives in486486- * debug_dma_assert_idle() as the pfn may be marked idle496496+ * debug_dma_assert_idle() as the cacheline may be marked idle487497 * prematurely.488498 */489489- WARN_ONCE(overlap > ACTIVE_PFN_MAX_OVERLAP,490490- "DMA-API: exceeded %d overlapping mappings of pfn %lx\n",491491- ACTIVE_PFN_MAX_OVERLAP, pfn);499499+ WARN_ONCE(overlap > ACTIVE_CACHELINE_MAX_OVERLAP,500500+ "DMA-API: exceeded %d overlapping mappings of cacheline %pa\n",501501+ ACTIVE_CACHELINE_MAX_OVERLAP, &cln);492502}493503494494-static int active_pfn_dec_overlap(unsigned long pfn)504504+static int active_cacheline_dec_overlap(phys_addr_t cln)495505{496496- int overlap = active_pfn_read_overlap(pfn);506506+ int overlap = active_cacheline_read_overlap(cln);497507498498- return active_pfn_set_overlap(pfn, --overlap);508508+ return active_cacheline_set_overlap(cln, --overlap);499509}500510501501-static int active_pfn_insert(struct dma_debug_entry *entry)511511+static int active_cacheline_insert(struct dma_debug_entry *entry)502512{513513+ phys_addr_t cln = to_cacheline_number(entry);503514 unsigned long flags;504515 int rc;505516517517+ /* If the device is not writing memory then we don't have any518518+ * concerns about the cpu consuming stale data. This mitigates519519+ * legitimate usages of overlapping mappings.520520+ */521521+ if (entry->direction == DMA_TO_DEVICE)522522+ return 0;523523+506524 spin_lock_irqsave(&radix_lock, flags);507507- rc = radix_tree_insert(&dma_active_pfn, entry->pfn, entry);525525+ rc = radix_tree_insert(&dma_active_cacheline, cln, entry);508526 if (rc == -EEXIST)509509- active_pfn_inc_overlap(entry->pfn);527527+ active_cacheline_inc_overlap(cln);510528 spin_unlock_irqrestore(&radix_lock, flags);511529512530 return rc;513531}514532515515-static void active_pfn_remove(struct dma_debug_entry *entry)533533+static void active_cacheline_remove(struct dma_debug_entry *entry)516534{535535+ phys_addr_t cln = to_cacheline_number(entry);517536 unsigned long flags;537537+538538+ /* ...mirror the insert case */539539+ if (entry->direction == DMA_TO_DEVICE)540540+ return;518541519542 spin_lock_irqsave(&radix_lock, flags);520543 /* since we are counting overlaps the final put of the521521- * entry->pfn will occur when the overlap count is 0.522522- * active_pfn_dec_overlap() returns -1 in that case544544+ * cacheline will occur when the overlap count is 0.545545+ * active_cacheline_dec_overlap() returns -1 in that case523546 */524524- if (active_pfn_dec_overlap(entry->pfn) < 0)525525- radix_tree_delete(&dma_active_pfn, entry->pfn);547547+ if (active_cacheline_dec_overlap(cln) < 0)548548+ radix_tree_delete(&dma_active_cacheline, cln);526549 spin_unlock_irqrestore(&radix_lock, flags);527550}528551529552/**530553 * debug_dma_assert_idle() - assert that a page is not undergoing dma531531- * @page: page to lookup in the dma_active_pfn tree554554+ * @page: page to lookup in the dma_active_cacheline tree532555 *533556 * Place a call to this routine in cases where the cpu touching the page534557 * before the dma completes (page is dma_unmapped) will lead to data···559536 */560537void debug_dma_assert_idle(struct page *page)561538{539539+ static struct dma_debug_entry *ents[CACHELINES_PER_PAGE];540540+ struct dma_debug_entry *entry = NULL;541541+ void **results = (void **) &ents;542542+ unsigned int nents, i;562543 unsigned long flags;563563- struct dma_debug_entry *entry;544544+ phys_addr_t cln;564545565546 if (!page)566547 return;567548549549+ cln = (phys_addr_t) page_to_pfn(page) << CACHELINE_PER_PAGE_SHIFT;568550 spin_lock_irqsave(&radix_lock, flags);569569- entry = radix_tree_lookup(&dma_active_pfn, page_to_pfn(page));551551+ nents = radix_tree_gang_lookup(&dma_active_cacheline, results, cln,552552+ CACHELINES_PER_PAGE);553553+ for (i = 0; i < nents; i++) {554554+ phys_addr_t ent_cln = to_cacheline_number(ents[i]);555555+556556+ if (ent_cln == cln) {557557+ entry = ents[i];558558+ break;559559+ } else if (ent_cln >= cln + CACHELINES_PER_PAGE)560560+ break;561561+ }570562 spin_unlock_irqrestore(&radix_lock, flags);571563572564 if (!entry)573565 return;574566567567+ cln = to_cacheline_number(entry);575568 err_printk(entry->dev, entry,576576- "DMA-API: cpu touching an active dma mapped page "577577- "[pfn=0x%lx]\n", entry->pfn);569569+ "DMA-API: cpu touching an active dma mapped cacheline [cln=%pa]\n",570570+ &cln);578571}579572580573/*···607568 hash_bucket_add(bucket, entry);608569 put_hash_bucket(bucket, &flags);609570610610- rc = active_pfn_insert(entry);571571+ rc = active_cacheline_insert(entry);611572 if (rc == -ENOMEM) {612612- pr_err("DMA-API: pfn tracking ENOMEM, dma-debug disabled\n");573573+ pr_err("DMA-API: cacheline tracking ENOMEM, dma-debug disabled\n");613574 global_disable = true;614575 }615576···670631{671632 unsigned long flags;672633673673- active_pfn_remove(entry);634634+ active_cacheline_remove(entry);674635675636 /*676637 * add to beginning of the list - this way the entries are
···11661166 } else {11671167 ret = do_huge_pmd_wp_page_fallback(mm, vma, address,11681168 pmd, orig_pmd, page, haddr);11691169- if (ret & VM_FAULT_OOM)11691169+ if (ret & VM_FAULT_OOM) {11701170 split_huge_page(page);11711171+ ret |= VM_FAULT_FALLBACK;11721172+ }11711173 put_page(page);11721174 }11731175 count_vm_event(THP_FAULT_FALLBACK);···11811179 if (page) {11821180 split_huge_page(page);11831181 put_page(page);11841184- }11821182+ } else11831183+ split_huge_page_pmd(vma, address, pmd);11841184+ ret |= VM_FAULT_FALLBACK;11851185 count_vm_event(THP_FAULT_FALLBACK);11861186- ret |= VM_FAULT_OOM;11871186 goto out;11881187 }11891188···15481545 entry = pmd_mknonnuma(entry);15491546 entry = pmd_modify(entry, newprot);15501547 ret = HPAGE_PMD_NR;15481548+ set_pmd_at(mm, addr, pmd, entry);15511549 BUG_ON(pmd_write(entry));15521550 } else {15531551 struct page *page = pmd_page(*pmd);···15611557 */15621558 if (!is_huge_zero_page(page) &&15631559 !pmd_numa(*pmd)) {15641564- entry = *pmd;15651565- entry = pmd_mknuma(entry);15601560+ pmdp_set_numa(mm, addr, pmd);15661561 ret = HPAGE_PMD_NR;15671562 }15681563 }15691569-15701570- /* Set PMD if cleared earlier */15711571- if (ret == HPAGE_PMD_NR)15721572- set_pmd_at(mm, addr, pmd, entry);15731573-15741564 spin_unlock(ptl);15751565 }15761566···19611963 return ret;19621964}1963196519641964-#define VM_NO_THP (VM_SPECIAL|VM_MIXEDMAP|VM_HUGETLB|VM_SHARED|VM_MAYSHARE)19661966+#define VM_NO_THP (VM_SPECIAL | VM_HUGETLB | VM_SHARED | VM_MAYSHARE)1965196719661968int hugepage_madvise(struct vm_area_struct *vma,19671969 unsigned long *vm_flags, int advice)
+1-1
mm/ksm.c
···444444static struct page *page_trans_compound_anon(struct page *page)445445{446446 if (PageTransCompound(page)) {447447- struct page *head = compound_trans_head(page);447447+ struct page *head = compound_head(page);448448 /*449449 * head may actually be splitted and freed from under450450 * us but it's ok here.
+14-6
mm/memcontrol.c
···11271127 * skipping css reference should be safe.11281128 */11291129 if (next_css) {11301130- if ((next_css->flags & CSS_ONLINE) &&11311131- (next_css == &root->css || css_tryget(next_css)))11301130+ if ((next_css == &root->css) ||11311131+ ((next_css->flags & CSS_ONLINE) && css_tryget(next_css)))11321132 return mem_cgroup_from_css(next_css);1133113311341134 prev_css = next_css;···16871687 * protects memcg_name and makes sure that parallel ooms do not16881688 * interleave16891689 */16901690- static DEFINE_SPINLOCK(oom_info_lock);16901690+ static DEFINE_MUTEX(oom_info_lock);16911691 struct cgroup *task_cgrp;16921692 struct cgroup *mem_cgrp;16931693 static char memcg_name[PATH_MAX];···16981698 if (!p)16991699 return;1700170017011701- spin_lock(&oom_info_lock);17011701+ mutex_lock(&oom_info_lock);17021702 rcu_read_lock();1703170317041704 mem_cgrp = memcg->css.cgroup;···1767176717681768 pr_cont("\n");17691769 }17701770- spin_unlock(&oom_info_lock);17701770+ mutex_unlock(&oom_info_lock);17711771}1772177217731773/*···65956595{65966596 struct mem_cgroup *memcg = mem_cgroup_from_css(css);65976597 struct mem_cgroup_event *event, *tmp;65986598+ struct cgroup_subsys_state *iter;6598659965996600 /*66006601 * Unregister events and notify userspace.···66126611 kmem_cgroup_css_offline(memcg);6613661266146613 mem_cgroup_invalidate_reclaim_iterators(memcg);66156615- mem_cgroup_reparent_charges(memcg);66146614+66156615+ /*66166616+ * This requires that offlining is serialized. Right now that is66176617+ * guaranteed because css_killed_work_fn() holds the cgroup_mutex.66186618+ */66196619+ css_for_each_descendant_post(iter, css)66206620+ mem_cgroup_reparent_charges(mem_cgroup_from_css(iter));66216621+66166622 mem_cgroup_destroy_all_caches(memcg);66176623 vmpressure_cleanup(&memcg->vmpressure);66186624}
+1-1
mm/memory-failure.c
···16511651{16521652 int ret;16531653 unsigned long pfn = page_to_pfn(page);16541654- struct page *hpage = compound_trans_head(page);16541654+ struct page *hpage = compound_head(page);1655165516561656 if (PageHWPoison(page)) {16571657 pr_info("soft offline: %#lx page already poisoned\n", pfn);
+4-11
mm/memory.c
···33483348 if (ret & VM_FAULT_LOCKED)33493349 unlock_page(vmf.page);33503350 ret = VM_FAULT_HWPOISON;33513351+ page_cache_release(vmf.page);33513352 goto uncharge_out;33523353 }33533354···37043703 if (unlikely(is_vm_hugetlb_page(vma)))37053704 return hugetlb_fault(mm, vma, address, flags);3706370537073707-retry:37083706 pgd = pgd_offset(mm, address);37093707 pud = pud_alloc(mm, pgd, address);37103708 if (!pud)···37413741 if (dirty && !pmd_write(orig_pmd)) {37423742 ret = do_huge_pmd_wp_page(mm, vma, address, pmd,37433743 orig_pmd);37443744- /*37453745- * If COW results in an oom, the huge pmd will37463746- * have been split, so retry the fault on the37473747- * pte for a smaller charge.37483748- */37493749- if (unlikely(ret & VM_FAULT_OOM))37503750- goto retry;37513751- return ret;37443744+ if (!(ret & VM_FAULT_FALLBACK))37453745+ return ret;37523746 } else {37533747 huge_pmd_set_accessed(mm, vma, address, pmd,37543748 orig_pmd, dirty);37493749+ return 0;37553750 }37563756-37573757- return 0;37583751 }37593752 }37603753
+8-17
mm/mprotect.c
···5858 if (pte_numa(ptent))5959 ptent = pte_mknonnuma(ptent);6060 ptent = pte_modify(ptent, newprot);6161+ /*6262+ * Avoid taking write faults for pages we6363+ * know to be dirty.6464+ */6565+ if (dirty_accountable && pte_dirty(ptent))6666+ ptent = pte_mkwrite(ptent);6767+ ptep_modify_prot_commit(mm, addr, pte, ptent);6168 updated = true;6269 } else {6370 struct page *page;64716565- ptent = *pte;6672 page = vm_normal_page(vma, addr, oldpte);6773 if (page && !PageKsm(page)) {6874 if (!pte_numa(oldpte)) {6969- ptent = pte_mknuma(ptent);7070- set_pte_at(mm, addr, pte, ptent);7575+ ptep_set_numa(mm, addr, pte);7176 updated = true;7277 }7378 }7479 }7575-7676- /*7777- * Avoid taking write faults for pages we know to be7878- * dirty.7979- */8080- if (dirty_accountable && pte_dirty(ptent)) {8181- ptent = pte_mkwrite(ptent);8282- updated = true;8383- }8484-8580 if (updated)8681 pages++;8787-8888- /* Only !prot_numa always clears the pte */8989- if (!prot_numa)9090- ptep_modify_prot_commit(mm, addr, pte, ptent);9182 } else if (IS_ENABLED(CONFIG_MIGRATION) && !pte_file(oldpte)) {9283 swp_entry_t entry = pte_to_swp_entry(oldpte);9384
+25-5
mm/page_alloc.c
···369369 __SetPageHead(page);370370 for (i = 1; i < nr_pages; i++) {371371 struct page *p = page + i;372372- __SetPageTail(p);373372 set_page_count(p, 0);374373 p->first_page = page;374374+ /* Make sure p->first_page is always valid for PageTail() */375375+ smp_wmb();376376+ __SetPageTail(p);375377 }376378}377379···12381236 }12391237 local_irq_restore(flags);12401238}12391239+static bool gfp_thisnode_allocation(gfp_t gfp_mask)12401240+{12411241+ return (gfp_mask & GFP_THISNODE) == GFP_THISNODE;12421242+}12431243+#else12441244+static bool gfp_thisnode_allocation(gfp_t gfp_mask)12451245+{12461246+ return false;12471247+}12411248#endif1242124912431250/*···15831572 get_pageblock_migratetype(page));15841573 }1585157415861586- __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order));15751575+ /*15761576+ * NOTE: GFP_THISNODE allocations do not partake in the kswapd15771577+ * aging protocol, so they can't be fair.15781578+ */15791579+ if (!gfp_thisnode_allocation(gfp_flags))15801580+ __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order));15811581+15871582 __count_zone_vm_events(PGALLOC, zone, 1 << order);15881583 zone_statistics(preferred_zone, zone, gfp_flags);15891584 local_irq_restore(flags);···19611944 * ultimately fall back to remote zones that do not19621945 * partake in the fairness round-robin cycle of this19631946 * zonelist.19471947+ *19481948+ * NOTE: GFP_THISNODE allocations do not partake in19491949+ * the kswapd aging protocol, so they can't be fair.19641950 */19651965- if (alloc_flags & ALLOC_WMARK_LOW) {19511951+ if ((alloc_flags & ALLOC_WMARK_LOW) &&19521952+ !gfp_thisnode_allocation(gfp_mask)) {19661953 if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0)19671954 continue;19681955 if (!zone_local(preferred_zone, zone))···25222501 * allowed per node queues are empty and that nodes are25232502 * over allocated.25242503 */25252525- if (IS_ENABLED(CONFIG_NUMA) &&25262526- (gfp_mask & GFP_THISNODE) == GFP_THISNODE)25042504+ if (gfp_thisnode_allocation(gfp_mask))25272505 goto nopage;2528250625292507restart:
+2-2
mm/swap.c
···9898 }9999100100 /* __split_huge_page_refcount can run under us */101101- page_head = compound_trans_head(page);101101+ page_head = compound_head(page);102102103103 /*104104 * THP can not break up slab pages so avoid taking···253253 */254254 unsigned long flags;255255 bool got;256256- struct page *page_head = compound_trans_head(page);256256+ struct page *page_head = compound_head(page);257257258258 /* Ref to put_compound_page() comment. */259259 if (!__compound_tail_refcounted(page_head)) {
···241241{242242 struct batadv_priv *bat_priv = netdev_priv(soft_iface);243243 const struct batadv_hard_iface *hard_iface;244244- int min_mtu = ETH_DATA_LEN;244244+ int min_mtu = INT_MAX;245245246246 rcu_read_lock();247247 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {···256256 }257257 rcu_read_unlock();258258259259- atomic_set(&bat_priv->packet_size_max, min_mtu);260260-261259 if (atomic_read(&bat_priv->fragmentation) == 0)262260 goto out;263261···266268 min_mtu = min_t(int, min_mtu, BATADV_FRAG_MAX_FRAG_SIZE);267269 min_mtu -= sizeof(struct batadv_frag_packet);268270 min_mtu *= BATADV_FRAG_MAX_FRAGMENTS;269269- atomic_set(&bat_priv->packet_size_max, min_mtu);270270-271271- /* with fragmentation enabled we can fragment external packets easily */272272- min_mtu = min_t(int, min_mtu, ETH_DATA_LEN);273271274272out:275275- return min_mtu - batadv_max_header_len();273273+ /* report to the other components the maximum amount of bytes that274274+ * batman-adv can send over the wire (without considering the payload275275+ * overhead). For example, this value is used by TT to compute the276276+ * maximum local table table size277277+ */278278+ atomic_set(&bat_priv->packet_size_max, min_mtu);279279+280280+ /* the real soft-interface MTU is computed by removing the payload281281+ * overhead from the maximum amount of bytes that was just computed.282282+ *283283+ * However batman-adv does not support MTUs bigger than ETH_DATA_LEN284284+ */285285+ return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);276286}277287278288/* adjusts the MTU if a new interface with a smaller MTU appeared. */
+36
net/batman-adv/originator.c
···458458}459459460460/**461461+ * batadv_neigh_node_get - retrieve a neighbour from the list462462+ * @orig_node: originator which the neighbour belongs to463463+ * @hard_iface: the interface where this neighbour is connected to464464+ * @addr: the address of the neighbour465465+ *466466+ * Looks for and possibly returns a neighbour belonging to this originator list467467+ * which is connected through the provided hard interface.468468+ * Returns NULL if the neighbour is not found.469469+ */470470+struct batadv_neigh_node *471471+batadv_neigh_node_get(const struct batadv_orig_node *orig_node,472472+ const struct batadv_hard_iface *hard_iface,473473+ const uint8_t *addr)474474+{475475+ struct batadv_neigh_node *tmp_neigh_node, *res = NULL;476476+477477+ rcu_read_lock();478478+ hlist_for_each_entry_rcu(tmp_neigh_node, &orig_node->neigh_list, list) {479479+ if (!batadv_compare_eth(tmp_neigh_node->addr, addr))480480+ continue;481481+482482+ if (tmp_neigh_node->if_incoming != hard_iface)483483+ continue;484484+485485+ if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))486486+ continue;487487+488488+ res = tmp_neigh_node;489489+ break;490490+ }491491+ rcu_read_unlock();492492+493493+ return res;494494+}495495+496496+/**461497 * batadv_orig_ifinfo_free_rcu - free the orig_ifinfo object462498 * @rcu: rcu pointer of the orig_ifinfo object463499 */
···688688 int is_old_ttvn;689689690690 /* check if there is enough data before accessing it */691691- if (pskb_may_pull(skb, hdr_len + ETH_HLEN) < 0)691691+ if (!pskb_may_pull(skb, hdr_len + ETH_HLEN))692692 return 0;693693694694 /* create a copy of the skb (in case of for re-routing) to modify it. */···918918919919 if (ret != NET_RX_SUCCESS)920920 ret = batadv_route_unicast_packet(skb, recv_if);921921+ else922922+ consume_skb(skb);921923922924 return ret;923925}
+7-2
net/batman-adv/send.c
···254254 struct batadv_orig_node *orig_node,255255 unsigned short vid)256256{257257- struct ethhdr *ethhdr = (struct ethhdr *)skb->data;257257+ struct ethhdr *ethhdr;258258 struct batadv_unicast_packet *unicast_packet;259259- int ret = NET_XMIT_DROP;259259+ int ret = NET_XMIT_DROP, hdr_size;260260261261 if (!orig_node)262262 goto out;···265265 case BATADV_UNICAST:266266 if (!batadv_send_skb_prepare_unicast(skb, orig_node))267267 goto out;268268+269269+ hdr_size = sizeof(*unicast_packet);268270 break;269271 case BATADV_UNICAST_4ADDR:270272 if (!batadv_send_skb_prepare_unicast_4addr(bat_priv, skb,271273 orig_node,272274 packet_subtype))273275 goto out;276276+277277+ hdr_size = sizeof(struct batadv_unicast_4addr_packet);274278 break;275279 default:276280 /* this function supports UNICAST and UNICAST_4ADDR only. It···283279 goto out;284280 }285281282282+ ethhdr = (struct ethhdr *)(skb->data + hdr_size);286283 unicast_packet = (struct batadv_unicast_packet *)skb->data;287284288285 /* inform the destination node that we are still missing a correct route
+17-6
net/batman-adv/translation-table.c
···19751975 struct hlist_head *head;19761976 uint32_t i, crc_tmp, crc = 0;19771977 uint8_t flags;19781978+ __be16 tmp_vid;1978197919791980 for (i = 0; i < hash->size; i++) {19801981 head = &hash->table[i];···20122011 orig_node))20132012 continue;2014201320152015- crc_tmp = crc32c(0, &tt_common->vid,20162016- sizeof(tt_common->vid));20142014+ /* use network order to read the VID: this ensures that20152015+ * every node reads the bytes in the same order.20162016+ */20172017+ tmp_vid = htons(tt_common->vid);20182018+ crc_tmp = crc32c(0, &tmp_vid, sizeof(tmp_vid));2017201920182020 /* compute the CRC on flags that have to be kept in sync20192021 * among nodes···20502046 struct hlist_head *head;20512047 uint32_t i, crc_tmp, crc = 0;20522048 uint8_t flags;20492049+ __be16 tmp_vid;2053205020542051 for (i = 0; i < hash->size; i++) {20552052 head = &hash->table[i];···20692064 if (tt_common->flags & BATADV_TT_CLIENT_NEW)20702065 continue;2071206620722072- crc_tmp = crc32c(0, &tt_common->vid,20732073- sizeof(tt_common->vid));20672067+ /* use network order to read the VID: this ensures that20682068+ * every node reads the bytes in the same order.20692069+ */20702070+ tmp_vid = htons(tt_common->vid);20712071+ crc_tmp = crc32c(0, &tmp_vid, sizeof(tmp_vid));2074207220752073 /* compute the CRC on flags that have to be kept in sync20762074 * among nodes···22702262{22712263 struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;22722264 struct batadv_orig_node_vlan *vlan;22652265+ uint32_t crc;22732266 int i;2274226722752268 /* check if each received CRC matches the locally stored one */···22902281 if (!vlan)22912282 return false;2292228322932293- if (vlan->tt.crc != ntohl(tt_vlan_tmp->crc))22842284+ crc = vlan->tt.crc;22852285+ batadv_orig_node_vlan_free_ref(vlan);22862286+22872287+ if (crc != ntohl(tt_vlan_tmp->crc))22942288 return false;22952289 }22962290···3230321832313219 spin_lock_bh(&orig_node->tt_lock);3232322032333233- tt_change = (struct batadv_tvlv_tt_change *)tt_buff;32343221 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes,32353222 ttvn, tt_change);32363223
+14-2
net/bluetooth/hidp/core.c
···430430 del_timer(&session->timer);431431}432432433433+static void hidp_process_report(struct hidp_session *session,434434+ int type, const u8 *data, int len, int intr)435435+{436436+ if (len > HID_MAX_BUFFER_SIZE)437437+ len = HID_MAX_BUFFER_SIZE;438438+439439+ memcpy(session->input_buf, data, len);440440+ hid_input_report(session->hid, type, session->input_buf, len, intr);441441+}442442+433443static void hidp_process_handshake(struct hidp_session *session,434444 unsigned char param)435445{···512502 hidp_input_report(session, skb);513503514504 if (session->hid)515515- hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 0);505505+ hidp_process_report(session, HID_INPUT_REPORT,506506+ skb->data, skb->len, 0);516507 break;517508518509 case HIDP_DATA_RTYPE_OTHER:···595584 hidp_input_report(session, skb);596585597586 if (session->hid) {598598- hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 1);587587+ hidp_process_report(session, HID_INPUT_REPORT,588588+ skb->data, skb->len, 1);599589 BT_DBG("report len %d", skb->len);600590 }601591 } else {
+4
net/bluetooth/hidp/hidp.h
···2424#define __HIDP_H25252626#include <linux/types.h>2727+#include <linux/hid.h>2728#include <linux/kref.h>2829#include <net/bluetooth/bluetooth.h>2930#include <net/bluetooth/l2cap.h>···180179181180 /* Used in hidp_output_raw_report() */182181 int output_report_success; /* boolean */182182+183183+ /* temporary input buffer */184184+ u8 input_buf[HID_MAX_BUFFER_SIZE];183185};184186185187/* HIDP init defines */
+5-21
net/can/raw.c
···121121 if (!ro->recv_own_msgs && oskb->sk == sk)122122 return;123123124124- /* do not pass frames with DLC > 8 to a legacy socket */125125- if (!ro->fd_frames) {126126- struct canfd_frame *cfd = (struct canfd_frame *)oskb->data;127127-128128- if (unlikely(cfd->len > CAN_MAX_DLEN))129129- return;130130- }124124+ /* do not pass non-CAN2.0 frames to a legacy socket */125125+ if (!ro->fd_frames && oskb->len != CAN_MTU)126126+ return;131127132128 /* clone the given skb to be able to enqueue it into the rcv queue */133129 skb = skb_clone(oskb, GFP_ATOMIC);···734738 struct msghdr *msg, size_t size, int flags)735739{736740 struct sock *sk = sock->sk;737737- struct raw_sock *ro = raw_sk(sk);738741 struct sk_buff *skb;739739- int rxmtu;740742 int err = 0;741743 int noblock;742744···745751 if (!skb)746752 return err;747753748748- /*749749- * when serving a legacy socket the DLC <= 8 is already checked inside750750- * raw_rcv(). Now check if we need to pass a canfd_frame to a legacy751751- * socket and cut the possible CANFD_MTU/CAN_MTU length to CAN_MTU752752- */753753- if (!ro->fd_frames)754754- rxmtu = CAN_MTU;755755- else756756- rxmtu = skb->len;757757-758758- if (size < rxmtu)754754+ if (size < skb->len)759755 msg->msg_flags |= MSG_TRUNC;760756 else761761- size = rxmtu;757757+ size = skb->len;762758763759 err = memcpy_toiovec(msg->msg_iov, skb->data, size);764760 if (err < 0) {
+12-10
net/core/dev.c
···24202420 * 2. No high memory really exists on this machine.24212421 */2422242224232423-static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)24232423+static int illegal_highdma(const struct net_device *dev, struct sk_buff *skb)24242424{24252425#ifdef CONFIG_HIGHMEM24262426 int i;···24952495}2496249624972497static netdev_features_t harmonize_features(struct sk_buff *skb,24982498- netdev_features_t features)24982498+ const struct net_device *dev,24992499+ netdev_features_t features)24992500{25002501 if (skb->ip_summed != CHECKSUM_NONE &&25012502 !can_checksum_protocol(features, skb_network_protocol(skb))) {25022503 features &= ~NETIF_F_ALL_CSUM;25032503- } else if (illegal_highdma(skb->dev, skb)) {25042504+ } else if (illegal_highdma(dev, skb)) {25042505 features &= ~NETIF_F_SG;25052506 }2506250725072508 return features;25082509}2509251025102510-netdev_features_t netif_skb_features(struct sk_buff *skb)25112511+netdev_features_t netif_skb_dev_features(struct sk_buff *skb,25122512+ const struct net_device *dev)25112513{25122514 __be16 protocol = skb->protocol;25132513- netdev_features_t features = skb->dev->features;25152515+ netdev_features_t features = dev->features;2514251625152515- if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs)25172517+ if (skb_shinfo(skb)->gso_segs > dev->gso_max_segs)25162518 features &= ~NETIF_F_GSO_MASK;2517251925182520 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {25192521 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;25202522 protocol = veh->h_vlan_encapsulated_proto;25212523 } else if (!vlan_tx_tag_present(skb)) {25222522- return harmonize_features(skb, features);25242524+ return harmonize_features(skb, dev, features);25232525 }2524252625252525- features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX |25272527+ features &= (dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX |25262528 NETIF_F_HW_VLAN_STAG_TX);2527252925282530 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD))···25322530 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX |25332531 NETIF_F_HW_VLAN_STAG_TX;2534253225352535- return harmonize_features(skb, features);25332533+ return harmonize_features(skb, dev, features);25362534}25372537-EXPORT_SYMBOL(netif_skb_features);25352535+EXPORT_SYMBOL(netif_skb_dev_features);2538253625392537int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,25402538 struct netdev_queue *txq)
···290290 left = tp->snd_cwnd - in_flight;291291 if (sk_can_gso(sk) &&292292 left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd &&293293- left * tp->mss_cache < sk->sk_gso_max_size &&294294- left < sk->sk_gso_max_segs)293293+ left < tp->xmit_size_goal_segs)295294 return true;296295 return left <= tcp_max_tso_deferred_mss(tp);297296}
+2-1
net/ipv4/tcp_input.c
···19451945 if (skb == tcp_send_head(sk))19461946 break;1947194719481948- if (TCP_SKB_CB(skb)->sacked & TCPCB_RETRANS)19481948+ if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS)19491949 tp->undo_marker = 0;19501950+19501951 TCP_SKB_CB(skb)->sacked &= (~TCPCB_TAGBITS)|TCPCB_SACKED_ACKED;19511952 if (!(TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_ACKED) || how) {19521953 TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED;
···138138config IPV6_VTI139139tristate "Virtual (secure) IPv6: tunneling"140140 select IPV6_TUNNEL141141+ select NET_IP_TUNNEL141142 depends on INET6_XFRM_MODE_TUNNEL142143 ---help---143144 Tunneling means encapsulating data of one protocol type within
···113113 fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);114114 fptr->nexthdr = nexthdr;115115 fptr->reserved = 0;116116- ipv6_select_ident(fptr, (struct rt6_info *)skb_dst(skb));116116+ fptr->identification = skb_shinfo(skb)->ip6_frag_id;117117118118 /* Fragment the skb. ipv6 header and the remaining fields of the119119 * fragment header are updated in ipv6_gso_segment()
···222222 switch (vht_oper->chan_width) {223223 case IEEE80211_VHT_CHANWIDTH_USE_HT:224224 vht_chandef.width = chandef->width;225225+ vht_chandef.center_freq1 = chandef->center_freq1;225226 break;226227 case IEEE80211_VHT_CHANWIDTH_80MHZ:227228 vht_chandef.width = NL80211_CHAN_WIDTH_80;···272271 ret = 0;273272274273out:274274+ /*275275+ * When tracking the current AP, don't do any further checks if the276276+ * new chandef is identical to the one we're currently using for the277277+ * connection. This keeps us from playing ping-pong with regulatory,278278+ * without it the following can happen (for example):279279+ * - connect to an AP with 80 MHz, world regdom allows 80 MHz280280+ * - AP advertises regdom US281281+ * - CRDA loads regdom US with 80 MHz prohibited (old database)282282+ * - the code below detects an unsupported channel, downgrades, and283283+ * we disconnect from the AP in the caller284284+ * - disconnect causes CRDA to reload world regdomain and the game285285+ * starts anew.286286+ * (see https://bugzilla.kernel.org/show_bug.cgi?id=70881)287287+ *288288+ * It seems possible that there are still scenarios with CSA or real289289+ * bandwidth changes where a this could happen, but those cases are290290+ * less common and wouldn't completely prevent using the AP.291291+ */292292+ if (tracking &&293293+ cfg80211_chandef_identical(chandef, &sdata->vif.bss_conf.chandef))294294+ return ret;295295+275296 /* don't print the message below for VHT mismatch if VHT is disabled */276297 if (ret & IEEE80211_STA_DISABLE_VHT)277298 vht_chandef = *chandef;···37763753 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);37773754 if (WARN_ON(!chanctx_conf)) {37783755 rcu_read_unlock();37563756+ sta_info_free(local, new_sta);37793757 return -EINVAL;37803758 }37813759 rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
+7
net/mac80211/rx.c
···11281128 sta->sta.addr, sta->sta.aid);1129112911301130 if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {11311131+ /*11321132+ * Clear the flag only if the other one is still set11331133+ * so that the TX path won't start TX'ing new frames11341134+ * directly ... In the case that the driver flag isn't11351135+ * set ieee80211_sta_ps_deliver_wakeup() will clear it.11361136+ */11371137+ clear_sta_flag(sta, WLAN_STA_PS_STA);11311138 ps_dbg(sta->sdata, "STA %pM aid %d driver-ps-blocked\n",11321139 sta->sta.addr, sta->sta.aid);11331140 return;
+42-24
net/mac80211/sta_info.c
···9191 return -ENOENT;9292}93939494-static void cleanup_single_sta(struct sta_info *sta)9494+static void __cleanup_single_sta(struct sta_info *sta)9595{9696 int ac, i;9797 struct tid_ampdu_tx *tid_tx;···9999 struct ieee80211_local *local = sdata->local;100100 struct ps_data *ps;101101102102- if (test_sta_flag(sta, WLAN_STA_PS_STA)) {102102+ if (test_sta_flag(sta, WLAN_STA_PS_STA) ||103103+ test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {103104 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||104105 sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)105106 ps = &sdata->bss->ps;···110109 return;111110112111 clear_sta_flag(sta, WLAN_STA_PS_STA);112112+ clear_sta_flag(sta, WLAN_STA_PS_DRIVER);113113114114 atomic_dec(&ps->num_sta_ps);115115 sta_info_recalc_tim(sta);···141139 ieee80211_purge_tx_queue(&local->hw, &tid_tx->pending);142140 kfree(tid_tx);143141 }142142+}144143144144+static void cleanup_single_sta(struct sta_info *sta)145145+{146146+ struct ieee80211_sub_if_data *sdata = sta->sdata;147147+ struct ieee80211_local *local = sdata->local;148148+149149+ __cleanup_single_sta(sta);145150 sta_info_free(local, sta);146151}147152···339330 rcu_read_unlock();340331341332 spin_lock_init(&sta->lock);333333+ spin_lock_init(&sta->ps_lock);342334 INIT_WORK(&sta->drv_unblock_wk, sta_unblock);343335 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);344336 mutex_init(&sta->ampdu_mlme.mtx);···497487 goto out_err;498488 }499489500500- /* notify driver */501501- err = sta_info_insert_drv_state(local, sdata, sta);502502- if (err)503503- goto out_err;504504-505490 local->num_sta++;506491 local->sta_generation++;507492 smp_mb();493493+494494+ /* simplify things and don't accept BA sessions yet */495495+ set_sta_flag(sta, WLAN_STA_BLOCK_BA);508496509497 /* make the station visible */510498 sta_info_hash_add(local, sta);511499512500 list_add_rcu(&sta->list, &local->sta_list);513501502502+ /* notify driver */503503+ err = sta_info_insert_drv_state(local, sdata, sta);504504+ if (err)505505+ goto out_remove;506506+514507 set_sta_flag(sta, WLAN_STA_INSERTED);508508+ /* accept BA sessions now */509509+ clear_sta_flag(sta, WLAN_STA_BLOCK_BA);515510516511 ieee80211_recalc_min_chandef(sdata);517512 ieee80211_sta_debugfs_add(sta);···537522 mesh_accept_plinks_update(sdata);538523539524 return 0;525525+ out_remove:526526+ sta_info_hash_del(local, sta);527527+ list_del_rcu(&sta->list);528528+ local->num_sta--;529529+ synchronize_net();530530+ __cleanup_single_sta(sta);540531 out_err:541532 mutex_unlock(&local->sta_mtx);542533 rcu_read_lock();···10921071}10931072EXPORT_SYMBOL(ieee80211_find_sta);1094107310951095-static void clear_sta_ps_flags(void *_sta)10741074+/* powersave support code */10751075+void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)10961076{10971097- struct sta_info *sta = _sta;10981077 struct ieee80211_sub_if_data *sdata = sta->sdata;10781078+ struct ieee80211_local *local = sdata->local;10791079+ struct sk_buff_head pending;10801080+ int filtered = 0, buffered = 0, ac;10811081+ unsigned long flags;10991082 struct ps_data *ps;1100108311011084 if (sdata->vif.type == NL80211_IFTYPE_AP ||···11091084 ps = &sdata->u.mesh.ps;11101085 else11111086 return;11121112-11131113- clear_sta_flag(sta, WLAN_STA_PS_DRIVER);11141114- if (test_and_clear_sta_flag(sta, WLAN_STA_PS_STA))11151115- atomic_dec(&ps->num_sta_ps);11161116-}11171117-11181118-/* powersave support code */11191119-void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)11201120-{11211121- struct ieee80211_sub_if_data *sdata = sta->sdata;11221122- struct ieee80211_local *local = sdata->local;11231123- struct sk_buff_head pending;11241124- int filtered = 0, buffered = 0, ac;11251125- unsigned long flags;1126108711271088 clear_sta_flag(sta, WLAN_STA_SP);11281089···1120110911211110 skb_queue_head_init(&pending);1122111111121112+ /* sync with ieee80211_tx_h_unicast_ps_buf */11131113+ spin_lock(&sta->ps_lock);11231114 /* Send all buffered frames to the station */11241115 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {11251116 int count = skb_queue_len(&pending), tmp;···11401127 buffered += tmp - count;11411128 }1142112911431143- ieee80211_add_pending_skbs_fn(local, &pending, clear_sta_ps_flags, sta);11301130+ ieee80211_add_pending_skbs(local, &pending);11311131+ clear_sta_flag(sta, WLAN_STA_PS_DRIVER);11321132+ clear_sta_flag(sta, WLAN_STA_PS_STA);11331133+ spin_unlock(&sta->ps_lock);11341134+11351135+ atomic_dec(&ps->num_sta_ps);1144113611451137 /* This station just woke up and isn't aware of our SMPS state */11461138 if (!ieee80211_smps_is_restrictive(sta->known_smps_mode,
+3-4
net/mac80211/sta_info.h
···267267 * @drv_unblock_wk: used for driver PS unblocking268268 * @listen_interval: listen interval of this station, when we're acting as AP269269 * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly270270+ * @ps_lock: used for powersave (when mac80211 is the AP) related locking270271 * @ps_tx_buf: buffers (per AC) of frames to transmit to this station271272 * when it leaves power saving state or polls272273 * @tx_filtered: buffers (per AC) of frames we already tried to···357356 /* use the accessors defined below */358357 unsigned long _flags;359358360360- /*361361- * STA powersave frame queues, no more than the internal362362- * locking required.363363- */359359+ /* STA powersave lock and frame queues */360360+ spinlock_t ps_lock;364361 struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];365362 struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];366363 unsigned long driver_buffered_tids;
+15
net/mac80211/tx.c
···478478 sta->sta.addr, sta->sta.aid, ac);479479 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)480480 purge_old_ps_buffers(tx->local);481481+482482+ /* sync with ieee80211_sta_ps_deliver_wakeup */483483+ spin_lock(&sta->ps_lock);484484+ /*485485+ * STA woke up the meantime and all the frames on ps_tx_buf have486486+ * been queued to pending queue. No reordering can happen, go487487+ * ahead and Tx the packet.488488+ */489489+ if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&490490+ !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {491491+ spin_unlock(&sta->ps_lock);492492+ return TX_CONTINUE;493493+ }494494+481495 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) {482496 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]);483497 ps_dbg(tx->sdata,···506492 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;507493 info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS;508494 skb_queue_tail(&sta->ps_tx_buf[ac], tx->skb);495495+ spin_unlock(&sta->ps_lock);509496510497 if (!timer_pending(&local->sta_cleanup))511498 mod_timer(&local->sta_cleanup,
+22-26
net/mac80211/util.c
···435435 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);436436}437437438438-void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local,439439- struct sk_buff_head *skbs,440440- void (*fn)(void *data), void *data)438438+void ieee80211_add_pending_skbs(struct ieee80211_local *local,439439+ struct sk_buff_head *skbs)441440{442441 struct ieee80211_hw *hw = &local->hw;443442 struct sk_buff *skb;···459460460461 __skb_queue_tail(&local->pending[queue], skb);461462 }462462-463463- if (fn)464464- fn(data);465463466464 for (i = 0; i < hw->queues; i++)467465 __ieee80211_wake_queue(hw, i,···17371741 IEEE80211_QUEUE_STOP_REASON_SUSPEND);1738174217391743 /*17441744+ * Reconfigure sched scan if it was interrupted by FW restart or17451745+ * suspend.17461746+ */17471747+ mutex_lock(&local->mtx);17481748+ sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata,17491749+ lockdep_is_held(&local->mtx));17501750+ if (sched_scan_sdata && local->sched_scan_req)17511751+ /*17521752+ * Sched scan stopped, but we don't want to report it. Instead,17531753+ * we're trying to reschedule.17541754+ */17551755+ if (__ieee80211_request_sched_scan_start(sched_scan_sdata,17561756+ local->sched_scan_req))17571757+ sched_scan_stopped = true;17581758+ mutex_unlock(&local->mtx);17591759+17601760+ if (sched_scan_stopped)17611761+ cfg80211_sched_scan_stopped(local->hw.wiphy);17621762+17631763+ /*17401764 * If this is for hw restart things are still running.17411765 * We may want to change that later, however.17421766 */···17831767#else17841768 WARN_ON(1);17851769#endif17861786-17871787- /*17881788- * Reconfigure sched scan if it was interrupted by FW restart or17891789- * suspend.17901790- */17911791- mutex_lock(&local->mtx);17921792- sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata,17931793- lockdep_is_held(&local->mtx));17941794- if (sched_scan_sdata && local->sched_scan_req)17951795- /*17961796- * Sched scan stopped, but we don't want to report it. Instead,17971797- * we're trying to reschedule.17981798- */17991799- if (__ieee80211_request_sched_scan_start(sched_scan_sdata,18001800- local->sched_scan_req))18011801- sched_scan_stopped = true;18021802- mutex_unlock(&local->mtx);18031803-18041804- if (sched_scan_stopped)18051805- cfg80211_sched_scan_stopped(local->hw.wiphy);1806177018071771 return 0;18081772}
+5
net/mac80211/wme.c
···154154 return IEEE80211_AC_BE;155155 }156156157157+ if (skb->protocol == sdata->control_port_protocol) {158158+ skb->priority = 7;159159+ return ieee80211_downgrade_queue(sdata, skb);160160+ }161161+157162 /* use the data classifier to determine what 802.1d tag the158163 * data frame has */159164 rcu_read_lock();
+14-21
net/netfilter/nf_conntrack_netlink.c
···13101310}1311131113121312static int13131313-ctnetlink_change_nat(struct nf_conn *ct, const struct nlattr * const cda[])13131313+ctnetlink_setup_nat(struct nf_conn *ct, const struct nlattr * const cda[])13141314{13151315#ifdef CONFIG_NF_NAT_NEEDED13161316 int ret;1317131713181318- if (cda[CTA_NAT_DST]) {13191319- ret = ctnetlink_parse_nat_setup(ct,13201320- NF_NAT_MANIP_DST,13211321- cda[CTA_NAT_DST]);13221322- if (ret < 0)13231323- return ret;13241324- }13251325- if (cda[CTA_NAT_SRC]) {13261326- ret = ctnetlink_parse_nat_setup(ct,13271327- NF_NAT_MANIP_SRC,13281328- cda[CTA_NAT_SRC]);13291329- if (ret < 0)13301330- return ret;13311331- }13321332- return 0;13181318+ ret = ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_DST,13191319+ cda[CTA_NAT_DST]);13201320+ if (ret < 0)13211321+ return ret;13221322+13231323+ ret = ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_SRC,13241324+ cda[CTA_NAT_SRC]);13251325+ return ret;13331326#else13271327+ if (!cda[CTA_NAT_DST] && !cda[CTA_NAT_SRC])13281328+ return 0;13341329 return -EOPNOTSUPP;13351330#endif13361331}···16541659 goto err2;16551660 }1656166116571657- if (cda[CTA_NAT_SRC] || cda[CTA_NAT_DST]) {16581658- err = ctnetlink_change_nat(ct, cda);16591659- if (err < 0)16601660- goto err2;16611661- }16621662+ err = ctnetlink_setup_nat(ct, cda);16631663+ if (err < 0)16641664+ goto err2;1662166516631666 nf_ct_acct_ext_add(ct, GFP_ATOMIC);16641667 nf_ct_tstamp_ext_add(ct, GFP_ATOMIC);
+35-21
net/netfilter/nf_nat_core.c
···432432}433433EXPORT_SYMBOL(nf_nat_setup_info);434434435435-unsigned int436436-nf_nat_alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)435435+static unsigned int436436+__nf_nat_alloc_null_binding(struct nf_conn *ct, enum nf_nat_manip_type manip)437437{438438 /* Force range to this IP; let proto decide mapping for439439 * per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED).440440 * Use reply in case it's already been mangled (eg local packet).441441 */442442 union nf_inet_addr ip =443443- (HOOK2MANIP(hooknum) == NF_NAT_MANIP_SRC ?443443+ (manip == NF_NAT_MANIP_SRC ?444444 ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3 :445445 ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3);446446 struct nf_nat_range range = {···448448 .min_addr = ip,449449 .max_addr = ip,450450 };451451- return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum));451451+ return nf_nat_setup_info(ct, &range, manip);452452+}453453+454454+unsigned int455455+nf_nat_alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)456456+{457457+ return __nf_nat_alloc_null_binding(ct, HOOK2MANIP(hooknum));452458}453459EXPORT_SYMBOL_GPL(nf_nat_alloc_null_binding);454460···708702709703static int710704nfnetlink_parse_nat(const struct nlattr *nat,711711- const struct nf_conn *ct, struct nf_nat_range *range)705705+ const struct nf_conn *ct, struct nf_nat_range *range,706706+ const struct nf_nat_l3proto *l3proto)712707{713713- const struct nf_nat_l3proto *l3proto;714708 struct nlattr *tb[CTA_NAT_MAX+1];715709 int err;716710···720714 if (err < 0)721715 return err;722716723723- rcu_read_lock();724724- l3proto = __nf_nat_l3proto_find(nf_ct_l3num(ct));725725- if (l3proto == NULL) {726726- err = -EAGAIN;727727- goto out;728728- }729717 err = l3proto->nlattr_to_range(tb, range);730718 if (err < 0)731731- goto out;719719+ return err;732720733721 if (!tb[CTA_NAT_PROTO])734734- goto out;722722+ return 0;735723736736- err = nfnetlink_parse_nat_proto(tb[CTA_NAT_PROTO], ct, range);737737-out:738738- rcu_read_unlock();739739- return err;724724+ return nfnetlink_parse_nat_proto(tb[CTA_NAT_PROTO], ct, range);740725}741726727727+/* This function is called under rcu_read_lock() */742728static int743729nfnetlink_parse_nat_setup(struct nf_conn *ct,744730 enum nf_nat_manip_type manip,745731 const struct nlattr *attr)746732{747733 struct nf_nat_range range;734734+ const struct nf_nat_l3proto *l3proto;748735 int err;749736750750- err = nfnetlink_parse_nat(attr, ct, &range);737737+ /* Should not happen, restricted to creating new conntracks738738+ * via ctnetlink.739739+ */740740+ if (WARN_ON_ONCE(nf_nat_initialized(ct, manip)))741741+ return -EEXIST;742742+743743+ /* Make sure that L3 NAT is there by when we call nf_nat_setup_info to744744+ * attach the null binding, otherwise this may oops.745745+ */746746+ l3proto = __nf_nat_l3proto_find(nf_ct_l3num(ct));747747+ if (l3proto == NULL)748748+ return -EAGAIN;749749+750750+ /* No NAT information has been passed, allocate the null-binding */751751+ if (attr == NULL)752752+ return __nf_nat_alloc_null_binding(ct, manip);753753+754754+ err = nfnetlink_parse_nat(attr, ct, &range, l3proto);751755 if (err < 0)752756 return err;753753- if (nf_nat_initialized(ct, manip))754754- return -EEXIST;755757756758 return nf_nat_setup_info(ct, &range, manip);757759}
+2-2
net/netfilter/nft_meta.c
···116116 skb->sk->sk_socket->file->f_cred->fsgid);117117 read_unlock_bh(&skb->sk->sk_callback_lock);118118 break;119119-#ifdef CONFIG_NET_CLS_ROUTE119119+#ifdef CONFIG_IP_ROUTE_CLASSID120120 case NFT_META_RTCLASSID: {121121 const struct dst_entry *dst = skb_dst(skb);122122···199199 case NFT_META_OIFTYPE:200200 case NFT_META_SKUID:201201 case NFT_META_SKGID:202202-#ifdef CONFIG_NET_CLS_ROUTE202202+#ifdef CONFIG_IP_ROUTE_CLASSID203203 case NFT_META_RTCLASSID:204204#endif205205#ifdef CONFIG_NETWORK_SECMARK
+2-1
net/netfilter/nft_payload.c
···135135 if (len == 0 || len > FIELD_SIZEOF(struct nft_data, data))136136 return ERR_PTR(-EINVAL);137137138138- if (len <= 4 && IS_ALIGNED(offset, len) && base != NFT_PAYLOAD_LL_HEADER)138138+ if (len <= 4 && is_power_of_2(len) && IS_ALIGNED(offset, len) &&139139+ base != NFT_PAYLOAD_LL_HEADER)139140 return &nft_payload_fast_ops;140141 else141142 return &nft_payload_ops;
···14891489 if (addr->sa_family != AF_NETLINK)14901490 return -EINVAL;1491149114921492- /* Only superuser is allowed to send multicasts */14931493- if (nladdr->nl_groups && !netlink_capable(sock, NL_CFG_F_NONROOT_SEND))14921492+ if ((nladdr->nl_groups || nladdr->nl_pid) &&14931493+ !netlink_capable(sock, NL_CFG_F_NONROOT_SEND))14941494 return -EPERM;1495149514961496 if (!nlk->portid)
+1-1
net/nfc/nci/core.c
···301301 rc = __nci_request(ndev, nci_reset_req, 0,302302 msecs_to_jiffies(NCI_RESET_TIMEOUT));303303304304- if (ndev->ops->setup(ndev))304304+ if (ndev->ops->setup)305305 ndev->ops->setup(ndev);306306307307 if (!rc) {
···1515 *1616 * ECN support is added by Naeem Khademi <naeemk@ifi.uio.no>1717 * University of Oslo, Norway.1818+ *1919+ * References:2020+ * IETF draft submission: http://tools.ietf.org/html/draft-pan-aqm-pie-002121+ * IEEE Conference on High Performance Switching and Routing 2013 :2222+ * "PIE: A * Lightweight Control Scheme to Address the Bufferbloat Problem"1823 */19242025#include <linux/module.h>···4136 psched_time_t target; /* user specified target delay in pschedtime */4237 u32 tupdate; /* timer frequency (in jiffies) */4338 u32 limit; /* number of packets that can be enqueued */4444- u32 alpha; /* alpha and beta are between -4 and 4 */3939+ u32 alpha; /* alpha and beta are between 0 and 32 */4540 u32 beta; /* and are used for shift relative to 1 */4641 bool ecn; /* true if ecn is enabled */4742 bool bytemode; /* to scale drop early prob based on pkt size */···331326 if (qdelay == 0 && qlen != 0)332327 update_prob = false;333328334334- /* Add ranges for alpha and beta, more aggressive for high dropping335335- * mode and gentle steps for light dropping mode336336- * In light dropping mode, take gentle steps; in medium dropping mode,337337- * take medium steps; in high dropping mode, take big steps.329329+ /* In the algorithm, alpha and beta are between 0 and 2 with typical330330+ * value for alpha as 0.125. In this implementation, we use values 0-32331331+ * passed from user space to represent this. Also, alpha and beta have332332+ * unit of HZ and need to be scaled before they can used to update333333+ * probability. alpha/beta are updated locally below by 1) scaling them334334+ * appropriately 2) scaling down by 16 to come to 0-2 range.335335+ * Please see paper for details.336336+ *337337+ * We scale alpha and beta differently depending on whether we are in338338+ * light, medium or high dropping mode.338339 */339340 if (q->vars.prob < MAX_PROB / 100) {340341 alpha =
+12-12
net/sched/sch_tbf.c
···334334 qdisc_put_rtab(qdisc_get_rtab(&qopt->peakrate,335335 tb[TCA_TBF_PTAB]));336336337337- if (q->qdisc != &noop_qdisc) {338338- err = fifo_set_limit(q->qdisc, qopt->limit);339339- if (err)340340- goto done;341341- } else if (qopt->limit > 0) {342342- child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit);343343- if (IS_ERR(child)) {344344- err = PTR_ERR(child);345345- goto done;346346- }347347- }348348-349337 buffer = min_t(u64, PSCHED_TICKS2NS(qopt->buffer), ~0U);350338 mtu = min_t(u64, PSCHED_TICKS2NS(qopt->mtu), ~0U);351339···376388 if (!max_size) {377389 err = -EINVAL;378390 goto done;391391+ }392392+393393+ if (q->qdisc != &noop_qdisc) {394394+ err = fifo_set_limit(q->qdisc, qopt->limit);395395+ if (err)396396+ goto done;397397+ } else if (qopt->limit > 0) {398398+ child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit);399399+ if (IS_ERR(child)) {400400+ err = PTR_ERR(child);401401+ goto done;402402+ }379403 }380404381405 sch_tree_lock(sch);
+106-125
net/sctp/associola.c
···12391239}1240124012411241/* Update the retran path for sending a retransmitted packet.12421242- * Round-robin through the active transports, else round-robin12431243- * through the inactive transports as this is the next best thing12441244- * we can try.12421242+ * See also RFC4960, 6.4. Multi-Homed SCTP Endpoints:12431243+ *12441244+ * When there is outbound data to send and the primary path12451245+ * becomes inactive (e.g., due to failures), or where the12461246+ * SCTP user explicitly requests to send data to an12471247+ * inactive destination transport address, before reporting12481248+ * an error to its ULP, the SCTP endpoint should try to send12491249+ * the data to an alternate active destination transport12501250+ * address if one exists.12511251+ *12521252+ * When retransmitting data that timed out, if the endpoint12531253+ * is multihomed, it should consider each source-destination12541254+ * address pair in its retransmission selection policy.12551255+ * When retransmitting timed-out data, the endpoint should12561256+ * attempt to pick the most divergent source-destination12571257+ * pair from the original source-destination pair to which12581258+ * the packet was transmitted.12591259+ *12601260+ * Note: Rules for picking the most divergent source-destination12611261+ * pair are an implementation decision and are not specified12621262+ * within this document.12631263+ *12641264+ * Our basic strategy is to round-robin transports in priorities12651265+ * according to sctp_state_prio_map[] e.g., if no such12661266+ * transport with state SCTP_ACTIVE exists, round-robin through12671267+ * SCTP_UNKNOWN, etc. You get the picture.12451268 */12461246-void sctp_assoc_update_retran_path(struct sctp_association *asoc)12691269+static const u8 sctp_trans_state_to_prio_map[] = {12701270+ [SCTP_ACTIVE] = 3, /* best case */12711271+ [SCTP_UNKNOWN] = 2,12721272+ [SCTP_PF] = 1,12731273+ [SCTP_INACTIVE] = 0, /* worst case */12741274+};12751275+12761276+static u8 sctp_trans_score(const struct sctp_transport *trans)12471277{12481248- struct sctp_transport *t, *next;12491249- struct list_head *head = &asoc->peer.transport_addr_list;12501250- struct list_head *pos;12511251-12521252- if (asoc->peer.transport_count == 1)12531253- return;12541254-12551255- /* Find the next transport in a round-robin fashion. */12561256- t = asoc->peer.retran_path;12571257- pos = &t->transports;12581258- next = NULL;12591259-12601260- while (1) {12611261- /* Skip the head. */12621262- if (pos->next == head)12631263- pos = head->next;12641264- else12651265- pos = pos->next;12661266-12671267- t = list_entry(pos, struct sctp_transport, transports);12681268-12691269- /* We have exhausted the list, but didn't find any12701270- * other active transports. If so, use the next12711271- * transport.12721272- */12731273- if (t == asoc->peer.retran_path) {12741274- t = next;12751275- break;12761276- }12771277-12781278- /* Try to find an active transport. */12791279-12801280- if ((t->state == SCTP_ACTIVE) ||12811281- (t->state == SCTP_UNKNOWN)) {12821282- break;12831283- } else {12841284- /* Keep track of the next transport in case12851285- * we don't find any active transport.12861286- */12871287- if (t->state != SCTP_UNCONFIRMED && !next)12881288- next = t;12891289- }12901290- }12911291-12921292- if (t)12931293- asoc->peer.retran_path = t;12941294- else12951295- t = asoc->peer.retran_path;12961296-12971297- pr_debug("%s: association:%p addr:%pISpc\n", __func__, asoc,12981298- &t->ipaddr.sa);12781278+ return sctp_trans_state_to_prio_map[trans->state];12991279}1300128013011301-/* Choose the transport for sending retransmit packet. */13021302-struct sctp_transport *sctp_assoc_choose_alter_transport(13031303- struct sctp_association *asoc, struct sctp_transport *last_sent_to)12811281+static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr,12821282+ struct sctp_transport *best)12831283+{12841284+ if (best == NULL)12851285+ return curr;12861286+12871287+ return sctp_trans_score(curr) > sctp_trans_score(best) ? curr : best;12881288+}12891289+12901290+void sctp_assoc_update_retran_path(struct sctp_association *asoc)12911291+{12921292+ struct sctp_transport *trans = asoc->peer.retran_path;12931293+ struct sctp_transport *trans_next = NULL;12941294+12951295+ /* We're done as we only have the one and only path. */12961296+ if (asoc->peer.transport_count == 1)12971297+ return;12981298+ /* If active_path and retran_path are the same and active,12991299+ * then this is the only active path. Use it.13001300+ */13011301+ if (asoc->peer.active_path == asoc->peer.retran_path &&13021302+ asoc->peer.active_path->state == SCTP_ACTIVE)13031303+ return;13041304+13051305+ /* Iterate from retran_path's successor back to retran_path. */13061306+ for (trans = list_next_entry(trans, transports); 1;13071307+ trans = list_next_entry(trans, transports)) {13081308+ /* Manually skip the head element. */13091309+ if (&trans->transports == &asoc->peer.transport_addr_list)13101310+ continue;13111311+ if (trans->state == SCTP_UNCONFIRMED)13121312+ continue;13131313+ trans_next = sctp_trans_elect_best(trans, trans_next);13141314+ /* Active is good enough for immediate return. */13151315+ if (trans_next->state == SCTP_ACTIVE)13161316+ break;13171317+ /* We've reached the end, time to update path. */13181318+ if (trans == asoc->peer.retran_path)13191319+ break;13201320+ }13211321+13221322+ if (trans_next != NULL)13231323+ asoc->peer.retran_path = trans_next;13241324+13251325+ pr_debug("%s: association:%p updated new path to addr:%pISpc\n",13261326+ __func__, asoc, &asoc->peer.retran_path->ipaddr.sa);13271327+}13281328+13291329+struct sctp_transport *13301330+sctp_assoc_choose_alter_transport(struct sctp_association *asoc,13311331+ struct sctp_transport *last_sent_to)13041332{13051333 /* If this is the first time packet is sent, use the active path,13061334 * else use the retran path. If the last packet was sent over the13071335 * retran path, update the retran path and use it.13081336 */13091309- if (!last_sent_to)13371337+ if (last_sent_to == NULL) {13101338 return asoc->peer.active_path;13111311- else {13391339+ } else {13121340 if (last_sent_to == asoc->peer.retran_path)13131341 sctp_assoc_update_retran_path(asoc);13421342+13141343 return asoc->peer.retran_path;13151344 }13161345}···13961367 return false;13971368}1398136913991399-/* Increase asoc's rwnd by len and send any window update SACK if needed. */14001400-void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len)13701370+/* Update asoc's rwnd for the approximated state in the buffer,13711371+ * and check whether SACK needs to be sent.13721372+ */13731373+void sctp_assoc_rwnd_update(struct sctp_association *asoc, bool update_peer)14011374{13751375+ int rx_count;14021376 struct sctp_chunk *sack;14031377 struct timer_list *timer;1404137814051405- if (asoc->rwnd_over) {14061406- if (asoc->rwnd_over >= len) {14071407- asoc->rwnd_over -= len;14081408- } else {14091409- asoc->rwnd += (len - asoc->rwnd_over);14101410- asoc->rwnd_over = 0;14111411- }14121412- } else {14131413- asoc->rwnd += len;14141414- }13791379+ if (asoc->ep->rcvbuf_policy)13801380+ rx_count = atomic_read(&asoc->rmem_alloc);13811381+ else13821382+ rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc);1415138314161416- /* If we had window pressure, start recovering it14171417- * once our rwnd had reached the accumulated pressure14181418- * threshold. The idea is to recover slowly, but up14191419- * to the initial advertised window.14201420- */14211421- if (asoc->rwnd_press && asoc->rwnd >= asoc->rwnd_press) {14221422- int change = min(asoc->pathmtu, asoc->rwnd_press);14231423- asoc->rwnd += change;14241424- asoc->rwnd_press -= change;14251425- }13841384+ if ((asoc->base.sk->sk_rcvbuf - rx_count) > 0)13851385+ asoc->rwnd = (asoc->base.sk->sk_rcvbuf - rx_count) >> 1;13861386+ else13871387+ asoc->rwnd = 0;1426138814271427- pr_debug("%s: asoc:%p rwnd increased by %d to (%u, %u) - %u\n",14281428- __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,14291429- asoc->a_rwnd);13891389+ pr_debug("%s: asoc:%p rwnd=%u, rx_count=%d, sk_rcvbuf=%d\n",13901390+ __func__, asoc, asoc->rwnd, rx_count,13911391+ asoc->base.sk->sk_rcvbuf);1430139214311393 /* Send a window update SACK if the rwnd has increased by at least the14321394 * minimum of the association's PMTU and half of the receive buffer.14331395 * The algorithm used is similar to the one described in14341396 * Section 4.2.3.3 of RFC 1122.14351397 */14361436- if (sctp_peer_needs_update(asoc)) {13981398+ if (update_peer && sctp_peer_needs_update(asoc)) {14371399 asoc->a_rwnd = asoc->rwnd;1438140014391401 pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u "···14461426 }14471427}1448142814491449-/* Decrease asoc's rwnd by len. */14501450-void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)14511451-{14521452- int rx_count;14531453- int over = 0;14541454-14551455- if (unlikely(!asoc->rwnd || asoc->rwnd_over))14561456- pr_debug("%s: association:%p has asoc->rwnd:%u, "14571457- "asoc->rwnd_over:%u!\n", __func__, asoc,14581458- asoc->rwnd, asoc->rwnd_over);14591459-14601460- if (asoc->ep->rcvbuf_policy)14611461- rx_count = atomic_read(&asoc->rmem_alloc);14621462- else14631463- rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc);14641464-14651465- /* If we've reached or overflowed our receive buffer, announce14661466- * a 0 rwnd if rwnd would still be positive. Store the14671467- * the potential pressure overflow so that the window can be restored14681468- * back to original value.14691469- */14701470- if (rx_count >= asoc->base.sk->sk_rcvbuf)14711471- over = 1;14721472-14731473- if (asoc->rwnd >= len) {14741474- asoc->rwnd -= len;14751475- if (over) {14761476- asoc->rwnd_press += asoc->rwnd;14771477- asoc->rwnd = 0;14781478- }14791479- } else {14801480- asoc->rwnd_over = len - asoc->rwnd;14811481- asoc->rwnd = 0;14821482- }14831483-14841484- pr_debug("%s: asoc:%p rwnd decreased by %d to (%u, %u, %u)\n",14851485- __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,14861486- asoc->rwnd_press);14871487-}1488142914891430/* Build the bind address list for the association based on info from the14901431 * local endpoint and the remote peer.
+4-3
net/sctp/sm_sideeffect.c
···495495 }496496497497 /* If the transport error count is greater than the pf_retrans498498- * threshold, and less than pathmaxrtx, then mark this transport499499- * as Partially Failed, ee SCTP Quick Failover Draft, secon 5.1,500500- * point 1498498+ * threshold, and less than pathmaxrtx, and if the current state499499+ * is not SCTP_UNCONFIRMED, then mark this transport as Partially500500+ * Failed, see SCTP Quick Failover Draft, section 5.1501501 */502502 if ((transport->state != SCTP_PF) &&503503+ (transport->state != SCTP_UNCONFIRMED) &&503504 (asoc->pf_retrans < transport->pathmaxrxt) &&504505 (transport->error_count > asoc->pf_retrans)) {505506
+8-1
net/sctp/sm_statefuns.c
···758758 struct sctp_chunk auth;759759 sctp_ierror_t ret;760760761761+ /* Make sure that we and the peer are AUTH capable */762762+ if (!net->sctp.auth_enable || !new_asoc->peer.auth_capable) {763763+ kfree_skb(chunk->auth_chunk);764764+ sctp_association_free(new_asoc);765765+ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);766766+ }767767+761768 /* set-up our fake chunk so that we can process it */762769 auth.skb = chunk->auth_chunk;763770 auth.asoc = chunk->asoc;···61836176 * PMTU. In cases, such as loopback, this might be a rather61846177 * large spill over.61856178 */61866186- if ((!chunk->data_accepted) && (!asoc->rwnd || asoc->rwnd_over ||61796179+ if ((!chunk->data_accepted) && (!asoc->rwnd ||61876180 (datalen > asoc->rwnd + asoc->frag_point))) {6188618161896182 /* If this is the next TSN, consider reneging to make
+32-15
net/sctp/socket.c
···6464#include <linux/crypto.h>6565#include <linux/slab.h>6666#include <linux/file.h>6767+#include <linux/compat.h>67686869#include <net/ip.h>6970#include <net/icmp.h>···13691368/*13701369 * New (hopefully final) interface for the API.13711370 * We use the sctp_getaddrs_old structure so that use-space library13721372- * can avoid any unnecessary allocations. The only defferent part13711371+ * can avoid any unnecessary allocations. The only different part13731372 * is that we store the actual length of the address buffer into the13741374- * addrs_num structure member. That way we can re-use the existing13731373+ * addrs_num structure member. That way we can re-use the existing13751374 * code.13761375 */13761376+#ifdef CONFIG_COMPAT13771377+struct compat_sctp_getaddrs_old {13781378+ sctp_assoc_t assoc_id;13791379+ s32 addr_num;13801380+ compat_uptr_t addrs; /* struct sockaddr * */13811381+};13821382+#endif13831383+13771384static int sctp_getsockopt_connectx3(struct sock *sk, int len,13781385 char __user *optval,13791386 int __user *optlen)···13901381 sctp_assoc_t assoc_id = 0;13911382 int err = 0;1392138313931393- if (len < sizeof(param))13941394- return -EINVAL;13841384+#ifdef CONFIG_COMPAT13851385+ if (is_compat_task()) {13861386+ struct compat_sctp_getaddrs_old param32;1395138713961396- if (copy_from_user(¶m, optval, sizeof(param)))13971397- return -EFAULT;13881388+ if (len < sizeof(param32))13891389+ return -EINVAL;13901390+ if (copy_from_user(¶m32, optval, sizeof(param32)))13911391+ return -EFAULT;1398139213991399- err = __sctp_setsockopt_connectx(sk,14001400- (struct sockaddr __user *)param.addrs,14011401- param.addr_num, &assoc_id);13931393+ param.assoc_id = param32.assoc_id;13941394+ param.addr_num = param32.addr_num;13951395+ param.addrs = compat_ptr(param32.addrs);13961396+ } else13971397+#endif13981398+ {13991399+ if (len < sizeof(param))14001400+ return -EINVAL;14011401+ if (copy_from_user(¶m, optval, sizeof(param)))14021402+ return -EFAULT;14031403+ }1402140414051405+ err = __sctp_setsockopt_connectx(sk, (struct sockaddr __user *)14061406+ param.addrs, param.addr_num,14071407+ &assoc_id);14031408 if (err == 0 || err == -EINPROGRESS) {14041409 if (copy_to_user(optval, &assoc_id, sizeof(assoc_id)))14051410 return -EFAULT;···21152092 sctp_skb_pull(skb, copied);21162093 skb_queue_head(&sk->sk_receive_queue, skb);2117209421182118- /* When only partial message is copied to the user, increase21192119- * rwnd by that amount. If all the data in the skb is read,21202120- * rwnd is updated when the event is freed.21212121- */21222122- if (!sctp_ulpevent_is_notification(event))21232123- sctp_assoc_rwnd_increase(event->asoc, copied);21242095 goto out;21252096 } else if ((event->msg_flags & MSG_NOTIFICATION) ||21262097 (event->msg_flags & MSG_EOR))
+11-7
net/sctp/sysctl.c
···151151 },152152 {153153 .procname = "cookie_hmac_alg",154154+ .data = &init_net.sctp.sctp_hmac_alg,154155 .maxlen = 8,155156 .mode = 0644,156157 .proc_handler = proc_sctp_do_hmac_alg,···402401403402int sctp_sysctl_net_register(struct net *net)404403{405405- struct ctl_table *table;406406- int i;404404+ struct ctl_table *table = sctp_net_table;407405408408- table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);409409- if (!table)410410- return -ENOMEM;406406+ if (!net_eq(net, &init_net)) {407407+ int i;411408412412- for (i = 0; table[i].data; i++)413413- table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;409409+ table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);410410+ if (!table)411411+ return -ENOMEM;412412+413413+ for (i = 0; table[i].data; i++)414414+ table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;415415+ }414416415417 net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);416418 return 0;
+6-2
net/sctp/ulpevent.c
···989989 skb = sctp_event2skb(event);990990 /* Set the owner and charge rwnd for bytes received. */991991 sctp_ulpevent_set_owner(event, asoc);992992- sctp_assoc_rwnd_decrease(asoc, skb_headlen(skb));992992+ sctp_assoc_rwnd_update(asoc, false);993993994994 if (!skb->data_len)995995 return;···10111011{10121012 struct sk_buff *skb, *frag;10131013 unsigned int len;10141014+ struct sctp_association *asoc;1014101510151016 /* Current stack structures assume that the rcv buffer is10161017 * per socket. For UDP style sockets this is not true as···10361035 }1037103610381037done:10391039- sctp_assoc_rwnd_increase(event->asoc, len);10381038+ asoc = event->asoc;10391039+ sctp_association_hold(asoc);10401040 sctp_ulpevent_release_owner(event);10411041+ sctp_assoc_rwnd_update(asoc, true);10421042+ sctp_association_put(asoc);10411043}1042104410431045static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event)
···13911391 u32 hdr_size;13921392 u32 min_hdr_size;1393139313941394+ /* If this packet comes from the defer queue, the skb has already13951395+ * been validated13961396+ */13971397+ if (unlikely(TIPC_SKB_CB(buf)->deferred))13981398+ return 1;13991399+13941400 if (unlikely(buf->len < MIN_H_SIZE))13951401 return 0;13961402···17091703 &l_ptr->newest_deferred_in, buf)) {17101704 l_ptr->deferred_inqueue_sz++;17111705 l_ptr->stats.deferred_recv++;17061706+ TIPC_SKB_CB(buf)->deferred = true;17121707 if ((l_ptr->deferred_inqueue_sz % 16) == 1)17131708 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);17141709 } else
-3
net/tipc/name_table.c
···945945{946946 u32 i;947947948948- if (!table.types)949949- return;950950-951948 /* Verify name table is empty, then release it */952949 write_lock_bh(&tipc_nametbl_lock);953950 for (i = 0; i < TIPC_NAMETBL_SIZE; i++) {
-8
net/tipc/netlink.c
···8383 },8484};85858686-static int tipc_genl_family_registered;8787-8886int tipc_netlink_start(void)8987{9088 int res;···9294 pr_err("Failed to register netlink interface\n");9395 return res;9496 }9595-9696- tipc_genl_family_registered = 1;9797 return 0;9898}9999100100void tipc_netlink_stop(void)101101{102102- if (!tipc_genl_family_registered)103103- return;104104-105102 genl_unregister_family(&tipc_genl_family);106106- tipc_genl_family_registered = 0;107103}
-3
net/tipc/ref.c
···126126 */127127void tipc_ref_table_stop(void)128128{129129- if (!tipc_ref_table.entries)130130- return;131131-132129 vfree(tipc_ref_table.entries);133130 tipc_ref_table.entries = NULL;134131}
-5
net/tipc/server.c
···573573 kmem_cache_destroy(s->rcvbuf_cache);574574 return ret;575575 }576576- s->enabled = 1;577576 return ret;578577}579578···582583 int total = 0;583584 int id;584585585585- if (!s->enabled)586586- return;587587-588588- s->enabled = 0;589586 spin_lock_bh(&s->idr_lock);590587 for (id = 0; total < s->idr_in_use; id++) {591588 con = idr_find(&s->conn_idr, id);
-2
net/tipc/server.h
···5656 * @name: server name5757 * @imp: message importance5858 * @type: socket type5959- * @enabled: identify whether server is launched or not6059 */6160struct tipc_server {6261 struct idr conn_idr;···7374 const char name[TIPC_SERVER_NAME_LEN];7475 int imp;7576 int type;7676- int enabled;7777};78787979int tipc_conn_sendmsg(struct tipc_server *s, int conid,
···17001700 return;17011701 case NL80211_REGDOM_SET_BY_USER:17021702 treatment = reg_process_hint_user(reg_request);17031703- if (treatment == REG_REQ_OK ||17031703+ if (treatment == REG_REQ_IGNORE ||17041704 treatment == REG_REQ_ALREADY_SET)17051705 return;17061706 schedule_delayed_work(®_timeout, msecs_to_jiffies(3142));···23732373int set_regdom(const struct ieee80211_regdomain *rd)23742374{23752375 struct regulatory_request *lr;23762376+ bool user_reset = false;23762377 int r;2377237823782379 if (!reg_is_valid_request(rd->alpha2)) {···23902389 break;23912390 case NL80211_REGDOM_SET_BY_USER:23922391 r = reg_set_rd_user(rd, lr);23922392+ user_reset = true;23932393 break;23942394 case NL80211_REGDOM_SET_BY_DRIVER:23952395 r = reg_set_rd_driver(rd, lr);···24042402 }2405240324062404 if (r) {24072407- if (r == -EALREADY)24052405+ switch (r) {24062406+ case -EALREADY:24082407 reg_set_request_processed();24082408+ break;24092409+ default:24102410+ /* Back to world regulatory in case of errors */24112411+ restore_regulatory_settings(user_reset);24122412+ }2409241324102414 kfree(rd);24112415 return r;
+1-1
net/xfrm/xfrm_policy.c
···11581158 if (hlist_unhashed(&pol->bydst))11591159 return NULL;1160116011611161- hlist_del(&pol->bydst);11611161+ hlist_del_init(&pol->bydst);11621162 hlist_del(&pol->byidx);11631163 list_del(&pol->walk.all);11641164 net->xfrm.policy_count[dir]--;
+17-6
net/xfrm/xfrm_state.c
···11591159 }11601160 x->props.aalgo = orig->props.aalgo;1161116111621162+ if (orig->aead) {11631163+ x->aead = xfrm_algo_aead_clone(orig->aead);11641164+ if (!x->aead)11651165+ goto error;11661166+ }11621167 if (orig->ealg) {11631168 x->ealg = xfrm_algo_clone(orig->ealg);11641169 if (!x->ealg)···12061201 x->props.flags = orig->props.flags;12071202 x->props.extra_flags = orig->props.extra_flags;1208120312041204+ x->tfcpad = orig->tfcpad;12051205+ x->replay_maxdiff = orig->replay_maxdiff;12061206+ x->replay_maxage = orig->replay_maxage;12091207 x->curlft.add_time = orig->curlft.add_time;12101208 x->km.state = orig->km.state;12111209 x->km.seq = orig->km.seq;···12231215 return NULL;12241216}1225121712261226-/* net->xfrm.xfrm_state_lock is held */12271218struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net)12281219{12291220 unsigned int h;12301230- struct xfrm_state *x;12211221+ struct xfrm_state *x = NULL;12221222+12231223+ spin_lock_bh(&net->xfrm.xfrm_state_lock);1231122412321225 if (m->reqid) {12331226 h = xfrm_dst_hash(net, &m->old_daddr, &m->old_saddr,···12451236 m->old_family))12461237 continue;12471238 xfrm_state_hold(x);12481248- return x;12391239+ break;12491240 }12501241 } else {12511242 h = xfrm_src_hash(net, &m->old_daddr, &m->old_saddr,···12601251 m->old_family))12611252 continue;12621253 xfrm_state_hold(x);12631263- return x;12541254+ break;12641255 }12651256 }1266125712671267- return NULL;12581258+ spin_unlock_bh(&net->xfrm.xfrm_state_lock);12591259+12601260+ return x;12681261}12691262EXPORT_SYMBOL(xfrm_migrate_state_find);12701263···14621451{14631452 int err = 0;14641453 struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family);14651465- struct net *net = xs_net(*dst);14541454+ struct net *net = xs_net(*src);1466145514671456 if (!afinfo)14681457 return -EAFNOSUPPORT;
···152152dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \153153 -I$(srctree)/arch/$(SRCARCH)/boot/dts \154154 -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \155155+ -I$(srctree)/drivers/of/testcase-data \155156 -undef -D__DTS__156157157158# Finds the multi-part object the current object will be linked into
···15021502#define R_ARM_JUMP24 2915031503#endif1504150415051505+#ifndef R_ARM_THM_CALL15061506+#define R_ARM_THM_CALL 1015071507+#endif15081508+#ifndef R_ARM_THM_JUMP2415091509+#define R_ARM_THM_JUMP24 3015101510+#endif15111511+#ifndef R_ARM_THM_JUMP1915121512+#define R_ARM_THM_JUMP19 5115131513+#endif15141514+15051515static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)15061516{15071517 unsigned int r_typ = ELF_R_TYPE(r->r_info);···15251515 case R_ARM_PC24:15261516 case R_ARM_CALL:15271517 case R_ARM_JUMP24:15181518+ case R_ARM_THM_CALL:15191519+ case R_ARM_THM_JUMP24:15201520+ case R_ARM_THM_JUMP19:15281521 /* From ARM ABI: ((S + A) | T) - P */15291522 r->r_addend = (int)(long)(elf->hdr +15301523 sechdr->sh_offset +
+5-1
security/keys/keyring.c
···1000100010011001 kenter("{%d}", key->serial);1002100210031003- BUG_ON(key != ctx->match_data);10031003+ /* We might get a keyring with matching index-key that is nonetheless a10041004+ * different keyring. */10051005+ if (key != ctx->match_data)10061006+ return 0;10071007+10041008 ctx->result = ERR_PTR(-EDEADLK);10051009 return 1;10061010}
···11111212config SND_BF5XX_SOC_SSM26021313 tristate "SoC SSM2602 Audio Codec Add-On Card support"1414- depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)1414+ depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI1515 select SND_BF5XX_SOC_I2S if !BF60x1616 select SND_BF6XX_SOC_I2S if BF60x1717 select SND_SOC_SSM2602···21212222config SND_SOC_BFIN_EVAL_ADAU17012323 tristate "Support for the EVAL-ADAU1701MINIZ board on Blackfin eval boards"2424- depends on SND_BF5XX_I2S2424+ depends on SND_BF5XX_I2S && I2C2525 select SND_BF5XX_SOC_I2S2626 select SND_SOC_ADAU17012727- select I2C2827 help2928 Say Y if you want to add support for the Analog Devices EVAL-ADAU1701MINIZ3029 board connected to one of the Blackfin evaluation boards like the···44454546config SND_SOC_BFIN_EVAL_ADAV80X4647 tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards"4747- depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)4848+ depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI4849 select SND_BF5XX_SOC_I2S4950 select SND_SOC_ADAV80X5051 help···57585859config SND_BF5XX_SOC_AD18365960 tristate "SoC AD1836 Audio support for BF5xx"6060- depends on SND_BF5XX_I2S6161+ depends on SND_BF5XX_I2S && SPI_MASTER6162 select SND_BF5XX_SOC_I2S6263 select SND_SOC_AD18366364 help···65666667config SND_BF5XX_SOC_AD193X6768 tristate "SoC AD193X Audio support for Blackfin"6868- depends on SND_BF5XX_I2S6969+ depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI6970 select SND_BF5XX_SOC_I2S7071 select SND_SOC_AD193X7172 help
···15231523 return 0;15241524}1525152515261526+/*15271527+ * DO NOT change the device Ids. The naming is intentionally specific as both15281528+ * the CODEC and PMIC parts of this chip are instantiated separately as I2C15291529+ * devices (both have configurable I2C addresses, and are to all intents and15301530+ * purposes separate). As a result there are specific DA9055 Ids for CODEC15311531+ * and PMIC, which must be different to operate together.15321532+ */15261533static const struct i2c_device_id da9055_i2c_id[] = {15271527- { "da9055", 0 },15341534+ { "da9055-codec", 0 },15281535 { }15291536};15301537MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);···15391532/* I2C codec control layer */15401533static struct i2c_driver da9055_i2c_driver = {15411534 .driver = {15421542- .name = "da9055",15351535+ .name = "da9055-codec",15431536 .owner = THIS_MODULE,15441537 },15451538 .probe = da9055_i2c_probe,
···336336 case M98090_REG_RECORD_TDM_SLOT:337337 case M98090_REG_SAMPLE_RATE:338338 case M98090_REG_DMIC34_BIQUAD_BASE ... M98090_REG_DMIC34_BIQUAD_BASE + 0x0E:339339+ case M98090_REG_REVISION_ID:339340 return true;340341 default:341342 return false;···1770176917711770 switch (level) {17721771 case SND_SOC_BIAS_ON:17731773- if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {17741774- ret = regcache_sync(max98090->regmap);17751775-17761776- if (ret != 0) {17771777- dev_err(codec->dev,17781778- "Failed to sync cache: %d\n", ret);17791779- return ret;17801780- }17811781- }17821782-17831772 if (max98090->jack_state == M98090_JACK_STATE_HEADSET) {17841773 /*17851774 * Set to normal bias level.···17831792 break;1784179317851794 case SND_SOC_BIAS_STANDBY:17951795+ if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {17961796+ ret = regcache_sync(max98090->regmap);17971797+ if (ret != 0) {17981798+ dev_err(codec->dev,17991799+ "Failed to sync cache: %d\n", ret);18001800+ return ret;18011801+ }18021802+ }18031803+ break;18041804+17861805 case SND_SOC_BIAS_OFF:17871806 /* Set internal pull-up to lowest power mode */17881807 snd_soc_update_bits(codec, M98090_REG_JACK_DETECT,
···5959 select SND_SOC_WM87506060 select SND_S3C2412_SOC_I2S6161 help6262- Sat Y if you want to add support for SoC audio on the Jive.6262+ Say Y if you want to add support for SoC audio on the Jive.63636464config SND_SOC_SAMSUNG_SMDK_WM85806565 tristate "SoC I2S Audio support for WM8580 on SMDK"···145145146146config SND_SOC_SAMSUNG_SMDK_WM9713147147 tristate "SoC AC97 Audio support for SMDK with WM9713"148148- depends on SND_SOC_SAMSUNG && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDKV210 || MACH_SMDKC110 || MACH_SMDKV310 || MACH_SMDKC210)148148+ depends on SND_SOC_SAMSUNG && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDKV210 || MACH_SMDKC110)149149 select SND_SOC_WM9713150150 select SND_SAMSUNG_AC97151151 help152152- Sat Y if you want to add support for SoC audio on the SMDK.152152+ Say Y if you want to add support for SoC audio on the SMDK.153153154154config SND_SOC_SMARTQ155155 tristate "SoC I2S Audio support for SmartQ board"
+133-20
sound/soc/soc-dapm.c
···12181218 ret = regulator_allow_bypass(w->regulator, false);12191219 if (ret != 0)12201220 dev_warn(w->dapm->dev,12211221- "ASoC: Failed to bypass %s: %d\n",12211221+ "ASoC: Failed to unbypass %s: %d\n",12221222 w->name, ret);12231223 }12241224···12281228 ret = regulator_allow_bypass(w->regulator, true);12291229 if (ret != 0)12301230 dev_warn(w->dapm->dev,12311231- "ASoC: Failed to unbypass %s: %d\n",12311231+ "ASoC: Failed to bypass %s: %d\n",12321232 w->name, ret);12331233 }12341234···32103210 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);32113211 const char *pin = (const char *)kcontrol->private_value;3212321232133213- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);32143214-32153213 if (ucontrol->value.integer.value[0])32163214 snd_soc_dapm_enable_pin(&card->dapm, pin);32173215 else32183216 snd_soc_dapm_disable_pin(&card->dapm, pin);32193219-32203220- mutex_unlock(&card->dapm_mutex);3221321732223218 snd_soc_dapm_sync(&card->dapm);32233219 return 0;···32443248 ret = regulator_allow_bypass(w->regulator, true);32453249 if (ret != 0)32463250 dev_warn(w->dapm->dev,32473247- "ASoC: Failed to unbypass %s: %d\n",32513251+ "ASoC: Failed to bypass %s: %d\n",32483252 w->name, ret);32493253 }32503254 break;···37633767}3764376837653769/**37703770+ * snd_soc_dapm_enable_pin_unlocked - enable pin.37713771+ * @dapm: DAPM context37723772+ * @pin: pin name37733773+ *37743774+ * Enables input/output pin and its parents or children widgets iff there is37753775+ * a valid audio route and active audio stream.37763776+ *37773777+ * Requires external locking.37783778+ *37793779+ * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to37803780+ * do any widget power switching.37813781+ */37823782+int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,37833783+ const char *pin)37843784+{37853785+ return snd_soc_dapm_set_pin(dapm, pin, 1);37863786+}37873787+EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin_unlocked);37883788+37893789+/**37663790 * snd_soc_dapm_enable_pin - enable pin.37673791 * @dapm: DAPM context37683792 * @pin: pin name37693793 *37703794 * Enables input/output pin and its parents or children widgets iff there is37713795 * a valid audio route and active audio stream.37963796+ *37723797 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to37733798 * do any widget power switching.37743799 */37753800int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin)37763801{37773777- return snd_soc_dapm_set_pin(dapm, pin, 1);38023802+ int ret;38033803+38043804+ mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);38053805+38063806+ ret = snd_soc_dapm_set_pin(dapm, pin, 1);38073807+38083808+ mutex_unlock(&dapm->card->dapm_mutex);38093809+38103810+ return ret;37783811}37793812EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin);38133813+38143814+/**38153815+ * snd_soc_dapm_force_enable_pin_unlocked - force a pin to be enabled38163816+ * @dapm: DAPM context38173817+ * @pin: pin name38183818+ *38193819+ * Enables input/output pin regardless of any other state. This is38203820+ * intended for use with microphone bias supplies used in microphone38213821+ * jack detection.38223822+ *38233823+ * Requires external locking.38243824+ *38253825+ * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to38263826+ * do any widget power switching.38273827+ */38283828+int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,38293829+ const char *pin)38303830+{38313831+ struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);38323832+38333833+ if (!w) {38343834+ dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin);38353835+ return -EINVAL;38363836+ }38373837+38383838+ dev_dbg(w->dapm->dev, "ASoC: force enable pin %s\n", pin);38393839+ w->connected = 1;38403840+ w->force = 1;38413841+ dapm_mark_dirty(w, "force enable");38423842+38433843+ return 0;38443844+}38453845+EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin_unlocked);3780384637813847/**37823848 * snd_soc_dapm_force_enable_pin - force a pin to be enabled···38553797int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,38563798 const char *pin)38573799{38583858- struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);38003800+ int ret;3859380138603860- if (!w) {38613861- dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin);38623862- return -EINVAL;38633863- }38023802+ mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);3864380338653865- dev_dbg(w->dapm->dev, "ASoC: force enable pin %s\n", pin);38663866- w->connected = 1;38673867- w->force = 1;38683868- dapm_mark_dirty(w, "force enable");38043804+ ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, pin);3869380538703870- return 0;38063806+ mutex_unlock(&dapm->card->dapm_mutex);38073807+38083808+ return ret;38713809}38723810EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);38113811+38123812+/**38133813+ * snd_soc_dapm_disable_pin_unlocked - disable pin.38143814+ * @dapm: DAPM context38153815+ * @pin: pin name38163816+ *38173817+ * Disables input/output pin and its parents or children widgets.38183818+ *38193819+ * Requires external locking.38203820+ *38213821+ * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to38223822+ * do any widget power switching.38233823+ */38243824+int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm,38253825+ const char *pin)38263826+{38273827+ return snd_soc_dapm_set_pin(dapm, pin, 0);38283828+}38293829+EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin_unlocked);3873383038743831/**38753832 * snd_soc_dapm_disable_pin - disable pin.···38923819 * @pin: pin name38933820 *38943821 * Disables input/output pin and its parents or children widgets.38223822+ *38953823 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to38963824 * do any widget power switching.38973825 */38983826int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,38993827 const char *pin)39003828{39013901- return snd_soc_dapm_set_pin(dapm, pin, 0);38293829+ int ret;38303830+38313831+ mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);38323832+38333833+ ret = snd_soc_dapm_set_pin(dapm, pin, 0);38343834+38353835+ mutex_unlock(&dapm->card->dapm_mutex);38363836+38373837+ return ret;39023838}39033839EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin);38403840+38413841+/**38423842+ * snd_soc_dapm_nc_pin_unlocked - permanently disable pin.38433843+ * @dapm: DAPM context38443844+ * @pin: pin name38453845+ *38463846+ * Marks the specified pin as being not connected, disabling it along38473847+ * any parent or child widgets. At present this is identical to38483848+ * snd_soc_dapm_disable_pin() but in future it will be extended to do38493849+ * additional things such as disabling controls which only affect38503850+ * paths through the pin.38513851+ *38523852+ * Requires external locking.38533853+ *38543854+ * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to38553855+ * do any widget power switching.38563856+ */38573857+int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,38583858+ const char *pin)38593859+{38603860+ return snd_soc_dapm_set_pin(dapm, pin, 0);38613861+}38623862+EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin_unlocked);3904386339053864/**39063865 * snd_soc_dapm_nc_pin - permanently disable pin.···39503845 */39513846int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin)39523847{39533953- return snd_soc_dapm_set_pin(dapm, pin, 0);38483848+ int ret;38493849+38503850+ mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);38513851+38523852+ ret = snd_soc_dapm_set_pin(dapm, pin, 0);38533853+38543854+ mutex_unlock(&dapm->card->dapm_mutex);38553855+38563856+ return ret;39543857}39553858EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin);39563859
+5-3
sound/soc/txx9/txx9aclc-ac97.c
···183183 irq = platform_get_irq(pdev, 0);184184 if (irq < 0)185185 return irq;186186+187187+ drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);188188+ if (!drvdata)189189+ return -ENOMEM;190190+186191 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);187192 drvdata->base = devm_ioremap_resource(&pdev->dev, r);188193 if (IS_ERR(drvdata->base))189194 return PTR_ERR(drvdata->base);190195191191- drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);192192- if (!drvdata)193193- return -ENOMEM;194196 platform_set_drvdata(pdev, drvdata);195197 drvdata->physbase = r->start;196198 if (sizeof(drvdata->physbase) > sizeof(r->start) &&
+1
sound/usb/mixer.c
···883883 }884884 break;885885886886+ case USB_ID(0x046d, 0x0807): /* Logitech Webcam C500 */886887 case USB_ID(0x046d, 0x0808):887888 case USB_ID(0x046d, 0x0809):888889 case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */
+9
sound/usb/mixer_maps.c
···328328 {}329329};330330331331+static const struct usbmix_name_map kef_x300a_map[] = {332332+ { 10, NULL }, /* firmware locks up (?) when we try to access this FU */333333+ { 0 }334334+};335335+331336/*332337 * Control map entries333338 */···423418 {424419 .id = USB_ID(0x200c, 0x1018),425420 .map = ebox44_map,421421+ },422422+ {423423+ .id = USB_ID(0x27ac, 0x1000),424424+ .map = kef_x300a_map,426425 },427426 { 0 } /* terminator */428427};
+3-3
tools/lib/lockdep/Makefile
···8787# We process the rest of the Makefile if this is the final invocation of make8888ifeq ($(skip-makefile),)89899090-srctree := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR))9191-objtree := $(CURDIR)9090+srctree := $(realpath $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)))9191+objtree := $(realpath $(CURDIR))9292src := $(srctree)9393obj := $(objtree)9494···112112113113LIBLOCKDEP_VERSION = $(LL_VERSION).$(LL_PATCHLEVEL).$(LL_EXTRAVERSION)114114115115-INCLUDES = -I. -I/usr/local/include -I./uinclude $(CONFIG_INCLUDES)115115+INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES)116116117117# Set compile option CFLAGS if not set elsewhere118118CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g
+1-1
tools/lib/lockdep/preload.c
···418418419419__attribute__((constructor)) static void init_preload(void)420420{421421- if (__init_state != done)421421+ if (__init_state == done)422422 return;423423424424#ifndef __GLIBC__
···151151void symbol__annotate_decay_histogram(struct symbol *sym, int evidx);152152void disasm__purge(struct list_head *head);153153154154+bool ui__has_annotation(void);155155+154156int symbol__tty_annotate(struct symbol *sym, struct map *map,155157 struct perf_evsel *evsel, bool print_lines,156158 bool full_paths, int min_pcnt, int max_lines);
+3-1
tools/perf/util/include/linux/bitops.h
···8787 return num;8888}89899090+typedef const unsigned long __attribute__((__may_alias__)) long_alias_t;9191+9092/*9193 * Find the first set bit in a memory region.9294 */9395static inline unsigned long9496find_first_bit(const unsigned long *addr, unsigned long size)9597{9696- const unsigned long *p = addr;9898+ long_alias_t *p = (long_alias_t *) addr;9799 unsigned long result = 0;98100 unsigned long tmp;99101
+15-2
tools/perf/util/parse-events.c
···10911091static bool is_event_supported(u8 type, unsigned config)10921092{10931093 bool ret = true;10941094+ int open_return;10941095 struct perf_evsel *evsel;10951096 struct perf_event_attr attr = {10961097 .type = type,10971098 .config = config,10981099 .disabled = 1,10991099- .exclude_kernel = 1,11001100 };11011101 struct {11021102 struct thread_map map;···1108110811091109 evsel = perf_evsel__new(&attr);11101110 if (evsel) {11111111- ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;11111111+ open_return = perf_evsel__open(evsel, NULL, &tmap.map);11121112+ ret = open_return >= 0;11131113+11141114+ if (open_return == -EACCES) {11151115+ /*11161116+ * This happens if the paranoid value11171117+ * /proc/sys/kernel/perf_event_paranoid is set to 211181118+ * Re-run with exclude_kernel set; we don't do that11191119+ * by default as some ARM machines do not support it.11201120+ *11211121+ */11221122+ evsel->attr.exclude_kernel = 1;11231123+ ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;11241124+ }11121125 perf_evsel__delete(evsel);11131126 }11141127
+1-1
tools/perf/util/probe-event.c
···336336 return ret;337337338338 for (i = 0; i < ntevs && ret >= 0; i++) {339339+ /* point.address is the addres of point.symbol + point.offset */339340 offset = tevs[i].point.address - stext;340340- offset += tevs[i].point.offset;341341 tevs[i].point.offset = 0;342342 zfree(&tevs[i].point.symbol);343343 ret = e_snprintf(buf, 32, "0x%lx", offset);
+6
tools/perf/util/session.c
···10081008 if (err == 0)10091009 perf_session__set_id_hdr_size(session);10101010 return err;10111011+ case PERF_RECORD_HEADER_EVENT_TYPE:10121012+ /*10131013+ * Depreceated, but we need to handle it for sake10141014+ * of old data files create in pipe mode.10151015+ */10161016+ return 0;10111017 case PERF_RECORD_HEADER_TRACING_DATA:10121018 /* setup for reading amidst mmap */10131019 lseek(fd, file_offset, SEEK_SET);