···29532953 improve throughput, but will also increase the29542954 amount of memory reserved for use by the client.2955295529562956- swapaccount[=0|1]29562956+ swapaccount=[0|1]29572957 [KNL] Enable accounting of swap in memory resource29582958 controller if no parameter or 1 is given or disable29592959 it if 0 is given (See Documentation/cgroups/memory.txt)
+7-7
MAINTAINERS
···55815581F: drivers/media/tuners/mxl5007t.*5582558255835583MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)55845584-M: Andrew Gallatin <gallatin@myri.com>55845584+M: Hyong-Youb Kim <hykim@myri.com>55855585L: netdev@vger.kernel.org55865586-W: http://www.myri.com/scs/download-Myri10GE.html55865586+W: https://www.myricom.com/support/downloads/myri10ge.html55875587S: Supported55885588F: drivers/net/ethernet/myricom/myri10ge/55895589···58845884F: include/linux/i2c-omap.h5885588558865886OMAP DEVICE TREE SUPPORT58875887-M: Benoît Cousson <b-cousson@ti.com>58875887+M: Benoît Cousson <bcousson@baylibre.com>58885888M: Tony Lindgren <tony@atomide.com>58895889L: linux-omap@vger.kernel.org58905890L: devicetree@vger.kernel.org···59645964F: drivers/char/hw_random/omap-rng.c5965596559665966OMAP HWMOD SUPPORT59675967-M: Benoît Cousson <b-cousson@ti.com>59675967+M: Benoît Cousson <bcousson@baylibre.com>59685968M: Paul Walmsley <paul@pwsan.com>59695969L: linux-omap@vger.kernel.org59705970S: Maintained59715971F: arch/arm/mach-omap2/omap_hwmod.*5972597259735973OMAP HWMOD DATA FOR OMAP4-BASED DEVICES59745974-M: Benoît Cousson <b-cousson@ti.com>59745974+M: Benoît Cousson <bcousson@baylibre.com>59755975L: linux-omap@vger.kernel.org59765976S: Maintained59775977F: arch/arm/mach-omap2/omap_hwmod_44xx_data.c···7366736673677367SGI GRU DRIVER73687368M: Dimitri Sivanich <sivanich@sgi.com>73697369-M: Robin Holt <holt@sgi.com>73707369S: Maintained73717370F: drivers/misc/sgi-gru/73727371···73857386F: Documentation/sgi-visws.txt7386738773877388SGI XP/XPC/XPNET DRIVER73887388-M: Robin Holt <holt@sgi.com>73897389+M: Cliff Whickman <cpw@sgi.com>73907390+M: Robin Holt <robinmholt@gmail.com>73897391S: Maintained73907392F: drivers/misc/sgi-xp/73917393
+1-1
Makefile
···11VERSION = 322PATCHLEVEL = 1133SUBLEVEL = 044-EXTRAVERSION = -rc544+EXTRAVERSION = -rc755NAME = Linux for Workgroups6677# *DOCUMENTATION*
+6
arch/Kconfig
···407407 help408408 Architecture has the first two arguments of clone(2) swapped.409409410410+config CLONE_BACKWARDS3411411+ bool412412+ help413413+ Architecture has tls passed as the 3rd argument of clone(2),414414+ not the 5th one.415415+410416config ODD_RT_SIGACTION411417 bool412418 help
+10
arch/arc/lib/strchr-700.S
···3939 ld.a r2,[r0,4]4040 sub r12,r6,r74141 bic r12,r12,r64242+#ifdef __LITTLE_ENDIAN__4243 and r7,r12,r44344 breq r7,0,.Loop ; For speed, we want this branch to be unaligned.4445 b .Lfound_char ; Likewise this one.4646+#else4747+ and r12,r12,r44848+ breq r12,0,.Loop ; For speed, we want this branch to be unaligned.4949+ lsr_s r12,r12,75050+ bic r2,r7,r65151+ b.d .Lfound_char_b5252+ and_s r2,r2,r125353+#endif4554; /* We require this code address to be unaligned for speed... */4655.Laligned:4756 ld_s r2,[r0]···10495 lsr r7,r7,71059610697 bic r2,r7,r69898+.Lfound_char_b:10799 norm r2,r2108100 sub_s r0,r0,4109101 asr_s r2,r2,3
···1515#include <asm/mmu_context.h>1616#include <asm/cacheflush.h>1717#include <asm/mach-types.h>1818+#include <asm/smp_plat.h>1819#include <asm/system_misc.h>19202021extern const unsigned char relocate_new_kernel[];···3837 struct kexec_segment *current_segment;3938 __be32 header;4039 int i, err;4040+4141+ /*4242+ * Validate that if the current HW supports SMP, then the SW supports4343+ * and implements CPU hotplug for the current HW. If not, we won't be4444+ * able to kexec reliably, so fail the prepare operation.4545+ */4646+ if (num_possible_cpus() > 1 && !platform_can_cpu_hotplug())4747+ return -EINVAL;41484249 /*4350 * No segment at default ATAGs address. try to locate···8273 crash_save_cpu(®s, smp_processor_id());8374 flush_cache_all();84757676+ set_cpu_online(smp_processor_id(), false);8577 atomic_dec(&waiting_for_crash_ipi);8678 while (1)8779 cpu_relax();···144134 unsigned long reboot_code_buffer_phys;145135 void *reboot_code_buffer;146136147147- if (num_online_cpus() > 1) {148148- pr_err("kexec: error: multiple CPUs still online\n");149149- return;150150- }137137+ /*138138+ * This can only happen if machine_shutdown() failed to disable some139139+ * CPU, and that can only happen if the checks in140140+ * machine_kexec_prepare() were not correct. If this fails, we can't141141+ * reliably kexec anyway, so BUG_ON is appropriate.142142+ */143143+ BUG_ON(num_online_cpus() > 1);151144152145 page_list = image->head & PAGE_MASK;153146
···114114115115/*116116 * A15-specific CP15 registers.117117- * Important: Must be sorted ascending by CRn, CRM, Op1, Op2117117+ * CRn denotes the primary register number, but is copied to the CRm in the118118+ * user space API for 64-bit register access in line with the terminology used119119+ * in the ARM ARM.120120+ * Important: Must be sorted ascending by CRn, CRM, Op1, Op2 and with 64-bit121121+ * registers preceding 32-bit ones.118122 */119123static const struct coproc_reg a15_regs[] = {120124 /* MPIDR: we use VMPIDR for guest access. */
+2-1
arch/arm/kvm/mmio.c
···6363static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,6464 struct kvm_exit_mmio *mmio)6565{6666- unsigned long rt, len;6666+ unsigned long rt;6767+ int len;6768 bool is_write, sign_extend;68696970 if (kvm_vcpu_dabt_isextabt(vcpu)) {
+15-21
arch/arm/kvm/mmu.c
···8585 return p;8686}87878888+static bool page_empty(void *ptr)8989+{9090+ struct page *ptr_page = virt_to_page(ptr);9191+ return page_count(ptr_page) == 1;9292+}9393+8894static void clear_pud_entry(struct kvm *kvm, pud_t *pud, phys_addr_t addr)8995{9096 pmd_t *pmd_table = pmd_offset(pud, 0);···109103 put_page(virt_to_page(pmd));110104}111105112112-static bool pmd_empty(pmd_t *pmd)113113-{114114- struct page *pmd_page = virt_to_page(pmd);115115- return page_count(pmd_page) == 1;116116-}117117-118106static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr)119107{120108 if (pte_present(*pte)) {···116116 put_page(virt_to_page(pte));117117 kvm_tlb_flush_vmid_ipa(kvm, addr);118118 }119119-}120120-121121-static bool pte_empty(pte_t *pte)122122-{123123- struct page *pte_page = virt_to_page(pte);124124- return page_count(pte_page) == 1;125119}126120127121static void unmap_range(struct kvm *kvm, pgd_t *pgdp,···126132 pmd_t *pmd;127133 pte_t *pte;128134 unsigned long long addr = start, end = start + size;129129- u64 range;135135+ u64 next;130136131137 while (addr < end) {132138 pgd = pgdp + pgd_index(addr);133139 pud = pud_offset(pgd, addr);134140 if (pud_none(*pud)) {135135- addr += PUD_SIZE;141141+ addr = pud_addr_end(addr, end);136142 continue;137143 }138144139145 pmd = pmd_offset(pud, addr);140146 if (pmd_none(*pmd)) {141141- addr += PMD_SIZE;147147+ addr = pmd_addr_end(addr, end);142148 continue;143149 }144150145151 pte = pte_offset_kernel(pmd, addr);146152 clear_pte_entry(kvm, pte, addr);147147- range = PAGE_SIZE;153153+ next = addr + PAGE_SIZE;148154149155 /* If we emptied the pte, walk back up the ladder */150150- if (pte_empty(pte)) {156156+ if (page_empty(pte)) {151157 clear_pmd_entry(kvm, pmd, addr);152152- range = PMD_SIZE;153153- if (pmd_empty(pmd)) {158158+ next = pmd_addr_end(addr, end);159159+ if (page_empty(pmd) && !page_empty(pud)) {154160 clear_pud_entry(kvm, pud, addr);155155- range = PUD_SIZE;161161+ next = pud_addr_end(addr, end);156162 }157163 }158164159159- addr += range;165165+ addr = next;160166 }161167}162168
···809809 the CPU type fitted to the system. This permits binaries to be810810 run on ARMv4 through to ARMv7 without modification.811811812812+ See Documentation/arm/kernel_user_helpers.txt for details.813813+812814 However, the fixed address nature of these helpers can be used813815 by ROP (return orientated programming) authors when creating814816 exploits.815817816818 If all of the binaries and libraries which run on your platform817819 are built specifically for your platform, and make no use of818818- these helpers, then you can turn this option off. However,819819- when such an binary or library is run, it will receive a SIGILL820820- signal, which will terminate the program.820820+ these helpers, then you can turn this option off to hinder821821+ such exploits. However, in that case, if a binary or library822822+ relying on those helpers is run, it will receive a SIGILL signal,823823+ which will terminate the program.821824822825 Say N here only if you are absolutely certain that you do not823826 need these helpers; otherwise, the safe option is to say Y.
+3-2
arch/arm/plat-samsung/init.c
···55555656 printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);57575858- if (cpu->map_io == NULL || cpu->init == NULL) {5858+ if (cpu->init == NULL) {5959 printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);6060 panic("Unsupported Samsung CPU");6161 }62626363- cpu->map_io();6363+ if (cpu->map_io)6464+ cpu->map_io();6465}65666667/* s3c24xx_init_clocks
···4242#define TPIDR_EL1 18 /* Thread ID, Privileged */4343#define AMAIR_EL1 19 /* Aux Memory Attribute Indirection Register */4444#define CNTKCTL_EL1 20 /* Timer Control Register (EL1) */4545+#define PAR_EL1 21 /* Physical Address Register */4546/* 32bit specific registers. Keep them at the end of the range */4646-#define DACR32_EL2 21 /* Domain Access Control Register */4747-#define IFSR32_EL2 22 /* Instruction Fault Status Register */4848-#define FPEXC32_EL2 23 /* Floating-Point Exception Control Register */4949-#define DBGVCR32_EL2 24 /* Debug Vector Catch Register */5050-#define TEECR32_EL1 25 /* ThumbEE Configuration Register */5151-#define TEEHBR32_EL1 26 /* ThumbEE Handler Base Register */5252-#define NR_SYS_REGS 274747+#define DACR32_EL2 22 /* Domain Access Control Register */4848+#define IFSR32_EL2 23 /* Instruction Fault Status Register */4949+#define FPEXC32_EL2 24 /* Floating-Point Exception Control Register */5050+#define DBGVCR32_EL2 25 /* Debug Vector Catch Register */5151+#define TEECR32_EL1 26 /* ThumbEE Configuration Register */5252+#define TEEHBR32_EL1 27 /* ThumbEE Handler Base Register */5353+#define NR_SYS_REGS 2853545455/* 32bit mapping */5556#define c0_MPIDR (MPIDR_EL1 * 2) /* MultiProcessor ID Register */···7069#define c5_AIFSR (AFSR1_EL1 * 2) /* Auxiliary Instr Fault Status R */7170#define c6_DFAR (FAR_EL1 * 2) /* Data Fault Address Register */7271#define c6_IFAR (c6_DFAR + 1) /* Instruction Fault Address Register */7272+#define c7_PAR (PAR_EL1 * 2) /* Physical Address Register */7373+#define c7_PAR_high (c7_PAR + 1) /* PAR top 32 bits */7374#define c10_PRRR (MAIR_EL1 * 2) /* Primary Region Remap Register */7475#define c10_NMRR (c10_PRRR + 1) /* Normal Memory Remap Register */7576#define c12_VBAR (VBAR_EL1 * 2) /* Vector Base Address Register */
+1-1
arch/arm64/include/asm/kvm_host.h
···129129 struct kvm_mmu_memory_cache mmu_page_cache;130130131131 /* Target CPU and feature flags */132132- u32 target;132132+ int target;133133 DECLARE_BITMAP(features, KVM_VCPU_MAX_FEATURES);134134135135 /* Detect first run of a vcpu */
+5-2
arch/arm64/include/asm/tlb.h
···3535 struct mm_struct *mm;3636 unsigned int fullmm;3737 struct vm_area_struct *vma;3838+ unsigned long start, end;3839 unsigned long range_start;3940 unsigned long range_end;4041 unsigned int nr;···9897}999810099static inline void101101-tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int fullmm)100100+tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)102101{103102 tlb->mm = mm;104104- tlb->fullmm = fullmm;103103+ tlb->fullmm = !(start | (end+1));104104+ tlb->start = start;105105+ tlb->end = end;105106 tlb->vma = NULL;106107 tlb->max = ARRAY_SIZE(tlb->local);107108 tlb->pages = tlb->local;
···803803 dec_insn.next_pc_inc;804804 return 1;805805 break;806806+#ifdef CONFIG_CPU_CAVIUM_OCTEON807807+ case lwc2_op: /* This is bbit0 on Octeon */808808+ if ((regs->regs[insn.i_format.rs] & (1ull<<insn.i_format.rt)) == 0)809809+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);810810+ else811811+ *contpc = regs->cp0_epc + 8;812812+ return 1;813813+ case ldc2_op: /* This is bbit032 on Octeon */814814+ if ((regs->regs[insn.i_format.rs] & (1ull<<(insn.i_format.rt + 32))) == 0)815815+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);816816+ else817817+ *contpc = regs->cp0_epc + 8;818818+ return 1;819819+ case swc2_op: /* This is bbit1 on Octeon */820820+ if (regs->regs[insn.i_format.rs] & (1ull<<insn.i_format.rt))821821+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);822822+ else823823+ *contpc = regs->cp0_epc + 8;824824+ return 1;825825+ case sdc2_op: /* This is bbit132 on Octeon */826826+ if (regs->regs[insn.i_format.rs] & (1ull<<(insn.i_format.rt + 32)))827827+ *contpc = regs->cp0_epc + 4 + (insn.i_format.simmediate << 2);828828+ else829829+ *contpc = regs->cp0_epc + 8;830830+ return 1;831831+#endif806832 case cop0_op:807833 case cop1_op:808834 case cop2_op:
+1
arch/openrisc/Kconfig
···55555656source "init/Kconfig"57575858+source "kernel/Kconfig.freezer"58595960menu "Processor type and features"6061
+1
arch/powerpc/Kconfig
···979979 must live at a different physical address than the primary980980 kernel.981981982982+# This value must have zeroes in the bottom 60 bits otherwise lots will break982983config PAGE_OFFSET983984 hex984985 default "0xc000000000000000"
+10
arch/powerpc/include/asm/page.h
···211211#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + VIRT_PHYS_OFFSET))212212#define __pa(x) ((unsigned long)(x) - VIRT_PHYS_OFFSET)213213#else214214+#ifdef CONFIG_PPC64215215+/*216216+ * gcc miscompiles (unsigned long)(&static_var) - PAGE_OFFSET217217+ * with -mcmodel=medium, so we use & and | instead of - and + on 64-bit.218218+ */219219+#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) | PAGE_OFFSET))220220+#define __pa(x) ((unsigned long)(x) & 0x0fffffffffffffffUL)221221+222222+#else /* 32-bit, non book E */214223#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + PAGE_OFFSET - MEMORY_START))215224#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START)225225+#endif216226#endif217227218228/*
+9-13
arch/powerpc/kernel/lparcfg.c
···3535#include <asm/vdso_datapage.h>3636#include <asm/vio.h>3737#include <asm/mmu.h>3838+#include <asm/machdep.h>38394040+4141+/*4242+ * This isn't a module but we expose that to userspace4343+ * via /proc so leave the definitions here4444+ */3945#define MODULE_VERS "1.9"4046#define MODULE_NAME "lparcfg"4147···424418{425419 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];426420427427- if (plpar_hcall(H_GET_EM_PARMS, retbuf) == H_SUCCESS)421421+ if (firmware_has_feature(FW_FEATURE_LPAR) &&422422+ plpar_hcall(H_GET_EM_PARMS, retbuf) == H_SUCCESS)428423 seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]);429424}430425···684677}685678686679static const struct file_operations lparcfg_fops = {687687- .owner = THIS_MODULE,688680 .read = seq_read,689681 .write = lparcfg_write,690682 .open = lparcfg_open,···705699 }706700 return 0;707701}708708-709709-static void __exit lparcfg_cleanup(void)710710-{711711- remove_proc_subtree("powerpc/lparcfg", NULL);712712-}713713-714714-module_init(lparcfg_init);715715-module_exit(lparcfg_cleanup);716716-MODULE_DESCRIPTION("Interface for LPAR configuration data");717717-MODULE_AUTHOR("Dave Engebretsen");718718-MODULE_LICENSE("GPL");702702+machine_device_initcall(pseries, lparcfg_init);
+6-2
arch/s390/include/asm/tlb.h
···3232 struct mm_struct *mm;3333 struct mmu_table_batch *batch;3434 unsigned int fullmm;3535+ unsigned long start, end;3536};36373738struct mmu_table_batch {···49485049static inline void tlb_gather_mmu(struct mmu_gather *tlb,5150 struct mm_struct *mm,5252- unsigned int full_mm_flush)5151+ unsigned long start,5252+ unsigned long end)5353{5454 tlb->mm = mm;5555- tlb->fullmm = full_mm_flush;5555+ tlb->start = start;5656+ tlb->end = end;5757+ tlb->fullmm = !(start | (end+1));5658 tlb->batch = NULL;5759 if (tlb->fullmm)5860 __tlb_flush_mm(mm);
···179179/*180180 * Bits 0, 6 and 7 are taken in the low part of the pte,181181 * put the 32 bits of offset into the high part.182182+ *183183+ * For soft-dirty tracking 11 bit is taken from184184+ * the low part of pte as well.182185 */183186#define pte_to_pgoff(pte) ((pte).pte_high)184187#define pgoff_to_pte(off) \
+30
arch/x86/include/asm/pgtable.h
···314314 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);315315}316316317317+static inline pte_t pte_swp_mksoft_dirty(pte_t pte)318318+{319319+ return pte_set_flags(pte, _PAGE_SWP_SOFT_DIRTY);320320+}321321+322322+static inline int pte_swp_soft_dirty(pte_t pte)323323+{324324+ return pte_flags(pte) & _PAGE_SWP_SOFT_DIRTY;325325+}326326+327327+static inline pte_t pte_swp_clear_soft_dirty(pte_t pte)328328+{329329+ return pte_clear_flags(pte, _PAGE_SWP_SOFT_DIRTY);330330+}331331+332332+static inline pte_t pte_file_clear_soft_dirty(pte_t pte)333333+{334334+ return pte_clear_flags(pte, _PAGE_SOFT_DIRTY);335335+}336336+337337+static inline pte_t pte_file_mksoft_dirty(pte_t pte)338338+{339339+ return pte_set_flags(pte, _PAGE_SOFT_DIRTY);340340+}341341+342342+static inline int pte_file_soft_dirty(pte_t pte)343343+{344344+ return pte_flags(pte) & _PAGE_SOFT_DIRTY;345345+}346346+317347/*318348 * Mask out unsupported bits in a present pgprot. Non-present pgprots319349 * can use those bits for other purposes, so leave them be.
+16-1
arch/x86/include/asm/pgtable_types.h
···6161 * they do not conflict with each other.6262 */63636464+#define _PAGE_BIT_SOFT_DIRTY _PAGE_BIT_HIDDEN6565+6466#ifdef CONFIG_MEM_SOFT_DIRTY6565-#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN)6767+#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_SOFT_DIRTY)6668#else6769#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 0))7070+#endif7171+7272+/*7373+ * Tracking soft dirty bit when a page goes to a swap is tricky.7474+ * We need a bit which can be stored in pte _and_ not conflict7575+ * with swap entry format. On x86 bits 6 and 7 are *not* involved7676+ * into swap entry computation, but bit 6 is used for nonlinear7777+ * file mapping, so we borrow bit 7 for soft dirty tracking.7878+ */7979+#ifdef CONFIG_MEM_SOFT_DIRTY8080+#define _PAGE_SWP_SOFT_DIRTY _PAGE_PSE8181+#else8282+#define _PAGE_SWP_SOFT_DIRTY (_AT(pteval_t, 0))6883#endif69847085#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
-4
arch/x86/include/asm/spinlock.h
···233233#define arch_read_relax(lock) cpu_relax()234234#define arch_write_relax(lock) cpu_relax()235235236236-/* The {read|write|spin}_lock() on x86 are full memory barriers. */237237-static inline void smp_mb__after_lock(void) { }238238-#define ARCH_HAS_SMP_MB_AFTER_LOCK239239-240236#endif /* _ASM_X86_SPINLOCK_H */
+5-15
arch/x86/kernel/cpu/amd.c
···512512513513static const int amd_erratum_383[];514514static const int amd_erratum_400[];515515-static bool cpu_has_amd_erratum(const int *erratum);515515+static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum);516516517517static void init_amd(struct cpuinfo_x86 *c)518518{···729729 value &= ~(1ULL << 24);730730 wrmsrl_safe(MSR_AMD64_BU_CFG2, value);731731732732- if (cpu_has_amd_erratum(amd_erratum_383))732732+ if (cpu_has_amd_erratum(c, amd_erratum_383))733733 set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);734734 }735735736736- if (cpu_has_amd_erratum(amd_erratum_400))736736+ if (cpu_has_amd_erratum(c, amd_erratum_400))737737 set_cpu_bug(c, X86_BUG_AMD_APIC_C1E);738738739739 rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);···878878static const int amd_erratum_383[] =879879 AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf));880880881881-static bool cpu_has_amd_erratum(const int *erratum)881881+882882+static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum)882883{883883- struct cpuinfo_x86 *cpu = __this_cpu_ptr(&cpu_info);884884 int osvw_id = *erratum++;885885 u32 range;886886 u32 ms;887887-888888- /*889889- * If called early enough that current_cpu_data hasn't been initialized890890- * yet, fall back to boot_cpu_data.891891- */892892- if (cpu->x86 == 0)893893- cpu = &boot_cpu_data;894894-895895- if (cpu->x86_vendor != X86_VENDOR_AMD)896896- return false;897887898888 if (osvw_id >= 0 && osvw_id < 65536 &&899889 cpu_has(cpu, X86_FEATURE_OSVW)) {
+1
arch/x86/kernel/cpu/perf_event_intel.c
···22702270 case 70:22712271 case 71:22722272 case 63:22732273+ case 69:22732274 x86_pmu.late_ack = true;22742275 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids));22752276 memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
···313313 e820_add_region(start, end - start, type);314314}315315316316+void xen_ignore_unusable(struct e820entry *list, size_t map_size)317317+{318318+ struct e820entry *entry;319319+ unsigned int i;320320+321321+ for (i = 0, entry = list; i < map_size; i++, entry++) {322322+ if (entry->type == E820_UNUSABLE)323323+ entry->type = E820_RAM;324324+ }325325+}326326+316327/**317328 * machine_specific_memory_setup - Hook for machine specific memory setup.318329 **/···363352 rc = 0;364353 }365354 BUG_ON(rc);355355+356356+ /*357357+ * Xen won't allow a 1:1 mapping to be created to UNUSABLE358358+ * regions, so if we're using the machine memory map leave the359359+ * region as RAM as it is in the pseudo-physical map.360360+ *361361+ * UNUSABLE regions in domUs are not handled and will need362362+ * a patch in the future.363363+ */364364+ if (xen_initial_domain())365365+ xen_ignore_unusable(map, memmap.nr_entries);366366367367 /* Make sure the Xen-supplied memory map is well-ordered. */368368 sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries);
+9-2
arch/x86/xen/smp.c
···694694static int xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle)695695{696696 int rc;697697- rc = native_cpu_up(cpu, tidle);698698- WARN_ON (xen_smp_intr_init(cpu));697697+ /*698698+ * xen_smp_intr_init() needs to run before native_cpu_up()699699+ * so that IPI vectors are set up on the booting CPU before700700+ * it is marked online in native_cpu_up().701701+ */702702+ rc = xen_smp_intr_init(cpu);703703+ WARN_ON(rc);704704+ if (!rc)705705+ rc = native_cpu_up(cpu, tidle);699706 return rc;700707}701708
+3-8
drivers/acpi/video.c
···908908 device->cap._DDC = 1;909909 }910910911911- if (acpi_video_init_brightness(device))912912- return;913913-914911 if (acpi_video_backlight_support()) {915912 struct backlight_properties props;916913 struct pci_dev *pdev;···917920 static int count = 0;918921 char *name;919922923923+ result = acpi_video_init_brightness(device);924924+ if (result)925925+ return;920926 name = kasprintf(GFP_KERNEL, "acpi_video%d", count);921927 if (!name)922928 return;···979979 if (result)980980 printk(KERN_ERR PREFIX "Create sysfs link\n");981981982982- } else {983983- /* Remove the brightness object. */984984- kfree(device->brightness->levels);985985- kfree(device->brightness);986986- device->brightness = NULL;987982 }988983}989984
+6-6
drivers/ata/libata-pmp.c
···289289290290 /* Disable sending Early R_OK.291291 * With "cached read" HDD testing and multiple ports busy on a SATA292292- * host controller, 3726 PMP will very rarely drop a deferred292292+ * host controller, 3x26 PMP will very rarely drop a deferred293293 * R_OK that was intended for the host. Symptom will be all294294 * 5 drives under test will timeout, get reset, and recover.295295 */296296- if (vendor == 0x1095 && devid == 0x3726) {296296+ if (vendor == 0x1095 && (devid == 0x3726 || devid == 0x3826)) {297297 u32 reg;298298299299 err_mask = sata_pmp_read(&ap->link, PMP_GSCR_SII_POL, ®);300300 if (err_mask) {301301 rc = -EIO;302302- reason = "failed to read Sil3726 Private Register";302302+ reason = "failed to read Sil3x26 Private Register";303303 goto fail;304304 }305305 reg &= ~0x1;306306 err_mask = sata_pmp_write(&ap->link, PMP_GSCR_SII_POL, reg);307307 if (err_mask) {308308 rc = -EIO;309309- reason = "failed to write Sil3726 Private Register";309309+ reason = "failed to write Sil3x26 Private Register";310310 goto fail;311311 }312312 }···383383 u16 devid = sata_pmp_gscr_devid(gscr);384384 struct ata_link *link;385385386386- if (vendor == 0x1095 && devid == 0x3726) {387387- /* sil3726 quirks */386386+ if (vendor == 0x1095 && (devid == 0x3726 || devid == 0x3826)) {387387+ /* sil3x26 quirks */388388 ata_for_each_link(link, ap, EDGE) {389389 /* link reports offline after LPM */390390 link->flags |= ATA_LFLAG_NO_LPM;
···906906 int i;907907908908 bio_for_each_segment(bv, bio, i) {909909- page = bv->bv_page;910909 /* Non-zero page count for non-head members of911911- * compound pages is no longer allowed by the kernel,912912- * but this has never been seen here.910910+ * compound pages is no longer allowed by the kernel.913911 */914914- if (unlikely(PageCompound(page)))915915- if (compound_trans_head(page) != page) {916916- pr_crit("page tail used for block I/O\n");917917- BUG();918918- }912912+ page = compound_trans_head(bv->bv_page);919913 atomic_inc(&page->_count);920914 }921915}···918924bio_pagedec(struct bio *bio)919925{920926 struct bio_vec *bv;927927+ struct page *page;921928 int i;922929923923- bio_for_each_segment(bv, bio, i)924924- atomic_dec(&bv->bv_page->_count);930930+ bio_for_each_segment(bv, bio, i) {931931+ page = compound_trans_head(bv->bv_page);932932+ atomic_dec(&page->_count);933933+ }925934}926935927936static void
···752752 will not assert AGPBUSY# and will only753753 be delivered when out of C3. */754754#define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */755755+#define INSTPM_TLB_INVALIDATE (1<<9)756756+#define INSTPM_SYNC_FLUSH (1<<5)755757#define ACTHD 0x020c8756758#define FW_BLC 0x020d8757759#define FW_BLC2 0x020dc
···37143714 * The bonding ndo_neigh_setup is called at init time beofre any37153715 * slave exists. So we must declare proxy setup function which will37163716 * be used at run time to resolve the actual slave neigh param setup.37173717+ *37183718+ * It's also called by master devices (such as vlans) to setup their37193719+ * underlying devices. In that case - do nothing, we're already set up from37203720+ * our init.37173721 */37183722static int bond_neigh_setup(struct net_device *dev,37193723 struct neigh_parms *parms)37203724{37213721- parms->neigh_setup = bond_neigh_init;37253725+ /* modify only our neigh_parms */37263726+ if (parms->dev == dev)37273727+ parms->neigh_setup = bond_neigh_init;3722372837233729 return 0;37243730}
···22612261 bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH;22622262}2263226322642264+static void bnx2x_init_dropless_fc(struct bnx2x *bp)22652265+{22662266+ u32 pause_enabled = 0;22672267+22682268+ if (!CHIP_IS_E1(bp) && bp->dropless_fc && bp->link_vars.link_up) {22692269+ if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_TX)22702270+ pause_enabled = 1;22712271+22722272+ REG_WR(bp, BAR_USTRORM_INTMEM +22732273+ USTORM_ETH_PAUSE_ENABLED_OFFSET(BP_PORT(bp)),22742274+ pause_enabled);22752275+ }22762276+22772277+ DP(NETIF_MSG_IFUP | NETIF_MSG_LINK, "dropless_fc is %s\n",22782278+ pause_enabled ? "enabled" : "disabled");22792279+}22802280+22642281int bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode)22652282{22662283 int rc, cfx_idx = bnx2x_get_link_cfg_idx(bp);···2311229423122295 bnx2x_release_phy_lock(bp);2313229622972297+ bnx2x_init_dropless_fc(bp);22982298+23142299 bnx2x_calc_fc_adv(bp);2315230023162301 if (bp->link_vars.link_up) {···23332314 bnx2x_acquire_phy_lock(bp);23342315 bnx2x_phy_init(&bp->link_params, &bp->link_vars);23352316 bnx2x_release_phy_lock(bp);23172317+23182318+ bnx2x_init_dropless_fc(bp);2336231923372320 bnx2x_calc_fc_adv(bp);23382321 } else···2497247624982477 input.port_rate = bp->link_vars.line_speed;2499247825002500- if (cmng_type == CMNG_FNS_MINMAX) {24792479+ if (cmng_type == CMNG_FNS_MINMAX && input.port_rate) {25012480 int vn;2502248125032482 /* read mf conf from shmem */···25542533 }25552534}2556253525362536+/* init cmng mode in HW according to local configuration */25372537+void bnx2x_set_local_cmng(struct bnx2x *bp)25382538+{25392539+ int cmng_fns = bnx2x_get_cmng_fns_mode(bp);25402540+25412541+ if (cmng_fns != CMNG_FNS_NONE) {25422542+ bnx2x_cmng_fns_init(bp, false, cmng_fns);25432543+ storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp));25442544+ } else {25452545+ /* rate shaping and fairness are disabled */25462546+ DP(NETIF_MSG_IFUP,25472547+ "single function mode without fairness\n");25482548+ }25492549+}25502550+25572551/* This function is called upon link interrupt */25582552static void bnx2x_link_attn(struct bnx2x *bp)25592553{···2577254125782542 bnx2x_link_update(&bp->link_params, &bp->link_vars);2579254325442544+ bnx2x_init_dropless_fc(bp);25452545+25802546 if (bp->link_vars.link_up) {25812581-25822582- /* dropless flow control */25832583- if (!CHIP_IS_E1(bp) && bp->dropless_fc) {25842584- int port = BP_PORT(bp);25852585- u32 pause_enabled = 0;25862586-25872587- if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_TX)25882588- pause_enabled = 1;25892589-25902590- REG_WR(bp, BAR_USTRORM_INTMEM +25912591- USTORM_ETH_PAUSE_ENABLED_OFFSET(port),25922592- pause_enabled);25932593- }2594254725952548 if (bp->link_vars.mac_type != MAC_TYPE_EMAC) {25962549 struct host_port_stats *pstats;···25932568 bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);25942569 }2595257025962596- if (bp->link_vars.link_up && bp->link_vars.line_speed) {25972597- int cmng_fns = bnx2x_get_cmng_fns_mode(bp);25982598-25992599- if (cmng_fns != CMNG_FNS_NONE) {26002600- bnx2x_cmng_fns_init(bp, false, cmng_fns);26012601- storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp));26022602- } else26032603- /* rate shaping and fairness are disabled */26042604- DP(NETIF_MSG_IFUP,26052605- "single function mode without fairness\n");26062606- }25712571+ if (bp->link_vars.link_up && bp->link_vars.line_speed)25722572+ bnx2x_set_local_cmng(bp);2607257326082574 __bnx2x_link_report(bp);26092575···96559639 &bp->sp_rtnl_state))96569640 bnx2x_pf_set_vfs_vlan(bp);9657964196429642+ if (test_and_clear_bit(BNX2X_SP_RTNL_TX_STOP, &bp->sp_rtnl_state))96439643+ bnx2x_dcbx_stop_hw_tx(bp);96449644+96459645+ if (test_and_clear_bit(BNX2X_SP_RTNL_TX_RESUME, &bp->sp_rtnl_state))96469646+ bnx2x_dcbx_resume_hw_tx(bp);96479647+96589648 /* work which needs rtnl lock not-taken (as it takes the lock itself and96599649 * can be called from other contexts as well)96609650 */···10384103621038510363 bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ?1038610364 BC_SUPPORTS_DCBX_MSG_NON_PMF : 0;1036510365+1036610366+ bp->flags |= (val >= REQ_BC_VER_4_RMMOD_CMD) ?1036710367+ BC_SUPPORTS_RMMOD_CMD : 0;1036810368+1038710369 boot_mode = SHMEM_RD(bp,1038810370 dev_info.port_feature_config[BP_PORT(bp)].mba_config) &1038910371 PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK;···1116311137 int tmp;1116411138 u32 cfg;11165111391114011140+ if (IS_VF(bp))1114111141+ return 0;1114211142+1116611143 if (IS_MF(bp) && !CHIP_IS_E1x(bp)) {1116711144 /* Take function: tmp = func */1116811145 tmp = BP_ABS_FUNC(bp);···1155311524 mutex_init(&bp->port.phy_mutex);1155411525 mutex_init(&bp->fw_mb_mutex);1155511526 spin_lock_init(&bp->stats_lock);1152711527+ sema_init(&bp->stats_sema, 1);11556115281155711529 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);1155811530 INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task);···1284712817 bnx2x_dcbnl_update_applist(bp, true);1284812818#endif12849128191282012820+ if (IS_PF(bp) &&1282112821+ !BP_NOMCP(bp) &&1282212822+ (bp->flags & BC_SUPPORTS_RMMOD_CMD))1282312823+ bnx2x_fw_command(bp, DRV_MSG_CODE_RMMOD, 0);1282412824+1285012825 /* Close the interface - either directly or implicitly */1285112826 if (remove_netdev) {1285212827 unregister_netdev(dev);1285312828 } else {1285412829 rtnl_lock();1285512855- if (netif_running(dev))1285612856- bnx2x_close(dev);1283012830+ dev_close(dev);1285712831 rtnl_unlock();1285812832 }1285912833
+34-24
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
···1747174717481748void bnx2x_iov_init_dmae(struct bnx2x *bp)17491749{17501750- DP(BNX2X_MSG_IOV, "SRIOV is %s\n", IS_SRIOV(bp) ? "ON" : "OFF");17511751- if (!IS_SRIOV(bp))17521752- return;17531753-17541754- REG_WR(bp, DMAE_REG_BACKWARD_COMP_EN, 0);17501750+ if (pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV))17511751+ REG_WR(bp, DMAE_REG_BACKWARD_COMP_EN, 0);17551752}1756175317571754static int bnx2x_vf_bus(struct bnx2x *bp, int vfid)···30813084 pci_disable_sriov(bp->pdev);30823085}3083308630843084-static int bnx2x_vf_ndo_sanity(struct bnx2x *bp, int vfidx,30853085- struct bnx2x_virtf *vf)30873087+static int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx,30883088+ struct bnx2x_virtf **vf,30893089+ struct pf_vf_bulletin_content **bulletin)30863090{30873091 if (bp->state != BNX2X_STATE_OPEN) {30883092 BNX2X_ERR("vf ndo called though PF is down\n");···31013103 return -EINVAL;31023104 }3103310531043104- if (!vf) {31063106+ /* init members */31073107+ *vf = BP_VF(bp, vfidx);31083108+ *bulletin = BP_VF_BULLETIN(bp, vfidx);31093109+31103110+ if (!*vf) {31053111 BNX2X_ERR("vf ndo called but vf was null. vfidx was %d\n",31123112+ vfidx);31133113+ return -EINVAL;31143114+ }31153115+31163116+ if (!*bulletin) {31173117+ BNX2X_ERR("vf ndo called but Bulletin Board struct is null. vfidx was %d\n",31063118 vfidx);31073119 return -EINVAL;31083120 }···31243116 struct ifla_vf_info *ivi)31253117{31263118 struct bnx2x *bp = netdev_priv(dev);31273127- struct bnx2x_virtf *vf = BP_VF(bp, vfidx);31283128- struct bnx2x_vlan_mac_obj *mac_obj = &bnx2x_vfq(vf, 0, mac_obj);31293129- struct bnx2x_vlan_mac_obj *vlan_obj = &bnx2x_vfq(vf, 0, vlan_obj);31303130- struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vfidx);31193119+ struct bnx2x_virtf *vf = NULL;31203120+ struct pf_vf_bulletin_content *bulletin = NULL;31213121+ struct bnx2x_vlan_mac_obj *mac_obj;31223122+ struct bnx2x_vlan_mac_obj *vlan_obj;31313123 int rc;3132312431333133- /* sanity */31343134- rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf);31253125+ /* sanity and init */31263126+ rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin);31353127 if (rc)31363128 return rc;31373137- if (!mac_obj || !vlan_obj || !bulletin) {31293129+ mac_obj = &bnx2x_vfq(vf, 0, mac_obj);31303130+ vlan_obj = &bnx2x_vfq(vf, 0, vlan_obj);31313131+ if (!mac_obj || !vlan_obj) {31383132 BNX2X_ERR("VF partially initialized\n");31393133 return -EINVAL;31403134 }···31933183{31943184 struct bnx2x *bp = netdev_priv(dev);31953185 int rc, q_logical_state;31963196- struct bnx2x_virtf *vf = BP_VF(bp, vfidx);31973197- struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vfidx);31863186+ struct bnx2x_virtf *vf = NULL;31873187+ struct pf_vf_bulletin_content *bulletin = NULL;3198318831993199- /* sanity */32003200- rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf);31893189+ /* sanity and init */31903190+ rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin);32013191 if (rc)32023192 return rc;32033193 if (!is_valid_ether_addr(mac)) {···32593249{32603250 struct bnx2x *bp = netdev_priv(dev);32613251 int rc, q_logical_state;32623262- struct bnx2x_virtf *vf = BP_VF(bp, vfidx);32633263- struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vfidx);32523252+ struct bnx2x_virtf *vf = NULL;32533253+ struct pf_vf_bulletin_content *bulletin = NULL;3264325432653265- /* sanity */32663266- rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf);32553255+ /* sanity and init */32563256+ rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin);32673257 if (rc)32683258 return rc;32693259···34733463alloc_mem_err:34743464 BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,34753465 sizeof(struct bnx2x_vf_mbx_msg));34763476- BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,34663466+ BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping,34773467 sizeof(union pf_vf_bulletin));34783468 return -ENOMEM;34793469}
+54-12
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
···221221 * Statistics service functions222222 */223223224224-static void bnx2x_stats_pmf_update(struct bnx2x *bp)224224+/* should be called under stats_sema */225225+static void __bnx2x_stats_pmf_update(struct bnx2x *bp)225226{226227 struct dmae_command *dmae;227228 u32 opcode;···519518 *stats_comp = 0;520519}521520522522-static void bnx2x_stats_start(struct bnx2x *bp)521521+/* should be called under stats_sema */522522+static void __bnx2x_stats_start(struct bnx2x *bp)523523{524524 /* vfs travel through here as part of the statistics FSM, but no action525525 * is required···536534537535 bnx2x_hw_stats_post(bp);538536 bnx2x_storm_stats_post(bp);537537+538538+ bp->stats_started = true;539539+}540540+541541+static void bnx2x_stats_start(struct bnx2x *bp)542542+{543543+ if (down_timeout(&bp->stats_sema, HZ/10))544544+ BNX2X_ERR("Unable to acquire stats lock\n");545545+ __bnx2x_stats_start(bp);546546+ up(&bp->stats_sema);539547}540548541549static void bnx2x_stats_pmf_start(struct bnx2x *bp)542550{551551+ if (down_timeout(&bp->stats_sema, HZ/10))552552+ BNX2X_ERR("Unable to acquire stats lock\n");543553 bnx2x_stats_comp(bp);544544- bnx2x_stats_pmf_update(bp);545545- bnx2x_stats_start(bp);554554+ __bnx2x_stats_pmf_update(bp);555555+ __bnx2x_stats_start(bp);556556+ up(&bp->stats_sema);557557+}558558+559559+static void bnx2x_stats_pmf_update(struct bnx2x *bp)560560+{561561+ if (down_timeout(&bp->stats_sema, HZ/10))562562+ BNX2X_ERR("Unable to acquire stats lock\n");563563+ __bnx2x_stats_pmf_update(bp);564564+ up(&bp->stats_sema);546565}547566548567static void bnx2x_stats_restart(struct bnx2x *bp)···573550 */574551 if (IS_VF(bp))575552 return;553553+ if (down_timeout(&bp->stats_sema, HZ/10))554554+ BNX2X_ERR("Unable to acquire stats lock\n");576555 bnx2x_stats_comp(bp);577577- bnx2x_stats_start(bp);556556+ __bnx2x_stats_start(bp);557557+ up(&bp->stats_sema);578558}579559580560static void bnx2x_bmac_stats_update(struct bnx2x *bp)···914888 /* Make sure we use the value of the counter915889 * used for sending the last stats ramrod.916890 */917917- spin_lock_bh(&bp->stats_lock);918891 cur_stats_counter = bp->stats_counter - 1;919919- spin_unlock_bh(&bp->stats_lock);920892921893 /* are storm stats valid? */922894 if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) {···12511227{12521228 u32 *stats_comp = bnx2x_sp(bp, stats_comp);1253122912541254- if (bnx2x_edebug_stats_stopped(bp))12301230+ /* we run update from timer context, so give up12311231+ * if somebody is in the middle of transition12321232+ */12331233+ if (down_trylock(&bp->stats_sema))12551234 return;12351235+12361236+ if (bnx2x_edebug_stats_stopped(bp) || !bp->stats_started)12371237+ goto out;1256123812571239 if (IS_PF(bp)) {12581240 if (*stats_comp != DMAE_COMP_VAL)12591259- return;12411241+ goto out;1260124212611243 if (bp->port.pmf)12621244 bnx2x_hw_stats_update(bp);···12721242 BNX2X_ERR("storm stats were not updated for 3 times\n");12731243 bnx2x_panic();12741244 }12751275- return;12451245+ goto out;12761246 }12771247 } else {12781248 /* vf doesn't collect HW statistics, and doesn't get completions···1286125612871257 /* vf is done */12881258 if (IS_VF(bp))12891289- return;12591259+ goto out;1290126012911261 if (netif_msg_timer(bp)) {12921262 struct bnx2x_eth_stats *estats = &bp->eth_stats;···1297126712981268 bnx2x_hw_stats_post(bp);12991269 bnx2x_storm_stats_post(bp);12701270+12711271+out:12721272+ up(&bp->stats_sema);13001273}1301127413021275static void bnx2x_port_stats_stop(struct bnx2x *bp)···13651332{13661333 int update = 0;1367133413351335+ if (down_timeout(&bp->stats_sema, HZ/10))13361336+ BNX2X_ERR("Unable to acquire stats lock\n");13371337+13381338+ bp->stats_started = false;13391339+13681340 bnx2x_stats_comp(bp);1369134113701342 if (bp->port.pmf)···13861348 bnx2x_hw_stats_post(bp);13871349 bnx2x_stats_comp(bp);13881350 }13511351+13521352+ up(&bp->stats_sema);13891353}1390135413911355static void bnx2x_stats_do_nothing(struct bnx2x *bp)···14161376void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)14171377{14181378 enum bnx2x_stats_state state;13791379+ void (*action)(struct bnx2x *bp);14191380 if (unlikely(bp->panic))14201381 return;1421138214221383 spin_lock_bh(&bp->stats_lock);14231384 state = bp->stats_state;14241385 bp->stats_state = bnx2x_stats_stm[state][event].next_state;13861386+ action = bnx2x_stats_stm[state][event].action;14251387 spin_unlock_bh(&bp->stats_lock);1426138814271427- bnx2x_stats_stm[state][event].action(bp);13891389+ action(bp);1428139014291391 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))14301392 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
···455455 q->pg_chunk.offset = 0;456456 mapping = pci_map_page(adapter->pdev, q->pg_chunk.page,457457 0, q->alloc_size, PCI_DMA_FROMDEVICE);458458- if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) {459459- __free_pages(q->pg_chunk.page, order);460460- q->pg_chunk.page = NULL;461461- return -EIO;462462- }463458 q->pg_chunk.mapping = mapping;464459 }465460 sd->pg_chunk = q->pg_chunk;···949954 return flits_to_desc(flits);950955}951956952952-953953-/* map_skb - map a packet main body and its page fragments954954- * @pdev: the PCI device955955- * @skb: the packet956956- * @addr: placeholder to save the mapped addresses957957- *958958- * map the main body of an sk_buff and its page fragments, if any.959959- */960960-static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb,961961- dma_addr_t *addr)962962-{963963- const skb_frag_t *fp, *end;964964- const struct skb_shared_info *si;965965-966966- *addr = pci_map_single(pdev, skb->data, skb_headlen(skb),967967- PCI_DMA_TODEVICE);968968- if (pci_dma_mapping_error(pdev, *addr))969969- goto out_err;970970-971971- si = skb_shinfo(skb);972972- end = &si->frags[si->nr_frags];973973-974974- for (fp = si->frags; fp < end; fp++) {975975- *++addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp),976976- DMA_TO_DEVICE);977977- if (pci_dma_mapping_error(pdev, *addr))978978- goto unwind;979979- }980980- return 0;981981-982982-unwind:983983- while (fp-- > si->frags)984984- dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp),985985- DMA_TO_DEVICE);986986-987987- pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE);988988-out_err:989989- return -ENOMEM;990990-}991991-992957/**993993- * write_sgl - populate a scatter/gather list for a packet958958+ * make_sgl - populate a scatter/gather list for a packet994959 * @skb: the packet995960 * @sgp: the SGL to populate996961 * @start: start address of skb main body data to include in the SGL997962 * @len: length of skb main body data to include in the SGL998998- * @addr: the list of the mapped addresses963963+ * @pdev: the PCI device999964 *10001000- * Copies the scatter/gather list for the buffers that make up a packet965965+ * Generates a scatter/gather list for the buffers that make up a packet1001966 * and returns the SGL size in 8-byte words. The caller must size the SGL1002967 * appropriately.1003968 */10041004-static inline unsigned int write_sgl(const struct sk_buff *skb,969969+static inline unsigned int make_sgl(const struct sk_buff *skb,1005970 struct sg_ent *sgp, unsigned char *start,10061006- unsigned int len, const dma_addr_t *addr)971971+ unsigned int len, struct pci_dev *pdev)1007972{10081008- unsigned int i, j = 0, k = 0, nfrags;973973+ dma_addr_t mapping;974974+ unsigned int i, j = 0, nfrags;10099751010976 if (len) {977977+ mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE);1011978 sgp->len[0] = cpu_to_be32(len);10121012- sgp->addr[j++] = cpu_to_be64(addr[k++]);979979+ sgp->addr[0] = cpu_to_be64(mapping);980980+ j = 1;1013981 }10149821015983 nfrags = skb_shinfo(skb)->nr_frags;1016984 for (i = 0; i < nfrags; i++) {1017985 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];1018986987987+ mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag),988988+ DMA_TO_DEVICE);1019989 sgp->len[j] = cpu_to_be32(skb_frag_size(frag));10201020- sgp->addr[j] = cpu_to_be64(addr[k++]);990990+ sgp->addr[j] = cpu_to_be64(mapping);1021991 j ^= 1;1022992 if (j == 0)1023993 ++sgp;···11381178 const struct port_info *pi,11391179 unsigned int pidx, unsigned int gen,11401180 struct sge_txq *q, unsigned int ndesc,11411141- unsigned int compl, const dma_addr_t *addr)11811181+ unsigned int compl)11421182{11431183 unsigned int flits, sgl_flits, cntrl, tso_info;11441184 struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1];···11961236 }1197123711981238 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;11991199- sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr);12391239+ sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev);1200124012011241 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen,12021242 htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl),···12271267 struct netdev_queue *txq;12281268 struct sge_qset *qs;12291269 struct sge_txq *q;12301230- dma_addr_t addr[MAX_SKB_FRAGS + 1];1231127012321271 /*12331272 * The chip min packet length is 9 octets but play safe and reject···12531294 "%s: Tx ring %u full while queue awake!\n",12541295 dev->name, q->cntxt_id & 7);12551296 return NETDEV_TX_BUSY;12561256- }12571257-12581258- if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) {12591259- dev_kfree_skb(skb);12601260- return NETDEV_TX_OK;12611297 }1262129812631299 q->in_use += ndesc;···13121358 if (likely(!skb_shared(skb)))13131359 skb_orphan(skb);1314136013151315- write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr);13611361+ write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl);13161362 check_ring_tx_db(adap, q);13171363 return NETDEV_TX_OK;13181364}···15771623 */15781624static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,15791625 struct sge_txq *q, unsigned int pidx,15801580- unsigned int gen, unsigned int ndesc,15811581- const dma_addr_t *addr)16261626+ unsigned int gen, unsigned int ndesc)15821627{15831628 unsigned int sgl_flits, flits;15841629 struct work_request_hdr *from;···1598164515991646 flits = skb_transport_offset(skb) / 8;16001647 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;16011601- sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb),16021602- skb_tail_pointer(skb) -16031603- skb_transport_header(skb), addr);16481648+ sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),16491649+ skb->tail - skb->transport_header,16501650+ adap->pdev);16041651 if (need_skb_unmap()) {16051652 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);16061653 skb->destructor = deferred_unmap_destructor;···16581705 goto again;16591706 }1660170716611661- if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) {16621662- spin_unlock(&q->lock);16631663- return NET_XMIT_SUCCESS;16641664- }16651665-16661708 gen = q->gen;16671709 q->in_use += ndesc;16681710 pidx = q->pidx;···16681720 }16691721 spin_unlock(&q->lock);1670172216711671- write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head);17231723+ write_ofld_wr(adap, skb, q, pidx, gen, ndesc);16721724 check_ring_tx_db(adap, q);16731725 return NET_XMIT_SUCCESS;16741726}···16861738 struct sge_txq *q = &qs->txq[TXQ_OFLD];16871739 const struct port_info *pi = netdev_priv(qs->netdev);16881740 struct adapter *adap = pi->adapter;16891689- unsigned int written = 0;1690174116911742 spin_lock(&q->lock);16921743again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK);···17051758 break;17061759 }1707176017081708- if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head))17091709- break;17101710-17111761 gen = q->gen;17121762 q->in_use += ndesc;17131763 pidx = q->pidx;17141764 q->pidx += ndesc;17151715- written += ndesc;17161765 if (q->pidx >= q->size) {17171766 q->pidx -= q->size;17181767 q->gen ^= 1;···17161773 __skb_unlink(skb, &q->sendq);17171774 spin_unlock(&q->lock);1718177517191719- write_ofld_wr(adap, skb, q, pidx, gen, ndesc,17201720- (dma_addr_t *)skb->head);17761776+ write_ofld_wr(adap, skb, q, pidx, gen, ndesc);17211777 spin_lock(&q->lock);17221778 }17231779 spin_unlock(&q->lock);···17261784 set_bit(TXQ_LAST_PKT_DB, &q->flags);17271785#endif17281786 wmb();17291729- if (likely(written))17301730- t3_write_reg(adap, A_SG_KDOORBELL,17311731- F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));17871787+ t3_write_reg(adap, A_SG_KDOORBELL,17881788+ F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));17321789}1733179017341791/**
+3
drivers/net/ethernet/emulex/benet/be_cmds.c
···3048304830493049 adapter->max_event_queues = le16_to_cpu(desc->eq_count);30503050 adapter->if_cap_flags = le32_to_cpu(desc->cap_flags);30513051+30523052+ /* Clear flags that driver is not interested in */30533053+ adapter->if_cap_flags &= BE_IF_CAP_FLAGS_WANT;30513054 }30523055err:30533056 mutex_unlock(&adapter->mbox_lock);
+6
drivers/net/ethernet/emulex/benet/be_cmds.h
···563563 BE_IF_FLAGS_MULTICAST = 0x1000564564};565565566566+#define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\567567+ BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\568568+ BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\569569+ BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\570570+ BE_IF_FLAGS_UNTAGGED)571571+566572/* An RX interface is an object with one or more MAC addresses and567573 * filtering capabilities. */568574struct be_cmd_req_if_create {
+1-1
drivers/net/ethernet/emulex/benet/be_main.c
···25632563 /* Wait for all pending tx completions to arrive so that25642564 * all tx skbs are freed.25652565 */25662566- be_tx_compl_clean(adapter);25672566 netif_tx_disable(netdev);25672567+ be_tx_compl_clean(adapter);2568256825692569 be_rx_qs_destroy(adapter);25702570
···21652165 if (err)21662166 goto err_out_disable_mbx_intr;2167216721682168- qlcnic_set_drv_version(adapter);21682168+ if (adapter->portnum == 0)21692169+ qlcnic_set_drv_version(adapter);2169217021702171 pci_set_drvdata(pdev, adapter);21712172···30863085 adapter->fw_fail_cnt = 0;30873086 adapter->flags &= ~QLCNIC_FW_HANG;30883087 clear_bit(__QLCNIC_RESETTING, &adapter->state);30893089- qlcnic_set_drv_version(adapter);30883088+ if (adapter->portnum == 0)30893089+ qlcnic_set_drv_version(adapter);3090309030913091 if (!qlcnic_clr_drv_state(adapter))30923092 qlcnic_schedule_work(adapter, qlcnic_fw_poll_work,
+3-3
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
···170170171171 if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) {172172 err = qlcnic_get_beacon_state(adapter, &h_beacon_state);173173- if (!err) {174174- dev_info(&adapter->pdev->dev,175175- "Failed to get current beacon state\n");173173+ if (err) {174174+ netdev_err(adapter->netdev,175175+ "Failed to get current beacon state\n");176176 } else {177177 if (h_beacon_state == QLCNIC_BEACON_DISABLE)178178 ahw->beacon_state = 0;
···10741074 u32 rxhash;1075107510761076 if (!(tun->flags & TUN_NO_PI)) {10771077- if ((len -= sizeof(pi)) > total_len)10771077+ if (len < sizeof(pi))10781078 return -EINVAL;10791079+ len -= sizeof(pi);1079108010801081 if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi)))10811082 return -EFAULT;···10841083 }1085108410861085 if (tun->flags & TUN_VNET_HDR) {10871087- if ((len -= tun->vnet_hdr_sz) > total_len)10861086+ if (len < tun->vnet_hdr_sz)10881087 return -EINVAL;10881088+ len -= tun->vnet_hdr_sz;1089108910901090 if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso)))10911091 return -EFAULT;
+10-5
drivers/net/usb/hso.c
···28162816static int hso_get_config_data(struct usb_interface *interface)28172817{28182818 struct usb_device *usbdev = interface_to_usbdev(interface);28192819- u8 config_data[17];28192819+ u8 *config_data = kmalloc(17, GFP_KERNEL);28202820 u32 if_num = interface->altsetting->desc.bInterfaceNumber;28212821 s32 result;2822282228232823+ if (!config_data)28242824+ return -ENOMEM;28232825 if (usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),28242826 0x86, 0xC0, 0, 0, config_data, 17,28252827 USB_CTRL_SET_TIMEOUT) != 0x11) {28282828+ kfree(config_data);28262829 return -EIO;28272830 }28282831···28762873 if (config_data[16] & 0x1)28772874 result |= HSO_INFO_CRC_BUG;2878287528762876+ kfree(config_data);28792877 return result;28802878}28812879···28902886 struct hso_shared_int *shared_int;28912887 struct hso_device *tmp_dev = NULL;2892288828892889+ if (interface->cur_altsetting->desc.bInterfaceClass != 0xFF) {28902890+ dev_err(&interface->dev, "Not our interface\n");28912891+ return -ENODEV;28922892+ }28932893+28932894 if_num = interface->altsetting->desc.bInterfaceNumber;2894289528952896 /* Get the interface/port specification from either driver_info or from···29042895 else29052896 port_spec = hso_get_config_data(interface);2906289729072907- if (interface->cur_altsetting->desc.bInterfaceClass != 0xFF) {29082908- dev_err(&interface->dev, "Not our interface\n");29092909- return -ENODEV;29102910- }29112898 /* Check if we need to switch to alt interfaces prior to port29122899 * configuration */29132900 if (interface->num_altsetting > 1)
···10681068 if (test_bit(STATUS_EXIT_PENDING, &priv->status))10691069 return;1070107010711071- if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))10711071+ if (!test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))10721072+ return;10731073+10741074+ if (ctx->vif)10721075 ieee80211_chswitch_done(ctx->vif, is_success);10731076}10741077
-2
drivers/net/wireless/iwlwifi/iwl-prph.h
···97979898#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800)9999100100-#define APMG_RTC_INT_STT_RFKILL (0x10000000)101101-102100/* Device system time */103101#define DEVICE_SYSTEM_TIME_REG 0xA0206C104102
+23-10
drivers/net/wireless/iwlwifi/mvm/time-event.c
···138138 schedule_work(&mvm->roc_done_wk);139139}140140141141+static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm,142142+ struct ieee80211_vif *vif,143143+ const char *errmsg)144144+{145145+ if (vif->type != NL80211_IFTYPE_STATION)146146+ return false;147147+ if (vif->bss_conf.assoc && vif->bss_conf.dtim_period)148148+ return false;149149+ if (errmsg)150150+ IWL_ERR(mvm, "%s\n", errmsg);151151+ ieee80211_connection_loss(vif);152152+ return true;153153+}154154+141155/*142156 * Handles a FW notification for an event that is known to the driver.143157 *···177163 * P2P Device discoveribility, while there are other higher priority178164 * events in the system).179165 */180180- WARN_ONCE(!le32_to_cpu(notif->status),181181- "Failed to schedule time event\n");166166+ if (WARN_ONCE(!le32_to_cpu(notif->status),167167+ "Failed to schedule time event\n")) {168168+ if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, NULL)) {169169+ iwl_mvm_te_clear_data(mvm, te_data);170170+ return;171171+ }172172+ }182173183174 if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_END) {184175 IWL_DEBUG_TE(mvm,···199180 * By now, we should have finished association200181 * and know the dtim period.201182 */202202- if (te_data->vif->type == NL80211_IFTYPE_STATION &&203203- (!te_data->vif->bss_conf.assoc ||204204- !te_data->vif->bss_conf.dtim_period)) {205205- IWL_ERR(mvm,206206- "No assocation and the time event is over already...\n");207207- ieee80211_connection_loss(te_data->vif);208208- }209209-183183+ iwl_mvm_te_check_disconnect(mvm, te_data->vif,184184+ "No assocation and the time event is over already...");210185 iwl_mvm_te_clear_data(mvm, te_data);211186 } else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) {212187 te_data->running = true;
-8
drivers/net/wireless/iwlwifi/pcie/rx.c
···888888889889 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);890890 if (hw_rfkill) {891891- /*892892- * Clear the interrupt in APMG if the NIC is going down.893893- * Note that when the NIC exits RFkill (else branch), we894894- * can't access prph and the NIC will be reset in895895- * start_hw anyway.896896- */897897- iwl_write_prph(trans, APMG_RTC_INT_STT_REG,898898- APMG_RTC_INT_STT_RFKILL);899891 set_bit(STATUS_RFKILL, &trans_pcie->status);900892 if (test_and_clear_bit(STATUS_HCMD_ACTIVE,901893 &trans_pcie->status))
+5-5
drivers/net/wireless/iwlwifi/pcie/trans.c
···15021502 spin_lock_init(&trans_pcie->reg_lock);15031503 init_waitqueue_head(&trans_pcie->ucode_write_waitq);1504150415051505- /* W/A - seems to solve weird behavior. We need to remove this if we15061506- * don't want to stay in L1 all the time. This wastes a lot of power */15071507- pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |15081508- PCIE_LINK_STATE_CLKPM);15091509-15101505 if (pci_enable_device(pdev)) {15111506 err = -ENODEV;15121507 goto out_no_pci;15131508 }15091509+15101510+ /* W/A - seems to solve weird behavior. We need to remove this if we15111511+ * don't want to stay in L1 all the time. This wastes a lot of power */15121512+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |15131513+ PCIE_LINK_STATE_CLKPM);1514151415151515 pci_set_master(pdev);15161516
···13531353 tristate "Emulex LightPulse Fibre Channel Support"13541354 depends on PCI && SCSI13551355 select SCSI_FC_ATTRS13561356- select GENERIC_CSUM13571356 select CRC_T10DIF13581357 help13591358 This lpfc driver supports the Emulex LightPulse
+1-1
drivers/staging/comedi/drivers.c
···482482 ret = comedi_device_postconfig(dev);483483 if (ret < 0) {484484 comedi_device_detach(dev);485485- module_put(dev->driver->module);485485+ module_put(driv->module);486486 }487487 /* On success, the driver module count has been incremented. */488488 return ret;
+2-2
drivers/tty/hvc/hvsi_lib.c
···341341342342 pr_devel("HVSI@%x: ... waiting handshake\n", pv->termno);343343344344- /* Try for up to 200s */345345- for (timeout = 0; timeout < 20; timeout++) {344344+ /* Try for up to 400ms */345345+ for (timeout = 0; timeout < 40; timeout++) {346346 if (pv->established)347347 goto established;348348 if (!hvsi_get_packet(pv))
+4-4
drivers/usb/class/usbtmc.c
···11191119 /* Determine if it is a Rigol or not */11201120 data->rigol_quirk = 0;11211121 dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n",11221122- data->usb_dev->descriptor.idVendor,11231123- data->usb_dev->descriptor.idProduct);11221122+ le16_to_cpu(data->usb_dev->descriptor.idVendor),11231123+ le16_to_cpu(data->usb_dev->descriptor.idProduct));11241124 for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) {11251125- if ((usbtmc_id_quirk[n].idVendor == data->usb_dev->descriptor.idVendor) &&11261126- (usbtmc_id_quirk[n].idProduct == data->usb_dev->descriptor.idProduct)) {11251125+ if ((usbtmc_id_quirk[n].idVendor == le16_to_cpu(data->usb_dev->descriptor.idVendor)) &&11261126+ (usbtmc_id_quirk[n].idProduct == le16_to_cpu(data->usb_dev->descriptor.idProduct))) {11271127 dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n");11281128 data->rigol_quirk = 1;11291129 break;
···1391139113921392 /* Behind the scheduling threshold? */13931393 if (unlikely(start < next)) {13941394+ unsigned now2 = (now - base) & (mod - 1);1394139513951396 /* USB_ISO_ASAP: Round up to the first available slot */13961397 if (urb->transfer_flags & URB_ISO_ASAP)13971398 start += (next - start + period - 1) & -period;1398139913991400 /*14001400- * Not ASAP: Use the next slot in the stream. If14011401- * the entire URB falls before the threshold, fail.14011401+ * Not ASAP: Use the next slot in the stream,14021402+ * no matter what.14021403 */14031403- else if (start + span - period < next) {14041404- ehci_dbg(ehci, "iso urb late %p (%u+%u < %u)\n",14041404+ else if (start + span - period < now2) {14051405+ ehci_dbg(ehci, "iso underrun %p (%u+%u < %u)\n",14051406 urb, start + base,14061406- span - period, next + base);14071407- status = -EXDEV;14081408- goto fail;14071407+ span - period, now2 + base);14091408 }14101409 }14111410
+7
drivers/usb/host/ohci-pci.c
···304304 pr_info("%s: " DRIVER_DESC "\n", hcd_name);305305306306 ohci_init_driver(&ohci_pci_hc_driver, &pci_overrides);307307+308308+#ifdef CONFIG_PM309309+ /* Entries for the PCI suspend/resume callbacks are special */310310+ ohci_pci_hc_driver.pci_suspend = ohci_suspend;311311+ ohci_pci_hc_driver.pci_resume = ohci_resume;312312+#endif313313+307314 return pci_register_driver(&ohci_pci_driver);308315}309316module_init(ohci_pci_init);
+1-1
drivers/usb/misc/adutux.c
···830830831831 /* let the user know what node this device is now attached to */832832 dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n",833833- udev->descriptor.idProduct, dev->serial_number,833833+ le16_to_cpu(udev->descriptor.idProduct), dev->serial_number,834834 (dev->minor - ADU_MINOR_BASE));835835exit:836836 dbg(2, " %s : leave, return value %p (dev)", __func__, dev);
+1-1
drivers/usb/phy/phy-fsl-usb.h
···1515 * 675 Mass Ave, Cambridge, MA 02139, USA.1616 */17171818-#include "otg_fsm.h"1818+#include "phy-fsm-usb.h"1919#include <linux/usb/otg.h>2020#include <linux/ioctl.h>2121
+1-1
drivers/usb/phy/phy-fsm-usb.c
···2929#include <linux/usb/gadget.h>3030#include <linux/usb/otg.h>31313232-#include "phy-otg-fsm.h"3232+#include "phy-fsm-usb.h"33333434/* Change USB protocol when there is a protocol change */3535static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
+1-1
drivers/usb/serial/keyspan.c
···23032303 if (d_details == NULL) {23042304 dev_err(&serial->dev->dev, "%s - unknown product id %x\n",23052305 __func__, le16_to_cpu(serial->dev->descriptor.idProduct));23062306- return 1;23062306+ return -ENODEV;23072307 }2308230823092309 /* Setup private data for serial driver */
···15361536 char buf[32];1537153715381538 /* try ID specific firmware first, then try generic firmware */15391539- sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor,15401540- dev->descriptor.idProduct);15391539+ sprintf(buf, "ti_usb-v%04x-p%04x.fw",15401540+ le16_to_cpu(dev->descriptor.idVendor),15411541+ le16_to_cpu(dev->descriptor.idProduct));15411542 status = request_firmware(&fw_p, buf, &dev->dev);1542154315431544 if (status != 0) {15441545 buf[0] = '\0';15451545- if (dev->descriptor.idVendor == MTS_VENDOR_ID) {15461546- switch (dev->descriptor.idProduct) {15461546+ if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) {15471547+ switch (le16_to_cpu(dev->descriptor.idProduct)) {15471548 case MTS_CDMA_PRODUCT_ID:15481549 strcpy(buf, "mts_cdma.fw");15491550 break;
+10-10
drivers/usb/serial/usb_wwan.c
···291291 tty_flip_buffer_push(&port->port);292292 } else293293 dev_dbg(dev, "%s: empty read urb received\n", __func__);294294-295295- /* Resubmit urb so we continue receiving */296296- err = usb_submit_urb(urb, GFP_ATOMIC);297297- if (err) {298298- if (err != -EPERM) {299299- dev_err(dev, "%s: resubmit read urb failed. (%d)\n", __func__, err);300300- /* busy also in error unless we are killed */301301- usb_mark_last_busy(port->serial->dev);302302- }303303- } else {294294+ }295295+ /* Resubmit urb so we continue receiving */296296+ err = usb_submit_urb(urb, GFP_ATOMIC);297297+ if (err) {298298+ if (err != -EPERM) {299299+ dev_err(dev, "%s: resubmit read urb failed. (%d)\n",300300+ __func__, err);301301+ /* busy also in error unless we are killed */304302 usb_mark_last_busy(port->serial->dev);305303 }304304+ } else {305305+ usb_mark_last_busy(port->serial->dev);306306 }307307}308308
+7-2
drivers/usb/wusbcore/wa-xfer.c
···12261226 }12271227 spin_lock_irqsave(&xfer->lock, flags);12281228 rpipe = xfer->ep->hcpriv;12291229+ if (rpipe == NULL) {12301230+ pr_debug("%s: xfer id 0x%08X has no RPIPE. %s",12311231+ __func__, wa_xfer_id(xfer),12321232+ "Probably already aborted.\n" );12331233+ goto out_unlock;12341234+ }12291235 /* Check the delayed list -> if there, release and complete */12301236 spin_lock_irqsave(&wa->xfer_list_lock, flags2);12311237 if (!list_empty(&xfer->list_node) && xfer->seg == NULL)···16501644 break;16511645 }16521646 usb_status = xfer_result->bTransferStatus & 0x3f;16531653- if (usb_status == WA_XFER_STATUS_ABORTED16541654- || usb_status == WA_XFER_STATUS_NOT_FOUND)16471647+ if (usb_status == WA_XFER_STATUS_NOT_FOUND)16551648 /* taken care of already */16561649 break;16571650 xfer_id = xfer_result->dwTransferID;
+12-1
drivers/xen/events.c
···348348349349 for_each_possible_cpu(i)350350 memset(per_cpu(cpu_evtchn_mask, i),351351- (i == 0) ? ~0 : 0, sizeof(*per_cpu(cpu_evtchn_mask, i)));351351+ (i == 0) ? ~0 : 0, NR_EVENT_CHANNELS/8);352352}353353354354static inline void clear_evtchn(int port)···14931493/* Rebind an evtchn so that it gets delivered to a specific cpu */14941494static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)14951495{14961496+ struct shared_info *s = HYPERVISOR_shared_info;14961497 struct evtchn_bind_vcpu bind_vcpu;14971498 int evtchn = evtchn_from_irq(irq);14991499+ int masked;1498150014991501 if (!VALID_EVTCHN(evtchn))15001502 return -1;···15131511 bind_vcpu.vcpu = tcpu;1514151215151513 /*15141514+ * Mask the event while changing the VCPU binding to prevent15151515+ * it being delivered on an unexpected VCPU.15161516+ */15171517+ masked = sync_test_and_set_bit(evtchn, BM(s->evtchn_mask));15181518+15191519+ /*15161520 * If this fails, it usually just indicates that we're dealing with a15171521 * virq or IPI channel, which don't actually need to be rebound. Ignore15181522 * it, but don't do the xenlinux-level rebind in that case.15191523 */15201524 if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0)15211525 bind_evtchn_to_cpu(evtchn, tcpu);15261526+15271527+ if (!masked)15281528+ unmask_evtchn(evtchn);1522152915231530 return 0;15241531}
+1-1
fs/bfs/inode.c
···4040 int block, off;41414242 inode = iget_locked(sb, ino);4343- if (IS_ERR(inode))4343+ if (!inode)4444 return ERR_PTR(-ENOMEM);4545 if (!(inode->i_state & I_NEW))4646 return inode;
+15-5
fs/bio.c
···10451045int bio_uncopy_user(struct bio *bio)10461046{10471047 struct bio_map_data *bmd = bio->bi_private;10481048- int ret = 0;10481048+ struct bio_vec *bvec;10491049+ int ret = 0, i;1049105010501050- if (!bio_flagged(bio, BIO_NULL_MAPPED))10511051- ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,10521052- bmd->nr_sgvecs, bio_data_dir(bio) == READ,10531053- 0, bmd->is_our_pages);10511051+ if (!bio_flagged(bio, BIO_NULL_MAPPED)) {10521052+ /*10531053+ * if we're in a workqueue, the request is orphaned, so10541054+ * don't copy into a random user address space, just free.10551055+ */10561056+ if (current->mm)10571057+ ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,10581058+ bmd->nr_sgvecs, bio_data_dir(bio) == READ,10591059+ 0, bmd->is_our_pages);10601060+ else if (bmd->is_our_pages)10611061+ bio_for_each_segment_all(bvec, bio, i)10621062+ __free_page(bvec->bv_page);10631063+ }10541064 bio_free_map_data(bmd);10551065 bio_put(bio);10561066 return ret;
+9-5
fs/cifs/cifsencrypt.c
···4343 server->secmech.md5 = crypto_alloc_shash("md5", 0, 0);4444 if (IS_ERR(server->secmech.md5)) {4545 cifs_dbg(VFS, "could not allocate crypto md5\n");4646- return PTR_ERR(server->secmech.md5);4646+ rc = PTR_ERR(server->secmech.md5);4747+ server->secmech.md5 = NULL;4848+ return rc;4749 }48504951 size = sizeof(struct shash_desc) +5052 crypto_shash_descsize(server->secmech.md5);5153 server->secmech.sdescmd5 = kmalloc(size, GFP_KERNEL);5254 if (!server->secmech.sdescmd5) {5353- rc = -ENOMEM;5455 crypto_free_shash(server->secmech.md5);5556 server->secmech.md5 = NULL;5656- return rc;5757+ return -ENOMEM;5758 }5859 server->secmech.sdescmd5->shash.tfm = server->secmech.md5;5960 server->secmech.sdescmd5->shash.flags = 0x0;···422421 if (blobptr + attrsize > blobend)423422 break;424423 if (type == NTLMSSP_AV_NB_DOMAIN_NAME) {425425- if (!attrsize)424424+ if (!attrsize || attrsize >= CIFS_MAX_DOMAINNAME_LEN)426425 break;427426 if (!ses->domainName) {428427 ses->domainName =···592591593592static int crypto_hmacmd5_alloc(struct TCP_Server_Info *server)594593{594594+ int rc;595595 unsigned int size;596596597597 /* check if already allocated */···602600 server->secmech.hmacmd5 = crypto_alloc_shash("hmac(md5)", 0, 0);603601 if (IS_ERR(server->secmech.hmacmd5)) {604602 cifs_dbg(VFS, "could not allocate crypto hmacmd5\n");605605- return PTR_ERR(server->secmech.hmacmd5);603603+ rc = PTR_ERR(server->secmech.hmacmd5);604604+ server->secmech.hmacmd5 = NULL;605605+ return rc;606606 }607607608608 size = sizeof(struct shash_desc) +
+5-6
fs/cifs/cifsfs.c
···147147 goto out_no_root;148148 }149149150150+ if (cifs_sb_master_tcon(cifs_sb)->nocase)151151+ sb->s_d_op = &cifs_ci_dentry_ops;152152+ else153153+ sb->s_d_op = &cifs_dentry_ops;154154+150155 sb->s_root = d_make_root(inode);151156 if (!sb->s_root) {152157 rc = -ENOMEM;153158 goto out_no_root;154159 }155155-156156- /* do that *after* d_make_root() - we want NULL ->d_op for root here */157157- if (cifs_sb_master_tcon(cifs_sb)->nocase)158158- sb->s_d_op = &cifs_ci_dentry_ops;159159- else160160- sb->s_d_op = &cifs_dentry_ops;161160162161#ifdef CONFIG_CIFS_NFSD_EXPORT163162 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
+4
fs/cifs/cifsglob.h
···4444#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)4545#define MAX_SERVER_SIZE 154646#define MAX_SHARE_SIZE 804747+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */4748#define MAX_USERNAME_SIZE 256 /* reasonable maximum for current servers */4849#define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */4950···370369 void (*generate_signingkey)(struct TCP_Server_Info *server);371370 int (*calc_signature)(struct smb_rqst *rqst,372371 struct TCP_Server_Info *server);372372+ int (*query_mf_symlink)(const unsigned char *path, char *pbuf,373373+ unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,374374+ unsigned int xid);373375};374376375377struct smb_version_values {
+3-1
fs/cifs/cifsproto.h
···497497struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,498498 work_func_t complete);499499void cifs_writedata_release(struct kref *refcount);500500-500500+int open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,501501+ unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,502502+ unsigned int xid);501503#endif /* _CIFSPROTO_H */
+4-3
fs/cifs/connect.c
···16751675 if (string == NULL)16761676 goto out_nomem;1677167716781678- if (strnlen(string, 256) == 256) {16781678+ if (strnlen(string, CIFS_MAX_DOMAINNAME_LEN)16791679+ == CIFS_MAX_DOMAINNAME_LEN) {16791680 printk(KERN_WARNING "CIFS: domain name too"16801681 " long\n");16811682 goto cifs_parse_mount_err;···2277227622782277#ifdef CONFIG_KEYS2279227822802280-/* strlen("cifs:a:") + INET6_ADDRSTRLEN + 1 */22812281-#define CIFSCREDS_DESC_SIZE (7 + INET6_ADDRSTRLEN + 1)22792279+/* strlen("cifs:a:") + CIFS_MAX_DOMAINNAME_LEN + 1 */22802280+#define CIFSCREDS_DESC_SIZE (7 + CIFS_MAX_DOMAINNAME_LEN + 1)2282228122832282/* Populate username and pw fields from keyring if possible */22842283static int
···111111 return;112112 }113113114114+ /*115115+ * If we know that the inode will need to be revalidated immediately,116116+ * then don't create a new dentry for it. We'll end up doing an on117117+ * the wire call either way and this spares us an invalidation.118118+ */119119+ if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)120120+ return;121121+114122 dentry = d_alloc(parent, name);115123 if (!dentry)116124 return;
+3-3
fs/cifs/sess.c
···197197 bytes_ret = 0;198198 } else199199 bytes_ret = cifs_strtoUTF16((__le16 *) bcc_ptr, ses->domainName,200200- 256, nls_cp);200200+ CIFS_MAX_DOMAINNAME_LEN, nls_cp);201201 bcc_ptr += 2 * bytes_ret;202202 bcc_ptr += 2; /* account for null terminator */203203···255255256256 /* copy domain */257257 if (ses->domainName != NULL) {258258- strncpy(bcc_ptr, ses->domainName, 256);259259- bcc_ptr += strnlen(ses->domainName, 256);258258+ strncpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN);259259+ bcc_ptr += strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN);260260 } /* else we will send a null domain name261261 so the server will default to its own domain */262262 *bcc_ptr = 0;
···229229 */230230static void d_free(struct dentry *dentry)231231{232232- BUG_ON(dentry->d_count);232232+ BUG_ON(dentry->d_lockref.count);233233 this_cpu_dec(nr_dentry);234234 if (dentry->d_op && dentry->d_op->d_release)235235 dentry->d_op->d_release(dentry);···467467 }468468469469 if (ref)470470- dentry->d_count--;470470+ dentry->d_lockref.count--;471471 /*472472 * inform the fs via d_prune that this dentry is about to be473473 * unhashed and destroyed.···513513 return;514514515515repeat:516516- if (dentry->d_count == 1)516516+ if (dentry->d_lockref.count == 1)517517 might_sleep();518518- spin_lock(&dentry->d_lock);519519- BUG_ON(!dentry->d_count);520520- if (dentry->d_count > 1) {521521- dentry->d_count--;522522- spin_unlock(&dentry->d_lock);518518+ if (lockref_put_or_lock(&dentry->d_lockref))523519 return;524524- }525520526521 if (dentry->d_flags & DCACHE_OP_DELETE) {527522 if (dentry->d_op->d_delete(dentry))···530535 dentry->d_flags |= DCACHE_REFERENCED;531536 dentry_lru_add(dentry);532537533533- dentry->d_count--;538538+ dentry->d_lockref.count--;534539 spin_unlock(&dentry->d_lock);535540 return;536541···585590 * We also need to leave mountpoints alone,586591 * directory or not.587592 */588588- if (dentry->d_count > 1 && dentry->d_inode) {593593+ if (dentry->d_lockref.count > 1 && dentry->d_inode) {589594 if (S_ISDIR(dentry->d_inode->i_mode) || d_mountpoint(dentry)) {590595 spin_unlock(&dentry->d_lock);591596 return -EBUSY;···601606/* This must be called with d_lock held */602607static inline void __dget_dlock(struct dentry *dentry)603608{604604- dentry->d_count++;609609+ dentry->d_lockref.count++;605610}606611607612static inline void __dget(struct dentry *dentry)608613{609609- spin_lock(&dentry->d_lock);610610- __dget_dlock(dentry);611611- spin_unlock(&dentry->d_lock);614614+ lockref_get(&dentry->d_lockref);612615}613616614617struct dentry *dget_parent(struct dentry *dentry)···627634 goto repeat;628635 }629636 rcu_read_unlock();630630- BUG_ON(!ret->d_count);631631- ret->d_count++;637637+ BUG_ON(!ret->d_lockref.count);638638+ ret->d_lockref.count++;632639 spin_unlock(&ret->d_lock);633640 return ret;634641}···711718 spin_lock(&inode->i_lock);712719 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {713720 spin_lock(&dentry->d_lock);714714- if (!dentry->d_count) {721721+ if (!dentry->d_lockref.count) {715722 __dget_dlock(dentry);716723 __d_drop(dentry);717724 spin_unlock(&dentry->d_lock);···756763 /* Prune ancestors. */757764 dentry = parent;758765 while (dentry) {759759- spin_lock(&dentry->d_lock);760760- if (dentry->d_count > 1) {761761- dentry->d_count--;762762- spin_unlock(&dentry->d_lock);766766+ if (lockref_put_or_lock(&dentry->d_lockref))763767 return;764764- }765768 dentry = dentry_kill(dentry, 1);766769 }767770}···782793 * the LRU because of laziness during lookup. Do not free783794 * it - just keep it off the LRU list.784795 */785785- if (dentry->d_count) {796796+ if (dentry->d_lockref.count) {786797 dentry_lru_del(dentry);787798 spin_unlock(&dentry->d_lock);788799 continue;···902913 dentry_lru_del(dentry);903914 __d_shrink(dentry);904915905905- if (dentry->d_count != 0) {916916+ if (dentry->d_lockref.count != 0) {906917 printk(KERN_ERR907918 "BUG: Dentry %p{i=%lx,n=%s}"908919 " still in use (%d)"···911922 dentry->d_inode ?912923 dentry->d_inode->i_ino : 0UL,913924 dentry->d_name.name,914914- dentry->d_count,925925+ dentry->d_lockref.count,915926 dentry->d_sb->s_type->name,916927 dentry->d_sb->s_id);917928 BUG();···922933 list_del(&dentry->d_u.d_child);923934 } else {924935 parent = dentry->d_parent;925925- parent->d_count--;936936+ parent->d_lockref.count--;926937 list_del(&dentry->d_u.d_child);927938 }928939···970981971982 dentry = sb->s_root;972983 sb->s_root = NULL;973973- dentry->d_count--;984984+ dentry->d_lockref.count--;974985 shrink_dcache_for_umount_subtree(dentry);975986976987 while (!hlist_bl_empty(&sb->s_anon)) {···11361147 * loop in shrink_dcache_parent() might not make any progress11371148 * and loop forever.11381149 */11391139- if (dentry->d_count) {11501150+ if (dentry->d_lockref.count) {11401151 dentry_lru_del(dentry);11411152 } else if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {11421153 dentry_lru_move_list(dentry, dispose);···12581269 smp_wmb();12591270 dentry->d_name.name = dname;1260127112611261- dentry->d_count = 1;12721272+ dentry->d_lockref.count = 1;12621273 dentry->d_flags = 0;12631274 spin_lock_init(&dentry->d_lock);12641275 seqcount_init(&dentry->d_seq);···19591970 goto next;19601971 }1961197219621962- dentry->d_count++;19731973+ dentry->d_lockref.count++;19631974 found = dentry;19641975 spin_unlock(&dentry->d_lock);19651976 break;···20582069 spin_lock(&dentry->d_lock);20592070 inode = dentry->d_inode;20602071 isdir = S_ISDIR(inode->i_mode);20612061- if (dentry->d_count == 1) {20722072+ if (dentry->d_lockref.count == 1) {20622073 if (!spin_trylock(&inode->i_lock)) {20632074 spin_unlock(&dentry->d_lock);20642075 cpu_relax();···27132724 return memcpy(buffer, temp, sz);27142725}2715272627272727+char *simple_dname(struct dentry *dentry, char *buffer, int buflen)27282728+{27292729+ char *end = buffer + buflen;27302730+ /* these dentries are never renamed, so d_lock is not needed */27312731+ if (prepend(&end, &buflen, " (deleted)", 11) ||27322732+ prepend_name(&end, &buflen, &dentry->d_name) ||27332733+ prepend(&end, &buflen, "/", 1)) 27342734+ end = ERR_PTR(-ENAMETOOLONG);27352735+ return end; 27362736+}27372737+27162738/*27172739 * Write full pathname from the root of the filesystem into the buffer.27182740 */···29372937 }29382938 if (!(dentry->d_flags & DCACHE_GENOCIDE)) {29392939 dentry->d_flags |= DCACHE_GENOCIDE;29402940- dentry->d_count--;29402940+ dentry->d_lockref.count--;29412941 }29422942 spin_unlock(&dentry->d_lock);29432943 }···29452945 struct dentry *child = this_parent;29462946 if (!(this_parent->d_flags & DCACHE_GENOCIDE)) {29472947 this_parent->d_flags |= DCACHE_GENOCIDE;29482948- this_parent->d_count--;29482948+ this_parent->d_lockref.count--;29492949 }29502950 this_parent = try_to_ascend(this_parent, locked, seq);29512951 if (!this_parent)
+1-1
fs/efs/inode.c
···5757 struct inode *inode;58585959 inode = iget_locked(super, ino);6060- if (IS_ERR(inode))6060+ if (!inode)6161 return ERR_PTR(-ENOMEM);6262 if (!(inode->i_state & I_NEW))6363 return inode;
+2-2
fs/exec.c
···608608 return -ENOMEM;609609610610 lru_add_drain();611611- tlb_gather_mmu(&tlb, mm, 0);611611+ tlb_gather_mmu(&tlb, mm, old_start, old_end);612612 if (new_end > old_start) {613613 /*614614 * when the old and new regions overlap clear from new_end.···625625 free_pgd_range(&tlb, old_start, old_end, new_end,626626 vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);627627 }628628- tlb_finish_mmu(&tlb, new_end, old_end);628628+ tlb_finish_mmu(&tlb, old_start, old_end);629629630630 /*631631 * Shrink the vma to just the new range. Always succeeds.
+1
fs/ext4/ext4.h
···20862086extern void ext4_dirty_inode(struct inode *, int);20872087extern int ext4_change_inode_journal_flag(struct inode *, int);20882088extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);20892089+extern int ext4_inode_attach_jinode(struct inode *inode);20892090extern int ext4_can_truncate(struct inode *inode);20902091extern void ext4_truncate(struct inode *);20912092extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
+4-4
fs/ext4/ext4_jbd2.c
···255255 set_buffer_prio(bh);256256 if (ext4_handle_valid(handle)) {257257 err = jbd2_journal_dirty_metadata(handle, bh);258258- if (err) {259259- /* Errors can only happen if there is a bug */260260- handle->h_err = err;261261- __ext4_journal_stop(where, line, handle);258258+ /* Errors can only happen if there is a bug */259259+ if (WARN_ON_ONCE(err)) {260260+ ext4_journal_abort_handle(where, line, __func__, bh,261261+ handle, err);262262 }263263 } else {264264 if (inode)
+4-17
fs/ext4/file.c
···219219{220220 struct super_block *sb = inode->i_sb;221221 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);222222- struct ext4_inode_info *ei = EXT4_I(inode);223222 struct vfsmount *mnt = filp->f_path.mnt;224223 struct path path;225224 char buf[64], *cp;···258259 * Set up the jbd2_inode if we are opening the inode for259260 * writing and the journal is present260261 */261261- if (sbi->s_journal && !ei->jinode && (filp->f_mode & FMODE_WRITE)) {262262- struct jbd2_inode *jinode = jbd2_alloc_inode(GFP_KERNEL);263263-264264- spin_lock(&inode->i_lock);265265- if (!ei->jinode) {266266- if (!jinode) {267267- spin_unlock(&inode->i_lock);268268- return -ENOMEM;269269- }270270- ei->jinode = jinode;271271- jbd2_journal_init_jbd_inode(ei->jinode, inode);272272- jinode = NULL;273273- }274274- spin_unlock(&inode->i_lock);275275- if (unlikely(jinode != NULL))276276- jbd2_free_inode(jinode);262262+ if (filp->f_mode & FMODE_WRITE) {263263+ int ret = ext4_inode_attach_jinode(inode);264264+ if (ret < 0)265265+ return ret;277266 }278267 return dquot_file_open(inode, filp);279268}
+43
fs/ext4/inode.c
···35333533 offset;35343534 }3535353535363536+ if (offset & (sb->s_blocksize - 1) ||35373537+ (offset + length) & (sb->s_blocksize - 1)) {35383538+ /*35393539+ * Attach jinode to inode for jbd2 if we do any zeroing of35403540+ * partial block35413541+ */35423542+ ret = ext4_inode_attach_jinode(inode);35433543+ if (ret < 0)35443544+ goto out_mutex;35453545+35463546+ }35473547+35363548 first_block_offset = round_up(offset, sb->s_blocksize);35373549 last_block_offset = round_down((offset + length), sb->s_blocksize) - 1;35383550···36133601 return ret;36143602}3615360336043604+int ext4_inode_attach_jinode(struct inode *inode)36053605+{36063606+ struct ext4_inode_info *ei = EXT4_I(inode);36073607+ struct jbd2_inode *jinode;36083608+36093609+ if (ei->jinode || !EXT4_SB(inode->i_sb)->s_journal)36103610+ return 0;36113611+36123612+ jinode = jbd2_alloc_inode(GFP_KERNEL);36133613+ spin_lock(&inode->i_lock);36143614+ if (!ei->jinode) {36153615+ if (!jinode) {36163616+ spin_unlock(&inode->i_lock);36173617+ return -ENOMEM;36183618+ }36193619+ ei->jinode = jinode;36203620+ jbd2_journal_init_jbd_inode(ei->jinode, inode);36213621+ jinode = NULL;36223622+ }36233623+ spin_unlock(&inode->i_lock);36243624+ if (unlikely(jinode != NULL))36253625+ jbd2_free_inode(jinode);36263626+ return 0;36273627+}36283628+36163629/*36173630 * ext4_truncate()36183631 *···3695365836963659 ext4_inline_data_truncate(inode, &has_inline);36973660 if (has_inline)36613661+ return;36623662+ }36633663+36643664+ /* If we zero-out tail of the page, we have to create jinode for jbd2 */36653665+ if (inode->i_size & (inode->i_sb->s_blocksize - 1)) {36663666+ if (ext4_inode_attach_jinode(inode) < 0)36983667 return;36993668 }37003669
···463463 return inode;464464}465465466466+/*467467+ * Hugetlbfs is not reclaimable; therefore its i_mmap_mutex will never468468+ * be taken from reclaim -- unlike regular filesystems. This needs an469469+ * annotation because huge_pmd_share() does an allocation under470470+ * i_mmap_mutex.471471+ */472472+struct lock_class_key hugetlbfs_i_mmap_mutex_key;473473+466474static struct inode *hugetlbfs_get_inode(struct super_block *sb,467475 struct inode *dir,468476 umode_t mode, dev_t dev)···482474 struct hugetlbfs_inode_info *info;483475 inode->i_ino = get_next_ino();484476 inode_init_owner(inode, dir, mode);477477+ lockdep_set_class(&inode->i_mapping->i_mmap_mutex,478478+ &hugetlbfs_i_mmap_mutex_key);485479 inode->i_mapping->a_ops = &hugetlbfs_aops;486480 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;487481 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;···926916 return h - hstates;927917}928918929929-static char *hugetlb_dname(struct dentry *dentry, char *buffer, int buflen)930930-{931931- return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",932932- dentry->d_name.name);933933-}934934-935919static struct dentry_operations anon_ops = {936936- .d_dname = hugetlb_dname920920+ .d_dname = simple_dname937921};938922939923/*
+23-8
fs/jfs/jfs_dtree.c
···3047304730483048 dir_index = (u32) ctx->pos;3049304930503050+ /*30513051+ * NFSv4 reserves cookies 1 and 2 for . and .. so the value30523052+ * we return to the vfs is one greater than the one we use30533053+ * internally.30543054+ */30553055+ if (dir_index)30563056+ dir_index--;30573057+30503058 if (dir_index > 1) {30513059 struct dir_table_slot dirtab_slot;30523060···30943086 if (p->header.flag & BT_INTERNAL) {30953087 jfs_err("jfs_readdir: bad index table");30963088 DT_PUTPAGE(mp);30973097- ctx->pos = -1;30893089+ ctx->pos = DIREND;30983090 return 0;30993091 }31003092 } else {···31023094 /*31033095 * self "."31043096 */31053105- ctx->pos = 0;30973097+ ctx->pos = 1;31063098 if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))31073099 return 0;31083100 }31093101 /*31103102 * parent ".."31113103 */31123112- ctx->pos = 1;31043104+ ctx->pos = 2;31133105 if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))31143106 return 0;31153107···31303122 /*31313123 * Legacy filesystem - OS/2 & Linux JFS < 0.3.631323124 *31333133- * pn = index = 0: First entry "."31343134- * pn = 0; index = 1: Second entry ".."31253125+ * pn = 0; index = 1: First entry "."31263126+ * pn = 0; index = 2: Second entry ".."31353127 * pn > 0: Real entries, pn=1 -> leftmost page31363128 * pn = index = -1: No more entries31373129 */31383130 dtpos = ctx->pos;31393139- if (dtpos == 0) {31313131+ if (dtpos < 2) {31403132 /* build "." entry */31333133+ ctx->pos = 1;31413134 if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))31423135 return 0;31433143- dtoffset->index = 1;31363136+ dtoffset->index = 2;31443137 ctx->pos = dtpos;31453138 }3146313931473140 if (dtoffset->pn == 0) {31483148- if (dtoffset->index == 1) {31413141+ if (dtoffset->index == 2) {31493142 /* build ".." entry */31503143 if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))31513144 return 0;···32373228 }32383229 jfs_dirent->position = unique_pos++;32393230 }32313231+ /*32323232+ * We add 1 to the index because we may32333233+ * use a value of 2 internally, and NFSv432343234+ * doesn't like that.32353235+ */32363236+ jfs_dirent->position++;32403237 } else {32413238 jfs_dirent->position = dtpos;32423239 len = min(d_namleft, DTLHDRDATALEN_LEGACY);
+10-6
fs/namei.c
···536536 * a reference at this point.537537 */538538 BUG_ON(!IS_ROOT(dentry) && dentry->d_parent != parent);539539- BUG_ON(!parent->d_count);540540- parent->d_count++;539539+ BUG_ON(!parent->d_lockref.count);540540+ parent->d_lockref.count++;541541 spin_unlock(&dentry->d_lock);542542 }543543 spin_unlock(&parent->d_lock);···33273327{33283328 shrink_dcache_parent(dentry);33293329 spin_lock(&dentry->d_lock);33303330- if (dentry->d_count == 1)33303330+ if (dentry->d_lockref.count == 1)33313331 __d_drop(dentry);33323332 spin_unlock(&dentry->d_lock);33333333}···36713671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)36723672 return -EINVAL;36733673 /*36743674- * Using empty names is equivalent to using AT_SYMLINK_FOLLOW36753675- * on /proc/self/fd/<fd>.36743674+ * To use null names we require CAP_DAC_READ_SEARCH36753675+ * This ensures that not everyone will be able to create36763676+ * handlink using the passed filedescriptor.36763677 */36773677- if (flags & AT_EMPTY_PATH)36783678+ if (flags & AT_EMPTY_PATH) {36793679+ if (!capable(CAP_DAC_READ_SEARCH))36803680+ return -ENOENT;36783681 how = LOOKUP_EMPTY;36823682+ }3679368336803684 if (flags & AT_SYMLINK_FOLLOW)36813685 how |= LOOKUP_FOLLOW;
···11+#ifndef __LINUX_LOCKREF_H22+#define __LINUX_LOCKREF_H33+44+/*55+ * Locked reference counts.66+ *77+ * These are different from just plain atomic refcounts in that they88+ * are atomic with respect to the spinlock that goes with them. In99+ * particular, there can be implementations that don't actually get1010+ * the spinlock for the common decrement/increment operations, but they1111+ * still have to check that the operation is done semantically as if1212+ * the spinlock had been taken (using a cmpxchg operation that covers1313+ * both the lock and the count word, or using memory transactions, for1414+ * example).1515+ */1616+1717+#include <linux/spinlock.h>1818+1919+struct lockref {2020+ spinlock_t lock;2121+ unsigned int count;2222+};2323+2424+/**2525+ * lockref_get - Increments reference count unconditionally2626+ * @lockcnt: pointer to lockref structure2727+ *2828+ * This operation is only valid if you already hold a reference2929+ * to the object, so you know the count cannot be zero.3030+ */3131+static inline void lockref_get(struct lockref *lockref)3232+{3333+ spin_lock(&lockref->lock);3434+ lockref->count++;3535+ spin_unlock(&lockref->lock);3636+}3737+3838+/**3939+ * lockref_get_not_zero - Increments count unless the count is 04040+ * @lockcnt: pointer to lockref structure4141+ * Return: 1 if count updated successfully or 0 if count is 04242+ */4343+static inline int lockref_get_not_zero(struct lockref *lockref)4444+{4545+ int retval = 0;4646+4747+ spin_lock(&lockref->lock);4848+ if (lockref->count) {4949+ lockref->count++;5050+ retval = 1;5151+ }5252+ spin_unlock(&lockref->lock);5353+ return retval;5454+}5555+5656+/**5757+ * lockref_put_or_lock - decrements count unless count <= 1 before decrement5858+ * @lockcnt: pointer to lockref structure5959+ * Return: 1 if count updated successfully or 0 if count <= 1 and lock taken6060+ */6161+static inline int lockref_put_or_lock(struct lockref *lockref)6262+{6363+ spin_lock(&lockref->lock);6464+ if (lockref->count <= 1)6565+ return 0;6666+ lockref->count--;6767+ spin_unlock(&lockref->lock);6868+ return 1;6969+}7070+7171+#endif /* __LINUX_LOCKREF_H */
···332332 unsigned long pgoff, unsigned long flags);333333#endif334334 unsigned long mmap_base; /* base of mmap area */335335+ unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */335336 unsigned long task_size; /* size of task vm space */336337 unsigned long highest_vm_end; /* highest vma end address */337338 pgd_t * pgd;
···15351535 * Test if a process is not yet dead (at most zombie state)15361536 * If pid_alive fails, then pointers within the task structure15371537 * can be stale and must not be dereferenced.15381538+ *15391539+ * Return: 1 if the process is alive. 0 otherwise.15381540 */15391541static inline int pid_alive(struct task_struct *p)15401542{···15481546 * @tsk: Task structure to be checked.15491547 *15501548 * Check if a task structure is the first user space task the kernel created.15491549+ *15501550+ * Return: 1 if the task structure is init. 0 otherwise.15511551 */15521552static inline int is_global_init(struct task_struct *tsk)15531553{···19011897/**19021898 * is_idle_task - is the specified task an idle task?19031899 * @p: the task in question.19001900+ *19011901+ * Return: 1 if @p is an idle task. 0 otherwise.19041902 */19051903static inline bool is_idle_task(const struct task_struct *p)19061904{
+11-3
include/linux/spinlock.h
···117117#endif /*arch_spin_is_contended*/118118#endif119119120120-/* The lock does not imply full memory barrier. */121121-#ifndef ARCH_HAS_SMP_MB_AFTER_LOCK122122-static inline void smp_mb__after_lock(void) { smp_mb(); }120120+/*121121+ * Despite its name it doesn't necessarily has to be a full barrier.122122+ * It should only guarantee that a STORE before the critical section123123+ * can not be reordered with a LOAD inside this section.124124+ * spin_lock() is the one-way barrier, this LOAD can not escape out125125+ * of the region. So the default implementation simply ensures that126126+ * a STORE can not move into the critical section, smp_wmb() should127127+ * serialize it with another STORE done by spin_lock().128128+ */129129+#ifndef smp_mb__before_spinlock130130+#define smp_mb__before_spinlock() smp_wmb()123131#endif124132125133/**
···802802asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,803803 int __user *);804804#else805805+#ifdef CONFIG_CLONE_BACKWARDS3806806+asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *,807807+ int __user *, int);808808+#else805809asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,806810 int __user *, int);811811+#endif807812#endif808813809814asmlinkage long sys_execve(const char __user *filename,
+57
include/linux/wait.h
···811811 __ret; \812812})813813814814+#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \815815+ lock, ret) \816816+do { \817817+ DEFINE_WAIT(__wait); \818818+ \819819+ for (;;) { \820820+ prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \821821+ if (condition) \822822+ break; \823823+ if (signal_pending(current)) { \824824+ ret = -ERESTARTSYS; \825825+ break; \826826+ } \827827+ spin_unlock_irq(&lock); \828828+ ret = schedule_timeout(ret); \829829+ spin_lock_irq(&lock); \830830+ if (!ret) \831831+ break; \832832+ } \833833+ finish_wait(&wq, &__wait); \834834+} while (0)835835+836836+/**837837+ * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses.838838+ * The condition is checked under the lock. This is expected839839+ * to be called with the lock taken.840840+ * @wq: the waitqueue to wait on841841+ * @condition: a C expression for the event to wait for842842+ * @lock: a locked spinlock_t, which will be released before schedule()843843+ * and reacquired afterwards.844844+ * @timeout: timeout, in jiffies845845+ *846846+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the847847+ * @condition evaluates to true or signal is received. The @condition is848848+ * checked each time the waitqueue @wq is woken up.849849+ *850850+ * wake_up() has to be called after changing any variable that could851851+ * change the result of the wait condition.852852+ *853853+ * This is supposed to be called while holding the lock. The lock is854854+ * dropped before going to sleep and is reacquired afterwards.855855+ *856856+ * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it857857+ * was interrupted by a signal, and the remaining jiffies otherwise858858+ * if the condition evaluated to true before the timeout elapsed.859859+ */860860+#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \861861+ timeout) \862862+({ \863863+ int __ret = timeout; \864864+ \865865+ if (!(condition)) \866866+ __wait_event_interruptible_lock_irq_timeout( \867867+ wq, condition, lock, __ret); \868868+ __ret; \869869+})870870+814871815872/*816873 * These are the old interfaces to sleep waiting for an event.
+1-6
include/net/busy_poll.h
···122122 if (rc > 0)123123 /* local bh are disabled so it is ok to use _BH */124124 NET_ADD_STATS_BH(sock_net(sk),125125- LINUX_MIB_LOWLATENCYRXPACKETS, rc);125125+ LINUX_MIB_BUSYPOLLRXPACKETS, rc);126126127127 } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&128128 !need_resched() && !busy_loop_timeout(end_time));···158158}159159160160static inline bool sk_can_busy_loop(struct sock *sk)161161-{162162- return false;163163-}164164-165165-static inline bool sk_busy_poll(struct sock *sk, int nonblock)166161{167162 return false;168163}
+2
include/net/ip6_route.h
···135135extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,136136 __be32 mtu);137137extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);138138+extern void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,139139+ u32 mark);138140extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);139141140142struct netlink_callback;
···955955 Memory Resource Controller Swap Extension comes with its price in956956 a bigger memory consumption. General purpose distribution kernels957957 which want to enable the feature but keep it disabled by default958958- and let the user enable it by swapaccount boot command line958958+ and let the user enable it by swapaccount=1 boot command line959959 parameter should have this option unselected.960960 For those who want to have the feature enabled by default should961961 select this option (if, for some reason, they need to disable it
+3-2
ipc/msg.c
···839839840840static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode)841841{842842- struct msg_msg *msg;842842+ struct msg_msg *msg, *found = NULL;843843 long count = 0;844844845845 list_for_each_entry(msg, &msq->q_messages, m_list) {···848848 *msgtyp, mode)) {849849 if (mode == SEARCH_LESSEQUAL && msg->m_type != 1) {850850 *msgtyp = msg->m_type - 1;851851+ found = msg;851852 } else if (mode == SEARCH_NUMBER) {852853 if (*msgtyp == count)853854 return msg;···858857 }859858 }860859861861- return ERR_PTR(-EAGAIN);860860+ return found ?: ERR_PTR(-EAGAIN);862861}863862864863long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgflg,
+13-7
kernel/cpuset.c
···475475476476 /*477477 * Cpusets with tasks - existing or newly being attached - can't478478- * have empty cpus_allowed or mems_allowed.478478+ * be changed to have empty cpus_allowed or mems_allowed.479479 */480480 ret = -ENOSPC;481481- if ((cgroup_task_count(cur->css.cgroup) || cur->attach_in_progress) &&482482- (cpumask_empty(trial->cpus_allowed) &&483483- nodes_empty(trial->mems_allowed)))484484- goto out;481481+ if ((cgroup_task_count(cur->css.cgroup) || cur->attach_in_progress)) {482482+ if (!cpumask_empty(cur->cpus_allowed) &&483483+ cpumask_empty(trial->cpus_allowed))484484+ goto out;485485+ if (!nodes_empty(cur->mems_allowed) &&486486+ nodes_empty(trial->mems_allowed))487487+ goto out;488488+ }485489486490 ret = 0;487491out:···16121608{16131609 struct cpuset *cs = cgroup_cs(cgrp);16141610 cpuset_filetype_t type = cft->private;16151615- int retval = -ENODEV;16111611+ int retval = 0;1616161216171613 mutex_lock(&cpuset_mutex);16181618- if (!is_cpuset_online(cs))16141614+ if (!is_cpuset_online(cs)) {16151615+ retval = -ENODEV;16191616 goto out_unlock;16171617+ }1620161816211619 switch (type) {16221620 case FILE_CPU_EXCLUSIVE:
+6
kernel/fork.c
···16791679 int __user *, parent_tidptr,16801680 int __user *, child_tidptr,16811681 int, tls_val)16821682+#elif defined(CONFIG_CLONE_BACKWARDS3)16831683+SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp,16841684+ int, stack_size,16851685+ int __user *, parent_tidptr,16861686+ int __user *, child_tidptr,16871687+ int, tls_val)16821688#else16831689SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,16841690 int __user *, parent_tidptr,
+2-2
kernel/mutex.c
···686686 might_sleep();687687 ret = __mutex_lock_common(&lock->base, TASK_UNINTERRUPTIBLE,688688 0, &ctx->dep_map, _RET_IP_, ctx);689689- if (!ret && ctx->acquired > 0)689689+ if (!ret && ctx->acquired > 1)690690 return ww_mutex_deadlock_injection(lock, ctx);691691692692 return ret;···702702 ret = __mutex_lock_common(&lock->base, TASK_INTERRUPTIBLE,703703 0, &ctx->dep_map, _RET_IP_, ctx);704704705705- if (!ret && ctx->acquired > 0)705705+ if (!ret && ctx->acquired > 1)706706 return ww_mutex_deadlock_injection(lock, ctx);707707708708 return ret;
+13-7
kernel/power/qos.c
···296296}297297EXPORT_SYMBOL_GPL(pm_qos_request_active);298298299299+static void __pm_qos_update_request(struct pm_qos_request *req,300300+ s32 new_value)301301+{302302+ trace_pm_qos_update_request(req->pm_qos_class, new_value);303303+304304+ if (new_value != req->node.prio)305305+ pm_qos_update_target(306306+ pm_qos_array[req->pm_qos_class]->constraints,307307+ &req->node, PM_QOS_UPDATE_REQ, new_value);308308+}309309+299310/**300311 * pm_qos_work_fn - the timeout handler of pm_qos_update_request_timeout301312 * @work: work struct for the delayed work (timeout)···319308 struct pm_qos_request,320309 work);321310322322- pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE);311311+ __pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE);323312}324313325314/**···375364 }376365377366 cancel_delayed_work_sync(&req->work);378378-379379- trace_pm_qos_update_request(req->pm_qos_class, new_value);380380- if (new_value != req->node.prio)381381- pm_qos_update_target(382382- pm_qos_array[req->pm_qos_class]->constraints,383383- &req->node, PM_QOS_UPDATE_REQ, new_value);367367+ __pm_qos_update_request(req, new_value);384368}385369EXPORT_SYMBOL_GPL(pm_qos_update_request);386370
+74-22
kernel/sched/core.c
···933933/**934934 * task_curr - is this task currently executing on a CPU?935935 * @p: the task in question.936936+ *937937+ * Return: 1 if the task is currently executing. 0 otherwise.936938 */937939inline int task_curr(const struct task_struct *p)938940{···14841482 * the simpler "current->state = TASK_RUNNING" to mark yourself14851483 * runnable without the overhead of this.14861484 *14871487- * Returns %true if @p was woken up, %false if it was already running14851485+ * Return: %true if @p was woken up, %false if it was already running.14881486 * or @state didn't match @p's state.14891487 */14901488static int···14931491 unsigned long flags;14941492 int cpu, success = 0;1495149314961496- smp_wmb();14941494+ /*14951495+ * If we are going to wake up a thread waiting for CONDITION we14961496+ * need to ensure that CONDITION=1 done by the caller can not be14971497+ * reordered with p->state check below. This pairs with mb() in14981498+ * set_current_state() the waiting thread does.14991499+ */15001500+ smp_mb__before_spinlock();14971501 raw_spin_lock_irqsave(&p->pi_lock, flags);14981502 if (!(p->state & state))14991503 goto out;···15851577 * @p: The process to be woken up.15861578 *15871579 * Attempt to wake up the nominated process and move it to the set of runnable15881588- * processes. Returns 1 if the process was woken up, 0 if it was already15891589- * running.15801580+ * processes.15811581+ *15821582+ * Return: 1 if the process was woken up, 0 if it was already running.15901583 *15911584 * It may be assumed that this function implies a write memory barrier before15921585 * changing the task state if and only if any tasks are woken up.···22002191 * This makes sure that uptime, CFS vruntime, load22012192 * balancing, etc... continue to move forward, even22022193 * with a very low granularity.21942194+ *21952195+ * Return: Maximum deferment in nanoseconds.22032196 */22042197u64 scheduler_tick_max_deferment(void)22052198{···24052394 if (sched_feat(HRTICK))24062395 hrtick_clear(rq);2407239623972397+ /*23982398+ * Make sure that signal_pending_state()->signal_pending() below23992399+ * can't be reordered with __set_current_state(TASK_INTERRUPTIBLE)24002400+ * done by the caller to avoid the race with signal_wake_up().24012401+ */24022402+ smp_mb__before_spinlock();24082403 raw_spin_lock_irq(&rq->lock);2409240424102405 switch_count = &prev->nivcsw;···28132796 * specified timeout to expire. The timeout is in jiffies. It is not28142797 * interruptible.28152798 *28162816- * The return value is 0 if timed out, and positive (at least 1, or number of28172817- * jiffies left till timeout) if completed.27992799+ * Return: 0 if timed out, and positive (at least 1, or number of jiffies left28002800+ * till timeout) if completed.28182801 */28192802unsigned long __sched28202803wait_for_completion_timeout(struct completion *x, unsigned long timeout)···28462829 * specified timeout to expire. The timeout is in jiffies. It is not28472830 * interruptible. The caller is accounted as waiting for IO.28482831 *28492849- * The return value is 0 if timed out, and positive (at least 1, or number of28502850- * jiffies left till timeout) if completed.28322832+ * Return: 0 if timed out, and positive (at least 1, or number of jiffies left28332833+ * till timeout) if completed.28512834 */28522835unsigned long __sched28532836wait_for_completion_io_timeout(struct completion *x, unsigned long timeout)···28632846 * This waits for completion of a specific task to be signaled. It is28642847 * interruptible.28652848 *28662866- * The return value is -ERESTARTSYS if interrupted, 0 if completed.28492849+ * Return: -ERESTARTSYS if interrupted, 0 if completed.28672850 */28682851int __sched wait_for_completion_interruptible(struct completion *x)28692852{···28822865 * This waits for either a completion of a specific task to be signaled or for a28832866 * specified timeout to expire. It is interruptible. The timeout is in jiffies.28842867 *28852885- * The return value is -ERESTARTSYS if interrupted, 0 if timed out,28862886- * positive (at least 1, or number of jiffies left till timeout) if completed.28682868+ * Return: -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1,28692869+ * or number of jiffies left till timeout) if completed.28872870 */28882871long __sched28892872wait_for_completion_interruptible_timeout(struct completion *x,···29002883 * This waits to be signaled for completion of a specific task. It can be29012884 * interrupted by a kill signal.29022885 *29032903- * The return value is -ERESTARTSYS if interrupted, 0 if completed.28862886+ * Return: -ERESTARTSYS if interrupted, 0 if completed.29042887 */29052888int __sched wait_for_completion_killable(struct completion *x)29062889{···29202903 * signaled or for a specified timeout to expire. It can be29212904 * interrupted by a kill signal. The timeout is in jiffies.29222905 *29232923- * The return value is -ERESTARTSYS if interrupted, 0 if timed out,29242924- * positive (at least 1, or number of jiffies left till timeout) if completed.29062906+ * Return: -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1,29072907+ * or number of jiffies left till timeout) if completed.29252908 */29262909long __sched29272910wait_for_completion_killable_timeout(struct completion *x,···29352918 * try_wait_for_completion - try to decrement a completion without blocking29362919 * @x: completion structure29372920 *29382938- * Returns: 0 if a decrement cannot be done without blocking29212921+ * Return: 0 if a decrement cannot be done without blocking29392922 * 1 if a decrement succeeded.29402923 *29412924 * If a completion is being used as a counting completion,···29622945 * completion_done - Test to see if a completion has any waiters29632946 * @x: completion structure29642947 *29652965- * Returns: 0 if there are waiters (wait_for_completion() in progress)29482948+ * Return: 0 if there are waiters (wait_for_completion() in progress)29662949 * 1 if there are no waiters.29672950 *29682951 */···31993182 * task_prio - return the priority value of a given task.32003183 * @p: the task in question.32013184 *32023202- * This is the priority value as seen by users in /proc.31853185+ * Return: The priority value as seen by users in /proc.32033186 * RT tasks are offset by -200. Normal tasks are centered32043187 * around 0, value goes from -16 to +15.32053188 */···32113194/**32123195 * task_nice - return the nice value of a given task.32133196 * @p: the task in question.31973197+ *31983198+ * Return: The nice value [ -20 ... 0 ... 19 ].32143199 */32153200int task_nice(const struct task_struct *p)32163201{···32233204/**32243205 * idle_cpu - is a given cpu idle currently?32253206 * @cpu: the processor in question.32073207+ *32083208+ * Return: 1 if the CPU is currently idle. 0 otherwise.32263209 */32273210int idle_cpu(int cpu)32283211{···32473226/**32483227 * idle_task - return the idle task for a given cpu.32493228 * @cpu: the processor in question.32293229+ *32303230+ * Return: The idle task for the cpu @cpu.32503231 */32513232struct task_struct *idle_task(int cpu)32523233{···32583235/**32593236 * find_process_by_pid - find a process with a matching PID value.32603237 * @pid: the pid in question.32383238+ *32393239+ * The task of @pid, if found. %NULL otherwise.32613240 */32623241static struct task_struct *find_process_by_pid(pid_t pid)32633242{···34573432 * @policy: new policy.34583433 * @param: structure containing the new RT priority.34593434 *34353435+ * Return: 0 on success. An error code otherwise.34363436+ *34603437 * NOTE that the task may be already dead.34613438 */34623439int sched_setscheduler(struct task_struct *p, int policy,···34783451 * current context has permission. For example, this is needed in34793452 * stop_machine(): we create temporary high priority worker threads,34803453 * but our caller might not have that capability.34543454+ *34553455+ * Return: 0 on success. An error code otherwise.34813456 */34823457int sched_setscheduler_nocheck(struct task_struct *p, int policy,34833458 const struct sched_param *param)···35143485 * @pid: the pid in question.35153486 * @policy: new policy.35163487 * @param: structure containing the new RT priority.34883488+ *34893489+ * Return: 0 on success. An error code otherwise.35173490 */35183491SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,35193492 struct sched_param __user *, param)···35313500 * sys_sched_setparam - set/change the RT priority of a thread35323501 * @pid: the pid in question.35333502 * @param: structure containing the new RT priority.35033503+ *35043504+ * Return: 0 on success. An error code otherwise.35343505 */35353506SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)35363507{···35423509/**35433510 * sys_sched_getscheduler - get the policy (scheduling class) of a thread35443511 * @pid: the pid in question.35123512+ *35133513+ * Return: On success, the policy of the thread. Otherwise, a negative error35143514+ * code.35453515 */35463516SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)35473517{···35713535 * sys_sched_getparam - get the RT priority of a thread35723536 * @pid: the pid in question.35733537 * @param: structure containing the RT priority.35383538+ *35393539+ * Return: On success, 0 and the RT priority is in @param. Otherwise, an error35403540+ * code.35743541 */35753542SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)35763543{···36983659 * @pid: pid of the process36993660 * @len: length in bytes of the bitmask pointed to by user_mask_ptr37003661 * @user_mask_ptr: user-space pointer to the new cpu mask36623662+ *36633663+ * Return: 0 on success. An error code otherwise.37013664 */37023665SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,37033666 unsigned long __user *, user_mask_ptr)···37513710 * @pid: pid of the process37523711 * @len: length in bytes of the bitmask pointed to by user_mask_ptr37533712 * @user_mask_ptr: user-space pointer to hold the current cpu mask37133713+ *37143714+ * Return: 0 on success. An error code otherwise.37543715 */37553716SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,37563717 unsigned long __user *, user_mask_ptr)···37873744 *37883745 * This function yields the current CPU to other tasks. If there are no37893746 * other threads running on this CPU then this function will return.37473747+ *37483748+ * Return: 0.37903749 */37913750SYSCALL_DEFINE0(sched_yield)37923751{···39143869 * It's the caller's job to ensure that the target task struct39153870 * can't go away on us before we can do any checks.39163871 *39173917- * Returns:38723872+ * Return:39183873 * true (>0) if we indeed boosted the target task.39193874 * false (0) if we failed to boost the target.39203875 * -ESRCH if there's no task to yield to.···40173972 * sys_sched_get_priority_max - return maximum RT priority.40183973 * @policy: scheduling class.40193974 *40204020- * this syscall returns the maximum rt_priority that can be used40214021- * by a given scheduling class.39753975+ * Return: On success, this syscall returns the maximum39763976+ * rt_priority that can be used by a given scheduling class.39773977+ * On failure, a negative error code is returned.40223978 */40233979SYSCALL_DEFINE1(sched_get_priority_max, int, policy)40243980{···40433997 * sys_sched_get_priority_min - return minimum RT priority.40443998 * @policy: scheduling class.40453999 *40464046- * this syscall returns the minimum rt_priority that can be used40474047- * by a given scheduling class.40004000+ * Return: On success, this syscall returns the minimum40014001+ * rt_priority that can be used by a given scheduling class.40024002+ * On failure, a negative error code is returned.40484003 */40494004SYSCALL_DEFINE1(sched_get_priority_min, int, policy)40504005{···40714024 *40724025 * this syscall writes the default timeslice value of a given process40734026 * into the user-space timespec buffer. A value of '0' means infinity.40274027+ *40284028+ * Return: On success, 0 and the timeslice is in @interval. Otherwise,40294029+ * an error code.40744030 */40754031SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,40764032 struct timespec __user *, interval)···66876637 * @cpu: the processor in question.66886638 *66896639 * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!66406640+ *66416641+ * Return: The current task for @cpu.66906642 */66916643struct task_struct *curr_task(int cpu)66926644{
+2-2
kernel/sched/cpupri.c
···6262 * any discrepancies created by racing against the uncertainty of the current6363 * priority configuration.6464 *6565- * Returns: (int)bool - CPUs were found6565+ * Return: (int)bool - CPUs were found6666 */6767int cpupri_find(struct cpupri *cp, struct task_struct *p,6868 struct cpumask *lowest_mask)···203203 * cpupri_init - initialize the cpupri structure204204 * @cp: The cpupri context205205 *206206- * Returns: -ENOMEM if memory fails.206206+ * Return: -ENOMEM on memory allocation failure.207207 */208208int cpupri_init(struct cpupri *cp)209209{
+8-2
kernel/sched/fair.c
···20322032 */20332033 update_entity_load_avg(curr, 1);20342034 update_cfs_rq_blocked_load(cfs_rq, 1);20352035+ update_cfs_shares(cfs_rq);2035203620362037#ifdef CONFIG_SCHED_HRTICK20372038 /*···43254324 * get_sd_load_idx - Obtain the load index for a given sched domain.43264325 * @sd: The sched_domain whose load_idx is to be obtained.43274326 * @idle: The Idle status of the CPU for whose sd load_icx is obtained.43274327+ *43284328+ * Return: The load index.43284329 */43294330static inline int get_sd_load_idx(struct sched_domain *sd,43304331 enum cpu_idle_type idle)···46214618 *46224619 * Determine if @sg is a busier group than the previously selected46234620 * busiest group.46214621+ *46224622+ * Return: %true if @sg is a busier group than the previously selected46234623+ * busiest group. %false otherwise.46244624 */46254625static bool update_sd_pick_busiest(struct lb_env *env,46264626 struct sd_lb_stats *sds,···47414735 * assuming lower CPU number will be equivalent to lower a SMT thread47424736 * number.47434737 *47444744- * Returns 1 when packing is required and a task should be moved to47384738+ * Return: 1 when packing is required and a task should be moved to47454739 * this CPU. The amount of the imbalance is returned in *imbalance.47464740 *47474741 * @env: The load balancing environment.···49194913 * @balance: Pointer to a variable indicating if this_cpu49204914 * is the appropriate cpu to perform load balancing at this_level.49214915 *49224922- * Returns: - the busiest group if imbalance exists.49164916+ * Return: - The busiest group if imbalance exists.49234917 * - If no imbalance and user has opted for power-savings balance,49244918 * return the least loaded group whose CPUs can be49254919 * put to idle by rebalancing its tasks onto our group.
+1-1
kernel/time/sched_clock.c
···121121 BUG_ON(bits > 32);122122 WARN_ON(!irqs_disabled());123123 read_sched_clock = read;124124- sched_clock_mask = (1 << bits) - 1;124124+ sched_clock_mask = (1ULL << bits) - 1;125125 cd.rate = rate;126126127127 /* calculate the mult/shift to convert counter ticks to ns. */
+2-3
kernel/time/tick-sched.c
···182182 * Don't allow the user to think they can get183183 * full NO_HZ with this machine.184184 */185185- WARN_ONCE(1, "NO_HZ FULL will not work with unstable sched clock");185185+ WARN_ONCE(have_nohz_full_mask,186186+ "NO_HZ FULL will not work with unstable sched clock");186187 return false;187188 }188189#endif···344343345344void __init tick_nohz_init(void)346345{347347- int cpu;348348-349346 if (!have_nohz_full_mask) {350347 if (tick_nohz_init_all() < 0)351348 return;
···363363364364/**365365 * wake_up_atomic_t - Wake up a waiter on a atomic_t366366- * @word: The word being waited on, a kernel virtual address367367- * @bit: The bit of the word being waited on366366+ * @p: The atomic_t being waited on, a kernel virtual address368367 *369368 * Wake up anyone waiting for the atomic_t to go to zero.370369 *
···5757 unsigned long addr, unsigned long pgoff, pgprot_t prot)5858{5959 int err = -ENOMEM;6060- pte_t *pte;6060+ pte_t *pte, ptfile;6161 spinlock_t *ptl;62626363 pte = get_locked_pte(mm, addr, &ptl);6464 if (!pte)6565 goto out;66666767- if (!pte_none(*pte))6868- zap_pte(mm, vma, addr, pte);6767+ ptfile = pgoff_to_pte(pgoff);69687070- set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff));6969+ if (!pte_none(*pte)) {7070+ if (pte_present(*pte) && pte_soft_dirty(*pte))7171+ pte_file_mksoft_dirty(ptfile);7272+ zap_pte(mm, vma, addr, pte);7373+ }7474+7575+ set_pte_at(mm, addr, pte, ptfile);7176 /*7277 * We don't need to run update_mmu_cache() here because the "file pte"7378 * being installed by install_file_pte() is not a real pte - it's a
+1-1
mm/hugetlb.c
···2490249024912491 mm = vma->vm_mm;2492249224932493- tlb_gather_mmu(&tlb, mm, 0);24932493+ tlb_gather_mmu(&tlb, mm, start, end);24942494 __unmap_hugepage_range(&tlb, vma, start, end, ref_page);24952495 tlb_finish_mmu(&tlb, start, end);24962496}
+2-3
mm/memcontrol.c
···31953195 if (!s->memcg_params)31963196 return -ENOMEM;3197319731983198- INIT_WORK(&s->memcg_params->destroy,31993199- kmem_cache_destroy_work_func);32003198 if (memcg) {32013199 s->memcg_params->memcg = memcg;32023200 s->memcg_params->root_cache = root_cache;32013201+ INIT_WORK(&s->memcg_params->destroy,32023202+ kmem_cache_destroy_work_func);32033203 } else32043204 s->memcg_params->is_root_cache = true;32053205···69696969#ifdef CONFIG_MEMCG_SWAP69706970static int __init enable_swap_account(char *s)69716971{69726972- /* consider enabled if no parameter or 1 is given */69736972 if (!strcmp(s, "1"))69746973 really_do_swap_account = 1;69756974 else if (!strcmp(s, "0"))
+31-18
mm/memory.c
···209209 * tear-down from @mm. The @fullmm argument is used when @mm is without210210 * users and we're going to destroy the full address space (exit/execve).211211 */212212-void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm)212212+void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)213213{214214 tlb->mm = mm;215215216216- tlb->fullmm = fullmm;216216+ /* Is it from 0 to ~0? */217217+ tlb->fullmm = !(start | (end+1));217218 tlb->need_flush_all = 0;218218- tlb->start = -1UL;219219- tlb->end = 0;219219+ tlb->start = start;220220+ tlb->end = end;220221 tlb->need_flush = 0;221222 tlb->local.next = NULL;222223 tlb->local.nr = 0;···257256{258257 struct mmu_gather_batch *batch, *next;259258260260- tlb->start = start;261261- tlb->end = end;262259 tlb_flush_mmu(tlb);263260264261 /* keep the page table cache within bounds */···10981099 spinlock_t *ptl;10991100 pte_t *start_pte;11001101 pte_t *pte;11011101- unsigned long range_start = addr;1102110211031103again:11041104 init_rss_vec(rss);···11391141 continue;11401142 if (unlikely(details) && details->nonlinear_vma11411143 && linear_page_index(details->nonlinear_vma,11421142- addr) != page->index)11431143- set_pte_at(mm, addr, pte,11441144- pgoff_to_pte(page->index));11441144+ addr) != page->index) {11451145+ pte_t ptfile = pgoff_to_pte(page->index);11461146+ if (pte_soft_dirty(ptent))11471147+ pte_file_mksoft_dirty(ptfile);11481148+ set_pte_at(mm, addr, pte, ptfile);11491149+ }11451150 if (PageAnon(page))11461151 rss[MM_ANONPAGES]--;11471152 else {···12031202 * and page-free while holding it.12041203 */12051204 if (force_flush) {12051205+ unsigned long old_end;12061206+12061207 force_flush = 0;1207120812081208-#ifdef HAVE_GENERIC_MMU_GATHER12091209- tlb->start = range_start;12091209+ /*12101210+ * Flush the TLB just for the previous segment,12111211+ * then update the range to be the remaining12121212+ * TLB range.12131213+ */12141214+ old_end = tlb->end;12101215 tlb->end = addr;12111211-#endif12161216+12121217 tlb_flush_mmu(tlb);12131213- if (addr != end) {12141214- range_start = addr;12181218+12191219+ tlb->start = addr;12201220+ tlb->end = old_end;12211221+12221222+ if (addr != end)12151223 goto again;12161216- }12171224 }1218122512191226 return addr;···14061397 unsigned long end = start + size;1407139814081399 lru_add_drain();14091409- tlb_gather_mmu(&tlb, mm, 0);14001400+ tlb_gather_mmu(&tlb, mm, start, end);14101401 update_hiwater_rss(mm);14111402 mmu_notifier_invalidate_range_start(mm, start, end);14121403 for ( ; vma && vma->vm_start < end; vma = vma->vm_next)···14321423 unsigned long end = address + size;1433142414341425 lru_add_drain();14351435- tlb_gather_mmu(&tlb, mm, 0);14261426+ tlb_gather_mmu(&tlb, mm, address, end);14361427 update_hiwater_rss(mm);14371428 mmu_notifier_invalidate_range_start(mm, address, end);14381429 unmap_single_vma(&tlb, vma, address, end, details);···31243115 exclusive = 1;31253116 }31263117 flush_icache_page(vma, page);31183118+ if (pte_swp_soft_dirty(orig_pte))31193119+ pte = pte_mksoft_dirty(pte);31273120 set_pte_at(mm, address, page_table, pte);31283121 if (page == swapcache)31293122 do_page_add_anon_rmap(page, vma, address, exclusive);···34193408 entry = mk_pte(page, vma->vm_page_prot);34203409 if (flags & FAULT_FLAG_WRITE)34213410 entry = maybe_mkwrite(pte_mkdirty(entry), vma);34113411+ else if (pte_file(orig_pte) && pte_file_soft_dirty(orig_pte))34123412+ pte_mksoft_dirty(entry);34223413 if (anon) {34233414 inc_mm_counter_fast(mm, MM_ANONPAGES);34243415 page_add_new_anon_rmap(page, vma, address);
+2-2
mm/mmap.c
···23362336 struct mmu_gather tlb;2337233723382338 lru_add_drain();23392339- tlb_gather_mmu(&tlb, mm, 0);23392339+ tlb_gather_mmu(&tlb, mm, start, end);23402340 update_hiwater_rss(mm);23412341 unmap_vmas(&tlb, vma, start, end);23422342 free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,···2709270927102710 lru_add_drain();27112711 flush_cache_mm(mm);27122712- tlb_gather_mmu(&tlb, mm, 1);27122712+ tlb_gather_mmu(&tlb, mm, 0, -1);27132713 /* update_hiwater_rss(mm) here? but nobody should be looking */27142714 /* Use -1 here to ensure all VMAs in the mm are unmapped */27152715 unmap_vmas(&tlb, vma, 0, -1);
+20-1
mm/mremap.c
···1515#include <linux/swap.h>1616#include <linux/capability.h>1717#include <linux/fs.h>1818+#include <linux/swapops.h>1819#include <linux/highmem.h>1920#include <linux/security.h>2021#include <linux/syscalls.h>···6867 VM_BUG_ON(pmd_trans_huge(*pmd));69687069 return pmd;7070+}7171+7272+static pte_t move_soft_dirty_pte(pte_t pte)7373+{7474+ /*7575+ * Set soft dirty bit so we can notice7676+ * in userspace the ptes were moved.7777+ */7878+#ifdef CONFIG_MEM_SOFT_DIRTY7979+ if (pte_present(pte))8080+ pte = pte_mksoft_dirty(pte);8181+ else if (is_swap_pte(pte))8282+ pte = pte_swp_mksoft_dirty(pte);8383+ else if (pte_file(pte))8484+ pte = pte_file_mksoft_dirty(pte);8585+#endif8686+ return pte;7187}72887389static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,···144126 continue;145127 pte = ptep_get_and_clear(mm, old_addr, old_pte);146128 pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);147147- set_pte_at(mm, new_addr, new_pte, pte_mksoft_dirty(pte));129129+ pte = move_soft_dirty_pte(pte);130130+ set_pte_at(mm, new_addr, new_pte, pte);148131 }149132150133 arch_leave_lazy_mmu_mode();
+11-3
mm/rmap.c
···12361236 swp_entry_to_pte(make_hwpoison_entry(page)));12371237 } else if (PageAnon(page)) {12381238 swp_entry_t entry = { .val = page_private(page) };12391239+ pte_t swp_pte;1239124012401241 if (PageSwapCache(page)) {12411242 /*···12651264 BUG_ON(TTU_ACTION(flags) != TTU_MIGRATION);12661265 entry = make_migration_entry(page, pte_write(pteval));12671266 }12681268- set_pte_at(mm, address, pte, swp_entry_to_pte(entry));12671267+ swp_pte = swp_entry_to_pte(entry);12681268+ if (pte_soft_dirty(pteval))12691269+ swp_pte = pte_swp_mksoft_dirty(swp_pte);12701270+ set_pte_at(mm, address, pte, swp_pte);12691271 BUG_ON(pte_file(*pte));12701272 } else if (IS_ENABLED(CONFIG_MIGRATION) &&12711273 (TTU_ACTION(flags) == TTU_MIGRATION)) {···14051401 pteval = ptep_clear_flush(vma, address, pte);1406140214071403 /* If nonlinear, store the file page offset in the pte. */14081408- if (page->index != linear_page_index(vma, address))14091409- set_pte_at(mm, address, pte, pgoff_to_pte(page->index));14041404+ if (page->index != linear_page_index(vma, address)) {14051405+ pte_t ptfile = pgoff_to_pte(page->index);14061406+ if (pte_soft_dirty(pteval))14071407+ pte_file_mksoft_dirty(ptfile);14081408+ set_pte_at(mm, address, pte, ptfile);14091409+ }1410141014111411 /* Move the dirty bit to the physical page now the pte is gone. */14121412 if (pte_dirty(pteval))
···162162163163static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx)164164{165165+ if (!s->memcg_params)166166+ return NULL;165167 return s->memcg_params->memcg_caches[idx];166168}167169
+17-2
mm/swapfile.c
···866866}867867#endif /* CONFIG_HIBERNATION */868868869869+static inline int maybe_same_pte(pte_t pte, pte_t swp_pte)870870+{871871+#ifdef CONFIG_MEM_SOFT_DIRTY872872+ /*873873+ * When pte keeps soft dirty bit the pte generated874874+ * from swap entry does not has it, still it's same875875+ * pte from logical point of view.876876+ */877877+ pte_t swp_pte_dirty = pte_swp_mksoft_dirty(swp_pte);878878+ return pte_same(pte, swp_pte) || pte_same(pte, swp_pte_dirty);879879+#else880880+ return pte_same(pte, swp_pte);881881+#endif882882+}883883+869884/*870885 * No need to decide whether this PTE shares the swap entry with others,871886 * just let do_wp_page work it out if a write is requested later - to···907892 }908893909894 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);910910- if (unlikely(!pte_same(*pte, swp_entry_to_pte(entry)))) {895895+ if (unlikely(!maybe_same_pte(*pte, swp_entry_to_pte(entry)))) {911896 mem_cgroup_cancel_charge_swapin(memcg);912897 ret = 0;913898 goto out;···962947 * swapoff spends a _lot_ of time in this loop!963948 * Test inline before going to call unuse_pte.964949 */965965- if (unlikely(pte_same(*pte, swp_pte))) {950950+ if (unlikely(maybe_same_pte(*pte, swp_pte))) {966951 pte_unmap(pte);967952 ret = unuse_pte(vma, pmd, addr, entry, page);968953 if (ret)
+6-1
net/8021q/vlan_core.c
···91919292struct net_device *vlan_dev_real_dev(const struct net_device *dev)9393{9494- return vlan_dev_priv(dev)->real_dev;9494+ struct net_device *ret = vlan_dev_priv(dev)->real_dev;9595+9696+ while (is_vlan_dev(ret))9797+ ret = vlan_dev_priv(ret)->real_dev;9898+9999+ return ret;95100}96101EXPORT_SYMBOL(vlan_dev_real_dev);97102
+2
net/batman-adv/bridge_loop_avoidance.c
···15291529 * in these cases, the skb is further handled by this function and15301530 * returns 1, otherwise it returns 0 and the caller shall further15311531 * process the skb.15321532+ *15331533+ * This call might reallocate skb data.15321534 */15331535int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,15341536 unsigned short vid)
+12-1
net/batman-adv/gateway_client.c
···508508 return 0;509509}510510511511+/* this call might reallocate skb data */511512static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len)512513{513514 int ret = false;···569568 return ret;570569}571570571571+/* this call might reallocate skb data */572572bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)573573{574574 struct ethhdr *ethhdr;···621619622620 if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr)))623621 return false;622622+623623+ /* skb->data might have been reallocated by pskb_may_pull() */624624+ ethhdr = (struct ethhdr *)skb->data;625625+ if (ntohs(ethhdr->h_proto) == ETH_P_8021Q)626626+ ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN);627627+624628 udphdr = (struct udphdr *)(skb->data + *header_len);625629 *header_len += sizeof(*udphdr);626630···642634 return true;643635}644636637637+/* this call might reallocate skb data */645638bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,646646- struct sk_buff *skb, struct ethhdr *ethhdr)639639+ struct sk_buff *skb)647640{648641 struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL;649642 struct batadv_orig_node *orig_dst_node = NULL;650643 struct batadv_gw_node *curr_gw = NULL;644644+ struct ethhdr *ethhdr;651645 bool ret, out_of_range = false;652646 unsigned int header_len = 0;653647 uint8_t curr_tq_avg;···658648 if (!ret)659649 goto out;660650651651+ ethhdr = (struct ethhdr *)skb->data;661652 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,662653 ethhdr->h_dest);663654 if (!orig_dst_node)
···180180 if (batadv_bla_tx(bat_priv, skb, vid))181181 goto dropped;182182183183+ /* skb->data might have been reallocated by batadv_bla_tx() */184184+ ethhdr = (struct ethhdr *)skb->data;185185+183186 /* Register the client MAC in the transtable */184187 if (!is_multicast_ether_addr(ethhdr->h_source))185188 batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif);···223220 default:224221 break;225222 }223223+224224+ /* reminder: ethhdr might have become unusable from here on225225+ * (batadv_gw_is_dhcp_target() might have reallocated skb data)226226+ */226227 }227228228229 /* ethernet packet should be broadcasted */···273266 /* unicast packet */274267 } else {275268 if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) {276276- ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr);269269+ ret = batadv_gw_out_of_range(bat_priv, skb);277270 if (ret)278271 goto dropped;279272 }
+17-6
net/batman-adv/unicast.c
···326326 * @skb: the skb containing the payload to encapsulate327327 * @orig_node: the destination node328328 *329329- * Returns false if the payload could not be encapsulated or true otherwise329329+ * Returns false if the payload could not be encapsulated or true otherwise.330330+ *331331+ * This call might reallocate skb data.330332 */331333static bool batadv_unicast_prepare_skb(struct sk_buff *skb,332334 struct batadv_orig_node *orig_node)···345343 * @orig_node: the destination node346344 * @packet_subtype: the batman 4addr packet subtype to use347345 *348348- * Returns false if the payload could not be encapsulated or true otherwise346346+ * Returns false if the payload could not be encapsulated or true otherwise.347347+ *348348+ * This call might reallocate skb data.349349 */350350bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv,351351 struct sk_buff *skb,···405401 struct batadv_neigh_node *neigh_node;406402 int data_len = skb->len;407403 int ret = NET_RX_DROP;408408- unsigned int dev_mtu;404404+ unsigned int dev_mtu, header_len;409405410406 /* get routing information */411407 if (is_multicast_ether_addr(ethhdr->h_dest)) {···432428433429 switch (packet_type) {434430 case BATADV_UNICAST:435435- batadv_unicast_prepare_skb(skb, orig_node);431431+ if (!batadv_unicast_prepare_skb(skb, orig_node))432432+ goto out;433433+434434+ header_len = sizeof(struct batadv_unicast_packet);436435 break;437436 case BATADV_UNICAST_4ADDR:438438- batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,439439- packet_subtype);437437+ if (!batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,438438+ packet_subtype))439439+ goto out;440440+441441+ header_len = sizeof(struct batadv_unicast_4addr_packet);440442 break;441443 default:442444 /* this function supports UNICAST and UNICAST_4ADDR only. It···451441 goto out;452442 }453443444444+ ethhdr = (struct ethhdr *)(skb->data + header_len);454445 unicast_packet = (struct batadv_unicast_packet *)skb->data;455446456447 /* inform the destination node that we are still missing a correct route
+5-5
net/bridge/br_fdb.c
···161161 if (!pv)162162 return;163163164164- for_each_set_bit_from(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {164164+ for_each_set_bit_from(vid, pv->vlan_bitmap, VLAN_N_VID) {165165 f = __br_fdb_get(br, br->dev->dev_addr, vid);166166 if (f && f->is_local && !f->dst)167167 fdb_delete(br, f);···730730 /* VID was specified, so use it. */731731 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);732732 } else {733733- if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN)) {733733+ if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) {734734 err = __br_fdb_add(ndm, p, addr, nlh_flags, 0);735735 goto out;736736 }···739739 * specify a VLAN. To be nice, add/update entry for every740740 * vlan on this port.741741 */742742- for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {742742+ for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {743743 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);744744 if (err)745745 goto out;···817817818818 err = __br_fdb_delete(p, addr, vid);819819 } else {820820- if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN)) {820820+ if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) {821821 err = __br_fdb_delete(p, addr, 0);822822 goto out;823823 }···827827 * vlan on this port.828828 */829829 err = -ENOENT;830830- for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {830830+ for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {831831 err &= __br_fdb_delete(p, addr, vid);832832 }833833 }
+1-1
net/bridge/br_multicast.c
···11951195 max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay));11961196 if (max_delay)11971197 group = &mld->mld_mca;11981198- } else if (skb->len >= sizeof(*mld2q)) {11981198+ } else {11991199 if (!pskb_may_pull(skb, sizeof(*mld2q))) {12001200 err = -EINVAL;12011201 goto out;
···11211121 goto wait_for_memory;1122112211231123 /*11241124+ * All packets are restored as if they have11251125+ * already been sent.11261126+ */11271127+ if (tp->repair)11281128+ TCP_SKB_CB(skb)->when = tcp_time_stamp;11291129+11301130+ /*11241131 * Check whether we can use HW checksum.11251132 */11261133 if (sk->sk_route_caps & NETIF_F_ALL_CSUM)
+7-5
net/ipv4/tcp_cubic.c
···206206 */207207static inline void bictcp_update(struct bictcp *ca, u32 cwnd)208208{209209- u64 offs;210210- u32 delta, t, bic_target, max_cnt;209209+ u32 delta, bic_target, max_cnt;210210+ u64 offs, t;211211212212 ca->ack_cnt++; /* count the number of ACKs */213213···250250 * if the cwnd < 1 million packets !!!251251 */252252253253+ t = (s32)(tcp_time_stamp - ca->epoch_start);254254+ t += msecs_to_jiffies(ca->delay_min >> 3);253255 /* change the unit from HZ to bictcp_HZ */254254- t = ((tcp_time_stamp + msecs_to_jiffies(ca->delay_min>>3)255255- - ca->epoch_start) << BICTCP_HZ) / HZ;256256+ t <<= BICTCP_HZ;257257+ do_div(t, HZ);256258257259 if (t < ca->bic_K) /* t - K */258260 offs = ca->bic_K - t;···416414 return;417415418416 /* Discard delay samples right after fast recovery */419419- if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ)417417+ if (ca->epoch_start && (s32)(tcp_time_stamp - ca->epoch_start) < HZ)420418 return;421419422420 delay = (rtt_us << 3) / USEC_PER_MSEC;
···419419 nfmsg->version = NFNETLINK_V0;420420 nfmsg->res_id = htons(inst->group_num);421421422422+ memset(&pmsg, 0, sizeof(pmsg));422423 pmsg.hw_protocol = skb->protocol;423424 pmsg.hook = hooknum;424425···499498 if (indev && skb->dev &&500499 skb->mac_header != skb->network_header) {501500 struct nfulnl_msg_packet_hw phw;502502- int len = dev_parse_header(skb, phw.hw_addr);501501+ int len;502502+503503+ memset(&phw, 0, sizeof(phw));504504+ len = dev_parse_header(skb, phw.hw_addr);503505 if (len > 0) {504506 phw.hw_addrlen = htons(len);505507 if (nla_put(inst->skb, NFULA_HWADDR, sizeof(phw), &phw))
+4-1
net/netfilter/nfnetlink_queue_core.c
···463463 if (indev && entskb->dev &&464464 entskb->mac_header != entskb->network_header) {465465 struct nfqnl_msg_packet_hw phw;466466- int len = dev_parse_header(entskb, phw.hw_addr);466466+ int len;467467+468468+ memset(&phw, 0, sizeof(phw));469469+ len = dev_parse_header(entskb, phw.hw_addr);467470 if (len) {468471 phw.hw_addrlen = htons(len);469472 if (nla_put(skb, NFQA_HWADDR, sizeof(phw), &phw))
+17-13
net/netfilter/xt_TCPMSS.c
···5252{5353 const struct xt_tcpmss_info *info = par->targinfo;5454 struct tcphdr *tcph;5555- unsigned int tcplen, i;5555+ int len, tcp_hdrlen;5656+ unsigned int i;5657 __be16 oldval;5758 u16 newmss;5859 u8 *opt;···6564 if (!skb_make_writable(skb, skb->len))6665 return -1;67666868- tcplen = skb->len - tcphoff;6969- tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);6767+ len = skb->len - tcphoff;6868+ if (len < (int)sizeof(struct tcphdr))6969+ return -1;70707171- /* Header cannot be larger than the packet */7272- if (tcplen < tcph->doff*4)7171+ tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);7272+ tcp_hdrlen = tcph->doff * 4;7373+7474+ if (len < tcp_hdrlen)7375 return -1;74767577 if (info->mss == XT_TCPMSS_CLAMP_PMTU) {···9187 newmss = info->mss;92889389 opt = (u_int8_t *)tcph;9494- for (i = sizeof(struct tcphdr); i < tcph->doff*4; i += optlen(opt, i)) {9595- if (opt[i] == TCPOPT_MSS && tcph->doff*4 - i >= TCPOLEN_MSS &&9696- opt[i+1] == TCPOLEN_MSS) {9090+ for (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) {9191+ if (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) {9792 u_int16_t oldmss;98939994 oldmss = (opt[i+2] << 8) | opt[i+3];···115112 }116113117114 /* There is data after the header so the option can't be added118118- without moving it, and doing so may make the SYN packet119119- itself too large. Accept the packet unmodified instead. */120120- if (tcplen > tcph->doff*4)115115+ * without moving it, and doing so may make the SYN packet116116+ * itself too large. Accept the packet unmodified instead.117117+ */118118+ if (len > tcp_hdrlen)121119 return 0;122120123121 /*···147143 newmss = min(newmss, (u16)1220);148144149145 opt = (u_int8_t *)tcph + sizeof(struct tcphdr);150150- memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));146146+ memmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr));151147152148 inet_proto_csum_replace2(&tcph->check, skb,153153- htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1);149149+ htons(len), htons(len + TCPOLEN_MSS), 1);154150 opt[0] = TCPOPT_MSS;155151 opt[1] = TCPOLEN_MSS;156152 opt[2] = (newmss & 0xff00) >> 8;
+6-4
net/netfilter/xt_TCPOPTSTRIP.c
···3838 struct tcphdr *tcph;3939 u_int16_t n, o;4040 u_int8_t *opt;4141- int len;4141+ int len, tcp_hdrlen;42424343 /* This is a fragment, no TCP header is available */4444 if (par->fragoff != 0)···5252 return NF_DROP;53535454 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);5555- if (tcph->doff * 4 > len)5555+ tcp_hdrlen = tcph->doff * 4;5656+5757+ if (len < tcp_hdrlen)5658 return NF_DROP;57595860 opt = (u_int8_t *)tcph;···6361 * Walk through all TCP options - if we find some option to remove,6462 * set all octets to %TCPOPT_NOP and adjust checksum.6563 */6666- for (i = sizeof(struct tcphdr); i < tcp_hdrlen(skb); i += optl) {6464+ for (i = sizeof(struct tcphdr); i < tcp_hdrlen - 1; i += optl) {6765 optl = optlen(opt, i);68666969- if (i + optl > tcp_hdrlen(skb))6767+ if (i + optl > tcp_hdrlen)7068 break;71697270 if (!tcpoptstrip_test_bit(info->strip_bmap, opt[i]))
···240240 struct flex_array *buckets;241241 int i, err;242242243243- buckets = flex_array_alloc(sizeof(struct hlist_head *),243243+ buckets = flex_array_alloc(sizeof(struct hlist_head),244244 n_buckets, GFP_KERNEL);245245 if (!buckets)246246 return NULL;
+2
net/packet/af_packet.c
···3259325932603260 if (po->tp_version == TPACKET_V3) {32613261 lv = sizeof(struct tpacket_stats_v3);32623262+ st.stats3.tp_packets += st.stats3.tp_drops;32623263 data = &st.stats3;32633264 } else {32643265 lv = sizeof(struct tpacket_stats);32663266+ st.stats1.tp_packets += st.stats1.tp_drops;32653267 data = &st.stats1;32663268 }32673269
+41
net/sched/sch_api.c
···285285 return q;286286}287287288288+/* The linklayer setting were not transferred from iproute2, in older289289+ * versions, and the rate tables lookup systems have been dropped in290290+ * the kernel. To keep backward compatible with older iproute2 tc291291+ * utils, we detect the linklayer setting by detecting if the rate292292+ * table were modified.293293+ *294294+ * For linklayer ATM table entries, the rate table will be aligned to295295+ * 48 bytes, thus some table entries will contain the same value. The296296+ * mpu (min packet unit) is also encoded into the old rate table, thus297297+ * starting from the mpu, we find low and high table entries for298298+ * mapping this cell. If these entries contain the same value, when299299+ * the rate tables have been modified for linklayer ATM.300300+ *301301+ * This is done by rounding mpu to the nearest 48 bytes cell/entry,302302+ * and then roundup to the next cell, calc the table entry one below,303303+ * and compare.304304+ */305305+static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab)306306+{307307+ int low = roundup(r->mpu, 48);308308+ int high = roundup(low+1, 48);309309+ int cell_low = low >> r->cell_log;310310+ int cell_high = (high >> r->cell_log) - 1;311311+312312+ /* rtab is too inaccurate at rates > 100Mbit/s */313313+ if ((r->rate > (100000000/8)) || (rtab[0] == 0)) {314314+ pr_debug("TC linklayer: Giving up ATM detection\n");315315+ return TC_LINKLAYER_ETHERNET;316316+ }317317+318318+ if ((cell_high > cell_low) && (cell_high < 256)319319+ && (rtab[cell_low] == rtab[cell_high])) {320320+ pr_debug("TC linklayer: Detected ATM, low(%d)=high(%d)=%u\n",321321+ cell_low, cell_high, rtab[cell_high]);322322+ return TC_LINKLAYER_ATM;323323+ }324324+ return TC_LINKLAYER_ETHERNET;325325+}326326+288327static struct qdisc_rate_table *qdisc_rtab_list;289328290329struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *tab)···347308 rtab->rate = *r;348309 rtab->refcnt = 1;349310 memcpy(rtab->data, nla_data(tab), 1024);311311+ if (r->linklayer == TC_LINKLAYER_UNAWARE)312312+ r->linklayer = __detect_linklayer(r, rtab->data);350313 rtab->next = qdisc_rtab_list;351314 qdisc_rtab_list = rtab;352315 }
+7-1
net/sched/sch_generic.c
···2525#include <linux/rcupdate.h>2626#include <linux/list.h>2727#include <linux/slab.h>2828+#include <linux/if_vlan.h>2829#include <net/sch_generic.h>2930#include <net/pkt_sched.h>3031#include <net/dst.h>···208207209208unsigned long dev_trans_start(struct net_device *dev)210209{211211- unsigned long val, res = dev->trans_start;210210+ unsigned long val, res;212211 unsigned int i;213212213213+ if (is_vlan_dev(dev))214214+ dev = vlan_dev_real_dev(dev);215215+ res = dev->trans_start;214216 for (i = 0; i < dev->num_tx_queues; i++) {215217 val = netdev_get_tx_queue(dev, i)->trans_start;216218 if (val && time_after(val, res))217219 res = val;218220 }219221 dev->trans_start = res;222222+220223 return res;221224}222225EXPORT_SYMBOL(dev_trans_start);···909904 memset(r, 0, sizeof(*r));910905 r->overhead = conf->overhead;911906 r->rate_bytes_ps = conf->rate;907907+ r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK);912908 r->mult = 1;913909 /*914910 * The deal here is to replace a divide by a reciprocal one
+13
net/sched/sch_htb.c
···13291329 struct htb_sched *q = qdisc_priv(sch);13301330 struct htb_class *cl = (struct htb_class *)*arg, *parent;13311331 struct nlattr *opt = tca[TCA_OPTIONS];13321332+ struct qdisc_rate_table *rtab = NULL, *ctab = NULL;13321333 struct nlattr *tb[TCA_HTB_MAX + 1];13331334 struct tc_htb_opt *hopt;13341335···13501349 hopt = nla_data(tb[TCA_HTB_PARMS]);13511350 if (!hopt->rate.rate || !hopt->ceil.rate)13521351 goto failure;13521352+13531353+ /* Keeping backward compatible with rate_table based iproute2 tc */13541354+ if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE) {13551355+ rtab = qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB]);13561356+ if (rtab)13571357+ qdisc_put_rtab(rtab);13581358+ }13591359+ if (hopt->ceil.linklayer == TC_LINKLAYER_UNAWARE) {13601360+ ctab = qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB]);13611361+ if (ctab)13621362+ qdisc_put_rtab(ctab);13631363+ }1353136413541365 if (!cl) { /* new class */13551366 struct Qdisc *new_q;
+2-2
net/sctp/associola.c
···846846 else847847 spc_state = SCTP_ADDR_AVAILABLE;848848 /* Don't inform ULP about transition from PF to849849- * active state and set cwnd to 1, see SCTP849849+ * active state and set cwnd to 1 MTU, see SCTP850850 * Quick failover draft section 5.1, point 5851851 */852852 if (transport->state == SCTP_PF) {853853 ulp_notify = false;854854- transport->cwnd = 1;854854+ transport->cwnd = asoc->pathmtu;855855 }856856 transport->state = SCTP_ACTIVE;857857 break;
+2-2
net/sctp/transport.c
···181181 return;182182 }183183184184- call_rcu(&transport->rcu, sctp_transport_destroy_rcu);185185-186184 sctp_packet_free(&transport->packet);187185188186 if (transport->asoc)189187 sctp_association_put(transport->asoc);188188+189189+ call_rcu(&transport->rcu, sctp_transport_destroy_rcu);190190}191191192192/* Start T3_rtx timer if it is not already running and update the heartbeat
···16161717#include "common.h"18181919-enum {2020- MIDI_BUFSIZE = 642121-};2222-2319struct midi_runtime {2420 struct sfire_chip *chip;2521 struct snd_rawmidi *instance;···2832 struct snd_rawmidi_substream *out;2933 struct urb out_urb;3034 u8 out_serial; /* serial number of out packet */3131- u8 out_buffer[MIDI_BUFSIZE];3535+ u8 *out_buffer;3236 int buffer_offset;33373438 void (*in_received)(struct midi_runtime *rt, u8 *data, int length);
+40-1
sound/usb/6fire/pcm.c
···582582 urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB;583583}584584585585+static int usb6fire_pcm_buffers_init(struct pcm_runtime *rt)586586+{587587+ int i;588588+589589+ for (i = 0; i < PCM_N_URBS; i++) {590590+ rt->out_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB591591+ * PCM_MAX_PACKET_SIZE, GFP_KERNEL);592592+ if (!rt->out_urbs[i].buffer)593593+ return -ENOMEM;594594+ rt->in_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB595595+ * PCM_MAX_PACKET_SIZE, GFP_KERNEL);596596+ if (!rt->in_urbs[i].buffer)597597+ return -ENOMEM;598598+ }599599+ return 0;600600+}601601+602602+static void usb6fire_pcm_buffers_destroy(struct pcm_runtime *rt)603603+{604604+ int i;605605+606606+ for (i = 0; i < PCM_N_URBS; i++) {607607+ kfree(rt->out_urbs[i].buffer);608608+ kfree(rt->in_urbs[i].buffer);609609+ }610610+}611611+585612int usb6fire_pcm_init(struct sfire_chip *chip)586613{587614 int i;···619592620593 if (!rt)621594 return -ENOMEM;595595+596596+ ret = usb6fire_pcm_buffers_init(rt);597597+ if (ret) {598598+ usb6fire_pcm_buffers_destroy(rt);599599+ kfree(rt);600600+ return ret;601601+ }622602623603 rt->chip = chip;624604 rt->stream_state = STREAM_DISABLED;···648614649615 ret = snd_pcm_new(chip->card, "DMX6FireUSB", 0, 1, 1, &pcm);650616 if (ret < 0) {617617+ usb6fire_pcm_buffers_destroy(rt);651618 kfree(rt);652619 snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n");653620 return ret;···660625 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops);661626662627 if (ret) {628628+ usb6fire_pcm_buffers_destroy(rt);663629 kfree(rt);664630 snd_printk(KERN_ERR PREFIX665631 "error preallocating pcm buffers.\n");···705669706670void usb6fire_pcm_destroy(struct sfire_chip *chip)707671{708708- kfree(chip->pcm);672672+ struct pcm_runtime *rt = chip->pcm;673673+674674+ usb6fire_pcm_buffers_destroy(rt);675675+ kfree(rt);709676 chip->pcm = NULL;710677}
+1-1
sound/usb/6fire/pcm.h
···3232 struct urb instance;3333 struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB];3434 /* END DO NOT SEPARATE */3535- u8 buffer[PCM_N_PACKETS_PER_URB * PCM_MAX_PACKET_SIZE];3535+ u8 *buffer;36363737 struct pcm_urb *peer;3838};
+1
sound/usb/mixer.c
···888888 case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */889889 case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */890890 case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */891891+ case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */891892 case USB_ID(0x046d, 0x0991):892893 /* Most audio usb devices lie about volume resolution.893894 * Most Logitech webcams have res = 384.
+3-3
sound/usb/quirks.c
···319319 if (altsd->bNumEndpoints < 1)320320 return -ENODEV;321321 epd = get_endpoint(alts, 0);322322- if (!usb_endpoint_xfer_bulk(epd) ||322322+ if (!usb_endpoint_xfer_bulk(epd) &&323323 !usb_endpoint_xfer_int(epd))324324 return -ENODEV;325325326326 switch (USB_ID_VENDOR(chip->usb_id)) {327327 case 0x0499: /* Yamaha */328328 err = create_yamaha_midi_quirk(chip, iface, driver, alts);329329- if (err < 0 && err != -ENODEV)329329+ if (err != -ENODEV)330330 return err;331331 break;332332 case 0x0582: /* Roland */333333 err = create_roland_midi_quirk(chip, iface, driver, alts);334334- if (err < 0 && err != -ENODEV)334334+ if (err != -ENODEV)335335 return err;336336 break;337337 }