···11<?xml version="1.0"?>22-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"33- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [22+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"33+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [44<!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities;55<!ENTITY media-indices SYSTEM "./media-indices.tmpl">66
···44Required properties :5566 - reg : Offset and length of the register set for the device77- - compatible : Should be "marvell,mv64xxx-i2c"77+ - compatible : Should be "marvell,mv64xxx-i2c" or "allwinner,sun4i-i2c"88 - interrupts : The interrupt number991010Optional properties :
···3131 Optional sub-node properties:3232 ti,warm-reset - maintain voltage during warm reset(boolean)3333 ti,roof-floor - control voltage selection by pin(boolean)3434- ti,sleep-mode - mode to adopt in pmic sleep 0 - off, 1 - auto,3434+ ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto,3535 2 - eco, 3 - forced pwm3636- ti,tstep - slope control 0 - Jump, 1 10mV/us, 2 5mV/us, 3 2.5mV/us3736 ti,smps-range - OTP has the wrong range set for the hardware so override3837 0 - low range, 1 - high range.3938···5859 ti,warm-reset;5960 ti,roof-floor;6061 ti,mode-sleep = <0>;6161- ti,tstep = <0>;6262 ti,smps-range = <1>;6363 };6464
+13-3
MAINTAINERS
···965965L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)966966S: Maintained967967968968+ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE969969+M: Santosh Shilimkar <santosh.shilimkar@ti.com>970970+L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)971971+S: Maintained972972+F: arch/arm/mach-keystone/973973+968974ARM/LOGICPD PXA270 MACHINE SUPPORT969975M: Lennert Buytenhek <kernel@wantstofly.org>970976L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)···12651259T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git1266126012671261ARM/Ux500 ARM ARCHITECTURE12681268-M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>12691262M: Linus Walleij <linus.walleij@linaro.org>12701263L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)12711264S: Maintained···55815576F: drivers/media/tuners/mxl5007t.*5582557755835578MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)55845584-M: Andrew Gallatin <gallatin@myri.com>55795579+M: Hyong-Youb Kim <hykim@myri.com>55855580L: netdev@vger.kernel.org55865586-W: http://www.myri.com/scs/download-Myri10GE.html55815581+W: https://www.myricom.com/support/downloads/myri10ge.html55875582S: Supported55885583F: drivers/net/ethernet/myricom/myri10ge/55895584···86698664T: git git://git.alsa-project.org/alsa-kernel.git86708665S: Maintained86718666F: sound/usb/midi.*86678667+86688668+USB NETWORKING DRIVERS86698669+L: linux-usb@vger.kernel.org86708670+S: Odd Fixes86718671+F: drivers/net/usb/8672867286738673USB OHCI DRIVER86748674M: Alan Stern <stern@rowland.harvard.edu>
+1-1
Makefile
···11VERSION = 322PATCHLEVEL = 1133SUBLEVEL = 044-EXTRAVERSION = -rc344+EXTRAVERSION = -rc555NAME = 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
···4343 struct mm_struct *mm;4444 unsigned int fullmm;4545 struct vm_area_struct *vma;4646+ unsigned long start, end;4647 unsigned long range_start;4748 unsigned long range_end;4849 unsigned int nr;···108107}109108110109static inline void111111-tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int fullmm)110110+tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)112111{113112 tlb->mm = mm;114114- tlb->fullmm = fullmm;113113+ tlb->fullmm = !(start | (end+1));114114+ tlb->start = start;115115+ tlb->end = end;115116 tlb->vma = NULL;116117 tlb->max = ARRAY_SIZE(tlb->local);117118 tlb->pages = tlb->local;
+6-1
arch/arm/kernel/perf_event.c
···5353static int5454armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)5555{5656- int mapping = (*event_map)[config];5656+ int mapping;5757+5858+ if (config >= PERF_COUNT_HW_MAX)5959+ return -ENOENT;6060+6161+ mapping = (*event_map)[config];5762 return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;5863}5964
+1-2
arch/arm/mach-msm/Kconfig
···121121 bool122122123123config MSM_GPIOMUX124124- depends on !(ARCH_MSM8X60 || ARCH_MSM8960)125125- bool "MSM V1 TLMM GPIOMUX architecture"124124+ bool126125 help127126 Support for MSM V1 TLMM GPIOMUX architecture.128127
-33
arch/arm/mach-msm/gpiomux-v1.c
···11-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.22- *33- * This program is free software; you can redistribute it and/or modify44- * it under the terms of the GNU General Public License version 2 and55- * only version 2 as published by the Free Software Foundation.66- *77- * This program is distributed in the hope that it will be useful,88- * but WITHOUT ANY WARRANTY; without even the implied warranty of99- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1010- * GNU General Public License for more details.1111- *1212- * You should have received a copy of the GNU General Public License1313- * along with this program; if not, write to the Free Software1414- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA1515- * 02110-1301, USA.1616- */1717-#include <linux/kernel.h>1818-#include "gpiomux.h"1919-#include "proc_comm.h"2020-2121-void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)2222-{2323- unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) |2424- ((gpio & 0x3ff) << 4);2525- unsigned tlmm_disable = 0;2626- int rc;2727-2828- rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX,2929- &tlmm_config, &tlmm_disable);3030- if (rc)3131- pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n",3232- __func__, rc, tlmm_config, tlmm_disable);3333-}
-10
arch/arm/mach-msm/gpiomux.h
···7373int msm_gpiomux_write(unsigned gpio,7474 gpiomux_config_t active,7575 gpiomux_config_t suspended);7676-7777-/* Architecture-internal function for use by the framework only.7878- * This function can assume the following:7979- * - the gpio value has passed a bounds-check8080- * - the gpiomux spinlock has been obtained8181- *8282- * This function is not for public consumption. External users8383- * should use msm_gpiomux_write.8484- */8585-void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);8676#else8777static inline int msm_gpiomux_write(unsigned gpio,8878 gpiomux_config_t active,
···129129 struct device_node *node = pdev->dev.of_node;130130 const char *oh_name;131131 int oh_cnt, i, ret = 0;132132+ bool device_active = false;132133133134 oh_cnt = of_property_count_strings(node, "ti,hwmods");134135 if (oh_cnt <= 0) {···153152 goto odbfd_exit1;154153 }155154 hwmods[i] = oh;155155+ if (oh->flags & HWMOD_INIT_NO_IDLE)156156+ device_active = true;156157 }157158158159 od = omap_device_alloc(pdev, hwmods, oh_cnt);···174171 }175172176173 pdev->dev.pm_domain = &omap_device_pm_domain;174174+175175+ if (device_active) {176176+ omap_device_enable(pdev);177177+ pm_runtime_set_active(&pdev->dev);178178+ }177179178180odbfd_exit1:179181 kfree(hwmods);···850842{851843 struct platform_device *pdev = to_platform_device(dev);852844 struct omap_device *od = to_omap_device(pdev);845845+ int i;853846854847 if (!od)855848 return 0;···859850 * If omap_device state is enabled, but has no driver bound,860851 * idle it.861852 */853853+854854+ /*855855+ * Some devices (like memory controllers) are always kept856856+ * enabled, and should not be idled even with no drivers.857857+ */858858+ for (i = 0; i < od->hwmods_cnt; i++)859859+ if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE)860860+ return 0;861861+862862 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) {863863 if (od->_state == OMAP_DEVICE_STATE_ENABLED) {864864 dev_warn(dev, "%s: enabled but no driver. Idling\n",
···208208 pr_info("%s used as console in debug mode: uart%d clocks will not be gated",209209 uart_name, uart->num);210210 }211211-212212- /*213213- * omap-uart can be used for earlyprintk logs214214- * So if omap-uart is used as console then prevent215215- * uart reset and idle to get logs from omap-uart216216- * until uart console driver is available to take217217- * care for console messages.218218- * Idling or resetting omap-uart while printing logs219219- * early boot logs can stall the boot-up.220220- */221221- oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET;222211 }223212 } while (1);224213
···1616#include <linux/linkage.h>1717#include <linux/init.h>18181919- __INIT2020-2119/*2220 * ST specific entry point for secondary CPUs. This provides2321 * a "holding pen" into which all secondary cores are held until we're
+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;
···1717#define current_cpu_type() current_cpu_data.cputype1818#endif19192020+#define boot_cpu_type() cpu_data[0].cputype2121+2022/*2123 * SMP assumption: Options of CPU 0 are a superset of all processors.2224 * This is true for all known MIPS systems.
+8-2
arch/mips/kernel/smp-bmips.c
···6666 int i, cpu = 1, boot_cpu = 0;67676868#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)6969+ int cpu_hw_intr;7070+6971 /* arbitration priority */7072 clear_c0_brcm_cmt_ctrl(0x30);7173···8280 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output8381 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output8482 */8585- change_c0_brcm_cmt_intr(0xf8018000,8686- (0x02 << 27) | (0x03 << 15));8383+ if (boot_cpu == 0)8484+ cpu_hw_intr = 0x02;8585+ else8686+ cpu_hw_intr = 0x1d;8787+8888+ change_c0_brcm_cmt_intr(0xf8018000, (cpu_hw_intr << 27) | (0x03 << 15));87898890 /* single core, 2 threads (2 pipelines) */8991 max_cpus = 2;
+1-1
arch/mips/oprofile/op_model_mipsxx.c
···166166 reg.control[i] |= M_PERFCTL_USER;167167 if (ctr[i].exl)168168 reg.control[i] |= M_PERFCTL_EXL;169169- if (current_cpu_type() == CPU_XLR)169169+ if (boot_cpu_type() == CPU_XLR)170170 reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS;171171 reg.counter[i] = 0x80000000 - ctr[i].count;172172 }
···55555656source "init/Kconfig"57575858+source "kernel/Kconfig.freezer"58595960menu "Processor type and features"6061
+1-1
arch/powerpc/Kconfig
···566566config PPC_DENORMALISATION567567 bool "PowerPC denormalisation exception handling"568568 depends on PPC_BOOK3S_64569569- default "n"569569+ default "y" if PPC_POWERNV570570 ---help---571571 Add support for handling denormalisation of single precision572572 values. Useful for bare metal only. If unsure say Y here.
+4
arch/powerpc/include/asm/processor.h
···247247 unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */248248 struct pt_regs ckpt_regs; /* Checkpointed registers */249249250250+ unsigned long tm_tar;251251+ unsigned long tm_ppr;252252+ unsigned long tm_dscr;253253+250254 /*251255 * Transactional FP and VSX 0-31 register set.252256 * NOTE: the sense of these is the opposite of the integer ckpt_regs!
+20-11
arch/powerpc/include/asm/reg.h
···254254#define SPRN_HRMOR 0x139 /* Real mode offset register */255255#define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */256256#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */257257+/* HFSCR and FSCR bit numbers are the same */258258+#define FSCR_TAR_LG 8 /* Enable Target Address Register */259259+#define FSCR_EBB_LG 7 /* Enable Event Based Branching */260260+#define FSCR_TM_LG 5 /* Enable Transactional Memory */261261+#define FSCR_PM_LG 4 /* Enable prob/priv access to PMU SPRs */262262+#define FSCR_BHRB_LG 3 /* Enable Branch History Rolling Buffer*/263263+#define FSCR_DSCR_LG 2 /* Enable Data Stream Control Register */264264+#define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */265265+#define FSCR_FP_LG 0 /* Enable Floating Point */257266#define SPRN_FSCR 0x099 /* Facility Status & Control Register */258258-#define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */259259-#define FSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */260260-#define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */267267+#define FSCR_TAR __MASK(FSCR_TAR_LG)268268+#define FSCR_EBB __MASK(FSCR_EBB_LG)269269+#define FSCR_DSCR __MASK(FSCR_DSCR_LG)261270#define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */262262-#define HFSCR_TAR (1 << (63-55)) /* Enable Target Address Register */263263-#define HFSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */264264-#define HFSCR_TM (1 << (63-58)) /* Enable Transactional Memory */265265-#define HFSCR_PM (1 << (63-60)) /* Enable prob/priv access to PMU SPRs */266266-#define HFSCR_BHRB (1 << (63-59)) /* Enable Branch History Rolling Buffer*/267267-#define HFSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */268268-#define HFSCR_VECVSX (1 << (63-62)) /* Enable VMX/VSX */269269-#define HFSCR_FP (1 << (63-63)) /* Enable Floating Point */271271+#define HFSCR_TAR __MASK(FSCR_TAR_LG)272272+#define HFSCR_EBB __MASK(FSCR_EBB_LG)273273+#define HFSCR_TM __MASK(FSCR_TM_LG)274274+#define HFSCR_PM __MASK(FSCR_PM_LG)275275+#define HFSCR_BHRB __MASK(FSCR_BHRB_LG)276276+#define HFSCR_DSCR __MASK(FSCR_DSCR_LG)277277+#define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG)278278+#define HFSCR_FP __MASK(FSCR_FP_LG)270279#define SPRN_TAR 0x32f /* Target Address Register */271280#define SPRN_LPCR 0x13E /* LPAR Control Register */272281#define LPCR_VPM0 (1ul << (63-0))
···1061106110621062static int __init eeh_init_proc(void)10631063{10641064- if (machine_is(pseries))10641064+ if (machine_is(pseries) || machine_is(powernv))10651065 proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations);10661066 return 0;10671067}
+26-10
arch/powerpc/kernel/entry_64.S
···449449450450#ifdef CONFIG_PPC_BOOK3S_64451451BEGIN_FTR_SECTION452452- /*453453- * Back up the TAR across context switches. Note that the TAR is not454454- * available for use in the kernel. (To provide this, the TAR should455455- * be backed up/restored on exception entry/exit instead, and be in456456- * pt_regs. FIXME, this should be in pt_regs anyway (for debug).)457457- */458458- mfspr r0,SPRN_TAR459459- std r0,THREAD_TAR(r3)460460-461452 /* Event based branch registers */462453 mfspr r0, SPRN_BESCR463454 std r0, THREAD_BESCR(r3)···575584 ld r7,DSCR_DEFAULT@toc(2)576585 ld r0,THREAD_DSCR(r4)577586 cmpwi r6,0587587+ li r8, FSCR_DSCR578588 bne 1f579589 ld r0,0(r7)580580-1: cmpd r0,r25590590+ b 3f591591+1:592592+ BEGIN_FTR_SECTION_NESTED(70)593593+ mfspr r6, SPRN_FSCR594594+ or r6, r6, r8595595+ mtspr SPRN_FSCR, r6596596+ BEGIN_FTR_SECTION_NESTED(69)597597+ mfspr r6, SPRN_HFSCR598598+ or r6, r6, r8599599+ mtspr SPRN_HFSCR, r6600600+ END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)601601+ b 4f602602+ END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)603603+3:604604+ BEGIN_FTR_SECTION_NESTED(70)605605+ mfspr r6, SPRN_FSCR606606+ andc r6, r6, r8607607+ mtspr SPRN_FSCR, r6608608+ BEGIN_FTR_SECTION_NESTED(69)609609+ mfspr r6, SPRN_HFSCR610610+ andc r6, r6, r8611611+ mtspr SPRN_HFSCR, r6612612+ END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)613613+ END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)614614+4: cmpd r0,r25581615 beq 2f582616 mtspr SPRN_DSCR,r05836172:
···600600 struct ppc64_tlb_batch *batch;601601#endif602602603603+ /* Back up the TAR across context switches.604604+ * Note that the TAR is not available for use in the kernel. (To605605+ * provide this, the TAR should be backed up/restored on exception606606+ * entry/exit instead, and be in pt_regs. FIXME, this should be in607607+ * pt_regs anyway (for debug).)608608+ * Save the TAR here before we do treclaim/trecheckpoint as these609609+ * will change the TAR.610610+ */611611+ save_tar(&prev->thread);612612+603613 __switch_to_tm(prev);604614605615#ifdef CONFIG_SMP
···4444#include <asm/machdep.h>4545#include <asm/rtas.h>4646#include <asm/pmc.h>4747-#ifdef CONFIG_PPC324847#include <asm/reg.h>4949-#endif5048#ifdef CONFIG_PMAC_BACKLIGHT5149#include <asm/backlight.h>5250#endif···12941296 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT);12951297}1296129812991299+#ifdef CONFIG_PPC6412971300void facility_unavailable_exception(struct pt_regs *regs)12981301{12991302 static char *facility_strings[] = {13001300- "FPU",13011301- "VMX/VSX",13021302- "DSCR",13031303- "PMU SPRs",13041304- "BHRB",13051305- "TM",13061306- "AT",13071307- "EBB",13081308- "TAR",13031303+ [FSCR_FP_LG] = "FPU",13041304+ [FSCR_VECVSX_LG] = "VMX/VSX",13051305+ [FSCR_DSCR_LG] = "DSCR",13061306+ [FSCR_PM_LG] = "PMU SPRs",13071307+ [FSCR_BHRB_LG] = "BHRB",13081308+ [FSCR_TM_LG] = "TM",13091309+ [FSCR_EBB_LG] = "EBB",13101310+ [FSCR_TAR_LG] = "TAR",13091311 };13101310- char *facility, *prefix;13121312+ char *facility = "unknown";13111313 u64 value;13141314+ u8 status;13151315+ bool hv;1312131613131313- if (regs->trap == 0xf60) {13141314- value = mfspr(SPRN_FSCR);13151315- prefix = "";13161316- } else {13171317+ hv = (regs->trap == 0xf80);13181318+ if (hv)13171319 value = mfspr(SPRN_HFSCR);13181318- prefix = "Hypervisor ";13201320+ else13211321+ value = mfspr(SPRN_FSCR);13221322+13231323+ status = value >> 56;13241324+ if (status == FSCR_DSCR_LG) {13251325+ /* User is acessing the DSCR. Set the inherit bit and allow13261326+ * the user to set it directly in future by setting via the13271327+ * H/FSCR DSCR bit.13281328+ */13291329+ current->thread.dscr_inherit = 1;13301330+ if (hv)13311331+ mtspr(SPRN_HFSCR, value | HFSCR_DSCR);13321332+ else13331333+ mtspr(SPRN_FSCR, value | FSCR_DSCR);13341334+ return;13191335 }1320133613211321- value = value >> 56;13371337+ if ((status < ARRAY_SIZE(facility_strings)) &&13381338+ facility_strings[status])13391339+ facility = facility_strings[status];1322134013231341 /* We restore the interrupt state now */13241342 if (!arch_irq_disabled_regs(regs))13251343 local_irq_enable();1326134413271327- if (value < ARRAY_SIZE(facility_strings))13281328- facility = facility_strings[value];13291329- else13301330- facility = "unknown";13311331-13321345 pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n",13331333- prefix, facility, regs->nip, regs->msr);13461346+ hv ? "Hypervisor " : "", facility, regs->nip, regs->msr);1334134713351348 if (user_mode(regs)) {13361349 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);···1350134113511342 die("Unexpected facility unavailable exception", regs, SIGABRT);13521343}13441344+#endif1353134513541346#ifdef CONFIG_PPC_TRANSACTIONAL_MEM13551347
+2-2
arch/powerpc/kvm/book3s_hv.c
···18091809 rma_size <<= PAGE_SHIFT;18101810 rmls = lpcr_rmls(rma_size);18111811 err = -EINVAL;18121812- if (rmls < 0) {18121812+ if ((long)rmls < 0) {18131813 pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size);18141814 goto out_srcu;18151815 }···18741874 /* Allocate the guest's logical partition ID */1875187518761876 lpid = kvmppc_alloc_lpid();18771877- if (lpid < 0)18771877+ if ((long)lpid < 0)18781878 return -ENOMEM;18791879 kvm->arch.lpid = lpid;18801880
+3-2
arch/powerpc/kvm/book3s_pr.c
···10471047 if (err)10481048 goto free_shadow_vcpu;1049104910501050+ err = -ENOMEM;10501051 p = __get_free_page(GFP_KERNEL|__GFP_ZERO);10511051- /* the real shared page fills the last 4k of our page */10521052- vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096);10531052 if (!p)10541053 goto uninit_vcpu;10541054+ /* the real shared page fills the last 4k of our page */10551055+ vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096);1055105610561057#ifdef CONFIG_PPC_BOOK3S_6410571058 /* default to book3s_64 (970fx) */
···118118 select HAVE_FUNCTION_TRACE_MCOUNT_TEST119119 select HAVE_KERNEL_BZIP2120120 select HAVE_KERNEL_GZIP121121+ select HAVE_KERNEL_LZ4121122 select HAVE_KERNEL_LZMA122123 select HAVE_KERNEL_LZO123124 select HAVE_KERNEL_XZ···228227 not work on older machines.229228230229config MARCH_ZEC12231231- bool "IBM zEC12"230230+ bool "IBM zBC12 and zEC12"232231 select HAVE_MARCH_ZEC12_FEATURES if 64BIT233232 help234234- Select this to enable optimizations for IBM zEC12 (2827 series). The235235- kernel will be slightly faster but will not work on older machines.233233+ Select this to enable optimizations for IBM zBC12 and zEC12 (2828 and234234+ 2827 series). The kernel will be slightly faster but will not work on235235+ older machines.236236237237endchoice238238···711709 def_bool y712710 prompt "s390 support for virtio devices"713711 depends on 64BIT712712+ select TTY714713 select VIRTUALIZATION715714 select VIRTIO716715 select VIRTIO_CONSOLE
···702702 return rc;703703704704 vcpu->arch.sie_block->icptcode = 0;705705- preempt_disable();706706- kvm_guest_enter();707707- preempt_enable();708705 VCPU_EVENT(vcpu, 6, "entering sie flags %x",709706 atomic_read(&vcpu->arch.sie_block->cpuflags));710707 trace_kvm_s390_sie_enter(vcpu,711708 atomic_read(&vcpu->arch.sie_block->cpuflags));709709+710710+ /*711711+ * As PF_VCPU will be used in fault handler, between guest_enter712712+ * and guest_exit should be no uaccess.713713+ */714714+ preempt_disable();715715+ kvm_guest_enter();716716+ preempt_enable();712717 rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs);718718+ kvm_guest_exit();719719+720720+ VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",721721+ vcpu->arch.sie_block->icptcode);722722+ trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);723723+713724 if (rc > 0)714725 rc = 0;715726 if (rc < 0) {···732721 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);733722 }734723 }735735- VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",736736- vcpu->arch.sie_block->icptcode);737737- trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);738738- kvm_guest_exit();739724740725 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);741726 return rc;
+2-2
arch/s390/kvm/priv.c
···1616#include <linux/errno.h>1717#include <linux/compat.h>1818#include <asm/asm-offsets.h>1919+#include <asm/facility.h>1920#include <asm/current.h>2021#include <asm/debug.h>2122#include <asm/ebcdic.h>···533532 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);534533535534 /* Only provide non-quiescing support if the host supports it */536536- if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ &&537537- S390_lowcore.stfl_fac_list & 0x00020000)535535+ if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && !test_facility(14))538536 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);539537540538 /* No support for conditional-SSKE */
+1
arch/s390/mm/init.c
···6969 order = 2;7070 break;7171 case 0x2827: /* zEC12 */7272+ case 0x2828: /* zEC12 */7273 default:7374 order = 5;7475 break;
+1-1
arch/s390/oprofile/init.c
···440440 switch (id.machine) {441441 case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break;442442 case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break;443443- case 0x2827: ops->cpu_type = "s390/zEC12"; break;443443+ case 0x2827: case 0x2828: ops->cpu_type = "s390/zEC12"; break;444444 default: return -ENODEV;445445 }446446 }
···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 */
+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));
···196196static void __init intel_remapping_check(int num, int slot, int func)197197{198198 u8 revision;199199+ u16 device;199200201201+ device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID);200202 revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID);201203202204 /*203203- * Revision 0x13 of this chipset supports irq remapping204204- * but has an erratum that breaks its behavior, flag it as such205205+ * Revision 13 of all triggering devices id in this quirk have206206+ * a problem draining interrupts when irq remapping is enabled,207207+ * and should be flagged as broken. Additionally revisions 0x12208208+ * and 0x22 of device id 0x3405 has this problem.205209 */206210 if (revision == 0x13)211211+ set_irq_remapping_broken();212212+ else if ((device == 0x3405) &&213213+ ((revision == 0x12) ||214214+ (revision == 0x22)))207215 set_irq_remapping_broken();208216209217}···246238 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,247239 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },248240 { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST,241241+ PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },242242+ { PCI_VENDOR_ID_INTEL, 0x3405, PCI_CLASS_BRIDGE_HOST,249243 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },250244 { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST,251245 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
···9898 * Bottom-up (legacy) layout on X86_32 did not support randomization, X86_649999 * does, but not when emulating X86_32100100 */101101-static unsigned long mmap_legacy_base(void)101101+unsigned long mmap_legacy_base(void)102102{103103 if (mmap_is_ia32())104104 return TASK_UNMAPPED_BASE;
···689689 * Some systems always report current brightness level as maximum690690 * through _BQC, we need to test another value for them.691691 */692692- test_level = current_level == max_level ? br->levels[2] : max_level;692692+ test_level = current_level == max_level ? br->levels[3] : max_level;693693694694 result = acpi_video_device_lcd_set_level(device, test_level);695695 if (result)
···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
+49-23
drivers/char/virtio_console.c
···272272 unsigned long flags;273273274274 spin_lock_irqsave(&portdev->ports_lock, flags);275275- list_for_each_entry(port, &portdev->ports, list)276276- if (port->cdev->dev == dev)275275+ list_for_each_entry(port, &portdev->ports, list) {276276+ if (port->cdev->dev == dev) {277277+ kref_get(&port->kref);277278 goto out;279279+ }280280+ }278281 port = NULL;279282out:280283 spin_unlock_irqrestore(&portdev->ports_lock, flags);···749746750747 port = filp->private_data;751748749749+ /* Port is hot-unplugged. */750750+ if (!port->guest_connected)751751+ return -ENODEV;752752+752753 if (!port_has_data(port)) {753754 /*754755 * If nothing's connected on the host just return 0 in···769762 if (ret < 0)770763 return ret;771764 }772772- /* Port got hot-unplugged. */765765+ /* Port got hot-unplugged while we were waiting above. */773766 if (!port->guest_connected)774767 return -ENODEV;775768 /*···939932 if (is_rproc_serial(port->out_vq->vdev))940933 return -EINVAL;941934935935+ /*936936+ * pipe->nrbufs == 0 means there are no data to transfer,937937+ * so this returns just 0 for no data.938938+ */939939+ pipe_lock(pipe);940940+ if (!pipe->nrbufs) {941941+ ret = 0;942942+ goto error_out;943943+ }944944+942945 ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK);943946 if (ret < 0)944944- return ret;947947+ goto error_out;945948946949 buf = alloc_buf(port->out_vq, 0, pipe->nrbufs);947947- if (!buf)948948- return -ENOMEM;950950+ if (!buf) {951951+ ret = -ENOMEM;952952+ goto error_out;953953+ }949954950955 sgl.n = 0;951956 sgl.len = 0;···965946 sgl.sg = buf->sg;966947 sg_init_table(sgl.sg, sgl.size);967948 ret = __splice_from_pipe(pipe, &sd, pipe_to_sg);949949+ pipe_unlock(pipe);968950 if (likely(ret > 0))969951 ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true);970952971953 if (unlikely(ret <= 0))972954 free_buf(buf, true);955955+ return ret;956956+957957+error_out:958958+ pipe_unlock(pipe);973959 return ret;974960}975961···10431019 struct port *port;10441020 int ret;1045102110221022+ /* We get the port with a kref here */10461023 port = find_port_by_devt(cdev->dev);10241024+ if (!port) {10251025+ /* Port was unplugged before we could proceed */10261026+ return -ENXIO;10271027+ }10471028 filp->private_data = port;10481048-10491049- /* Prevent against a port getting hot-unplugged at the same time */10501050- spin_lock_irq(&port->portdev->ports_lock);10511051- kref_get(&port->kref);10521052- spin_unlock_irq(&port->portdev->ports_lock);1053102910541030 /*10551031 * Don't allow opening of console port devices -- that's done···1522149815231499 port = container_of(kref, struct port, kref);1524150015251525- sysfs_remove_group(&port->dev->kobj, &port_attribute_group);15261526- device_destroy(pdrvdata.class, port->dev->devt);15271527- cdev_del(port->cdev);15281528-15291529- kfree(port->name);15301530-15311531- debugfs_remove(port->debugfs_file);15321532-15331501 kfree(port);15341502}15351503···15551539 spin_unlock_irq(&port->portdev->ports_lock);1556154015571541 if (port->guest_connected) {15581558- port->guest_connected = false;15591559- port->host_connected = false;15601560- wake_up_interruptible(&port->waitqueue);15611561-15621542 /* Let the app know the port is going down. */15631543 send_sigio_to_port(port);15441544+15451545+ /* Do this after sigio is actually sent */15461546+ port->guest_connected = false;15471547+ port->host_connected = false;15481548+15491549+ wake_up_interruptible(&port->waitqueue);15641550 }1565155115661552 if (is_console_port(port)) {···15801562 * control message.15811563 */15821564 port->portdev = NULL;15651565+15661566+ sysfs_remove_group(&port->dev->kobj, &port_attribute_group);15671567+ device_destroy(pdrvdata.class, port->dev->devt);15681568+ cdev_del(port->cdev);15691569+15701570+ kfree(port->name);15711571+15721572+ debugfs_remove(port->debugfs_file);1583157315841574 /*15851575 * Locks around here are not necessary - a port can't be
···165165166166/* Per policy Governers sysfs tunables */167167struct od_dbs_tuners {168168- unsigned int ignore_nice;168168+ unsigned int ignore_nice_load;169169 unsigned int sampling_rate;170170 unsigned int sampling_down_factor;171171 unsigned int up_threshold;···175175};176176177177struct cs_dbs_tuners {178178- unsigned int ignore_nice;178178+ unsigned int ignore_nice_load;179179 unsigned int sampling_rate;180180 unsigned int sampling_down_factor;181181 unsigned int up_threshold;
+10-10
drivers/cpufreq/cpufreq_ondemand.c
···403403 return count;404404}405405406406-static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf,407407- size_t count)406406+static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data,407407+ const char *buf, size_t count)408408{409409 struct od_dbs_tuners *od_tuners = dbs_data->tuners;410410 unsigned int input;···419419 if (input > 1)420420 input = 1;421421422422- if (input == od_tuners->ignore_nice) { /* nothing to do */422422+ if (input == od_tuners->ignore_nice_load) { /* nothing to do */423423 return count;424424 }425425- od_tuners->ignore_nice = input;425425+ od_tuners->ignore_nice_load = input;426426427427 /* we need to re-evaluate prev_cpu_idle */428428 for_each_online_cpu(j) {···430430 dbs_info = &per_cpu(od_cpu_dbs_info, j);431431 dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j,432432 &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy);433433- if (od_tuners->ignore_nice)433433+ if (od_tuners->ignore_nice_load)434434 dbs_info->cdbs.prev_cpu_nice =435435 kcpustat_cpu(j).cpustat[CPUTIME_NICE];436436···461461show_store_one(od, io_is_busy);462462show_store_one(od, up_threshold);463463show_store_one(od, sampling_down_factor);464464-show_store_one(od, ignore_nice);464464+show_store_one(od, ignore_nice_load);465465show_store_one(od, powersave_bias);466466declare_show_sampling_rate_min(od);467467···469469gov_sys_pol_attr_rw(io_is_busy);470470gov_sys_pol_attr_rw(up_threshold);471471gov_sys_pol_attr_rw(sampling_down_factor);472472-gov_sys_pol_attr_rw(ignore_nice);472472+gov_sys_pol_attr_rw(ignore_nice_load);473473gov_sys_pol_attr_rw(powersave_bias);474474gov_sys_pol_attr_ro(sampling_rate_min);475475···478478 &sampling_rate_gov_sys.attr,479479 &up_threshold_gov_sys.attr,480480 &sampling_down_factor_gov_sys.attr,481481- &ignore_nice_gov_sys.attr,481481+ &ignore_nice_load_gov_sys.attr,482482 &powersave_bias_gov_sys.attr,483483 &io_is_busy_gov_sys.attr,484484 NULL···494494 &sampling_rate_gov_pol.attr,495495 &up_threshold_gov_pol.attr,496496 &sampling_down_factor_gov_pol.attr,497497- &ignore_nice_gov_pol.attr,497497+ &ignore_nice_load_gov_pol.attr,498498 &powersave_bias_gov_pol.attr,499499 &io_is_busy_gov_pol.attr,500500 NULL···544544 }545545546546 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;547547- tuners->ignore_nice = 0;547547+ tuners->ignore_nice_load = 0;548548 tuners->powersave_bias = default_powersave_bias;549549 tuners->io_is_busy = should_io_be_busy();550550
+6-5
drivers/cpufreq/loongson2_cpufreq.c
···118118 clk_put(cpuclk);119119 return -EINVAL;120120 }121121- ret = clk_set_rate(cpuclk, rate);122122- if (ret) {123123- clk_put(cpuclk);124124- return ret;125125- }126121127122 /* clock table init */128123 for (i = 2;129124 (loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END);130125 i++)131126 loongson2_clockmod_table[i].frequency = (rate * i) / 8;127127+128128+ ret = clk_set_rate(cpuclk, rate);129129+ if (ret) {130130+ clk_put(cpuclk);131131+ return ret;132132+ }132133133134 policy->cur = loongson2_cpufreq_get(policy->cpu);134135
+1
drivers/dma/pch_dma.c
···867867868868 if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {869869 dev_err(&pdev->dev, "Cannot find proper base address\n");870870+ err = -ENODEV;870871 goto err_disable_pdev;871872 }872873
···708708 /* Subtract time delta from raw timestamp to get final709709 * vblank_time timestamp for end of vblank.710710 */711711- etime = ktime_sub_ns(etime, delta_ns);711711+ if (delta_ns < 0)712712+ etime = ktime_add_ns(etime, -delta_ns);713713+ else714714+ etime = ktime_sub_ns(etime, delta_ns);712715 *vblank_time = ktime_to_timeval(etime);713716714717 DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
+9-3
drivers/gpu/drm/i915/i915_reg.h
···18561856#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)1857185718581858#define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114)18591859-/* HDMI/DP bits are gen4+ */18601860-#define PORTB_HOTPLUG_LIVE_STATUS (1 << 29)18591859+/*18601860+ * HDMI/DP bits are gen4+18611861+ *18621862+ * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused.18631863+ * Please check the detailed lore in the commit message for for experimental18641864+ * evidence.18651865+ */18661866+#define PORTD_HOTPLUG_LIVE_STATUS (1 << 29)18611867#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28)18621862-#define PORTD_HOTPLUG_LIVE_STATUS (1 << 27)18681868+#define PORTB_HOTPLUG_LIVE_STATUS (1 << 27)18631869#define PORTD_HOTPLUG_INT_STATUS (3 << 21)18641870#define PORTC_HOTPLUG_INT_STATUS (3 << 19)18651871#define PORTB_HOTPLUG_INT_STATUS (3 << 17)
+3-1
drivers/gpu/drm/i915/intel_display.c
···8269826982708270 list_for_each_entry(encoder, &dev->mode_config.encoder_list,82718271 base.head) {82728272+ enum pipe pipe;82728273 if (encoder->base.crtc != &crtc->base)82738274 continue;82748274- if (encoder->get_config)82758275+ if (encoder->get_config &&82768276+ encoder->get_hw_state(encoder, &pipe))82758277 encoder->get_config(encoder, &pipe_config);82768278 }82778279
+16-2
drivers/gpu/drm/i915/intel_panel.c
···497497 goto out;498498 }499499500500- /* scale to hardware */501501- level = level * freq / max;500500+ /* scale to hardware, but be careful to not overflow */501501+ if (freq < max)502502+ level = level * freq / max;503503+ else504504+ level = freq / max * level;502505503506 dev_priv->backlight.level = level;504507 if (dev_priv->backlight.device)···517514{518515 struct drm_i915_private *dev_priv = dev->dev_private;519516 unsigned long flags;517517+518518+ /*519519+ * Do not disable backlight on the vgaswitcheroo path. When switching520520+ * away from i915, the other client may depend on i915 to handle the521521+ * backlight. This will leave the backlight on unnecessarily when522522+ * another client is not activated.523523+ */524524+ if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) {525525+ DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");526526+ return;527527+ }520528521529 spin_lock_irqsave(&dev_priv->backlight.lock, flags);522530
+18
drivers/gpu/drm/i915/intel_pm.c
···50635063 }50645064 } else {50655065 if (enable_requested) {50665066+ unsigned long irqflags;50675067+ enum pipe p;50685068+50665069 I915_WRITE(HSW_PWR_WELL_DRIVER, 0);50705070+ POSTING_READ(HSW_PWR_WELL_DRIVER);50675071 DRM_DEBUG_KMS("Requesting to disable the power well\n");50725072+50735073+ /*50745074+ * After this, the registers on the pipes that are part50755075+ * of the power well will become zero, so we have to50765076+ * adjust our counters according to that.50775077+ *50785078+ * FIXME: Should we do this in general in50795079+ * drm_vblank_post_modeset?50805080+ */50815081+ spin_lock_irqsave(&dev->vbl_lock, irqflags);50825082+ for_each_pipe(p)50835083+ if (p != PIPE_A)50845084+ dev->last_vblank[p] = 0;50855085+ spin_unlock_irqrestore(&dev->vbl_lock, irqflags);50685086 }50695087 }50705088}
···493493 * based on this empirical measurement and a lot of previous frobbing.494494 */495495 i2c->cmd_err = 0;496496- if (msg->len < 8) {496496+ if (0) { /* disable PIO mode until a proper fix is made */497497 ret = mxs_i2c_pio_setup_xfer(adap, msg, flags);498498 if (ret)499499 mxs_i2c_reset(i2c);
+22-8
drivers/iio/adc/ti_am335x_adc.c
···6060{6161 unsigned int stepconfig;6262 int i, steps;6363- u32 step_en;64636564 /*6665 * There are 16 configurable steps and 8 analog input···8586 adc_dev->channel_step[i] = steps;8687 steps++;8788 }8888- step_en = get_adc_step_mask(adc_dev);8989- am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en);8989+9090}91919292static const char * const chan_name_ain[] = {···140142 int *val, int *val2, long mask)141143{142144 struct tiadc_device *adc_dev = iio_priv(indio_dev);143143- int i;144144- unsigned int fifo1count, read;145145+ int i, map_val;146146+ unsigned int fifo1count, read, stepid;145147 u32 step = UINT_MAX;146148 bool found = false;149149+ u32 step_en;150150+ unsigned long timeout = jiffies + usecs_to_jiffies151151+ (IDLE_TIMEOUT * adc_dev->channels);152152+ step_en = get_adc_step_mask(adc_dev);153153+ am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en);154154+155155+ /* Wait for ADC sequencer to complete sampling */156156+ while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) {157157+ if (time_after(jiffies, timeout))158158+ return -EAGAIN;159159+ }160160+ map_val = chan->channel + TOTAL_CHANNELS;147161148162 /*149163 * When the sub-system is first enabled,···180170 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);181171 for (i = 0; i < fifo1count; i++) {182172 read = tiadc_readl(adc_dev, REG_FIFO1);183183- if (read >> 16 == step) {184184- *val = read & 0xfff;173173+ stepid = read & FIFOREAD_CHNLID_MASK;174174+ stepid = stepid >> 0x10;175175+176176+ if (stepid == map_val) {177177+ read = read & FIFOREAD_DATA_MASK;185178 found = true;179179+ *val = read;186180 }187181 }188188- am335x_tsc_se_update(adc_dev->mfd_tscadc);182182+189183 if (found == false)190184 return -EBUSY;191185 return IIO_VAL_INT;
+22-12
drivers/iio/industrialio-trigger.c
···127127void iio_trigger_poll(struct iio_trigger *trig, s64 time)128128{129129 int i;130130- if (!trig->use_count)131131- for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++)132132- if (trig->subirqs[i].enabled) {133133- trig->use_count++;130130+131131+ if (!atomic_read(&trig->use_count)) {132132+ atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);133133+134134+ for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {135135+ if (trig->subirqs[i].enabled)134136 generic_handle_irq(trig->subirq_base + i);135135- }137137+ else138138+ iio_trigger_notify_done(trig);139139+ }140140+ }136141}137142EXPORT_SYMBOL(iio_trigger_poll);138143···151146void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time)152147{153148 int i;154154- if (!trig->use_count)155155- for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++)156156- if (trig->subirqs[i].enabled) {157157- trig->use_count++;149149+150150+ if (!atomic_read(&trig->use_count)) {151151+ atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);152152+153153+ for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {154154+ if (trig->subirqs[i].enabled)158155 handle_nested_irq(trig->subirq_base + i);159159- }156156+ else157157+ iio_trigger_notify_done(trig);158158+ }159159+ }160160}161161EXPORT_SYMBOL(iio_trigger_poll_chained);162162163163void iio_trigger_notify_done(struct iio_trigger *trig)164164{165165- trig->use_count--;166166- if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable)165165+ if (atomic_dec_and_test(&trig->use_count) && trig->ops &&166166+ trig->ops->try_reenable)167167 if (trig->ops->try_reenable(trig))168168 /* Missed an interrupt so launch new poll now */169169 iio_trigger_poll(trig, 0);
+2-2
drivers/media/i2c/ml86v7667.c
···117117{118118 struct v4l2_subdev *sd = to_sd(ctrl);119119 struct i2c_client *client = v4l2_get_subdevdata(sd);120120- int ret;120120+ int ret = -EINVAL;121121122122 switch (ctrl->id) {123123 case V4L2_CID_BRIGHTNESS:···157157 break;158158 }159159160160- return 0;160160+ return ret;161161}162162163163static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
···303303304304 dev->workqueue = 0;305305306306+ /* init video transfer queues first of all */307307+ /* to prevent oops in hdpvr_delete() on error paths */308308+ INIT_LIST_HEAD(&dev->free_buff_list);309309+ INIT_LIST_HEAD(&dev->rec_buff_list);310310+306311 /* register v4l2_device early so it can be used for printks */307312 if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) {308313 dev_err(&interface->dev, "v4l2_device_register failed\n");···329324 dev->workqueue = create_singlethread_workqueue("hdpvr_buffer");330325 if (!dev->workqueue)331326 goto error;332332-333333- /* init video transfer queues */334334- INIT_LIST_HEAD(&dev->free_buff_list);335335- INIT_LIST_HEAD(&dev->rec_buff_list);336327337328 dev->options = hdpvr_default_options;338329···406405 video_nr[atomic_inc_return(&dev_nr)]);407406 if (retval < 0) {408407 v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");409409- goto error;408408+ goto reg_fail;410409 }411410412411 /* let the user know what node this device is now attached to */
+1-1
drivers/media/usb/usbtv/Kconfig
···11config VIDEO_USBTV22 tristate "USBTV007 video capture support"33- depends on VIDEO_DEV33+ depends on VIDEO_V4L244 select VIDEOBUF2_VMALLOC5566 ---help---
+38-13
drivers/media/usb/usbtv/usbtv.c
···5757#define USBTV_CHUNK_SIZE 2565858#define USBTV_CHUNK 2405959#define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \6060- / 2 / USBTV_CHUNK)6060+ / 4 / USBTV_CHUNK)61616262/* Chunk header. */6363#define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \···8989 /* Number of currently processed frame, useful find9090 * out when a new one begins. */9191 u32 frame_id;9292+ int chunks_done;92939394 int iso_size;9495 unsigned int sequence;···203202 return 0;204203}205204205205+/* Copy data from chunk into a frame buffer, deinterlacing the data206206+ * into every second line. Unfortunately, they don't align nicely into207207+ * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels.208208+ * Therefore, we break down the chunk into two halves before copyting,209209+ * so that we can interleave a line if needed. */210210+static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd)211211+{212212+ int half;213213+214214+ for (half = 0; half < 2; half++) {215215+ int part_no = chunk_no * 2 + half;216216+ int line = part_no / 3;217217+ int part_index = (line * 2 + !odd) * 3 + (part_no % 3);218218+219219+ u32 *dst = &frame[part_index * USBTV_CHUNK/2];220220+ memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src));221221+ src += USBTV_CHUNK/2;222222+ }223223+}224224+206225/* Called for each 256-byte image chunk.207226 * First word identifies the chunk, followed by 240 words of image208227 * data and padding. */···239218 frame_id = USBTV_FRAME_ID(chunk);240219 odd = USBTV_ODD(chunk);241220 chunk_no = USBTV_CHUNK_NO(chunk);242242-243243- /* Deinterlace. TODO: Use interlaced frame format. */244244- chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3;245245- chunk_no += !odd * 3;246246-247221 if (chunk_no >= USBTV_CHUNKS)248222 return;249223250224 /* Beginning of a frame. */251251- if (chunk_no == 0)225225+ if (chunk_no == 0) {252226 usbtv->frame_id = frame_id;227227+ usbtv->chunks_done = 0;228228+ }229229+230230+ if (usbtv->frame_id != frame_id)231231+ return;253232254233 spin_lock_irqsave(&usbtv->buflock, flags);255234 if (list_empty(&usbtv->bufs)) {···262241 buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list);263242 frame = vb2_plane_vaddr(&buf->vb, 0);264243265265- /* Copy the chunk. */266266- memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1],267267- USBTV_CHUNK * sizeof(chunk[1]));244244+ /* Copy the chunk data. */245245+ usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd);246246+ usbtv->chunks_done++;268247269248 /* Last chunk in a frame, signalling an end */270270- if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) {249249+ if (odd && chunk_no == USBTV_CHUNKS-1) {271250 int size = vb2_plane_size(&buf->vb, 0);251251+ enum vb2_buffer_state state = usbtv->chunks_done ==252252+ USBTV_CHUNKS ?253253+ VB2_BUF_STATE_DONE :254254+ VB2_BUF_STATE_ERROR;272255273256 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;274257 buf->vb.v4l2_buf.sequence = usbtv->sequence++;275258 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);276259 vb2_set_plane_payload(&buf->vb, 0, size);277277- vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);260260+ vb2_buffer_done(&buf->vb, state);278261 list_del(&buf->list);279262 }280263···543518 if (*nbuffers < 2)544519 *nbuffers = 2;545520 *nplanes = 1;546546- sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32);521521+ sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32);547522548523 return 0;549524}
···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",
···21612161 if (err)21622162 goto err_out_disable_mbx_intr;2163216321642164- qlcnic_set_drv_version(adapter);21642164+ if (adapter->portnum == 0)21652165+ qlcnic_set_drv_version(adapter);2165216621662167 pci_set_drvdata(pdev, adapter);21672168···30843083 adapter->fw_fail_cnt = 0;30853084 adapter->flags &= ~QLCNIC_FW_HANG;30863085 clear_bit(__QLCNIC_RESETTING, &adapter->state);30873087- qlcnic_set_drv_version(adapter);30863086+ if (adapter->portnum == 0)30873087+ qlcnic_set_drv_version(adapter);3088308830893089 if (!qlcnic_clr_drv_state(adapter))30903090 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;
···742742 return -EADDRNOTAVAIL;743743 }744744745745+ if (data && data[IFLA_MACVLAN_FLAGS] &&746746+ nla_get_u16(data[IFLA_MACVLAN_FLAGS]) & ~MACVLAN_FLAG_NOPROMISC)747747+ return -EINVAL;748748+745749 if (data && data[IFLA_MACVLAN_MODE]) {746750 switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) {747751 case MACVLAN_MODE_PRIVATE:
+9-3
drivers/net/macvtap.c
···715715 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;716716 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;717717 }718718- if (vlan)718718+ if (vlan) {719719+ local_bh_disable();719720 macvlan_start_xmit(skb, vlan->dev);720720- else721721+ local_bh_enable();722722+ } else {721723 kfree_skb(skb);724724+ }722725 rcu_read_unlock();723726724727 return total_len;···812809done:813810 rcu_read_lock();814811 vlan = rcu_dereference(q->vlan);815815- if (vlan)812812+ if (vlan) {813813+ preempt_disable();816814 macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0);815815+ preempt_enable();816816+ }817817 rcu_read_unlock();818818819819 return ret ? ret : copied;
+4-2
drivers/net/tun.c
···977977 u32 rxhash;978978979979 if (!(tun->flags & TUN_NO_PI)) {980980- if ((len -= sizeof(pi)) > total_len)980980+ if (len < sizeof(pi))981981 return -EINVAL;982982+ len -= sizeof(pi);982983983984 if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi)))984985 return -EFAULT;···987986 }988987989988 if (tun->flags & TUN_VNET_HDR) {990990- if ((len -= tun->vnet_hdr_sz) > total_len)989989+ if (len < tun->vnet_hdr_sz)991990 return -EINVAL;991991+ len -= tun->vnet_hdr_sz;992992993993 if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso)))994994 return -EFAULT;
···317317/* ACPI bus type */318318static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)319319{320320- struct pci_dev * pci_dev;321321- u64 addr;320320+ struct pci_dev *pci_dev = to_pci_dev(dev);321321+ bool is_bridge;322322+ u64 addr;322323323323- pci_dev = to_pci_dev(dev);324324+ /*325325+ * pci_is_bridge() is not suitable here, because pci_dev->subordinate326326+ * is set only after acpi_pci_find_device() has been called for the327327+ * given device.328328+ */329329+ is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE330330+ || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;324331 /* Please ref to ACPI spec for the syntax of _ADR */325332 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);326326- *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr);333333+ *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge);327334 if (!*handle)328335 return -ENODEV;329336 return 0;
+25-10
drivers/rtc/rtc-stmp3xxx.c
···2323#include <linux/init.h>2424#include <linux/platform_device.h>2525#include <linux/interrupt.h>2626+#include <linux/delay.h>2627#include <linux/rtc.h>2728#include <linux/slab.h>2829#include <linux/of_device.h>···120119}121120#endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */122121123123-static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)122122+static int stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)124123{124124+ int timeout = 5000; /* 3ms according to i.MX28 Ref Manual */125125 /*126126- * The datasheet doesn't say which way round the127127- * NEW_REGS/STALE_REGS bitfields go. In fact it's 0x1=P0,128128- * 0x2=P1, .., 0x20=P5, 0x40=ALARM, 0x80=SECONDS126126+ * The i.MX28 Applications Processor Reference Manual, Rev. 1, 2010127127+ * states:128128+ * | The order in which registers are updated is129129+ * | Persistent 0, 1, 2, 3, 4, 5, Alarm, Seconds.130130+ * | (This list is in bitfield order, from LSB to MSB, as they would131131+ * | appear in the STALE_REGS and NEW_REGS bitfields of the HW_RTC_STAT132132+ * | register. For example, the Seconds register corresponds to133133+ * | STALE_REGS or NEW_REGS containing 0x80.)129134 */130130- while (readl(rtc_data->io + STMP3XXX_RTC_STAT) &131131- (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT))132132- cpu_relax();135135+ do {136136+ if (!(readl(rtc_data->io + STMP3XXX_RTC_STAT) &137137+ (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)))138138+ return 0;139139+ udelay(1);140140+ } while (--timeout > 0);141141+ return (readl(rtc_data->io + STMP3XXX_RTC_STAT) &142142+ (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)) ? -ETIME : 0;133143}134144135145/* Time read/write */136146static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)137147{148148+ int ret;138149 struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);139150140140- stmp3xxx_wait_time(rtc_data);151151+ ret = stmp3xxx_wait_time(rtc_data);152152+ if (ret)153153+ return ret;154154+141155 rtc_time_to_tm(readl(rtc_data->io + STMP3XXX_RTC_SECONDS), rtc_tm);142156 return 0;143157}···162146 struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);163147164148 writel(t, rtc_data->io + STMP3XXX_RTC_SECONDS);165165- stmp3xxx_wait_time(rtc_data);166166- return 0;149149+ return stmp3xxx_wait_time(rtc_data);167150}168151169152/* interrupt(s) handler */
···35473547 break;35483548 }3549354935503550- /*35513551- * We expect the FW state to be READY35523552- */35533553- if (megasas_transition_to_ready(instance, 0))35543554- goto fail_ready_state;35503550+ if (megasas_transition_to_ready(instance, 0)) {35513551+ atomic_set(&instance->fw_reset_no_pci_access, 1);35523552+ instance->instancet->adp_reset35533553+ (instance, instance->reg_set);35543554+ atomic_set(&instance->fw_reset_no_pci_access, 0);35553555+ dev_info(&instance->pdev->dev,35563556+ "megasas: FW restarted successfully from %s!\n",35573557+ __func__);35583558+35593559+ /*waitting for about 30 second before retry*/35603560+ ssleep(30);35613561+35623562+ if (megasas_transition_to_ready(instance, 0))35633563+ goto fail_ready_state;35643564+ }3555356535563566 /*35573567 * MSI-X host index 0 is common for all adapter.
+3
drivers/scsi/scsi.c
···10311031{10321032 int i, result;1033103310341034+ if (sdev->skip_vpd_pages)10351035+ goto fail;10361036+10341037 /* Ask for all the pages supported by this device */10351038 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);10361039 if (result)
+1-1
drivers/scsi/virtio_scsi.c
···751751752752 vscsi->affinity_hint_set = true;753753 } else {754754- for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++)754754+ for (i = 0; i < vscsi->num_queues; i++)755755 virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1);756756757757 vscsi->affinity_hint_set = false;
···18111811#else18121812 if (*zcache_comp_name != '\0') {18131813 ret = crypto_has_comp(zcache_comp_name, 0, 0);18141814- if (!ret)18141814+ if (!ret) {18151815 pr_info("zcache: %s not supported\n",18161816 zcache_comp_name);18171817- goto out;18171817+ ret = 1;18181818+ goto out;18191819+ }18181820 }18191821 if (!ret)18201822 strcpy(zcache_comp_name, "lzo");
+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;
+3-2
drivers/usb/core/hub.c
···47984798 hub->ports[i - 1]->child;4799479948004800 dev_dbg(hub_dev, "warm reset port %d\n", i);48014801- if (!udev) {48014801+ if (!udev || !(portstatus &48024802+ USB_PORT_STAT_CONNECTION)) {48024803 status = hub_port_reset(hub, i,48034804 NULL, HUB_BH_RESET_TIME,48044805 true);···48094808 usb_lock_device(udev);48104809 status = usb_reset_device(udev);48114810 usb_unlock_device(udev);48114811+ connect_change = 0;48124812 }48134813- connect_change = 0;48144813 }4815481448164815 if (connect_change)
···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
···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/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 */
···40484048 }4049404940504050 while (!end) {40514051- u64 offset_in_extent;40514051+ u64 offset_in_extent = 0;4052405240534053 /* break if the extent we found is outside the range */40544054 if (em->start >= max || extent_map_end(em) < off)···4064406440654065 /*40664066 * record the offset from the start of the extent40674067- * for adjusting the disk offset below40674067+ * for adjusting the disk offset below. Only do this if the40684068+ * extent isn't compressed since our in ram offset may be past40694069+ * what we have actually allocated on disk.40684070 */40694069- offset_in_extent = em_start - em->start;40714071+ if (!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))40724072+ offset_in_extent = em_start - em->start;40704073 em_end = extent_map_end(em);40714074 em_len = em_end - em_start;40724075 emflags = em->flags;
···21662166 if (btrfs_file_extent_disk_bytenr(leaf, extent) != old->bytenr)21672167 continue;2168216821692169- extent_offset = btrfs_file_extent_offset(leaf, extent);21702170- if (key.offset - extent_offset != offset)21692169+ /*21702170+ * 'offset' refers to the exact key.offset,21712171+ * NOT the 'offset' field in btrfs_extent_data_ref, ie.21722172+ * (key.offset - extent_offset).21732173+ */21742174+ if (key.offset != offset)21712175 continue;2172217621772177+ extent_offset = btrfs_file_extent_offset(leaf, extent);21732178 num_bytes = btrfs_file_extent_num_bytes(leaf, extent);21792179+21742180 if (extent_offset >= old->extent_offset + old->offset +21752181 old->len || extent_offset + num_bytes <=21762182 old->extent_offset + old->offset)21772183 continue;2178218421852185+ ret = 0;21792186 break;21802187 }21812188···2194218721952188 backref->root_id = root_id;21962189 backref->inum = inum;21972197- backref->file_pos = offset + extent_offset;21902190+ backref->file_pos = offset;21982191 backref->num_bytes = num_bytes;21992192 backref->extent_offset = extent_offset;22002193 backref->generation = btrfs_file_extent_generation(leaf, extent);···22172210 new->path = path;2218221122192212 list_for_each_entry_safe(old, tmp, &new->head, list) {22202220- ret = iterate_inodes_from_logical(old->bytenr, fs_info,22132213+ ret = iterate_inodes_from_logical(old->bytenr +22142214+ old->extent_offset, fs_info,22212215 path, record_one_backref,22222216 old);22232217 BUG_ON(ret < 0 && ret != -ENOENT);···43994391 int mask = attr->ia_valid;44004392 int ret;4401439344024402- if (newsize == oldsize)44034403- return 0;44044404-44054394 /*44064395 * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a44074396 * special case where we need to update the times despite not having···51705165 }5171516651725167 /* Reached end of directory/root. Bump pos past the last item. */51735173- if (key_type == BTRFS_DIR_INDEX_KEY)51745174- /*51755175- * 32-bit glibc will use getdents64, but then strtol -51765176- * so the last number we can serve is this.51775177- */51785178- ctx->pos = 0x7fffffff;51795179- else51805180- ctx->pos++;51685168+ ctx->pos++;51695169+51705170+ /*51715171+ * Stop new entries from being returned after we return the last51725172+ * entry.51735173+ *51745174+ * New directory entries are assigned a strictly increasing51755175+ * offset. This means that new entries created during readdir51765176+ * are *guaranteed* to be seen in the future by that readdir.51775177+ * This has broken buggy programs which operate on names as51785178+ * they're returned by readdir. Until we re-use freed offsets51795179+ * we have this hack to stop new entries from being returned51805180+ * under the assumption that they'll never reach this huge51815181+ * offset.51825182+ *51835183+ * This is being careful not to overflow 32bit loff_t unless the51845184+ * last entry requires it because doing so has broken 32bit apps51855185+ * in the past.51865186+ */51875187+ if (key_type == BTRFS_DIR_INDEX_KEY) {51885188+ if (ctx->pos >= INT_MAX)51895189+ ctx->pos = LLONG_MAX;51905190+ else51915191+ ctx->pos = INT_MAX;51925192+ }51815193nopos:51825194 ret = 0;51835195err:
+4-4
fs/btrfs/transaction.c
···983983 * a dirty root struct and adds it into the list of dead roots that need to984984 * be deleted985985 */986986-int btrfs_add_dead_root(struct btrfs_root *root)986986+void btrfs_add_dead_root(struct btrfs_root *root)987987{988988 spin_lock(&root->fs_info->trans_lock);989989- list_add_tail(&root->root_list, &root->fs_info->dead_roots);989989+ if (list_empty(&root->root_list))990990+ list_add_tail(&root->root_list, &root->fs_info->dead_roots);990991 spin_unlock(&root->fs_info->trans_lock);991991- return 0;992992}993993994994/*···19251925 }19261926 root = list_first_entry(&fs_info->dead_roots,19271927 struct btrfs_root, root_list);19281928- list_del(&root->root_list);19281928+ list_del_init(&root->root_list);19291929 spin_unlock(&fs_info->trans_lock);1930193019311931 pr_debug("btrfs: cleaner removing %llu\n",
···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;
···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.
···36713671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)36723672 return -EINVAL;36733673 /*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.36743674+ * Using empty names is equivalent to using AT_SYMLINK_FOLLOW36753675+ * on /proc/self/fd/<fd>.36773676 */36783678- if (flags & AT_EMPTY_PATH) {36793679- if (!capable(CAP_DAC_READ_SEARCH))36803680- return -ENOENT;36773677+ if (flags & AT_EMPTY_PATH)36813678 how = LOOKUP_EMPTY;36823682- }3683367936843680 if (flags & AT_SYMLINK_FOLLOW)36853681 how |= LOOKUP_FOLLOW;
+8-3
fs/nfs/inode.c
···463463 unlock_new_inode(inode);464464 } else465465 nfs_refresh_inode(inode, fattr);466466- nfs_setsecurity(inode, fattr, label);467466 dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n",468467 inode->i_sb->s_id,469468 (long long)NFS_FILEID(inode),···962963static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)963964{964965 struct nfs_inode *nfsi = NFS_I(inode);965965-966966+ int ret;967967+966968 if (mapping->nrpages != 0) {967967- int ret = invalidate_inode_pages2(mapping);969969+ if (S_ISREG(inode->i_mode)) {970970+ ret = nfs_sync_mapping(mapping);971971+ if (ret < 0)972972+ return ret;973973+ }974974+ ret = invalidate_inode_pages2(mapping);968975 if (ret < 0)969976 return ret;970977 }
···24782478 if (server->flags & NFS_MOUNT_NOAC)24792479 sb_mntdata.mntflags |= MS_SYNCHRONOUS;2480248024812481+ if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL)24822482+ if (mount_info->cloned->sb->s_flags & MS_SYNCHRONOUS)24832483+ sb_mntdata.mntflags |= MS_SYNCHRONOUS;24842484+24812485 /* Get a superblock - note that we may end up sharing one that already exists */24822486 s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata);24832487 if (IS_ERR(s)) {
···1919/*2020 * LOCKING:2121 *2222- * We rely on new Alexander Viro's super-block locking.2222+ * These guys are evicted from procfs as the very first step in ->kill_sb().2323 *2424 */25252626-static int show_version(struct seq_file *m, struct super_block *sb)2626+static int show_version(struct seq_file *m, void *unused)2727{2828+ struct super_block *sb = m->private;2829 char *format;29303031 if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) {···6766#define DJP( x ) le32_to_cpu( jp -> x )6867#define JF( x ) ( r -> s_journal -> x )69687070-static int show_super(struct seq_file *m, struct super_block *sb)6969+static int show_super(struct seq_file *m, void *unused)7170{7171+ struct super_block *sb = m->private;7272 struct reiserfs_sb_info *r = REISERFS_SB(sb);73737474 seq_printf(m, "state: \t%s\n"···130128 return 0;131129}132130133133-static int show_per_level(struct seq_file *m, struct super_block *sb)131131+static int show_per_level(struct seq_file *m, void *unused)134132{133133+ struct super_block *sb = m->private;135134 struct reiserfs_sb_info *r = REISERFS_SB(sb);136135 int level;137136···189186 return 0;190187}191188192192-static int show_bitmap(struct seq_file *m, struct super_block *sb)189189+static int show_bitmap(struct seq_file *m, void *unused)193190{191191+ struct super_block *sb = m->private;194192 struct reiserfs_sb_info *r = REISERFS_SB(sb);195193196194 seq_printf(m, "free_block: %lu\n"···222218 return 0;223219}224220225225-static int show_on_disk_super(struct seq_file *m, struct super_block *sb)221221+static int show_on_disk_super(struct seq_file *m, void *unused)226222{223223+ struct super_block *sb = m->private;227224 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);228225 struct reiserfs_super_block *rs = sb_info->s_rs;229226 int hash_code = DFL(s_hash_function_code);···266261 return 0;267262}268263269269-static int show_oidmap(struct seq_file *m, struct super_block *sb)264264+static int show_oidmap(struct seq_file *m, void *unused)270265{266266+ struct super_block *sb = m->private;271267 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);272268 struct reiserfs_super_block *rs = sb_info->s_rs;273269 unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize);···297291 return 0;298292}299293300300-static int show_journal(struct seq_file *m, struct super_block *sb)294294+static int show_journal(struct seq_file *m, void *unused)301295{296296+ struct super_block *sb = m->private;302297 struct reiserfs_sb_info *r = REISERFS_SB(sb);303298 struct reiserfs_super_block *rs = r->s_rs;304299 struct journal_params *jp = &rs->s_v1.s_journal;···390383 return 0;391384}392385393393-/* iterator */394394-static int test_sb(struct super_block *sb, void *data)395395-{396396- return data == sb;397397-}398398-399399-static int set_sb(struct super_block *sb, void *data)400400-{401401- return -ENOENT;402402-}403403-404404-struct reiserfs_seq_private {405405- struct super_block *sb;406406- int (*show) (struct seq_file *, struct super_block *);407407-};408408-409409-static void *r_start(struct seq_file *m, loff_t * pos)410410-{411411- struct reiserfs_seq_private *priv = m->private;412412- loff_t l = *pos;413413-414414- if (l)415415- return NULL;416416-417417- if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb)))418418- return NULL;419419-420420- up_write(&priv->sb->s_umount);421421- return priv->sb;422422-}423423-424424-static void *r_next(struct seq_file *m, void *v, loff_t * pos)425425-{426426- ++*pos;427427- if (v)428428- deactivate_super(v);429429- return NULL;430430-}431431-432432-static void r_stop(struct seq_file *m, void *v)433433-{434434- if (v)435435- deactivate_super(v);436436-}437437-438438-static int r_show(struct seq_file *m, void *v)439439-{440440- struct reiserfs_seq_private *priv = m->private;441441- return priv->show(m, v);442442-}443443-444444-static const struct seq_operations r_ops = {445445- .start = r_start,446446- .next = r_next,447447- .stop = r_stop,448448- .show = r_show,449449-};450450-451386static int r_open(struct inode *inode, struct file *file)452387{453453- struct reiserfs_seq_private *priv;454454- int ret = seq_open_private(file, &r_ops,455455- sizeof(struct reiserfs_seq_private));456456-457457- if (!ret) {458458- struct seq_file *m = file->private_data;459459- priv = m->private;460460- priv->sb = proc_get_parent_data(inode);461461- priv->show = PDE_DATA(inode);462462- }463463- return ret;388388+ return single_open(file, PDE_DATA(inode), 389389+ proc_get_parent_data(inode));464390}465391466392static const struct file_operations r_file_operations = {467393 .open = r_open,468394 .read = seq_read,469395 .llseek = seq_lseek,470470- .release = seq_release_private,471471- .owner = THIS_MODULE,396396+ .release = single_release,472397};473398474399static struct proc_dir_entry *proc_info_root = NULL;475400static const char proc_info_root_name[] = "fs/reiserfs";476401477402static void add_file(struct super_block *sb, char *name,478478- int (*func) (struct seq_file *, struct super_block *))403403+ int (*func) (struct seq_file *, void *))479404{480405 proc_create_data(name, 0, REISERFS_SB(sb)->procdir,481406 &r_file_operations, func);
+1-2
fs/reiserfs/super.c
···499499static void reiserfs_kill_sb(struct super_block *s)500500{501501 if (REISERFS_SB(s)) {502502+ reiserfs_proc_info_done(s);502503 /*503504 * Force any pending inode evictions to occur now. Any504505 * inodes to be removed that have extended attributes···554553 reiserfs_warning(s, "green-2005", "reserved blocks left %d",555554 REISERFS_SB(s)->reserved_blocks);556555 }557557-558558- reiserfs_proc_info_done(s);559556560557 reiserfs_write_unlock(s);561558 mutex_destroy(&REISERFS_SB(s)->lock);
···112112113113#define HAVE_GENERIC_MMU_GATHER114114115115-void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm);115115+void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end);116116void tlb_flush_mmu(struct mmu_gather *tlb);117117void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start,118118 unsigned long end);
+7-5
include/linux/ftrace_event.h
···7878 /* trace_seq for __print_flags() and __print_symbolic() etc. */7979 struct trace_seq tmp_seq;80808181+ cpumask_var_t started;8282+8383+ /* it's true when current open file is snapshot */8484+ bool snapshot;8585+8186 /* The below is zeroed out in pipe_read */8287 struct trace_seq seq;8388 struct trace_entry *ent;···9590 loff_t pos;9691 long idx;97929898- cpumask_var_t started;9999-100100- /* it's true when current open file is snapshot */101101- bool snapshot;9393+ /* All new field here will be zeroed out in pipe_read */10294};1039510496enum trace_iter_flags {···334332 const char *name, int offset, int size,335333 int is_signed, int filter_type);336334extern int trace_add_event_call(struct ftrace_event_call *call);337337-extern void trace_remove_event_call(struct ftrace_event_call *call);335335+extern int trace_remove_event_call(struct ftrace_event_call *call);338336339337#define is_signed_type(type) (((type)(-1)) < (type)1)340338
···113113#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)114114#define CNTRLREG_TSCENB BIT(7)115115116116+/* FIFO READ Register */117117+#define FIFOREAD_DATA_MASK (0xfff << 0)118118+#define FIFOREAD_CHNLID_MASK (0xf << 16)119119+120120+/* Sequencer Status */121121+#define SEQ_STATUS BIT(5)122122+116123#define ADC_CLK 3000000117124#define MAX_CLK_DIV 7118125#define TOTAL_STEPS 16119126#define TOTAL_CHANNELS 8127127+128128+/*129129+* ADC runs at 3MHz, and it takes130130+* 15 cycles to latch one data output.131131+* Hence the idle time for ADC to132132+* process one sample data would be133133+* around 5 micro seconds.134134+*/135135+#define IDLE_TIMEOUT 5 /* microsec */120136121137#define TSCADC_CELLS 2122138
···314314struct user_namespace;315315316316#ifdef CONFIG_MMU317317+extern unsigned long mmap_legacy_base(void);317318extern void arch_pick_mmap_layout(struct mm_struct *mm);318319extern unsigned long319320arch_get_unmapped_area(struct file *, unsigned long, unsigned long,···15331532 * Test if a process is not yet dead (at most zombie state)15341533 * If pid_alive fails, then pointers within the task structure15351534 * can be stale and must not be dereferenced.15351535+ *15361536+ * Return: 1 if the process is alive. 0 otherwise.15361537 */15371538static inline int pid_alive(struct task_struct *p)15381539{···15461543 * @tsk: Task structure to be checked.15471544 *15481545 * Check if a task structure is the first user space task the kernel created.15461546+ *15471547+ * Return: 1 if the task structure is init. 0 otherwise.15491548 */15501549static inline int is_global_init(struct task_struct *tsk)15511550{···18991894/**19001895 * is_idle_task - is the specified task an idle task?19011896 * @p: the task in question.18971897+ *18981898+ * Return: 1 if @p is an idle task. 0 otherwise.19021899 */19031900static inline bool is_idle_task(const struct task_struct *p)19041901{
+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/**
+1
include/linux/sunrpc/sched.h
···121121#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */122122#define RPC_TASK_SENT 0x0800 /* message was sent */123123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */124124+#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */124125125126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)126127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
···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,
+1
include/linux/user_namespace.h
···2323 struct uid_gid_map projid_map;2424 atomic_t count;2525 struct user_namespace *parent;2626+ int level;2627 kuid_t owner;2728 kgid_t group;2829 unsigned int proc_inum;
···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}
···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)···66826632 * @cpu: the processor in question.66836633 *66846634 * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!66356635+ *66366636+ * Return: The current task for @cpu.66856637 */66866638struct task_struct *curr_task(int cpu)66876639{
+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 /*···42814280 * get_sd_load_idx - Obtain the load index for a given sched domain.42824281 * @sd: The sched_domain whose load_idx is to be obtained.42834282 * @idle: The Idle status of the CPU for whose sd load_icx is obtained.42834283+ *42844284+ * Return: The load index.42844285 */42854286static inline int get_sd_load_idx(struct sched_domain *sd,42864287 enum cpu_idle_type idle)···45774574 *45784575 * Determine if @sg is a busier group than the previously selected45794576 * busiest group.45774577+ *45784578+ * Return: %true if @sg is a busier group than the previously selected45794579+ * busiest group. %false otherwise.45804580 */45814581static bool update_sd_pick_busiest(struct lb_env *env,45824582 struct sd_lb_stats *sds,···46974691 * assuming lower CPU number will be equivalent to lower a SMT thread46984692 * number.46994693 *47004700- * Returns 1 when packing is required and a task should be moved to46944694+ * Return: 1 when packing is required and a task should be moved to47014695 * this CPU. The amount of the imbalance is returned in *imbalance.47024696 *47034697 * @env: The load balancing environment.···48754869 * @balance: Pointer to a variable indicating if this_cpu48764870 * is the appropriate cpu to perform load balancing at this_level.48774871 *48784878- * Returns: - the busiest group if imbalance exists.48724872+ * Return: - The busiest group if imbalance exists.48794873 * - If no imbalance and user has opted for power-savings balance,48804874 * return the least loaded group whose CPUs can be48814875 * put to idle by rebalancing its tasks onto our group.
+72-15
kernel/trace/ftrace.c
···21692169static unsigned long ftrace_update_cnt;21702170unsigned long ftrace_update_tot_cnt;2171217121722172-static int ops_traces_mod(struct ftrace_ops *ops)21722172+static inline int ops_traces_mod(struct ftrace_ops *ops)21732173{21742174- struct ftrace_hash *hash;21742174+ /*21752175+ * Filter_hash being empty will default to trace module.21762176+ * But notrace hash requires a test of individual module functions.21772177+ */21782178+ return ftrace_hash_empty(ops->filter_hash) &&21792179+ ftrace_hash_empty(ops->notrace_hash);21802180+}2175218121762176- hash = ops->filter_hash;21772177- return ftrace_hash_empty(hash);21822182+/*21832183+ * Check if the current ops references the record.21842184+ *21852185+ * If the ops traces all functions, then it was already accounted for.21862186+ * If the ops does not trace the current record function, skip it.21872187+ * If the ops ignores the function via notrace filter, skip it.21882188+ */21892189+static inline bool21902190+ops_references_rec(struct ftrace_ops *ops, struct dyn_ftrace *rec)21912191+{21922192+ /* If ops isn't enabled, ignore it */21932193+ if (!(ops->flags & FTRACE_OPS_FL_ENABLED))21942194+ return 0;21952195+21962196+ /* If ops traces all mods, we already accounted for it */21972197+ if (ops_traces_mod(ops))21982198+ return 0;21992199+22002200+ /* The function must be in the filter */22012201+ if (!ftrace_hash_empty(ops->filter_hash) &&22022202+ !ftrace_lookup_ip(ops->filter_hash, rec->ip))22032203+ return 0;22042204+22052205+ /* If in notrace hash, we ignore it too */22062206+ if (ftrace_lookup_ip(ops->notrace_hash, rec->ip))22072207+ return 0;22082208+22092209+ return 1;22102210+}22112211+22122212+static int referenced_filters(struct dyn_ftrace *rec)22132213+{22142214+ struct ftrace_ops *ops;22152215+ int cnt = 0;22162216+22172217+ for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) {22182218+ if (ops_references_rec(ops, rec))22192219+ cnt++;22202220+ }22212221+22222222+ return cnt;21782223}2179222421802225static int ftrace_update_code(struct module *mod)···22282183 struct dyn_ftrace *p;22292184 cycle_t start, stop;22302185 unsigned long ref = 0;21862186+ bool test = false;22312187 int i;2232218822332189 /*···2242219622432197 for (ops = ftrace_ops_list;22442198 ops != &ftrace_list_end; ops = ops->next) {22452245- if (ops->flags & FTRACE_OPS_FL_ENABLED &&22462246- ops_traces_mod(ops))22472247- ref++;21992199+ if (ops->flags & FTRACE_OPS_FL_ENABLED) {22002200+ if (ops_traces_mod(ops))22012201+ ref++;22022202+ else22032203+ test = true;22042204+ }22482205 }22492206 }22502207···22572208 for (pg = ftrace_new_pgs; pg; pg = pg->next) {2258220922592210 for (i = 0; i < pg->index; i++) {22112211+ int cnt = ref;22122212+22602213 /* If something went wrong, bail without enabling anything */22612214 if (unlikely(ftrace_disabled))22622215 return -1;2263221622642217 p = &pg->records[i];22652265- p->flags = ref;22182218+ if (test)22192219+ cnt += referenced_filters(p);22202220+ p->flags = cnt;2266222122672222 /*22682223 * Do the initial record conversion from mcount jump···22862233 * conversion puts the module to the correct state, thus22872234 * passing the ftrace_make_call check.22882235 */22892289- if (ftrace_start_up && ref) {22362236+ if (ftrace_start_up && cnt) {22902237 int failed = __ftrace_replace_code(p, 1);22912238 if (failed)22922239 ftrace_bug(failed, p->ip);···34373384 return add_hash_entry(hash, ip);34383385}3439338633873387+static void ftrace_ops_update_code(struct ftrace_ops *ops)33883388+{33893389+ if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled)33903390+ ftrace_run_update_code(FTRACE_UPDATE_CALLS);33913391+}33923392+34403393static int34413394ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,34423395 unsigned long ip, int remove, int reset, int enable)···3485342634863427 mutex_lock(&ftrace_lock);34873428 ret = ftrace_hash_move(ops, enable, orig_hash, hash);34883488- if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED34893489- && ftrace_enabled)34903490- ftrace_run_update_code(FTRACE_UPDATE_CALLS);34293429+ if (!ret)34303430+ ftrace_ops_update_code(ops);3491343134923432 mutex_unlock(&ftrace_lock);34933433···37133655 mutex_lock(&ftrace_lock);37143656 ret = ftrace_hash_move(iter->ops, filter_hash,37153657 orig_hash, iter->hash);37163716- if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED)37173717- && ftrace_enabled)37183718- ftrace_run_update_code(FTRACE_UPDATE_CALLS);36583658+ if (!ret)36593659+ ftrace_ops_update_code(iter->ops);3719366037203661 mutex_unlock(&ftrace_lock);37213662 }
+14-13
kernel/trace/trace.c
···243243}244244EXPORT_SYMBOL_GPL(filter_current_check_discard);245245246246-cycle_t ftrace_now(int cpu)246246+cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)247247{248248 u64 ts;249249250250 /* Early boot up does not have a buffer yet */251251- if (!global_trace.trace_buffer.buffer)251251+ if (!buf->buffer)252252 return trace_clock_local();253253254254- ts = ring_buffer_time_stamp(global_trace.trace_buffer.buffer, cpu);255255- ring_buffer_normalize_time_stamp(global_trace.trace_buffer.buffer, cpu, &ts);254254+ ts = ring_buffer_time_stamp(buf->buffer, cpu);255255+ ring_buffer_normalize_time_stamp(buf->buffer, cpu, &ts);256256257257 return ts;258258+}259259+260260+cycle_t ftrace_now(int cpu)261261+{262262+ return buffer_ftrace_now(&global_trace.trace_buffer, cpu);258263}259264260265/**···12161211 /* Make sure all commits have finished */12171212 synchronize_sched();1218121312191219- buf->time_start = ftrace_now(buf->cpu);12141214+ buf->time_start = buffer_ftrace_now(buf, buf->cpu);1220121512211216 for_each_online_cpu(cpu)12221217 ring_buffer_reset_cpu(buffer, cpu);1223121812241219 ring_buffer_record_enable(buffer);12251225-}12261226-12271227-void tracing_reset_current(int cpu)12281228-{12291229- tracing_reset(&global_trace.trace_buffer, cpu);12301220}1231122112321222/* Must have trace_types_lock held */···41514151 memset(&iter->seq, 0,41524152 sizeof(struct trace_iterator) -41534153 offsetof(struct trace_iterator, seq));41544154+ cpumask_clear(iter->started);41544155 iter->pos = -1;4155415641564157 trace_event_read_lock();···4469446844704469 /* disable tracing ? */44714470 if (trace_flags & TRACE_ITER_STOP_ON_FREE)44724472- tracing_off();44714471+ tracer_tracing_off(tr);44734472 /* resize the ring buffer to 0 */44744473 tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS);44754474···46344633 * New clock may not be consistent with the previous clock.46354634 * Reset the buffer so that it doesn't have incomparable timestamps.46364635 */46374637- tracing_reset_online_cpus(&global_trace.trace_buffer);46364636+ tracing_reset_online_cpus(&tr->trace_buffer);4638463746394638#ifdef CONFIG_TRACER_MAX_TRACE46404639 if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer)46414640 ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func);46424642- tracing_reset_online_cpus(&global_trace.max_buffer);46414641+ tracing_reset_online_cpus(&tr->max_buffer);46434642#endif4644464346454644 mutex_unlock(&trace_types_lock);
+129-75
kernel/trace/trace_events.c
···409409 mutex_unlock(&event_mutex);410410}411411412412-/*413413- * Open and update trace_array ref count.414414- * Must have the current trace_array passed to it.415415- */416416-static int tracing_open_generic_file(struct inode *inode, struct file *filp)412412+static void remove_subsystem(struct ftrace_subsystem_dir *dir)417413{418418- struct ftrace_event_file *file = inode->i_private;419419- struct trace_array *tr = file->tr;420420- int ret;414414+ if (!dir)415415+ return;421416422422- if (trace_array_get(tr) < 0)423423- return -ENODEV;424424-425425- ret = tracing_open_generic(inode, filp);426426- if (ret < 0)427427- trace_array_put(tr);428428- return ret;417417+ if (!--dir->nr_events) {418418+ debugfs_remove_recursive(dir->entry);419419+ list_del(&dir->list);420420+ __put_system_dir(dir);421421+ }429422}430423431431-static int tracing_release_generic_file(struct inode *inode, struct file *filp)424424+static void *event_file_data(struct file *filp)432425{433433- struct ftrace_event_file *file = inode->i_private;434434- struct trace_array *tr = file->tr;426426+ return ACCESS_ONCE(file_inode(filp)->i_private);427427+}435428436436- trace_array_put(tr);429429+static void remove_event_file_dir(struct ftrace_event_file *file)430430+{431431+ struct dentry *dir = file->dir;432432+ struct dentry *child;437433438438- return 0;434434+ if (dir) {435435+ spin_lock(&dir->d_lock); /* probably unneeded */436436+ list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) {437437+ if (child->d_inode) /* probably unneeded */438438+ child->d_inode->i_private = NULL;439439+ }440440+ spin_unlock(&dir->d_lock);441441+442442+ debugfs_remove_recursive(dir);443443+ }444444+445445+ list_del(&file->list);446446+ remove_subsystem(file->system);447447+ kmem_cache_free(file_cachep, file);439448}440449441450/*···688679event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,689680 loff_t *ppos)690681{691691- struct ftrace_event_file *file = filp->private_data;682682+ struct ftrace_event_file *file;683683+ unsigned long flags;692684 char buf[4] = "0";693685694694- if (file->flags & FTRACE_EVENT_FL_ENABLED &&695695- !(file->flags & FTRACE_EVENT_FL_SOFT_DISABLED))686686+ mutex_lock(&event_mutex);687687+ file = event_file_data(filp);688688+ if (likely(file))689689+ flags = file->flags;690690+ mutex_unlock(&event_mutex);691691+692692+ if (!file)693693+ return -ENODEV;694694+695695+ if (flags & FTRACE_EVENT_FL_ENABLED &&696696+ !(flags & FTRACE_EVENT_FL_SOFT_DISABLED))696697 strcpy(buf, "1");697698698698- if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED ||699699- file->flags & FTRACE_EVENT_FL_SOFT_MODE)699699+ if (flags & FTRACE_EVENT_FL_SOFT_DISABLED ||700700+ flags & FTRACE_EVENT_FL_SOFT_MODE)700701 strcat(buf, "*");701702702703 strcat(buf, "\n");···718699event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,719700 loff_t *ppos)720701{721721- struct ftrace_event_file *file = filp->private_data;702702+ struct ftrace_event_file *file;722703 unsigned long val;723704 int ret;724724-725725- if (!file)726726- return -EINVAL;727705728706 ret = kstrtoul_from_user(ubuf, cnt, 10, &val);729707 if (ret)···733717 switch (val) {734718 case 0:735719 case 1:720720+ ret = -ENODEV;736721 mutex_lock(&event_mutex);737737- ret = ftrace_event_enable_disable(file, val);722722+ file = event_file_data(filp);723723+ if (likely(file))724724+ ret = ftrace_event_enable_disable(file, val);738725 mutex_unlock(&event_mutex);739726 break;740727···844825845826static void *f_next(struct seq_file *m, void *v, loff_t *pos)846827{847847- struct ftrace_event_call *call = m->private;828828+ struct ftrace_event_call *call = event_file_data(m->private);848829 struct list_head *common_head = &ftrace_common_fields;849830 struct list_head *head = trace_get_fields(call);850831 struct list_head *node = v;···876857877858static int f_show(struct seq_file *m, void *v)878859{879879- struct ftrace_event_call *call = m->private;860860+ struct ftrace_event_call *call = event_file_data(m->private);880861 struct ftrace_event_field *field;881862 const char *array_descriptor;882863···929910 void *p = (void *)FORMAT_HEADER;930911 loff_t l = 0;931912913913+ /* ->stop() is called even if ->start() fails */914914+ mutex_lock(&event_mutex);915915+ if (!event_file_data(m->private))916916+ return ERR_PTR(-ENODEV);917917+932918 while (l < *pos && p)933919 p = f_next(m, p, &l);934920···942918943919static void f_stop(struct seq_file *m, void *p)944920{921921+ mutex_unlock(&event_mutex);945922}946923947924static const struct seq_operations trace_format_seq_ops = {···954929955930static int trace_format_open(struct inode *inode, struct file *file)956931{957957- struct ftrace_event_call *call = inode->i_private;958932 struct seq_file *m;959933 int ret;960934···962938 return ret;963939964940 m = file->private_data;965965- m->private = call;941941+ m->private = file;966942967943 return 0;968944}···970946static ssize_t971947event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)972948{973973- struct ftrace_event_call *call = filp->private_data;949949+ int id = (long)event_file_data(filp);974950 char buf[32];975951 int len;976952977953 if (*ppos)978954 return 0;979955980980- len = sprintf(buf, "%d\n", call->event.type);956956+ if (unlikely(!id))957957+ return -ENODEV;958958+959959+ len = sprintf(buf, "%d\n", id);960960+981961 return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);982962}983963···989961event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,990962 loff_t *ppos)991963{992992- struct ftrace_event_call *call = filp->private_data;964964+ struct ftrace_event_call *call;993965 struct trace_seq *s;994994- int r;966966+ int r = -ENODEV;995967996968 if (*ppos)997969 return 0;998970999971 s = kmalloc(sizeof(*s), GFP_KERNEL);972972+1000973 if (!s)1001974 return -ENOMEM;10029751003976 trace_seq_init(s);100497710051005- print_event_filter(call, s);10061006- r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);978978+ mutex_lock(&event_mutex);979979+ call = event_file_data(filp);980980+ if (call)981981+ print_event_filter(call, s);982982+ mutex_unlock(&event_mutex);983983+984984+ if (call)985985+ r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);10079861008987 kfree(s);1009988···1021986event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,1022987 loff_t *ppos)1023988{10241024- struct ftrace_event_call *call = filp->private_data;989989+ struct ftrace_event_call *call;1025990 char *buf;10261026- int err;991991+ int err = -ENODEV;10279921028993 if (cnt >= PAGE_SIZE)1029994 return -EINVAL;···10381003 }10391004 buf[cnt] = '\0';1040100510411041- err = apply_event_filter(call, buf);10061006+ mutex_lock(&event_mutex);10071007+ call = event_file_data(filp);10081008+ if (call)10091009+ err = apply_event_filter(call, buf);10101010+ mutex_unlock(&event_mutex);10111011+10421012 free_page((unsigned long) buf);10431013 if (err < 0)10441014 return err;···12651225};1266122612671227static const struct file_operations ftrace_enable_fops = {12681268- .open = tracing_open_generic_file,12281228+ .open = tracing_open_generic,12691229 .read = event_enable_read,12701230 .write = event_enable_write,12711271- .release = tracing_release_generic_file,12721231 .llseek = default_llseek,12731232};12741233···12791240};1280124112811242static const struct file_operations ftrace_event_id_fops = {12821282- .open = tracing_open_generic,12831243 .read = event_id_read,12841244 .llseek = default_llseek,12851245};···1526148815271489#ifdef CONFIG_PERF_EVENTS15281490 if (call->event.type && call->class->reg)15291529- trace_create_file("id", 0444, file->dir, call,15301530- id);14911491+ trace_create_file("id", 0444, file->dir,14921492+ (void *)(long)call->event.type, id);15311493#endif1532149415331495 /*···15521514 return 0;15531515}1554151615551555-static void remove_subsystem(struct ftrace_subsystem_dir *dir)15561556-{15571557- if (!dir)15581558- return;15591559-15601560- if (!--dir->nr_events) {15611561- debugfs_remove_recursive(dir->entry);15621562- list_del(&dir->list);15631563- __put_system_dir(dir);15641564- }15651565-}15661566-15671517static void remove_event_from_tracers(struct ftrace_event_call *call)15681518{15691519 struct ftrace_event_file *file;15701520 struct trace_array *tr;1571152115721522 do_for_each_event_file_safe(tr, file) {15731573-15741523 if (file->event_call != call)15751524 continue;1576152515771577- list_del(&file->list);15781578- debugfs_remove_recursive(file->dir);15791579- remove_subsystem(file->system);15801580- kmem_cache_free(file_cachep, file);15811581-15261526+ remove_event_file_dir(file);15821527 /*15831528 * The do_for_each_event_file_safe() is15841529 * a double loop. After finding the call for this···17131692 destroy_preds(call);17141693}1715169417161716-/* Remove an event_call */17171717-void trace_remove_event_call(struct ftrace_event_call *call)16951695+static int probe_remove_event_call(struct ftrace_event_call *call)17181696{16971697+ struct trace_array *tr;16981698+ struct ftrace_event_file *file;16991699+17001700+#ifdef CONFIG_PERF_EVENTS17011701+ if (call->perf_refcount)17021702+ return -EBUSY;17031703+#endif17041704+ do_for_each_event_file(tr, file) {17051705+ if (file->event_call != call)17061706+ continue;17071707+ /*17081708+ * We can't rely on ftrace_event_enable_disable(enable => 0)17091709+ * we are going to do, FTRACE_EVENT_FL_SOFT_MODE can suppress17101710+ * TRACE_REG_UNREGISTER.17111711+ */17121712+ if (file->flags & FTRACE_EVENT_FL_ENABLED)17131713+ return -EBUSY;17141714+ /*17151715+ * The do_for_each_event_file_safe() is17161716+ * a double loop. After finding the call for this17171717+ * trace_array, we use break to jump to the next17181718+ * trace_array.17191719+ */17201720+ break;17211721+ } while_for_each_event_file();17221722+17231723+ __trace_remove_event_call(call);17241724+17251725+ return 0;17261726+}17271727+17281728+/* Remove an event_call */17291729+int trace_remove_event_call(struct ftrace_event_call *call)17301730+{17311731+ int ret;17321732+17191733 mutex_lock(&trace_types_lock);17201734 mutex_lock(&event_mutex);17211735 down_write(&trace_event_sem);17221722- __trace_remove_event_call(call);17361736+ ret = probe_remove_event_call(call);17231737 up_write(&trace_event_sem);17241738 mutex_unlock(&event_mutex);17251739 mutex_unlock(&trace_types_lock);17401740+17411741+ return ret;17261742}1727174317281744#define for_each_event(event, start, end) \···23282270{23292271 struct ftrace_event_file *file, *next;2330227223312331- list_for_each_entry_safe(file, next, &tr->events, list) {23322332- list_del(&file->list);23332333- debugfs_remove_recursive(file->dir);23342334- remove_subsystem(file->system);23352335- kmem_cache_free(file_cachep, file);23362336- }22732273+ list_for_each_entry_safe(file, next, &tr->events, list)22742274+ remove_event_file_dir(file);23372275}2338227623392277static void
+6-11
kernel/trace/trace_events_filter.c
···637637 free_page((unsigned long) buf);638638}639639640640+/* caller must hold event_mutex */640641void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s)641642{642642- struct event_filter *filter;643643+ struct event_filter *filter = call->filter;643644644644- mutex_lock(&event_mutex);645645- filter = call->filter;646645 if (filter && filter->filter_string)647646 trace_seq_printf(s, "%s\n", filter->filter_string);648647 else649648 trace_seq_puts(s, "none\n");650650- mutex_unlock(&event_mutex);651649}652650653651void print_subsystem_event_filter(struct event_subsystem *system,···18391841 return err;18401842}1841184318441844+/* caller must hold event_mutex */18421845int apply_event_filter(struct ftrace_event_call *call, char *filter_string)18431846{18441847 struct event_filter *filter;18451845- int err = 0;18461846-18471847- mutex_lock(&event_mutex);18481848+ int err;1848184918491850 if (!strcmp(strstrip(filter_string), "0")) {18501851 filter_disable(call);18511852 filter = call->filter;18521853 if (!filter)18531853- goto out_unlock;18541854+ return 0;18541855 RCU_INIT_POINTER(call->filter, NULL);18551856 /* Make sure the filter is not being used */18561857 synchronize_sched();18571858 __free_filter(filter);18581858- goto out_unlock;18591859+ return 0;18591860 }1860186118611862 err = create_filter(call, filter_string, true, &filter);···18811884 __free_filter(tmp);18821885 }18831886 }18841884-out_unlock:18851885- mutex_unlock(&event_mutex);1886188718871888 return err;18881889}
+15-6
kernel/trace/trace_kprobe.c
···9595}96969797static int register_probe_event(struct trace_probe *tp);9898-static void unregister_probe_event(struct trace_probe *tp);9898+static int unregister_probe_event(struct trace_probe *tp);9999100100static DEFINE_MUTEX(probe_lock);101101static LIST_HEAD(probe_list);···351351 if (trace_probe_is_enabled(tp))352352 return -EBUSY;353353354354+ /* Will fail if probe is being used by ftrace or perf */355355+ if (unregister_probe_event(tp))356356+ return -EBUSY;357357+354358 __unregister_trace_probe(tp);355359 list_del(&tp->list);356356- unregister_probe_event(tp);357360358361 return 0;359362}···635632 /* TODO: Use batch unregistration */636633 while (!list_empty(&probe_list)) {637634 tp = list_entry(probe_list.next, struct trace_probe, list);638638- unregister_trace_probe(tp);635635+ ret = unregister_trace_probe(tp);636636+ if (ret)637637+ goto end;639638 free_trace_probe(tp);640639 }641640···12521247 return ret;12531248}1254124912551255-static void unregister_probe_event(struct trace_probe *tp)12501250+static int unregister_probe_event(struct trace_probe *tp)12561251{12521252+ int ret;12531253+12571254 /* tp->event is unregistered in trace_remove_event_call() */12581258- trace_remove_event_call(&tp->call);12591259- kfree(tp->call.print_fmt);12551255+ ret = trace_remove_event_call(&tp->call);12561256+ if (!ret)12571257+ kfree(tp->call.print_fmt);12581258+ return ret;12601259}1261126012621261/* Make a debugfs interface for controlling probe points */
+38-13
kernel/trace/trace_uprobe.c
···7070 (sizeof(struct probe_arg) * (n)))71717272static int register_uprobe_event(struct trace_uprobe *tu);7373-static void unregister_uprobe_event(struct trace_uprobe *tu);7373+static int unregister_uprobe_event(struct trace_uprobe *tu);74747575static DEFINE_MUTEX(uprobe_lock);7676static LIST_HEAD(uprobe_list);···164164}165165166166/* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */167167-static void unregister_trace_uprobe(struct trace_uprobe *tu)167167+static int unregister_trace_uprobe(struct trace_uprobe *tu)168168{169169+ int ret;170170+171171+ ret = unregister_uprobe_event(tu);172172+ if (ret)173173+ return ret;174174+169175 list_del(&tu->list);170170- unregister_uprobe_event(tu);171176 free_trace_uprobe(tu);177177+ return 0;172178}173179174180/* Register a trace_uprobe and probe_event */···187181188182 /* register as an event */189183 old_tp = find_probe_event(tu->call.name, tu->call.class->system);190190- if (old_tp)184184+ if (old_tp) {191185 /* delete old event */192192- unregister_trace_uprobe(old_tp);186186+ ret = unregister_trace_uprobe(old_tp);187187+ if (ret)188188+ goto end;189189+ }193190194191 ret = register_uprobe_event(tu);195192 if (ret) {···265256 group = UPROBE_EVENT_SYSTEM;266257267258 if (is_delete) {259259+ int ret;260260+268261 if (!event) {269262 pr_info("Delete command needs an event name.\n");270263 return -EINVAL;···280269 return -ENOENT;281270 }282271 /* delete an event */283283- unregister_trace_uprobe(tu);272272+ ret = unregister_trace_uprobe(tu);284273 mutex_unlock(&uprobe_lock);285285- return 0;274274+ return ret;286275 }287276288277 if (argc < 2) {···419408 return ret;420409}421410422422-static void cleanup_all_probes(void)411411+static int cleanup_all_probes(void)423412{424413 struct trace_uprobe *tu;414414+ int ret = 0;425415426416 mutex_lock(&uprobe_lock);427417 while (!list_empty(&uprobe_list)) {428418 tu = list_entry(uprobe_list.next, struct trace_uprobe, list);429429- unregister_trace_uprobe(tu);419419+ ret = unregister_trace_uprobe(tu);420420+ if (ret)421421+ break;430422 }431423 mutex_unlock(&uprobe_lock);424424+ return ret;432425}433426434427/* Probes listing interfaces */···477462478463static int probes_open(struct inode *inode, struct file *file)479464{480480- if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC))481481- cleanup_all_probes();465465+ int ret;466466+467467+ if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {468468+ ret = cleanup_all_probes();469469+ if (ret)470470+ return ret;471471+ }482472483473 return seq_open(file, &probes_seq_op);484474}···988968 return ret;989969}990970991991-static void unregister_uprobe_event(struct trace_uprobe *tu)971971+static int unregister_uprobe_event(struct trace_uprobe *tu)992972{973973+ int ret;974974+993975 /* tu->event is unregistered in trace_remove_event_call() */994994- trace_remove_event_call(&tu->call);976976+ ret = trace_remove_event_call(&tu->call);977977+ if (ret)978978+ return ret;995979 kfree(tu->call.print_fmt);996980 tu->call.print_fmt = NULL;981981+ return 0;997982}998983999984/* Make a trace interface for controling probe points */
+13-4
kernel/user_namespace.c
···6262 kgid_t group = new->egid;6363 int ret;64646565+ if (parent_ns->level > 32)6666+ return -EUSERS;6767+6568 /*6669 * Verify that we can not violate the policy of which files6770 * may be accessed that is specified by the root directory,···9592 atomic_set(&ns->count, 1);9693 /* Leave the new->user_ns reference with the new user namespace. */9794 ns->parent = parent_ns;9595+ ns->level = parent_ns->level + 1;9896 ns->owner = owner;9997 ns->group = group;10098···109105int unshare_userns(unsigned long unshare_flags, struct cred **new_cred)110106{111107 struct cred *cred;108108+ int err = -ENOMEM;112109113110 if (!(unshare_flags & CLONE_NEWUSER))114111 return 0;115112116113 cred = prepare_creds();117117- if (!cred)118118- return -ENOMEM;114114+ if (cred) {115115+ err = create_user_ns(cred);116116+ if (err)117117+ put_cred(cred);118118+ else119119+ *new_cred = cred;120120+ }119121120120- *new_cred = cred;121121- return create_user_ns(cred);122122+ return err;122123}123124124125void free_user_ns(struct user_namespace *ns)
+34-10
kernel/workqueue.c
···28172817 return false;28182818}2819281928202820+static bool __flush_work(struct work_struct *work)28212821+{28222822+ struct wq_barrier barr;28232823+28242824+ if (start_flush_work(work, &barr)) {28252825+ wait_for_completion(&barr.done);28262826+ destroy_work_on_stack(&barr.work);28272827+ return true;28282828+ } else {28292829+ return false;28302830+ }28312831+}28322832+28202833/**28212834 * flush_work - wait for a work to finish executing the last queueing instance28222835 * @work: the work to flush···28432830 */28442831bool flush_work(struct work_struct *work)28452832{28462846- struct wq_barrier barr;28472847-28482833 lock_map_acquire(&work->lockdep_map);28492834 lock_map_release(&work->lockdep_map);2850283528512851- if (start_flush_work(work, &barr)) {28522852- wait_for_completion(&barr.done);28532853- destroy_work_on_stack(&barr.work);28542854- return true;28552855- } else {28562856- return false;28572857- }28362836+ return __flush_work(work);28582837}28592838EXPORT_SYMBOL_GPL(flush_work);28602839···34163411{34173412 to->nice = from->nice;34183413 cpumask_copy(to->cpumask, from->cpumask);34143414+ /*34153415+ * Unlike hash and equality test, this function doesn't ignore34163416+ * ->no_numa as it is used for both pool and wq attrs. Instead,34173417+ * get_unbound_pool() explicitly clears ->no_numa after copying.34183418+ */34193419+ to->no_numa = from->no_numa;34193420}3420342134213422/* hash value of the content of @attr */···3588357735893578 lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */35903579 copy_workqueue_attrs(pool->attrs, attrs);35803580+35813581+ /*35823582+ * no_numa isn't a worker_pool attribute, always clear it. See35833583+ * 'struct workqueue_attrs' comments for detail.35843584+ */35853585+ pool->attrs->no_numa = false;3591358635923587 /* if cpumask is contained inside a NUMA node, we belong to that node */35933588 if (wq_numa_enabled) {···4773475647744757 INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn);47754758 schedule_work_on(cpu, &wfc.work);47764776- flush_work(&wfc.work);47594759+47604760+ /*47614761+ * The work item is on-stack and can't lead to deadlock through47624762+ * flushing. Use __flush_work() to avoid spurious lockdep warnings47634763+ * when work_on_cpu()s are nested.47644764+ */47654765+ __flush_work(&wfc.work);47664766+47774767 return wfc.ret;47784768}47794769EXPORT_SYMBOL_GPL(work_on_cpu);
+9-4
mm/fremap.c
···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}
···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);
+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))
···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 }
+10-3
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)) {···433429 switch (packet_type) {434430 case BATADV_UNICAST:435431 batadv_unicast_prepare_skb(skb, orig_node);432432+ header_len = sizeof(struct batadv_unicast_packet);436433 break;437434 case BATADV_UNICAST_4ADDR:438435 batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,439436 packet_subtype);437437+ header_len = sizeof(struct batadv_unicast_4addr_packet);440438 break;441439 default:442440 /* this function supports UNICAST and UNICAST_4ADDR only. It···447441 goto out;448442 }449443444444+ ethhdr = (struct ethhdr *)(skb->data + header_len);450445 unicast_packet = (struct batadv_unicast_packet *)skb->data;451446452447 /* inform the destination node that we are still missing a correct route
+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;
+1-1
net/bridge/br_sysfs_br.c
···11/*22- * Sysfs attributes of bridge ports22+ * Sysfs attributes of bridge33 * Linux ethernet bridge44 *55 * Authors:
+1
net/core/flow_dissector.c
···6565 nhoff += sizeof(struct ipv6hdr);6666 break;6767 }6868+ case __constant_htons(ETH_P_8021AD):6869 case __constant_htons(ETH_P_8021Q): {6970 const struct vlan_hdr *vlan;7071 struct vlan_hdr _vlan;
+2-2
net/core/rtnetlink.c
···21792179 /* If aging addresses are supported device will need to21802180 * implement its own handler for this.21812181 */21822182- if (ndm->ndm_state & NUD_PERMANENT) {21822182+ if (!(ndm->ndm_state & NUD_PERMANENT)) {21832183 pr_info("%s: FDB only supports static addresses\n", dev->name);21842184 return -EINVAL;21852185 }···24072407 struct nlattr *extfilt;24082408 u32 filter_mask = 0;2409240924102410- extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct rtgenmsg),24102410+ extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg),24112411 IFLA_EXT_MASK);24122412 if (extfilt)24132413 filter_mask = nla_get_u32(extfilt);
···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]))
+7
net/netlink/genetlink.c
···789789 struct net *net = sock_net(skb->sk);790790 int chains_to_skip = cb->args[0];791791 int fams_to_skip = cb->args[1];792792+ bool need_locking = chains_to_skip || fams_to_skip;793793+794794+ if (need_locking)795795+ genl_lock();792796793797 for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) {794798 n = 0;···813809errout:814810 cb->args[0] = i;815811 cb->args[1] = n;812812+813813+ if (need_locking)814814+ genl_unlock();816815817816 return skb->len;818817}
···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;
+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
···840840 else841841 spc_state = SCTP_ADDR_AVAILABLE;842842 /* Don't inform ULP about transition from PF to843843- * active state and set cwnd to 1, see SCTP843843+ * active state and set cwnd to 1 MTU, see SCTP844844 * Quick failover draft section 5.1, point 5845845 */846846 if (transport->state == SCTP_PF) {847847 ulp_notify = false;848848- transport->cwnd = 1;848848+ transport->cwnd = asoc->pathmtu;849849 }850850 transport->state = SCTP_ACTIVE;851851 break;
+2-2
net/sctp/transport.c
···175175 return;176176 }177177178178- call_rcu(&transport->rcu, sctp_transport_destroy_rcu);179179-180178 sctp_packet_free(&transport->packet);181179182180 if (transport->asoc)183181 sctp_association_put(transport->asoc);182182+183183+ call_rcu(&transport->rcu, sctp_transport_destroy_rcu);184184}185185186186/* Start T3_rtx timer if it is not already running and update the heartbeat
+4
net/sunrpc/clnt.c
···16601660 task->tk_action = call_connect_status;16611661 if (task->tk_status < 0)16621662 return;16631663+ if (task->tk_flags & RPC_TASK_NOCONNECT) {16641664+ rpc_exit(task, -ENOTCONN);16651665+ return;16661666+ }16631667 xprt_connect(task);16641668 }16651669}
+1
net/sunrpc/netns.h
···2323 struct rpc_clnt *rpcb_local_clnt4;2424 spinlock_t rpcb_clnt_lock;2525 unsigned int rpcb_users;2626+ unsigned int rpcb_is_af_local : 1;26272728 struct mutex gssp_lock;2829 wait_queue_head_t gssp_wq;
+35-13
net/sunrpc/rpcb_clnt.c
···204204}205205206206static void rpcb_set_local(struct net *net, struct rpc_clnt *clnt,207207- struct rpc_clnt *clnt4)207207+ struct rpc_clnt *clnt4,208208+ bool is_af_local)208209{209210 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);210211211212 /* Protected by rpcb_create_local_mutex */212213 sn->rpcb_local_clnt = clnt;213214 sn->rpcb_local_clnt4 = clnt4;215215+ sn->rpcb_is_af_local = is_af_local ? 1 : 0;214216 smp_wmb(); 215217 sn->rpcb_users = 1;216218 dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: "···240238 .program = &rpcb_program,241239 .version = RPCBVERS_2,242240 .authflavor = RPC_AUTH_NULL,241241+ /*242242+ * We turn off the idle timeout to prevent the kernel243243+ * from automatically disconnecting the socket.244244+ * Otherwise, we'd have to cache the mount namespace245245+ * of the caller and somehow pass that to the socket246246+ * reconnect code.247247+ */248248+ .flags = RPC_CLNT_CREATE_NO_IDLE_TIMEOUT,243249 };244250 struct rpc_clnt *clnt, *clnt4;245251 int result = 0;···273263 clnt4 = NULL;274264 }275265276276- rpcb_set_local(net, clnt, clnt4);266266+ rpcb_set_local(net, clnt, clnt4, true);277267278268out:279269 return result;···325315 clnt4 = NULL;326316 }327317328328- rpcb_set_local(net, clnt, clnt4);318318+ rpcb_set_local(net, clnt, clnt4, false);329319330320out:331321 return result;···386376 return rpc_create(&args);387377}388378389389-static int rpcb_register_call(struct rpc_clnt *clnt, struct rpc_message *msg)379379+static int rpcb_register_call(struct sunrpc_net *sn, struct rpc_clnt *clnt, struct rpc_message *msg, bool is_set)390380{391391- int result, error = 0;381381+ int flags = RPC_TASK_NOCONNECT;382382+ int error, result = 0;392383384384+ if (is_set || !sn->rpcb_is_af_local)385385+ flags = RPC_TASK_SOFTCONN;393386 msg->rpc_resp = &result;394387395395- error = rpc_call_sync(clnt, msg, RPC_TASK_SOFTCONN);388388+ error = rpc_call_sync(clnt, msg, flags);396389 if (error < 0) {397390 dprintk("RPC: failed to contact local rpcbind "398391 "server (errno %d).\n", -error);···452439 .rpc_argp = &map,453440 };454441 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);442442+ bool is_set = false;455443456444 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "457445 "rpcbind\n", (port ? "" : "un"),458446 prog, vers, prot, port);459447460448 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET];461461- if (port)449449+ if (port != 0) {462450 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET];451451+ is_set = true;452452+ }463453464464- return rpcb_register_call(sn->rpcb_local_clnt, &msg);454454+ return rpcb_register_call(sn, sn->rpcb_local_clnt, &msg, is_set);465455}466456467457/*···477461 const struct sockaddr_in *sin = (const struct sockaddr_in *)sap;478462 struct rpcbind_args *map = msg->rpc_argp;479463 unsigned short port = ntohs(sin->sin_port);464464+ bool is_set = false;480465 int result;481466482467 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL);···488471 map->r_addr, map->r_netid);489472490473 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];491491- if (port)474474+ if (port != 0) {492475 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];476476+ is_set = true;477477+ }493478494494- result = rpcb_register_call(sn->rpcb_local_clnt4, msg);479479+ result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set);495480 kfree(map->r_addr);496481 return result;497482}···508489 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sap;509490 struct rpcbind_args *map = msg->rpc_argp;510491 unsigned short port = ntohs(sin6->sin6_port);492492+ bool is_set = false;511493 int result;512494513495 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL);···519499 map->r_addr, map->r_netid);520500521501 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];522522- if (port)502502+ if (port != 0) {523503 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];504504+ is_set = true;505505+ }524506525525- result = rpcb_register_call(sn->rpcb_local_clnt4, msg);507507+ result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set);526508 kfree(map->r_addr);527509 return result;528510}···541519 map->r_addr = "";542520 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];543521544544- return rpcb_register_call(sn->rpcb_local_clnt4, msg);522522+ return rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, false);545523}546524547525/**
···294294 /* Request PB3 as reset pin */295295 ret = devm_gpio_request_one(&pdev->dev,296296 CONFIG_SND_BF5XX_RESET_GPIO_NUM,297297- GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET") {297297+ GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET");298298+ if (ret) {298299 dev_err(&pdev->dev,299300 "Failed to request GPIO_%d for reset: %d\n",300301 CONFIG_SND_BF5XX_RESET_GPIO_NUM, ret);301301- goto gpio_err;302302+ return ret;302303 }303304#endif304305
-1
sound/soc/blackfin/bf5xx-ac97.h
···99#ifndef _BF5XX_AC97_H1010#define _BF5XX_AC97_H11111212-extern struct snd_ac97_bus_ops bf5xx_ac97_ops;1312extern struct snd_ac97 *ac97;1413/* Frame format in memory, only support stereo currently */1514struct ac97_frame {
···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};
+6-7
sound/usb/endpoint.c
···591591 ep->stride = frame_bits >> 3;592592 ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0;593593594594- /* calculate max. frequency */595595- if (ep->maxpacksize) {594594+ /* assume max. frequency is 25% higher than nominal */595595+ ep->freqmax = ep->freqn + (ep->freqn >> 2);596596+ maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))597597+ >> (16 - ep->datainterval);598598+ /* but wMaxPacketSize might reduce this */599599+ if (ep->maxpacksize && ep->maxpacksize < maxsize) {596600 /* whatever fits into a max. size packet */597601 maxsize = ep->maxpacksize;598602 ep->freqmax = (maxsize / (frame_bits >> 3))599603 << (16 - ep->datainterval);600600- } else {601601- /* no max. packet size: just take 25% higher than nominal */602602- ep->freqmax = ep->freqn + (ep->freqn >> 2);603603- maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))604604- >> (16 - ep->datainterval);605604 }606605607606 if (ep->fill_max)
+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 }