···779779 else780780 state = PWRDM_POWER_RET;781781782782-#ifdef CONFIG_CPU_IDLE783783- /*784784- * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot785785- * enable OFF mode in a stable form for previous revisions, restrict786786- * instead to RET787787- */788788- if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))789789- omap3_cpuidle_update_states(state, PWRDM_POWER_RET);790790- else791791- omap3_cpuidle_update_states(state, state);792792-#endif793793-794782 list_for_each_entry(pwrst, &pwrst_list, node) {795783 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583) &&796784 pwrst->pwrdm == core_pwrdm &&···882894 return -ENODEV;883895884896 pm_errata_configure();885885-886886- printk(KERN_ERR "Power Management for TI OMAP3.\n");887897888898 /* XXX prcm_setup_regs needs to be before enabling hw889899 * supervised mode for powerdomains */
···14581458 return err;14591459}1460146014611461+static const struct of_device_id schizo_match[];14611462static int __devinit schizo_probe(struct platform_device *op)14621463{14631463- if (!op->dev.of_match)14641464+ const struct of_device_id *match;14651465+14661466+ match = of_match_device(schizo_match, &op->dev);14671467+ if (!match)14641468 return -EINVAL;14651465- return __schizo_init(op, (unsigned long) op->dev.of_match->data);14691469+ return __schizo_init(op, (unsigned long)match->data);14661470}1467147114681472/* The ordering of this table is very important. Some Tomatillo
···289289290290 /* Also, handle the alignment code out of band. */291291cc_dword_align:292292- cmp %g1, 6293293- bl,a ccte292292+ cmp %g1, 16293293+ bge 1f294294+ srl %g1, 1, %o3295295+2: cmp %o3, 0296296+ be,a ccte294297 andcc %g1, 0xf, %o3295295- andcc %o0, 0x1, %g0298298+ andcc %o3, %o0, %g0 ! Check %o0 only (%o1 has the same last 2 bits)299299+ be,a 2b300300+ srl %o3, 1, %o3301301+1: andcc %o0, 0x1, %g0296302 bne ccslow297303 andcc %o0, 0x2, %g0298304 be 1f
+22-1
arch/um/os-Linux/util.c
···5566#include <stdio.h>77#include <stdlib.h>88+#include <unistd.h>89#include <errno.h>910#include <signal.h>1011#include <string.h>···7675 host.release, host.version, host.machine);7776}78777878+/*7979+ * We cannot use glibc's abort(). It makes use of tgkill() which8080+ * has no effect within UML's kernel threads.8181+ * After that glibc would execute an invalid instruction to kill8282+ * the calling process and UML crashes with SIGSEGV.8383+ */8484+static inline void __attribute__ ((noreturn)) uml_abort(void)8585+{8686+ sigset_t sig;8787+8888+ fflush(NULL);8989+9090+ if (!sigemptyset(&sig) && !sigaddset(&sig, SIGABRT))9191+ sigprocmask(SIG_UNBLOCK, &sig, 0);9292+9393+ for (;;)9494+ if (kill(getpid(), SIGABRT) < 0)9595+ exit(127);9696+}9797+7998void os_dump_core(void)8099{81100 int pid;···137116 while ((pid = waitpid(-1, NULL, WNOHANG | __WALL)) > 0)138117 os_kill_ptraced_process(pid, 0);139118140140- abort();119119+ uml_abort();141120}
···299299/* Install a pte for a particular vaddr in kernel space. */300300void set_pte_vaddr(unsigned long vaddr, pte_t pte);301301302302+extern void native_pagetable_reserve(u64 start, u64 end);302303#ifdef CONFIG_X86_32303304extern void native_pagetable_setup_start(pgd_t *base);304305extern void native_pagetable_setup_done(pgd_t *base);
+13-4
arch/x86/include/asm/uv/uv_bau.h
···9494/* after this # consecutive successes, bump up the throttle if it was lowered */9595#define COMPLETE_THRESHOLD 596969797+#define UV_LB_SUBNODEID 0x109898+9799/*98100 * number of entries in the destination side payload queue99101 */···126124 * The distribution specification (32 bytes) is interpreted as a 256-bit127125 * distribution vector. Adjacent bits correspond to consecutive even numbered128126 * nodeIDs. The result of adding the index of a given bit to the 15-bit129129- * 'base_dest_nodeid' field of the header corresponds to the127127+ * 'base_dest_nasid' field of the header corresponds to the130128 * destination nodeID associated with that specified bit.131129 */132130struct bau_target_uvhubmask {···178176struct bau_msg_header {179177 unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */180178 /* bits 5:0 */181181- unsigned int base_dest_nodeid:15; /* nasid of the */179179+ unsigned int base_dest_nasid:15; /* nasid of the */182180 /* bits 20:6 */ /* first bit in uvhub map */183181 unsigned int command:8; /* message type */184182 /* bits 28:21 */···380378 unsigned long d_rcanceled; /* number of messages canceled by resets */381379};382380381381+struct hub_and_pnode {382382+ short uvhub;383383+ short pnode;384384+};383385/*384386 * one per-cpu; to locate the software tables385387 */···405399 int baudisabled;406400 int set_bau_off;407401 short cpu;402402+ short osnode;408403 short uvhub_cpu;409404 short uvhub;410405 short cpus_in_socket;411406 short cpus_in_uvhub;407407+ short partition_base_pnode;412408 unsigned short message_number;413409 unsigned short uvhub_quiesce;414410 short socket_acknowledge_count[DEST_Q_SIZE];···430422 int congested_period;431423 cycles_t period_time;432424 long period_requests;425425+ struct hub_and_pnode *target_hub_and_pnode;433426};434427435428static inline int bau_uvhub_isset(int uvhub, struct bau_target_uvhubmask *dstp)436429{437430 return constant_test_bit(uvhub, &dstp->bits[0]);438431}439439-static inline void bau_uvhub_set(int uvhub, struct bau_target_uvhubmask *dstp)432432+static inline void bau_uvhub_set(int pnode, struct bau_target_uvhubmask *dstp)440433{441441- __set_bit(uvhub, &dstp->bits[0]);434434+ __set_bit(pnode, &dstp->bits[0]);442435}443436static inline void bau_uvhubs_clear(struct bau_target_uvhubmask *dstp,444437 int nbits)
+2
arch/x86/include/asm/uv/uv_hub.h
···398398 unsigned short nr_online_cpus;399399 unsigned short pnode;400400 short memory_nid;401401+ spinlock_t nmi_lock;402402+ unsigned long nmi_count;401403};402404extern struct uv_blade_info *uv_blade_info;403405extern short *uv_node_to_blade;
+15-1
arch/x86/include/asm/uv/uv_mmrs.h
···55 *66 * SGI UV MMR definitions77 *88- * Copyright (C) 2007-2010 Silicon Graphics, Inc. All rights reserved.88+ * Copyright (C) 2007-2011 Silicon Graphics, Inc. All rights reserved.99 */10101111#ifndef _ASM_X86_UV_UV_MMRS_H···10991099 } s;11001100};1101110111021102+/* ========================================================================= */11031103+/* UVH_SCRATCH5 */11041104+/* ========================================================================= */11051105+#define UVH_SCRATCH5 0x2d0200UL11061106+#define UVH_SCRATCH5_32 0x0077811071107+11081108+#define UVH_SCRATCH5_SCRATCH5_SHFT 011091109+#define UVH_SCRATCH5_SCRATCH5_MASK 0xffffffffffffffffUL11101110+union uvh_scratch5_u {11111111+ unsigned long v;11121112+ struct uvh_scratch5_s {11131113+ unsigned long scratch5 : 64; /* RW, W1CS */11141114+ } s;11151115+};1102111611031117#endif /* __ASM_UV_MMRS_X86_H__ */
+12
arch/x86/include/asm/x86_init.h
···6868};69697070/**7171+ * struct x86_init_mapping - platform specific initial kernel pagetable setup7272+ * @pagetable_reserve: reserve a range of addresses for kernel pagetable usage7373+ *7474+ * For more details on the purpose of this hook, look in7575+ * init_memory_mapping and the commit that added it.7676+ */7777+struct x86_init_mapping {7878+ void (*pagetable_reserve)(u64 start, u64 end);7979+};8080+8181+/**7182 * struct x86_init_paging - platform specific paging functions7283 * @pagetable_setup_start: platform specific pre paging_init() call7384 * @pagetable_setup_done: platform specific post paging_init() call···134123 struct x86_init_mpparse mpparse;135124 struct x86_init_irqs irqs;136125 struct x86_init_oem oem;126126+ struct x86_init_mapping mapping;137127 struct x86_init_paging paging;138128 struct x86_init_timers timers;139129 struct x86_init_iommu iommu;
+43-5
arch/x86/kernel/apic/x2apic_uv_x.c
···3737#include <asm/smp.h>3838#include <asm/x86_init.h>3939#include <asm/emergency-restart.h>4040+#include <asm/nmi.h>4141+4242+/* BMC sets a bit this MMR non-zero before sending an NMI */4343+#define UVH_NMI_MMR UVH_SCRATCH54444+#define UVH_NMI_MMR_CLEAR (UVH_NMI_MMR + 8)4545+#define UV_NMI_PENDING_MASK (1UL << 63)4646+DEFINE_PER_CPU(unsigned long, cpu_last_nmi_count);40474148DEFINE_PER_CPU(int, x2apic_extra_bits);4249···649642 */650643int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)651644{645645+ unsigned long real_uv_nmi;646646+ int bid;647647+652648 if (reason != DIE_NMIUNKNOWN)653649 return NOTIFY_OK;654650655651 if (in_crash_kexec)656652 /* do nothing if entering the crash kernel */657653 return NOTIFY_OK;654654+658655 /*659659- * Use a lock so only one cpu prints at a time660660- * to prevent intermixed output.656656+ * Each blade has an MMR that indicates when an NMI has been sent657657+ * to cpus on the blade. If an NMI is detected, atomically658658+ * clear the MMR and update a per-blade NMI count used to659659+ * cause each cpu on the blade to notice a new NMI.660660+ */661661+ bid = uv_numa_blade_id();662662+ real_uv_nmi = (uv_read_local_mmr(UVH_NMI_MMR) & UV_NMI_PENDING_MASK);663663+664664+ if (unlikely(real_uv_nmi)) {665665+ spin_lock(&uv_blade_info[bid].nmi_lock);666666+ real_uv_nmi = (uv_read_local_mmr(UVH_NMI_MMR) & UV_NMI_PENDING_MASK);667667+ if (real_uv_nmi) {668668+ uv_blade_info[bid].nmi_count++;669669+ uv_write_local_mmr(UVH_NMI_MMR_CLEAR, UV_NMI_PENDING_MASK);670670+ }671671+ spin_unlock(&uv_blade_info[bid].nmi_lock);672672+ }673673+674674+ if (likely(__get_cpu_var(cpu_last_nmi_count) == uv_blade_info[bid].nmi_count))675675+ return NOTIFY_DONE;676676+677677+ __get_cpu_var(cpu_last_nmi_count) = uv_blade_info[bid].nmi_count;678678+679679+ /*680680+ * Use a lock so only one cpu prints at a time.681681+ * This prevents intermixed output.661682 */662683 spin_lock(&uv_nmi_lock);663663- pr_info("NMI stack dump cpu %u:\n", smp_processor_id());684684+ pr_info("UV NMI stack dump cpu %u:\n", smp_processor_id());664685 dump_stack();665686 spin_unlock(&uv_nmi_lock);666687···696661}697662698663static struct notifier_block uv_dump_stack_nmi_nb = {699699- .notifier_call = uv_handle_nmi664664+ .notifier_call = uv_handle_nmi,665665+ .priority = NMI_LOCAL_LOW_PRIOR - 1,700666};701667702668void uv_register_nmi_notifier(void)···756720 printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades());757721758722 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();759759- uv_blade_info = kmalloc(bytes, GFP_KERNEL);723723+ uv_blade_info = kzalloc(bytes, GFP_KERNEL);760724 BUG_ON(!uv_blade_info);725725+761726 for (blade = 0; blade < uv_num_possible_blades(); blade++)762727 uv_blade_info[blade].memory_nid = -1;763728···784747 uv_blade_info[blade].pnode = pnode;785748 uv_blade_info[blade].nr_possible_cpus = 0;786749 uv_blade_info[blade].nr_online_cpus = 0;750750+ spin_lock_init(&uv_blade_info[blade].nmi_lock);787751 max_pnode = max(pnode, max_pnode);788752 blade++;789753 }
+2-2
arch/x86/kernel/cpu/amd.c
···613613#endif614614615615 /* As a rule processors have APIC timer running in deep C states */616616- if (c->x86 >= 0xf && !cpu_has_amd_erratum(amd_erratum_400))616616+ if (c->x86 > 0xf && !cpu_has_amd_erratum(amd_erratum_400))617617 set_cpu_cap(c, X86_FEATURE_ARAT);618618619619 /*···698698 */699699700700const int amd_erratum_400[] =701701- AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0x0f, 0x4, 0x2, 0xff, 0xf),701701+ AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf),702702 AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf));703703EXPORT_SYMBOL_GPL(amd_erratum_400);704704
···446446 */447447 rdmsr(MSR_IA32_MISC_ENABLE, l, h);448448449449+ h = lvtthmr_init;449450 /*450451 * The initial value of thermal LVT entries on all APs always reads451452 * 0x10000 because APs are woken up by BSP issuing INIT-SIPI-SIPI452453 * sequence to them and LVT registers are reset to 0s except for453454 * the mask bits which are set to 1s when APs receive INIT IPI.454454- * Always restore the value that BIOS has programmed on AP based on455455- * BSP's info we saved since BIOS is always setting the same value456456- * for all threads/cores455455+ * If BIOS takes over the thermal interrupt and sets its interrupt456456+ * delivery mode to SMI (not fixed), it restores the value that the457457+ * BIOS has programmed on AP based on BSP's info we saved since BIOS458458+ * is always setting the same value for all threads/cores.457459 */458458- apic_write(APIC_LVTTHMR, lvtthmr_init);460460+ if ((h & APIC_DM_FIXED_MASK) != APIC_DM_FIXED)461461+ apic_write(APIC_LVTTHMR, lvtthmr_init);459462460460- h = lvtthmr_init;461463462464 if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) {463465 printk(KERN_DEBUG
+3-2
arch/x86/kernel/kprobes.c
···11831183 struct pt_regs *regs)11841184{11851185 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();11861186+ unsigned long flags;1186118711871188 /* This is possible if op is under delayed unoptimizing */11881189 if (kprobe_disabled(&op->kp))11891190 return;1190119111911191- preempt_disable();11921192+ local_irq_save(flags);11921193 if (kprobe_running()) {11931194 kprobes_inc_nmissed_count(&op->kp);11941195 } else {···12081207 opt_pre_handler(&op->kp, regs);12091208 __this_cpu_write(current_kprobe, NULL);12101209 }12111211- preempt_enable_no_resched();12101210+ local_irq_restore(flags);12121211}1213121212141213static int __kprobes copy_optimized_instructions(u8 *dest, u8 *src)
···8181 end, pgt_buf_start << PAGE_SHIFT, pgt_buf_top << PAGE_SHIFT);8282}83838484+void __init native_pagetable_reserve(u64 start, u64 end)8585+{8686+ memblock_x86_reserve_range(start, end, "PGTABLE");8787+}8888+8489struct map_range {8590 unsigned long start;8691 unsigned long end;···277272278273 __flush_tlb_all();279274275275+ /*276276+ * Reserve the kernel pagetable pages we used (pgt_buf_start -277277+ * pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top)278278+ * so that they can be reused for other purposes.279279+ *280280+ * On native it just means calling memblock_x86_reserve_range, on Xen it281281+ * also means marking RW the pagetable pages that we allocated before282282+ * but that haven't been used.283283+ *284284+ * In fact on xen we mark RO the whole range pgt_buf_start -285285+ * pgt_buf_top, because we have to make sure that when286286+ * init_memory_mapping reaches the pagetable pages area, it maps287287+ * RO all the pagetable pages, including the ones that are beyond288288+ * pgt_buf_end at that time.289289+ */280290 if (!after_bootmem && pgt_buf_end > pgt_buf_start)281281- memblock_x86_reserve_range(pgt_buf_start << PAGE_SHIFT,282282- pgt_buf_end << PAGE_SHIFT, "PGTABLE");291291+ x86_init.mapping.pagetable_reserve(PFN_PHYS(pgt_buf_start),292292+ PFN_PHYS(pgt_buf_end));283293284294 if (!after_bootmem)285295 early_memtest(start, end);
+64-30
arch/x86/platform/uv/tlb_uv.c
···699699 struct mm_struct *mm,700700 unsigned long va, unsigned int cpu)701701{702702- int tcpu;703703- int uvhub;704702 int locals = 0;705703 int remotes = 0;706704 int hubs = 0;705705+ int tcpu;706706+ int tpnode;707707 struct bau_desc *bau_desc;708708 struct cpumask *flush_mask;709709 struct ptc_stats *stat;710710 struct bau_control *bcp;711711 struct bau_control *tbcp;712712+ struct hub_and_pnode *hpp;712713713714 /* kernel was booted 'nobau' */714715 if (nobau)···751750 bau_desc += UV_ITEMS_PER_DESCRIPTOR * bcp->uvhub_cpu;752751 bau_uvhubs_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE);753752754754- /* cpu statistics */755753 for_each_cpu(tcpu, flush_mask) {756756- uvhub = uv_cpu_to_blade_id(tcpu);757757- bau_uvhub_set(uvhub, &bau_desc->distribution);758758- if (uvhub == bcp->uvhub)754754+ /*755755+ * The distribution vector is a bit map of pnodes, relative756756+ * to the partition base pnode (and the partition base nasid757757+ * in the header).758758+ * Translate cpu to pnode and hub using an array stored759759+ * in local memory.760760+ */761761+ hpp = &bcp->socket_master->target_hub_and_pnode[tcpu];762762+ tpnode = hpp->pnode - bcp->partition_base_pnode;763763+ bau_uvhub_set(tpnode, &bau_desc->distribution);764764+ if (hpp->uvhub == bcp->uvhub)759765 locals++;760766 else761767 remotes++;···863855 * an interrupt, but causes an error message to be returned to864856 * the sender.865857 */866866-static void uv_enable_timeouts(void)858858+static void __init uv_enable_timeouts(void)867859{868860 int uvhub;869861 int nuvhubs;···13341326}1335132713361328/*13371337- * initialize the sending side's sending buffers13291329+ * Initialize the sending side's sending buffers.13381330 */13391331static void13401340-uv_activation_descriptor_init(int node, int pnode)13321332+uv_activation_descriptor_init(int node, int pnode, int base_pnode)13411333{13421334 int i;13431335 int cpu;···13601352 n = pa >> uv_nshift;13611353 m = pa & uv_mmask;1362135413551355+ /* the 14-bit pnode */13631356 uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE,13641357 (n << UV_DESC_BASE_PNODE_SHIFT | m));13651365-13661358 /*13671367- * initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each13591359+ * Initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each13681360 * cpu even though we only use the first one; one descriptor can13691361 * describe a broadcast to 256 uv hubs.13701362 */···13731365 memset(bd2, 0, sizeof(struct bau_desc));13741366 bd2->header.sw_ack_flag = 1;13751367 /*13761376- * base_dest_nodeid is the nasid of the first uvhub13771377- * in the partition. The bit map will indicate uvhub numbers,13781378- * which are 0-N in a partition. Pnodes are unique system-wide.13681368+ * The base_dest_nasid set in the message header is the nasid13691369+ * of the first uvhub in the partition. The bit map will13701370+ * indicate destination pnode numbers relative to that base.13711371+ * They may not be consecutive if nasid striding is being used.13791372 */13801380- bd2->header.base_dest_nodeid = UV_PNODE_TO_NASID(uv_partition_base_pnode);13811381- bd2->header.dest_subnodeid = 0x10; /* the LB */13731373+ bd2->header.base_dest_nasid = UV_PNODE_TO_NASID(base_pnode);13741374+ bd2->header.dest_subnodeid = UV_LB_SUBNODEID;13821375 bd2->header.command = UV_NET_ENDPOINT_INTD;13831376 bd2->header.int_both = 1;13841377 /*···14511442/*14521443 * Initialization of each UV hub's structures14531444 */14541454-static void __init uv_init_uvhub(int uvhub, int vector)14451445+static void __init uv_init_uvhub(int uvhub, int vector, int base_pnode)14551446{14561447 int node;14571448 int pnode;···1459145014601451 node = uvhub_to_first_node(uvhub);14611452 pnode = uv_blade_to_pnode(uvhub);14621462- uv_activation_descriptor_init(node, pnode);14531453+ uv_activation_descriptor_init(node, pnode, base_pnode);14631454 uv_payload_queue_init(node, pnode);14641455 /*14651465- * the below initialization can't be in firmware because the14661466- * messaging IRQ will be determined by the OS14561456+ * The below initialization can't be in firmware because the14571457+ * messaging IRQ will be determined by the OS.14671458 */14681459 apicid = uvhub_to_first_apicid(uvhub) | uv_apicid_hibits;14691460 uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG,···15001491/*15011492 * initialize the bau_control structure for each cpu15021493 */15031503-static int __init uv_init_per_cpu(int nuvhubs)14941494+static int __init uv_init_per_cpu(int nuvhubs, int base_part_pnode)15041495{15051496 int i;15061497 int cpu;14981498+ int tcpu;15071499 int pnode;15081500 int uvhub;15091501 int have_hmaster;···15381528 bcp = &per_cpu(bau_control, cpu);15391529 memset(bcp, 0, sizeof(struct bau_control));15401530 pnode = uv_cpu_hub_info(cpu)->pnode;15311531+ if ((pnode - base_part_pnode) >= UV_DISTRIBUTION_SIZE) {15321532+ printk(KERN_EMERG15331533+ "cpu %d pnode %d-%d beyond %d; BAU disabled\n",15341534+ cpu, pnode, base_part_pnode,15351535+ UV_DISTRIBUTION_SIZE);15361536+ return 1;15371537+ }15381538+ bcp->osnode = cpu_to_node(cpu);15391539+ bcp->partition_base_pnode = uv_partition_base_pnode;15411540 uvhub = uv_cpu_hub_info(cpu)->numa_blade_id;15421541 *(uvhub_mask + (uvhub/8)) |= (1 << (uvhub%8));15431542 bdp = &uvhub_descs[uvhub];···15551536 bdp->pnode = pnode;15561537 /* kludge: 'assuming' one node per socket, and assuming that15571538 disabling a socket just leaves a gap in node numbers */15581558- socket = (cpu_to_node(cpu) & 1);15391539+ socket = bcp->osnode & 1;15591540 bdp->socket_mask |= (1 << socket);15601541 sdp = &bdp->socket[socket];15611542 sdp->cpu_number[sdp->num_cpus] = cpu;···16041585nextsocket:16051586 socket++;16061587 socket_mask = (socket_mask >> 1);15881588+ /* each socket gets a local array of pnodes/hubs */15891589+ bcp = smaster;15901590+ bcp->target_hub_and_pnode = kmalloc_node(15911591+ sizeof(struct hub_and_pnode) *15921592+ num_possible_cpus(), GFP_KERNEL, bcp->osnode);15931593+ memset(bcp->target_hub_and_pnode, 0,15941594+ sizeof(struct hub_and_pnode) *15951595+ num_possible_cpus());15961596+ for_each_present_cpu(tcpu) {15971597+ bcp->target_hub_and_pnode[tcpu].pnode =15981598+ uv_cpu_hub_info(tcpu)->pnode;15991599+ bcp->target_hub_and_pnode[tcpu].uvhub =16001600+ uv_cpu_hub_info(tcpu)->numa_blade_id;16011601+ }16071602 }16081603 }16091604 kfree(uvhub_descs);···16701637 spin_lock_init(&disable_lock);16711638 congested_cycles = microsec_2_cycles(congested_response_us);1672163916731673- if (uv_init_per_cpu(nuvhubs)) {16401640+ uv_partition_base_pnode = 0x7fffffff;16411641+ for (uvhub = 0; uvhub < nuvhubs; uvhub++) {16421642+ if (uv_blade_nr_possible_cpus(uvhub) &&16431643+ (uv_blade_to_pnode(uvhub) < uv_partition_base_pnode))16441644+ uv_partition_base_pnode = uv_blade_to_pnode(uvhub);16451645+ }16461646+16471647+ if (uv_init_per_cpu(nuvhubs, uv_partition_base_pnode)) {16741648 nobau = 1;16751649 return 0;16761650 }1677165116781678- uv_partition_base_pnode = 0x7fffffff;16791679- for (uvhub = 0; uvhub < nuvhubs; uvhub++)16801680- if (uv_blade_nr_possible_cpus(uvhub) &&16811681- (uv_blade_to_pnode(uvhub) < uv_partition_base_pnode))16821682- uv_partition_base_pnode = uv_blade_to_pnode(uvhub);16831683-16841652 vector = UV_BAU_MESSAGE;16851653 for_each_possible_blade(uvhub)16861654 if (uv_blade_nr_possible_cpus(uvhub))16871687- uv_init_uvhub(uvhub, vector);16551655+ uv_init_uvhub(uvhub, vector, uv_partition_base_pnode);1688165616891657 uv_enable_timeouts();16901658 alloc_intr_gate(vector, uv_bau_message_intr1);
+15-123
arch/x86/xen/mmu.c
···12751275{12761276}1277127712781278+static __init void xen_mapping_pagetable_reserve(u64 start, u64 end)12791279+{12801280+ /* reserve the range used */12811281+ native_pagetable_reserve(start, end);12821282+12831283+ /* set as RW the rest */12841284+ printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n", end,12851285+ PFN_PHYS(pgt_buf_top));12861286+ while (end < PFN_PHYS(pgt_buf_top)) {12871287+ make_lowmem_page_readwrite(__va(end));12881288+ end += PAGE_SIZE;12891289+ }12901290+}12911291+12781292static void xen_post_allocator_init(void);1279129312801294static __init void xen_pagetable_setup_done(pgd_t *base)···14771463 return ret;14781464}1479146514801480-#ifdef CONFIG_X86_6414811481-static __initdata u64 __last_pgt_set_rw = 0;14821482-static __initdata u64 __pgt_buf_start = 0;14831483-static __initdata u64 __pgt_buf_end = 0;14841484-static __initdata u64 __pgt_buf_top = 0;14851485-/*14861486- * As a consequence of the commit:14871487- * 14881488- * commit 4b239f458c229de044d6905c2b0f9fe16ed9e01e14891489- * Author: Yinghai Lu <yinghai@kernel.org>14901490- * Date: Fri Dec 17 16:58:28 2010 -080014911491- * 14921492- * x86-64, mm: Put early page table high14931493- * 14941494- * at some point init_memory_mapping is going to reach the pagetable pages14951495- * area and map those pages too (mapping them as normal memory that falls14961496- * in the range of addresses passed to init_memory_mapping as argument).14971497- * Some of those pages are already pagetable pages (they are in the range14981498- * pgt_buf_start-pgt_buf_end) therefore they are going to be mapped RO and14991499- * everything is fine.15001500- * Some of these pages are not pagetable pages yet (they fall in the range15011501- * pgt_buf_end-pgt_buf_top; for example the page at pgt_buf_end) so they15021502- * are going to be mapped RW. When these pages become pagetable pages and15031503- * are hooked into the pagetable, xen will find that the guest has already15041504- * a RW mapping of them somewhere and fail the operation.15051505- * The reason Xen requires pagetables to be RO is that the hypervisor needs15061506- * to verify that the pagetables are valid before using them. The validation15071507- * operations are called "pinning".15081508- * 15091509- * In order to fix the issue we mark all the pages in the entire range15101510- * pgt_buf_start-pgt_buf_top as RO, however when the pagetable allocation15111511- * is completed only the range pgt_buf_start-pgt_buf_end is reserved by15121512- * init_memory_mapping. Hence the kernel is going to crash as soon as one15131513- * of the pages in the range pgt_buf_end-pgt_buf_top is reused (b/c those15141514- * ranges are RO).15151515- * 15161516- * For this reason, 'mark_rw_past_pgt' is introduced which is called _after_15171517- * the init_memory_mapping has completed (in a perfect world we would15181518- * call this function from init_memory_mapping, but lets ignore that).15191519- * 15201520- * Because we are called _after_ init_memory_mapping the pgt_buf_[start,15211521- * end,top] have all changed to new values (b/c init_memory_mapping15221522- * is called and setting up another new page-table). Hence, the first time15231523- * we enter this function, we save away the pgt_buf_start value and update15241524- * the pgt_buf_[end,top].15251525- * 15261526- * When we detect that the "old" pgt_buf_start through pgt_buf_end15271527- * PFNs have been reserved (so memblock_x86_reserve_range has been called),15281528- * we immediately set out to RW the "old" pgt_buf_end through pgt_buf_top.15291529- * 15301530- * And then we update those "old" pgt_buf_[end|top] with the new ones15311531- * so that we can redo this on the next pagetable.15321532- */15331533-static __init void mark_rw_past_pgt(void) {15341534-15351535- if (pgt_buf_end > pgt_buf_start) {15361536- u64 addr, size;15371537-15381538- /* Save it away. */15391539- if (!__pgt_buf_start) {15401540- __pgt_buf_start = pgt_buf_start;15411541- __pgt_buf_end = pgt_buf_end;15421542- __pgt_buf_top = pgt_buf_top;15431543- return;15441544- }15451545- /* If we get the range that starts at __pgt_buf_end that means15461546- * the range is reserved, and that in 'init_memory_mapping'15471547- * the 'memblock_x86_reserve_range' has been called with the15481548- * outdated __pgt_buf_start, __pgt_buf_end (the "new"15491549- * pgt_buf_[start|end|top] refer now to a new pagetable.15501550- * Note: we are called _after_ the pgt_buf_[..] have been15511551- * updated.*/15521552-15531553- addr = memblock_x86_find_in_range_size(PFN_PHYS(__pgt_buf_start),15541554- &size, PAGE_SIZE);15551555-15561556- /* Still not reserved, meaning 'memblock_x86_reserve_range'15571557- * hasn't been called yet. Update the _end and _top.*/15581558- if (addr == PFN_PHYS(__pgt_buf_start)) {15591559- __pgt_buf_end = pgt_buf_end;15601560- __pgt_buf_top = pgt_buf_top;15611561- return;15621562- }15631563-15641564- /* OK, the area is reserved, meaning it is time for us to15651565- * set RW for the old end->top PFNs. */15661566-15671567- /* ..unless we had already done this. */15681568- if (__pgt_buf_end == __last_pgt_set_rw)15691569- return;15701570-15711571- addr = PFN_PHYS(__pgt_buf_end);15721572-15731573- /* set as RW the rest */15741574- printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n",15751575- PFN_PHYS(__pgt_buf_end), PFN_PHYS(__pgt_buf_top));15761576-15771577- while (addr < PFN_PHYS(__pgt_buf_top)) {15781578- make_lowmem_page_readwrite(__va(addr));15791579- addr += PAGE_SIZE;15801580- }15811581- /* And update everything so that we are ready for the next15821582- * pagetable (the one created for regions past 4GB) */15831583- __last_pgt_set_rw = __pgt_buf_end;15841584- __pgt_buf_start = pgt_buf_start;15851585- __pgt_buf_end = pgt_buf_end;15861586- __pgt_buf_top = pgt_buf_top;15871587- }15881588- return;15891589-}15901590-#else15911591-static __init void mark_rw_past_pgt(void) { }15921592-#endif15931466static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)15941467{15951468#ifdef CONFIG_X86_64···15021601{15031602 unsigned long pfn = pte_pfn(pte);1504160315051505- /*15061506- * A bit of optimization. We do not need to call the workaround15071507- * when xen_set_pte_init is called with a PTE with 0 as PFN.15081508- * That is b/c the pagetable at that point are just being populated15091509- * with empty values and we can save some cycles by not calling15101510- * the 'memblock' code.*/15111511- if (pfn)15121512- mark_rw_past_pgt();15131604 /*15141605 * If the new pfn is within the range of the newly allocated15151606 * kernel pagetable, and it isn't being mapped into an···2011211820122119static __init void xen_post_allocator_init(void)20132120{20142014- mark_rw_past_pgt();20152015-20162121#ifdef CONFIG_XEN_DEBUG20172122 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug);20182123#endif···2119222821202229void __init xen_init_mmu_ops(void)21212230{22312231+ x86_init.mapping.pagetable_reserve = xen_mapping_pagetable_reserve;21222232 x86_init.paging.pagetable_setup_start = xen_pagetable_setup_start;21232233 x86_init.paging.pagetable_setup_done = xen_pagetable_setup_done;21242234 pv_mmu_ops = xen_mmu_ops;
···561561{562562 void __iomem *port_mmio = ahci_port_base(ap);563563 u32 tmp;564564- u8 status;565565-566566- status = readl(port_mmio + PORT_TFDATA) & 0xFF;567567-568568- /*569569- * At end of section 10.1 of AHCI spec (rev 1.3), it states570570- * Software shall not set PxCMD.ST to 1 until it is determined571571- * that a functoinal device is present on the port as determined by572572- * PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h573573- *574574- * Even though most AHCI host controllers work without this check,575575- * specific controller will fail under this condition576576- */577577- if (status & (ATA_BUSY | ATA_DRQ))578578- return;579579- else {580580- ahci_scr_read(&ap->link, SCR_STATUS, &tmp);581581-582582- if ((tmp & 0xf) != 0x3)583583- return;584584- }585564586565 /* start DMA */587566 tmp = readl(port_mmio + PORT_CMD);
···986986987987 cdinfo(CD_OPEN, "entering cdrom_open\n"); 988988989989+ /* open is event synchronization point, check events first */990990+ check_disk_change(bdev);991991+989992 /* if this was a O_NONBLOCK open and we should honor the flags,990993 * do a quick open without drive/disc integrity checks. */991994 cdi->use_count++;···1015101210161013 cdinfo(CD_OPEN, "Use count for \"/dev/%s\" now %d\n",10171014 cdi->name, cdi->use_count);10181018- /* Do this on open. Don't wait for mount, because they might10191019- not be mounting, but opening with O_NONBLOCK */10201020- check_disk_change(bdev);10211015 return 0;10221016err_release:10231017 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
-1
drivers/cdrom/gdrom.c
···803803 goto probe_fail_cdrom_register;804804 }805805 gd.disk->fops = &gdrom_bdops;806806- gd.disk->events = DISK_EVENT_MEDIA_CHANGE;807806 /* latch on to the interrupt */808807 err = gdrom_set_interrupt_handlers();809808 if (err)
···715715}716716717717#ifdef CONFIG_OF718718-static int __devinit hwicap_of_probe(struct platform_device *op)718718+static int __devinit hwicap_of_probe(struct platform_device *op,719719+ const struct hwicap_driver_config *config)719720{720721 struct resource res;721722 const unsigned int *id;722723 const char *family;723724 int rc;724724- const struct hwicap_driver_config *config = op->dev.of_match->data;725725 const struct config_registers *regs;726726727727···751751 regs);752752}753753#else754754-static inline int hwicap_of_probe(struct platform_device *op)754754+static inline int hwicap_of_probe(struct platform_device *op,755755+ const struct hwicap_driver_config *config)755756{756757 return -EINVAL;757758}758759#endif /* CONFIG_OF */759760761761+static const struct of_device_id __devinitconst hwicap_of_match[];760762static int __devinit hwicap_drv_probe(struct platform_device *pdev)761763{764764+ const struct of_device_id *match;762765 struct resource *res;763766 const struct config_registers *regs;764767 const char *family;765768766766- if (pdev->dev.of_match)767767- return hwicap_of_probe(pdev);769769+ match = of_match_device(hwicap_of_match, &pdev->dev);770770+ if (match)771771+ return hwicap_of_probe(pdev, match->data);768772769773 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);770774 if (!res)
+1-1
drivers/edac/ppc4xx_edac.c
···10191019 struct ppc4xx_edac_pdata *pdata = NULL;10201020 const struct device_node *np = op->dev.of_node;1021102110221022- if (op->dev.of_match == NULL)10221022+ if (of_match_device(ppc4xx_edac_match, &op->dev) == NULL)10231023 return -EINVAL;1024102410251025 /* Initial driver pointers and private data */
+22-4
drivers/gpu/drm/drm_fb_helper.c
···15161516}15171517EXPORT_SYMBOL(drm_fb_helper_initial_config);1518151815191519-bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)15191519+/**15201520+ * drm_fb_helper_hotplug_event - respond to a hotplug notification by15211521+ * probing all the outputs attached to the fb.15221522+ * @fb_helper: the drm_fb_helper15231523+ *15241524+ * LOCKING:15251525+ * Called at runtime, must take mode config lock.15261526+ *15271527+ * Scan the connectors attached to the fb_helper and try to put together a15281528+ * setup after *notification of a change in output configuration.15291529+ *15301530+ * RETURNS:15311531+ * 0 on success and a non-zero error code otherwise.15321532+ */15331533+int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)15201534{15351535+ struct drm_device *dev = fb_helper->dev;15211536 int count = 0;15221537 u32 max_width, max_height, bpp_sel;15231538 bool bound = false, crtcs_bound = false;15241539 struct drm_crtc *crtc;1525154015261541 if (!fb_helper->fb)15271527- return false;15421542+ return 0;1528154315291529- list_for_each_entry(crtc, &fb_helper->dev->mode_config.crtc_list, head) {15441544+ mutex_lock(&dev->mode_config.mutex);15451545+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {15301546 if (crtc->fb)15311547 crtcs_bound = true;15321548 if (crtc->fb == fb_helper->fb)···1551153515521536 if (!bound && crtcs_bound) {15531537 fb_helper->delayed_hotplug = true;15541554- return false;15381538+ mutex_unlock(&dev->mode_config.mutex);15391539+ return 0;15551540 }15561541 DRM_DEBUG_KMS("\n");15571542···15631546 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width,15641547 max_height);15651548 drm_setup_crtcs(fb_helper);15491549+ mutex_unlock(&dev->mode_config.mutex);1566155015671551 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);15681552}
+1-1
drivers/gpu/drm/i915/i915_drv.c
···4949unsigned int i915_powersave = 1;5050module_param_named(powersave, i915_powersave, int, 0600);51515252-unsigned int i915_semaphores = 1;5252+unsigned int i915_semaphores = 0;5353module_param_named(semaphores, i915_semaphores, int, 0600);54545555unsigned int i915_enable_rc6 = 0;
+2
drivers/gpu/drm/i915/intel_display.c
···5154515451555155 I915_WRITE(DSPCNTR(plane), dspcntr);51565156 POSTING_READ(DSPCNTR(plane));51575157+ if (!HAS_PCH_SPLIT(dev))51585158+ intel_enable_plane(dev_priv, plane, pipe);5157515951585160 ret = intel_pipe_set_base(crtc, x, y, old_fb);51595161
···219219 int i;220220 struct vga_switcheroo_client *active = NULL;221221222222- if (new_client->active == true)223223- return 0;224224-225222 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {226223 if (vgasr_priv.clients[i].active == true) {227224 active = &vgasr_priv.clients[i];···368371 ret = vgasr_priv.handler->switchto(client_id);369372 goto out;370373 }374374+375375+ if (client->active == true)376376+ goto out;371377372378 /* okay we want a switch - test if devices are willing to switch */373379 can_switch = true;
+6-3
drivers/i2c/busses/i2c-mpc.c
···560560 .timeout = HZ,561561};562562563563+static const struct of_device_id mpc_i2c_of_match[];563564static int __devinit fsl_i2c_probe(struct platform_device *op)564565{566566+ const struct of_device_id *match;565567 struct mpc_i2c *i2c;566568 const u32 *prop;567569 u32 clock = MPC_I2C_CLOCK_LEGACY;568570 int result = 0;569571 int plen;570572571571- if (!op->dev.of_match)573573+ match = of_match_device(mpc_i2c_of_match, &op->dev);574574+ if (!match)572575 return -EINVAL;573576574577 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);···608605 clock = *prop;609606 }610607611611- if (op->dev.of_match->data) {612612- struct mpc_i2c_data *data = op->dev.of_match->data;608608+ if (match->data) {609609+ struct mpc_i2c_data *data = match->data;613610 data->setup(op->dev.of_node, i2c, clock, data->prescaler);614611 } else {615612 /* Backwards compatibility */
···136136}137137EXPORT_SYMBOL(soc_camera_apply_sensor_flags);138138139139+#define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \140140+ ((x) >> 24) & 0xff141141+142142+static int soc_camera_try_fmt(struct soc_camera_device *icd,143143+ struct v4l2_format *f)144144+{145145+ struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);146146+ struct v4l2_pix_format *pix = &f->fmt.pix;147147+ int ret;148148+149149+ dev_dbg(&icd->dev, "TRY_FMT(%c%c%c%c, %ux%u)\n",150150+ pixfmtstr(pix->pixelformat), pix->width, pix->height);151151+152152+ pix->bytesperline = 0;153153+ pix->sizeimage = 0;154154+155155+ ret = ici->ops->try_fmt(icd, f);156156+ if (ret < 0)157157+ return ret;158158+159159+ if (!pix->sizeimage) {160160+ if (!pix->bytesperline) {161161+ const struct soc_camera_format_xlate *xlate;162162+163163+ xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);164164+ if (!xlate)165165+ return -EINVAL;166166+167167+ ret = soc_mbus_bytes_per_line(pix->width,168168+ xlate->host_fmt);169169+ if (ret > 0)170170+ pix->bytesperline = ret;171171+ }172172+ if (pix->bytesperline)173173+ pix->sizeimage = pix->bytesperline * pix->height;174174+ }175175+176176+ return 0;177177+}178178+139179static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv,140180 struct v4l2_format *f)141181{142182 struct soc_camera_device *icd = file->private_data;143143- struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);144183145184 WARN_ON(priv != file->private_data);146185···188149 return -EINVAL;189150190151 /* limit format to hardware capabilities */191191- return ici->ops->try_fmt(icd, f);152152+ return soc_camera_try_fmt(icd, f);192153}193154194155static int soc_camera_enum_input(struct file *file, void *priv,···401362 icd->user_formats = NULL;402363}403364404404-#define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \405405- ((x) >> 24) & 0xff406406-407365/* Called with .vb_lock held, or from the first open(2), see comment there */408366static int soc_camera_set_fmt(struct soc_camera_device *icd,409367 struct v4l2_format *f)···413377 pixfmtstr(pix->pixelformat), pix->width, pix->height);414378415379 /* We always call try_fmt() before set_fmt() or set_crop() */416416- ret = ici->ops->try_fmt(icd, f);380380+ ret = soc_camera_try_fmt(icd, f);417381 if (ret < 0)418382 return ret;419383
+4-1
drivers/media/video/v4l2-device.c
···155155 sd->v4l2_dev = v4l2_dev;156156 if (sd->internal_ops && sd->internal_ops->registered) {157157 err = sd->internal_ops->registered(sd);158158- if (err)158158+ if (err) {159159+ module_put(sd->owner);159160 return err;161161+ }160162 }161163162164 /* This just returns 0 if either of the two args is NULL */···166164 if (err) {167165 if (sd->internal_ops && sd->internal_ops->unregistered)168166 sd->internal_ops->unregistered(sd);167167+ module_put(sd->owner);169168 return err;170169 }171170
+7-7
drivers/media/video/v4l2-subdev.c
···155155156156 switch (cmd) {157157 case VIDIOC_QUERYCTRL:158158- return v4l2_subdev_queryctrl(sd, arg);158158+ return v4l2_queryctrl(sd->ctrl_handler, arg);159159160160 case VIDIOC_QUERYMENU:161161- return v4l2_subdev_querymenu(sd, arg);161161+ return v4l2_querymenu(sd->ctrl_handler, arg);162162163163 case VIDIOC_G_CTRL:164164- return v4l2_subdev_g_ctrl(sd, arg);164164+ return v4l2_g_ctrl(sd->ctrl_handler, arg);165165166166 case VIDIOC_S_CTRL:167167- return v4l2_subdev_s_ctrl(sd, arg);167167+ return v4l2_s_ctrl(sd->ctrl_handler, arg);168168169169 case VIDIOC_G_EXT_CTRLS:170170- return v4l2_subdev_g_ext_ctrls(sd, arg);170170+ return v4l2_g_ext_ctrls(sd->ctrl_handler, arg);171171172172 case VIDIOC_S_EXT_CTRLS:173173- return v4l2_subdev_s_ext_ctrls(sd, arg);173173+ return v4l2_s_ext_ctrls(sd->ctrl_handler, arg);174174175175 case VIDIOC_TRY_EXT_CTRLS:176176- return v4l2_subdev_try_ext_ctrls(sd, arg);176176+ return v4l2_try_ext_ctrls(sd->ctrl_handler, arg);177177178178 case VIDIOC_DQEVENT:179179 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
···12921292 .use_clustering = ENABLE_CLUSTERING,12931293};1294129412951295+static const struct of_device_id qpti_match[];12951296static int __devinit qpti_sbus_probe(struct platform_device *op)12961297{12981298+ const struct of_device_id *match;12971299 struct scsi_host_template *tpnt;12981300 struct device_node *dp = op->dev.of_node;12991301 struct Scsi_Host *host;···13031301 static int nqptis;13041302 const char *fcode;1305130313061306- if (!op->dev.of_match)13041304+ match = of_match_device(qpti_match, &op->dev);13051305+ if (!match)13071306 return -EINVAL;13081308- tpnt = op->dev.of_match->data;13071307+ tpnt = match->data;1309130813101309 /* Sometimes Antares cards come up not completely13111310 * setup, and we get a report of a zero IRQ.
···8080/*8181 * Try to register a serial port8282 */8383+static struct of_device_id of_platform_serial_table[];8384static int __devinit of_platform_serial_probe(struct platform_device *ofdev)8485{8686+ const struct of_device_id *match;8587 struct of_serial_info *info;8688 struct uart_port port;8789 int port_type;8890 int ret;89919090- if (!ofdev->dev.of_match)9292+ match = of_match_device(of_platform_serial_table, &ofdev->dev);9393+ if (!match)9194 return -EINVAL;92959396 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))···10097 if (info == NULL)10198 return -ENOMEM;10299103103- port_type = (unsigned long)ofdev->dev.of_match->data;100100+ port_type = (unsigned long)match->data;104101 ret = of_platform_serial_setup(ofdev, port_type, &port);105102 if (ret)106103 goto out;
+5-2
drivers/usb/gadget/fsl_qe_udc.c
···25392539}2540254025412541/* Driver probe functions */25422542+static const struct of_device_id qe_udc_match[];25422543static int __devinit qe_udc_probe(struct platform_device *ofdev)25432544{25452545+ const struct of_device_id *match;25442546 struct device_node *np = ofdev->dev.of_node;25452547 struct qe_ep *ep;25462548 unsigned int ret = 0;25472549 unsigned int i;25482550 const void *prop;2549255125502550- if (!ofdev->dev.of_match)25522552+ match = of_match_device(qe_udc_match, &ofdev->dev);25532553+ if (!match)25512554 return -EINVAL;2552255525532556 prop = of_get_property(np, "mode", NULL);···25642561 return -ENOMEM;25652562 }2566256325672567- udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data;25642564+ udc_controller->soc_type = (unsigned long)match->data;25682565 udc_controller->usb_regs = of_iomap(np, 0);25692566 if (!udc_controller->usb_regs) {25702567 ret = -ENOMEM;
+150-77
drivers/video/fbmem.c
···42424343#define FBPIXMAPSIZE (1024 * 8)44444545+static DEFINE_MUTEX(registration_lock);4546struct fb_info *registered_fb[FB_MAX] __read_mostly;4647int num_registered_fb __read_mostly;4848+4949+static struct fb_info *get_fb_info(unsigned int idx)5050+{5151+ struct fb_info *fb_info;5252+5353+ if (idx >= FB_MAX)5454+ return ERR_PTR(-ENODEV);5555+5656+ mutex_lock(®istration_lock);5757+ fb_info = registered_fb[idx];5858+ if (fb_info)5959+ atomic_inc(&fb_info->count);6060+ mutex_unlock(®istration_lock);6161+6262+ return fb_info;6363+}6464+6565+static void put_fb_info(struct fb_info *fb_info)6666+{6767+ if (!atomic_dec_and_test(&fb_info->count))6868+ return;6969+ if (fb_info->fbops->fb_destroy)7070+ fb_info->fbops->fb_destroy(fb_info);7171+}47724873int lock_fb_info(struct fb_info *info)4974{···672647673648static void *fb_seq_start(struct seq_file *m, loff_t *pos)674649{650650+ mutex_lock(®istration_lock);675651 return (*pos < FB_MAX) ? pos : NULL;676652}677653···684658685659static void fb_seq_stop(struct seq_file *m, void *v)686660{661661+ mutex_unlock(®istration_lock);687662}688663689664static int fb_seq_show(struct seq_file *m, void *v)···717690 .release = seq_release,718691};719692693693+/*694694+ * We hold a reference to the fb_info in file->private_data,695695+ * but if the current registered fb has changed, we don't696696+ * actually want to use it.697697+ *698698+ * So look up the fb_info using the inode minor number,699699+ * and just verify it against the reference we have.700700+ */701701+static struct fb_info *file_fb_info(struct file *file)702702+{703703+ struct inode *inode = file->f_path.dentry->d_inode;704704+ int fbidx = iminor(inode);705705+ struct fb_info *info = registered_fb[fbidx];706706+707707+ if (info != file->private_data)708708+ info = NULL;709709+ return info;710710+}711711+720712static ssize_t721713fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)722714{723715 unsigned long p = *ppos;724724- struct inode *inode = file->f_path.dentry->d_inode;725725- int fbidx = iminor(inode);726726- struct fb_info *info = registered_fb[fbidx];716716+ struct fb_info *info = file_fb_info(file);727717 u8 *buffer, *dst;728718 u8 __iomem *src;729719 int c, cnt = 0, err = 0;···805761fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)806762{807763 unsigned long p = *ppos;808808- struct inode *inode = file->f_path.dentry->d_inode;809809- int fbidx = iminor(inode);810810- struct fb_info *info = registered_fb[fbidx];764764+ struct fb_info *info = file_fb_info(file);811765 u8 *buffer, *src;812766 u8 __iomem *dst;813767 int c, cnt = 0, err = 0;···1183114111841142static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)11851143{11861186- struct inode *inode = file->f_path.dentry->d_inode;11871187- int fbidx = iminor(inode);11881188- struct fb_info *info = registered_fb[fbidx];11441144+ struct fb_info *info = file_fb_info(file);1189114511461146+ if (!info)11471147+ return -ENODEV;11901148 return do_fb_ioctl(info, cmd, arg);11911149}11921150···13071265static long fb_compat_ioctl(struct file *file, unsigned int cmd,13081266 unsigned long arg)13091267{13101310- struct inode *inode = file->f_path.dentry->d_inode;13111311- int fbidx = iminor(inode);13121312- struct fb_info *info = registered_fb[fbidx];13131313- struct fb_ops *fb = info->fbops;12681268+ struct fb_info *info = file_fb_info(file);12691269+ struct fb_ops *fb;13141270 long ret = -ENOIOCTLCMD;1315127112721272+ if (!info)12731273+ return -ENODEV;12741274+ fb = info->fbops;13161275 switch(cmd) {13171276 case FBIOGET_VSCREENINFO:13181277 case FBIOPUT_VSCREENINFO:···13461303static int13471304fb_mmap(struct file *file, struct vm_area_struct * vma)13481305{13491349- int fbidx = iminor(file->f_path.dentry->d_inode);13501350- struct fb_info *info = registered_fb[fbidx];13511351- struct fb_ops *fb = info->fbops;13061306+ struct fb_info *info = file_fb_info(file);13071307+ struct fb_ops *fb;13521308 unsigned long off;13531309 unsigned long start;13541310 u32 len;1355131113121312+ if (!info)13131313+ return -ENODEV;13561314 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))13571315 return -EINVAL;13581316 off = vma->vm_pgoff << PAGE_SHIFT;13171317+ fb = info->fbops;13591318 if (!fb)13601319 return -ENODEV;13611320 mutex_lock(&info->mm_lock);···14061361 struct fb_info *info;14071362 int res = 0;1408136314091409- if (fbidx >= FB_MAX)14101410- return -ENODEV;14111411- info = registered_fb[fbidx];14121412- if (!info)13641364+ info = get_fb_info(fbidx);13651365+ if (!info) {14131366 request_module("fb%d", fbidx);14141414- info = registered_fb[fbidx];14151415- if (!info)14161416- return -ENODEV;13671367+ info = get_fb_info(fbidx);13681368+ if (!info)13691369+ return -ENODEV;13701370+ }13711371+ if (IS_ERR(info))13721372+ return PTR_ERR(info);13731373+14171374 mutex_lock(&info->lock);14181375 if (!try_module_get(info->fbops->owner)) {14191376 res = -ENODEV;···14331386#endif14341387out:14351388 mutex_unlock(&info->lock);13891389+ if (res)13901390+ put_fb_info(info);14361391 return res;14371392}14381393···14501401 info->fbops->fb_release(info,1);14511402 module_put(info->fbops->owner);14521403 mutex_unlock(&info->lock);14041404+ put_fb_info(info);14531405 return 0;14541406}14551407···15371487 return false;15381488}1539148914901490+static int do_unregister_framebuffer(struct fb_info *fb_info);14911491+15401492#define VGA_FB_PHYS 0xA000015411541-void remove_conflicting_framebuffers(struct apertures_struct *a,14931493+static void do_remove_conflicting_framebuffers(struct apertures_struct *a,15421494 const char *name, bool primary)15431495{15441496 int i;···15621510 printk(KERN_INFO "fb: conflicting fb hw usage "15631511 "%s vs %s - removing generic driver\n",15641512 name, registered_fb[i]->fix.id);15651565- unregister_framebuffer(registered_fb[i]);15131513+ do_unregister_framebuffer(registered_fb[i]);15661514 }15671515 }15681516}15691569-EXPORT_SYMBOL(remove_conflicting_framebuffers);1570151715711571-/**15721572- * register_framebuffer - registers a frame buffer device15731573- * @fb_info: frame buffer info structure15741574- *15751575- * Registers a frame buffer device @fb_info.15761576- *15771577- * Returns negative errno on error, or zero for success.15781578- *15791579- */15801580-15811581-int15821582-register_framebuffer(struct fb_info *fb_info)15181518+static int do_register_framebuffer(struct fb_info *fb_info)15831519{15841520 int i;15851521 struct fb_event event;15861522 struct fb_videomode mode;1587152315881588- if (num_registered_fb == FB_MAX)15891589- return -ENXIO;15901590-15911524 if (fb_check_foreignness(fb_info))15921525 return -ENOSYS;1593152615941594- remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id,15271527+ do_remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id,15951528 fb_is_primary_device(fb_info));15291529+15301530+ if (num_registered_fb == FB_MAX)15311531+ return -ENXIO;1596153215971533 num_registered_fb++;15981534 for (i = 0 ; i < FB_MAX; i++)15991535 if (!registered_fb[i])16001536 break;16011537 fb_info->node = i;15381538+ atomic_set(&fb_info->count, 1);16021539 mutex_init(&fb_info->lock);16031540 mutex_init(&fb_info->mm_lock);16041541···16331592 return 0;16341593}1635159415951595+static int do_unregister_framebuffer(struct fb_info *fb_info)15961596+{15971597+ struct fb_event event;15981598+ int i, ret = 0;15991599+16001600+ i = fb_info->node;16011601+ if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)16021602+ return -EINVAL;16031603+16041604+ if (!lock_fb_info(fb_info))16051605+ return -ENODEV;16061606+ event.info = fb_info;16071607+ ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);16081608+ unlock_fb_info(fb_info);16091609+16101610+ if (ret)16111611+ return -EINVAL;16121612+16131613+ if (fb_info->pixmap.addr &&16141614+ (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))16151615+ kfree(fb_info->pixmap.addr);16161616+ fb_destroy_modelist(&fb_info->modelist);16171617+ registered_fb[i] = NULL;16181618+ num_registered_fb--;16191619+ fb_cleanup_device(fb_info);16201620+ device_destroy(fb_class, MKDEV(FB_MAJOR, i));16211621+ event.info = fb_info;16221622+ fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);16231623+16241624+ /* this may free fb info */16251625+ put_fb_info(fb_info);16261626+ return 0;16271627+}16281628+16291629+void remove_conflicting_framebuffers(struct apertures_struct *a,16301630+ const char *name, bool primary)16311631+{16321632+ mutex_lock(®istration_lock);16331633+ do_remove_conflicting_framebuffers(a, name, primary);16341634+ mutex_unlock(®istration_lock);16351635+}16361636+EXPORT_SYMBOL(remove_conflicting_framebuffers);16371637+16381638+/**16391639+ * register_framebuffer - registers a frame buffer device16401640+ * @fb_info: frame buffer info structure16411641+ *16421642+ * Registers a frame buffer device @fb_info.16431643+ *16441644+ * Returns negative errno on error, or zero for success.16451645+ *16461646+ */16471647+int16481648+register_framebuffer(struct fb_info *fb_info)16491649+{16501650+ int ret;16511651+16521652+ mutex_lock(®istration_lock);16531653+ ret = do_register_framebuffer(fb_info);16541654+ mutex_unlock(®istration_lock);16551655+16561656+ return ret;16571657+}1636165816371659/**16381660 * unregister_framebuffer - releases a frame buffer device···17131609 * that the driver implements fb_open() and fb_release() to17141610 * check that no processes are using the device.17151611 */17161716-17171612int17181613unregister_framebuffer(struct fb_info *fb_info)17191614{17201720- struct fb_event event;17211721- int i, ret = 0;16151615+ int ret;1722161617231723- i = fb_info->node;17241724- if (!registered_fb[i]) {17251725- ret = -EINVAL;17261726- goto done;17271727- }16171617+ mutex_lock(®istration_lock);16181618+ ret = do_unregister_framebuffer(fb_info);16191619+ mutex_unlock(®istration_lock);1728162017291729-17301730- if (!lock_fb_info(fb_info))17311731- return -ENODEV;17321732- event.info = fb_info;17331733- ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);17341734- unlock_fb_info(fb_info);17351735-17361736- if (ret) {17371737- ret = -EINVAL;17381738- goto done;17391739- }17401740-17411741- if (fb_info->pixmap.addr &&17421742- (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))17431743- kfree(fb_info->pixmap.addr);17441744- fb_destroy_modelist(&fb_info->modelist);17451745- registered_fb[i]=NULL;17461746- num_registered_fb--;17471747- fb_cleanup_device(fb_info);17481748- device_destroy(fb_class, MKDEV(FB_MAJOR, i));17491749- event.info = fb_info;17501750- fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);17511751-17521752- /* this may free fb info */17531753- if (fb_info->fbops->fb_destroy)17541754- fb_info->fbops->fb_destroy(fb_info);17551755-done:17561621 return ret;17571622}17581623
+5-2
drivers/watchdog/mpc8xxx_wdt.c
···185185 .fops = &mpc8xxx_wdt_fops,186186};187187188188+static const struct of_device_id mpc8xxx_wdt_match[];188189static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev)189190{190191 int ret;192192+ const struct of_device_id *match;191193 struct device_node *np = ofdev->dev.of_node;192194 struct mpc8xxx_wdt_type *wdt_type;193195 u32 freq = fsl_get_sys_freq();194196 bool enabled;195197196196- if (!ofdev->dev.of_match)198198+ match = of_match_device(mpc8xxx_wdt_match, &ofdev->dev);199199+ if (!match)197200 return -EINVAL;198198- wdt_type = ofdev->dev.of_match->data;201201+ wdt_type = match->data;199202200203 if (!freq || freq == -1)201204 return -EINVAL;
+18-9
fs/block_dev.c
···11021102 if (!bdev->bd_part)11031103 goto out_clear;1104110411051105+ ret = 0;11051106 if (disk->fops->open) {11061107 ret = disk->fops->open(bdev, mode);11071108 if (ret == -ERESTARTSYS) {···11191118 put_disk(disk);11201119 goto restart;11211120 }11221122- if (ret)11231123- goto out_clear;11241121 }11221122+ /*11231123+ * If the device is invalidated, rescan partition11241124+ * if open succeeded or failed with -ENOMEDIUM.11251125+ * The latter is necessary to prevent ghost11261126+ * partitions on a removed medium.11271127+ */11281128+ if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM))11291129+ rescan_partitions(disk, bdev);11301130+ if (ret)11311131+ goto out_clear;11321132+11251133 if (!bdev->bd_openers) {11261134 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);11271135 bdi = blk_get_backing_dev_info(bdev);···11381128 bdi = &default_backing_dev_info;11391129 bdev_inode_switch_bdi(bdev->bd_inode, bdi);11401130 }11411141- if (bdev->bd_invalidated)11421142- rescan_partitions(disk, bdev);11431131 } else {11441132 struct block_device *whole;11451133 whole = bdget_disk(disk, 0);···11611153 }11621154 } else {11631155 if (bdev->bd_contains == bdev) {11641164- if (bdev->bd_disk->fops->open) {11561156+ ret = 0;11571157+ if (bdev->bd_disk->fops->open)11651158 ret = bdev->bd_disk->fops->open(bdev, mode);11661166- if (ret)11671167- goto out_unlock_bdev;11681168- }11691169- if (bdev->bd_invalidated)11591159+ /* the same as first opener case, read comment there */11601160+ if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM))11701161 rescan_partitions(bdev->bd_disk, bdev);11621162+ if (ret)11631163+ goto out_unlock_bdev;11711164 }11721165 /* only one opener holds refs to the module and disk */11731166 module_put(disk->fops->owner);
···88568856int btrfs_init_space_info(struct btrfs_fs_info *fs_info)88578857{88588858 struct btrfs_space_info *space_info;88598859+ struct btrfs_super_block *disk_super;88608860+ u64 features;88618861+ u64 flags;88628862+ int mixed = 0;88598863 int ret;8860886488618861- ret = update_space_info(fs_info, BTRFS_BLOCK_GROUP_SYSTEM, 0, 0,88628862- &space_info);88638863- if (ret)88648864- return ret;88658865+ disk_super = &fs_info->super_copy;88668866+ if (!btrfs_super_root(disk_super))88678867+ return 1;8865886888668866- ret = update_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA, 0, 0,88678867- &space_info);88688868- if (ret)88698869- return ret;88698869+ features = btrfs_super_incompat_flags(disk_super);88708870+ if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS)88718871+ mixed = 1;8870887288718871- ret = update_space_info(fs_info, BTRFS_BLOCK_GROUP_DATA, 0, 0,88728872- &space_info);88738873+ flags = BTRFS_BLOCK_GROUP_SYSTEM;88748874+ ret = update_space_info(fs_info, flags, 0, 0, &space_info);88738875 if (ret)88748874- return ret;88768876+ goto out;8875887788788878+ if (mixed) {88798879+ flags = BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_DATA;88808880+ ret = update_space_info(fs_info, flags, 0, 0, &space_info);88818881+ } else {88828882+ flags = BTRFS_BLOCK_GROUP_METADATA;88838883+ ret = update_space_info(fs_info, flags, 0, 0, &space_info);88848884+ if (ret)88858885+ goto out;88868886+88878887+ flags = BTRFS_BLOCK_GROUP_DATA;88888888+ ret = update_space_info(fs_info, flags, 0, 0, &space_info);88898889+ }88908890+out:88768891 return ret;88778892}88788893
+15-9
fs/btrfs/ioctl.c
···8181 iflags |= FS_NOATIME_FL;8282 if (flags & BTRFS_INODE_DIRSYNC)8383 iflags |= FS_DIRSYNC_FL;8484+ if (flags & BTRFS_INODE_NODATACOW)8585+ iflags |= FS_NOCOW_FL;8686+8787+ if ((flags & BTRFS_INODE_COMPRESS) && !(flags & BTRFS_INODE_NOCOMPRESS))8888+ iflags |= FS_COMPR_FL;8989+ else if (flags & BTRFS_INODE_NOCOMPRESS)9090+ iflags |= FS_NOCOMP_FL;84918592 return iflags;8693}···151144 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \152145 FS_NOATIME_FL | FS_NODUMP_FL | \153146 FS_SYNC_FL | FS_DIRSYNC_FL | \154154- FS_NOCOMP_FL | FS_COMPR_FL | \155155- FS_NOCOW_FL | FS_COW_FL))147147+ FS_NOCOMP_FL | FS_COMPR_FL |148148+ FS_NOCOW_FL))156149 return -EOPNOTSUPP;157150158151 if ((flags & FS_NOCOMP_FL) && (flags & FS_COMPR_FL))159159- return -EINVAL;160160-161161- if ((flags & FS_NOCOW_FL) && (flags & FS_COW_FL))162152 return -EINVAL;163153164154 return 0;···222218 ip->flags |= BTRFS_INODE_DIRSYNC;223219 else224220 ip->flags &= ~BTRFS_INODE_DIRSYNC;221221+ if (flags & FS_NOCOW_FL)222222+ ip->flags |= BTRFS_INODE_NODATACOW;223223+ else224224+ ip->flags &= ~BTRFS_INODE_NODATACOW;225225226226 /*227227 * The COMPRESS flag can only be changed by users, while the NOCOMPRESS···238230 } else if (flags & FS_COMPR_FL) {239231 ip->flags |= BTRFS_INODE_COMPRESS;240232 ip->flags &= ~BTRFS_INODE_NOCOMPRESS;233233+ } else {234234+ ip->flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS);241235 }242242- if (flags & FS_NOCOW_FL)243243- ip->flags |= BTRFS_INODE_NODATACOW;244244- else if (flags & FS_COW_FL)245245- ip->flags &= ~BTRFS_INODE_NODATACOW;246236247237 trans = btrfs_join_transaction(root, 1);248238 BUG_ON(IS_ERR(trans));
+6-8
fs/cifs/cifs_unicode.c
···277277278278 for (i = 0, j = 0; i < srclen; j++) {279279 src_char = source[i];280280+ charlen = 1;280281 switch (src_char) {281282 case 0:282283 put_unaligned(0, &target[j]);···317316 dst_char = cpu_to_le16(0x003f);318317 charlen = 1;319318 }320320- /*321321- * character may take more than one byte in the source322322- * string, but will take exactly two bytes in the323323- * target string324324- */325325- i += charlen;326326- continue;327319 }320320+ /*321321+ * character may take more than one byte in the source string,322322+ * but will take exactly two bytes in the target string323323+ */324324+ i += charlen;328325 put_unaligned(dst_char, &target[j]);329329- i++; /* move to next char in source string */330326 }331327332328ctoUCS_out:
···5353static void configfs_d_iput(struct dentry * dentry,5454 struct inode * inode)5555{5656- struct configfs_dirent * sd = dentry->d_fsdata;5656+ struct configfs_dirent *sd = dentry->d_fsdata;57575858 if (sd) {5959 BUG_ON(sd->s_dentry != dentry);6060+ /* Coordinate with configfs_readdir */6161+ spin_lock(&configfs_dirent_lock);6062 sd->s_dentry = NULL;6363+ spin_unlock(&configfs_dirent_lock);6164 configfs_put(sd);6265 }6366 iput(inode);···692689 sd = child->d_fsdata;693690 sd->s_type |= CONFIGFS_USET_DEFAULT;694691 } else {695695- d_delete(child);692692+ BUG_ON(child->d_inode);693693+ d_drop(child);696694 dput(child);697695 }698696 }···15491545 struct configfs_dirent * parent_sd = dentry->d_fsdata;15501546 struct configfs_dirent *cursor = filp->private_data;15511547 struct list_head *p, *q = &cursor->s_sibling;15521552- ino_t ino;15481548+ ino_t ino = 0;15531549 int i = filp->f_pos;1554155015551551 switch (i) {···15771573 struct configfs_dirent *next;15781574 const char * name;15791575 int len;15761576+ struct inode *inode = NULL;1580157715811578 next = list_entry(p, struct configfs_dirent,15821579 s_sibling);···1586158115871582 name = configfs_get_name(next);15881583 len = strlen(name);15891589- if (next->s_dentry)15901590- ino = next->s_dentry->d_inode->i_ino;15911591- else15841584+15851585+ /*15861586+ * We'll have a dentry and an inode for15871587+ * PINNED items and for open attribute15881588+ * files. We lock here to prevent a race15891589+ * with configfs_d_iput() clearing15901590+ * s_dentry before calling iput().15911591+ *15921592+ * Why do we go to the trouble? If15931593+ * someone has an attribute file open,15941594+ * the inode number should match until15951595+ * they close it. Beyond that, we don't15961596+ * care.15971597+ */15981598+ spin_lock(&configfs_dirent_lock);15991599+ dentry = next->s_dentry;16001600+ if (dentry)16011601+ inode = dentry->d_inode;16021602+ if (inode)16031603+ ino = inode->i_ino;16041604+ spin_unlock(&configfs_dirent_lock);16051605+ if (!inode)15921606 ino = iunique(configfs_sb, 2);1593160715941608 if (filldir(dirent, name, len, filp->f_pos, ino,···17071683 err = configfs_attach_group(sd->s_element, &group->cg_item,17081684 dentry);17091685 if (err) {17101710- d_delete(dentry);16861686+ BUG_ON(dentry->d_inode);16871687+ d_drop(dentry);17111688 dput(dentry);17121689 } else {17131690 spin_lock(&configfs_dirent_lock);
+1-1
fs/fuse/dir.c
···174174 if (!inode)175175 return 0;176176177177- if (nd->flags & LOOKUP_RCU)177177+ if (nd && (nd->flags & LOOKUP_RCU))178178 return -ECHILD;179179180180 fc = get_fuse_conn(inode);
+1-1
fs/namei.c
···179179static int acl_permission_check(struct inode *inode, int mask, unsigned int flags,180180 int (*check_acl)(struct inode *inode, int mask, unsigned int flags))181181{182182- umode_t mode = inode->i_mode;182182+ unsigned int mode = inode->i_mode;183183184184 mask &= MAY_READ | MAY_WRITE | MAY_EXEC;185185
···539539540540/* We want to make sure that nobody is heartbeating on top of us --541541 * this will help detect an invalid configuration. */542542-static int o2hb_check_last_timestamp(struct o2hb_region *reg)542542+static void o2hb_check_last_timestamp(struct o2hb_region *reg)543543{544544- int node_num, ret;545544 struct o2hb_disk_slot *slot;546545 struct o2hb_disk_heartbeat_block *hb_block;546546+ char *errstr;547547548548- node_num = o2nm_this_node();549549-550550- ret = 1;551551- slot = ®->hr_slots[node_num];548548+ slot = ®->hr_slots[o2nm_this_node()];552549 /* Don't check on our 1st timestamp */553553- if (slot->ds_last_time) {554554- hb_block = slot->ds_raw_block;550550+ if (!slot->ds_last_time)551551+ return;555552556556- if (le64_to_cpu(hb_block->hb_seq) != slot->ds_last_time)557557- ret = 0;558558- }553553+ hb_block = slot->ds_raw_block;554554+ if (le64_to_cpu(hb_block->hb_seq) == slot->ds_last_time &&555555+ le64_to_cpu(hb_block->hb_generation) == slot->ds_last_generation &&556556+ hb_block->hb_node == slot->ds_node_num)557557+ return;559558560560- return ret;559559+#define ERRSTR1 "Another node is heartbeating on device"560560+#define ERRSTR2 "Heartbeat generation mismatch on device"561561+#define ERRSTR3 "Heartbeat sequence mismatch on device"562562+563563+ if (hb_block->hb_node != slot->ds_node_num)564564+ errstr = ERRSTR1;565565+ else if (le64_to_cpu(hb_block->hb_generation) !=566566+ slot->ds_last_generation)567567+ errstr = ERRSTR2;568568+ else569569+ errstr = ERRSTR3;570570+571571+ mlog(ML_ERROR, "%s (%s): expected(%u:0x%llx, 0x%llx), "572572+ "ondisk(%u:0x%llx, 0x%llx)\n", errstr, reg->hr_dev_name,573573+ slot->ds_node_num, (unsigned long long)slot->ds_last_generation,574574+ (unsigned long long)slot->ds_last_time, hb_block->hb_node,575575+ (unsigned long long)le64_to_cpu(hb_block->hb_generation),576576+ (unsigned long long)le64_to_cpu(hb_block->hb_seq));561577}562578563579static inline void o2hb_prepare_block(struct o2hb_region *reg,···999983 /* With an up to date view of the slots, we can check that no1000984 * other node has been improperly configured to heartbeat in1001985 * our slot. */10021002- if (!o2hb_check_last_timestamp(reg))10031003- mlog(ML_ERROR, "Device \"%s\": another node is heartbeating "10041004- "in our slot!\n", reg->hr_dev_name);986986+ o2hb_check_last_timestamp(reg);10059871006988 /* fill in the proper info for our next heartbeat */1007989 o2hb_prepare_block(reg, reg->hr_generation);···1013999 }1014100010151001 i = -1;10161016- while((i = find_next_bit(configured_nodes, O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES) {10171017-10021002+ while((i = find_next_bit(configured_nodes,10031003+ O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES) {10181004 change |= o2hb_check_slot(reg, ®->hr_slots[i]);10191005 }10201006···17041690 struct file *filp = NULL;17051691 struct inode *inode = NULL;17061692 ssize_t ret = -EINVAL;16931693+ int live_threshold;1707169417081695 if (reg->hr_bdev)17091696 goto out;···17811766 * A node is considered live after it has beat LIVE_THRESHOLD17821767 * times. We're not steady until we've given them a chance17831768 * _after_ our first read.17691769+ * The default threshold is bare minimum so as to limit the delay17701770+ * during mounts. For global heartbeat, the threshold doubled for the17711771+ * first region.17841772 */17851785- atomic_set(®->hr_steady_iterations, O2HB_LIVE_THRESHOLD + 1);17731773+ live_threshold = O2HB_LIVE_THRESHOLD;17741774+ if (o2hb_global_heartbeat_active()) {17751775+ spin_lock(&o2hb_live_lock);17761776+ if (o2hb_pop_count(&o2hb_region_bitmap, O2NM_MAX_REGIONS) == 1)17771777+ live_threshold <<= 1;17781778+ spin_unlock(&o2hb_live_lock);17791779+ }17801780+ atomic_set(®->hr_steady_iterations, live_threshold + 1);1786178117871782 hb_task = kthread_run(o2hb_thread, reg, "o2hb-%s",17881783 reg->hr_item.ci_name);
···16141614 spin_unlock(&dlm->spinlock);1615161516161616 /* Support for global heartbeat and node info was added in 1.1 */16171617- if (dlm_protocol.pv_major > 1 || dlm_protocol.pv_minor > 0) {16171617+ if (dlm->dlm_locking_proto.pv_major > 1 ||16181618+ dlm->dlm_locking_proto.pv_minor > 0) {16181619 status = dlm_send_nodeinfo(dlm, ctxt->yes_resp_map);16191620 if (status) {16201621 mlog_errno(status);
+3
fs/ocfs2/dlm/dlmmaster.c
···25742574 res->state &= ~DLM_LOCK_RES_MIGRATING;25752575 wake = 1;25762576 spin_unlock(&res->spinlock);25772577+ if (dlm_is_host_down(ret))25782578+ dlm_wait_for_node_death(dlm, target,25792579+ DLM_NODE_DEATH_WAIT_MAX);25772580 goto leave;25782581 }25792582
+12
fs/ocfs2/file.c
···16071607 range = le32_to_cpu(rec->e_cpos) + ocfs2_rec_clusters(el, rec);1608160816091609 if (le32_to_cpu(rec->e_cpos) >= trunc_start) {16101610+ /*16111611+ * remove an entire extent record.16121612+ */16101613 *trunc_cpos = le32_to_cpu(rec->e_cpos);16111614 /*16121615 * Skip holes if any.···16201617 *blkno = le64_to_cpu(rec->e_blkno);16211618 *trunc_end = le32_to_cpu(rec->e_cpos);16221619 } else if (range > trunc_start) {16201620+ /*16211621+ * remove a partial extent record, which means we're16221622+ * removing the last extent record.16231623+ */16231624 *trunc_cpos = trunc_start;16251625+ /*16261626+ * skip hole if any.16271627+ */16281628+ if (range < *trunc_end)16291629+ *trunc_end = range;16241630 *trunc_len = *trunc_end - trunc_start;16251631 coff = trunc_start - le32_to_cpu(rec->e_cpos);16261632 *blkno = le64_to_cpu(rec->e_blkno) +
+3
fs/ocfs2/journal.c
···12601260{12611261 struct ocfs2_journal *journal = osb->journal;1262126212631263+ if (ocfs2_is_hard_readonly(osb))12641264+ return;12651265+12631266 /* No need to queue up our truncate_log as regular cleanup will catch12641267 * that */12651268 ocfs2_queue_recovery_completion(journal, osb->slot_num,
···546546extern bool capable(int cap);547547extern bool ns_capable(struct user_namespace *ns, int cap);548548extern bool task_ns_capable(struct task_struct *t, int cap);549549-550550-/**551551- * nsown_capable - Check superior capability to one's own user_ns552552- * @cap: The capability in question553553- *554554- * Return true if the current task has the given superior capability555555- * targeted at its own user namespace.556556- */557557-static inline bool nsown_capable(int cap)558558-{559559- return ns_capable(current_user_ns(), cap);560560-}549549+extern bool nsown_capable(int cap);561550562551/* audit system wants to get cap info from files as well */563552extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
···3838 return outer;3939}40404141-#define INET_ECN_xmit(sk) do { inet_sk(sk)->tos |= INET_ECN_ECT_0; } while (0)4242-#define INET_ECN_dontxmit(sk) \4343- do { inet_sk(sk)->tos &= ~INET_ECN_MASK; } while (0)4141+static inline void INET_ECN_xmit(struct sock *sk)4242+{4343+ inet_sk(sk)->tos |= INET_ECN_ECT_0;4444+ if (inet6_sk(sk) != NULL)4545+ inet6_sk(sk)->tclass |= INET_ECN_ECT_0;4646+}4747+4848+static inline void INET_ECN_dontxmit(struct sock *sk)4949+{5050+ inet_sk(sk)->tos &= ~INET_ECN_MASK;5151+ if (inet6_sk(sk) != NULL)5252+ inet6_sk(sk)->tclass &= ~INET_ECN_MASK;5353+}44544555#define IP6_ECN_flow_init(label) do { \4656 (label) &= ~htonl(INET_ECN_MASK << 20); \
+4-4
include/net/llc_pdu.h
···199199 u8 ssap;200200 u8 ctrl_1;201201 u8 ctrl_2;202202-};202202+} __packed;203203204204static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb)205205{···211211 u8 dsap;212212 u8 ssap;213213 u8 ctrl_1;214214-};214214+} __packed;215215216216static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb)217217{···359359 u8 fmt_id; /* always 0x81 for LLC */360360 u8 type; /* different if NULL/non-NULL LSAP */361361 u8 rw; /* sender receive window */362362-};362362+} __packed;363363364364/**365365 * llc_pdu_init_as_xid_cmd - sets bytes 3, 4 & 5 of LLC header as XID···415415 u8 curr_ssv; /* current send state variable val */416416 u8 curr_rsv; /* current receive state variable */417417 u8 ind_bits; /* indicator bits set with macro */418418-};418418+} __packed;419419420420extern void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type);421421extern void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value);
+1
include/scsi/scsi_device.h
···169169 sdev_dev;170170171171 struct execute_work ew; /* used to get process context on put */172172+ struct work_struct requeue_work;172173173174 struct scsi_dh_data *scsi_dh_data;174175 enum scsi_device_state sdev_state;
+12
kernel/capability.c
···399399 return ns_capable(task_cred_xxx(t, user)->user_ns, cap);400400}401401EXPORT_SYMBOL(task_ns_capable);402402+403403+/**404404+ * nsown_capable - Check superior capability to one's own user_ns405405+ * @cap: The capability in question406406+ *407407+ * Return true if the current task has the given superior capability408408+ * targeted at its own user namespace.409409+ */410410+bool nsown_capable(int cap)411411+{412412+ return ns_capable(current_user_ns(), cap);413413+}
+6-6
kernel/cred.c
···5454 .cap_effective = CAP_INIT_EFF_SET,5555 .cap_bset = CAP_INIT_BSET,5656 .user = INIT_USER,5757+ .user_ns = &init_user_ns,5758 .group_info = &init_groups,5859#ifdef CONFIG_KEYS5960 .tgcred = &init_tgcred,···411410 goto error_put;412411 }413412413413+ /* cache user_ns in cred. Doesn't need a refcount because it will414414+ * stay pinned by cred->user415415+ */416416+ new->user_ns = new->user->user_ns;417417+414418#ifdef CONFIG_KEYS415419 /* new threads get their own thread keyrings if their parent already416420 * had one */···746740 return security_kernel_create_files_as(new, inode);747741}748742EXPORT_SYMBOL(set_create_files_as);749749-750750-struct user_namespace *current_user_ns(void)751751-{752752- return _current_user_ns();753753-}754754-EXPORT_SYMBOL(current_user_ns);755743756744#ifdef CONFIG_DEBUG_CREDENTIALS757745
+2-2
kernel/time/clocksource.c
···685685 /* Add clocksource to the clcoksource list */686686 mutex_lock(&clocksource_mutex);687687 clocksource_enqueue(cs);688688- clocksource_select();689688 clocksource_enqueue_watchdog(cs);689689+ clocksource_select();690690 mutex_unlock(&clocksource_mutex);691691 return 0;692692}···706706707707 mutex_lock(&clocksource_mutex);708708 clocksource_enqueue(cs);709709- clocksource_select();710709 clocksource_enqueue_watchdog(cs);710710+ clocksource_select();711711 mutex_unlock(&clocksource_mutex);712712 return 0;713713}
+11-1
kernel/time/tick-broadcast.c
···522522 */523523void tick_broadcast_setup_oneshot(struct clock_event_device *bc)524524{525525+ int cpu = smp_processor_id();526526+525527 /* Set it up only once ! */526528 if (bc->event_handler != tick_handle_oneshot_broadcast) {527529 int was_periodic = bc->mode == CLOCK_EVT_MODE_PERIODIC;528528- int cpu = smp_processor_id();529530530531 bc->event_handler = tick_handle_oneshot_broadcast;531532 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);···552551 tick_broadcast_set_event(tick_next_period, 1);553552 } else554553 bc->next_event.tv64 = KTIME_MAX;554554+ } else {555555+ /*556556+ * The first cpu which switches to oneshot mode sets557557+ * the bit for all other cpus which are in the general558558+ * (periodic) broadcast mask. So the bit is set and559559+ * would prevent the first broadcast enter after this560560+ * to program the bc device.561561+ */562562+ tick_broadcast_clear_oneshot(cpu);555563 }556564}557565
+1-1
lib/vsprintf.c
···797797 return string(buf, end, uuid, spec);798798}799799800800-int kptr_restrict = 1;800800+int kptr_restrict __read_mostly;801801802802/*803803 * Show a '%p' thing. A kernel extension is that the '%p' is followed
+1
mm/page_alloc.c
···23582358/**23592359 * alloc_pages_exact_nid - allocate an exact number of physically-contiguous23602360 * pages on a node.23612361+ * @nid: the preferred node ID where memory should be allocated23612362 * @size: the number of bytes to allocate23622363 * @gfp_mask: GFP flags for the allocation23632364 *
+4-6
mm/shmem.c
···10371037 struct address_space *mapping;10381038 unsigned long index;10391039 struct inode *inode;10401040- bool unlock_mutex = false;1041104010421041 BUG_ON(!PageLocked(page));10431042 mapping = page->mapping;···10711072 * we've taken the spinlock, because shmem_unuse_inode() will10721073 * prune a !swapped inode from the swaplist under both locks.10731074 */10741074- if (swap.val && list_empty(&info->swaplist)) {10751075+ if (swap.val) {10751076 mutex_lock(&shmem_swaplist_mutex);10761076- /* move instead of add in case we're racing */10771077- list_move_tail(&info->swaplist, &shmem_swaplist);10781078- unlock_mutex = true;10771077+ if (list_empty(&info->swaplist))10781078+ list_add_tail(&info->swaplist, &shmem_swaplist);10791079 }1080108010811081 spin_lock(&info->lock);10821082- if (unlock_mutex)10821082+ if (swap.val)10831083 mutex_unlock(&shmem_swaplist_mutex);1084108410851085 if (index >= info->next_index) {
+1-1
mm/vmscan.c
···937937 * back off and wait for congestion to clear because further reclaim938938 * will encounter the same problem939939 */940940- if (nr_dirty == nr_congested && nr_dirty != 0)940940+ if (nr_dirty && nr_dirty == nr_congested && scanning_global_lru(sc))941941 zone_set_flag(zone, ZONE_CONGESTED);942942943943 free_page_list(&free_pages);
···737737 nf_bridge->mask |= BRNF_PKT_TYPE;738738 }739739740740- if (br_parse_ip_options(skb))740740+ if (pf == PF_INET && br_parse_ip_options(skb))741741 return NF_DROP;742742743743 /* The physdev module checks on this */
+8-14
net/core/dev.c
···51865186 /* Fix illegal checksum combinations */51875187 if ((features & NETIF_F_HW_CSUM) &&51885188 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {51895189- netdev_info(dev, "mixed HW and IP checksum settings.\n");51895189+ netdev_warn(dev, "mixed HW and IP checksum settings.\n");51905190 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);51915191 }5192519251935193 if ((features & NETIF_F_NO_CSUM) &&51945194 (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {51955195- netdev_info(dev, "mixed no checksumming and other settings.\n");51955195+ netdev_warn(dev, "mixed no checksumming and other settings.\n");51965196 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM);51975197 }5198519851995199 /* Fix illegal SG+CSUM combinations. */52005200 if ((features & NETIF_F_SG) &&52015201 !(features & NETIF_F_ALL_CSUM)) {52025202- netdev_info(dev,52035203- "Dropping NETIF_F_SG since no checksum feature.\n");52025202+ netdev_dbg(dev,52035203+ "Dropping NETIF_F_SG since no checksum feature.\n");52045204 features &= ~NETIF_F_SG;52055205 }5206520652075207 /* TSO requires that SG is present as well. */52085208 if ((features & NETIF_F_ALL_TSO) && !(features & NETIF_F_SG)) {52095209- netdev_info(dev, "Dropping TSO features since no SG feature.\n");52095209+ netdev_dbg(dev, "Dropping TSO features since no SG feature.\n");52105210 features &= ~NETIF_F_ALL_TSO;52115211 }52125212···5216521652175217 /* Software GSO depends on SG. */52185218 if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) {52195219- netdev_info(dev, "Dropping NETIF_F_GSO since no SG feature.\n");52195219+ netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n");52205220 features &= ~NETIF_F_GSO;52215221 }52225222···52265226 if (!((features & NETIF_F_GEN_CSUM) ||52275227 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))52285228 == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {52295229- netdev_info(dev,52295229+ netdev_dbg(dev,52305230 "Dropping NETIF_F_UFO since no checksum offload features.\n");52315231 features &= ~NETIF_F_UFO;52325232 }5233523352345234 if (!(features & NETIF_F_SG)) {52355235- netdev_info(dev,52355235+ netdev_dbg(dev,52365236 "Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n");52375237 features &= ~NETIF_F_UFO;52385238 }···54135413 dev->hw_features |= NETIF_F_SOFT_FEATURES;54145414 dev->features |= NETIF_F_SOFT_FEATURES;54155415 dev->wanted_features = dev->features & dev->hw_features;54165416-54175417- /* Avoid warning from netdev_fix_features() for GSO without SG */54185418- if (!(dev->wanted_features & NETIF_F_SG)) {54195419- dev->wanted_features &= ~NETIF_F_GSO;54205420- dev->features &= ~NETIF_F_GSO;54215421- }5422541654235417 /* Enable GRO and NETIF_F_HIGHDMA for vlans by default,54245418 * vlan_dev_init() will do the dev->features check, so these features
+4
net/mac80211/tx.c
···237237 &local->dynamic_ps_disable_work);238238 }239239240240+ /* Don't restart the timer if we're not disassociated */241241+ if (!ifmgd->associated)242242+ return TX_CONTINUE;243243+240244 mod_timer(&local->dynamic_ps_timer, jiffies +241245 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));242246
···427427{428428 int i;429429430430- for (i = 0; i < evsel_list->cpus->nr; i++) {430430+ for (i = 0; i < evsel_list->nr_mmaps; i++) {431431 if (evsel_list->mmap[i].base)432432 mmap_read(&evsel_list->mmap[i]);433433 }
+1-1
tools/perf/builtin-test.c
···549549 ++foo;550550 }551551552552- while ((event = perf_evlist__read_on_cpu(evlist, 0)) != NULL) {552552+ while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) {553553 struct perf_sample sample;554554555555 if (event->header.type != PERF_RECORD_SAMPLE) {
+4-4
tools/perf/builtin-top.c
···801801 }802802}803803804804-static void perf_session__mmap_read_cpu(struct perf_session *self, int cpu)804804+static void perf_session__mmap_read_idx(struct perf_session *self, int idx)805805{806806 struct perf_sample sample;807807 union perf_event *event;808808809809- while ((event = perf_evlist__read_on_cpu(top.evlist, cpu)) != NULL) {809809+ while ((event = perf_evlist__mmap_read(top.evlist, idx)) != NULL) {810810 perf_session__parse_sample(self, event, &sample);811811812812 if (event->header.type == PERF_RECORD_SAMPLE)···820820{821821 int i;822822823823- for (i = 0; i < top.evlist->cpus->nr; i++)824824- perf_session__mmap_read_cpu(self, i);823823+ for (i = 0; i < top.evlist->nr_mmaps; i++)824824+ perf_session__mmap_read_idx(self, i);825825}826826827827static void start_counters(struct perf_evlist *evlist)
+107-46
tools/perf/util/evlist.c
···166166 return NULL;167167}168168169169-union perf_event *perf_evlist__read_on_cpu(struct perf_evlist *evlist, int cpu)169169+union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)170170{171171 /* XXX Move this to perf.c, making it generally available */172172 unsigned int page_size = sysconf(_SC_PAGE_SIZE);173173- struct perf_mmap *md = &evlist->mmap[cpu];173173+ struct perf_mmap *md = &evlist->mmap[idx];174174 unsigned int head = perf_mmap__read_head(md);175175 unsigned int old = md->prev;176176 unsigned char *data = md->base + page_size;···235235236236void perf_evlist__munmap(struct perf_evlist *evlist)237237{238238- int cpu;238238+ int i;239239240240- for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {241241- if (evlist->mmap[cpu].base != NULL) {242242- munmap(evlist->mmap[cpu].base, evlist->mmap_len);243243- evlist->mmap[cpu].base = NULL;240240+ for (i = 0; i < evlist->nr_mmaps; i++) {241241+ if (evlist->mmap[i].base != NULL) {242242+ munmap(evlist->mmap[i].base, evlist->mmap_len);243243+ evlist->mmap[i].base = NULL;244244 }245245 }246246+247247+ free(evlist->mmap);248248+ evlist->mmap = NULL;246249}247250248251int perf_evlist__alloc_mmap(struct perf_evlist *evlist)249252{250250- evlist->mmap = zalloc(evlist->cpus->nr * sizeof(struct perf_mmap));253253+ evlist->nr_mmaps = evlist->cpus->nr;254254+ if (evlist->cpus->map[0] == -1)255255+ evlist->nr_mmaps = evlist->threads->nr;256256+ evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));251257 return evlist->mmap != NULL ? 0 : -ENOMEM;252258}253259254260static int __perf_evlist__mmap(struct perf_evlist *evlist, struct perf_evsel *evsel,255255- int cpu, int prot, int mask, int fd)261261+ int idx, int prot, int mask, int fd)256262{257257- evlist->mmap[cpu].prev = 0;258258- evlist->mmap[cpu].mask = mask;259259- evlist->mmap[cpu].base = mmap(NULL, evlist->mmap_len, prot,263263+ evlist->mmap[idx].prev = 0;264264+ evlist->mmap[idx].mask = mask;265265+ evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, prot,260266 MAP_SHARED, fd, 0);261261- if (evlist->mmap[cpu].base == MAP_FAILED) {262262- if (evlist->cpus->map[cpu] == -1 && evsel->attr.inherit)267267+ if (evlist->mmap[idx].base == MAP_FAILED) {268268+ if (evlist->cpus->map[idx] == -1 && evsel->attr.inherit)263269 ui__warning("Inherit is not allowed on per-task "264270 "events using mmap.\n");265271 return -1;···273267274268 perf_evlist__add_pollfd(evlist, fd);275269 return 0;270270+}271271+272272+static int perf_evlist__mmap_per_cpu(struct perf_evlist *evlist, int prot, int mask)273273+{274274+ struct perf_evsel *evsel;275275+ int cpu, thread;276276+277277+ for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {278278+ int output = -1;279279+280280+ for (thread = 0; thread < evlist->threads->nr; thread++) {281281+ list_for_each_entry(evsel, &evlist->entries, node) {282282+ int fd = FD(evsel, cpu, thread);283283+284284+ if (output == -1) {285285+ output = fd;286286+ if (__perf_evlist__mmap(evlist, evsel, cpu,287287+ prot, mask, output) < 0)288288+ goto out_unmap;289289+ } else {290290+ if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, output) != 0)291291+ goto out_unmap;292292+ }293293+294294+ if ((evsel->attr.read_format & PERF_FORMAT_ID) &&295295+ perf_evlist__id_add_fd(evlist, evsel, cpu, thread, fd) < 0)296296+ goto out_unmap;297297+ }298298+ }299299+ }300300+301301+ return 0;302302+303303+out_unmap:304304+ for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {305305+ if (evlist->mmap[cpu].base != NULL) {306306+ munmap(evlist->mmap[cpu].base, evlist->mmap_len);307307+ evlist->mmap[cpu].base = NULL;308308+ }309309+ }310310+ return -1;311311+}312312+313313+static int perf_evlist__mmap_per_thread(struct perf_evlist *evlist, int prot, int mask)314314+{315315+ struct perf_evsel *evsel;316316+ int thread;317317+318318+ for (thread = 0; thread < evlist->threads->nr; thread++) {319319+ int output = -1;320320+321321+ list_for_each_entry(evsel, &evlist->entries, node) {322322+ int fd = FD(evsel, 0, thread);323323+324324+ if (output == -1) {325325+ output = fd;326326+ if (__perf_evlist__mmap(evlist, evsel, thread,327327+ prot, mask, output) < 0)328328+ goto out_unmap;329329+ } else {330330+ if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, output) != 0)331331+ goto out_unmap;332332+ }333333+334334+ if ((evsel->attr.read_format & PERF_FORMAT_ID) &&335335+ perf_evlist__id_add_fd(evlist, evsel, 0, thread, fd) < 0)336336+ goto out_unmap;337337+ }338338+ }339339+340340+ return 0;341341+342342+out_unmap:343343+ for (thread = 0; thread < evlist->threads->nr; thread++) {344344+ if (evlist->mmap[thread].base != NULL) {345345+ munmap(evlist->mmap[thread].base, evlist->mmap_len);346346+ evlist->mmap[thread].base = NULL;347347+ }348348+ }349349+ return -1;276350}277351278352/** perf_evlist__mmap - Create per cpu maps to receive events···373287int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite)374288{375289 unsigned int page_size = sysconf(_SC_PAGE_SIZE);376376- int mask = pages * page_size - 1, cpu;377377- struct perf_evsel *first_evsel, *evsel;290290+ int mask = pages * page_size - 1;291291+ struct perf_evsel *evsel;378292 const struct cpu_map *cpus = evlist->cpus;379293 const struct thread_map *threads = evlist->threads;380380- int thread, prot = PROT_READ | (overwrite ? 0 : PROT_WRITE);294294+ int prot = PROT_READ | (overwrite ? 0 : PROT_WRITE);381295382296 if (evlist->mmap == NULL && perf_evlist__alloc_mmap(evlist) < 0)383297 return -ENOMEM;···387301388302 evlist->overwrite = overwrite;389303 evlist->mmap_len = (pages + 1) * page_size;390390- first_evsel = list_entry(evlist->entries.next, struct perf_evsel, node);391304392305 list_for_each_entry(evsel, &evlist->entries, node) {393306 if ((evsel->attr.read_format & PERF_FORMAT_ID) &&394307 evsel->sample_id == NULL &&395308 perf_evsel__alloc_id(evsel, cpus->nr, threads->nr) < 0)396309 return -ENOMEM;397397-398398- for (cpu = 0; cpu < cpus->nr; cpu++) {399399- for (thread = 0; thread < threads->nr; thread++) {400400- int fd = FD(evsel, cpu, thread);401401-402402- if (evsel->idx || thread) {403403- if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT,404404- FD(first_evsel, cpu, 0)) != 0)405405- goto out_unmap;406406- } else if (__perf_evlist__mmap(evlist, evsel, cpu,407407- prot, mask, fd) < 0)408408- goto out_unmap;409409-410410- if ((evsel->attr.read_format & PERF_FORMAT_ID) &&411411- perf_evlist__id_add_fd(evlist, evsel, cpu, thread, fd) < 0)412412- goto out_unmap;413413- }414414- }415310 }416311417417- return 0;312312+ if (evlist->cpus->map[0] == -1)313313+ return perf_evlist__mmap_per_thread(evlist, prot, mask);418314419419-out_unmap:420420- for (cpu = 0; cpu < cpus->nr; cpu++) {421421- if (evlist->mmap[cpu].base != NULL) {422422- munmap(evlist->mmap[cpu].base, evlist->mmap_len);423423- evlist->mmap[cpu].base = NULL;424424- }425425- }426426- return -1;315315+ return perf_evlist__mmap_per_cpu(evlist, prot, mask);427316}428317429318int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid,···409348 if (evlist->threads == NULL)410349 return -1;411350412412- if (target_tid != -1)351351+ if (cpu_list == NULL && target_tid != -1)413352 evlist->cpus = cpu_map__dummy_new();414353 else415354 evlist->cpus = cpu_map__new(cpu_list);
+2-1
tools/perf/util/evlist.h
···1717 struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];1818 int nr_entries;1919 int nr_fds;2020+ int nr_mmaps;2021 int mmap_len;2122 bool overwrite;2223 union perf_event event_copy;···47464847struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);49485050-union perf_event *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu);4949+union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);51505251int perf_evlist__alloc_mmap(struct perf_evlist *evlist);5352int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);