···1411411.2.0 Handle creation of arrays that contain failed devices.1421421.3.0 Added support for RAID 101431431.3.1 Allow device replacement/rebuild for RAID 10144144+1.3.2 Fix/improve redundancy checking for RAID10
···8181Required properties for pin configuration node:8282- atmel,pins: 4 integers array, represents a group of pins mux and config8383 setting. The format is atmel,pins = <PIN_BANK PIN_BANK_NUM PERIPH CONFIG>.8484- The PERIPH 0 means gpio.8484+ The PERIPH 0 means gpio, PERIPH 1 is periph A, PERIPH 2 is periph B...8585+ PIN_BANK 0 is pioA, PIN_BANK 1 is pioB...85868687Bits used for CONFIG:8788PULL_UP (1 << 0): indicate this pin need a pull up.···127126 pinctrl_dbgu: dbgu-0 {128127 atmel,pins =129128 <1 14 0x1 0x0 /* PB14 periph A */130130- 1 15 0x1 0x1>; /* PB15 periph with pullup */129129+ 1 15 0x1 0x1>; /* PB15 periph A with pullup */131130 };132131 };133132};
+9-9
Documentation/filesystems/f2fs.txt
···175175 align with the zone size <-|176176 |-> align with the segment size177177 _________________________________________________________________________178178- | | | Node | Segment | Segment | |179179- | Superblock | Checkpoint | Address | Info. | Summary | Main |180180- | (SB) | (CP) | Table (NAT) | Table (SIT) | Area (SSA) | |178178+ | | | Segment | Node | Segment | |179179+ | Superblock | Checkpoint | Info. | Address | Summary | Main |180180+ | (SB) | (CP) | Table (SIT) | Table (NAT) | Area (SSA) | |181181 |____________|_____2______|______N______|______N______|______N_____|__N___|182182 . .183183 . .···200200 : It contains file system information, bitmaps for valid NAT/SIT sets, orphan201201 inode lists, and summary entries of current active segments.202202203203-- Node Address Table (NAT)204204- : It is composed of a block address table for all the node blocks stored in205205- Main area.206206-207203- Segment Information Table (SIT)208204 : It contains segment information such as valid block count and bitmap for the209205 validity of all the blocks.206206+207207+- Node Address Table (NAT)208208+ : It is composed of a block address table for all the node blocks stored in209209+ Main area.210210211211- Segment Summary Area (SSA)212212 : It contains summary entries which contains the owner information of all the···236236valid, as shown as below.237237238238 +--------+----------+---------+239239- | CP | NAT | SIT |239239+ | CP | SIT | NAT |240240 +--------+----------+---------+241241 . . . .242242 . . . .243243 . . . .244244 +-------+-------+--------+--------+--------+--------+245245- | CP #0 | CP #1 | NAT #0 | NAT #1 | SIT #0 | SIT #1 |245245+ | CP #0 | CP #1 | SIT #0 | SIT #1 | NAT #0 | NAT #1 |246246 +-------+-------+--------+--------+--------+--------+247247 | ^ ^248248 | | |
+13-14
MAINTAINERS
···19721972F: drivers/usb/host/ohci-ep93xx.c1973197319741974CIRRUS LOGIC CS4270 SOUND DRIVER19751975-M: Timur Tabi <timur@freescale.com>19751975+M: Timur Tabi <timur@tabi.org>19761976L: alsa-devel@alsa-project.org (moderated for non-subscribers)19771977-S: Supported19771977+S: Odd Fixes19781978F: sound/soc/codecs/cs4270*1979197919801980CLEANCACHE API···29662966F: drivers/net/ethernet/i825xx/eexpress.*2967296729682968ETHERNET BRIDGE29692969-M: Stephen Hemminger <shemminger@vyatta.com>29692969+M: Stephen Hemminger <stephen@networkplumber.org>29702970L: bridge@lists.linux-foundation.org29712971L: netdev@vger.kernel.org29722972W: http://www.linuxfoundation.org/en/Net:Bridge···31863186F: include/uapi/linux/fb.h3187318731883188FREESCALE DIU FRAMEBUFFER DRIVER31893189-M: Timur Tabi <timur@freescale.com>31893189+M: Timur Tabi <timur@tabi.org>31903190L: linux-fbdev@vger.kernel.org31913191-S: Supported31913191+S: Maintained31923192F: drivers/video/fsl-diu-fb.*3193319331943194FREESCALE DMA DRIVER···32233223F: include/linux/fs_enet_pd.h3224322432253225FREESCALE QUICC ENGINE LIBRARY32263226-M: Timur Tabi <timur@freescale.com>32273226L: linuxppc-dev@lists.ozlabs.org32283228-S: Supported32273227+S: Orphan32293228F: arch/powerpc/sysdev/qe_lib/32303229F: arch/powerpc/include/asm/*qe.h32313230···32433244F: drivers/net/ethernet/freescale/ucc_geth*3244324532453246FREESCALE QUICC ENGINE UCC UART DRIVER32463246-M: Timur Tabi <timur@freescale.com>32473247+M: Timur Tabi <timur@tabi.org>32473248L: linuxppc-dev@lists.ozlabs.org32483248-S: Supported32493249+S: Maintained32493250F: drivers/tty/serial/ucc_uart.c3250325132513252FREESCALE SOC SOUND DRIVERS32523252-M: Timur Tabi <timur@freescale.com>32533253+M: Timur Tabi <timur@tabi.org>32533254L: alsa-devel@alsa-project.org (moderated for non-subscribers)32543255L: linuxppc-dev@lists.ozlabs.org32553255-S: Supported32563256+S: Maintained32563257F: sound/soc/fsl/fsl*32573258F: sound/soc/fsl/mpc8610_hpcd.c32583259···4900490149014902MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2)49024903M: Mirko Lindner <mlindner@marvell.com>49034903-M: Stephen Hemminger <shemminger@vyatta.com>49044904+M: Stephen Hemminger <stephen@networkplumber.org>49044905L: netdev@vger.kernel.org49054906S: Maintained49064907F: drivers/net/ethernet/marvell/sk*···51755176F: drivers/infiniband/hw/nes/5176517751775178NETEM NETWORK EMULATOR51785178-M: Stephen Hemminger <shemminger@vyatta.com>51795179+M: Stephen Hemminger <stephen@networkplumber.org>51795180L: netem@lists.linux-foundation.org51805181S: Maintained51815182F: net/sched/sch_netem.c···65736574F: include/media/s3c_camif.h6574657565756576SERIAL DRIVERS65766576-M: Alan Cox <alan@linux.intel.com>65776577+M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>65776578L: linux-serial@vger.kernel.org65786579S: Maintained65796580F: drivers/tty/serial
···1919CONFIG_SOC_AT91SAM9263=y2020CONFIG_SOC_AT91SAM9G45=y2121CONFIG_SOC_AT91SAM9X5=y2222+CONFIG_SOC_AT91SAM9N12=y2223CONFIG_MACH_AT91SAM_DT=y2324CONFIG_AT91_PROGRAMMABLE_CLOCKS=y2425CONFIG_AT91_TIMER_HZ=128···3231CONFIG_ZBOOT_ROM_BSS=0x03332CONFIG_ARM_APPENDED_DTB=y3433CONFIG_ARM_ATAG_DTB_COMPAT=y3535-CONFIG_CMDLINE="mem=128M console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"3434+CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"3635CONFIG_KEXEC=y3736CONFIG_AUTO_ZRELADDR=y3837# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
···246246247247 /*248248 * Then map boot params address in r2 if specified.249249+ * We map 2 sections in case the ATAGs/DTB crosses a section boundary.249250 */250251 mov r0, r2, lsr #SECTION_SHIFT251252 movs r0, r0, lsl #SECTION_SHIFT···254253 addne r3, r3, #PAGE_OFFSET255254 addne r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER)256255 orrne r6, r7, r0256256+ strne r6, [r3], #1 << PMD_ORDER257257+ addne r6, r6, #1 << SECTION_SHIFT257258 strne r6, [r3]258259259260#ifdef CONFIG_DEBUG_LL···334331 * as it has already been validated by the primary processor.335332 */336333#ifdef CONFIG_ARM_VIRT_EXT337337- bl __hyp_stub_install334334+ bl __hyp_stub_install_secondary338335#endif339336 safe_svcmode_maskall r9340337
+6-12
arch/arm/kernel/hyp-stub.S
···9999 * immediately.100100 */101101 compare_cpu_mode_with_primary r4, r5, r6, r7102102- bxne lr102102+ movne pc, lr103103104104 /*105105 * Once we have given up on one CPU, we do not try to install the···111111 */112112113113 cmp r4, #HYP_MODE114114- bxne lr @ give up if the CPU is not in HYP mode114114+ movne pc, lr @ give up if the CPU is not in HYP mode115115116116/*117117 * Configure HSCTLR to set correct exception endianness/instruction set···120120 * Eventually, CPU-specific code might be needed -- assume not for now121121 *122122 * This code relies on the "eret" instruction to synchronize the123123- * various coprocessor accesses.123123+ * various coprocessor accesses. This is done when we switch to SVC124124+ * (see safe_svcmode_maskall).124125 */125126 @ Now install the hypervisor stub:126127 adr r7, __hyp_stub_vectors···1561551:157156#endif158157159159- bic r7, r4, #MODE_MASK160160- orr r7, r7, #SVC_MODE161161-THUMB( orr r7, r7, #PSR_T_BIT )162162- msr spsr_cxsf, r7 @ This is SPSR_hyp.163163-164164- __MSR_ELR_HYP(14) @ msr elr_hyp, lr165165- __ERET @ return, switching to SVC mode166166- @ The boot CPU mode is left in r4.158158+ bx lr @ The boot CPU mode is left in r4.167159ENDPROC(__hyp_stub_install_secondary)168160169161__hyp_stub_do_trap:···194200 @ fall through195201ENTRY(__hyp_set_vectors)196202 __HVC(0)197197- bx lr203203+ mov pc, lr198204ENDPROC(__hyp_set_vectors)199205200206#ifndef ZIMAGE
+2
arch/arm/mach-at91/setup.c
···105105 switch (socid) {106106 case ARCH_ID_AT91RM9200:107107 at91_soc_initdata.type = AT91_SOC_RM9200;108108+ if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_NONE)109109+ at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;108110 at91_boot_soc = at91rm9200_soc;109111 break;110112
···436436 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)437437 clk_prepare_enable(clk[clks_init_on[i]]);438438439439+ /* Set initial power mode */440440+ imx6q_set_lpm(WAIT_CLOCKED);441441+439442 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt");440443 base = of_iomap(np, 0);441444 WARN_ON(!base);
+1
arch/arm/mach-imx/common.h
···142142extern void imx6q_clock_map_io(void);143143144144extern void imx_cpu_die(unsigned int cpu);145145+extern int imx_cpu_kill(unsigned int cpu);145146146147#ifdef CONFIG_PM147148extern void imx6q_pm_init(void);
···4646void imx_cpu_die(unsigned int cpu)4747{4848 cpu_enter_lowpower();4949- imx_enable_cpu(cpu, false);4949+ cpu_do_idle();5050+}50515151- /* spin here until hardware takes it down */5252- while (1)5353- ;5252+int imx_cpu_kill(unsigned int cpu)5353+{5454+ imx_enable_cpu(cpu, false);5555+ return 1;5456}
···475475{476476 int ret = 0;477477478478+ if (!ap_syscon_base)479479+ return -EINVAL;480480+478481 if (nr == 0) {479482 sys->mem_offset = PHYS_PCI_MEM_BASE;480483 ret = pci_v3_setup_resources(sys);481481- /* Remap the Integrator system controller */482482- ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100);483483- if (!ap_syscon_base)484484- return -EINVAL;485484 }486485487486 return ret;···495496 unsigned long flags;496497 unsigned int temp;497498 int ret;499499+500500+ /* Remap the Integrator system controller */501501+ ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100);502502+ if (!ap_syscon_base) {503503+ pr_err("unable to remap the AP syscon for PCIv3\n");504504+ return;505505+ }498506499507 pcibios_min_mem = 0x00100000;500508
-38
arch/arm/mach-kirkwood/board-ns2.c
···1818#include <linux/gpio.h>1919#include <linux/of.h>2020#include "common.h"2121-#include "mpp.h"22212322static struct mv643xx_eth_platform_data ns2_ge00_data = {2423 .phy_addr = MV643XX_ETH_PHY_ADDR(8),2525-};2626-2727-static unsigned int ns2_mpp_config[] __initdata = {2828- MPP0_SPI_SCn,2929- MPP1_SPI_MOSI,3030- MPP2_SPI_SCK,3131- MPP3_SPI_MISO,3232- MPP4_NF_IO6,3333- MPP5_NF_IO7,3434- MPP6_SYSRST_OUTn,3535- MPP7_GPO, /* Fan speed (bit 1) */3636- MPP8_TW0_SDA,3737- MPP9_TW0_SCK,3838- MPP10_UART0_TXD,3939- MPP11_UART0_RXD,4040- MPP12_GPO, /* Red led */4141- MPP14_GPIO, /* USB fuse */4242- MPP16_GPIO, /* SATA 0 power */4343- MPP17_GPIO, /* SATA 1 power */4444- MPP18_NF_IO0,4545- MPP19_NF_IO1,4646- MPP20_SATA1_ACTn,4747- MPP21_SATA0_ACTn,4848- MPP22_GPIO, /* Fan speed (bit 0) */4949- MPP23_GPIO, /* Fan power */5050- MPP24_GPIO, /* USB mode select */5151- MPP25_GPIO, /* Fan rotation fail */5252- MPP26_GPIO, /* USB device vbus */5353- MPP28_GPIO, /* USB enable host vbus */5454- MPP29_GPIO, /* Blue led (slow register) */5555- MPP30_GPIO, /* Blue led (command register) */5656- MPP31_GPIO, /* Board power off */5757- MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */5858- MPP33_GPO, /* Fan speed (bit 2) */5959- 06024};61256226#define NS2_GPIO_POWER_OFF 31···3571 /*3672 * Basic setup. Needs to be called early.3773 */3838- kirkwood_mpp_conf(ns2_mpp_config);3939-4074 if (of_machine_is_compatible("lacie,netspace_lite_v2") ||4175 of_machine_is_compatible("lacie,netspace_mini_v2"))4276 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
···20262026 * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power20272027 * state when turning the ABE clock domain. Workaround this by20282028 * locking the ABE DPLL on boot.20292029+ * Lock the ABE DPLL in any case to avoid issues with audio.20292030 */20302030- if (cpu_is_omap446x()) {20312031- rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck);20322032- if (!rc)20332033- rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ);20342034- if (rc)20352035- pr_err("%s: failed to configure ABE DPLL!\n", __func__);20362036- }20312031+ rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck);20322032+ if (!rc)20332033+ rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ);20342034+ if (rc)20352035+ pr_err("%s: failed to configure ABE DPLL!\n", __func__);2037203620382037 return 0;20392038}
···21322132 * currently reset very early during boot, before I2C is21332133 * available, so it doesn't seem that we have any choice in21342134 * the kernel other than to avoid resetting it.21352135+ *21362136+ * Also, McPDM needs to be configured to NO_IDLE mode when it21372137+ * is in used otherwise vital clocks will be gated which21382138+ * results 'slow motion' audio playback.21352139 */21362136- .flags = HWMOD_EXT_OPT_MAIN_CLK,21402140+ .flags = HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE,21372141 .mpu_irqs = omap44xx_mcpdm_irqs,21382142 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,21392143 .main_clk = "mcpdm_fck",
+2-6
arch/arm/mach-omap2/timer.c
···165165 struct device_node *np;166166167167 for_each_matching_node(np, match) {168168- if (!of_device_is_available(np)) {169169- of_node_put(np);168168+ if (!of_device_is_available(np))170169 continue;171171- }172170173173- if (property && !of_get_property(np, property, NULL)) {174174- of_node_put(np);171171+ if (property && !of_get_property(np, property, NULL))175172 continue;176176- }177173178174 of_add_property(np, &device_disabled);179175 return np;
···338338 for (i = 0; i < ARRAY_SIZE(s3c64xx_pm_domains); i++)339339 pm_genpd_init(&s3c64xx_pm_domains[i]->pd, NULL, false);340340341341+#ifdef CONFIG_S3C_DEV_FB341342 if (dev_get_platdata(&s3c_device_fb.dev))342343 pm_genpd_add_device(&s3c64xx_pm_f.pd, &s3c_device_fb.dev);344344+#endif343345344346 return 0;345347}
+10-8
arch/arm/mm/dma-mapping.c
···774774 size_t size, enum dma_data_direction dir,775775 void (*op)(const void *, size_t, int))776776{777777+ unsigned long pfn;778778+ size_t left = size;779779+780780+ pfn = page_to_pfn(page) + offset / PAGE_SIZE;781781+ offset %= PAGE_SIZE;782782+777783 /*778784 * A single sg entry may refer to multiple physically contiguous779785 * pages. But we still need to process highmem pages individually.780786 * If highmem is not configured then the bulk of this loop gets781787 * optimized out.782788 */783783- size_t left = size;784789 do {785790 size_t len = left;786791 void *vaddr;787792793793+ page = pfn_to_page(pfn);794794+788795 if (PageHighMem(page)) {789789- if (len + offset > PAGE_SIZE) {790790- if (offset >= PAGE_SIZE) {791791- page += offset / PAGE_SIZE;792792- offset %= PAGE_SIZE;793793- }796796+ if (len + offset > PAGE_SIZE)794797 len = PAGE_SIZE - offset;795795- }796798 vaddr = kmap_high_get(page);797799 if (vaddr) {798800 vaddr += offset;···811809 op(vaddr, len, dir);812810 }813811 offset = 0;814814- page++;812812+ pfn++;815813 left -= len;816814 } while (left);817815}
···672672 read_unlock(&tasklist_lock);673673}674674675675-static inline int676676-thread_matches (struct task_struct *thread, unsigned long addr)677677-{678678- unsigned long thread_rbs_end;679679- struct pt_regs *thread_regs;680680-681681- if (ptrace_check_attach(thread, 0) < 0)682682- /*683683- * If the thread is not in an attachable state, we'll684684- * ignore it. The net effect is that if ADDR happens685685- * to overlap with the portion of the thread's686686- * register backing store that is currently residing687687- * on the thread's kernel stack, then ptrace() may end688688- * up accessing a stale value. But if the thread689689- * isn't stopped, that's a problem anyhow, so we're690690- * doing as well as we can...691691- */692692- return 0;693693-694694- thread_regs = task_pt_regs(thread);695695- thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL);696696- if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end))697697- return 0;698698-699699- return 1; /* looks like we've got a winner */700700-}701701-702675/*703676 * Write f32-f127 back to task->thread.fph if it has been modified.704677 */
···664664 ld r4,TI_FLAGS(r9)665665 andi. r0,r4,_TIF_NEED_RESCHED666666 bne 1b667667+668668+ /*669669+ * arch_local_irq_restore() from preempt_schedule_irq above may670670+ * enable hard interrupt but we really should disable interrupts671671+ * when we return from the interrupt, and so that we don't get672672+ * interrupted after loading SRR0/1.673673+ */674674+#ifdef CONFIG_PPC_BOOK3E675675+ wrteei 0676676+#else677677+ ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */678678+ mtmsrd r10,1 /* Update machine state */679679+#endif /* CONFIG_PPC_BOOK3E */667680#endif /* CONFIG_PREEMPT */668681669682 .globl fast_exc_return_irq
+3-2
arch/powerpc/kernel/kgdb.c
···154154static int kgdb_singlestep(struct pt_regs *regs)155155{156156 struct thread_info *thread_info, *exception_thread_info;157157- struct thread_info *backup_current_thread_info = \158158- (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);157157+ struct thread_info *backup_current_thread_info;159158160159 if (user_mode(regs))161160 return 0;162161162162+ backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);163163 /*164164 * On Book E and perhaps other processors, singlestep is handled on165165 * the critical exception stack. This causes current_thread_info()···185185 /* Restore current_thread_info lastly. */186186 memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);187187188188+ kfree(backup_current_thread_info);188189 return 1;189190}190191
+7-2
arch/powerpc/kernel/time.c
···494494 set_dec(DECREMENTER_MAX);495495496496 /* Some implementations of hotplug will get timer interrupts while497497- * offline, just ignore these497497+ * offline, just ignore these and we also need to set498498+ * decrementers_next_tb as MAX to make sure __check_irq_replay499499+ * don't replay timer interrupt when return, otherwise we'll trap500500+ * here infinitely :(498501 */499499- if (!cpu_online(smp_processor_id()))502502+ if (!cpu_online(smp_processor_id())) {503503+ *next_tb = ~(u64)0;500504 return;505505+ }501506502507 /* Conditionally hard-enable interrupts now that the DEC has been503508 * bumped to its maximum value
+2
arch/powerpc/kvm/emulate.c
···3939#define OP_31_XOP_TRAP 44040#define OP_31_XOP_LWZX 234141#define OP_31_XOP_TRAP_64 684242+#define OP_31_XOP_DCBF 864243#define OP_31_XOP_LBZX 874344#define OP_31_XOP_STWX 1514445#define OP_31_XOP_STBX 215···375374 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs);376375 break;377376377377+ case OP_31_XOP_DCBF:378378 case OP_31_XOP_DCBI:379379 /* Do nothing. The guest is performing dcbi because380380 * hardware DMA is not snooped by the dcache, but
···236236237237static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy)238238{239239+ /*240240+ * We don't support CPU hotplug. Don't unmap after the system241241+ * has already made it to a running state.242242+ */243243+ if (system_state != SYSTEM_BOOTING)244244+ return 0;245245+239246 if (sdcasr_mapbase)240247 iounmap(sdcasr_mapbase);241248 if (sdcpwr_mapbase)
···128128 return get_clock_xt() - sched_clock_base_cc;129129}130130131131+/**132132+ * tod_to_ns - convert a TOD format value to nanoseconds133133+ * @todval: to be converted TOD format value134134+ * Returns: number of nanoseconds that correspond to the TOD format value135135+ *136136+ * Converting a 64 Bit TOD format value to nanoseconds means that the value137137+ * must be divided by 4.096. In order to achieve that we multiply with 125138138+ * and divide by 512:139139+ *140140+ * ns = (todval * 125) >> 9;141141+ *142142+ * In order to avoid an overflow with the multiplication we can rewrite this.143143+ * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)144144+ * we end up with145145+ *146146+ * ns = ((2^32 * th + tl) * 125 ) >> 9;147147+ * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);148148+ *149149+ */150150+static inline unsigned long long tod_to_ns(unsigned long long todval)151151+{152152+ unsigned long long ns;153153+154154+ ns = ((todval >> 32) << 23) * 125;155155+ ns += ((todval & 0xffffffff) * 125) >> 9;156156+ return ns;157157+}158158+131159#endif
+1-1
arch/s390/kernel/time.c
···6363 */6464unsigned long long notrace __kprobes sched_clock(void)6565{6666- return (get_clock_monotonic() * 125) >> 9;6666+ return tod_to_ns(get_clock_monotonic());6767}68686969/*
···3939/* This decides where the kernel will search for a free chunk of vm4040 * space during mmap's.4141 */4242-#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)4242+#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)43434444/*4545 * Bit of SR register
+1-1
arch/sh/include/asm/processor_64.h
···4747/* This decides where the kernel will search for a free chunk of vm4848 * space during mmap's.4949 */5050-#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)5050+#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)51515252/*5353 * Bit of SR register
···302302 if (status != EFI_SUCCESS)303303 continue;304304305305- if (!attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)305305+ if (!(attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM))306306 continue;307307308308 if (!pci->romimage || !pci->romsize)
-6
arch/x86/kernel/cpu/perf_event.c
···340340 /* BTS is currently only allowed for user-mode. */341341 if (!attr->exclude_kernel)342342 return -EOPNOTSUPP;343343-344344- if (!attr->exclude_guest)345345- return -EOPNOTSUPP;346343 }347344348345 hwc->config |= config;···381384{382385 if (event->attr.precise_ip) {383386 int precise = 0;384384-385385- if (!event->attr.exclude_guest)386386- return -EOPNOTSUPP;387387388388 /* Support for constant skid */389389 if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
···610610611611static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;612612613613+static bool __init snb_gfx_workaround_needed(void)614614+{615615+#ifdef CONFIG_PCI616616+ int i;617617+ u16 vendor, devid;618618+ static const __initconst u16 snb_ids[] = {619619+ 0x0102,620620+ 0x0112,621621+ 0x0122,622622+ 0x0106,623623+ 0x0116,624624+ 0x0126,625625+ 0x010a,626626+ };627627+628628+ /* Assume no if something weird is going on with PCI */629629+ if (!early_pci_allowed())630630+ return false;631631+632632+ vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);633633+ if (vendor != 0x8086)634634+ return false;635635+636636+ devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);637637+ for (i = 0; i < ARRAY_SIZE(snb_ids); i++)638638+ if (devid == snb_ids[i])639639+ return true;640640+#endif641641+642642+ return false;643643+}644644+645645+/*646646+ * Sandy Bridge graphics has trouble with certain ranges, exclude647647+ * them from allocation.648648+ */649649+static void __init trim_snb_memory(void)650650+{651651+ static const __initconst unsigned long bad_pages[] = {652652+ 0x20050000,653653+ 0x20110000,654654+ 0x20130000,655655+ 0x20138000,656656+ 0x40004000,657657+ };658658+ int i;659659+660660+ if (!snb_gfx_workaround_needed())661661+ return;662662+663663+ printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");664664+665665+ /*666666+ * Reserve all memory below the 1 MB mark that has not667667+ * already been reserved.668668+ */669669+ memblock_reserve(0, 1<<20);670670+671671+ for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {672672+ if (memblock_reserve(bad_pages[i], PAGE_SIZE))673673+ printk(KERN_WARNING "failed to reserve 0x%08lx\n",674674+ bad_pages[i]);675675+ }676676+}677677+678678+/*679679+ * Here we put platform-specific memory range workarounds, i.e.680680+ * memory known to be corrupt or otherwise in need to be reserved on681681+ * specific platforms.682682+ *683683+ * If this gets used more widely it could use a real dispatch mechanism.684684+ */685685+static void __init trim_platform_memory_ranges(void)686686+{687687+ trim_snb_memory();688688+}689689+613690static void __init trim_bios_range(void)614691{615692 /*···707630 * take them out.708631 */709632 e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);633633+710634 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);711635}712636···985907 (max_pfn_mapped<<PAGE_SHIFT) - 1);986908987909 setup_real_mode();910910+911911+ trim_platform_memory_ranges();988912989913 init_gbpages();990914
+5-4
arch/x86/kernel/step.c
···165165 * Ensure irq/preemption can't change debugctl in between.166166 * Note also that both TIF_BLOCKSTEP and debugctl should167167 * be changed atomically wrt preemption.168168- * FIXME: this means that set/clear TIF_BLOCKSTEP is simply169169- * wrong if task != current, SIGKILL can wakeup the stopped170170- * tracee and set/clear can play with the running task, this171171- * can confuse the next __switch_to_xtra().168168+ *169169+ * NOTE: this means that set/clear TIF_BLOCKSTEP is only safe if170170+ * task is current or it can't be running, otherwise we can race171171+ * with __switch_to_xtra(). We rely on ptrace_freeze_traced() but172172+ * PTRACE_KILL is not safe.172173 */173174 local_irq_disable();174175 debugctl = get_debugctlmsr();
-7
arch/x86/xen/smp.c
···432432 play_dead_common();433433 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);434434 cpu_bringup();435435- /*436436- * Balance out the preempt calls - as we are running in cpu_idle437437- * loop which has been called at bootup from cpu_bringup_and_idle.438438- * The cpucpu_bringup_and_idle called cpu_bringup which made a439439- * preempt_disable() So this preempt_enable will balance it out.440440- */441441- preempt_enable();442435}443436444437#else /* !CONFIG_HOTPLUG_CPU */
···340340 if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)341341 || boot_cpu_data.x86 == 0x11) {342342 rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi);343343+ /*344344+ * MSR C001_0064+:345345+ * Bit 63: PstateEn. Read-write. If set, the P-state is valid.346346+ */347347+ if (!(hi & BIT(31)))348348+ return;349349+343350 fid = lo & 0x3f;344351 did = (lo >> 6) & 7;345352 if (boot_cpu_data.x86 == 0x10)
+7-1
drivers/ata/ahci.c
···53535454enum {5555 AHCI_PCI_BAR_STA2X11 = 0,5656+ AHCI_PCI_BAR_ENMOTUS = 2,5657 AHCI_PCI_BAR_STANDARD = 5,5758};5859···410409 { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM1060 */411410 { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */412411 { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */412412+413413+ /* Enmotus */414414+ { PCI_DEVICE(0x1c44, 0x8000), board_ahci },413415414416 /* Generic, PCI class code for AHCI */415417 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,···11021098 dev_info(&pdev->dev,11031099 "PDC42819 can only drive SATA devices with this driver\n");1104110011051105- /* The Connext uses non-standard BAR */11011101+ /* Both Connext and Enmotus devices use non-standard BARs */11061102 if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06)11071103 ahci_pci_bar = AHCI_PCI_BAR_STA2X11;11041104+ else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)11051105+ ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;1108110611091107 /* acquire resources */11101108 rc = pcim_enable_device(pdev);
+3-3
drivers/ata/libahci.c
···19511951 /* Use the nominal value 10 ms if the read MDAT is zero,19521952 * the nominal value of DETO is 20 ms.19531953 */19541954- if (dev->sata_settings[ATA_LOG_DEVSLP_VALID] &19541954+ if (dev->devslp_timing[ATA_LOG_DEVSLP_VALID] &19551955 ATA_LOG_DEVSLP_VALID_MASK) {19561956- mdat = dev->sata_settings[ATA_LOG_DEVSLP_MDAT] &19561956+ mdat = dev->devslp_timing[ATA_LOG_DEVSLP_MDAT] &19571957 ATA_LOG_DEVSLP_MDAT_MASK;19581958 if (!mdat)19591959 mdat = 10;19601960- deto = dev->sata_settings[ATA_LOG_DEVSLP_DETO];19601960+ deto = dev->devslp_timing[ATA_LOG_DEVSLP_DETO];19611961 if (!deto)19621962 deto = 20;19631963 } else {
+13-9
drivers/ata/libata-core.c
···23252325 }23262326 }2327232723282328- /* check and mark DevSlp capability */23292329- if (ata_id_has_devslp(dev->id))23302330- dev->flags |= ATA_DFLAG_DEVSLP;23312331-23322332- /* Obtain SATA Settings page from Identify Device Data Log,23332333- * which contains DevSlp timing variables etc.23342334- * Exclude old devices with ata_id_has_ncq()23282328+ /* Check and mark DevSlp capability. Get DevSlp timing variables23292329+ * from SATA Settings page of Identify Device Data Log.23352330 */23362336- if (ata_id_has_ncq(dev->id)) {23312331+ if (ata_id_has_devslp(dev->id)) {23322332+ u8 sata_setting[ATA_SECT_SIZE];23332333+ int i, j;23342334+23352335+ dev->flags |= ATA_DFLAG_DEVSLP;23372336 err_mask = ata_read_log_page(dev,23382337 ATA_LOG_SATA_ID_DEV_DATA,23392338 ATA_LOG_SATA_SETTINGS,23402340- dev->sata_settings,23392339+ sata_setting,23412340 1);23422341 if (err_mask)23432342 ata_dev_dbg(dev,23442343 "failed to get Identify Device Data, Emask 0x%x\n",23452344 err_mask);23452345+ else23462346+ for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) {23472347+ j = ATA_LOG_DEVSLP_OFFSET + i;23482348+ dev->devslp_timing[i] = sata_setting[j];23492349+ }23462350 }2347235123482352 dev->cdb_len = 16;
+1-1
drivers/ata/libata-eh.c
···20942094 */20952095static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc)20962096{20972097- if (qc->flags & AC_ERR_MEDIA)20972097+ if (qc->err_mask & AC_ERR_MEDIA)20982098 return 0; /* don't retry media errors */20992099 if (qc->flags & ATA_QCFLAG_IO)21002100 return 1; /* otherwise retry anything from fs stack */
+1-1
drivers/base/cpu.c
···224224 * by the cpu device.225225 *226226 * Never copy this way of doing things, or you too will be made fun of227227- * on the linux-kerenl list, you have been warned.227227+ * on the linux-kernel list, you have been warned.228228 */229229}230230
···5656 .llseek = default_llseek,5757};58585959+static void regmap_debugfs_free_dump_cache(struct regmap *map)6060+{6161+ struct regmap_debugfs_off_cache *c;6262+6363+ while (!list_empty(&map->debugfs_off_cache)) {6464+ c = list_first_entry(&map->debugfs_off_cache,6565+ struct regmap_debugfs_off_cache,6666+ list);6767+ list_del(&c->list);6868+ kfree(c);6969+ }7070+}7171+5972/*6073 * Work out where the start offset maps into register numbers, bearing6174 * in mind that we suppress hidden registers.···10491 /* No cache entry? Start a new one */10592 if (!c) {10693 c = kzalloc(sizeof(*c), GFP_KERNEL);107107- if (!c)108108- break;9494+ if (!c) {9595+ regmap_debugfs_free_dump_cache(map);9696+ return base;9797+ }10998 c->min = p;11099 c->base_reg = i;111100 }···116101 }117102 }118103104104+ /* Close the last entry off if we didn't scan beyond it */105105+ if (c) {106106+ c->max = p - 1;107107+ list_add_tail(&c->list,108108+ &map->debugfs_off_cache);109109+ }110110+111111+ /*112112+ * This should never happen; we return above if we fail to113113+ * allocate and we should never be in this code if there are114114+ * no registers at all.115115+ */116116+ if (list_empty(&map->debugfs_off_cache)) {117117+ WARN_ON(list_empty(&map->debugfs_off_cache));118118+ return base;119119+ }120120+119121 /* Find the relevant block */120122 list_for_each_entry(c, &map->debugfs_off_cache, list) {121121- if (*pos >= c->min && *pos <= c->max) {123123+ if (from >= c->min && from <= c->max) {122124 *pos = c->min;123125 return c->base_reg;124126 }125127126126- ret = c->max;128128+ *pos = c->min;129129+ ret = c->base_reg;127130 }128131129132 return ret;···420387421388void regmap_debugfs_exit(struct regmap *map)422389{423423- struct regmap_debugfs_off_cache *c;424424-425390 debugfs_remove_recursive(map->debugfs);426426- while (!list_empty(&map->debugfs_off_cache)) {427427- c = list_first_entry(&map->debugfs_off_cache,428428- struct regmap_debugfs_off_cache,429429- list);430430- list_del(&c->list);431431- kfree(c);432432- }391391+ regmap_debugfs_free_dump_cache(map);433392 kfree(map->debugfs_name);434393}435394
+1-1
drivers/base/regmap/regmap.c
···11061106 * @val_count: Number of registers to write11071107 *11081108 * This function is intended to be used for writing a large block of11091109- * data to be device either in single transfer or multiple transfer.11091109+ * data to the device either in single transfer or multiple transfer.11101110 *11111111 * A value of zero will be returned on success, a negative errno will11121112 * be returned in error cases.
+6-1
drivers/block/virtio_blk.c
···889889{890890 struct virtio_blk *vblk = vdev->priv;891891 int index = vblk->index;892892+ int refc;892893893894 /* Prevent config work handler from accessing the device. */894895 mutex_lock(&vblk->config_lock);···904903905904 flush_work(&vblk->config_work);906905906906+ refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount);907907 put_disk(vblk->disk);908908 mempool_destroy(vblk->pool);909909 vdev->config->del_vqs(vdev);910910 kfree(vblk);911911- ida_simple_remove(&vd_index_ida, index);911911+912912+ /* Only free device id if we don't have any users */913913+ if (refc == 1)914914+ ida_simple_remove(&vd_index_ida, index);912915}913916914917#ifdef CONFIG_PM
···106106config X86_POWERNOW_K8107107 tristate "AMD Opteron/Athlon64 PowerNow!"108108 select CPU_FREQ_TABLE109109- depends on ACPI && ACPI_PROCESSOR109109+ depends on ACPI && ACPI_PROCESSOR && X86_ACPI_CPUFREQ110110 help111111 This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors.112112 Support for K10 and newer processors is now in acpi-cpufreq.
···7171 }72727373 if (cpu_reg) {7474+ rcu_read_lock();7475 opp = opp_find_freq_ceil(cpu_dev, &freq_Hz);7576 if (IS_ERR(opp)) {7777+ rcu_read_unlock();7678 pr_err("failed to find OPP for %ld\n", freq_Hz);7779 return PTR_ERR(opp);7880 }7981 volt = opp_get_voltage(opp);8282+ rcu_read_unlock();8083 tol = volt * voltage_tolerance / 100;8184 volt_old = regulator_get_voltage(cpu_reg);8285 }···239236 */240237 for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)241238 ;239239+ rcu_read_lock();242240 opp = opp_find_freq_exact(cpu_dev,243241 freq_table[0].frequency * 1000, true);244242 min_uV = opp_get_voltage(opp);245243 opp = opp_find_freq_exact(cpu_dev,246244 freq_table[i-1].frequency * 1000, true);247245 max_uV = opp_get_voltage(opp);246246+ rcu_read_unlock();248247 ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV);249248 if (ret > 0)250249 transition_latency += ret * 1000;
+3
drivers/cpufreq/omap-cpufreq.c
···110110 freq = ret;111111112112 if (mpu_reg) {113113+ rcu_read_lock();113114 opp = opp_find_freq_ceil(mpu_dev, &freq);114115 if (IS_ERR(opp)) {116116+ rcu_read_unlock();115117 dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n",116118 __func__, freqs.new);117119 return -EINVAL;118120 }119121 volt = opp_get_voltage(opp);122122+ rcu_read_unlock();120123 tol = volt * OPP_TOLERANCE / 100;121124 volt_old = regulator_get_voltage(mpu_reg);122125 }
+4-13
drivers/cpuidle/cpuidle.c
···6969{7070 struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);7171 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);7272- int i, dead_state = -1;7373- int power_usage = INT_MAX;7272+ int i;74737574 if (!drv)7675 return -ENODEV;77767877 /* Find lowest-power state that supports long-term idle */7979- for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {8080- struct cpuidle_state *s = &drv->states[i];8181-8282- if (s->power_usage < power_usage && s->enter_dead) {8383- power_usage = s->power_usage;8484- dead_state = i;8585- }8686- }8787-8888- if (dead_state != -1)8989- return drv->states[dead_state].enter_dead(dev, dead_state);7878+ for (i = drv->state_count - 1; i >= CPUIDLE_DRIVER_STATE_START; i--)7979+ if (drv->states[i].enter_dead)8080+ return drv->states[i].enter_dead(dev, i);90819182 return -ENODEV;9283}
-25
drivers/cpuidle/driver.c
···1919static void __cpuidle_set_cpu_driver(struct cpuidle_driver *drv, int cpu);2020static struct cpuidle_driver * __cpuidle_get_cpu_driver(int cpu);21212222-static void set_power_states(struct cpuidle_driver *drv)2323-{2424- int i;2525-2626- /*2727- * cpuidle driver should set the drv->power_specified bit2828- * before registering if the driver provides2929- * power_usage numbers.3030- *3131- * If power_specified is not set,3232- * we fill in power_usage with decreasing values as the3333- * cpuidle code has an implicit assumption that state Cn3434- * uses less power than C(n-1).3535- *3636- * With CONFIG_ARCH_HAS_CPU_RELAX, C0 is already assigned3737- * an power value of -1. So we use -2, -3, etc, for other3838- * c-states.3939- */4040- for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++)4141- drv->states[i].power_usage = -1 - i;4242-}4343-4422static void __cpuidle_driver_init(struct cpuidle_driver *drv)4523{4624 drv->refcnt = 0;4747-4848- if (!drv->power_specified)4949- set_power_states(drv);5025}51265227static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu)
+2-6
drivers/cpuidle/governors/menu.c
···312312{313313 struct menu_device *data = &__get_cpu_var(menu_devices);314314 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);315315- int power_usage = INT_MAX;316315 int i;317316 int multiplier;318317 struct timespec t;···382383 if (s->exit_latency * multiplier > data->predicted_us)383384 continue;384385385385- if (s->power_usage < power_usage) {386386- power_usage = s->power_usage;387387- data->last_state_idx = i;388388- data->exit_us = s->exit_latency;389389- }386386+ data->last_state_idx = i;387387+ data->exit_us = s->exit_latency;390388 }391389392390 /* not deepest C-state chosen for low predicted residency */
+1-1
drivers/cpuidle/sysfs.c
···374374 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);375375376376 /* state statistics */377377- for (i = 0; i < drv->state_count; i++) {377377+ for (i = 0; i < device->state_count; i++) {378378 kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL);379379 if (!kobj)380380 goto error_state;
+5
drivers/devfreq/devfreq.c
···994994 * @freq: The frequency given to target function995995 * @flags: Flags handed from devfreq framework.996996 *997997+ * Locking: This function must be called under rcu_read_lock(). opp is a rcu998998+ * protected pointer. The reason for the same is that the opp pointer which is999999+ * returned will remain valid for use with opp_get_{voltage, freq} only while10001000+ * under the locked area. The pointer returned must be used prior to unlocking10011001+ * with rcu_read_unlock() to maintain the integrity of the pointer.9971002 */9981003struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,9991004 u32 flags)
+67-27
drivers/devfreq/exynos4_bus.c
···7373#define EX4210_LV_NUM (LV_2 + 1)7474#define EX4x12_LV_NUM (LV_4 + 1)75757676+/**7777+ * struct busfreq_opp_info - opp information for bus7878+ * @rate: Frequency in hertz7979+ * @volt: Voltage in microvolts corresponding to this OPP8080+ */8181+struct busfreq_opp_info {8282+ unsigned long rate;8383+ unsigned long volt;8484+};8585+7686struct busfreq_data {7787 enum exynos4_busf_type type;7888 struct device *dev;···9080 bool disabled;9181 struct regulator *vdd_int;9282 struct regulator *vdd_mif; /* Exynos4412/4212 only */9393- struct opp *curr_opp;8383+ struct busfreq_opp_info curr_oppinfo;9484 struct exynos4_ppmu dmc[2];95859686 struct notifier_block pm_notifier;···306296};307297308298309309-static int exynos4210_set_busclk(struct busfreq_data *data, struct opp *opp)299299+static int exynos4210_set_busclk(struct busfreq_data *data,300300+ struct busfreq_opp_info *oppi)310301{311302 unsigned int index;312303 unsigned int tmp;313304314305 for (index = LV_0; index < EX4210_LV_NUM; index++)315315- if (opp_get_freq(opp) == exynos4210_busclk_table[index].clk)306306+ if (oppi->rate == exynos4210_busclk_table[index].clk)316307 break;317308318309 if (index == EX4210_LV_NUM)···372361 return 0;373362}374363375375-static int exynos4x12_set_busclk(struct busfreq_data *data, struct opp *opp)364364+static int exynos4x12_set_busclk(struct busfreq_data *data,365365+ struct busfreq_opp_info *oppi)376366{377367 unsigned int index;378368 unsigned int tmp;379369380370 for (index = LV_0; index < EX4x12_LV_NUM; index++)381381- if (opp_get_freq(opp) == exynos4x12_mifclk_table[index].clk)371371+ if (oppi->rate == exynos4x12_mifclk_table[index].clk)382372 break;383373384374 if (index == EX4x12_LV_NUM)···588576 return -EINVAL;589577}590578591591-static int exynos4_bus_setvolt(struct busfreq_data *data, struct opp *opp,592592- struct opp *oldopp)579579+static int exynos4_bus_setvolt(struct busfreq_data *data,580580+ struct busfreq_opp_info *oppi,581581+ struct busfreq_opp_info *oldoppi)593582{594583 int err = 0, tmp;595595- unsigned long volt = opp_get_voltage(opp);584584+ unsigned long volt = oppi->volt;596585597586 switch (data->type) {598587 case TYPE_BUSF_EXYNOS4210:···608595 if (err)609596 break;610597611611- tmp = exynos4x12_get_intspec(opp_get_freq(opp));598598+ tmp = exynos4x12_get_intspec(oppi->rate);612599 if (tmp < 0) {613600 err = tmp;614601 regulator_set_voltage(data->vdd_mif,615615- opp_get_voltage(oldopp),602602+ oldoppi->volt,616603 MAX_SAFEVOLT);617604 break;618605 }···622609 /* Try to recover */623610 if (err)624611 regulator_set_voltage(data->vdd_mif,625625- opp_get_voltage(oldopp),612612+ oldoppi->volt,626613 MAX_SAFEVOLT);627614 break;628615 default:···639626 struct platform_device *pdev = container_of(dev, struct platform_device,640627 dev);641628 struct busfreq_data *data = platform_get_drvdata(pdev);642642- struct opp *opp = devfreq_recommended_opp(dev, _freq, flags);643643- unsigned long freq = opp_get_freq(opp);644644- unsigned long old_freq = opp_get_freq(data->curr_opp);629629+ struct opp *opp;630630+ unsigned long freq;631631+ unsigned long old_freq = data->curr_oppinfo.rate;632632+ struct busfreq_opp_info new_oppinfo;645633646646- if (IS_ERR(opp))634634+ rcu_read_lock();635635+ opp = devfreq_recommended_opp(dev, _freq, flags);636636+ if (IS_ERR(opp)) {637637+ rcu_read_unlock();647638 return PTR_ERR(opp);639639+ }640640+ new_oppinfo.rate = opp_get_freq(opp);641641+ new_oppinfo.volt = opp_get_voltage(opp);642642+ rcu_read_unlock();643643+ freq = new_oppinfo.rate;648644649645 if (old_freq == freq)650646 return 0;651647652652- dev_dbg(dev, "targetting %lukHz %luuV\n", freq, opp_get_voltage(opp));648648+ dev_dbg(dev, "targetting %lukHz %luuV\n", freq, new_oppinfo.volt);653649654650 mutex_lock(&data->lock);655651···666644 goto out;667645668646 if (old_freq < freq)669669- err = exynos4_bus_setvolt(data, opp, data->curr_opp);647647+ err = exynos4_bus_setvolt(data, &new_oppinfo,648648+ &data->curr_oppinfo);670649 if (err)671650 goto out;672651673652 if (old_freq != freq) {674653 switch (data->type) {675654 case TYPE_BUSF_EXYNOS4210:676676- err = exynos4210_set_busclk(data, opp);655655+ err = exynos4210_set_busclk(data, &new_oppinfo);677656 break;678657 case TYPE_BUSF_EXYNOS4x12:679679- err = exynos4x12_set_busclk(data, opp);658658+ err = exynos4x12_set_busclk(data, &new_oppinfo);680659 break;681660 default:682661 err = -EINVAL;···687664 goto out;688665689666 if (old_freq > freq)690690- err = exynos4_bus_setvolt(data, opp, data->curr_opp);667667+ err = exynos4_bus_setvolt(data, &new_oppinfo,668668+ &data->curr_oppinfo);691669 if (err)692670 goto out;693671694694- data->curr_opp = opp;672672+ data->curr_oppinfo = new_oppinfo;695673out:696674 mutex_unlock(&data->lock);697675 return err;···726702727703 exynos4_read_ppmu(data);728704 busier_dmc = exynos4_get_busier_dmc(data);729729- stat->current_frequency = opp_get_freq(data->curr_opp);705705+ stat->current_frequency = data->curr_oppinfo.rate;730706731707 if (busier_dmc)732708 addr = S5P_VA_DMC1;···957933 struct busfreq_data *data = container_of(this, struct busfreq_data,958934 pm_notifier);959935 struct opp *opp;936936+ struct busfreq_opp_info new_oppinfo;960937 unsigned long maxfreq = ULONG_MAX;961938 int err = 0;962939···968943969944 data->disabled = true;970945946946+ rcu_read_lock();971947 opp = opp_find_freq_floor(data->dev, &maxfreq);948948+ if (IS_ERR(opp)) {949949+ rcu_read_unlock();950950+ dev_err(data->dev, "%s: unable to find a min freq\n",951951+ __func__);952952+ return PTR_ERR(opp);953953+ }954954+ new_oppinfo.rate = opp_get_freq(opp);955955+ new_oppinfo.volt = opp_get_voltage(opp);956956+ rcu_read_unlock();972957973973- err = exynos4_bus_setvolt(data, opp, data->curr_opp);958958+ err = exynos4_bus_setvolt(data, &new_oppinfo,959959+ &data->curr_oppinfo);974960 if (err)975961 goto unlock;976962977963 switch (data->type) {978964 case TYPE_BUSF_EXYNOS4210:979979- err = exynos4210_set_busclk(data, opp);965965+ err = exynos4210_set_busclk(data, &new_oppinfo);980966 break;981967 case TYPE_BUSF_EXYNOS4x12:982982- err = exynos4x12_set_busclk(data, opp);968968+ err = exynos4x12_set_busclk(data, &new_oppinfo);983969 break;984970 default:985971 err = -EINVAL;···998962 if (err)999963 goto unlock;100096410011001- data->curr_opp = opp;965965+ data->curr_oppinfo = new_oppinfo;1002966unlock:1003967 mutex_unlock(&data->lock);1004968 if (err)···10631027 }10641028 }1065102910301030+ rcu_read_lock();10661031 opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq);10671032 if (IS_ERR(opp)) {10331033+ rcu_read_unlock();10681034 dev_err(dev, "Invalid initial frequency %lu kHz.\n",10691035 exynos4_devfreq_profile.initial_freq);10701036 return PTR_ERR(opp);10711037 }10721072- data->curr_opp = opp;10381038+ data->curr_oppinfo.rate = opp_get_freq(opp);10391039+ data->curr_oppinfo.volt = opp_get_voltage(opp);10401040+ rcu_read_unlock();1073104110741042 platform_set_drvdata(pdev, data);10751043
···539539 total = 0;540540 for (i = 0; i < count; i++) {541541 struct drm_i915_gem_relocation_entry __user *user_relocs;542542+ u64 invalid_offset = (u64)-1;543543+ int j;542544543545 user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr;544546···549547 ret = -EFAULT;550548 mutex_lock(&dev->struct_mutex);551549 goto err;550550+ }551551+552552+ /* As we do not update the known relocation offsets after553553+ * relocating (due to the complexities in lock handling),554554+ * we need to mark them as invalid now so that we force the555555+ * relocation processing next time. Just in case the target556556+ * object is evicted and then rebound into its old557557+ * presumed_offset before the next execbuffer - if that558558+ * happened we would make the mistake of assuming that the559559+ * relocations were valid.560560+ */561561+ for (j = 0; j < exec[i].relocation_count; j++) {562562+ if (copy_to_user(&user_relocs[j].presumed_offset,563563+ &invalid_offset,564564+ sizeof(invalid_offset))) {565565+ ret = -EFAULT;566566+ mutex_lock(&dev->struct_mutex);567567+ goto err;568568+ }552569 }553570554571 reloc_offset[i] = total;
···512512#define GEN7_ERR_INT 0x44040513513#define ERR_INT_MMIO_UNCLAIMED (1<<13)514514515515+#define DERRMR 0x44050516516+515517/* GM45+ chicken bits -- debug workaround bits that may be required516518 * for various sorts of correct behavior. The top 16 bits of each are517519 * the enables for writing to the corresponding low bit.
+32-15
drivers/gpu/drm/i915/intel_dp.c
···2579257925802580static void25812581intel_dp_init_panel_power_sequencer(struct drm_device *dev,25822582- struct intel_dp *intel_dp)25822582+ struct intel_dp *intel_dp,25832583+ struct edp_power_seq *out)25832584{25842585 struct drm_i915_private *dev_priv = dev->dev_private;25852586 struct edp_power_seq cur, vbt, spec, final;···26512650 intel_dp->panel_power_cycle_delay = get_delay(t11_t12);26522651#undef get_delay2653265226532653+ DRM_DEBUG_KMS("panel power up delay %d, power down delay %d, power cycle delay %d\n",26542654+ intel_dp->panel_power_up_delay, intel_dp->panel_power_down_delay,26552655+ intel_dp->panel_power_cycle_delay);26562656+26572657+ DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n",26582658+ intel_dp->backlight_on_delay, intel_dp->backlight_off_delay);26592659+26602660+ if (out)26612661+ *out = final;26622662+}26632663+26642664+static void26652665+intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,26662666+ struct intel_dp *intel_dp,26672667+ struct edp_power_seq *seq)26682668+{26692669+ struct drm_i915_private *dev_priv = dev->dev_private;26702670+ u32 pp_on, pp_off, pp_div;26712671+26542672 /* And finally store the new values in the power sequencer. */26552655- pp_on = (final.t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) |26562656- (final.t8 << PANEL_LIGHT_ON_DELAY_SHIFT);26572657- pp_off = (final.t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) |26582658- (final.t10 << PANEL_POWER_DOWN_DELAY_SHIFT);26732673+ pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) |26742674+ (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT);26752675+ pp_off = (seq->t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) |26762676+ (seq->t10 << PANEL_POWER_DOWN_DELAY_SHIFT);26592677 /* Compute the divisor for the pp clock, simply match the Bspec26602678 * formula. */26612679 pp_div = ((100 * intel_pch_rawclk(dev))/2 - 1)26622680 << PP_REFERENCE_DIVIDER_SHIFT;26632663- pp_div |= (DIV_ROUND_UP(final.t11_t12, 1000)26812681+ pp_div |= (DIV_ROUND_UP(seq->t11_t12, 1000)26642682 << PANEL_POWER_CYCLE_DELAY_SHIFT);2665268326662684 /* Haswell doesn't have any port selection bits for the panel···26942674 I915_WRITE(PCH_PP_ON_DELAYS, pp_on);26952675 I915_WRITE(PCH_PP_OFF_DELAYS, pp_off);26962676 I915_WRITE(PCH_PP_DIVISOR, pp_div);26972697-26982698-26992699- DRM_DEBUG_KMS("panel power up delay %d, power down delay %d, power cycle delay %d\n",27002700- intel_dp->panel_power_up_delay, intel_dp->panel_power_down_delay,27012701- intel_dp->panel_power_cycle_delay);27022702-27032703- DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n",27042704- intel_dp->backlight_on_delay, intel_dp->backlight_off_delay);2705267727062678 DRM_DEBUG_KMS("panel power sequencer register settings: PP_ON %#x, PP_OFF %#x, PP_DIV %#x\n",27072679 I915_READ(PCH_PP_ON_DELAYS),···27112699 struct drm_device *dev = intel_encoder->base.dev;27122700 struct drm_i915_private *dev_priv = dev->dev_private;27132701 struct drm_display_mode *fixed_mode = NULL;27022702+ struct edp_power_seq power_seq = { 0 };27142703 enum port port = intel_dig_port->port;27152704 const char *name = NULL;27162705 int type;···27842771 }2785277227862773 if (is_edp(intel_dp))27872787- intel_dp_init_panel_power_sequencer(dev, intel_dp);27742774+ intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq);2788277527892776 intel_dp_i2c_init(intel_dp, intel_connector, name);27902777···28102797 intel_dp_destroy(connector);28112798 return;28122799 }28002800+28012801+ /* We now know it's not a ghost, init power sequence regs. */28022802+ intel_dp_init_panel_power_sequencer_registers(dev, intel_dp,28032803+ &power_seq);2813280428142805 ironlake_edp_panel_vdd_on(intel_dp);28152806 edid = drm_get_edid(connector, &intel_dp->adapter);
+12-5
drivers/gpu/drm/i915/intel_pm.c
···42504250static void __gen6_gt_force_wake_mt_reset(struct drm_i915_private *dev_priv)42514251{42524252 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(0xffff));42534253- POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */42534253+ /* something from same cacheline, but !FORCEWAKE_MT */42544254+ POSTING_READ(ECOBUS);42544255}4255425642564257static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv)···42684267 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");4269426842704269 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));42714271- POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */42704270+ /* something from same cacheline, but !FORCEWAKE_MT */42714271+ POSTING_READ(ECOBUS);4272427242734273 if (wait_for_atomic((I915_READ_NOTRACE(forcewake_ack) & 1),42744274 FORCEWAKE_ACK_TIMEOUT_MS))···43064304static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)43074305{43084306 I915_WRITE_NOTRACE(FORCEWAKE, 0);43094309- /* gen6_gt_check_fifodbg doubles as the POSTING_READ */43074307+ /* something from same cacheline, but !FORCEWAKE */43084308+ POSTING_READ(ECOBUS);43104309 gen6_gt_check_fifodbg(dev_priv);43114310}4312431143134312static void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv)43144313{43154314 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));43164316- /* gen6_gt_check_fifodbg doubles as the POSTING_READ */43154315+ /* something from same cacheline, but !FORCEWAKE_MT */43164316+ POSTING_READ(ECOBUS);43174317 gen6_gt_check_fifodbg(dev_priv);43184318}43194319···43554351static void vlv_force_wake_reset(struct drm_i915_private *dev_priv)43564352{43574353 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(0xffff));43544354+ /* something from same cacheline, but !FORCEWAKE_VLV */43554355+ POSTING_READ(FORCEWAKE_ACK_VLV);43584356}4359435743604358static void vlv_force_wake_get(struct drm_i915_private *dev_priv)···43774371static void vlv_force_wake_put(struct drm_i915_private *dev_priv)43784372{43794373 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));43804380- /* The below doubles as a POSTING_READ */43744374+ /* something from same cacheline, but !FORCEWAKE_VLV */43754375+ POSTING_READ(FORCEWAKE_ACK_VLV);43814376 gen6_gt_check_fifodbg(dev_priv);43824377}43834378
+6
drivers/gpu/drm/radeon/evergreen.c
···24012401{24022402 struct evergreen_mc_save save;2403240324042404+ if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))24052405+ reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE);24062406+24072407+ if (RREG32(DMA_STATUS_REG) & DMA_IDLE)24082408+ reset_mask &= ~RADEON_RESET_DMA;24092409+24042410 if (reset_mask == 0)24052411 return 0;24062412
+6
drivers/gpu/drm/radeon/ni.c
···14091409{14101410 struct evergreen_mc_save save;1411141114121412+ if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))14131413+ reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE);14141414+14151415+ if (RREG32(DMA_STATUS_REG) & DMA_IDLE)14161416+ reset_mask &= ~RADEON_RESET_DMA;14171417+14121418 if (reset_mask == 0)14131419 return 0;14141420
+6
drivers/gpu/drm/radeon/r600.c
···13781378{13791379 struct rv515_mc_save save;1380138013811381+ if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))13821382+ reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE);13831383+13841384+ if (RREG32(DMA_STATUS_REG) & DMA_IDLE)13851385+ reset_mask &= ~RADEON_RESET_DMA;13861386+13811387 if (reset_mask == 0)13821388 return 0;13831389
···784784 }785785 seq_printf(m, "driver's copy of the wptr: 0x%08x [%5d]\n", ring->wptr, ring->wptr);786786 seq_printf(m, "driver's copy of the rptr: 0x%08x [%5d]\n", ring->rptr, ring->rptr);787787+ seq_printf(m, "last semaphore signal addr : 0x%016llx\n", ring->last_semaphore_signal_addr);788788+ seq_printf(m, "last semaphore wait addr : 0x%016llx\n", ring->last_semaphore_wait_addr);787789 seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw);788790 seq_printf(m, "%u dwords in ring\n", count);789791 /* print 8 dw before current rptr as often it's the last executed
+4
drivers/gpu/drm/radeon/radeon_semaphore.c
···9595 /* we assume caller has already allocated space on waiters ring */9696 radeon_semaphore_emit_wait(rdev, waiter, semaphore);97979898+ /* for debugging lockup only, used by sysfs debug files */9999+ rdev->ring[signaler].last_semaphore_signal_addr = semaphore->gpu_addr;100100+ rdev->ring[waiter].last_semaphore_wait_addr = semaphore->gpu_addr;101101+98102 return 0;99103}100104
···344344345345 if (ttm->state == tt_unpopulated) {346346 ret = ttm->bdev->driver->ttm_tt_populate(ttm);347347- if (ret)347347+ if (ret) {348348+ /* if we fail here don't nuke the mm node349349+ * as the bo still owns it */350350+ old_copy.mm_node = NULL;348351 goto out1;352352+ }349353 }350354351355 add = 0;···375371 prot);376372 } else377373 ret = ttm_copy_io_page(new_iomap, old_iomap, page);378378- if (ret)374374+ if (ret) {375375+ /* failing here, means keep old copy as-is */376376+ old_copy.mm_node = NULL;379377 goto out1;378378+ }380379 }381380 mb();382381out2:
+21-14
drivers/hv/hv_balloon.c
···403403 */404404405405struct dm_info_msg {406406- struct dm_info_header header;406406+ struct dm_header hdr;407407 __u32 reserved;408408 __u32 info_size;409409 __u8 info[];···503503504504static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg)505505{506506- switch (msg->header.type) {506506+ struct dm_info_header *info_hdr;507507+508508+ info_hdr = (struct dm_info_header *)msg->info;509509+510510+ switch (info_hdr->type) {507511 case INFO_TYPE_MAX_PAGE_CNT:508512 pr_info("Received INFO_TYPE_MAX_PAGE_CNT\n");509509- pr_info("Data Size is %d\n", msg->header.data_size);513513+ pr_info("Data Size is %d\n", info_hdr->data_size);510514 break;511515 default:512512- pr_info("Received Unknown type: %d\n", msg->header.type);516516+ pr_info("Received Unknown type: %d\n", info_hdr->type);513517 }514518}515519···883879 balloon_onchannelcallback, dev);884880885881 if (ret)886886- return ret;882882+ goto probe_error0;887883888884 dm_device.dev = dev;889885 dm_device.state = DM_INITIALIZING;···895891 kthread_run(dm_thread_func, &dm_device, "hv_balloon");896892 if (IS_ERR(dm_device.thread)) {897893 ret = PTR_ERR(dm_device.thread);898898- goto probe_error0;894894+ goto probe_error1;899895 }900896901897 hv_set_drvdata(dev, &dm_device);···918914 VM_PKT_DATA_INBAND,919915 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);920916 if (ret)921921- goto probe_error1;917917+ goto probe_error2;922918923919 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);924920 if (t == 0) {925921 ret = -ETIMEDOUT;926926- goto probe_error1;922922+ goto probe_error2;927923 }928924929925 /*···932928 */933929 if (dm_device.state == DM_INIT_ERROR) {934930 ret = -ETIMEDOUT;935935- goto probe_error1;931931+ goto probe_error2;936932 }937933 /*938934 * Now submit our capabilities to the host.···965961 VM_PKT_DATA_INBAND,966962 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);967963 if (ret)968968- goto probe_error1;964964+ goto probe_error2;969965970966 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);971967 if (t == 0) {972968 ret = -ETIMEDOUT;973973- goto probe_error1;969969+ goto probe_error2;974970 }975971976972 /*···979975 */980976 if (dm_device.state == DM_INIT_ERROR) {981977 ret = -ETIMEDOUT;982982- goto probe_error1;978978+ goto probe_error2;983979 }984980985981 dm_device.state = DM_INITIALIZED;986982987983 return 0;988984989989-probe_error1:985985+probe_error2:990986 kthread_stop(dm_device.thread);991987992992-probe_error0:988988+probe_error1:993989 vmbus_close(dev->channel);990990+probe_error0:991991+ kfree(send_buffer);994992 return ret;995993}996994···100599910061000 vmbus_close(dev->channel);10071001 kthread_stop(dm->thread);10021002+ kfree(send_buffer);1008100310091004 return 0;10101005}
···975975}976976977977/*978978+ * Family15h Model 10h-1fh erratum 746 (IOMMU Logging May Stall Translations)979979+ * Workaround:980980+ * BIOS should disable L2B micellaneous clock gating by setting981981+ * L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b982982+ */983983+static void __init amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)984984+{985985+ u32 value;986986+987987+ if ((boot_cpu_data.x86 != 0x15) ||988988+ (boot_cpu_data.x86_model < 0x10) ||989989+ (boot_cpu_data.x86_model > 0x1f))990990+ return;991991+992992+ pci_write_config_dword(iommu->dev, 0xf0, 0x90);993993+ pci_read_config_dword(iommu->dev, 0xf4, &value);994994+995995+ if (value & BIT(2))996996+ return;997997+998998+ /* Select NB indirect register 0x90 and enable writing */999999+ pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8));10001000+10011001+ pci_write_config_dword(iommu->dev, 0xf4, value | 0x4);10021002+ pr_info("AMD-Vi: Applying erratum 746 workaround for IOMMU at %s\n",10031003+ dev_name(&iommu->dev->dev));10041004+10051005+ /* Clear the enable writing bit */10061006+ pci_write_config_dword(iommu->dev, 0xf0, 0x90);10071007+}10081008+10091009+/*9781010 * This function clues the initialization function for one IOMMU9791011 * together and also allocates the command buffer and programs the9801012 * hardware. It does NOT enable the IOMMU. This is done afterwards.···12031171 for (i = 0; i < 0x83; i++)12041172 iommu->stored_l2[i] = iommu_read_l2(iommu, i);12051173 }11741174+11751175+ amd_iommu_erratum_746_workaround(iommu);1206117612071177 return pci_enable_device(iommu->dev);12081178}
+2
drivers/isdn/gigaset/capi.c
···248248 CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l,249249 CAPIMSG_CONTROL(data));250250 l -= 12;251251+ if (l <= 0)252252+ return;251253 dbgline = kmalloc(3 * l, GFP_ATOMIC);252254 if (!dbgline)253255 return;
+37-64
drivers/md/dm-raid.c
···340340}341341342342/*343343- * validate_rebuild_devices343343+ * validate_raid_redundancy344344 * @rs345345 *346346- * Determine if the devices specified for rebuild can result in a valid347347- * usable array that is capable of rebuilding the given devices.346346+ * Determine if there are enough devices in the array that haven't347347+ * failed (or are being rebuilt) to form a usable array.348348 *349349 * Returns: 0 on success, -EINVAL on failure.350350 */351351-static int validate_rebuild_devices(struct raid_set *rs)351351+static int validate_raid_redundancy(struct raid_set *rs)352352{353353 unsigned i, rebuild_cnt = 0;354354 unsigned rebuilds_per_group, copies, d;355355356356- if (!(rs->print_flags & DMPF_REBUILD))357357- return 0;358358-359356 for (i = 0; i < rs->md.raid_disks; i++)360360- if (!test_bit(In_sync, &rs->dev[i].rdev.flags))357357+ if (!test_bit(In_sync, &rs->dev[i].rdev.flags) ||358358+ !rs->dev[i].rdev.sb_page)361359 rebuild_cnt++;362360363361 switch (rs->raid_type->level) {···391393 * A A B B C392394 * C D D E E393395 */394394- rebuilds_per_group = 0;395396 for (i = 0; i < rs->md.raid_disks * copies; i++) {397397+ if (!(i % copies))398398+ rebuilds_per_group = 0;396399 d = i % rs->md.raid_disks;397397- if (!test_bit(In_sync, &rs->dev[d].rdev.flags) &&400400+ if ((!rs->dev[d].rdev.sb_page ||401401+ !test_bit(In_sync, &rs->dev[d].rdev.flags)) &&398402 (++rebuilds_per_group >= copies))399403 goto too_many;400400- if (!((i + 1) % copies))401401- rebuilds_per_group = 0;402404 }403405 break;404406 default:405405- DMERR("The rebuild parameter is not supported for %s",406406- rs->raid_type->name);407407- rs->ti->error = "Rebuild not supported for this RAID type";408408- return -EINVAL;407407+ if (rebuild_cnt)408408+ return -EINVAL;409409 }410410411411 return 0;412412413413too_many:414414- rs->ti->error = "Too many rebuild devices specified";415414 return -EINVAL;416415}417416···658663 return -EINVAL;659664 }660665 rs->md.dev_sectors = sectors_per_dev;661661-662662- if (validate_rebuild_devices(rs))663663- return -EINVAL;664666665667 /* Assume there are no metadata devices until the drives are parsed */666668 rs->md.persistent = 0;···987995static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)988996{989997 int ret;990990- unsigned redundancy = 0;991998 struct raid_dev *dev;992999 struct md_rdev *rdev, *tmp, *freshest;9931000 struct mddev *mddev = &rs->md;994994-995995- switch (rs->raid_type->level) {996996- case 1:997997- redundancy = rs->md.raid_disks - 1;998998- break;999999- case 4:10001000- case 5:10011001- case 6:10021002- redundancy = rs->raid_type->parity_devs;10031003- break;10041004- case 10:10051005- redundancy = raid10_md_layout_to_copies(mddev->layout) - 1;10061006- break;10071007- default:10081008- ti->error = "Unknown RAID type";10091009- return -EINVAL;10101010- }1011100110121002 freshest = NULL;10131003 rdev_for_each_safe(rdev, tmp, mddev) {···10191045 break;10201046 default:10211047 dev = container_of(rdev, struct raid_dev, rdev);10221022- if (redundancy--) {10231023- if (dev->meta_dev)10241024- dm_put_device(ti, dev->meta_dev);10481048+ if (dev->meta_dev)10491049+ dm_put_device(ti, dev->meta_dev);1025105010261026- dev->meta_dev = NULL;10271027- rdev->meta_bdev = NULL;10511051+ dev->meta_dev = NULL;10521052+ rdev->meta_bdev = NULL;1028105310291029- if (rdev->sb_page)10301030- put_page(rdev->sb_page);10541054+ if (rdev->sb_page)10551055+ put_page(rdev->sb_page);1031105610321032- rdev->sb_page = NULL;10571057+ rdev->sb_page = NULL;1033105810341034- rdev->sb_loaded = 0;10591059+ rdev->sb_loaded = 0;1035106010361036- /*10371037- * We might be able to salvage the data device10381038- * even though the meta device has failed. For10391039- * now, we behave as though '- -' had been10401040- * set for this device in the table.10411041- */10421042- if (dev->data_dev)10431043- dm_put_device(ti, dev->data_dev);10611061+ /*10621062+ * We might be able to salvage the data device10631063+ * even though the meta device has failed. For10641064+ * now, we behave as though '- -' had been10651065+ * set for this device in the table.10661066+ */10671067+ if (dev->data_dev)10681068+ dm_put_device(ti, dev->data_dev);1044106910451045- dev->data_dev = NULL;10461046- rdev->bdev = NULL;10701070+ dev->data_dev = NULL;10711071+ rdev->bdev = NULL;1047107210481048- list_del(&rdev->same_set);10491049-10501050- continue;10511051- }10521052- ti->error = "Failed to load superblock";10531053- return ret;10731073+ list_del(&rdev->same_set);10541074 }10551075 }1056107610571077 if (!freshest)10581078 return 0;10791079+10801080+ if (validate_raid_redundancy(rs)) {10811081+ rs->ti->error = "Insufficient redundancy to activate array";10821082+ return -EINVAL;10831083+ }1059108410601085 /*10611086 * Validation of the freshest device provides the source of···1405143214061433static struct target_type raid_target = {14071434 .name = "raid",14081408- .version = {1, 4, 0},14351435+ .version = {1, 4, 1},14091436 .module = THIS_MODULE,14101437 .ctr = raid_ctr,14111438 .dtr = raid_dtr,
+1-1
drivers/media/i2c/m5mols/m5mols_core.c
···556556 mutex_lock(&info->lock);557557558558 format = __find_format(info, fh, fmt->which, info->res_type);559559- if (!format)559559+ if (format)560560 fmt->format = *format;561561 else562562 ret = -EINVAL;
···593593{594594 struct media_entity *source, *sink;595595 unsigned int flags = MEDIA_LNK_FL_ENABLED;596596- int i, ret;596596+ int i, ret = 0;597597598598 for (i = 0; i < FIMC_LITE_MAX_DEVS; i++) {599599 struct fimc_lite *fimc = fmd->fimc_lite[i];
+37-51
drivers/media/platform/s5p-mfc/s5p_mfc.c
···412412}413413414414/* Error handling for interrupt */415415-static void s5p_mfc_handle_error(struct s5p_mfc_ctx *ctx,416416- unsigned int reason, unsigned int err)415415+static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev,416416+ struct s5p_mfc_ctx *ctx, unsigned int reason, unsigned int err)417417{418418- struct s5p_mfc_dev *dev;419418 unsigned long flags;420419421421- /* If no context is available then all necessary422422- * processing has been done. */423423- if (ctx == NULL)424424- return;425425-426426- dev = ctx->dev;427420 mfc_err("Interrupt Error: %08x\n", err);428428- s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);429429- wake_up_dev(dev, reason, err);430421431431- /* Error recovery is dependent on the state of context */432432- switch (ctx->state) {433433- case MFCINST_INIT:434434- /* This error had to happen while acquireing instance */435435- case MFCINST_GOT_INST:436436- /* This error had to happen while parsing the header */437437- case MFCINST_HEAD_PARSED:438438- /* This error had to happen while setting dst buffers */439439- case MFCINST_RETURN_INST:440440- /* This error had to happen while releasing instance */441441- clear_work_bit(ctx);442442- wake_up_ctx(ctx, reason, err);443443- if (test_and_clear_bit(0, &dev->hw_lock) == 0)444444- BUG();445445- s5p_mfc_clock_off();446446- ctx->state = MFCINST_ERROR;447447- break;448448- case MFCINST_FINISHING:449449- case MFCINST_FINISHED:450450- case MFCINST_RUNNING:451451- /* It is higly probable that an error occured452452- * while decoding a frame */453453- clear_work_bit(ctx);454454- ctx->state = MFCINST_ERROR;455455- /* Mark all dst buffers as having an error */456456- spin_lock_irqsave(&dev->irqlock, flags);457457- s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->dst_queue,458458- &ctx->vq_dst);459459- /* Mark all src buffers as having an error */460460- s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->src_queue,461461- &ctx->vq_src);462462- spin_unlock_irqrestore(&dev->irqlock, flags);463463- if (test_and_clear_bit(0, &dev->hw_lock) == 0)464464- BUG();465465- s5p_mfc_clock_off();466466- break;467467- default:468468- mfc_err("Encountered an error interrupt which had not been handled\n");469469- break;422422+ if (ctx != NULL) {423423+ /* Error recovery is dependent on the state of context */424424+ switch (ctx->state) {425425+ case MFCINST_RES_CHANGE_INIT:426426+ case MFCINST_RES_CHANGE_FLUSH:427427+ case MFCINST_RES_CHANGE_END:428428+ case MFCINST_FINISHING:429429+ case MFCINST_FINISHED:430430+ case MFCINST_RUNNING:431431+ /* It is higly probable that an error occured432432+ * while decoding a frame */433433+ clear_work_bit(ctx);434434+ ctx->state = MFCINST_ERROR;435435+ /* Mark all dst buffers as having an error */436436+ spin_lock_irqsave(&dev->irqlock, flags);437437+ s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue,438438+ &ctx->dst_queue, &ctx->vq_dst);439439+ /* Mark all src buffers as having an error */440440+ s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue,441441+ &ctx->src_queue, &ctx->vq_src);442442+ spin_unlock_irqrestore(&dev->irqlock, flags);443443+ wake_up_ctx(ctx, reason, err);444444+ break;445445+ default:446446+ clear_work_bit(ctx);447447+ ctx->state = MFCINST_ERROR;448448+ wake_up_ctx(ctx, reason, err);449449+ break;450450+ }470451 }452452+ if (test_and_clear_bit(0, &dev->hw_lock) == 0)453453+ BUG();454454+ s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);455455+ s5p_mfc_clock_off();456456+ wake_up_dev(dev, reason, err);471457 return;472458}473459···618632 dev->warn_start)619633 s5p_mfc_handle_frame(ctx, reason, err);620634 else621621- s5p_mfc_handle_error(ctx, reason, err);635635+ s5p_mfc_handle_error(dev, ctx, reason, err);622636 clear_bit(0, &dev->enter_suspend);623637 break;624638
···921921 * In videobuf we use our internal V4l2_planes struct for922922 * single-planar buffers as well, for simplicity.923923 */924924- if (V4L2_TYPE_IS_OUTPUT(b->type))924924+ if (V4L2_TYPE_IS_OUTPUT(b->type)) {925925 v4l2_planes[0].bytesused = b->bytesused;926926+ v4l2_planes[0].data_offset = 0;927927+ }926928927929 if (b->memory == V4L2_MEMORY_USERPTR) {928930 v4l2_planes[0].m.userptr = b->m.userptr;
+2
drivers/mfd/Kconfig
···237237 depends on I2C=y && GPIOLIB238238 select MFD_CORE239239 select REGMAP_I2C240240+ select REGMAP_IRQ240241 select IRQ_DOMAIN241242 help242243 if you say yes here you get support for the TPS65910 series of···293292 bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support"294293 depends on I2C=y && GENERIC_HARDIRQS295294 select IRQ_DOMAIN295295+ select REGMAP_I2C296296 help297297 Say yes here if you have TWL4030 / TWL6030 family chip on your board.298298 This core driver provides register access and IRQ handling
···2727#include <linux/of_device.h>2828#endif29293030+/* I2C safe register check */3131+static inline bool i2c_safe_reg(unsigned char reg)3232+{3333+ switch (reg) {3434+ case DA9052_STATUS_A_REG:3535+ case DA9052_STATUS_B_REG:3636+ case DA9052_STATUS_C_REG:3737+ case DA9052_STATUS_D_REG:3838+ case DA9052_ADC_RES_L_REG:3939+ case DA9052_ADC_RES_H_REG:4040+ case DA9052_VDD_RES_REG:4141+ case DA9052_ICHG_AV_REG:4242+ case DA9052_TBAT_RES_REG:4343+ case DA9052_ADCIN4_RES_REG:4444+ case DA9052_ADCIN5_RES_REG:4545+ case DA9052_ADCIN6_RES_REG:4646+ case DA9052_TJUNC_RES_REG:4747+ case DA9052_TSI_X_MSB_REG:4848+ case DA9052_TSI_Y_MSB_REG:4949+ case DA9052_TSI_LSB_REG:5050+ case DA9052_TSI_Z_MSB_REG:5151+ return true;5252+ default:5353+ return false;5454+ }5555+}5656+5757+/*5858+ * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC5959+ * gets lockup up or fails to respond following a system reset.6060+ * This fix is to follow any read or write with a dummy read to a safe6161+ * register.6262+ */6363+int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)6464+{6565+ int val;6666+6767+ switch (da9052->chip_id) {6868+ case DA9052:6969+ case DA9053_AA:7070+ case DA9053_BA:7171+ case DA9053_BB:7272+ /* A dummy read to a safe register address. */7373+ if (!i2c_safe_reg(reg))7474+ return regmap_read(da9052->regmap,7575+ DA9052_PARK_REGISTER,7676+ &val);7777+ break;7878+ default:7979+ /*8080+ * For other chips parking of I2C register8181+ * to a safe place is not required.8282+ */8383+ break;8484+ }8585+8686+ return 0;8787+}8888+EXPORT_SYMBOL(da9052_i2c_fix);8989+3090static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)3191{3292 int reg_val, ret;···1438314484 da9052->dev = &client->dev;14585 da9052->chip_irq = client->irq;8686+ da9052->fix_io = da9052_i2c_fix;1468714788 i2c_set_clientdata(client, da9052);14889
+9-4
drivers/mfd/db8500-prcmu.c
···2524252425252525 for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) {25262526 if (ev & prcmu_irq_bit[n])25272527- generic_handle_irq(IRQ_PRCMU_BASE + n);25272527+ generic_handle_irq(irq_find_mapping(db8500_irq_domain, n));25282528 }25292529 r = true;25302530 break;···27372737}2738273827392739static struct irq_domain_ops db8500_irq_ops = {27402740- .map = db8500_irq_map,27412741- .xlate = irq_domain_xlate_twocell,27402740+ .map = db8500_irq_map,27412741+ .xlate = irq_domain_xlate_twocell,27422742};2743274327442744static int db8500_irq_init(struct device_node *np)27452745{27462746- int irq_base = -1;27462746+ int irq_base = 0;27472747+ int i;2747274827482749 /* In the device tree case, just take some IRQs */27492750 if (!np)···27582757 pr_err("Failed to create irqdomain\n");27592758 return -ENOSYS;27602759 }27602760+27612761+ /* All wakeups will be used, so create mappings for all */27622762+ for (i = 0; i < NUM_PRCMU_WAKEUPS; i++)27632763+ irq_create_mapping(db8500_irq_domain, i);2761276427622765 return 0;27632766}
+9-9
drivers/mfd/max77686.c
···9393 if (max77686 == NULL)9494 return -ENOMEM;95959696- max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config);9797- if (IS_ERR(max77686->regmap)) {9898- ret = PTR_ERR(max77686->regmap);9999- dev_err(max77686->dev, "Failed to allocate register map: %d\n",100100- ret);101101- kfree(max77686);102102- return ret;103103- }104104-10596 i2c_set_clientdata(i2c, max77686);10697 max77686->dev = &i2c->dev;10798 max77686->i2c = i2c;···101110 max77686->wakeup = pdata->wakeup;102111 max77686->irq_gpio = pdata->irq_gpio;103112 max77686->irq = i2c->irq;113113+114114+ max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config);115115+ if (IS_ERR(max77686->regmap)) {116116+ ret = PTR_ERR(max77686->regmap);117117+ dev_err(max77686->dev, "Failed to allocate register map: %d\n",118118+ ret);119119+ kfree(max77686);120120+ return ret;121121+ }104122105123 if (regmap_read(max77686->regmap,106124 MAX77686_REG_DEVICE_ID, &data) < 0) {
+18-16
drivers/mfd/max77693.c
···114114 u8 reg_data;115115 int ret = 0;116116117117+ if (!pdata) {118118+ dev_err(&i2c->dev, "No platform data found.\n");119119+ return -EINVAL;120120+ }121121+117122 max77693 = devm_kzalloc(&i2c->dev,118123 sizeof(struct max77693_dev), GFP_KERNEL);119124 if (max77693 == NULL)120125 return -ENOMEM;121121-122122- max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config);123123- if (IS_ERR(max77693->regmap)) {124124- ret = PTR_ERR(max77693->regmap);125125- dev_err(max77693->dev,"failed to allocate register map: %d\n",126126- ret);127127- goto err_regmap;128128- }129126130127 i2c_set_clientdata(i2c, max77693);131128 max77693->dev = &i2c->dev;···130133 max77693->irq = i2c->irq;131134 max77693->type = id->driver_data;132135133133- if (!pdata)134134- goto err_regmap;136136+ max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config);137137+ if (IS_ERR(max77693->regmap)) {138138+ ret = PTR_ERR(max77693->regmap);139139+ dev_err(max77693->dev, "failed to allocate register map: %d\n",140140+ ret);141141+ return ret;142142+ }135143136144 max77693->wakeup = pdata->wakeup;137145138138- if (max77693_read_reg(max77693->regmap,139139- MAX77693_PMIC_REG_PMIC_ID2, ®_data) < 0) {146146+ ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2,147147+ ®_data);148148+ if (ret < 0) {140149 dev_err(max77693->dev, "device not found on this channel\n");141141- ret = -ENODEV;142142- goto err_regmap;150150+ return ret;143151 } else144152 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data);145153···165163 ret = PTR_ERR(max77693->regmap_muic);166164 dev_err(max77693->dev,167165 "failed to allocate register map: %d\n", ret);168168- goto err_regmap;166166+ goto err_regmap_muic;169167 }170168171169 ret = max77693_irq_init(max77693);···186184err_mfd:187185 max77693_irq_exit(max77693);188186err_irq:187187+err_regmap_muic:189188 i2c_unregister_device(max77693->muic);190189 i2c_unregister_device(max77693->haptic);191191-err_regmap:192190 return ret;193191}194192
···159159static int twl4030_write_script(u8 address, struct twl4030_ins *script,160160 int len)161161{162162- int err;162162+ int err = -EINVAL;163163164164 for (; len; len--, address++, script++) {165165 if (len == 1) {
···548548 return -1;549549 }550550551551+ /* All frames should fit into a single buffer */552552+ if (!(status & RXDESC_FIRST_SEG) || !(status & RXDESC_LAST_SEG))553553+ return -1;554554+551555 /* Check if packet has checksum already */552556 if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) &&553557 !(ext_status & RXDESC_IP_PAYLOAD_MASK))
+13-2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
···19941994{19951995 const struct port_info *pi = netdev_priv(dev);19961996 struct adapter *adap = pi->adapter;19971997+ struct sge_rspq *q;19981998+ int i;19991999+ int r = 0;1997200019981998- return set_rxq_intr_params(adap, &adap->sge.ethrxq[pi->first_qset].rspq,19991999- c->rx_coalesce_usecs, c->rx_max_coalesced_frames);20012001+ for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) {20022002+ q = &adap->sge.ethrxq[i].rspq;20032003+ r = set_rxq_intr_params(adap, q, c->rx_coalesce_usecs,20042004+ c->rx_max_coalesced_frames);20052005+ if (r) {20062006+ dev_err(&dev->dev, "failed to set coalesce %d\n", r);20072007+ break;20082008+ }20092009+ }20102010+ return r;20002011}2001201220022013static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
+9-4
drivers/net/ethernet/mellanox/mlx4/en_tx.c
···640640 ring->tx_csum++;641641 }642642643643- /* Copy dst mac address to wqe */644644- ethh = (struct ethhdr *)skb->data;645645- tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest);646646- tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2));643643+ if (mlx4_is_mfunc(mdev->dev) || priv->validate_loopback) {644644+ /* Copy dst mac address to wqe. This allows loopback in eSwitch,645645+ * so that VFs and PF can communicate with each other646646+ */647647+ ethh = (struct ethhdr *)skb->data;648648+ tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest);649649+ tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2));650650+ }651651+647652 /* Handle LSO (TSO) packets */648653 if (lso_header_size) {649654 /* Mark opcode as LSO */
+2-9
drivers/net/ethernet/mellanox/mlx4/main.c
···17901790 int i;1791179117921792 if (msi_x) {17931793- /* In multifunction mode each function gets 2 msi-X vectors17941794- * one for data path completions anf the other for asynch events17951795- * or command completions */17961796- if (mlx4_is_mfunc(dev)) {17971797- nreq = 2;17981798- } else {17991799- nreq = min_t(int, dev->caps.num_eqs -18001800- dev->caps.reserved_eqs, nreq);18011801- }17931793+ nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,17941794+ nreq);1802179518031796 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);18041797 if (!entries)
···77777878 skb_orphan(skb);79798080+ /* Before queueing this packet to netif_rx(),8181+ * make sure dst is refcounted.8282+ */8383+ skb_dst_force(skb);8484+8085 skb->protocol = eth_type_trans(skb, dev);81868287 /* it's OK to use per_cpu_ptr() because BHs are off */
···109109 unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN];110110};111111112112-/* 1024 is probably a high enough limit: modern hypervisors seem to support on113113- * the order of 100-200 CPUs so this leaves us some breathing space if we want114114- * to match a queue per guest CPU.115115- */116116-#define MAX_TAP_QUEUES 1024112112+/* DEFAULT_MAX_NUM_RSS_QUEUES were choosed to let the rx/tx queues allocated for113113+ * the netdevice to be fit in one page. So we can make sure the success of114114+ * memory allocation. TODO: increase the limit. */115115+#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES116116+#define MAX_TAP_FLOWS 4096117117118118#define TUN_FLOW_EXPIRE (3 * HZ)119119···186186 unsigned int numdisabled;187187 struct list_head disabled;188188 void *security;189189+ u32 flow_count;189190};190191191192static inline u32 tun_hashfn(u32 rxhash)···220219 e->queue_index = queue_index;221220 e->tun = tun;222221 hlist_add_head_rcu(&e->hash_link, head);222222+ ++tun->flow_count;223223 }224224 return e;225225}···231229 e->rxhash, e->queue_index);232230 hlist_del_rcu(&e->hash_link);233231 kfree_rcu(e, rcu);232232+ --tun->flow_count;234233}235234236235static void tun_flow_flush(struct tun_struct *tun)···321318 e->updated = jiffies;322319 } else {323320 spin_lock_bh(&tun->lock);324324- if (!tun_flow_find(head, rxhash))321321+ if (!tun_flow_find(head, rxhash) &&322322+ tun->flow_count < MAX_TAP_FLOWS)325323 tun_flow_create(tun, head, rxhash, queue_index);326324327325 if (!timer_pending(&tun->flow_gc_timer))···15911587 else {15921588 char *name;15931589 unsigned long flags = 0;15901590+ int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?15911591+ MAX_TAP_QUEUES : 1;1594159215951593 if (!ns_capable(net->user_ns, CAP_NET_ADMIN))15961594 return -EPERM;···16161610 name = ifr->ifr_name;1617161116181612 dev = alloc_netdev_mqs(sizeof(struct tun_struct), name,16191619- tun_setup,16201620- MAX_TAP_QUEUES, MAX_TAP_QUEUES);16131613+ tun_setup, queues, queues);16141614+16211615 if (!dev)16221616 return -ENOMEM;16231617
+19
drivers/net/usb/cdc_mbim.c
···374374 .tx_fixup = cdc_mbim_tx_fixup,375375};376376377377+/* MBIM and NCM devices should not need a ZLP after NTBs with378378+ * dwNtbOutMaxSize length. This driver_info is for the exceptional379379+ * devices requiring it anyway, allowing them to be supported without380380+ * forcing the performance penalty on all the sane devices.381381+ */382382+static const struct driver_info cdc_mbim_info_zlp = {383383+ .description = "CDC MBIM",384384+ .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN | FLAG_SEND_ZLP,385385+ .bind = cdc_mbim_bind,386386+ .unbind = cdc_mbim_unbind,387387+ .manage_power = cdc_mbim_manage_power,388388+ .rx_fixup = cdc_mbim_rx_fixup,389389+ .tx_fixup = cdc_mbim_tx_fixup,390390+};391391+377392static const struct usb_device_id mbim_devs[] = {378393 /* This duplicate NCM entry is intentional. MBIM devices can379394 * be disguised as NCM by default, and this is necessary to···399384 */400385 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),401386 .driver_info = (unsigned long)&cdc_mbim_info,387387+ },388388+ /* Sierra Wireless MC7710 need ZLPs */389389+ { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68a2, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),390390+ .driver_info = (unsigned long)&cdc_mbim_info_zlp,402391 },403392 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),404393 .driver_info = (unsigned long)&cdc_mbim_info,
+30-1
drivers/net/usb/cdc_ncm.c
···435435 len -= temp;436436 }437437438438+ /* some buggy devices have an IAD but no CDC Union */439439+ if (!ctx->union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) {440440+ ctx->control = intf;441441+ ctx->data = usb_ifnum_to_if(dev->udev, intf->cur_altsetting->desc.bInterfaceNumber + 1);442442+ dev_dbg(&intf->dev, "CDC Union missing - got slave from IAD\n");443443+ }444444+438445 /* check if we got everything */439446 if ((ctx->control == NULL) || (ctx->data == NULL) ||440447 ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf))))···504497error2:505498 usb_set_intfdata(ctx->control, NULL);506499 usb_set_intfdata(ctx->data, NULL);507507- usb_driver_release_interface(driver, ctx->data);500500+ if (ctx->data != ctx->control)501501+ usb_driver_release_interface(driver, ctx->data);508502error:509503 cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]);510504 dev->data[0] = 0;···11631155 .tx_fixup = cdc_ncm_tx_fixup,11641156};1165115711581158+/* Same as wwan_info, but with FLAG_NOARP */11591159+static const struct driver_info wwan_noarp_info = {11601160+ .description = "Mobile Broadband Network Device (NO ARP)",11611161+ .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET11621162+ | FLAG_WWAN | FLAG_NOARP,11631163+ .bind = cdc_ncm_bind,11641164+ .unbind = cdc_ncm_unbind,11651165+ .check_connect = cdc_ncm_check_connect,11661166+ .manage_power = usbnet_manage_power,11671167+ .status = cdc_ncm_status,11681168+ .rx_fixup = cdc_ncm_rx_fixup,11691169+ .tx_fixup = cdc_ncm_tx_fixup,11701170+};11711171+11661172static const struct usb_device_id cdc_devs[] = {11671173 /* Ericsson MBM devices like F5521gw */11681174 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO···12141192 },12151193 { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46),12161194 .driver_info = (unsigned long)&wwan_info,11951195+ },11961196+11971197+ /* Infineon(now Intel) HSPA Modem platform */11981198+ { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443,11991199+ USB_CLASS_COMM,12001200+ USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),12011201+ .driver_info = (unsigned long)&wwan_noarp_info,12171202 },1218120312191204 /* Generic CDC-NCM devices */
···14481448 if ((dev->driver_info->flags & FLAG_WWAN) != 0)14491449 strcpy(net->name, "wwan%d");1450145014511451+ /* devices that cannot do ARP */14521452+ if ((dev->driver_info->flags & FLAG_NOARP) != 0)14531453+ net->flags |= IFF_NOARP;14541454+14511455 /* maybe the remote can't receive an Ethernet MTU */14521456 if (net->mtu > (dev->hard_mtu - net->hard_header_len))14531457 net->mtu = dev->hard_mtu - net->hard_header_len;
+98-20
drivers/net/virtio_net.c
···2626#include <linux/scatterlist.h>2727#include <linux/if_vlan.h>2828#include <linux/slab.h>2929+#include <linux/cpu.h>29303031static int napi_weight = 128;3132module_param(napi_weight, int, 0444);···124123125124 /* Does the affinity hint is set for virtqueues? */126125 bool affinity_hint_set;126126+127127+ /* Per-cpu variable to show the mapping from CPU to virtqueue */128128+ int __percpu *vq_index;129129+130130+ /* CPU hot plug notifier */131131+ struct notifier_block nb;127132};128133129134struct skb_vnet_hdr {···10371030 return 0;10381031}1039103210401040-static void virtnet_set_affinity(struct virtnet_info *vi, bool set)10331033+static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)10411034{10421035 int i;10361036+ int cpu;10371037+10381038+ if (vi->affinity_hint_set) {10391039+ for (i = 0; i < vi->max_queue_pairs; i++) {10401040+ virtqueue_set_affinity(vi->rq[i].vq, -1);10411041+ virtqueue_set_affinity(vi->sq[i].vq, -1);10421042+ }10431043+10441044+ vi->affinity_hint_set = false;10451045+ }10461046+10471047+ i = 0;10481048+ for_each_online_cpu(cpu) {10491049+ if (cpu == hcpu) {10501050+ *per_cpu_ptr(vi->vq_index, cpu) = -1;10511051+ } else {10521052+ *per_cpu_ptr(vi->vq_index, cpu) =10531053+ ++i % vi->curr_queue_pairs;10541054+ }10551055+ }10561056+}10571057+10581058+static void virtnet_set_affinity(struct virtnet_info *vi)10591059+{10601060+ int i;10611061+ int cpu;1043106210441063 /* In multiqueue mode, when the number of cpu is equal to the number of10451064 * queue pairs, we let the queue pairs to be private to one cpu by10461065 * setting the affinity hint to eliminate the contention.10471066 */10481048- if ((vi->curr_queue_pairs == 1 ||10491049- vi->max_queue_pairs != num_online_cpus()) && set) {10501050- if (vi->affinity_hint_set)10511051- set = false;10521052- else10531053- return;10671067+ if (vi->curr_queue_pairs == 1 ||10681068+ vi->max_queue_pairs != num_online_cpus()) {10691069+ virtnet_clean_affinity(vi, -1);10701070+ return;10541071 }1055107210561056- for (i = 0; i < vi->max_queue_pairs; i++) {10571057- int cpu = set ? i : -1;10731073+ i = 0;10741074+ for_each_online_cpu(cpu) {10581075 virtqueue_set_affinity(vi->rq[i].vq, cpu);10591076 virtqueue_set_affinity(vi->sq[i].vq, cpu);10771077+ *per_cpu_ptr(vi->vq_index, cpu) = i;10781078+ i++;10601079 }1061108010621062- if (set)10631063- vi->affinity_hint_set = true;10641064- else10651065- vi->affinity_hint_set = false;10811081+ vi->affinity_hint_set = true;10821082+}10831083+10841084+static int virtnet_cpu_callback(struct notifier_block *nfb,10851085+ unsigned long action, void *hcpu)10861086+{10871087+ struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb);10881088+10891089+ switch(action & ~CPU_TASKS_FROZEN) {10901090+ case CPU_ONLINE:10911091+ case CPU_DOWN_FAILED:10921092+ case CPU_DEAD:10931093+ virtnet_set_affinity(vi);10941094+ break;10951095+ case CPU_DOWN_PREPARE:10961096+ virtnet_clean_affinity(vi, (long)hcpu);10971097+ break;10981098+ default:10991099+ break;11001100+ }11011101+ return NOTIFY_OK;10661102}1067110310681104static void virtnet_get_ringparam(struct net_device *dev,···11491099 if (queue_pairs > vi->max_queue_pairs)11501100 return -EINVAL;1151110111021102+ get_online_cpus();11521103 err = virtnet_set_queues(vi, queue_pairs);11531104 if (!err) {11541105 netif_set_real_num_tx_queues(dev, queue_pairs);11551106 netif_set_real_num_rx_queues(dev, queue_pairs);1156110711571157- virtnet_set_affinity(vi, true);11081108+ virtnet_set_affinity(vi);11581109 }11101110+ put_online_cpus();1159111111601112 return err;11611113}···1196114411971145/* To avoid contending a lock hold by a vcpu who would exit to host, select the11981146 * txq based on the processor id.11991199- * TODO: handle cpu hotplug.12001147 */12011148static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb)12021149{12031203- int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) :12041204- smp_processor_id();11501150+ int txq;11511151+ struct virtnet_info *vi = netdev_priv(dev);11521152+11531153+ if (skb_rx_queue_recorded(skb)) {11541154+ txq = skb_get_rx_queue(skb);11551155+ } else {11561156+ txq = *__this_cpu_ptr(vi->vq_index);11571157+ if (txq == -1)11581158+ txq = 0;11591159+ }1205116012061161 while (unlikely(txq >= dev->real_num_tx_queues))12071162 txq -= dev->real_num_tx_queues;···13241265{13251266 struct virtio_device *vdev = vi->vdev;1326126713271327- virtnet_set_affinity(vi, false);12681268+ virtnet_clean_affinity(vi, -1);1328126913291270 vdev->config->del_vqs(vdev);13301271···14471388 if (ret)14481389 goto err_free;1449139014501450- virtnet_set_affinity(vi, true);13911391+ get_online_cpus();13921392+ virtnet_set_affinity(vi);13931393+ put_online_cpus();13941394+14511395 return 0;1452139614531397err_free:···15321470 if (vi->stats == NULL)15331471 goto free;1534147214731473+ vi->vq_index = alloc_percpu(int);14741474+ if (vi->vq_index == NULL)14751475+ goto free_stats;14761476+15351477 mutex_init(&vi->config_lock);15361478 vi->config_enable = true;15371479 INIT_WORK(&vi->config_work, virtnet_config_changed_work);···15591493 /* Allocate/initialize the rx/tx queues, and invoke find_vqs */15601494 err = init_vqs(vi);15611495 if (err)15621562- goto free_stats;14961496+ goto free_index;1563149715641498 netif_set_real_num_tx_queues(dev, 1);15651499 netif_set_real_num_rx_queues(dev, 1);···15801514 err = -ENOMEM;15811515 goto free_recv_bufs;15821516 }15171517+ }15181518+15191519+ vi->nb.notifier_call = &virtnet_cpu_callback;15201520+ err = register_hotcpu_notifier(&vi->nb);15211521+ if (err) {15221522+ pr_debug("virtio_net: registering cpu notifier failed\n");15231523+ goto free_recv_bufs;15831524 }1584152515851526 /* Assume link up if device can't report link status,···16101537free_vqs:16111538 cancel_delayed_work_sync(&vi->refill);16121539 virtnet_del_vqs(vi);15401540+free_index:15411541+ free_percpu(vi->vq_index);16131542free_stats:16141543 free_percpu(vi->stats);16151544free:···16351560{16361561 struct virtnet_info *vi = vdev->priv;1637156215631563+ unregister_hotcpu_notifier(&vi->nb);15641564+16381565 /* Prevent config work handler from accessing the device. */16391566 mutex_lock(&vi->config_lock);16401567 vi->config_enable = false;···1648157116491572 flush_work(&vi->config_work);1650157315741574+ free_percpu(vi->vq_index);16511575 free_percpu(vi->stats);16521576 free_netdev(vi->dev);16531577}
···771771{772772 struct pci_dev *child;773773774774+ if (aspm_force)775775+ return;776776+774777 /*775778 * Clear any ASPM setup that the firmware has carried out on this bus776779 */
+11-4
drivers/regulator/core.c
···18851885 struct regulator_dev *rdev = regulator->rdev;1886188618871887 if (rdev->constraints &&18881888- rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&18891889- (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)18901890- return 1;18881888+ (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {18891889+ if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)18901890+ return 1;18911891+18921892+ if (rdev->desc->continuous_voltage_range &&18931893+ rdev->constraints->min_uV && rdev->constraints->max_uV &&18941894+ rdev->constraints->min_uV != rdev->constraints->max_uV)18951895+ return 1;18961896+ }1891189718921898 return 0;18931899}···33213315 * @config: runtime configuration for regulator33223316 *33233317 * Called by regulator drivers to register a regulator.33243324- * Returns 0 on success.33183318+ * Returns a valid pointer to struct regulator_dev on success33193319+ * or an ERR_PTR() on error.33253320 */33263321struct regulator_dev *33273322regulator_register(const struct regulator_desc *regulator_desc,
···212212 struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, *l_tg_pt_gp_mem;213213 unsigned char *buf;214214 unsigned char *ptr;215215- sense_reason_t rc;215215+ sense_reason_t rc = TCM_NO_SENSE;216216 u32 len = 4; /* Skip over RESERVED area in header */217217 int alua_access_state, primary = 0;218218 u16 tg_pt_id, rtpi;
+1-1
drivers/target/target_core_pr.c
···20532053 /* Used for APTPL metadata w/ UNREGISTER */20542054 unsigned char *pr_aptpl_buf = NULL;20552055 unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL;20562056- sense_reason_t ret;20562056+ sense_reason_t ret = TCM_NO_SENSE;20572057 int pr_holder = 0, type;2058205820592059 if (!se_sess || !se_lun) {
+16-4
drivers/target/target_core_transport.c
···541541542542void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)543543{544544- if (!(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))545545- transport_lun_remove_cmd(cmd);546546-547544 if (transport_cmd_check_stop_to_fabric(cmd))548545 return;549546 if (remove)···1393139613941397 se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;13951398 se_cmd->se_tfo->queue_tm_rsp(se_cmd);13991399+14001400+ transport_cmd_check_stop_to_fabric(se_cmd);13961401}1397140213981403/**···16871688 }1688168916891690 cmd->t_state = TRANSPORT_PROCESSING;16911691+ cmd->transport_state |= CMD_T_ACTIVE;16901692 spin_unlock_irq(&cmd->t_state_lock);1691169316921694 if (!target_handle_task_attr(cmd))···25972597 * SENSE KEY values from include/scsi/scsi.h25982598 */25992599 switch (reason) {26002600+ case TCM_NO_SENSE:26012601+ /* CURRENT ERROR */26022602+ buffer[0] = 0x70;26032603+ buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;26042604+ /* Not Ready */26052605+ buffer[SPC_SENSE_KEY_OFFSET] = NOT_READY;26062606+ /* NO ADDITIONAL SENSE INFORMATION */26072607+ buffer[SPC_ASC_KEY_OFFSET] = 0;26082608+ buffer[SPC_ASCQ_KEY_OFFSET] = 0;26092609+ break;26002610 case TCM_NON_EXISTENT_LUN:26012611 /* CURRENT ERROR */26022612 buffer[0] = 0x70;···27532743 /* ILLEGAL REQUEST */27542744 buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;27552745 /* LOGICAL UNIT COMMUNICATION FAILURE */27562756- buffer[SPC_ASC_KEY_OFFSET] = 0x80;27462746+ buffer[SPC_ASC_KEY_OFFSET] = 0x08;27572747 break;27582748 }27592749 /*···28132803 }28142804 }28152805 cmd->scsi_status = SAM_STAT_TASK_ABORTED;28062806+28072807+ transport_lun_remove_cmd(cmd);2816280828172809 pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x,"28182810 " ITT: 0x%08x\n", cmd->t_task_cdb[0],
+9-3
drivers/target/tcm_fc/tfc_sess.c
···355355356356 tport = ft_tport_create(rdata->local_port);357357 if (!tport)358358- return 0; /* not a target for this local port */358358+ goto not_target; /* not a target for this local port */359359360360 acl = ft_acl_get(tport->tpg, rdata);361361 if (!acl)362362- return 0;362362+ goto not_target; /* no target for this remote */363363364364 if (!rspp)365365 goto fill;···396396397397 /*398398 * OR in our service parameters with other provider (initiator), if any.399399- * TBD XXX - indicate RETRY capability?400399 */401400fill:402401 fcp_parm = ntohl(spp->spp_params);402402+ fcp_parm &= ~FCP_SPPF_RETRY;403403 spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN);404404 return FC_SPP_RESP_ACK;405405+406406+not_target:407407+ fcp_parm = ntohl(spp->spp_params);408408+ fcp_parm &= ~FCP_SPPF_TARG_FCN;409409+ spp->spp_params = htonl(fcp_parm);410410+ return 0;405411}406412407413/**
+2
drivers/tty/pty.c
···441441 return pty_get_pktmode(tty, (int __user *)arg);442442 case TIOCSIG: /* Send signal to other side of pty */443443 return pty_signal(tty, (int) arg);444444+ case TIOCGPTN: /* TTY returns ENOTTY, but glibc expects EINVAL here */445445+ return -EINVAL;444446 }445447 return -ENOIOCTLCMD;446448}
···604604 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;605605606606 vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);607607- if (vt8500_port->clk) {607607+ if (!IS_ERR(vt8500_port->clk)) {608608 vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);609609 } else {610610 /* use the default of 24Mhz if not specified and warn */
···148148 Variation of ARC USB block used in some Freescale chips.149149150150config USB_EHCI_MXC151151- bool "Support for Freescale i.MX on-chip EHCI USB controller"151151+ tristate "Support for Freescale i.MX on-chip EHCI USB controller"152152 depends on USB_EHCI_HCD && ARCH_MXC153153 select USB_EHCI_ROOT_HUB_TT154154 ---help---
···3838#endif39394040/* statistics can be kept for tuning/monitoring */4141+#ifdef DEBUG4242+#define EHCI_STATS4343+#endif4444+4145struct ehci_stats {4246 /* irq usage */4347 unsigned long normal;···225221#ifdef DEBUG226222 struct dentry *debug_dir;227223#endif224224+225225+ /* platform-specific data -- must come last */226226+ unsigned long priv[0] __aligned(sizeof(s64));228227};229228230229/* convert between an HCD pointer and the corresponding EHCI_HCD */
+9-6
drivers/usb/host/uhci-hcd.c
···447447 return IRQ_NONE;448448 uhci_writew(uhci, status, USBSTS); /* Clear it */449449450450+ spin_lock(&uhci->lock);451451+ if (unlikely(!uhci->is_initialized)) /* not yet configured */452452+ goto done;453453+450454 if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) {451455 if (status & USBSTS_HSE)452456 dev_err(uhci_dev(uhci), "host system error, "···459455 dev_err(uhci_dev(uhci), "host controller process "460456 "error, something bad happened!\n");461457 if (status & USBSTS_HCH) {462462- spin_lock(&uhci->lock);463458 if (uhci->rh_state >= UHCI_RH_RUNNING) {464459 dev_err(uhci_dev(uhci),465460 "host controller halted, "···476473 * pending unlinks */477474 mod_timer(&hcd->rh_timer, jiffies);478475 }479479- spin_unlock(&uhci->lock);480476 }481477 }482478483483- if (status & USBSTS_RD)479479+ if (status & USBSTS_RD) {480480+ spin_unlock(&uhci->lock);484481 usb_hcd_poll_rh_status(hcd);485485- else {486486- spin_lock(&uhci->lock);482482+ } else {487483 uhci_scan_schedule(uhci);484484+ done:488485 spin_unlock(&uhci->lock);489486 }490487···665662 */666663 mb();667664665665+ spin_lock_irq(&uhci->lock);668666 configure_hc(uhci);669667 uhci->is_initialized = 1;670670- spin_lock_irq(&uhci->lock);671668 start_rh(uhci);672669 spin_unlock_irq(&uhci->lock);673670 return 0;
···2525static int vcpu_online(unsigned int cpu)2626{2727 int err;2828- char dir[32], state[32];2828+ char dir[16], state[16];29293030 sprintf(dir, "cpu/%u", cpu);3131- err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state);3131+ err = xenbus_scanf(XBT_NIL, dir, "availability", "%15s", state);3232 if (err != 1) {3333 if (!xen_initial_domain())3434 printk(KERN_ERR "XENBUS: Unable to read cpu state\n");
+88-42
drivers/xen/gntdev.c
···5656static atomic_t pages_mapped = ATOMIC_INIT(0);57575858static int use_ptemod;5959+#define populate_freeable_maps use_ptemod59606061struct gntdev_priv {6262+ /* maps with visible offsets in the file descriptor */6163 struct list_head maps;6262- /* lock protects maps from concurrent changes */6464+ /* maps that are not visible; will be freed on munmap.6565+ * Only populated if populate_freeable_maps == 1 */6666+ struct list_head freeable_maps;6767+ /* lock protects maps and freeable_maps */6368 spinlock_t lock;6469 struct mm_struct *mm;6570 struct mmu_notifier mn;···198193 return NULL;199194}200195201201-static void gntdev_put_map(struct grant_map *map)196196+static void gntdev_put_map(struct gntdev_priv *priv, struct grant_map *map)202197{203198 if (!map)204199 return;···211206 if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) {212207 notify_remote_via_evtchn(map->notify.event);213208 evtchn_put(map->notify.event);209209+ }210210+211211+ if (populate_freeable_maps && priv) {212212+ spin_lock(&priv->lock);213213+ list_del(&map->next);214214+ spin_unlock(&priv->lock);214215 }215216216217 if (map->pages && !use_ptemod)···312301313302 if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {314303 int pgno = (map->notify.addr >> PAGE_SHIFT);315315- if (pgno >= offset && pgno < offset + pages && use_ptemod) {316316- void __user *tmp = (void __user *)317317- map->vma->vm_start + map->notify.addr;318318- err = copy_to_user(tmp, &err, 1);319319- if (err)320320- return -EFAULT;321321- map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;322322- } else if (pgno >= offset && pgno < offset + pages) {323323- uint8_t *tmp = kmap(map->pages[pgno]);304304+ if (pgno >= offset && pgno < offset + pages) {305305+ /* No need for kmap, pages are in lowmem */306306+ uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno]));324307 tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;325325- kunmap(map->pages[pgno]);326308 map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;327309 }328310 }···380376static void gntdev_vma_close(struct vm_area_struct *vma)381377{382378 struct grant_map *map = vma->vm_private_data;379379+ struct file *file = vma->vm_file;380380+ struct gntdev_priv *priv = file->private_data;383381384382 pr_debug("gntdev_vma_close %p\n", vma);385385- map->vma = NULL;383383+ if (use_ptemod) {384384+ /* It is possible that an mmu notifier could be running385385+ * concurrently, so take priv->lock to ensure that the vma won't386386+ * vanishing during the unmap_grant_pages call, since we will387387+ * spin here until that completes. Such a concurrent call will388388+ * not do any unmapping, since that has been done prior to389389+ * closing the vma, but it may still iterate the unmap_ops list.390390+ */391391+ spin_lock(&priv->lock);392392+ map->vma = NULL;393393+ spin_unlock(&priv->lock);394394+ }386395 vma->vm_private_data = NULL;387387- gntdev_put_map(map);396396+ gntdev_put_map(priv, map);388397}389398390399static struct vm_operations_struct gntdev_vmops = {···407390408391/* ------------------------------------------------------------------ */409392393393+static void unmap_if_in_range(struct grant_map *map,394394+ unsigned long start, unsigned long end)395395+{396396+ unsigned long mstart, mend;397397+ int err;398398+399399+ if (!map->vma)400400+ return;401401+ if (map->vma->vm_start >= end)402402+ return;403403+ if (map->vma->vm_end <= start)404404+ return;405405+ mstart = max(start, map->vma->vm_start);406406+ mend = min(end, map->vma->vm_end);407407+ pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n",408408+ map->index, map->count,409409+ map->vma->vm_start, map->vma->vm_end,410410+ start, end, mstart, mend);411411+ err = unmap_grant_pages(map,412412+ (mstart - map->vma->vm_start) >> PAGE_SHIFT,413413+ (mend - mstart) >> PAGE_SHIFT);414414+ WARN_ON(err);415415+}416416+410417static void mn_invl_range_start(struct mmu_notifier *mn,411418 struct mm_struct *mm,412419 unsigned long start, unsigned long end)413420{414421 struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn);415422 struct grant_map *map;416416- unsigned long mstart, mend;417417- int err;418423419424 spin_lock(&priv->lock);420425 list_for_each_entry(map, &priv->maps, next) {421421- if (!map->vma)422422- continue;423423- if (map->vma->vm_start >= end)424424- continue;425425- if (map->vma->vm_end <= start)426426- continue;427427- mstart = max(start, map->vma->vm_start);428428- mend = min(end, map->vma->vm_end);429429- pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n",430430- map->index, map->count,431431- map->vma->vm_start, map->vma->vm_end,432432- start, end, mstart, mend);433433- err = unmap_grant_pages(map,434434- (mstart - map->vma->vm_start) >> PAGE_SHIFT,435435- (mend - mstart) >> PAGE_SHIFT);436436- WARN_ON(err);426426+ unmap_if_in_range(map, start, end);427427+ }428428+ list_for_each_entry(map, &priv->freeable_maps, next) {429429+ unmap_if_in_range(map, start, end);437430 }438431 spin_unlock(&priv->lock);439432}···464437465438 spin_lock(&priv->lock);466439 list_for_each_entry(map, &priv->maps, next) {440440+ if (!map->vma)441441+ continue;442442+ pr_debug("map %d+%d (%lx %lx)\n",443443+ map->index, map->count,444444+ map->vma->vm_start, map->vma->vm_end);445445+ err = unmap_grant_pages(map, /* offset */ 0, map->count);446446+ WARN_ON(err);447447+ }448448+ list_for_each_entry(map, &priv->freeable_maps, next) {467449 if (!map->vma)468450 continue;469451 pr_debug("map %d+%d (%lx %lx)\n",···502466 return -ENOMEM;503467504468 INIT_LIST_HEAD(&priv->maps);469469+ INIT_LIST_HEAD(&priv->freeable_maps);505470 spin_lock_init(&priv->lock);506471507472 if (use_ptemod) {···537500 while (!list_empty(&priv->maps)) {538501 map = list_entry(priv->maps.next, struct grant_map, next);539502 list_del(&map->next);540540- gntdev_put_map(map);503503+ gntdev_put_map(NULL /* already removed */, map);541504 }505505+ WARN_ON(!list_empty(&priv->freeable_maps));542506543507 if (use_ptemod)544508 mmu_notifier_unregister(&priv->mn, priv->mm);···567529568530 if (unlikely(atomic_add_return(op.count, &pages_mapped) > limit)) {569531 pr_debug("can't map: over limit\n");570570- gntdev_put_map(map);532532+ gntdev_put_map(NULL, map);571533 return err;572534 }573535574536 if (copy_from_user(map->grants, &u->refs,575537 sizeof(map->grants[0]) * op.count) != 0) {576576- gntdev_put_map(map);577577- return err;538538+ gntdev_put_map(NULL, map);539539+ return -EFAULT;578540 }579541580542 spin_lock(&priv->lock);···603565 map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT, op.count);604566 if (map) {605567 list_del(&map->next);568568+ if (populate_freeable_maps)569569+ list_add_tail(&map->next, &priv->freeable_maps);606570 err = 0;607571 }608572 spin_unlock(&priv->lock);609573 if (map)610610- gntdev_put_map(map);574574+ gntdev_put_map(priv, map);611575 return err;612576}613577···619579 struct ioctl_gntdev_get_offset_for_vaddr op;620580 struct vm_area_struct *vma;621581 struct grant_map *map;582582+ int rv = -EINVAL;622583623584 if (copy_from_user(&op, u, sizeof(op)) != 0)624585 return -EFAULT;625586 pr_debug("priv %p, offset for vaddr %lx\n", priv, (unsigned long)op.vaddr);626587588588+ down_read(¤t->mm->mmap_sem);627589 vma = find_vma(current->mm, op.vaddr);628590 if (!vma || vma->vm_ops != &gntdev_vmops)629629- return -EINVAL;591591+ goto out_unlock;630592631593 map = vma->vm_private_data;632594 if (!map)633633- return -EINVAL;595595+ goto out_unlock;634596635597 op.offset = map->index << PAGE_SHIFT;636598 op.count = map->count;599599+ rv = 0;637600638638- if (copy_to_user(u, &op, sizeof(op)) != 0)601601+ out_unlock:602602+ up_read(¤t->mm->mmap_sem);603603+604604+ if (rv == 0 && copy_to_user(u, &op, sizeof(op)) != 0)639605 return -EFAULT;640640- return 0;606606+ return rv;641607}642608643609static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u)···824778out_put_map:825779 if (use_ptemod)826780 map->vma = NULL;827827- gntdev_put_map(map);781781+ gntdev_put_map(priv, map);828782 return err;829783}830784
+30-20
drivers/xen/grant-table.c
···5656/* External tools reserve first few grant table entries. */5757#define NR_RESERVED_ENTRIES 85858#define GNTTAB_LIST_END 0xffffffff5959-#define GREFS_PER_GRANT_FRAME \6060-(grant_table_version == 1 ? \6161-(PAGE_SIZE / sizeof(struct grant_entry_v1)) : \6262-(PAGE_SIZE / sizeof(union grant_entry_v2)))63596460static grant_ref_t **gnttab_list;6561static unsigned int nr_grant_frames;···150154static grant_status_t *grstatus;151155152156static int grant_table_version;157157+static int grefs_per_grant_frame;153158154159static struct gnttab_free_callback *gnttab_free_callback_list;155160···764767 unsigned int new_nr_grant_frames, extra_entries, i;765768 unsigned int nr_glist_frames, new_nr_glist_frames;766769767767- new_nr_grant_frames = nr_grant_frames + more_frames;768768- extra_entries = more_frames * GREFS_PER_GRANT_FRAME;770770+ BUG_ON(grefs_per_grant_frame == 0);769771770770- nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;772772+ new_nr_grant_frames = nr_grant_frames + more_frames;773773+ extra_entries = more_frames * grefs_per_grant_frame;774774+775775+ nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;771776 new_nr_glist_frames =772772- (new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;777777+ (new_nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;773778 for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {774779 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);775780 if (!gnttab_list[i])···779780 }780781781782782782- for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames;783783- i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++)783783+ for (i = grefs_per_grant_frame * nr_grant_frames;784784+ i < grefs_per_grant_frame * new_nr_grant_frames - 1; i++)784785 gnttab_entry(i) = i + 1;785786786787 gnttab_entry(i) = gnttab_free_head;787787- gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames;788788+ gnttab_free_head = grefs_per_grant_frame * nr_grant_frames;788789 gnttab_free_count += extra_entries;789790790791 nr_grant_frames = new_nr_grant_frames;···956957957958static unsigned nr_status_frames(unsigned nr_grant_frames)958959{959959- return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP;960960+ BUG_ON(grefs_per_grant_frame == 0);961961+ return (nr_grant_frames * grefs_per_grant_frame + SPP - 1) / SPP;960962}961963962964static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes)···11151115 rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);11161116 if (rc == 0 && gsv.version == 2) {11171117 grant_table_version = 2;11181118+ grefs_per_grant_frame = PAGE_SIZE / sizeof(union grant_entry_v2);11181119 gnttab_interface = &gnttab_v2_ops;11191120 } else if (grant_table_version == 2) {11201121 /*···11281127 panic("we need grant tables version 2, but only version 1 is available");11291128 } else {11301129 grant_table_version = 1;11301130+ grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1);11311131 gnttab_interface = &gnttab_v1_ops;11321132 }11331133 printk(KERN_INFO "Grant tables using version %d layout.\n",11341134 grant_table_version);11351135}1136113611371137-int gnttab_resume(void)11371137+static int gnttab_setup(void)11381138{11391139 unsigned int max_nr_gframes;1140114011411141- gnttab_request_version();11421141 max_nr_gframes = gnttab_max_grant_frames();11431142 if (max_nr_gframes < nr_grant_frames)11441143 return -ENOSYS;···11611160 return 0;11621161}1163116211631163+int gnttab_resume(void)11641164+{11651165+ gnttab_request_version();11661166+ return gnttab_setup();11671167+}11681168+11641169int gnttab_suspend(void)11651170{11661171 gnttab_interface->unmap_frames();···11781171 int rc;11791172 unsigned int cur, extra;1180117311741174+ BUG_ON(grefs_per_grant_frame == 0);11811175 cur = nr_grant_frames;11821182- extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) /11831183- GREFS_PER_GRANT_FRAME);11761176+ extra = ((req_entries + (grefs_per_grant_frame-1)) /11771177+ grefs_per_grant_frame);11841178 if (cur + extra > gnttab_max_grant_frames())11851179 return -ENOSPC;11861180···11991191 unsigned int nr_init_grefs;12001192 int ret;1201119311941194+ gnttab_request_version();12021195 nr_grant_frames = 1;12031196 boot_max_nr_grant_frames = __max_nr_grant_frames();1204119712051198 /* Determine the maximum number of frames required for the12061199 * grant reference free list on the current hypervisor.12071200 */12011201+ BUG_ON(grefs_per_grant_frame == 0);12081202 max_nr_glist_frames = (boot_max_nr_grant_frames *12091209- GREFS_PER_GRANT_FRAME / RPP);12031203+ grefs_per_grant_frame / RPP);1210120412111205 gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),12121206 GFP_KERNEL);12131207 if (gnttab_list == NULL)12141208 return -ENOMEM;1215120912161216- nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;12101210+ nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;12171211 for (i = 0; i < nr_glist_frames; i++) {12181212 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);12191213 if (gnttab_list[i] == NULL) {···12241214 }12251215 }1226121612271227- if (gnttab_resume() < 0) {12171217+ if (gnttab_setup() < 0) {12281218 ret = -ENODEV;12291219 goto ini_nomem;12301220 }1231122112321232- nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME;12221222+ nr_init_grefs = nr_grant_frames * grefs_per_grant_frame;1233122312341224 for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++)12351225 gnttab_entry(i) = i + 1;
+47-42
drivers/xen/privcmd.c
···199199 LIST_HEAD(pagelist);200200 struct mmap_mfn_state state;201201202202- if (!xen_initial_domain())203203- return -EPERM;204204-205202 /* We only support privcmd_ioctl_mmap_batch for auto translated. */206203 if (xen_feature(XENFEAT_auto_translated_physmap))207204 return -ENOSYS;···258261 * -ENOENT if at least 1 -ENOENT has happened.259262 */260263 int global_error;261261- /* An array for individual errors */262262- int *err;264264+ int version;263265264266 /* User-space mfn array to store errors in the second pass for V1. */265267 xen_pfn_t __user *user_mfn;268268+ /* User-space int array to store errors in the second pass for V2. */269269+ int __user *user_err;266270};267271268272/* auto translated dom0 note: if domU being created is PV, then mfn is···286288 &cur_page);287289288290 /* Store error code for second pass. */289289- *(st->err++) = ret;291291+ if (st->version == 1) {292292+ if (ret < 0) {293293+ /*294294+ * V1 encodes the error codes in the 32bit top nibble of the295295+ * mfn (with its known limitations vis-a-vis 64 bit callers).296296+ */297297+ *mfnp |= (ret == -ENOENT) ?298298+ PRIVCMD_MMAPBATCH_PAGED_ERROR :299299+ PRIVCMD_MMAPBATCH_MFN_ERROR;300300+ }301301+ } else { /* st->version == 2 */302302+ *((int *) mfnp) = ret;303303+ }290304291305 /* And see if it affects the global_error. */292306 if (ret < 0) {···315305 return 0;316306}317307318318-static int mmap_return_errors_v1(void *data, void *state)308308+static int mmap_return_errors(void *data, void *state)319309{320320- xen_pfn_t *mfnp = data;321310 struct mmap_batch_state *st = state;322322- int err = *(st->err++);323311324324- /*325325- * V1 encodes the error codes in the 32bit top nibble of the326326- * mfn (with its known limitations vis-a-vis 64 bit callers).327327- */328328- *mfnp |= (err == -ENOENT) ?329329- PRIVCMD_MMAPBATCH_PAGED_ERROR :330330- PRIVCMD_MMAPBATCH_MFN_ERROR;331331- return __put_user(*mfnp, st->user_mfn++);312312+ if (st->version == 1) {313313+ xen_pfn_t mfnp = *((xen_pfn_t *) data);314314+ if (mfnp & PRIVCMD_MMAPBATCH_MFN_ERROR)315315+ return __put_user(mfnp, st->user_mfn++);316316+ else317317+ st->user_mfn++;318318+ } else { /* st->version == 2 */319319+ int err = *((int *) data);320320+ if (err)321321+ return __put_user(err, st->user_err++);322322+ else323323+ st->user_err++;324324+ }325325+326326+ return 0;332327}333328334329/* Allocate pfns that are then mapped with gmfns from foreign domid. Update···372357 struct vm_area_struct *vma;373358 unsigned long nr_pages;374359 LIST_HEAD(pagelist);375375- int *err_array = NULL;376360 struct mmap_batch_state state;377377-378378- if (!xen_initial_domain())379379- return -EPERM;380361381362 switch (version) {382363 case 1:···407396 goto out;408397 }409398410410- err_array = kcalloc(m.num, sizeof(int), GFP_KERNEL);411411- if (err_array == NULL) {412412- ret = -ENOMEM;413413- goto out;399399+ if (version == 2) {400400+ /* Zero error array now to only copy back actual errors. */401401+ if (clear_user(m.err, sizeof(int) * m.num)) {402402+ ret = -EFAULT;403403+ goto out;404404+ }414405 }415406416407 down_write(&mm->mmap_sem);···440427 state.va = m.addr;441428 state.index = 0;442429 state.global_error = 0;443443- state.err = err_array;430430+ state.version = version;444431445432 /* mmap_batch_fn guarantees ret == 0 */446433 BUG_ON(traverse_pages(m.num, sizeof(xen_pfn_t),···448435449436 up_write(&mm->mmap_sem);450437451451- if (version == 1) {452452- if (state.global_error) {453453- /* Write back errors in second pass. */454454- state.user_mfn = (xen_pfn_t *)m.arr;455455- state.err = err_array;456456- ret = traverse_pages(m.num, sizeof(xen_pfn_t),457457- &pagelist, mmap_return_errors_v1, &state);458458- } else459459- ret = 0;460460-461461- } else if (version == 2) {462462- ret = __copy_to_user(m.err, err_array, m.num * sizeof(int));463463- if (ret)464464- ret = -EFAULT;465465- }438438+ if (state.global_error) {439439+ /* Write back errors in second pass. */440440+ state.user_mfn = (xen_pfn_t *)m.arr;441441+ state.user_err = m.err;442442+ ret = traverse_pages(m.num, sizeof(xen_pfn_t),443443+ &pagelist, mmap_return_errors, &state);444444+ } else445445+ ret = 0;466446467447 /* If we have not had any EFAULT-like global errors then set the global468448 * error to -ENOENT if necessary. */···463457 ret = -ENOENT;464458465459out:466466- kfree(err_array);467460 free_page_list(&pagelist);468461469462 return ret;
+1-1
drivers/xen/xen-pciback/pciback.h
···124124static inline void xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev,125125 struct pci_dev *dev)126126{127127- if (xen_pcibk_backend && xen_pcibk_backend->free)127127+ if (xen_pcibk_backend && xen_pcibk_backend->release)128128 return xen_pcibk_backend->release(pdev, dev);129129}130130
-10
fs/Kconfig
···6868source "fs/autofs4/Kconfig"6969source "fs/fuse/Kconfig"70707171-config CUSE7272- tristate "Character device in Userspace support"7373- depends on FUSE_FS7474- help7575- This FUSE extension allows character devices to be7676- implemented in userspace.7777-7878- If you want to develop or use userspace character device7979- based on CUSE, answer Y or M.8080-8171config GENERIC_ACL8272 bool8373 select FS_POSIX_ACL
+4-2
fs/btrfs/extent-tree.c
···39973997 * We make the other tasks wait for the flush only when we can flush39983998 * all things.39993999 */40004000- if (ret && flush == BTRFS_RESERVE_FLUSH_ALL) {40004000+ if (ret && flush != BTRFS_RESERVE_NO_FLUSH) {40014001 flushing = true;40024002 space_info->flush = 1;40034003 }···55605560 int empty_cluster = 2 * 1024 * 1024;55615561 struct btrfs_space_info *space_info;55625562 int loop = 0;55635563- int index = 0;55635563+ int index = __get_raid_index(data);55645564 int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ?55655565 RESERVE_ALLOC_NO_ACCOUNT : RESERVE_ALLOC;55665566 bool found_uncached_bg = false;···67886788 &wc->flags[level]);67896789 if (ret < 0) {67906790 btrfs_tree_unlock_rw(eb, path->locks[level]);67916791+ path->locks[level] = 0;67916792 return ret;67926793 }67936794 BUG_ON(wc->refs[level] == 0);67946795 if (wc->refs[level] == 1) {67956796 btrfs_tree_unlock_rw(eb, path->locks[level]);67976797+ path->locks[level] = 0;67966798 return 1;67976799 }67986800 }
···18621862{18631863 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;18641864 struct btrfs_free_space *info;18651865- int ret = 0;18651865+ int ret;18661866+ bool re_search = false;1866186718671868 spin_lock(&ctl->tree_lock);1868186918691870again:18711871+ ret = 0;18701872 if (!bytes)18711873 goto out_lock;18721874···18811879 info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset),18821880 1, 0);18831881 if (!info) {18841884- /* the tree logging code might be calling us before we18851885- * have fully loaded the free space rbtree for this18861886- * block group. So it is possible the entry won't18871887- * be in the rbtree yet at all. The caching code18881888- * will make sure not to put it in the rbtree if18891889- * the logging code has pinned it.18821882+ /*18831883+ * If we found a partial bit of our free space in a18841884+ * bitmap but then couldn't find the other part this may18851885+ * be a problem, so WARN about it.18901886 */18871887+ WARN_ON(re_search);18911888 goto out_lock;18921889 }18931890 }1894189118921892+ re_search = false;18951893 if (!info->bitmap) {18961894 unlink_free_space(ctl, info);18971895 if (offset == info->offset) {···19371935 }1938193619391937 ret = remove_from_bitmap(ctl, info, &offset, &bytes);19401940- if (ret == -EAGAIN)19381938+ if (ret == -EAGAIN) {19391939+ re_search = true;19411940 goto again;19411941+ }19421942 BUG_ON(ret); /* logic error */19431943out_lock:19441944 spin_unlock(&ctl->tree_lock);
+102-35
fs/btrfs/inode.c
···8888 [S_IFLNK >> S_SHIFT] = BTRFS_FT_SYMLINK,8989};90909191-static int btrfs_setsize(struct inode *inode, loff_t newsize);9191+static int btrfs_setsize(struct inode *inode, struct iattr *attr);9292static int btrfs_truncate(struct inode *inode);9393static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent);9494static noinline int cow_file_range(struct inode *inode,···24782478 continue;24792479 }24802480 nr_truncate++;24812481+24822482+ /* 1 for the orphan item deletion. */24832483+ trans = btrfs_start_transaction(root, 1);24842484+ if (IS_ERR(trans)) {24852485+ ret = PTR_ERR(trans);24862486+ goto out;24872487+ }24882488+ ret = btrfs_orphan_add(trans, inode);24892489+ btrfs_end_transaction(trans, root);24902490+ if (ret)24912491+ goto out;24922492+24812493 ret = btrfs_truncate(inode);24822494 } else {24832495 nr_unlink++;···36773665 block_end - cur_offset, 0);36783666 if (IS_ERR(em)) {36793667 err = PTR_ERR(em);36683668+ em = NULL;36803669 break;36813670 }36823671 last_byte = min(extent_map_end(em), block_end);···37613748 return err;37623749}3763375037643764-static int btrfs_setsize(struct inode *inode, loff_t newsize)37513751+static int btrfs_setsize(struct inode *inode, struct iattr *attr)37653752{37663753 struct btrfs_root *root = BTRFS_I(inode)->root;37673754 struct btrfs_trans_handle *trans;37683755 loff_t oldsize = i_size_read(inode);37563756+ loff_t newsize = attr->ia_size;37573757+ int mask = attr->ia_valid;37693758 int ret;3770375937713760 if (newsize == oldsize)37723761 return 0;37623762+37633763+ /*37643764+ * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a37653765+ * special case where we need to update the times despite not having37663766+ * these flags set. For all other operations the VFS set these flags37673767+ * explicitly if it wants a timestamp update.37683768+ */37693769+ if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME))))37703770+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);3773377137743772 if (newsize > oldsize) {37753773 truncate_pagecache(inode, oldsize, newsize);···38073783 set_bit(BTRFS_INODE_ORDERED_DATA_CLOSE,38083784 &BTRFS_I(inode)->runtime_flags);3809378537863786+ /*37873787+ * 1 for the orphan item we're going to add37883788+ * 1 for the orphan item deletion.37893789+ */37903790+ trans = btrfs_start_transaction(root, 2);37913791+ if (IS_ERR(trans))37923792+ return PTR_ERR(trans);37933793+37943794+ /*37953795+ * We need to do this in case we fail at _any_ point during the37963796+ * actual truncate. Once we do the truncate_setsize we could37973797+ * invalidate pages which forces any outstanding ordered io to37983798+ * be instantly completed which will give us extents that need37993799+ * to be truncated. If we fail to get an orphan inode down we38003800+ * could have left over extents that were never meant to live,38013801+ * so we need to garuntee from this point on that everything38023802+ * will be consistent.38033803+ */38043804+ ret = btrfs_orphan_add(trans, inode);38053805+ btrfs_end_transaction(trans, root);38063806+ if (ret)38073807+ return ret;38083808+38103809 /* we don't support swapfiles, so vmtruncate shouldn't fail */38113810 truncate_setsize(inode, newsize);38123811 ret = btrfs_truncate(inode);38123812+ if (ret && inode->i_nlink)38133813+ btrfs_orphan_del(NULL, inode);38133814 }3814381538153816 return ret;···38543805 return err;3855380638563807 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) {38573857- err = btrfs_setsize(inode, attr->ia_size);38083808+ err = btrfs_setsize(inode, attr);38583809 if (err)38593810 return err;38603811 }···56215572 return em;56225573 if (em) {56235574 /*56245624- * if our em maps to a hole, there might56255625- * actually be delalloc bytes behind it55755575+ * if our em maps to55765576+ * - a hole or55775577+ * - a pre-alloc extent,55785578+ * there might actually be delalloc bytes behind it.56265579 */56275627- if (em->block_start != EXTENT_MAP_HOLE)55805580+ if (em->block_start != EXTENT_MAP_HOLE &&55815581+ !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))56285582 return em;56295583 else56305584 hole_em = em;···57095657 */57105658 em->block_start = hole_em->block_start;57115659 em->block_len = hole_len;56605660+ if (test_bit(EXTENT_FLAG_PREALLOC, &hole_em->flags))56615661+ set_bit(EXTENT_FLAG_PREALLOC, &em->flags);57125662 } else {57135663 em->start = range_start;57145664 em->len = found;···6969691569706916 /*69716917 * 1 for the truncate slack space69726972- * 1 for the orphan item we're going to add69736973- * 1 for the orphan item deletion69746918 * 1 for updating the inode.69756919 */69766976- trans = btrfs_start_transaction(root, 4);69206920+ trans = btrfs_start_transaction(root, 2);69776921 if (IS_ERR(trans)) {69786922 err = PTR_ERR(trans);69796923 goto out;···69816929 ret = btrfs_block_rsv_migrate(&root->fs_info->trans_block_rsv, rsv,69826930 min_size);69836931 BUG_ON(ret);69846984-69856985- ret = btrfs_orphan_add(trans, inode);69866986- if (ret) {69876987- btrfs_end_transaction(trans, root);69886988- goto out;69896989- }6990693269916933 /*69926934 * setattr is responsible for setting the ordered_data_close flag,···70507004 ret = btrfs_orphan_del(trans, inode);70517005 if (ret)70527006 err = ret;70537053- } else if (ret && inode->i_nlink > 0) {70547054- /*70557055- * Failed to do the truncate, remove us from the in memory70567056- * orphan list.70577057- */70587058- ret = btrfs_orphan_del(NULL, inode);70597007 }7060700870617009 if (trans) {···75717531 */75727532int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput)75737533{75747574- struct list_head *head = &root->fs_info->delalloc_inodes;75757534 struct btrfs_inode *binode;75767535 struct inode *inode;75777536 struct btrfs_delalloc_work *work, *next;75787537 struct list_head works;75387538+ struct list_head splice;75797539 int ret = 0;7580754075817541 if (root->fs_info->sb->s_flags & MS_RDONLY)75827542 return -EROFS;7583754375847544 INIT_LIST_HEAD(&works);75857585-75457545+ INIT_LIST_HEAD(&splice);75467546+again:75867547 spin_lock(&root->fs_info->delalloc_lock);75877587- while (!list_empty(head)) {75887588- binode = list_entry(head->next, struct btrfs_inode,75487548+ list_splice_init(&root->fs_info->delalloc_inodes, &splice);75497549+ while (!list_empty(&splice)) {75507550+ binode = list_entry(splice.next, struct btrfs_inode,75897551 delalloc_inodes);75527552+75537553+ list_del_init(&binode->delalloc_inodes);75547554+75907555 inode = igrab(&binode->vfs_inode);75917556 if (!inode)75927592- list_del_init(&binode->delalloc_inodes);75577557+ continue;75587558+75597559+ list_add_tail(&binode->delalloc_inodes,75607560+ &root->fs_info->delalloc_inodes);75937561 spin_unlock(&root->fs_info->delalloc_lock);75947594- if (inode) {75957595- work = btrfs_alloc_delalloc_work(inode, 0, delay_iput);75967596- if (!work) {75977597- ret = -ENOMEM;75987598- goto out;75997599- }76007600- list_add_tail(&work->list, &works);76017601- btrfs_queue_worker(&root->fs_info->flush_workers,76027602- &work->work);75627562+75637563+ work = btrfs_alloc_delalloc_work(inode, 0, delay_iput);75647564+ if (unlikely(!work)) {75657565+ ret = -ENOMEM;75667566+ goto out;76037567 }75687568+ list_add_tail(&work->list, &works);75697569+ btrfs_queue_worker(&root->fs_info->flush_workers,75707570+ &work->work);75717571+76047572 cond_resched();76057573 spin_lock(&root->fs_info->delalloc_lock);75747574+ }75757575+ spin_unlock(&root->fs_info->delalloc_lock);75767576+75777577+ list_for_each_entry_safe(work, next, &works, list) {75787578+ list_del_init(&work->list);75797579+ btrfs_wait_and_free_delalloc_work(work);75807580+ }75817581+75827582+ spin_lock(&root->fs_info->delalloc_lock);75837583+ if (!list_empty(&root->fs_info->delalloc_inodes)) {75847584+ spin_unlock(&root->fs_info->delalloc_lock);75857585+ goto again;76067586 }76077587 spin_unlock(&root->fs_info->delalloc_lock);76087588···76387578 atomic_read(&root->fs_info->async_delalloc_pages) == 0));76397579 }76407580 atomic_dec(&root->fs_info->async_submit_draining);75817581+ return 0;76417582out:76427583 list_for_each_entry_safe(work, next, &works, list) {76437584 list_del_init(&work->list);76447585 btrfs_wait_and_free_delalloc_work(work);75867586+ }75877587+75887588+ if (!list_empty_careful(&splice)) {75897589+ spin_lock(&root->fs_info->delalloc_lock);75907590+ list_splice_tail(&splice, &root->fs_info->delalloc_inodes);75917591+ spin_unlock(&root->fs_info->delalloc_lock);76457592 }76467593 return ret;76477594}
+94-35
fs/btrfs/ioctl.c
···13391339 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,13401340 1)) {13411341 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");13421342- return -EINPROGRESS;13421342+ mnt_drop_write_file(file);13431343+ return -EINVAL;13431344 }1344134513451346 mutex_lock(&root->fs_info->volume_mutex);···13631362 printk(KERN_INFO "btrfs: resizing devid %llu\n",13641363 (unsigned long long)devid);13651364 }13651365+13661366 device = btrfs_find_device(root->fs_info, devid, NULL, NULL);13671367 if (!device) {13681368 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",···13711369 ret = -EINVAL;13721370 goto out_free;13731371 }13741374- if (device->fs_devices && device->fs_devices->seeding) {13721372+13731373+ if (!device->writeable) {13751374 printk(KERN_INFO "btrfs: resizer unable to apply on "13761376- "seeding device %llu\n",13751375+ "readonly device %llu\n",13771376 (unsigned long long)devid);13781377 ret = -EINVAL;13791378 goto out_free;···14461443 kfree(vol_args);14471444out:14481445 mutex_unlock(&root->fs_info->volume_mutex);14491449- mnt_drop_write_file(file);14501446 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);14471447+ mnt_drop_write_file(file);14511448 return ret;14521449}14531450···20982095 err = inode_permission(inode, MAY_WRITE | MAY_EXEC);20992096 if (err)21002097 goto out_dput;21012101-21022102- /* check if subvolume may be deleted by a non-root user */21032103- err = btrfs_may_delete(dir, dentry, 1);21042104- if (err)21052105- goto out_dput;21062098 }20992099+21002100+ /* check if subvolume may be deleted by a user */21012101+ err = btrfs_may_delete(dir, dentry, 1);21022102+ if (err)21032103+ goto out_dput;2107210421082105 if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) {21092106 err = -EINVAL;···21862183 struct btrfs_ioctl_defrag_range_args *range;21872184 int ret;2188218521892189- if (btrfs_root_readonly(root))21902190- return -EROFS;21862186+ ret = mnt_want_write_file(file);21872187+ if (ret)21882188+ return ret;2191218921922190 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,21932191 1)) {21942192 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");21952195- return -EINPROGRESS;21932193+ mnt_drop_write_file(file);21942194+ return -EINVAL;21962195 }21972197- ret = mnt_want_write_file(file);21982198- if (ret) {21992199- atomic_set(&root->fs_info->mutually_exclusive_operation_running,22002200- 0);22012201- return ret;21962196+21972197+ if (btrfs_root_readonly(root)) {21982198+ ret = -EROFS;21992199+ goto out;22022200 }2203220122042202 switch (inode->i_mode & S_IFMT) {···22512247 ret = -EINVAL;22522248 }22532249out:22542254- mnt_drop_write_file(file);22552250 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);22512251+ mnt_drop_write_file(file);22562252 return ret;22572253}22582254···22672263 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,22682264 1)) {22692265 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");22702270- return -EINPROGRESS;22662266+ return -EINVAL;22712267 }2272226822732269 mutex_lock(&root->fs_info->volume_mutex);···23042300 1)) {23052301 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");23062302 mnt_drop_write_file(file);23072307- return -EINPROGRESS;23032303+ return -EINVAL;23082304 }2309230523102306 mutex_lock(&root->fs_info->volume_mutex);···23202316 kfree(vol_args);23212317out:23222318 mutex_unlock(&root->fs_info->volume_mutex);23232323- mnt_drop_write_file(file);23242319 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);23202320+ mnt_drop_write_file(file);23252321 return ret;23262322}23272323···34413437 struct btrfs_fs_info *fs_info = root->fs_info;34423438 struct btrfs_ioctl_balance_args *bargs;34433439 struct btrfs_balance_control *bctl;34403440+ bool need_unlock; /* for mut. excl. ops lock */34443441 int ret;34453445- int need_to_clear_lock = 0;3446344234473443 if (!capable(CAP_SYS_ADMIN))34483444 return -EPERM;···34513447 if (ret)34523448 return ret;3453344934543454- mutex_lock(&fs_info->volume_mutex);34503450+again:34513451+ if (!atomic_xchg(&fs_info->mutually_exclusive_operation_running, 1)) {34523452+ mutex_lock(&fs_info->volume_mutex);34533453+ mutex_lock(&fs_info->balance_mutex);34543454+ need_unlock = true;34553455+ goto locked;34563456+ }34573457+34583458+ /*34593459+ * mut. excl. ops lock is locked. Three possibilites:34603460+ * (1) some other op is running34613461+ * (2) balance is running34623462+ * (3) balance is paused -- special case (think resume)34633463+ */34553464 mutex_lock(&fs_info->balance_mutex);34653465+ if (fs_info->balance_ctl) {34663466+ /* this is either (2) or (3) */34673467+ if (!atomic_read(&fs_info->balance_running)) {34683468+ mutex_unlock(&fs_info->balance_mutex);34693469+ if (!mutex_trylock(&fs_info->volume_mutex))34703470+ goto again;34713471+ mutex_lock(&fs_info->balance_mutex);34723472+34733473+ if (fs_info->balance_ctl &&34743474+ !atomic_read(&fs_info->balance_running)) {34753475+ /* this is (3) */34763476+ need_unlock = false;34773477+ goto locked;34783478+ }34793479+34803480+ mutex_unlock(&fs_info->balance_mutex);34813481+ mutex_unlock(&fs_info->volume_mutex);34823482+ goto again;34833483+ } else {34843484+ /* this is (2) */34853485+ mutex_unlock(&fs_info->balance_mutex);34863486+ ret = -EINPROGRESS;34873487+ goto out;34883488+ }34893489+ } else {34903490+ /* this is (1) */34913491+ mutex_unlock(&fs_info->balance_mutex);34923492+ pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");34933493+ ret = -EINVAL;34943494+ goto out;34953495+ }34963496+34973497+locked:34983498+ BUG_ON(!atomic_read(&fs_info->mutually_exclusive_operation_running));3456349934573500 if (arg) {34583501 bargs = memdup_user(arg, sizeof(*bargs));34593502 if (IS_ERR(bargs)) {34603503 ret = PTR_ERR(bargs);34613461- goto out;35043504+ goto out_unlock;34623505 }3463350634643507 if (bargs->flags & BTRFS_BALANCE_RESUME) {···35253474 bargs = NULL;35263475 }3527347635283528- if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,35293529- 1)) {35303530- pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");34773477+ if (fs_info->balance_ctl) {35313478 ret = -EINPROGRESS;35323479 goto out_bargs;35333480 }35343534- need_to_clear_lock = 1;3535348135363482 bctl = kzalloc(sizeof(*bctl), GFP_NOFS);35373483 if (!bctl) {···35493501 }3550350235513503do_balance:35523552- ret = btrfs_balance(bctl, bargs);35533504 /*35543554- * bctl is freed in __cancel_balance or in free_fs_info if35553555- * restriper was paused all the way until unmount35053505+ * Ownership of bctl and mutually_exclusive_operation_running35063506+ * goes to to btrfs_balance. bctl is freed in __cancel_balance,35073507+ * or, if restriper was paused all the way until unmount, in35083508+ * free_fs_info. mutually_exclusive_operation_running is35093509+ * cleared in __cancel_balance.35563510 */35113511+ need_unlock = false;35123512+35133513+ ret = btrfs_balance(bctl, bargs);35143514+35573515 if (arg) {35583516 if (copy_to_user(arg, bargs, sizeof(*bargs)))35593517 ret = -EFAULT;···3567351335683514out_bargs:35693515 kfree(bargs);35703570-out:35713571- if (need_to_clear_lock)35723572- atomic_set(&root->fs_info->mutually_exclusive_operation_running,35733573- 0);35163516+out_unlock:35743517 mutex_unlock(&fs_info->balance_mutex);35753518 mutex_unlock(&fs_info->volume_mutex);35193519+ if (need_unlock)35203520+ atomic_set(&fs_info->mutually_exclusive_operation_running, 0);35213521+out:35763522 mnt_drop_write_file(file);35773523 return ret;35783524}···37503696 if (IS_ERR(sa)) {37513697 ret = PTR_ERR(sa);37523698 goto drop_write;36993699+ }37003700+37013701+ if (!sa->qgroupid) {37023702+ ret = -EINVAL;37033703+ goto out;37533704 }3754370537553706 trans = btrfs_join_transaction(root);
+19-1
fs/btrfs/qgroup.c
···379379380380 ret = add_relation_rb(fs_info, found_key.objectid,381381 found_key.offset);382382+ if (ret == -ENOENT) {383383+ printk(KERN_WARNING384384+ "btrfs: orphan qgroup relation 0x%llx->0x%llx\n",385385+ (unsigned long long)found_key.objectid,386386+ (unsigned long long)found_key.offset);387387+ ret = 0; /* ignore the error */388388+ }382389 if (ret)383390 goto out;384391next2:···963956 struct btrfs_fs_info *fs_info, u64 qgroupid)964957{965958 struct btrfs_root *quota_root;959959+ struct btrfs_qgroup *qgroup;966960 int ret = 0;967961968962 quota_root = fs_info->quota_root;969963 if (!quota_root)970964 return -EINVAL;971965966966+ /* check if there are no relations to this qgroup */967967+ spin_lock(&fs_info->qgroup_lock);968968+ qgroup = find_qgroup_rb(fs_info, qgroupid);969969+ if (qgroup) {970970+ if (!list_empty(&qgroup->groups) || !list_empty(&qgroup->members)) {971971+ spin_unlock(&fs_info->qgroup_lock);972972+ return -EBUSY;973973+ }974974+ }975975+ spin_unlock(&fs_info->qgroup_lock);976976+972977 ret = del_qgroup_item(trans, quota_root, qgroupid);973978974979 spin_lock(&fs_info->qgroup_lock);975980 del_qgroup_rb(quota_root->fs_info, qgroupid);976976-977981 spin_unlock(&fs_info->qgroup_lock);978982979983 return ret;
+3-1
fs/btrfs/send.c
···18141814 (unsigned long)nce->ino);18151815 if (!nce_head) {18161816 nce_head = kmalloc(sizeof(*nce_head), GFP_NOFS);18171817- if (!nce_head)18171817+ if (!nce_head) {18181818+ kfree(nce);18181819 return -ENOMEM;18201820+ }18191821 INIT_LIST_HEAD(nce_head);1820182218211823 ret = radix_tree_insert(&sctx->name_cache, nce->ino, nce_head);
···14681468 goto cleanup_transaction;14691469 }1470147014711471- if (cur_trans->aborted) {14711471+ /* Stop the commit early if ->aborted is set */14721472+ if (unlikely(ACCESS_ONCE(cur_trans->aborted))) {14721473 ret = cur_trans->aborted;14731474 goto cleanup_transaction;14741475 }···15751574 wait_event(cur_trans->writer_wait,15761575 atomic_read(&cur_trans->num_writers) == 1);1577157615771577+ /* ->aborted might be set after the previous check, so check it */15781578+ if (unlikely(ACCESS_ONCE(cur_trans->aborted))) {15791579+ ret = cur_trans->aborted;15801580+ goto cleanup_transaction;15811581+ }15781582 /*15791583 * the reloc mutex makes sure that we stop15801584 * the balancing code from coming in and moving···1658165216591653 ret = commit_cowonly_roots(trans, root);16601654 if (ret) {16551655+ mutex_unlock(&root->fs_info->tree_log_mutex);16561656+ mutex_unlock(&root->fs_info->reloc_mutex);16571657+ goto cleanup_transaction;16581658+ }16591659+16601660+ /*16611661+ * The tasks which save the space cache and inode cache may also16621662+ * update ->aborted, check it.16631663+ */16641664+ if (unlikely(ACCESS_ONCE(cur_trans->aborted))) {16651665+ ret = cur_trans->aborted;16611666 mutex_unlock(&root->fs_info->tree_log_mutex);16621667 mutex_unlock(&root->fs_info->reloc_mutex);16631668 goto cleanup_transaction;
+8-2
fs/btrfs/tree-log.c
···33573357 if (skip_csum)33583358 return 0;3359335933603360+ if (em->compress_type) {33613361+ csum_offset = 0;33623362+ csum_len = block_len;33633363+ }33643364+33603365 /* block start is already adjusted for the file extent offset. */33613366 ret = btrfs_lookup_csums_range(log->fs_info->csum_root,33623367 em->block_start + csum_offset,···34153410 em = list_entry(extents.next, struct extent_map, list);3416341134173412 list_del_init(&em->list);34183418- clear_bit(EXTENT_FLAG_LOGGING, &em->flags);3419341334203414 /*34213415 * If we had an error we just need to delete everybody from our34223416 * private list.34233417 */34243418 if (ret) {34193419+ clear_em_logging(tree, em);34253420 free_extent_map(em);34263421 continue;34273422 }···34293424 write_unlock(&tree->lock);3430342534313426 ret = log_one_extent(trans, inode, root, em, path);34323432- free_extent_map(em);34333427 write_lock(&tree->lock);34283428+ clear_em_logging(tree, em);34293429+ free_extent_map(em);34343430 }34353431 WARN_ON(!list_empty(&extents));34363432 write_unlock(&tree->lock);
···214214 goto retry;215215 }216216 new->ino = ino;217217- INIT_LIST_HEAD(&new->list);218217219218 /* add new_oentry into list which is sorted by inode number */220219 if (orphan) {···771772 sbi->n_orphans = 0;772773}773774774774-int create_checkpoint_caches(void)775775+int __init create_checkpoint_caches(void)775776{776777 orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry",777778 sizeof(struct orphan_inode_entry), NULL);
···78787979 sbi->bg_gc++;80808181- if (f2fs_gc(sbi, 1) == GC_NONE)8181+ if (f2fs_gc(sbi) == GC_NONE)8282 wait_ms = GC_THREAD_NOGC_SLEEP_TIME;8383 else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME)8484 wait_ms = GC_THREAD_MAX_SLEEP_TIME;···424424}425425426426/*427427- * Calculate start block index that this node page contains427427+ * Calculate start block index indicating the given node offset.428428+ * Be careful, caller should give this node offset only indicating direct node429429+ * blocks. If any node offsets, which point the other types of node blocks such430430+ * as indirect or double indirect node blocks, are given, it must be a caller's431431+ * bug.428432 */429433block_t start_bidx_of_node(unsigned int node_ofs)430434{···655651 return ret;656652}657653658658-int f2fs_gc(struct f2fs_sb_info *sbi, int nGC)654654+int f2fs_gc(struct f2fs_sb_info *sbi)659655{660660- unsigned int segno;661661- int old_free_secs, cur_free_secs;662662- int gc_status, nfree;663656 struct list_head ilist;657657+ unsigned int segno, i;664658 int gc_type = BG_GC;659659+ int gc_status = GC_NONE;665660666661 INIT_LIST_HEAD(&ilist);667662gc_more:668668- nfree = 0;669669- gc_status = GC_NONE;663663+ if (!(sbi->sb->s_flags & MS_ACTIVE))664664+ goto stop;670665671666 if (has_not_enough_free_secs(sbi))672672- old_free_secs = reserved_sections(sbi);673673- else674674- old_free_secs = free_sections(sbi);667667+ gc_type = FG_GC;675668676676- while (sbi->sb->s_flags & MS_ACTIVE) {677677- int i;678678- if (has_not_enough_free_secs(sbi))679679- gc_type = FG_GC;669669+ if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))670670+ goto stop;680671681681- cur_free_secs = free_sections(sbi) + nfree;682682-683683- /* We got free space successfully. */684684- if (nGC < cur_free_secs - old_free_secs)672672+ for (i = 0; i < sbi->segs_per_sec; i++) {673673+ /*674674+ * do_garbage_collect will give us three gc_status:675675+ * GC_ERROR, GC_DONE, and GC_BLOCKED.676676+ * If GC is finished uncleanly, we have to return677677+ * the victim to dirty segment list.678678+ */679679+ gc_status = do_garbage_collect(sbi, segno + i, &ilist, gc_type);680680+ if (gc_status != GC_DONE)685681 break;686686-687687- if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))688688- break;689689-690690- for (i = 0; i < sbi->segs_per_sec; i++) {691691- /*692692- * do_garbage_collect will give us three gc_status:693693- * GC_ERROR, GC_DONE, and GC_BLOCKED.694694- * If GC is finished uncleanly, we have to return695695- * the victim to dirty segment list.696696- */697697- gc_status = do_garbage_collect(sbi, segno + i,698698- &ilist, gc_type);699699- if (gc_status != GC_DONE)700700- goto stop;701701- nfree++;702702- }703682 }704704-stop:705705- if (has_not_enough_free_secs(sbi) || gc_status == GC_BLOCKED) {683683+ if (has_not_enough_free_secs(sbi)) {706684 write_checkpoint(sbi, (gc_status == GC_BLOCKED), false);707707- if (nfree)685685+ if (has_not_enough_free_secs(sbi))708686 goto gc_more;709687 }688688+stop:710689 mutex_unlock(&sbi->gc_mutex);711690712691 put_gc_inode(&ilist);713713- BUG_ON(!list_empty(&ilist));714692 return gc_status;715693}716694···701715 DIRTY_I(sbi)->v_ops = &default_v_ops;702716}703717704704-int create_gc_caches(void)718718+int __init create_gc_caches(void)705719{706720 winode_slab = f2fs_kmem_cache_create("f2fs_gc_inodes",707721 sizeof(struct inode_entry), NULL);
+3
fs/f2fs/inode.c
···217217 inode->i_ino == F2FS_META_INO(sbi))218218 return 0;219219220220+ if (wbc)221221+ f2fs_balance_fs(sbi);222222+220223 node_page = get_node_page(sbi, inode->i_ino);221224 if (IS_ERR(node_page))222225 return PTR_ERR(node_page);
+12-7
fs/f2fs/node.c
···11241124 return 0;11251125}1126112611271127+/*11281128+ * It is very important to gather dirty pages and write at once, so that we can11291129+ * submit a big bio without interfering other data writes.11301130+ * Be default, 512 pages (2MB), a segment size, is quite reasonable.11311131+ */11321132+#define COLLECT_DIRTY_NODES 51211271133static int f2fs_write_node_pages(struct address_space *mapping,11281134 struct writeback_control *wbc)11291135{···11371131 struct block_device *bdev = sbi->sb->s_bdev;11381132 long nr_to_write = wbc->nr_to_write;1139113311401140- if (wbc->for_kupdate)11411141- return 0;11421142-11431143- if (get_pages(sbi, F2FS_DIRTY_NODES) == 0)11441144- return 0;11451145-11341134+ /* First check balancing cached NAT entries */11461135 if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK)) {11471136 write_checkpoint(sbi, false, false);11481137 return 0;11491138 }11391139+11401140+ /* collect a number of dirty node pages and write together */11411141+ if (get_pages(sbi, F2FS_DIRTY_NODES) < COLLECT_DIRTY_NODES)11421142+ return 0;1150114311511144 /* if mounting is failed, skip writing node pages */11521145 wbc->nr_to_write = bio_get_nr_vecs(bdev);···17371732 kfree(nm_i);17381733}1739173417401740-int create_node_manager_caches(void)17351735+int __init create_node_manager_caches(void)17411736{17421737 nat_entry_slab = f2fs_kmem_cache_create("nat_entry",17431738 sizeof(struct nat_entry), NULL);
···3131 */3232 if (has_not_enough_free_secs(sbi)) {3333 mutex_lock(&sbi->gc_mutex);3434- f2fs_gc(sbi, 1);3434+ f2fs_gc(sbi);3535 }3636}3737
+72-25
fs/f2fs/super.c
···5353 {Opt_err, NULL},5454};55555656+void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...)5757+{5858+ struct va_format vaf;5959+ va_list args;6060+6161+ va_start(args, fmt);6262+ vaf.fmt = fmt;6363+ vaf.va = &args;6464+ printk("%sF2FS-fs (%s): %pV\n", level, sb->s_id, &vaf);6565+ va_end(args);6666+}6767+5668static void init_once(void *foo)5769{5870 struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo;···137125138126 if (sync)139127 write_checkpoint(sbi, false, false);128128+ else129129+ f2fs_balance_fs(sbi);140130141131 return 0;142132}···261247 .get_parent = f2fs_get_parent,262248};263249264264-static int parse_options(struct f2fs_sb_info *sbi, char *options)250250+static int parse_options(struct super_block *sb, struct f2fs_sb_info *sbi,251251+ char *options)265252{266253 substring_t args[MAX_OPT_ARGS];267254 char *p;···301286 break;302287#else303288 case Opt_nouser_xattr:304304- pr_info("nouser_xattr options not supported\n");289289+ f2fs_msg(sb, KERN_INFO,290290+ "nouser_xattr options not supported");305291 break;306292#endif307293#ifdef CONFIG_F2FS_FS_POSIX_ACL···311295 break;312296#else313297 case Opt_noacl:314314- pr_info("noacl options not supported\n");298298+ f2fs_msg(sb, KERN_INFO, "noacl options not supported");315299 break;316300#endif317301 case Opt_active_logs:···325309 set_opt(sbi, DISABLE_EXT_IDENTIFY);326310 break;327311 default:328328- pr_err("Unrecognized mount option \"%s\" or missing value\n",329329- p);312312+ f2fs_msg(sb, KERN_ERR,313313+ "Unrecognized mount option \"%s\" or missing value",314314+ p);330315 return -EINVAL;331316 }332317 }···354337 return result;355338}356339357357-static int sanity_check_raw_super(struct f2fs_super_block *raw_super)340340+static int sanity_check_raw_super(struct super_block *sb,341341+ struct f2fs_super_block *raw_super)358342{359343 unsigned int blocksize;360344361361- if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic))345345+ if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) {346346+ f2fs_msg(sb, KERN_INFO,347347+ "Magic Mismatch, valid(0x%x) - read(0x%x)",348348+ F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic));362349 return 1;350350+ }363351364352 /* Currently, support only 4KB block size */365353 blocksize = 1 << le32_to_cpu(raw_super->log_blocksize);366366- if (blocksize != PAGE_CACHE_SIZE)354354+ if (blocksize != PAGE_CACHE_SIZE) {355355+ f2fs_msg(sb, KERN_INFO,356356+ "Invalid blocksize (%u), supports only 4KB\n",357357+ blocksize);367358 return 1;359359+ }368360 if (le32_to_cpu(raw_super->log_sectorsize) !=369369- F2FS_LOG_SECTOR_SIZE)361361+ F2FS_LOG_SECTOR_SIZE) {362362+ f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize");370363 return 1;364364+ }371365 if (le32_to_cpu(raw_super->log_sectors_per_block) !=372372- F2FS_LOG_SECTORS_PER_BLOCK)366366+ F2FS_LOG_SECTORS_PER_BLOCK) {367367+ f2fs_msg(sb, KERN_INFO, "Invalid log sectors per block");373368 return 1;369369+ }374370 return 0;375371}376372···443413 if (!sbi)444414 return -ENOMEM;445415446446- /* set a temporary block size */447447- if (!sb_set_blocksize(sb, F2FS_BLKSIZE))416416+ /* set a block size */417417+ if (!sb_set_blocksize(sb, F2FS_BLKSIZE)) {418418+ f2fs_msg(sb, KERN_ERR, "unable to set blocksize");448419 goto free_sbi;420420+ }449421450422 /* read f2fs raw super block */451423 raw_super_buf = sb_bread(sb, 0);452424 if (!raw_super_buf) {453425 err = -EIO;426426+ f2fs_msg(sb, KERN_ERR, "unable to read superblock");454427 goto free_sbi;455428 }456429 raw_super = (struct f2fs_super_block *)···471438 set_opt(sbi, POSIX_ACL);472439#endif473440 /* parse mount options */474474- if (parse_options(sbi, (char *)data))441441+ if (parse_options(sb, sbi, (char *)data))475442 goto free_sb_buf;476443477444 /* sanity checking of raw super */478478- if (sanity_check_raw_super(raw_super))445445+ if (sanity_check_raw_super(sb, raw_super)) {446446+ f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem");479447 goto free_sb_buf;448448+ }480449481450 sb->s_maxbytes = max_file_size(le32_to_cpu(raw_super->log_blocksize));482451 sb->s_max_links = F2FS_LINK_MAX;···512477 /* get an inode for meta space */513478 sbi->meta_inode = f2fs_iget(sb, F2FS_META_INO(sbi));514479 if (IS_ERR(sbi->meta_inode)) {480480+ f2fs_msg(sb, KERN_ERR, "Failed to read F2FS meta data inode");515481 err = PTR_ERR(sbi->meta_inode);516482 goto free_sb_buf;517483 }518484519485 err = get_valid_checkpoint(sbi);520520- if (err)486486+ if (err) {487487+ f2fs_msg(sb, KERN_ERR, "Failed to get valid F2FS checkpoint");521488 goto free_meta_inode;489489+ }522490523491 /* sanity checking of checkpoint */524492 err = -EINVAL;525525- if (sanity_check_ckpt(raw_super, sbi->ckpt))493493+ if (sanity_check_ckpt(raw_super, sbi->ckpt)) {494494+ f2fs_msg(sb, KERN_ERR, "Invalid F2FS checkpoint");526495 goto free_cp;496496+ }527497528498 sbi->total_valid_node_count =529499 le32_to_cpu(sbi->ckpt->valid_node_count);···542502 INIT_LIST_HEAD(&sbi->dir_inode_list);543503 spin_lock_init(&sbi->dir_inode_lock);544504545545- /* init super block */546546- if (!sb_set_blocksize(sb, sbi->blocksize))547547- goto free_cp;548548-549505 init_orphan_info(sbi);550506551507 /* setup f2fs internal modules */552508 err = build_segment_manager(sbi);553553- if (err)509509+ if (err) {510510+ f2fs_msg(sb, KERN_ERR,511511+ "Failed to initialize F2FS segment manager");554512 goto free_sm;513513+ }555514 err = build_node_manager(sbi);556556- if (err)515515+ if (err) {516516+ f2fs_msg(sb, KERN_ERR,517517+ "Failed to initialize F2FS node manager");557518 goto free_nm;519519+ }558520559521 build_gc_manager(sbi);560522561523 /* get an inode for node space */562524 sbi->node_inode = f2fs_iget(sb, F2FS_NODE_INO(sbi));563525 if (IS_ERR(sbi->node_inode)) {526526+ f2fs_msg(sb, KERN_ERR, "Failed to read node inode");564527 err = PTR_ERR(sbi->node_inode);565528 goto free_nm;566529 }···576533 /* read root inode and dentry */577534 root = f2fs_iget(sb, F2FS_ROOT_INO(sbi));578535 if (IS_ERR(root)) {536536+ f2fs_msg(sb, KERN_ERR, "Failed to read root inode");579537 err = PTR_ERR(root);580538 goto free_node_inode;581539 }···640596 .fs_flags = FS_REQUIRES_DEV,641597};642598643643-static int init_inodecache(void)599599+static int __init init_inodecache(void)644600{645601 f2fs_inode_cachep = f2fs_kmem_cache_create("f2fs_inode_cache",646602 sizeof(struct f2fs_inode_info), NULL);···675631 err = create_checkpoint_caches();676632 if (err)677633 goto fail;678678- return register_filesystem(&f2fs_fs_type);634634+ err = register_filesystem(&f2fs_fs_type);635635+ if (err)636636+ goto fail;637637+ f2fs_create_root_stats();679638fail:680639 return err;681640}682641683642static void __exit exit_f2fs_fs(void)684643{685685- destroy_root_stats();644644+ f2fs_destroy_root_stats();686645 unregister_filesystem(&f2fs_fs_type);687646 destroy_checkpoint_caches();688647 destroy_gc_caches();
+2
fs/f2fs/xattr.c
···318318 if (name_len > 255 || value_len > MAX_VALUE_LEN)319319 return -ERANGE;320320321321+ f2fs_balance_fs(sbi);322322+321323 mutex_lock_op(sbi, NODE_NEW);322324 if (!fi->i_xattr_nid) {323325 /* Allocate new attribute block */
+14-2
fs/fuse/Kconfig
···44 With FUSE it is possible to implement a fully functional filesystem55 in a userspace program.6677- There's also companion library: libfuse. This library along with88- utilities is available from the FUSE homepage:77+ There's also a companion library: libfuse2. This library is available88+ from the FUSE homepage:99 <http://fuse.sourceforge.net/>1010+ although chances are your distribution already has that library1111+ installed if you've installed the "fuse" package itself.10121113 See <file:Documentation/filesystems/fuse.txt> for more information.1214 See <file:Documentation/Changes> for needed library/utility version.13151416 If you want to develop a userspace FS, or if you want to use1517 a filesystem based on FUSE, answer Y or M.1818+1919+config CUSE2020+ tristate "Character device in Userspace support"2121+ depends on FUSE_FS2222+ help2323+ This FUSE extension allows character devices to be2424+ implemented in userspace.2525+2626+ If you want to develop or use a userspace character device2727+ based on CUSE, answer Y or M.
+22-14
fs/fuse/cuse.c
···4545#include <linux/miscdevice.h>4646#include <linux/mutex.h>4747#include <linux/slab.h>4848-#include <linux/spinlock.h>4948#include <linux/stat.h>5049#include <linux/module.h>5150···6263 bool unrestricted_ioctl;6364};64656565-static DEFINE_SPINLOCK(cuse_lock); /* protects cuse_conntbl */6666+static DEFINE_MUTEX(cuse_lock); /* protects registration */6667static struct list_head cuse_conntbl[CUSE_CONNTBL_LEN];6768static struct class *cuse_class;6869···113114 int rc;114115115116 /* look up and get the connection */116116- spin_lock(&cuse_lock);117117+ mutex_lock(&cuse_lock);117118 list_for_each_entry(pos, cuse_conntbl_head(devt), list)118119 if (pos->dev->devt == devt) {119120 fuse_conn_get(&pos->fc);120121 cc = pos;121122 break;122123 }123123- spin_unlock(&cuse_lock);124124+ mutex_unlock(&cuse_lock);124125125126 /* dead? */126127 if (!cc)···266267static int cuse_parse_devinfo(char *p, size_t len, struct cuse_devinfo *devinfo)267268{268269 char *end = p + len;269269- char *key, *val;270270+ char *uninitialized_var(key), *uninitialized_var(val);270271 int rc;271272272273 while (true) {···304305 */305306static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)306307{307307- struct cuse_conn *cc = fc_to_cc(fc);308308+ struct cuse_conn *cc = fc_to_cc(fc), *pos;308309 struct cuse_init_out *arg = req->out.args[0].value;309310 struct page *page = req->pages[0];310311 struct cuse_devinfo devinfo = { };311312 struct device *dev;312313 struct cdev *cdev;313314 dev_t devt;314314- int rc;315315+ int rc, i;315316316317 if (req->out.h.error ||317318 arg->major != FUSE_KERNEL_VERSION || arg->minor < 11) {···355356 dev_set_drvdata(dev, cc);356357 dev_set_name(dev, "%s", devinfo.name);357358359359+ mutex_lock(&cuse_lock);360360+361361+ /* make sure the device-name is unique */362362+ for (i = 0; i < CUSE_CONNTBL_LEN; ++i) {363363+ list_for_each_entry(pos, &cuse_conntbl[i], list)364364+ if (!strcmp(dev_name(pos->dev), dev_name(dev)))365365+ goto err_unlock;366366+ }367367+358368 rc = device_add(dev);359369 if (rc)360360- goto err_device;370370+ goto err_unlock;361371362372 /* register cdev */363373 rc = -ENOMEM;364374 cdev = cdev_alloc();365375 if (!cdev)366366- goto err_device;376376+ goto err_unlock;367377368378 cdev->owner = THIS_MODULE;369379 cdev->ops = &cuse_frontend_fops;···385377 cc->cdev = cdev;386378387379 /* make the device available */388388- spin_lock(&cuse_lock);389380 list_add(&cc->list, cuse_conntbl_head(devt));390390- spin_unlock(&cuse_lock);381381+ mutex_unlock(&cuse_lock);391382392383 /* announce device availability */393384 dev_set_uevent_suppress(dev, 0);···398391399392err_cdev:400393 cdev_del(cdev);401401-err_device:394394+err_unlock:395395+ mutex_unlock(&cuse_lock);402396 put_device(dev);403397err_region:404398 unregister_chrdev_region(devt, 1);···528520 int rc;529521530522 /* remove from the conntbl, no more access from this point on */531531- spin_lock(&cuse_lock);523523+ mutex_lock(&cuse_lock);532524 list_del_init(&cc->list);533533- spin_unlock(&cuse_lock);525525+ mutex_unlock(&cuse_lock);534526535527 /* remove device */536528 if (cc->dev)
-5
fs/fuse/dev.c
···692692 struct page *oldpage = *pagep;693693 struct page *newpage;694694 struct pipe_buffer *buf = cs->pipebufs;695695- struct address_space *mapping;696696- pgoff_t index;697695698696 unlock_request(cs->fc, cs->req);699697 fuse_copy_finish(cs);···721723722724 if (fuse_check_page(newpage) != 0)723725 goto out_fallback_unlock;724724-725725- mapping = oldpage->mapping;726726- index = oldpage->index;727726728727 /*729728 * This is a new and locked page, it shouldn't be mapped or
···281281{282282 struct gfs2_sbd *sdp = gl->gl_sbd;283283 struct lm_lockstruct *ls = &sdp->sd_lockstruct;284284+ int lvb_needs_unlock = 0;284285 int error;285286286287 if (gl->gl_lksb.sb_lkid == 0) {···295294 gfs2_update_request_times(gl);296295297296 /* don't want to skip dlm_unlock writing the lvb when lock is ex */297297+298298+ if (gl->gl_lksb.sb_lvbptr && (gl->gl_state == LM_ST_EXCLUSIVE))299299+ lvb_needs_unlock = 1;300300+298301 if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&299299- gl->gl_lksb.sb_lvbptr && (gl->gl_state != LM_ST_EXCLUSIVE)) {302302+ !lvb_needs_unlock) {300303 gfs2_glock_free(gl);301304 return;302305 }
+2-1
fs/jbd/journal.c
···446446 * currently running transaction (if it exists). Otherwise,447447 * the target tid must be an old one.448448 */449449- if (journal->j_running_transaction &&449449+ if (journal->j_commit_request != target &&450450+ journal->j_running_transaction &&450451 journal->j_running_transaction->t_tid == target) {451452 /*452453 * We want a new commit: OK, mark the request and wakeup the
+2-1
fs/udf/super.c
···307307{308308 struct udf_sb_info *sbi = UDF_SB(sb);309309 int i;310310-310310+ if (sbi->s_partmaps == NULL)311311+ return;311312 for (i = 0; i < sbi->s_partitions; i++)312313 udf_free_partition(&sbi->s_partmaps[i]);313314 kfree(sbi->s_partmaps);
···355355 /*356356 * If need to compact the leaf entries, do it now.357357 */358358- if (compact)358358+ if (compact) {359359 xfs_dir2_block_compact(tp, bp, hdr, btp, blp, &needlog,360360 &lfloghigh, &lfloglow);361361- else if (btp->stale) {361361+ /* recalculate blp post-compaction */362362+ blp = xfs_dir2_block_leaf_p(btp);363363+ } else if (btp->stale) {362364 /*363365 * Set leaf logging boundaries to impossible state.364366 * For the no-stale case they're set explicitly.
···126126 struct module *owner;127127 int refcnt;128128129129- unsigned int power_specified:1;130129 /* set to 1 to use the core cpuidle time keeping (for all states). */131130 unsigned int en_core_tk_irqen:1;131131+ /* states array must be ordered in decreasing power consumption */132132 struct cpuidle_state states[CPUIDLE_STATE_MAX];133133 int state_count;134134 int safe_state_index;
+2-2
include/linux/libata.h
···652652 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */653653 };654654655655- /* Identify Device Data Log (30h), SATA Settings (page 08h) */656656- u8 sata_settings[ATA_SECT_SIZE];655655+ /* DEVSLP Timing Variables from Identify Device Data Log */656656+ u8 devslp_timing[ATA_LOG_DEVSLP_SIZE];657657658658 /* error history */659659 int spdn_cnt;
···158158#define SG_TRANS_DATA (0x02 << 4)159159#define SG_LINK_DESC (0x03 << 4)160160161161-/* SD bank voltage */162162-#define SD_IO_3V3 0163163-#define SD_IO_1V8 1164164-161161+/* Output voltage */162162+#define OUTPUT_3V3 0163163+#define OUTPUT_1V8 1165164166165/* Card Clock Enable Register */167166#define SD_CLK_EN 0x04···200201#define CHANGE_CLK 0x01201202202203/* LDO_CTL */204204+#define BPP_ASIC_1V7 0x00205205+#define BPP_ASIC_1V8 0x01206206+#define BPP_ASIC_1V9 0x02207207+#define BPP_ASIC_2V0 0x03208208+#define BPP_ASIC_2V7 0x04209209+#define BPP_ASIC_2V8 0x05210210+#define BPP_ASIC_3V2 0x06211211+#define BPP_ASIC_3V3 0x07212212+#define BPP_REG_TUNED18 0x07213213+#define BPP_TUNED18_SHIFT_8402 5214214+#define BPP_TUNED18_SHIFT_8411 4215215+#define BPP_PAD_MASK 0x04216216+#define BPP_PAD_3V3 0x04217217+#define BPP_PAD_1V8 0x00203218#define BPP_LDO_POWB 0x03204219#define BPP_LDO_ON 0x00205220#define BPP_LDO_SUSPEND 0x02···701688 int (*disable_auto_blink)(struct rtsx_pcr *pcr);702689 int (*card_power_on)(struct rtsx_pcr *pcr, int card);703690 int (*card_power_off)(struct rtsx_pcr *pcr, int card);691691+ int (*switch_output_voltage)(struct rtsx_pcr *pcr,692692+ u8 voltage);704693 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);694694+ int (*conv_clk_and_div_n)(int clk, int dir);705695};706696707697enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};···799783 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);800784int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card);801785int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card);786786+int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage);802787unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr);803788void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr);804789
+5-5
include/linux/module.h
···199199 struct module *source, *target;200200};201201202202-enum module_state203203-{204204- MODULE_STATE_LIVE,205205- MODULE_STATE_COMING,206206- MODULE_STATE_GOING,202202+enum module_state {203203+ MODULE_STATE_LIVE, /* Normal state. */204204+ MODULE_STATE_COMING, /* Full formed, running module_init. */205205+ MODULE_STATE_GOING, /* Going away. */206206+ MODULE_STATE_UNFORMED, /* Still setting it up. */207207};208208209209/**
-1
include/linux/ptrace.h
···4545extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);4646extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);4747extern void ptrace_disable(struct task_struct *);4848-extern int ptrace_check_attach(struct task_struct *task, bool ignore_state);4948extern int ptrace_request(struct task_struct *child, long request,5049 unsigned long addr, unsigned long data);5150extern void ptrace_notify(int exit_code);
···18101810#define PF_MEMALLOC 0x00000800 /* Allocating memory */18111811#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */18121812#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */18131813+#define PF_USED_ASYNC 0x00004000 /* used async_schedule*(), used by module init */18131814#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */18141815#define PF_FROZEN 0x00010000 /* frozen for system suspend */18151816#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */···27142713extern void recalc_sigpending_and_wake(struct task_struct *t);27152714extern void recalc_sigpending(void);2716271527172717-extern void signal_wake_up(struct task_struct *t, int resume_stopped);27162716+extern void signal_wake_up_state(struct task_struct *t, unsigned int state);27172717+27182718+static inline void signal_wake_up(struct task_struct *t, bool resume)27192719+{27202720+ signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0);27212721+}27222722+static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume)27232723+{27242724+ signal_wake_up_state(t, resume ? __TASK_TRACED : 0);27252725+}2718272627192727/*27202728 * Wrappers for p->thread_info->cpu access. No-op on UP.
+1
include/linux/usb/usbnet.h
···100100#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */101101102102#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */103103+#define FLAG_NOARP 0x2000 /* device can't do ARP */103104104105/*105106 * Indicates to usbnet, that USB driver accumulates multiple IP packets.
+2
include/net/ip.h
···143143extern int ip4_datagram_connect(struct sock *sk, 144144 struct sockaddr *uaddr, int addr_len);145145146146+extern void ip4_datagram_release_cb(struct sock *sk);147147+146148struct ip_reply_arg {147149 struct kvec iov[1]; 148150 int flags;
···5050#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */5151#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */5252#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */5353-#define PORT_MAX_8250 24 /* max port ID */5353+#define PORT_BRCM_TRUMANAGE 245454+#define PORT_MAX_8250 25 /* max port ID */54555556/*5657 * ARM specific type numbers. These are not currently guaranteed
···188188 ongoing or failed initialization etc. */189189static inline int strong_try_module_get(struct module *mod)190190{191191+ BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED);191192 if (mod && mod->state == MODULE_STATE_COMING)192193 return -EBUSY;193194 if (try_module_get(mod))···344343#endif345344 };346345346346+ if (mod->state == MODULE_STATE_UNFORMED)347347+ continue;348348+347349 if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data))348350 return true;349351 }···454450EXPORT_SYMBOL_GPL(find_symbol);455451456452/* Search for module by name: must hold module_mutex. */457457-struct module *find_module(const char *name)453453+static struct module *find_module_all(const char *name,454454+ bool even_unformed)458455{459456 struct module *mod;460457461458 list_for_each_entry(mod, &modules, list) {459459+ if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)460460+ continue;462461 if (strcmp(mod->name, name) == 0)463462 return mod;464463 }465464 return NULL;465465+}466466+467467+struct module *find_module(const char *name)468468+{469469+ return find_module_all(name, false);466470}467471EXPORT_SYMBOL_GPL(find_module);468472···537525 preempt_disable();538526539527 list_for_each_entry_rcu(mod, &modules, list) {528528+ if (mod->state == MODULE_STATE_UNFORMED)529529+ continue;540530 if (!mod->percpu_size)541531 continue;542532 for_each_possible_cpu(cpu) {···10621048 case MODULE_STATE_GOING:10631049 state = "going";10641050 break;10511051+ default:10521052+ BUG();10651053 }10661054 return sprintf(buffer, "%s\n", state);10671055}···1802178618031787 mutex_lock(&module_mutex);18041788 list_for_each_entry_rcu(mod, &modules, list) {17891789+ if (mod->state == MODULE_STATE_UNFORMED)17901790+ continue;18051791 if ((mod->module_core) && (mod->core_text_size)) {18061792 set_page_attributes(mod->module_core,18071793 mod->module_core + mod->core_text_size,···1825180718261808 mutex_lock(&module_mutex);18271809 list_for_each_entry_rcu(mod, &modules, list) {18101810+ if (mod->state == MODULE_STATE_UNFORMED)18111811+ continue;18281812 if ((mod->module_core) && (mod->core_text_size)) {18291813 set_page_attributes(mod->module_core,18301814 mod->module_core + mod->core_text_size,···25472527 err = -EFBIG;25482528 goto out;25492529 }25302530+25312531+ /* Don't hand 0 to vmalloc, it whines. */25322532+ if (stat.size == 0) {25332533+ err = -EINVAL;25342534+ goto out;25352535+ }25362536+25502537 info->hdr = vmalloc(stat.size);25512538 if (!info->hdr) {25522539 err = -ENOMEM;···30172990 bool ret;3018299130192992 mutex_lock(&module_mutex);30203020- mod = find_module(name);30213021- ret = !mod || mod->state != MODULE_STATE_COMING;29932993+ mod = find_module_all(name, true);29942994+ ret = !mod || mod->state == MODULE_STATE_LIVE29952995+ || mod->state == MODULE_STATE_GOING;30222996 mutex_unlock(&module_mutex);3023299730242998 return ret;···30403012static int do_init_module(struct module *mod)30413013{30423014 int ret = 0;30153015+30163016+ /*30173017+ * We want to find out whether @mod uses async during init. Clear30183018+ * PF_USED_ASYNC. async_schedule*() will set it.30193019+ */30203020+ current->flags &= ~PF_USED_ASYNC;3043302130443022 blocking_notifier_call_chain(&module_notify_list,30453023 MODULE_STATE_COMING, mod);···30923058 blocking_notifier_call_chain(&module_notify_list,30933059 MODULE_STATE_LIVE, mod);3094306030953095- /* We need to finish all async code before the module init sequence is done */30963096- async_synchronize_full();30613061+ /*30623062+ * We need to finish all async code before the module init sequence30633063+ * is done. This has potential to deadlock. For example, a newly30643064+ * detected block device can trigger request_module() of the30653065+ * default iosched from async probing task. Once userland helper30663066+ * reaches here, async_synchronize_full() will wait on the async30673067+ * task waiting on request_module() and deadlock.30683068+ *30693069+ * This deadlock is avoided by perfomring async_synchronize_full()30703070+ * iff module init queued any async jobs. This isn't a full30713071+ * solution as it will deadlock the same if module loading from30723072+ * async jobs nests more than once; however, due to the various30733073+ * constraints, this hack seems to be the best option for now.30743074+ * Please refer to the following thread for details.30753075+ *30763076+ * http://thread.gmane.org/gmane.linux.kernel/142081430773077+ */30783078+ if (current->flags & PF_USED_ASYNC)30793079+ async_synchronize_full();3097308030983081 mutex_lock(&module_mutex);30993082 /* Drop initial reference. */···31643113 goto free_copy;31653114 }3166311531163116+ /*31173117+ * We try to place it in the list now to make sure it's unique31183118+ * before we dedicate too many resources. In particular,31193119+ * temporary percpu memory exhaustion.31203120+ */31213121+ mod->state = MODULE_STATE_UNFORMED;31223122+again:31233123+ mutex_lock(&module_mutex);31243124+ if ((old = find_module_all(mod->name, true)) != NULL) {31253125+ if (old->state == MODULE_STATE_COMING31263126+ || old->state == MODULE_STATE_UNFORMED) {31273127+ /* Wait in case it fails to load. */31283128+ mutex_unlock(&module_mutex);31293129+ err = wait_event_interruptible(module_wq,31303130+ finished_loading(mod->name));31313131+ if (err)31323132+ goto free_module;31333133+ goto again;31343134+ }31353135+ err = -EEXIST;31363136+ mutex_unlock(&module_mutex);31373137+ goto free_module;31383138+ }31393139+ list_add_rcu(&mod->list, &modules);31403140+ mutex_unlock(&module_mutex);31413141+31673142#ifdef CONFIG_MODULE_SIG31683143 mod->sig_ok = info->sig_ok;31693144 if (!mod->sig_ok)···31993122 /* Now module is in final location, initialize linked lists, etc. */32003123 err = module_unload_init(mod);32013124 if (err)32023202- goto free_module;31253125+ goto unlink_mod;3203312632043127 /* Now we've got everything in the final locations, we can32053128 * find optional sections. */···32343157 goto free_arch_cleanup;32353158 }3236315932373237- /* Mark state as coming so strong_try_module_get() ignores us. */32383238- mod->state = MODULE_STATE_COMING;32393239-32403240- /* Now sew it into the lists so we can get lockdep and oops32413241- * info during argument parsing. No one should access us, since32423242- * strong_try_module_get() will fail.32433243- * lockdep/oops can run asynchronous, so use the RCU list insertion32443244- * function to insert in a way safe to concurrent readers.32453245- * The mutex protects against concurrent writers.32463246- */32473247-again:32483248- mutex_lock(&module_mutex);32493249- if ((old = find_module(mod->name)) != NULL) {32503250- if (old->state == MODULE_STATE_COMING) {32513251- /* Wait in case it fails to load. */32523252- mutex_unlock(&module_mutex);32533253- err = wait_event_interruptible(module_wq,32543254- finished_loading(mod->name));32553255- if (err)32563256- goto free_arch_cleanup;32573257- goto again;32583258- }32593259- err = -EEXIST;32603260- goto unlock;32613261- }32623262-32633263- /* This has to be done once we're sure module name is unique. */32643160 dynamic_debug_setup(info->debug, info->num_debug);3265316132663266- /* Find duplicate symbols */31623162+ mutex_lock(&module_mutex);31633163+ /* Find duplicate symbols (must be called under lock). */32673164 err = verify_export_symbols(mod);32683165 if (err < 0)32693269- goto ddebug;31663166+ goto ddebug_cleanup;3270316731683168+ /* This relies on module_mutex for list integrity. */32713169 module_bug_finalize(info->hdr, info->sechdrs, mod);32723272- list_add_rcu(&mod->list, &modules);31703170+31713171+ /* Mark state as coming so strong_try_module_get() ignores us,31723172+ * but kallsyms etc. can see us. */31733173+ mod->state = MODULE_STATE_COMING;31743174+32733175 mutex_unlock(&module_mutex);3274317632753177 /* Module is ready to execute: parsing args may do that. */32763178 err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,32773179 -32768, 32767, &ddebug_dyndbg_module_param_cb);32783180 if (err < 0)32793279- goto unlink;31813181+ goto bug_cleanup;3280318232813183 /* Link in to syfs. */32823184 err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp);32833185 if (err < 0)32843284- goto unlink;31863186+ goto bug_cleanup;3285318732863188 /* Get rid of temporary copy. */32873189 free_copy(info);···3270321432713215 return do_init_module(mod);3272321632733273- unlink:32173217+ bug_cleanup:32183218+ /* module_bug_cleanup needs module_mutex protection */32743219 mutex_lock(&module_mutex);32753275- /* Unlink carefully: kallsyms could be walking list. */32763276- list_del_rcu(&mod->list);32773220 module_bug_cleanup(mod);32783278- wake_up_all(&module_wq);32793279- ddebug:32803280- dynamic_debug_remove(info->debug);32813281- unlock:32213221+ ddebug_cleanup:32823222 mutex_unlock(&module_mutex);32233223+ dynamic_debug_remove(info->debug);32833224 synchronize_sched();32843225 kfree(mod->args);32853226 free_arch_cleanup:···32853232 free_modinfo(mod);32863233 free_unload:32873234 module_unload_free(mod);32353235+ unlink_mod:32363236+ mutex_lock(&module_mutex);32373237+ /* Unlink carefully: kallsyms could be walking list. */32383238+ list_del_rcu(&mod->list);32393239+ wake_up_all(&module_wq);32403240+ mutex_unlock(&module_mutex);32883241 free_module:32893242 module_deallocate(mod, info);32903243 free_copy:···3413335434143355 preempt_disable();34153356 list_for_each_entry_rcu(mod, &modules, list) {33573357+ if (mod->state == MODULE_STATE_UNFORMED)33583358+ continue;34163359 if (within_module_init(addr, mod) ||34173360 within_module_core(addr, mod)) {34183361 if (modname)···3438337734393378 preempt_disable();34403379 list_for_each_entry_rcu(mod, &modules, list) {33803380+ if (mod->state == MODULE_STATE_UNFORMED)33813381+ continue;34413382 if (within_module_init(addr, mod) ||34423383 within_module_core(addr, mod)) {34433384 const char *sym;···3464340134653402 preempt_disable();34663403 list_for_each_entry_rcu(mod, &modules, list) {34043404+ if (mod->state == MODULE_STATE_UNFORMED)34053405+ continue;34673406 if (within_module_init(addr, mod) ||34683407 within_module_core(addr, mod)) {34693408 const char *sym;···3493342834943429 preempt_disable();34953430 list_for_each_entry_rcu(mod, &modules, list) {34313431+ if (mod->state == MODULE_STATE_UNFORMED)34323432+ continue;34963433 if (symnum < mod->num_symtab) {34973434 *value = mod->symtab[symnum].st_value;34983435 *type = mod->symtab[symnum].st_info;···35373470 ret = mod_find_symname(mod, colon+1);35383471 *colon = ':';35393472 } else {35403540- list_for_each_entry_rcu(mod, &modules, list)34733473+ list_for_each_entry_rcu(mod, &modules, list) {34743474+ if (mod->state == MODULE_STATE_UNFORMED)34753475+ continue;35413476 if ((ret = mod_find_symname(mod, name)) != 0)35423477 break;34783478+ }35433479 }35443480 preempt_enable();35453481 return ret;···35573487 int ret;3558348835593489 list_for_each_entry(mod, &modules, list) {34903490+ if (mod->state == MODULE_STATE_UNFORMED)34913491+ continue;35603492 for (i = 0; i < mod->num_symtab; i++) {35613493 ret = fn(data, mod->strtab + mod->symtab[i].st_name,35623494 mod, mod->symtab[i].st_value);···35743502{35753503 int bx = 0;3576350435053505+ BUG_ON(mod->state == MODULE_STATE_UNFORMED);35773506 if (mod->taints ||35783507 mod->state == MODULE_STATE_GOING ||35793508 mod->state == MODULE_STATE_COMING) {···36153542{36163543 struct module *mod = list_entry(p, struct module, list);36173544 char buf[8];35453545+35463546+ /* We always ignore unformed modules. */35473547+ if (mod->state == MODULE_STATE_UNFORMED)35483548+ return 0;3618354936193550 seq_printf(m, "%s %u",36203551 mod->name, mod->init_size + mod->core_size);···3680360336813604 preempt_disable();36823605 list_for_each_entry_rcu(mod, &modules, list) {36063606+ if (mod->state == MODULE_STATE_UNFORMED)36073607+ continue;36833608 if (mod->num_exentries == 0)36843609 continue;36853610···37303651 if (addr < module_addr_min || addr > module_addr_max)37313652 return NULL;3732365337333733- list_for_each_entry_rcu(mod, &modules, list)36543654+ list_for_each_entry_rcu(mod, &modules, list) {36553655+ if (mod->state == MODULE_STATE_UNFORMED)36563656+ continue;37343657 if (within_module_core(addr, mod)37353658 || within_module_init(addr, mod))37363659 return mod;36603660+ }37373661 return NULL;37383662}37393663EXPORT_SYMBOL_GPL(__module_address);···37893707 printk(KERN_DEFAULT "Modules linked in:");37903708 /* Most callers should already have preempt disabled, but make sure */37913709 preempt_disable();37923792- list_for_each_entry_rcu(mod, &modules, list)37103710+ list_for_each_entry_rcu(mod, &modules, list) {37113711+ if (mod->state == MODULE_STATE_UNFORMED)37123712+ continue;37933713 printk(" %s%s", mod->name, module_flags(mod, buf));37143714+ }37943715 preempt_enable();37953716 if (last_unloaded_module[0])37963717 printk(" [last unloaded: %s]", last_unloaded_module);
+59-15
kernel/ptrace.c
···117117 * TASK_KILLABLE sleeps.118118 */119119 if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child))120120- signal_wake_up(child, task_is_traced(child));120120+ ptrace_signal_wake_up(child, true);121121122122 spin_unlock(&child->sighand->siglock);123123+}124124+125125+/* Ensure that nothing can wake it up, even SIGKILL */126126+static bool ptrace_freeze_traced(struct task_struct *task)127127+{128128+ bool ret = false;129129+130130+ /* Lockless, nobody but us can set this flag */131131+ if (task->jobctl & JOBCTL_LISTENING)132132+ return ret;133133+134134+ spin_lock_irq(&task->sighand->siglock);135135+ if (task_is_traced(task) && !__fatal_signal_pending(task)) {136136+ task->state = __TASK_TRACED;137137+ ret = true;138138+ }139139+ spin_unlock_irq(&task->sighand->siglock);140140+141141+ return ret;142142+}143143+144144+static void ptrace_unfreeze_traced(struct task_struct *task)145145+{146146+ if (task->state != __TASK_TRACED)147147+ return;148148+149149+ WARN_ON(!task->ptrace || task->parent != current);150150+151151+ spin_lock_irq(&task->sighand->siglock);152152+ if (__fatal_signal_pending(task))153153+ wake_up_state(task, __TASK_TRACED);154154+ else155155+ task->state = TASK_TRACED;156156+ spin_unlock_irq(&task->sighand->siglock);123157}124158125159/**···173139 * RETURNS:174140 * 0 on success, -ESRCH if %child is not ready.175141 */176176-int ptrace_check_attach(struct task_struct *child, bool ignore_state)142142+static int ptrace_check_attach(struct task_struct *child, bool ignore_state)177143{178144 int ret = -ESRCH;179145···185151 * be changed by us so it's not changing right after this.186152 */187153 read_lock(&tasklist_lock);188188- if ((child->ptrace & PT_PTRACED) && child->parent == current) {154154+ if (child->ptrace && child->parent == current) {155155+ WARN_ON(child->state == __TASK_TRACED);189156 /*190157 * child->sighand can't be NULL, release_task()191158 * does ptrace_unlink() before __exit_signal().192159 */193193- spin_lock_irq(&child->sighand->siglock);194194- WARN_ON_ONCE(task_is_stopped(child));195195- if (ignore_state || (task_is_traced(child) &&196196- !(child->jobctl & JOBCTL_LISTENING)))160160+ if (ignore_state || ptrace_freeze_traced(child))197161 ret = 0;198198- spin_unlock_irq(&child->sighand->siglock);199162 }200163 read_unlock(&tasklist_lock);201164202202- if (!ret && !ignore_state)203203- ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH;165165+ if (!ret && !ignore_state) {166166+ if (!wait_task_inactive(child, __TASK_TRACED)) {167167+ /*168168+ * This can only happen if may_ptrace_stop() fails and169169+ * ptrace_stop() changes ->state back to TASK_RUNNING,170170+ * so we should not worry about leaking __TASK_TRACED.171171+ */172172+ WARN_ON(child->state == __TASK_TRACED);173173+ ret = -ESRCH;174174+ }175175+ }204176205205- /* All systems go.. */206177 return ret;207178}208179···356317 */357318 if (task_is_stopped(task) &&358319 task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING))359359- signal_wake_up(task, 1);320320+ signal_wake_up_state(task, __TASK_STOPPED);360321361322 spin_unlock(&task->sighand->siglock);362323···776737 * tracee into STOP.777738 */778739 if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP)))779779- signal_wake_up(child, child->jobctl & JOBCTL_LISTENING);740740+ ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING);780741781742 unlock_task_sighand(child, &flags);782743 ret = 0;···802763 * start of this trap and now. Trigger re-trap.803764 */804765 if (child->jobctl & JOBCTL_TRAP_NOTIFY)805805- signal_wake_up(child, true);766766+ ptrace_signal_wake_up(child, true);806767 ret = 0;807768 }808769 unlock_task_sighand(child, &flags);···939900 goto out_put_task_struct;940901941902 ret = arch_ptrace(child, request, addr, data);903903+ if (ret || request != PTRACE_DETACH)904904+ ptrace_unfreeze_traced(child);942905943906 out_put_task_struct:944907 put_task_struct(child);···1080103910811040 ret = ptrace_check_attach(child, request == PTRACE_KILL ||10821041 request == PTRACE_INTERRUPT);10831083- if (!ret)10421042+ if (!ret) {10841043 ret = compat_arch_ptrace(child, request, addr, data);10441044+ if (ret || request != PTRACE_DETACH)10451045+ ptrace_unfreeze_traced(child);10461046+ }1085104710861048 out_put_task_struct:10871049 put_task_struct(child);
···680680 * No need to set need_resched since signal event passing681681 * goes through ->blocked682682 */683683-void signal_wake_up(struct task_struct *t, int resume)683683+void signal_wake_up_state(struct task_struct *t, unsigned int state)684684{685685- unsigned int mask;686686-687685 set_tsk_thread_flag(t, TIF_SIGPENDING);688688-689686 /*690690- * For SIGKILL, we want to wake it up in the stopped/traced/killable687687+ * TASK_WAKEKILL also means wake it up in the stopped/traced/killable691688 * case. We don't check t->state here because there is a race with it692689 * executing another processor and just now entering stopped state.693690 * By using wake_up_state, we ensure the process will wake up and694691 * handle its death signal.695692 */696696- mask = TASK_INTERRUPTIBLE;697697- if (resume)698698- mask |= TASK_WAKEKILL;699699- if (!wake_up_state(t, mask))693693+ if (!wake_up_state(t, state | TASK_INTERRUPTIBLE))700694 kick_process(t);701695}702696···838844 assert_spin_locked(&t->sighand->siglock);839845840846 task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY);841841- signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);847847+ ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);842848}843849844850/*···17941800 * If SIGKILL was already sent before the caller unlocked17951801 * ->siglock we must see ->core_state != NULL. Otherwise it17961802 * is safe to enter schedule().18031803+ *18041804+ * This is almost outdated, a task with the pending SIGKILL can't18051805+ * block in TASK_TRACED. But PTRACE_EVENT_EXIT can be reported18061806+ * after SIGKILL was already dequeued.17971807 */17981808 if (unlikely(current->mm->core_state) &&17991809 unlikely(current->mm == current->parent->mm))···19231925 if (gstop_done)19241926 do_notify_parent_cldstop(current, false, why);1925192719281928+ /* tasklist protects us from ptrace_freeze_traced() */19261929 __set_current_state(TASK_RUNNING);19271930 if (clear_code)19281931 current->exit_code = 0;···3115311631163117#ifdef CONFIG_COMPAT31173118#ifdef CONFIG_GENERIC_SIGALTSTACK31183118-asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,31193119- compat_stack_t __user *uoss_ptr)31193119+COMPAT_SYSCALL_DEFINE2(sigaltstack,31203120+ const compat_stack_t __user *, uss_ptr,31213121+ compat_stack_t __user *, uoss_ptr)31203122{31213123 stack_t uss, uoss;31223124 int ret;
+1-1
kernel/trace/ftrace.c
···3998399839993999struct notifier_block ftrace_module_nb = {40004000 .notifier_call = ftrace_module_notify,40014001- .priority = 0,40014001+ .priority = INT_MAX, /* Run before anything that can use kprobes */40024002};4003400340044004extern unsigned long __start_mcount_loc[];
+11-4
kernel/trace/trace.c
···34543454 return -EINTR;3455345534563456 /*34573457- * We block until we read something and tracing is enabled.34573457+ * We block until we read something and tracing is disabled.34583458 * We still block if tracing is disabled, but we have never34593459 * read anything. This allows a user to cat this file, and34603460 * then enable tracing. But after we have read something,···34623462 *34633463 * iter->pos will be 0 if we haven't read anything.34643464 */34653465- if (tracing_is_enabled() && iter->pos)34653465+ if (!tracing_is_enabled() && iter->pos)34663466 break;34673467 }34683468···48174817 return ret;4818481848194819 if (buffer) {48204820- if (val)48204820+ mutex_lock(&trace_types_lock);48214821+ if (val) {48214822 ring_buffer_record_on(buffer);48224822- else48234823+ if (current_trace->start)48244824+ current_trace->start(tr);48254825+ } else {48234826 ring_buffer_record_off(buffer);48274827+ if (current_trace->stop)48284828+ current_trace->stop(tr);48294829+ }48304830+ mutex_unlock(&trace_types_lock);48244831 }4825483248264833 (*ppos)++;
+1
lib/bug.c
···5555}56565757#ifdef CONFIG_MODULES5858+/* Updates are protected by module mutex */5859static LIST_HEAD(module_bug_list);59606061static const struct bug_entry *module_find_bug(unsigned long bugaddr)
+18-1
net/batman-adv/distributed-arp-table.c
···738738 struct arphdr *arphdr;739739 struct ethhdr *ethhdr;740740 __be32 ip_src, ip_dst;741741+ uint8_t *hw_src, *hw_dst;741742 uint16_t type = 0;742743743744 /* pull the ethernet header */···778777 ip_src = batadv_arp_ip_src(skb, hdr_size);779778 ip_dst = batadv_arp_ip_dst(skb, hdr_size);780779 if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) ||781781- ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst))780780+ ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) ||781781+ ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) ||782782+ ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst))782783 goto out;784784+785785+ hw_src = batadv_arp_hw_src(skb, hdr_size);786786+ if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src))787787+ goto out;788788+789789+ /* we don't care about the destination MAC address in ARP requests */790790+ if (arphdr->ar_op != htons(ARPOP_REQUEST)) {791791+ hw_dst = batadv_arp_hw_dst(skb, hdr_size);792792+ if (is_zero_ether_addr(hw_dst) ||793793+ is_multicast_ether_addr(hw_dst))794794+ goto out;795795+ }783796784797 type = ntohs(arphdr->ar_op);785798out:···10271012 */10281013 ret = !batadv_is_my_client(bat_priv, hw_dst);10291014out:10151015+ if (ret)10161016+ kfree_skb(skb);10301017 /* if ret == false -> packet has to be delivered to the interface */10311018 return ret;10321019}
+4-1
net/core/scm.c
···3535#include <net/sock.h>3636#include <net/compat.h>3737#include <net/scm.h>3838+#include <net/cls_cgroup.h>383939404041/*···303302 }304303 /* Bump the usage count and install the file. */305304 sock = sock_from_file(fp[i], &err);306306- if (sock)305305+ if (sock) {307306 sock_update_netprioidx(sock->sk, current);307307+ sock_update_classid(sock->sk, current);308308+ }308309 fd_install(new_fd, get_file(fp[i]));309310 }310311
···369369 * We do take care of PMTU discovery (RFC1191) special case :370370 * we can receive locally generated ICMP messages while socket is held.371371 */372372- if (sock_owned_by_user(sk) &&373373- type != ICMP_DEST_UNREACH &&374374- code != ICMP_FRAG_NEEDED)375375- NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);376376-372372+ if (sock_owned_by_user(sk)) {373373+ if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED))374374+ NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);375375+ }377376 if (sk->sk_state == TCP_CLOSE)378377 goto out;379378
···17661766 return -EINVAL;17671767 if (get_user(v, (u32 __user *)optval))17681768 return -EFAULT;17691769+ /* "pim6reg%u" should not exceed 16 bytes (IFNAMSIZ) */17701770+ if (v != RT_TABLE_DEFAULT && v >= 100000000)17711771+ return -EINVAL;17691772 if (sk == mrt->mroute6_sk)17701773 return -EBUSY;17711774
+8-4
net/sctp/outqueue.c
···224224225225/* Free the outqueue structure and any related pending chunks.226226 */227227-void sctp_outq_teardown(struct sctp_outq *q)227227+static void __sctp_outq_teardown(struct sctp_outq *q)228228{229229 struct sctp_transport *transport;230230 struct list_head *lchunk, *temp;···277277 sctp_chunk_free(chunk);278278 }279279280280- q->error = 0;281281-282280 /* Throw away any leftover control chunks. */283281 list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) {284282 list_del_init(&chunk->list);···284286 }285287}286288289289+void sctp_outq_teardown(struct sctp_outq *q)290290+{291291+ __sctp_outq_teardown(q);292292+ sctp_outq_init(q->asoc, q);293293+}294294+287295/* Free the outqueue structure and any related pending chunks. */288296void sctp_outq_free(struct sctp_outq *q)289297{290298 /* Throw away leftover chunks. */291291- sctp_outq_teardown(q);299299+ __sctp_outq_teardown(q);292300293301 /* If we were kmalloc()'d, free the memory. */294302 if (q->malloced)
+3-1
net/sctp/sm_statefuns.c
···1779177917801780 /* Update the content of current association. */17811781 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));17821782- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));17831782 sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev));17831783+ sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,17841784+ SCTP_STATE(SCTP_STATE_ESTABLISHED));17851785+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));17841786 return SCTP_DISPOSITION_CONSUME;1785178717861788nomem_ev:
···387387 * rules388388 */389389 err = usb_driver_set_configuration(dev, 2);390390- if (err < 0) {390390+ if (err < 0)391391 snd_printdd("error usb_driver_set_configuration: %d\n",392392 err);393393- return -ENODEV;394394- }393393+ /* Always return an error, so that we stop creating a device394394+ that will just be destroyed and recreated with a new395395+ configuration */396396+ return -ENODEV;395397 } else396398 snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n");397399···861859 if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) &&862860 ep->type == SND_USB_ENDPOINT_TYPE_SYNC)863861 ep->skip_packets = 4;862862+863863+ /*864864+ * M-Audio Fast Track C400 - when packets are not skipped, real world865865+ * latency varies by approx. +/- 50 frames (at 96KHz) each time the866866+ * stream is (re)started. When skipping packets 16 at endpoint start867867+ * up, the real world latency is stable within +/- 1 frame (also868868+ * across power cycles).869869+ */870870+ if (ep->chip->usb_id == USB_ID(0x0763, 0x2030) &&871871+ ep->type == SND_USB_ENDPOINT_TYPE_DATA)872872+ ep->skip_packets = 16;864873}865874866875void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,