···2166216621672167N: Pavel Machek21682168E: pavel@ucw.cz21692169-E: pavel@suse.cz21702169D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd21712170D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB,21722171D: work on suspend-to-ram/disk, killing duplicates from ioctl32
+1-1
Documentation/ABI/testing/sysfs-firmware-memmap
···11What: /sys/firmware/memmap/22Date: June 200833-Contact: Bernhard Walle <bwalle@suse.de>33+Contact: Bernhard Walle <bernhard.walle@gmx.de>44Description:55 On all platforms, the firmware provides a memory map which the66 kernel reads. The resources from that memory map are registered
+1-1
Documentation/PCI/PCIEBUS-HOWTO.txt
···93939494int pcie_port_service_register(struct pcie_port_service_driver *new)95959696-This API replaces the Linux Driver Model's pci_module_init API. A9696+This API replaces the Linux Driver Model's pci_register_driver API. A9797service driver should always calls pcie_port_service_register at9898module init. Note that after service driver being loaded, calls9999such as pci_enable_device(dev) and pci_set_master(dev) are no longer
+2-4
Documentation/cgroups/cgroups.txt
···252252When a task is moved from one cgroup to another, it gets a new253253css_set pointer - if there's an already existing css_set with the254254desired collection of cgroups then that group is reused, else a new255255-css_set is allocated. Note that the current implementation uses a256256-linear search to locate an appropriate existing css_set, so isn't257257-very efficient. A future version will use a hash table for better258258-performance.255255+css_set is allocated. The appropriate existing css_set is located by256256+looking into a hash table.259257260258To allow access from a cgroup to the css_sets (and hence tasks)261259that comprise it, a set of cg_cgroup_link objects form a lattice;
+101
Documentation/hwmon/hpfall.c
···11+/* Disk protection for HP machines.22+ *33+ * Copyright 2008 Eric Piel44+ * Copyright 2009 Pavel Machek <pavel@suse.cz>55+ *66+ * GPLv2.77+ */88+99+#include <stdio.h>1010+#include <stdlib.h>1111+#include <unistd.h>1212+#include <fcntl.h>1313+#include <sys/stat.h>1414+#include <sys/types.h>1515+#include <string.h>1616+#include <stdint.h>1717+#include <errno.h>1818+#include <signal.h>1919+2020+void write_int(char *path, int i)2121+{2222+ char buf[1024];2323+ int fd = open(path, O_RDWR);2424+ if (fd < 0) {2525+ perror("open");2626+ exit(1);2727+ }2828+ sprintf(buf, "%d", i);2929+ if (write(fd, buf, strlen(buf)) != strlen(buf)) {3030+ perror("write");3131+ exit(1);3232+ }3333+ close(fd);3434+}3535+3636+void set_led(int on)3737+{3838+ write_int("/sys/class/leds/hp::hddprotect/brightness", on);3939+}4040+4141+void protect(int seconds)4242+{4343+ write_int("/sys/block/sda/device/unload_heads", seconds*1000);4444+}4545+4646+int on_ac(void)4747+{4848+// /sys/class/power_supply/AC0/online4949+}5050+5151+int lid_open(void)5252+{5353+// /proc/acpi/button/lid/LID/state5454+}5555+5656+void ignore_me(void)5757+{5858+ protect(0);5959+ set_led(0);6060+6161+}6262+6363+int main(int argc, char* argv[])6464+{6565+ int fd, ret;6666+6767+ fd = open("/dev/freefall", O_RDONLY);6868+ if (fd < 0) {6969+ perror("open");7070+ return EXIT_FAILURE;7171+ }7272+7373+ signal(SIGALRM, ignore_me);7474+7575+ for (;;) {7676+ unsigned char count;7777+7878+ ret = read(fd, &count, sizeof(count));7979+ alarm(0);8080+ if ((ret == -1) && (errno == EINTR)) {8181+ /* Alarm expired, time to unpark the heads */8282+ continue;8383+ }8484+8585+ if (ret != sizeof(count)) {8686+ perror("read");8787+ break;8888+ }8989+9090+ protect(21);9191+ set_led(1);9292+ if (1 || on_ac() || lid_open()) {9393+ alarm(2);9494+ } else {9595+ alarm(20);9696+ }9797+ }9898+9999+ close(fd);100100+ return EXIT_SUCCESS;101101+}
+8
Documentation/hwmon/lis3lv02d
···3333This driver also provides an absolute input class device, allowing3434the laptop to act as a pinball machine-esque joystick.35353636+Another feature of the driver is misc device called "freefall" that3737+acts similar to /dev/rtc and reacts on free-fall interrupts received3838+from the device. It supports blocking operations, poll/select and3939+fasync operation modes. You must read 1 bytes from the device. The4040+result is number of free-fall interrupts since the last successful4141+read (or 255 if number of interrupts would not fit).4242+4343+3644Axes orientation3745----------------3846
+9-9
MAINTAINERS
···19051905S: Maintained1906190619071907HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER19081908-P: Robert Love19091909-M: rlove@rlove.org19101910-M: linux-kernel@vger.kernel.org19111911-W: http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/19081908+P: Frank Seidel19091909+M: frank@f-seidel.de19101910+L: lm-sensors@lm-sensors.org19111911+W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/19121912S: Maintained1913191319141914GSPCA FINEPIX SUBDRIVER···2001200120022002HIBERNATION (aka Software Suspend, aka swsusp)20032003P: Pavel Machek20042004-M: pavel@suse.cz20042004+M: pavel@ucw.cz20052005P: Rafael J. Wysocki20062006M: rjw@sisk.pl20072007L: linux-pm@lists.linux-foundation.org···41784178P: Len Brown41794179M: len.brown@intel.com41804180P: Pavel Machek41814181-M: pavel@suse.cz41814181+M: pavel@ucw.cz41824182P: Rafael J. Wysocki41834183M: rjw@sisk.pl41844184L: linux-pm@lists.linux-foundation.org···49304930S: Maintained4931493149324932ZR36067 VIDEO FOR LINUX DRIVER49334933-P: Ronald Bultje49344934-M: rbultje@ronald.bitfreak.net49354933L: mjpeg-users@lists.sourceforge.net49344934+L: linux-media@vger.kernel.org49364935W: http://mjpeg.sourceforge.net/driver-zoran/49374937-S: Maintained49364936+T: Mercurial http://linuxtv.org/hg/v4l-dvb49374937+S: Odd Fixes4938493849394939ZS DECSTATION Z85C30 SERIAL DRIVER49404940P: Maciej W. Rozycki
+1-1
Makefile
···389389# output directory.390390outputmakefile:391391ifneq ($(KBUILD_SRC),)392392+ $(Q)ln -fsn $(srctree) source392393 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \393394 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)394395endif···947946 mkdir -p include2; \948947 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \949948 fi950950- ln -fsn $(srctree) source951949endif952950953951# prepare2 creates a makefile if using a separate output directory
+4-4
arch/alpha/kernel/process.c
···9393 if (cpuid != boot_cpuid) {9494 flags |= 0x00040000UL; /* "remain halted" */9595 *pflags = flags;9696- cpu_clear(cpuid, cpu_present_map);9797- cpu_clear(cpuid, cpu_possible_map);9696+ set_cpu_present(cpuid, false);9797+ set_cpu_possible(cpuid, false);9898 halt();9999 }100100#endif···120120121121#ifdef CONFIG_SMP122122 /* Wait for the secondaries to halt. */123123- cpu_clear(boot_cpuid, cpu_present_map);124124- cpu_clear(boot_cpuid, cpu_possible_map);123123+ set_cpu_present(boot_cpuid, false);124124+ set_cpu_possible(boot_cpuid, false);125125 while (cpus_weight(cpu_present_map))126126 barrier();127127#endif
+6-6
arch/alpha/kernel/smp.c
···120120smp_callin(void)121121{122122 int cpuid = hard_smp_processor_id();123123- cpumask_t mask = cpu_online_map;124123125125- if (cpu_test_and_set(cpuid, mask)) {124124+ if (cpu_online(cpuid)) {126125 printk("??, cpu 0x%x already present??\n", cpuid);127126 BUG();128127 }128128+ set_cpu_online(cpuid, true);129129130130 /* Turn on machine checks. */131131 wrmces(7);···436436 ((char *)cpubase + i*hwrpb->processor_size);437437 if ((cpu->flags & 0x1cc) == 0x1cc) {438438 smp_num_probed++;439439- cpu_set(i, cpu_possible_map);440440- cpu_set(i, cpu_present_map);439439+ set_cpu_possible(i, true);440440+ set_cpu_present(i, true);441441 cpu->pal_revision = boot_cpu_palrev;442442 }443443···470470471471 /* Nothing to do on a UP box, or when told not to. */472472 if (smp_num_probed == 1 || max_cpus == 0) {473473- cpu_possible_map = cpumask_of_cpu(boot_cpuid);474474- cpu_present_map = cpumask_of_cpu(boot_cpuid);473473+ init_cpu_possible(cpumask_of(boot_cpuid));474474+ init_cpu_present(cpumask_of(boot_cpuid));475475 printk(KERN_INFO "SMP mode deactivated.\n");476476 return;477477 }
+4
arch/ia64/include/asm/kvm.h
···25252626#include <linux/ioctl.h>27272828+/* Select x86 specific features in <linux/kvm.h> */2929+#define __KVM_HAVE_IOAPIC3030+#define __KVM_HAVE_DEVICE_ASSIGNMENT3131+2832/* Architectural interrupt line count. */2933#define KVM_NR_INTERRUPTS 2563034
-4
arch/ia64/include/asm/mmzone.h
···3131#endif3232}33333434-#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID3535-extern int early_pfn_to_nid(unsigned long pfn);3636-#endif3737-3834#ifdef CONFIG_IA64_DIG /* DIG systems are small */3935# define MAX_PHYSNODE_ID 84036# define NR_NODE_MEMBLKS (MAX_NUMNODES * 8)
···455455 if (!vmm_fpswa_interface)456456 return (fpswa_ret_t) {-1, 0, 0, 0};457457458458- /*459459- * Just let fpswa driver to use hardware fp registers.460460- * No fp register is valid in memory.461461- */462458 memset(&fp_state, 0, sizeof(fp_state_t));463459464460 /*461461+ * compute fp_state. only FP registers f6 - f11 are used by the462462+ * vmm, so set those bits in the mask and set the low volatile463463+ * pointer to point to these registers.464464+ */465465+ fp_state.bitmask_low64 = 0xfc0; /* bit6..bit11 */466466+467467+ fp_state.fp_state_low_volatile = (fp_state_low_volatile_t *) ®s->f6;468468+469469+ /*465470 * unsigned long (*EFI_FPSWA) (466471 * unsigned long trap_type,467472 * void *Bundle,···550545 status = vmm_handle_fpu_swa(0, regs, isr);551546 if (!status)552547 return ;553553- else if (-EAGAIN == status) {554554- vcpu_decrement_iip(vcpu);555555- return ;556556- }557548 break;558549 }559550
+2-2
arch/ia64/mm/numa.c
···5858 * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where5959 * the section resides.6060 */6161-int early_pfn_to_nid(unsigned long pfn)6161+int __meminit __early_pfn_to_nid(unsigned long pfn)6262{6363 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;6464···7070 return node_memblk[i].nid;7171 }72727373- return 0;7373+ return -1;7474}75757676#ifdef CONFIG_MEMORY_HOTPLUG
+1-1
arch/powerpc/include/asm/pgtable-4k.h
···6060/* It should be preserving the high 48 bits and then specifically */6161/* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */6262#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \6363- _PAGE_HPTEFLAGS)6363+ _PAGE_HPTEFLAGS | _PAGE_SPECIAL)64646565/* Bits to mask out from a PMD to get to the PTE page */6666#define PMD_MASKED_BITS 0
+1-1
arch/powerpc/include/asm/pgtable-64k.h
···114114 * pgprot changes115115 */116116#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \117117- _PAGE_ACCESSED)117117+ _PAGE_ACCESSED | _PAGE_SPECIAL)118118119119/* Bits to mask out from a PMD to get to the PTE page */120120#define PMD_MASKED_BITS 0x1ff
···99#include <linux/types.h>1010#include <linux/ioctl.h>11111212+/* Select x86 specific features in <linux/kvm.h> */1313+#define __KVM_HAVE_PIT1414+#define __KVM_HAVE_IOAPIC1515+#define __KVM_HAVE_DEVICE_ASSIGNMENT1616+#define __KVM_HAVE_MSI1717+#define __KVM_HAVE_USER_NMI1818+1219/* Architectural interrupt line count. */1320#define KVM_NR_INTERRUPTS 2561421
-2
arch/x86/include/asm/mmzone_32.h
···3232 get_memcfg_numa_flat();3333}34343535-extern int early_pfn_to_nid(unsigned long pfn);3636-3735extern void resume_map_numa_kva(pgd_t *pgd);38363937#else /* !CONFIG_NUMA */
···5757typedef struct { pgprotval_t pgprot; } pgprot_t;58585959extern int page_is_ram(unsigned long pagenr);6060-extern int pagerange_is_ram(unsigned long start, unsigned long end);6160extern int devmem_is_allowed(unsigned long pagenr);6261extern void map_devmem(unsigned long pfn, unsigned long size,6362 pgprot_t vma_prot);
···11571157 data->cpu = pol->cpu;11581158 data->currpstate = HW_PSTATE_INVALID;1159115911601160- rc = powernow_k8_cpu_init_acpi(data);11611161- if (rc) {11601160+ if (powernow_k8_cpu_init_acpi(data)) {11621161 /*11631162 * Use the PSB BIOS structure. This is only availabe on11641163 * an UP version, and is deprecated by AMD.···11751176 "ACPI maintainers and complain to your BIOS "11761177 "vendor.\n");11771178#endif11781178- goto err_out;11791179+ kfree(data);11801180+ return -ENODEV;11791181 }11801182 if (pol->cpu != 0) {11811183 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "11821184 "CPU other than CPU0. Complain to your BIOS "11831185 "vendor.\n");11841184- goto err_out;11861186+ kfree(data);11871187+ return -ENODEV;11851188 }11861189 rc = find_psb_table(data);11871190 if (rc) {11881188- goto err_out;11911191+ kfree(data);11921192+ return -ENODEV;11891193 }11901194 /* Take a crude guess here.11911195 * That guess was in microseconds, so multiply with 1000 */
+2
arch/x86/kernel/hpet.c
···269269 now = hpet_readl(HPET_COUNTER);270270 cmp = now + (unsigned long) delta;271271 cfg = hpet_readl(HPET_Tn_CFG(timer));272272+ /* Make sure we use edge triggered interrupts */273273+ cfg &= ~HPET_TN_LEVEL;272274 cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |273275 HPET_TN_SETVAL | HPET_TN_32BIT;274276 hpet_writel(cfg, HPET_Tn_CFG(timer));
+1-1
arch/x86/kernel/olpc.c
···203203static void __init platform_detect(void)204204{205205 /* stopgap until OFW support is added to the kernel */206206- olpc_platform_info.boardrev = 0xc2;206206+ olpc_platform_info.boardrev = olpc_board(0xc2);207207}208208#endif209209
···810810811811static void ptrace_bts_detach(struct task_struct *child)812812{813813- if (unlikely(child->bts)) {814814- ds_release_bts(child->bts);815815- child->bts = NULL;816816-817817- ptrace_bts_free_buffer(child);818818- }813813+ /*814814+ * Ptrace_detach() races with ptrace_untrace() in case815815+ * the child dies and is reaped by another thread.816816+ *817817+ * We only do the memory accounting at this point and818818+ * leave the buffer deallocation and the bts tracer819819+ * release to ptrace_bts_untrace() which will be called820820+ * later on with tasklist_lock held.821821+ */822822+ release_locked_buffer(child->bts_buffer, child->bts_size);819823}820824#else821825static inline void ptrace_bts_fork(struct task_struct *tsk) {}
···16001600 /* Okay, we can deliver the interrupt: grab it and update PIC state. */16011601 intr_vector = kvm_cpu_get_interrupt(vcpu);16021602 svm_inject_irq(svm, intr_vector);16031603- kvm_timer_intr_post(vcpu, intr_vector);16041603out:16051604 update_cr8_intercept(vcpu);16061605}
+2-3
arch/x86/kvm/vmx.c
···903903 data = vmcs_readl(GUEST_SYSENTER_ESP);904904 break;905905 default:906906+ vmx_load_host_state(to_vmx(vcpu));906907 msr = find_msr_entry(to_vmx(vcpu), msr_index);907908 if (msr) {908909 data = msr->data;···32863285 }32873286 if (vcpu->arch.interrupt.pending) {32883287 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr);32893289- kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr);32903288 if (kvm_cpu_has_interrupt(vcpu))32913289 enable_irq_window(vcpu);32923290 }···36873687 if (vm_need_ept()) {36883688 bypass_guest_pf = 0;36893689 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |36903690- VMX_EPT_WRITABLE_MASK |36913691- VMX_EPT_IGMT_BIT);36903690+ VMX_EPT_WRITABLE_MASK);36923691 kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,36933692 VMX_EPT_EXECUTABLE_MASK,36943693 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
+8-2
arch/x86/kvm/x86.c
···967967 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:968968 case KVM_CAP_SET_TSS_ADDR:969969 case KVM_CAP_EXT_CPUID:970970- case KVM_CAP_CLOCKSOURCE:971970 case KVM_CAP_PIT:972971 case KVM_CAP_NOP_IO_DELAY:973972 case KVM_CAP_MP_STATE:···990991 break;991992 case KVM_CAP_IOMMU:992993 r = iommu_found();994994+ break;995995+ case KVM_CAP_CLOCKSOURCE:996996+ r = boot_cpu_has(X86_FEATURE_CONSTANT_TSC);993997 break;994998 default:995999 r = 0;···4129412741304128}4131412941324132-void kvm_arch_destroy_vm(struct kvm *kvm)41304130+void kvm_arch_sync_events(struct kvm *kvm)41334131{41344132 kvm_free_all_assigned_devices(kvm);41334133+}41344134+41354135+void kvm_arch_destroy_vm(struct kvm *kvm)41364136+{41354137 kvm_iommu_unmap_guest(kvm);41364138 kvm_free_pit(kvm);41374139 kfree(kvm->arch.vpic);
-19
arch/x86/mm/ioremap.c
···134134 return 0;135135}136136137137-int pagerange_is_ram(unsigned long start, unsigned long end)138138-{139139- int ram_page = 0, not_rampage = 0;140140- unsigned long page_nr;141141-142142- for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);143143- ++page_nr) {144144- if (page_is_ram(page_nr))145145- ram_page = 1;146146- else147147- not_rampage = 1;148148-149149- if (ram_page == not_rampage)150150- return -1;151151- }152152-153153- return ram_page;154154-}155155-156137/*157138 * Fix up the linear direct mapping of the kernel to avoid cache attribute158139 * conflicts.
+1-1
arch/x86/mm/numa_64.c
···145145 return shift;146146}147147148148-int early_pfn_to_nid(unsigned long pfn)148148+int __meminit __early_pfn_to_nid(unsigned long pfn)149149{150150 return phys_to_nid(pfn << PAGE_SHIFT);151151}
+14-1
arch/x86/mm/pageattr.c
···575575 address = cpa->vaddr[cpa->curpage];576576 else577577 address = *cpa->vaddr;578578-579578repeat:580579 kpte = lookup_address(address, &level);581580 if (!kpte)···811812812813 vm_unmap_aliases();813814815815+ /*816816+ * If we're called with lazy mmu updates enabled, the817817+ * in-memory pte state may be stale. Flush pending updates to818818+ * bring them up to date.819819+ */820820+ arch_flush_lazy_mmu_mode();821821+814822 cpa.vaddr = addr;815823 cpa.numpages = numpages;816824 cpa.mask_set = mask_set;···859853 cpa_flush_range(*addr, numpages, cache);860854 } else861855 cpa_flush_all(cache);856856+857857+ /*858858+ * If we've been called with lazy mmu updates enabled, then859859+ * make sure that everything gets flushed out before we860860+ * return.861861+ */862862+ arch_flush_lazy_mmu_mode();862863863864out:864865 return ret;
+45-38
arch/x86/mm/pat.c
···211211static struct memtype *cached_entry;212212static u64 cached_start;213213214214+static int pat_pagerange_is_ram(unsigned long start, unsigned long end)215215+{216216+ int ram_page = 0, not_rampage = 0;217217+ unsigned long page_nr;218218+219219+ for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);220220+ ++page_nr) {221221+ /*222222+ * For legacy reasons, physical address range in the legacy ISA223223+ * region is tracked as non-RAM. This will allow users of224224+ * /dev/mem to map portions of legacy ISA region, even when225225+ * some of those portions are listed(or not even listed) with226226+ * different e820 types(RAM/reserved/..)227227+ */228228+ if (page_nr >= (ISA_END_ADDRESS >> PAGE_SHIFT) &&229229+ page_is_ram(page_nr))230230+ ram_page = 1;231231+ else232232+ not_rampage = 1;233233+234234+ if (ram_page == not_rampage)235235+ return -1;236236+ }237237+238238+ return ram_page;239239+}240240+214241/*215242 * For RAM pages, mark the pages as non WB memory type using216243 * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or···363336 if (new_type)364337 *new_type = actual_type;365338366366- /*367367- * For legacy reasons, some parts of the physical address range in the368368- * legacy 1MB region is treated as non-RAM (even when listed as RAM in369369- * the e820 tables). So we will track the memory attributes of this370370- * legacy 1MB region using the linear memtype_list always.371371- */372372- if (end >= ISA_END_ADDRESS) {373373- is_range_ram = pagerange_is_ram(start, end);374374- if (is_range_ram == 1)375375- return reserve_ram_pages_type(start, end, req_type,376376- new_type);377377- else if (is_range_ram < 0)378378- return -EINVAL;379379- }339339+ is_range_ram = pat_pagerange_is_ram(start, end);340340+ if (is_range_ram == 1)341341+ return reserve_ram_pages_type(start, end, req_type,342342+ new_type);343343+ else if (is_range_ram < 0)344344+ return -EINVAL;380345381346 new = kmalloc(sizeof(struct memtype), GFP_KERNEL);382347 if (!new)···465446 if (is_ISA_range(start, end - 1))466447 return 0;467448468468- /*469469- * For legacy reasons, some parts of the physical address range in the470470- * legacy 1MB region is treated as non-RAM (even when listed as RAM in471471- * the e820 tables). So we will track the memory attributes of this472472- * legacy 1MB region using the linear memtype_list always.473473- */474474- if (end >= ISA_END_ADDRESS) {475475- is_range_ram = pagerange_is_ram(start, end);476476- if (is_range_ram == 1)477477- return free_ram_pages_type(start, end);478478- else if (is_range_ram < 0)479479- return -EINVAL;480480- }449449+ is_range_ram = pat_pagerange_is_ram(start, end);450450+ if (is_range_ram == 1)451451+ return free_ram_pages_type(start, end);452452+ else if (is_range_ram < 0)453453+ return -EINVAL;481454482455 spin_lock(&memtype_lock);483456 list_for_each_entry(entry, &memtype_list, nd) {···637626 unsigned long flags;638627 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK);639628640640- is_ram = pagerange_is_ram(paddr, paddr + size);629629+ is_ram = pat_pagerange_is_ram(paddr, paddr + size);641630642642- if (is_ram != 0) {643643- /*644644- * For mapping RAM pages, drivers need to call645645- * set_memory_[uc|wc|wb] directly, for reserve and free, before646646- * setting up the PTE.647647- */648648- WARN_ON_ONCE(1);649649- return 0;650650- }631631+ /*632632+ * reserve_pfn_range() doesn't support RAM pages.633633+ */634634+ if (is_ram != 0)635635+ return -EINVAL;651636652637 ret = reserve_memtype(paddr, paddr + size, want_flags, &flags);653638 if (ret)···700693{701694 int is_ram;702695703703- is_ram = pagerange_is_ram(paddr, paddr + size);696696+ is_ram = pat_pagerange_is_ram(paddr, paddr + size);704697 if (is_ram == 0)705698 free_memtype(paddr, paddr + size);706699}
+8-1
block/blk-timeout.c
···209209{210210 unsigned long flags;211211 struct request *rq, *tmp;212212+ LIST_HEAD(list);212213213214 spin_lock_irqsave(q->queue_lock, flags);214215215216 elv_abort_queue(q);216217217217- list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list)218218+ /*219219+ * Splice entries to local list, to avoid deadlocking if entries220220+ * get readded to the timeout list by error handling221221+ */222222+ list_splice_init(&q->timeout_list, &list);223223+224224+ list_for_each_entry_safe(rq, tmp, &list, timeout_list)218225 blk_abort_request(rq);219226220227 spin_unlock_irqrestore(q->queue_lock, flags);
+10-7
block/bsg.c
···244244 * map sg_io_v4 to a request.245245 */246246static struct request *247247-bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)247247+bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,248248+ u8 *sense)248249{249250 struct request_queue *q = bd->queue;250251 struct request *rq, *next_rq = NULL;···307306 if (ret)308307 goto out;309308 }309309+310310+ rq->sense = sense;311311+ rq->sense_len = 0;312312+310313 return rq;311314out:312315 if (rq->cmd != rq->__cmd)···353348static void bsg_add_command(struct bsg_device *bd, struct request_queue *q,354349 struct bsg_command *bc, struct request *rq)355350{356356- rq->sense = bc->sense;357357- rq->sense_len = 0;358358-359351 /*360352 * add bc command to busy queue and submit rq for io361353 */···421419{422420 int ret = 0;423421424424- dprintk("rq %p bio %p %u\n", rq, bio, rq->errors);422422+ dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors);425423 /*426424 * fill in all the output members427425 */···637635 /*638636 * get a request, fill in the blanks, and add to request queue639637 */640640- rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm);638638+ rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense);641639 if (IS_ERR(rq)) {642640 ret = PTR_ERR(rq);643641 rq = NULL;···924922 struct request *rq;925923 struct bio *bio, *bidi_bio = NULL;926924 struct sg_io_v4 hdr;925925+ u8 sense[SCSI_SENSE_BUFFERSIZE];927926928927 if (copy_from_user(&hdr, uarg, sizeof(hdr)))929928 return -EFAULT;930929931931- rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE);930930+ rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense);932931 if (IS_ERR(rq))933932 return PTR_ERR(rq);934933
+8
block/genhd.c
···10871087 if (strcmp(dev_name(dev), name))10881088 continue;1089108910901090+ if (partno < disk->minors) {10911091+ /* We need to return the right devno, even10921092+ * if the partition doesn't exist yet.10931093+ */10941094+ devt = MKDEV(MAJOR(dev->devt),10951095+ MINOR(dev->devt) + partno);10961096+ break;10971097+ }10901098 part = disk_get_part(disk, partno);10911099 if (part) {10921100 devt = part_devt(part);
···421421 .hardreset = ATA_OP_NULL,422422};423423424424-/* OSDL bz3352 reports that nf2/3 controllers can't determine device425425- * signature reliably. Also, the following thread reports detection426426- * failure on cold boot with the standard debouncing timing.424424+/* nf2 is ripe with hardreset related problems.425425+ *426426+ * kernel bz#3352 reports nf2/3 controllers can't determine device427427+ * signature reliably. The following thread reports detection failure428428+ * on cold boot with the standard debouncing timing.427429 *428430 * http://thread.gmane.org/gmane.linux.ide/34098429431 *430430- * Debounce with hotplug timing and request follow-up SRST.432432+ * And bz#12176 reports that hardreset simply doesn't work on nf2.433433+ * Give up on it and just don't do hardreset.431434 */432435static struct ata_port_operations nv_nf2_ops = {433433- .inherits = &nv_common_ops,436436+ .inherits = &nv_generic_ops,434437 .freeze = nv_nf2_freeze,435438 .thaw = nv_nf2_thaw,436436- .hardreset = nv_noclassify_hardreset,437439};438440439441/* For initial probing after boot and hot plugging, hardreset mostly
···33903390 kfree(p);33913391}3392339233933393+/* Send a message CDB to the firmware. */33943394+static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, unsigned char type)33953395+{33963396+ typedef struct {33973397+ CommandListHeader_struct CommandHeader;33983398+ RequestBlock_struct Request;33993399+ ErrDescriptor_struct ErrorDescriptor;34003400+ } Command;34013401+ static const size_t cmd_sz = sizeof(Command) + sizeof(ErrorInfo_struct);34023402+ Command *cmd;34033403+ dma_addr_t paddr64;34043404+ uint32_t paddr32, tag;34053405+ void __iomem *vaddr;34063406+ int i, err;34073407+34083408+ vaddr = ioremap_nocache(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));34093409+ if (vaddr == NULL)34103410+ return -ENOMEM;34113411+34123412+ /* The Inbound Post Queue only accepts 32-bit physical addresses for the34133413+ CCISS commands, so they must be allocated from the lower 4GiB of34143414+ memory. */34153415+ err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);34163416+ if (err) {34173417+ iounmap(vaddr);34183418+ return -ENOMEM;34193419+ }34203420+34213421+ cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64);34223422+ if (cmd == NULL) {34233423+ iounmap(vaddr);34243424+ return -ENOMEM;34253425+ }34263426+34273427+ /* This must fit, because of the 32-bit consistent DMA mask. Also,34283428+ although there's no guarantee, we assume that the address is at34293429+ least 4-byte aligned (most likely, it's page-aligned). */34303430+ paddr32 = paddr64;34313431+34323432+ cmd->CommandHeader.ReplyQueue = 0;34333433+ cmd->CommandHeader.SGList = 0;34343434+ cmd->CommandHeader.SGTotal = 0;34353435+ cmd->CommandHeader.Tag.lower = paddr32;34363436+ cmd->CommandHeader.Tag.upper = 0;34373437+ memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8);34383438+34393439+ cmd->Request.CDBLen = 16;34403440+ cmd->Request.Type.Type = TYPE_MSG;34413441+ cmd->Request.Type.Attribute = ATTR_HEADOFQUEUE;34423442+ cmd->Request.Type.Direction = XFER_NONE;34433443+ cmd->Request.Timeout = 0; /* Don't time out */34443444+ cmd->Request.CDB[0] = opcode;34453445+ cmd->Request.CDB[1] = type;34463446+ memset(&cmd->Request.CDB[2], 0, 14); /* the rest of the CDB is reserved */34473447+34483448+ cmd->ErrorDescriptor.Addr.lower = paddr32 + sizeof(Command);34493449+ cmd->ErrorDescriptor.Addr.upper = 0;34503450+ cmd->ErrorDescriptor.Len = sizeof(ErrorInfo_struct);34513451+34523452+ writel(paddr32, vaddr + SA5_REQUEST_PORT_OFFSET);34533453+34543454+ for (i = 0; i < 10; i++) {34553455+ tag = readl(vaddr + SA5_REPLY_PORT_OFFSET);34563456+ if ((tag & ~3) == paddr32)34573457+ break;34583458+ schedule_timeout_uninterruptible(HZ);34593459+ }34603460+34613461+ iounmap(vaddr);34623462+34633463+ /* we leak the DMA buffer here ... no choice since the controller could34643464+ still complete the command. */34653465+ if (i == 10) {34663466+ printk(KERN_ERR "cciss: controller message %02x:%02x timed out\n",34673467+ opcode, type);34683468+ return -ETIMEDOUT;34693469+ }34703470+34713471+ pci_free_consistent(pdev, cmd_sz, cmd, paddr64);34723472+34733473+ if (tag & 2) {34743474+ printk(KERN_ERR "cciss: controller message %02x:%02x failed\n",34753475+ opcode, type);34763476+ return -EIO;34773477+ }34783478+34793479+ printk(KERN_INFO "cciss: controller message %02x:%02x succeeded\n",34803480+ opcode, type);34813481+ return 0;34823482+}34833483+34843484+#define cciss_soft_reset_controller(p) cciss_message(p, 1, 0)34853485+#define cciss_noop(p) cciss_message(p, 3, 0)34863486+34873487+static __devinit int cciss_reset_msi(struct pci_dev *pdev)34883488+{34893489+/* the #defines are stolen from drivers/pci/msi.h. */34903490+#define msi_control_reg(base) (base + PCI_MSI_FLAGS)34913491+#define PCI_MSIX_FLAGS_ENABLE (1 << 15)34923492+34933493+ int pos;34943494+ u16 control = 0;34953495+34963496+ pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);34973497+ if (pos) {34983498+ pci_read_config_word(pdev, msi_control_reg(pos), &control);34993499+ if (control & PCI_MSI_FLAGS_ENABLE) {35003500+ printk(KERN_INFO "cciss: resetting MSI\n");35013501+ pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE);35023502+ }35033503+ }35043504+35053505+ pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);35063506+ if (pos) {35073507+ pci_read_config_word(pdev, msi_control_reg(pos), &control);35083508+ if (control & PCI_MSIX_FLAGS_ENABLE) {35093509+ printk(KERN_INFO "cciss: resetting MSI-X\n");35103510+ pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE);35113511+ }35123512+ }35133513+35143514+ return 0;35153515+}35163516+35173517+/* This does a hard reset of the controller using PCI power management35183518+ * states. */35193519+static __devinit int cciss_hard_reset_controller(struct pci_dev *pdev)35203520+{35213521+ u16 pmcsr, saved_config_space[32];35223522+ int i, pos;35233523+35243524+ printk(KERN_INFO "cciss: using PCI PM to reset controller\n");35253525+35263526+ /* This is very nearly the same thing as35273527+35283528+ pci_save_state(pci_dev);35293529+ pci_set_power_state(pci_dev, PCI_D3hot);35303530+ pci_set_power_state(pci_dev, PCI_D0);35313531+ pci_restore_state(pci_dev);35323532+35333533+ but we can't use these nice canned kernel routines on35343534+ kexec, because they also check the MSI/MSI-X state in PCI35353535+ configuration space and do the wrong thing when it is35363536+ set/cleared. Also, the pci_save/restore_state functions35373537+ violate the ordering requirements for restoring the35383538+ configuration space from the CCISS document (see the35393539+ comment below). So we roll our own .... */35403540+35413541+ for (i = 0; i < 32; i++)35423542+ pci_read_config_word(pdev, 2*i, &saved_config_space[i]);35433543+35443544+ pos = pci_find_capability(pdev, PCI_CAP_ID_PM);35453545+ if (pos == 0) {35463546+ printk(KERN_ERR "cciss_reset_controller: PCI PM not supported\n");35473547+ return -ENODEV;35483548+ }35493549+35503550+ /* Quoting from the Open CISS Specification: "The Power35513551+ * Management Control/Status Register (CSR) controls the power35523552+ * state of the device. The normal operating state is D0,35533553+ * CSR=00h. The software off state is D3, CSR=03h. To reset35543554+ * the controller, place the interface device in D3 then to35553555+ * D0, this causes a secondary PCI reset which will reset the35563556+ * controller." */35573557+35583558+ /* enter the D3hot power management state */35593559+ pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);35603560+ pmcsr &= ~PCI_PM_CTRL_STATE_MASK;35613561+ pmcsr |= PCI_D3hot;35623562+ pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);35633563+35643564+ schedule_timeout_uninterruptible(HZ >> 1);35653565+35663566+ /* enter the D0 power management state */35673567+ pmcsr &= ~PCI_PM_CTRL_STATE_MASK;35683568+ pmcsr |= PCI_D0;35693569+ pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);35703570+35713571+ schedule_timeout_uninterruptible(HZ >> 1);35723572+35733573+ /* Restore the PCI configuration space. The Open CISS35743574+ * Specification says, "Restore the PCI Configuration35753575+ * Registers, offsets 00h through 60h. It is important to35763576+ * restore the command register, 16-bits at offset 04h,35773577+ * last. Do not restore the configuration status register,35783578+ * 16-bits at offset 06h." Note that the offset is 2*i. */35793579+ for (i = 0; i < 32; i++) {35803580+ if (i == 2 || i == 3)35813581+ continue;35823582+ pci_write_config_word(pdev, 2*i, saved_config_space[i]);35833583+ }35843584+ wmb();35853585+ pci_write_config_word(pdev, 4, saved_config_space[2]);35863586+35873587+ return 0;35883588+}35893589+33933590/*33943591 * This is it. Find all the controllers and register them. I really hate33953592 * stealing all these major device numbers.···36003403 int rc;36013404 int dac, return_code;36023405 InquiryData_struct *inq_buff = NULL;34063406+34073407+ if (reset_devices) {34083408+ /* Reset the controller with a PCI power-cycle */34093409+ if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))34103410+ return -ENODEV;34113411+34123412+ /* Some devices (notably the HP Smart Array 5i Controller)34133413+ need a little pause here */34143414+ schedule_timeout_uninterruptible(30*HZ);34153415+34163416+ /* Now try to get the controller to respond to a no-op */34173417+ for (i=0; i<12; i++) {34183418+ if (cciss_noop(pdev) == 0)34193419+ break;34203420+ else34213421+ printk("cciss: no-op failed%s\n", (i < 11 ? "; re-trying" : ""));34223422+ }34233423+ }3603342436043425 i = alloc_cciss_hba();36053426 if (i < 0)
+52-27
drivers/block/floppy.c
···558558static void recalibrate_floppy(void);559559static void floppy_shutdown(unsigned long);560560561561+static int floppy_request_regions(int);562562+static void floppy_release_regions(int);561563static int floppy_grab_irq_and_dma(void);562564static void floppy_release_irq_and_dma(void);563565···42764274 FDCS->rawcmd = 2;42774275 if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) {42784276 /* free ioports reserved by floppy_grab_irq_and_dma() */42794279- release_region(FDCS->address + 2, 4);42804280- release_region(FDCS->address + 7, 1);42774277+ floppy_release_regions(fdc);42814278 FDCS->address = -1;42824279 FDCS->version = FDC_NONE;42834280 continue;···42854284 FDCS->version = get_fdc_version();42864285 if (FDCS->version == FDC_NONE) {42874286 /* free ioports reserved by floppy_grab_irq_and_dma() */42884288- release_region(FDCS->address + 2, 4);42894289- release_region(FDCS->address + 7, 1);42874287+ floppy_release_regions(fdc);42904288 FDCS->address = -1;42914289 continue;42924290 }···4358435843594359static DEFINE_SPINLOCK(floppy_usage_lock);4360436043614361+static const struct io_region {43624362+ int offset;43634363+ int size;43644364+} io_regions[] = {43654365+ { 2, 1 },43664366+ /* address + 3 is sometimes reserved by pnp bios for motherboard */43674367+ { 4, 2 },43684368+ /* address + 6 is reserved, and may be taken by IDE.43694369+ * Unfortunately, Adaptec doesn't know this :-(, */43704370+ { 7, 1 },43714371+};43724372+43734373+static void floppy_release_allocated_regions(int fdc, const struct io_region *p)43744374+{43754375+ while (p != io_regions) {43764376+ p--;43774377+ release_region(FDCS->address + p->offset, p->size);43784378+ }43794379+}43804380+43814381+#define ARRAY_END(X) (&((X)[ARRAY_SIZE(X)]))43824382+43834383+static int floppy_request_regions(int fdc)43844384+{43854385+ const struct io_region *p;43864386+43874387+ for (p = io_regions; p < ARRAY_END(io_regions); p++) {43884388+ if (!request_region(FDCS->address + p->offset, p->size, "floppy")) {43894389+ DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + p->offset);43904390+ floppy_release_allocated_regions(fdc, p);43914391+ return -EBUSY;43924392+ }43934393+ }43944394+ return 0;43954395+}43964396+43974397+static void floppy_release_regions(int fdc)43984398+{43994399+ floppy_release_allocated_regions(fdc, ARRAY_END(io_regions));44004400+}44014401+43614402static int floppy_grab_irq_and_dma(void)43624403{43634404 unsigned long flags;···4440439944414400 for (fdc = 0; fdc < N_FDC; fdc++) {44424401 if (FDCS->address != -1) {44434443- if (!request_region(FDCS->address + 2, 4, "floppy")) {44444444- DPRINT("Floppy io-port 0x%04lx in use\n",44454445- FDCS->address + 2);44464446- goto cleanup1;44474447- }44484448- if (!request_region(FDCS->address + 7, 1, "floppy DIR")) {44494449- DPRINT("Floppy io-port 0x%04lx in use\n",44504450- FDCS->address + 7);44514451- goto cleanup2;44524452- }44534453- /* address + 6 is reserved, and may be taken by IDE.44544454- * Unfortunately, Adaptec doesn't know this :-(, */44024402+ if (floppy_request_regions(fdc))44034403+ goto cleanup;44554404 }44564405 }44574406 for (fdc = 0; fdc < N_FDC; fdc++) {···44634432 fdc = 0;44644433 irqdma_allocated = 1;44654434 return 0;44664466-cleanup2:44674467- release_region(FDCS->address + 2, 4);44684468-cleanup1:44354435+cleanup:44694436 fd_free_irq();44704437 fd_free_dma();44714471- while (--fdc >= 0) {44724472- release_region(FDCS->address + 2, 4);44734473- release_region(FDCS->address + 7, 1);44744474- }44384438+ while (--fdc >= 0)44394439+ floppy_release_regions(fdc);44754440 spin_lock_irqsave(&floppy_usage_lock, flags);44764441 usage_count--;44774442 spin_unlock_irqrestore(&floppy_usage_lock, flags);···45284501#endif45294502 old_fdc = fdc;45304503 for (fdc = 0; fdc < N_FDC; fdc++)45314531- if (FDCS->address != -1) {45324532- release_region(FDCS->address + 2, 4);45334533- release_region(FDCS->address + 7, 1);45344534- }45044504+ if (FDCS->address != -1)45054505+ floppy_release_regions(fdc);45354506 fdc = old_fdc;45364507}45374508
+1-1
drivers/block/paride/pg.c
···422422423423 for (k = 0; k < len; k++) {424424 char c = *buf++;425425- if (c != ' ' || c != l)425425+ if (c != ' ' && c != l)426426 l = *targ++ = c;427427 }428428 if (l == ' ')
···11/*22 * linux/drivers/firmware/memmap.c33 * Copyright (C) 2008 SUSE LINUX Products GmbH44- * by Bernhard Walle <bwalle@suse.de>44+ * by Bernhard Walle <bernhard.walle@gmx.de>55 *66 * This program is free software; you can redistribute it and/or modify77 * it under the terms of the GNU General Public License v2.0 as published by
+6-7
drivers/gpu/drm/Kconfig
···8080 XFree86 4.4 and above. If unsure, build this and i830 as modules and8181 the X server will load the correct one.82828383-endchoice8484-8583config DRM_I915_KMS8684 bool "Enable modesetting on intel by default"8785 depends on DRM_I9158886 help8989- Choose this option if you want kernel modesetting enabled by default,9090- and you have a new enough userspace to support this. Running old9191- userspaces with this enabled will cause pain. Note that this causes9292- the driver to bind to PCI devices, which precludes loading things9393- like intelfb.8787+ Choose this option if you want kernel modesetting enabled by default,8888+ and you have a new enough userspace to support this. Running old8989+ userspaces with this enabled will cause pain. Note that this causes9090+ the driver to bind to PCI devices, which precludes loading things9191+ like intelfb.94929393+endchoice95949695config DRM_MGA9796 tristate "Matrox g200/g400"
···267267 default:268268 {269269 struct hid_device *hid = dev->hid;270270- if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ)271271- return -EINVAL;270270+ if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) {271271+ ret = -EINVAL;272272+ break;273273+ }272274273275 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {274276 int len;···279277 len = strlen(hid->name) + 1;280278 if (len > _IOC_SIZE(cmd))281279 len = _IOC_SIZE(cmd);282282- return copy_to_user(user_arg, hid->name, len) ?280280+ ret = copy_to_user(user_arg, hid->name, len) ?283281 -EFAULT : len;282282+ break;284283 }285284286285 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {···291288 len = strlen(hid->phys) + 1;292289 if (len > _IOC_SIZE(cmd))293290 len = _IOC_SIZE(cmd);294294- return copy_to_user(user_arg, hid->phys, len) ?291291+ ret = copy_to_user(user_arg, hid->phys, len) ?295292 -EFAULT : len;293293+ break;296294 }297295 }298296299299- ret = -ENOTTY;297297+ ret = -ENOTTY;300298 }301299 unlock_kernel();302300 return ret;
+2-2
drivers/hwmon/f71882fg.c
···1872187218731873 devid = superio_inw(sioaddr, SIO_REG_MANID);18741874 if (devid != SIO_FINTEK_ID) {18751875- printk(KERN_INFO DRVNAME ": Not a Fintek device\n");18751875+ pr_debug(DRVNAME ": Not a Fintek device\n");18761876 goto exit;18771877 }18781878···19321932 res.name = f71882fg_pdev->name;19331933 err = acpi_check_resource_conflict(&res);19341934 if (err)19351935- return err;19351935+ goto exit_device_put;1936193619371937 err = platform_device_add_resources(f71882fg_pdev, &res, 1);19381938 if (err) {
+81-4
drivers/hwmon/hp_accel.c
···166166 }, \167167 .driver_data = &lis3lv02d_axis_##_axis \168168}169169+170170+#define AXIS_DMI_MATCH2(_ident, _class1, _name1, \171171+ _class2, _name2, \172172+ _axis) { \173173+ .ident = _ident, \174174+ .callback = lis3lv02d_dmi_matched, \175175+ .matches = { \176176+ DMI_MATCH(DMI_##_class1, _name1), \177177+ DMI_MATCH(DMI_##_class2, _name2), \178178+ }, \179179+ .driver_data = &lis3lv02d_axis_##_axis \180180+}169181static struct dmi_system_id lis3lv02d_dmi_ids[] = {170182 /* product names are truncated to match all kinds of a same model */171183 AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted),···191179 AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),192180 AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),193181 AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),182182+ /* Intel-based HP Pavilion dv5 */183183+ AXIS_DMI_MATCH2("HPDV5_I",184184+ PRODUCT_NAME, "HP Pavilion dv5",185185+ BOARD_NAME, "3603",186186+ x_inverted),187187+ /* AMD-based HP Pavilion dv5 */188188+ AXIS_DMI_MATCH2("HPDV5_A",189189+ PRODUCT_NAME, "HP Pavilion dv5",190190+ BOARD_NAME, "3600",191191+ y_inverted),194192 { NULL, }195193/* Laptop models without axis info (yet):196194 * "NC6910" "HP Compaq 6910"···235213 .set_brightness = hpled_set,236214};237215216216+static acpi_status217217+lis3lv02d_get_resource(struct acpi_resource *resource, void *context)218218+{219219+ if (resource->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {220220+ struct acpi_resource_extended_irq *irq;221221+ u32 *device_irq = context;222222+223223+ irq = &resource->data.extended_irq;224224+ *device_irq = irq->interrupts[0];225225+ }226226+227227+ return AE_OK;228228+}229229+230230+static void lis3lv02d_enum_resources(struct acpi_device *device)231231+{232232+ acpi_status status;233233+234234+ status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,235235+ lis3lv02d_get_resource, &adev.irq);236236+ if (ACPI_FAILURE(status))237237+ printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n");238238+}239239+240240+static s16 lis3lv02d_read_16(acpi_handle handle, int reg)241241+{242242+ u8 lo, hi;243243+244244+ adev.read(handle, reg - 1, &lo);245245+ adev.read(handle, reg, &hi);246246+ /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */247247+ return (s16)((hi << 8) | lo);248248+}249249+250250+static s16 lis3lv02d_read_8(acpi_handle handle, int reg)251251+{252252+ s8 lo;253253+ adev.read(handle, reg, &lo);254254+ return lo;255255+}256256+238257static int lis3lv02d_add(struct acpi_device *device)239258{240240- u8 val;241259 int ret;242260243261 if (!device)···291229 strcpy(acpi_device_class(device), ACPI_MDPS_CLASS);292230 device->driver_data = &adev;293231294294- lis3lv02d_acpi_read(device->handle, WHO_AM_I, &val);295295- if ((val != LIS3LV02DL_ID) && (val != LIS302DL_ID)) {232232+ lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami);233233+ switch (adev.whoami) {234234+ case LIS_DOUBLE_ID:235235+ printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n");236236+ adev.read_data = lis3lv02d_read_16;237237+ adev.mdps_max_val = 2048;238238+ break;239239+ case LIS_SINGLE_ID:240240+ printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n");241241+ adev.read_data = lis3lv02d_read_8;242242+ adev.mdps_max_val = 128;243243+ break;244244+ default:296245 printk(KERN_ERR DRIVER_NAME297297- ": Accelerometer chip not LIS3LV02D{L,Q}\n");246246+ ": unknown sensor type 0x%X\n", adev.whoami);247247+ return -EINVAL;298248 }299249300250 /* If possible use a "standard" axes order */···320246 ret = led_classdev_register(NULL, &hpled_led.led_classdev);321247 if (ret)322248 return ret;249249+250250+ /* obtain IRQ number of our device from ACPI */251251+ lis3lv02d_enum_resources(adev.device);323252324253 ret = lis3lv02d_init_device(&adev);325254 if (ret) {
+160-35
drivers/hwmon/lis3lv02d.c
···33 *44 * Copyright (C) 2007-2008 Yan Burman55 * Copyright (C) 2008 Eric Piel66- * Copyright (C) 2008 Pavel Machek66+ * Copyright (C) 2008-2009 Pavel Machek77 *88 * This program is free software; you can redistribute it and/or modify99 * it under the terms of the GNU General Public License as published by···3535#include <linux/poll.h>3636#include <linux/freezer.h>3737#include <linux/uaccess.h>3838+#include <linux/miscdevice.h>3839#include <acpi/acpi_drivers.h>3940#include <asm/atomic.h>4041#include "lis3lv02d.h"···5352 * joystick.5453 */55545656-/* Maximum value our axis may get for the input device (signed 12 bits) */5757-#define MDPS_MAX_VAL 20485555+struct acpi_lis3lv02d adev = {5656+ .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait),5757+};58585959-struct acpi_lis3lv02d adev;6059EXPORT_SYMBOL_GPL(adev);61606261static int lis3lv02d_add_fs(struct acpi_device *device);6363-6464-static s16 lis3lv02d_read_16(acpi_handle handle, int reg)6565-{6666- u8 lo, hi;6767-6868- adev.read(handle, reg, &lo);6969- adev.read(handle, reg + 1, &hi);7070- /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */7171- return (s16)((hi << 8) | lo);7272-}73627463/**7564 * lis3lv02d_get_axis - For the given axis, give the value converted···8998{9099 int position[3];911009292- position[0] = lis3lv02d_read_16(handle, OUTX_L);9393- position[1] = lis3lv02d_read_16(handle, OUTY_L);9494- position[2] = lis3lv02d_read_16(handle, OUTZ_L);101101+ position[0] = adev.read_data(handle, OUTX);102102+ position[1] = adev.read_data(handle, OUTY);103103+ position[2] = adev.read_data(handle, OUTZ);9510496105 *x = lis3lv02d_get_axis(adev.ac.x, position);97106 *y = lis3lv02d_get_axis(adev.ac.y, position);···101110void lis3lv02d_poweroff(acpi_handle handle)102111{103112 adev.is_on = 0;104104- /* disable X,Y,Z axis and power down */105105- adev.write(handle, CTRL_REG1, 0x00);106113}107114EXPORT_SYMBOL_GPL(lis3lv02d_poweroff);108115109116void lis3lv02d_poweron(acpi_handle handle)110117{111111- u8 val;112112-113118 adev.is_on = 1;114119 adev.init(handle);115115- adev.write(handle, FF_WU_CFG, 0);116116- /*117117- * BDU: LSB and MSB values are not updated until both have been read.118118- * So the value read will always be correct.119119- * IEN: Interrupt for free-fall and DD, not for data-ready.120120- */121121- adev.read(handle, CTRL_REG2, &val);122122- val |= CTRL2_BDU | CTRL2_IEN;123123- adev.write(handle, CTRL_REG2, val);124120}125121EXPORT_SYMBOL_GPL(lis3lv02d_poweron);126122···139161 lis3lv02d_poweroff(dev->device->handle);140162 mutex_unlock(&dev->lock);141163}164164+165165+static irqreturn_t lis302dl_interrupt(int irq, void *dummy)166166+{167167+ /*168168+ * Be careful: on some HP laptops the bios force DD when on battery and169169+ * the lid is closed. This leads to interrupts as soon as a little move170170+ * is done.171171+ */172172+ atomic_inc(&adev.count);173173+174174+ wake_up_interruptible(&adev.misc_wait);175175+ kill_fasync(&adev.async_queue, SIGIO, POLL_IN);176176+ return IRQ_HANDLED;177177+}178178+179179+static int lis3lv02d_misc_open(struct inode *inode, struct file *file)180180+{181181+ int ret;182182+183183+ if (test_and_set_bit(0, &adev.misc_opened))184184+ return -EBUSY; /* already open */185185+186186+ atomic_set(&adev.count, 0);187187+188188+ /*189189+ * The sensor can generate interrupts for free-fall and direction190190+ * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep191191+ * the things simple and _fast_ we activate it only for free-fall, so192192+ * no need to read register (very slow with ACPI). For the same reason,193193+ * we forbid shared interrupts.194194+ *195195+ * IRQF_TRIGGER_RISING seems pointless on HP laptops because the196196+ * io-apic is not configurable (and generates a warning) but I keep it197197+ * in case of support for other hardware.198198+ */199199+ ret = request_irq(adev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING,200200+ DRIVER_NAME, &adev);201201+202202+ if (ret) {203203+ clear_bit(0, &adev.misc_opened);204204+ printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", adev.irq);205205+ return -EBUSY;206206+ }207207+ lis3lv02d_increase_use(&adev);208208+ printk("lis3: registered interrupt %d\n", adev.irq);209209+ return 0;210210+}211211+212212+static int lis3lv02d_misc_release(struct inode *inode, struct file *file)213213+{214214+ fasync_helper(-1, file, 0, &adev.async_queue);215215+ lis3lv02d_decrease_use(&adev);216216+ free_irq(adev.irq, &adev);217217+ clear_bit(0, &adev.misc_opened); /* release the device */218218+ return 0;219219+}220220+221221+static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,222222+ size_t count, loff_t *pos)223223+{224224+ DECLARE_WAITQUEUE(wait, current);225225+ u32 data;226226+ unsigned char byte_data;227227+ ssize_t retval = 1;228228+229229+ if (count < 1)230230+ return -EINVAL;231231+232232+ add_wait_queue(&adev.misc_wait, &wait);233233+ while (true) {234234+ set_current_state(TASK_INTERRUPTIBLE);235235+ data = atomic_xchg(&adev.count, 0);236236+ if (data)237237+ break;238238+239239+ if (file->f_flags & O_NONBLOCK) {240240+ retval = -EAGAIN;241241+ goto out;242242+ }243243+244244+ if (signal_pending(current)) {245245+ retval = -ERESTARTSYS;246246+ goto out;247247+ }248248+249249+ schedule();250250+ }251251+252252+ if (data < 255)253253+ byte_data = data;254254+ else255255+ byte_data = 255;256256+257257+ /* make sure we are not going into copy_to_user() with258258+ * TASK_INTERRUPTIBLE state */259259+ set_current_state(TASK_RUNNING);260260+ if (copy_to_user(buf, &byte_data, sizeof(byte_data)))261261+ retval = -EFAULT;262262+263263+out:264264+ __set_current_state(TASK_RUNNING);265265+ remove_wait_queue(&adev.misc_wait, &wait);266266+267267+ return retval;268268+}269269+270270+static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)271271+{272272+ poll_wait(file, &adev.misc_wait, wait);273273+ if (atomic_read(&adev.count))274274+ return POLLIN | POLLRDNORM;275275+ return 0;276276+}277277+278278+static int lis3lv02d_misc_fasync(int fd, struct file *file, int on)279279+{280280+ return fasync_helper(fd, file, on, &adev.async_queue);281281+}282282+283283+static const struct file_operations lis3lv02d_misc_fops = {284284+ .owner = THIS_MODULE,285285+ .llseek = no_llseek,286286+ .read = lis3lv02d_misc_read,287287+ .open = lis3lv02d_misc_open,288288+ .release = lis3lv02d_misc_release,289289+ .poll = lis3lv02d_misc_poll,290290+ .fasync = lis3lv02d_misc_fasync,291291+};292292+293293+static struct miscdevice lis3lv02d_misc_device = {294294+ .minor = MISC_DYNAMIC_MINOR,295295+ .name = "freefall",296296+ .fops = &lis3lv02d_misc_fops,297297+};142298143299/**144300 * lis3lv02d_joystick_kthread - Kthread polling function···315203 lis3lv02d_decrease_use(&adev);316204}317205318318-319206static inline void lis3lv02d_calibrate_joystick(void)320207{321208 lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib);···342231 adev.idev->close = lis3lv02d_joystick_close;343232344233 set_bit(EV_ABS, adev.idev->evbit);345345- input_set_abs_params(adev.idev, ABS_X, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3);346346- input_set_abs_params(adev.idev, ABS_Y, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3);347347- input_set_abs_params(adev.idev, ABS_Z, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3);234234+ input_set_abs_params(adev.idev, ABS_X, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);235235+ input_set_abs_params(adev.idev, ABS_Y, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);236236+ input_set_abs_params(adev.idev, ABS_Z, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);348237349238 err = input_register_device(adev.idev);350239 if (err) {···361250 if (!adev.idev)362251 return;363252253253+ misc_deregister(&lis3lv02d_misc_device);364254 input_unregister_device(adev.idev);365255 adev.idev = NULL;366256}···380268 if (lis3lv02d_joystick_enable())381269 printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");382270271271+ printk("lis3_init_device: irq %d\n", dev->irq);272272+273273+ /* if we did not get an IRQ from ACPI - we have nothing more to do */274274+ if (!dev->irq) {275275+ printk(KERN_ERR DRIVER_NAME276276+ ": No IRQ in ACPI. Disabling /dev/freefall\n");277277+ goto out;278278+ }279279+280280+ printk("lis3: registering device\n");281281+ if (misc_register(&lis3lv02d_misc_device))282282+ printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");283283+out:383284 lis3lv02d_decrease_use(dev);384285 return 0;385286}···476351EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);477352478353MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver");479479-MODULE_AUTHOR("Yan Burman and Eric Piel");354354+MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");480355MODULE_LICENSE("GPL");481356
+18-3
drivers/hwmon/lis3lv02d.h
···2222/*2323 * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to2424 * be connected via SPI. There exists also several similar chips (such as LIS302DL or2525- * LIS3L02DQ) but not in the HP laptops and they have slightly different registers.2525+ * LIS3L02DQ) and they have slightly different registers, but we can provide a2626+ * common interface for all of them.2627 * They can also be connected via I²C.2728 */28292929-#define LIS3LV02DL_ID 0x3A /* Also the LIS3LV02DQ */3030-#define LIS302DL_ID 0x3B /* Also the LIS202DL! */3030+/* 2-byte registers */3131+#define LIS_DOUBLE_ID 0x3A /* LIS3LV02D[LQ] */3232+/* 1-byte registers */3333+#define LIS_SINGLE_ID 0x3B /* LIS[32]02DL and others */31343235enum lis3lv02d_reg {3336 WHO_AM_I = 0x0F,···4744 STATUS_REG = 0x27,4845 OUTX_L = 0x28,4946 OUTX_H = 0x29,4747+ OUTX = 0x29,5048 OUTY_L = 0x2A,5149 OUTY_H = 0x2B,5050+ OUTY = 0x2B,5251 OUTZ_L = 0x2C,5352 OUTZ_H = 0x2D,5353+ OUTZ = 0x2D,5454 FF_WU_CFG = 0x30,5555 FF_WU_SRC = 0x31,5656 FF_WU_ACK = 0x32,···165159 acpi_status (*write) (acpi_handle handle, int reg, u8 val);166160 acpi_status (*read) (acpi_handle handle, int reg, u8 *ret);167161162162+ u8 whoami; /* 3Ah: 2-byte registries, 3Bh: 1-byte registries */163163+ s16 (*read_data) (acpi_handle handle, int reg);164164+ int mdps_max_val;165165+168166 struct input_dev *idev; /* input device */169167 struct task_struct *kthread; /* kthread for input */170168 struct mutex lock;···180170 unsigned char is_on; /* whether the device is on or off */181171 unsigned char usage; /* usage counter */182172 struct axis_conversion ac; /* hw -> logical axis */173173+174174+ u32 irq; /* IRQ number */175175+ struct fasync_struct *async_queue; /* queue for the misc device */176176+ wait_queue_head_t misc_wait; /* Wait queue for the misc device */177177+ unsigned long misc_opened; /* bit0: whether the device is open */183178};184179185180int lis3lv02d_init_device(struct acpi_lis3lv02d *dev);
···328328 struct dpages old_pages = *dp;329329330330 if (sync)331331- rw |= (1 << BIO_RW_SYNC);331331+ rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);332332333333 /*334334 * For multiple regions we need to be careful to rewind
···393393 return 0;394394 }395395396396- v4l2_subdev_call(itv->sd_video, video, s_fmt, fmt);396396+ v4l2_subdev_call(itv->sd_video, video, g_fmt, fmt);397397 vbifmt->service_set = ivtv_get_service_set(vbifmt);398398 return 0;399399}···17481748 break;17491749 }1750175017511751+ case IVTV_IOC_DMA_FRAME:17521752+ case VIDEO_GET_PTS:17531753+ case VIDEO_GET_FRAME_COUNT:17541754+ case VIDEO_GET_EVENT:17551755+ case VIDEO_PLAY:17561756+ case VIDEO_STOP:17571757+ case VIDEO_FREEZE:17581758+ case VIDEO_CONTINUE:17591759+ case VIDEO_COMMAND:17601760+ case VIDEO_TRY_COMMAND:17611761+ return ivtv_decoder_ioctls(file, cmd, (void *)arg);17621762+17511763 default:17521764 return -EINVAL;17531765 }···18011789 itv->audio_bilingual_mode = arg;18021790 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);18031791 return 0;18041804-18051805- case IVTV_IOC_DMA_FRAME:18061806- case VIDEO_GET_PTS:18071807- case VIDEO_GET_FRAME_COUNT:18081808- case VIDEO_GET_EVENT:18091809- case VIDEO_PLAY:18101810- case VIDEO_STOP:18111811- case VIDEO_FREEZE:18121812- case VIDEO_CONTINUE:18131813- case VIDEO_COMMAND:18141814- case VIDEO_TRY_COMMAND:18151815- return ivtv_decoder_ioctls(filp, cmd, (void *)arg);1816179218171793 default:18181794 break;
+2-2
drivers/mfd/htc-egpio.c
···286286 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);287287 if (!res)288288 goto fail;289289- ei->base_addr = ioremap_nocache(res->start, res->end - res->start);289289+ ei->base_addr = ioremap_nocache(res->start, resource_size(res));290290 if (!ei->base_addr)291291 goto fail;292292 pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);···307307308308 ei->nchips = pdata->num_chips;309309 ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL);310310- if (!ei) {310310+ if (!ei->chip) {311311 ret = -ENOMEM;312312 goto fail;313313 }
+1
drivers/mfd/pcf50633-core.c
···678678679679static struct i2c_device_id pcf50633_id_table[] = {680680 {"pcf50633", 0x73},681681+ {/* end of list */}681682};682683683684static struct i2c_driver pcf50633_driver = {
···5555#define VS30 (1 << 25)5656#define SDVS18 (0x5 << 9)5757#define SDVS30 (0x6 << 9)5858+#define SDVS33 (0x7 << 9)5859#define SDVSCLR 0xFFFFF1FF5960#define SDVSDET 0x000004006061#define AUTOIDLE 0x1···376375}377376#endif /* CONFIG_MMC_DEBUG */378377378378+/*379379+ * MMC controller internal state machines reset380380+ *381381+ * Used to reset command or data internal state machines, using respectively382382+ * SRC or SRD bit of SYSCTL register383383+ * Can be called from interrupt context384384+ */385385+static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host,386386+ unsigned long bit)387387+{388388+ unsigned long i = 0;389389+ unsigned long limit = (loops_per_jiffy *390390+ msecs_to_jiffies(MMC_TIMEOUT_MS));391391+392392+ OMAP_HSMMC_WRITE(host->base, SYSCTL,393393+ OMAP_HSMMC_READ(host->base, SYSCTL) | bit);394394+395395+ while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) &&396396+ (i++ < limit))397397+ cpu_relax();398398+399399+ if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit)400400+ dev_err(mmc_dev(host->mmc),401401+ "Timeout waiting on controller reset in %s\n",402402+ __func__);403403+}379404380405/*381406 * MMC controller IRQ handler···430403 (status & CMD_CRC)) {431404 if (host->cmd) {432405 if (status & CMD_TIMEOUT) {433433- OMAP_HSMMC_WRITE(host->base, SYSCTL,434434- OMAP_HSMMC_READ(host->base,435435- SYSCTL) | SRC);436436- while (OMAP_HSMMC_READ(host->base,437437- SYSCTL) & SRC)438438- ;439439-406406+ mmc_omap_reset_controller_fsm(host, SRC);440407 host->cmd->error = -ETIMEDOUT;441408 } else {442409 host->cmd->error = -EILSEQ;443410 }444411 end_cmd = 1;445412 }446446- if (host->data)413413+ if (host->data) {447414 mmc_dma_cleanup(host);415415+ mmc_omap_reset_controller_fsm(host, SRD);416416+ }448417 }449418 if ((status & DATA_TIMEOUT) ||450419 (status & DATA_CRC)) {···449426 mmc_dma_cleanup(host);450427 else451428 host->data->error = -EILSEQ;452452- OMAP_HSMMC_WRITE(host->base, SYSCTL,453453- OMAP_HSMMC_READ(host->base,454454- SYSCTL) | SRD);455455- while (OMAP_HSMMC_READ(host->base,456456- SYSCTL) & SRD)457457- ;429429+ mmc_omap_reset_controller_fsm(host, SRD);458430 end_trans = 1;459431 }460432 }···474456}475457476458/*477477- * Switch MMC operating voltage459459+ * Switch MMC interface voltage ... only relevant for MMC1.460460+ *461461+ * MMC2 and MMC3 use fixed 1.8V levels, and maybe a transceiver.462462+ * The MMC2 transceiver controls are used instead of DAT4..DAT7.463463+ * Some chips, like eMMC ones, use internal transceivers.478464 */479465static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)480466{481467 u32 reg_val = 0;482468 int ret;469469+470470+ if (host->id != OMAP_MMC1_DEVID)471471+ return 0;483472484473 /* Disable the clocks */485474 clk_disable(host->fclk);···510485 OMAP_HSMMC_WRITE(host->base, HCTL,511486 OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR);512487 reg_val = OMAP_HSMMC_READ(host->base, HCTL);488488+513489 /*514490 * If a MMC dual voltage card is detected, the set_ios fn calls515491 * this fn with VDD bit set for 1.8V. Upon card removal from the516492 * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF.517493 *518518- * Only MMC1 supports 3.0V. MMC2 will not function if SDVS30 is519519- * set in HCTL.494494+ * Cope with a bit of slop in the range ... per data sheets:495495+ * - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max,496496+ * but recommended values are 1.71V to 1.89V497497+ * - "3.0V" for vdds_mmc1/vdds_mmc1a can be up to 3.5V max,498498+ * but recommended values are 2.7V to 3.3V499499+ *500500+ * Board setup code shouldn't permit anything very out-of-range.501501+ * TWL4030-family VMMC1 and VSIM regulators are fine (avoiding the502502+ * middle range) but VSIM can't power DAT4..DAT7 at more than 3V.520503 */521521- if (host->id == OMAP_MMC1_DEVID && (((1 << vdd) == MMC_VDD_32_33) ||522522- ((1 << vdd) == MMC_VDD_33_34)))523523- reg_val |= SDVS30;524524- if ((1 << vdd) == MMC_VDD_165_195)504504+ if ((1 << vdd) <= MMC_VDD_23_24)525505 reg_val |= SDVS18;506506+ else507507+ reg_val |= SDVS30;526508527509 OMAP_HSMMC_WRITE(host->base, HCTL, reg_val);528510···549517{550518 struct mmc_omap_host *host = container_of(work, struct mmc_omap_host,551519 mmc_carddetect_work);520520+ struct omap_mmc_slot_data *slot = &mmc_slot(host);521521+522522+ host->carddetect = slot->card_detect(slot->card_detect_irq);552523553524 sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch");554525 if (host->carddetect) {555526 mmc_detect_change(host->mmc, (HZ * 200) / 1000);556527 } else {557557- OMAP_HSMMC_WRITE(host->base, SYSCTL,558558- OMAP_HSMMC_READ(host->base, SYSCTL) | SRD);559559- while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD)560560- ;561561-528528+ mmc_omap_reset_controller_fsm(host, SRD);562529 mmc_detect_change(host->mmc, (HZ * 50) / 1000);563530 }564531}···569538{570539 struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id;571540572572- host->carddetect = mmc_slot(host).card_detect(irq);573541 schedule_work(&host->mmc_carddetect_work);574542575543 return IRQ_HANDLED;···787757 case MMC_POWER_OFF:788758 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0);789759 /*790790- * Reset bus voltage to 3V if it got set to 1.8V earlier.760760+ * Reset interface voltage to 3V if it's 1.8V now;761761+ * only relevant on MMC-1, the others always use 1.8V.762762+ *791763 * REVISIT: If we are able to detect cards after unplugging792764 * a 1.8V card, this code should not be needed.793765 */766766+ if (host->id != OMAP_MMC1_DEVID)767767+ break;794768 if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {795769 int vdd = fls(host->mmc->ocr_avail) - 1;796770 if (omap_mmc_switch_opcond(host, vdd) != 0)···818784 }819785820786 if (host->id == OMAP_MMC1_DEVID) {821821- /* Only MMC1 can operate at 3V/1.8V */787787+ /* Only MMC1 can interface at 3V without some flavor788788+ * of external transceiver; but they all handle 1.8V.789789+ */822790 if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) &&823791 (ios->vdd == DUAL_VOLT_OCR_BIT)) {824792 /*···11731137 " level suspend\n");11741138 }1175113911761176- if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {11401140+ if (host->id == OMAP_MMC1_DEVID11411141+ && !(OMAP_HSMMC_READ(host->base, HCTL)11421142+ & SDVSDET)) {11771143 OMAP_HSMMC_WRITE(host->base, HCTL,11781144 OMAP_HSMMC_READ(host->base, HCTL)11791145 & SDVSCLR);
+1-1
drivers/mmc/host/s3cmci.c
···329329330330 to_ptr = host->base + host->sdidata;331331332332- while ((fifo = fifo_free(host))) {332332+ while ((fifo = fifo_free(host)) > 3) {333333 if (!host->pio_bytes) {334334 res = get_data_buffer(host, &host->pio_bytes,335335 &host->pio_ptr);
···208208#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12)209209/* Controller has an issue with buffer bits for small transfers */210210#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)211211-/* Controller supports high speed but doesn't have the caps bit set */212212-#define SDHCI_QUIRK_FORCE_HIGHSPEED (1<<14)213211214212 int irq; /* Device IRQ */215213 void __iomem * ioaddr; /* Mapped address */···220222221223#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)222224 struct led_classdev led; /* LED control */225225+ char led_name[32];223226#endif224227225228 spinlock_t lock; /* Mutex */
+15-1
drivers/pci/intel-iommu.c
···6161/* global iommu list, set NULL for ignored DMAR units */6262static struct intel_iommu **g_iommus;63636464+static int rwbf_quirk;6565+6466/*6567 * 0: Present6668 * 1-11: Reserved···787785 u32 val;788786 unsigned long flag;789787790790- if (!cap_rwbf(iommu->cap))788788+ if (!rwbf_quirk && !cap_rwbf(iommu->cap))791789 return;792790 val = iommu->gcmd | DMA_GCMD_WBF;793791···31393137 .unmap = intel_iommu_unmap_range,31403138 .iova_to_phys = intel_iommu_iova_to_phys,31413139};31403140+31413141+static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)31423142+{31433143+ /*31443144+ * Mobile 4 Series Chipset neglects to set RWBF capability,31453145+ * but needs it:31463146+ */31473147+ printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n");31483148+ rwbf_quirk = 1;31493149+}31503150+31513151+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
+4-6
drivers/pci/msi.c
···103103 }104104}105105106106-/*107107- * Essentially, this is ((1 << (1 << x)) - 1), but without the108108- * undefinedness of a << 32.109109- */110106static inline __attribute_const__ u32 msi_mask(unsigned x)111107{112112- static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff };113113- return mask[x];108108+ /* Don't shift by >= width of type */109109+ if (x >= 5)110110+ return 0xffffffff;111111+ return (1 << (1 << x)) - 1;114112}115113116114static void msix_flush_writes(struct irq_desc *desc)
+9-4
drivers/pci/pci.c
···15401540}1541154115421542/**15431543- * pci_request_region - Reserved PCI I/O and memory resource15431543+ * __pci_request_region - Reserved PCI I/O and memory resource15441544 * @pdev: PCI device whose resources are to be reserved15451545 * @bar: BAR to be reserved15461546 * @res_name: Name to be associated with resource.15471547+ * @exclusive: whether the region access is exclusive or not15471548 *15481549 * Mark the PCI region associated with PCI device @pdev BR @bar as15491550 * being reserved by owner @res_name. Do not access any15501551 * address inside the PCI regions unless this call returns15511552 * successfully.15531553+ *15541554+ * If @exclusive is set, then the region is marked so that userspace15551555+ * is explicitly not allowed to map the resource via /dev/mem or15561556+ * sysfs MMIO access.15521557 *15531558 * Returns 0 on success, or %EBUSY on error. A warning15541559 * message is also printed on failure.···15931588}1594158915951590/**15961596- * pci_request_region - Reserved PCI I/O and memory resource15911591+ * pci_request_region - Reserve PCI I/O and memory resource15971592 * @pdev: PCI device whose resources are to be reserved15981593 * @bar: BAR to be reserved15991599- * @res_name: Name to be associated with resource.15941594+ * @res_name: Name to be associated with resource16001595 *16011601- * Mark the PCI region associated with PCI device @pdev BR @bar as15961596+ * Mark the PCI region associated with PCI device @pdev BAR @bar as16021597 * being reserved by owner @res_name. Do not access any16031598 * address inside the PCI regions unless this call returns16041599 * successfully.
+10-10
drivers/pci/pci.h
···1616#endif17171818/**1919- * Firmware PM callbacks1919+ * struct pci_platform_pm_ops - Firmware PM callbacks2020 *2121- * @is_manageable - returns 'true' if given device is power manageable by the2222- * platform firmware2121+ * @is_manageable: returns 'true' if given device is power manageable by the2222+ * platform firmware2323 *2424- * @set_state - invokes the platform firmware to set the device's power state2424+ * @set_state: invokes the platform firmware to set the device's power state2525 *2626- * @choose_state - returns PCI power state of given device preferred by the2727- * platform; to be used during system-wide transitions from a2828- * sleeping state to the working state and vice versa2626+ * @choose_state: returns PCI power state of given device preferred by the2727+ * platform; to be used during system-wide transitions from a2828+ * sleeping state to the working state and vice versa2929 *3030- * @can_wakeup - returns 'true' if given device is capable of waking up the3131- * system from a sleeping state3030+ * @can_wakeup: returns 'true' if given device is capable of waking up the3131+ * system from a sleeping state3232 *3333- * @sleep_wake - enables/disables the system wake up capability of given device3333+ * @sleep_wake: enables/disables the system wake up capability of given device3434 *3535 * If given platform is generally capable of power managing PCI devices, all of3636 * these callbacks are mandatory.
+1
drivers/pci/rom.c
···55555656/**5757 * pci_get_rom_size - obtain the actual size of the ROM image5858+ * @pdev: target PCI device5859 * @rom: kernel virtual pointer to image of ROM5960 * @size: size of PCI window6061 * return: size of actual ROM image
+2
drivers/platform/x86/Kconfig
···6262 depends on EXPERIMENTAL6363 depends on BACKLIGHT_CLASS_DEVICE6464 depends on RFKILL6565+ depends on POWER_SUPPLY6566 default n6667 ---help---6768 This driver adds support for rfkill and backlight control to Dell···302301config EEEPC_LAPTOP303302 tristate "Eee PC Hotkey Driver (EXPERIMENTAL)"304303 depends on ACPI304304+ depends on INPUT305305 depends on EXPERIMENTAL306306 select BACKLIGHT_CLASS_DEVICE307307 select HWMON
+4
drivers/serial/atmel_serial.c
···877877 }878878 }879879880880+ /* Save current CSR for comparison in atmel_tasklet_func() */881881+ atmel_port->irq_status_prev = UART_GET_CSR(port);882882+ atmel_port->irq_status = atmel_port->irq_status_prev;883883+880884 /*881885 * Finally, enable the serial port882886 */
···298298EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);299299300300/**301301- * usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled302302- * @dev: USB Host Controller being resumed303303- *304304- * Store this function in the HCD's struct pci_driver as .resume_early.305305- */306306-int usb_hcd_pci_resume_early(struct pci_dev *dev)307307-{308308- pci_restore_state(dev);309309- return 0;310310-}311311-EXPORT_SYMBOL_GPL(usb_hcd_pci_resume_early);312312-313313-/**314301 * usb_hcd_pci_resume - power management resume of a PCI-based HCD315302 * @dev: USB Host Controller being resumed316303 *···319332 of_node, 0, 1);320333 }321334#endif335335+336336+ pci_restore_state(dev);322337323338 hcd = pci_get_drvdata(dev);324339 if (hcd->state != HC_STATE_SUSPENDED) {
-1
drivers/usb/core/hcd.h
···257257258258#ifdef CONFIG_PM259259extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg);260260-extern int usb_hcd_pci_resume_early(struct pci_dev *dev);261260extern int usb_hcd_pci_resume(struct pci_dev *dev);262261#endif /* CONFIG_PM */263262
···227227 * Now that the ASL is updated, complete the removal of any228228 * removed qsets.229229 */230230- spin_lock(&whc->lock);230230+ spin_lock_irq(&whc->lock);231231232232 list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) {233233 qset_remove_complete(whc, qset);234234 }235235236236- spin_unlock(&whc->lock);236236+ spin_unlock_irq(&whc->lock);237237}238238239239/**
+2-2
drivers/usb/host/whci/pzl.c
···255255 * Now that the PZL is updated, complete the removal of any256256 * removed qsets.257257 */258258- spin_lock(&whc->lock);258258+ spin_lock_irq(&whc->lock);259259260260 list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) {261261 qset_remove_complete(whc, qset);262262 }263263264264- spin_unlock(&whc->lock);264264+ spin_unlock_irq(&whc->lock);265265}266266267267/**
···406406 ---help---407407 Hardware driver for the intel TCO timer based watchdog devices.408408 These drivers are included in the Intel 82801 I/O Controller409409- Hub family (from ICH0 up to ICH8) and in the Intel 6300ESB409409+ Hub family (from ICH0 up to ICH10) and in the Intel 63xxESB410410 controller hub.411411412412 The TCO (Total Cost of Ownership) timer is a watchdog timer
+28-4
drivers/watchdog/iTCO_vendor_support.c
···11/*22 * intel TCO vendor specific watchdog driver support33 *44- * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>.44+ * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>.55 *66 * This program is free software; you can redistribute it and/or77 * modify it under the terms of the GNU General Public License···19192020/* Module and version information */2121#define DRV_NAME "iTCO_vendor_support"2222-#define DRV_VERSION "1.02"2222+#define DRV_VERSION "1.03"2323#define PFX DRV_NAME ": "24242525/* Includes */···7676 * time is about 40 seconds, and the minimum hang time is about7777 * 20.6 seconds.7878 */7979+8080+static void supermicro_old_pre_start(unsigned long acpibase)8181+{8282+ unsigned long val32;8383+8484+ /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */8585+ val32 = inl(SMI_EN);8686+ val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */8787+ outl(val32, SMI_EN); /* Needed to activate watchdog */8888+}8989+9090+static void supermicro_old_pre_stop(unsigned long acpibase)9191+{9292+ unsigned long val32;9393+9494+ /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */9595+ val32 = inl(SMI_EN);9696+ val32 |= 0x00002000; /* Turn on SMI clearing watchdog */9797+ outl(val32, SMI_EN); /* Needed to deactivate watchdog */9898+}799980100static void supermicro_old_pre_keepalive(unsigned long acpibase)81101{···248228void iTCO_vendor_pre_start(unsigned long acpibase,249229 unsigned int heartbeat)250230{251251- if (vendorsupport == SUPERMICRO_NEW_BOARD)231231+ if (vendorsupport == SUPERMICRO_OLD_BOARD)232232+ supermicro_old_pre_start(acpibase);233233+ else if (vendorsupport == SUPERMICRO_NEW_BOARD)252234 supermicro_new_pre_start(heartbeat);253235}254236EXPORT_SYMBOL(iTCO_vendor_pre_start);255237256238void iTCO_vendor_pre_stop(unsigned long acpibase)257239{258258- if (vendorsupport == SUPERMICRO_NEW_BOARD)240240+ if (vendorsupport == SUPERMICRO_OLD_BOARD)241241+ supermicro_old_pre_stop(acpibase);242242+ else if (vendorsupport == SUPERMICRO_NEW_BOARD)259243 supermicro_new_pre_stop();260244}261245EXPORT_SYMBOL(iTCO_vendor_pre_stop);
+14-21
drivers/watchdog/iTCO_wdt.c
···11/*22- * intel TCO Watchdog Driver (Used in i82801 and i6300ESB chipsets)22+ * intel TCO Watchdog Driver (Used in i82801 and i63xxESB chipsets)33 *44- * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>.44+ * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>.55 *66 * This program is free software; you can redistribute it and/or77 * modify it under the terms of the GNU General Public License···63636464/* Module and version information */6565#define DRV_NAME "iTCO_wdt"6666-#define DRV_VERSION "1.04"6666+#define DRV_VERSION "1.05"6767#define PFX DRV_NAME ": "68686969/* Includes */···236236237237/* Address definitions for the TCO */238238/* TCO base address */239239-#define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60239239+#define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60240240/* SMI Control and Enable Register */241241-#define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30241241+#define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30242242243243#define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */244244#define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */245245-#define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */246246-#define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */247247-#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */248248-#define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */245245+#define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */246246+#define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */247247+#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */248248+#define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */249249#define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */250250#define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */251251#define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */···338338static int iTCO_wdt_start(void)339339{340340 unsigned int val;341341- unsigned long val32;342341343342 spin_lock(&iTCO_wdt_private.io_lock);344343···349350 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");350351 return -EIO;351352 }352352-353353- /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */354354- val32 = inl(SMI_EN);355355- val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */356356- outl(val32, SMI_EN);357353358354 /* Force the timer to its reload value by writing to the TCO_RLD359355 register */···372378static int iTCO_wdt_stop(void)373379{374380 unsigned int val;375375- unsigned long val32;376381377382 spin_lock(&iTCO_wdt_private.io_lock);378383···382389 val |= 0x0800;383390 outw(val, TCO1_CNT);384391 val = inw(TCO1_CNT);385385-386386- /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */387387- val32 = inl(SMI_EN);388388- val32 |= 0x00002000;389389- outl(val32, SMI_EN);390392391393 /* Set the NO_REBOOT bit to prevent later reboots, just for sure */392394 iTCO_wdt_set_NO_REBOOT_bit();···637649 int ret;638650 u32 base_address;639651 unsigned long RCBA;652652+ unsigned long val32;640653641654 /*642655 * Find the ACPI/PM base I/O address which is the base···684695 ret = -EIO;685696 goto out;686697 }698698+ /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */699699+ val32 = inl(SMI_EN);700700+ val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */701701+ outl(val32, SMI_EN);687702688703 /* The TCO I/O registers reside in a 32-byte range pointed to689704 by the TCOBASE value */
+3-2
fs/bio.c
···302302struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)303303{304304 struct bio *bio = NULL;305305+ void *p;305306306307 if (bs) {307307- void *p = mempool_alloc(bs->bio_pool, gfp_mask);308308+ p = mempool_alloc(bs->bio_pool, gfp_mask);308309309310 if (p)310311 bio = p + bs->front_pad;···330329 }331330 if (unlikely(!bvl)) {332331 if (bs)333333- mempool_free(bio, bs->bio_pool);332332+ mempool_free(p, bs->bio_pool);334333 else335334 kfree(bio);336335 bio = NULL;
+37-21
fs/btrfs/ctree.c
···3838static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,3939 struct btrfs_path *path, int level, int slot);40404141-inline void btrfs_init_path(struct btrfs_path *p)4242-{4343- memset(p, 0, sizeof(*p));4444-}4545-4641struct btrfs_path *btrfs_alloc_path(void)4742{4843 struct btrfs_path *path;4949- path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS);5050- if (path) {5151- btrfs_init_path(path);4444+ path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS);4545+ if (path)5246 path->reada = 1;5353- }5447 return path;5548}5649···62696370/*6471 * reset all the locked nodes in the patch to spinning locks.7272+ *7373+ * held is used to keep lockdep happy, when lockdep is enabled7474+ * we set held to a blocking lock before we go around and7575+ * retake all the spinlocks in the path. You can safely use NULL7676+ * for held6577 */6666-noinline void btrfs_clear_path_blocking(struct btrfs_path *p)7878+noinline void btrfs_clear_path_blocking(struct btrfs_path *p,7979+ struct extent_buffer *held)6780{6881 int i;6969- for (i = 0; i < BTRFS_MAX_LEVEL; i++) {8282+8383+#ifdef CONFIG_DEBUG_LOCK_ALLOC8484+ /* lockdep really cares that we take all of these spinlocks8585+ * in the right order. If any of the locks in the path are not8686+ * currently blocking, it is going to complain. So, make really8787+ * really sure by forcing the path to blocking before we clear8888+ * the path blocking.8989+ */9090+ if (held)9191+ btrfs_set_lock_blocking(held);9292+ btrfs_set_path_blocking(p);9393+#endif9494+9595+ for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) {7096 if (p->nodes[i] && p->locks[i])7197 btrfs_clear_lock_blocking(p->nodes[i]);7298 }9999+100100+#ifdef CONFIG_DEBUG_LOCK_ALLOC101101+ if (held)102102+ btrfs_clear_lock_blocking(held);103103+#endif73104}7410575106/* this also releases the path */···303286 trans->transid, level, &ins);304287 BUG_ON(ret);305288 cow = btrfs_init_new_buffer(trans, root, prealloc_dest,306306- buf->len);289289+ buf->len, level);307290 } else {308291 cow = btrfs_alloc_free_block(trans, root, buf->len,309292 parent_start,···934917935918 /* promote the child to a root */936919 child = read_node_slot(root, mid, 0);920920+ BUG_ON(!child);937921 btrfs_tree_lock(child);938922 btrfs_set_lock_blocking(child);939939- BUG_ON(!child);940923 ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0);941924 BUG_ON(ret);942925···15831566 if (!p->skip_locking)15841567 p->locks[level] = 1;1585156815861586- btrfs_clear_path_blocking(p);15691569+ btrfs_clear_path_blocking(p, NULL);1587157015881571 /*15891572 * we have a lock on b and as long as we aren't changing···1622160516231606 btrfs_set_path_blocking(p);16241607 sret = split_node(trans, root, p, level);16251625- btrfs_clear_path_blocking(p);16081608+ btrfs_clear_path_blocking(p, NULL);1626160916271610 BUG_ON(sret > 0);16281611 if (sret) {···1642162516431626 btrfs_set_path_blocking(p);16441627 sret = balance_level(trans, root, p, level);16451645- btrfs_clear_path_blocking(p);16281628+ btrfs_clear_path_blocking(p, NULL);1646162916471630 if (sret) {16481631 ret = sret;···17051688 if (!p->skip_locking) {17061689 int lret;1707169017081708- btrfs_clear_path_blocking(p);16911691+ btrfs_clear_path_blocking(p, NULL);17091692 lret = btrfs_try_spin_lock(b);1710169317111694 if (!lret) {17121695 btrfs_set_path_blocking(p);17131696 btrfs_tree_lock(b);17141714- btrfs_clear_path_blocking(p);16971697+ btrfs_clear_path_blocking(p, b);17151698 }17161699 }17171700 } else {···17231706 btrfs_set_path_blocking(p);17241707 sret = split_leaf(trans, root, key,17251708 p, ins_len, ret == 0);17261726- btrfs_clear_path_blocking(p);17091709+ btrfs_clear_path_blocking(p, NULL);1727171017281711 BUG_ON(sret > 0);17291712 if (sret) {···39433926 btrfs_release_path(root, path);39443927 goto again;39453928 } else {39463946- btrfs_clear_path_blocking(path);39473929 goto out;39483930 }39493931 }···39623946 path->locks[level - 1] = 1;39633947 path->nodes[level - 1] = cur;39643948 unlock_up(path, level, 1);39653965- btrfs_clear_path_blocking(path);39493949+ btrfs_clear_path_blocking(path, NULL);39663950 }39673951out:39683952 if (ret == 0)
···7575 struct btrfs_work work;7676};77777878+/* These are used to set the lockdep class on the extent buffer locks.7979+ * The class is set by the readpage_end_io_hook after the buffer has8080+ * passed csum validation but before the pages are unlocked.8181+ *8282+ * The lockdep class is also set by btrfs_init_new_buffer on freshly8383+ * allocated blocks.8484+ *8585+ * The class is based on the level in the tree block, which allows lockdep8686+ * to know that lower nodes nest inside the locks of higher nodes.8787+ *8888+ * We also add a check to make sure the highest level of the tree is8989+ * the same as our lockdep setup here. If BTRFS_MAX_LEVEL changes, this9090+ * code needs update as well.9191+ */9292+#ifdef CONFIG_DEBUG_LOCK_ALLOC9393+# if BTRFS_MAX_LEVEL != 89494+# error9595+# endif9696+static struct lock_class_key btrfs_eb_class[BTRFS_MAX_LEVEL + 1];9797+static const char *btrfs_eb_name[BTRFS_MAX_LEVEL + 1] = {9898+ /* leaf */9999+ "btrfs-extent-00",100100+ "btrfs-extent-01",101101+ "btrfs-extent-02",102102+ "btrfs-extent-03",103103+ "btrfs-extent-04",104104+ "btrfs-extent-05",105105+ "btrfs-extent-06",106106+ "btrfs-extent-07",107107+ /* highest possible level */108108+ "btrfs-extent-08",109109+};110110+#endif111111+78112/*79113 * extents on the btree inode are pretty simple, there's one extent80114 * that covers the entire device···381347 return ret;382348}383349350350+#ifdef CONFIG_DEBUG_LOCK_ALLOC351351+void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level)352352+{353353+ lockdep_set_class_and_name(&eb->lock,354354+ &btrfs_eb_class[level],355355+ btrfs_eb_name[level]);356356+}357357+#endif358358+384359static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,385360 struct extent_state *state)386361{···434391 goto err;435392 }436393 found_level = btrfs_header_level(eb);394394+395395+ btrfs_set_buffer_lockdep_class(eb, found_level);437396438397 ret = csum_tree_block(root, eb, 1);439398 if (ret)···18221777 ret = find_and_setup_root(tree_root, fs_info,18231778 BTRFS_DEV_TREE_OBJECTID, dev_root);18241779 dev_root->track_dirty = 1;18251825-18261780 if (ret)18271781 goto fail_extent_root;18281782
···13231323int btrfs_extent_post_op(struct btrfs_trans_handle *trans,13241324 struct btrfs_root *root)13251325{13261326- finish_current_insert(trans, root->fs_info->extent_root, 1);13271327- del_pending_extents(trans, root->fs_info->extent_root, 1);13261326+ u64 start;13271327+ u64 end;13281328+ int ret;13291329+13301330+ while(1) {13311331+ finish_current_insert(trans, root->fs_info->extent_root, 1);13321332+ del_pending_extents(trans, root->fs_info->extent_root, 1);13331333+13341334+ /* is there more work to do? */13351335+ ret = find_first_extent_bit(&root->fs_info->pending_del,13361336+ 0, &start, &end, EXTENT_WRITEBACK);13371337+ if (!ret)13381338+ continue;13391339+ ret = find_first_extent_bit(&root->fs_info->extent_ins,13401340+ 0, &start, &end, EXTENT_WRITEBACK);13411341+ if (!ret)13421342+ continue;13431343+ break;13441344+ }13281345 return 0;13291346}13301347···22282211 u64 end;22292212 u64 priv;22302213 u64 search = 0;22312231- u64 skipped = 0;22322214 struct btrfs_fs_info *info = extent_root->fs_info;22332215 struct btrfs_path *path;22342216 struct pending_extent_op *extent_op, *tmp;22352217 struct list_head insert_list, update_list;22362218 int ret;22372237- int num_inserts = 0, max_inserts;22192219+ int num_inserts = 0, max_inserts, restart = 0;2238222022392221 path = btrfs_alloc_path();22402222 INIT_LIST_HEAD(&insert_list);···22492233 ret = find_first_extent_bit(&info->extent_ins, search, &start,22502234 &end, EXTENT_WRITEBACK);22512235 if (ret) {22522252- if (skipped && all && !num_inserts &&22362236+ if (restart && !num_inserts &&22532237 list_empty(&update_list)) {22542254- skipped = 0;22382238+ restart = 0;22552239 search = 0;22562240 continue;22572241 }22582258- mutex_unlock(&info->extent_ins_mutex);22592242 break;22602243 }2261224422622245 ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS);22632246 if (!ret) {22642264- skipped = 1;22472247+ if (all)22482248+ restart = 1;22652249 search = end + 1;22662250 if (need_resched()) {22672251 mutex_unlock(&info->extent_ins_mutex);···22802264 list_add_tail(&extent_op->list, &insert_list);22812265 search = end + 1;22822266 if (num_inserts == max_inserts) {22832283- mutex_unlock(&info->extent_ins_mutex);22672267+ restart = 1;22842268 break;22852269 }22862270 } else if (extent_op->type == PENDING_BACKREF_UPDATE) {···22962280 * somebody marked this thing for deletion then just unlock it and be22972281 * done, the free_extents will handle it22982282 */22992299- mutex_lock(&info->extent_ins_mutex);23002283 list_for_each_entry_safe(extent_op, tmp, &update_list, list) {23012284 clear_extent_bits(&info->extent_ins, extent_op->bytenr,23022285 extent_op->bytenr + extent_op->num_bytes - 1,···23172302 if (!list_empty(&update_list)) {23182303 ret = update_backrefs(trans, extent_root, path, &update_list);23192304 BUG_ON(ret);23052305+23062306+ /* we may have COW'ed new blocks, so lets start over */23072307+ if (all)23082308+ restart = 1;23202309 }2321231023222311 /*···23282309 * need to make sure everything is cleaned then reset everything and23292310 * go back to the beginning23302311 */23312331- if (!num_inserts && all && skipped) {23122312+ if (!num_inserts && restart) {23322313 search = 0;23332333- skipped = 0;23142314+ restart = 0;23342315 INIT_LIST_HEAD(&update_list);23352316 INIT_LIST_HEAD(&insert_list);23362317 goto again;···23872368 BUG_ON(ret);2388236923892370 /*23902390- * if we broke out of the loop in order to insert stuff because we hit23912391- * the maximum number of inserts at a time we can handle, then loop23922392- * back and pick up where we left off23712371+ * if restart is set for whatever reason we need to go back and start23722372+ * searching through the pending list again.23732373+ *23742374+ * We just inserted some extents, which could have resulted in new23752375+ * blocks being allocated, which would result in new blocks needing23762376+ * updates, so if all is set we _must_ restart to get the updated23772377+ * blocks.23932378 */23942394- if (num_inserts == max_inserts) {23952395- INIT_LIST_HEAD(&insert_list);23962396- INIT_LIST_HEAD(&update_list);23972397- num_inserts = 0;23982398- goto again;23992399- }24002400-24012401- /*24022402- * again, if we need to make absolutely sure there are no more pending24032403- * extent operations left and we know that we skipped some, go back to24042404- * the beginning and do it all again24052405- */24062406- if (all && skipped) {23792379+ if (restart || all) {24072380 INIT_LIST_HEAD(&insert_list);24082381 INIT_LIST_HEAD(&update_list);24092382 search = 0;24102410- skipped = 0;23832383+ restart = 0;24112384 num_inserts = 0;24122385 goto again;24132386 }···27202709 goto again;27212710 }2722271127122712+ if (!err)27132713+ finish_current_insert(trans, extent_root, 0);27232714 return err;27242715}27252716···2872285928732860 if (data & BTRFS_BLOCK_GROUP_METADATA) {28742861 last_ptr = &root->fs_info->last_alloc;28752875- empty_cluster = 64 * 1024;28622862+ if (!btrfs_test_opt(root, SSD))28632863+ empty_cluster = 64 * 1024;28762864 }2877286528782866 if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD))···3416340234173403struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,34183404 struct btrfs_root *root,34193419- u64 bytenr, u32 blocksize)34053405+ u64 bytenr, u32 blocksize,34063406+ int level)34203407{34213408 struct extent_buffer *buf;34223409···34253410 if (!buf)34263411 return ERR_PTR(-ENOMEM);34273412 btrfs_set_header_generation(buf, trans->transid);34133413+ btrfs_set_buffer_lockdep_class(buf, level);34283414 btrfs_tree_lock(buf);34293415 clean_tree_block(trans, root, buf);34303416···34693453 return ERR_PTR(ret);34703454 }3471345534723472- buf = btrfs_init_new_buffer(trans, root, ins.objectid, blocksize);34563456+ buf = btrfs_init_new_buffer(trans, root, ins.objectid,34573457+ blocksize, level);34733458 return buf;34743459}34753460···56585641 prev_block = block_start;56595642 }5660564356445644+ mutex_lock(&extent_root->fs_info->trans_mutex);56615645 btrfs_record_root_in_trans(found_root);56465646+ mutex_unlock(&extent_root->fs_info->trans_mutex);56625647 if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) {56635648 /*56645649 * try to update data extent references while
···2525#include "extent_io.h"2626#include "locking.h"27272828-/*2929- * btrfs_header_level() isn't free, so don't call it when lockdep isn't3030- * on3131- */3232-#ifdef CONFIG_DEBUG_LOCK_ALLOC3333-static inline void spin_nested(struct extent_buffer *eb)3434-{3535- spin_lock_nested(&eb->lock, BTRFS_MAX_LEVEL - btrfs_header_level(eb));3636-}3737-#else3828static inline void spin_nested(struct extent_buffer *eb)3929{4030 spin_lock(&eb->lock);4131}4242-#endif43324433/*4534 * Setting a lock to blocking will drop the spinlock and set the
+4-1
fs/btrfs/super.c
···379379 btrfs_start_delalloc_inodes(root);380380 btrfs_wait_ordered_extents(root, 0);381381382382- btrfs_clean_old_snapshots(root);383382 trans = btrfs_start_transaction(root, 1);384383 ret = btrfs_commit_transaction(trans, root);385384 sb->s_dirt = 0;···509510{510511 struct btrfs_root *root = btrfs_sb(sb);511512 int ret;513513+514514+ ret = btrfs_parse_options(root, data);515515+ if (ret)516516+ return -EINVAL;512517513518 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))514519 return 0;
···28942894 free_extent_map(em);28952895 }2896289628972897- map = kzalloc(sizeof(*map), GFP_NOFS);28982898- if (!map)28992899- return -ENOMEM;29002900-29012897 em = alloc_extent_map(GFP_NOFS);29022898 if (!em)29032899 return -ENOMEM;···31023106 if (!sb)31033107 return -ENOMEM;31043108 btrfs_set_buffer_uptodate(sb);31093109+ btrfs_set_buffer_lockdep_class(sb, 0);31103110+31053111 write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);31063112 array_size = btrfs_super_sys_array_size(super_copy);31073113
+2-1
fs/buffer.c
···777777 __inc_zone_page_state(page, NR_FILE_DIRTY);778778 __inc_bdi_stat(mapping->backing_dev_info,779779 BDI_RECLAIMABLE);780780+ task_dirty_inc(current);780781 task_io_account_write(PAGE_CACHE_SIZE);781782 }782783 radix_tree_tag_set(&mapping->page_tree,···31093108 if (test_clear_buffer_dirty(bh)) {31103109 get_bh(bh);31113110 bh->b_end_io = end_buffer_write_sync;31123112- ret = submit_bh(WRITE_SYNC, bh);31113111+ ret = submit_bh(WRITE, bh);31133112 wait_on_buffer(bh);31143113 if (buffer_eopnotsupp(bh)) {31153114 clear_buffer_eopnotsupp(bh);
+2
fs/compat_ioctl.c
···19381938/* Big K */19391939COMPATIBLE_IOCTL(PIO_FONT)19401940COMPATIBLE_IOCTL(GIO_FONT)19411941+COMPATIBLE_IOCTL(PIO_CMAP)19421942+COMPATIBLE_IOCTL(GIO_CMAP)19411943ULONG_IOCTL(KDSIGACCEPT)19421944COMPATIBLE_IOCTL(KDGETKEYCODE)19431945COMPATIBLE_IOCTL(KDSETKEYCODE)
+1-1
fs/ext4/ext4.h
···868868{869869 unsigned len = le16_to_cpu(dlen);870870871871- if (len == EXT4_MAX_REC_LEN)871871+ if (len == EXT4_MAX_REC_LEN || len == 0)872872 return 1 << 16;873873 return len;874874}
+23-4
fs/ext4/inode.c
···4747static inline int ext4_begin_ordered_truncate(struct inode *inode,4848 loff_t new_size)4949{5050- return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode,5151- new_size);5050+ return jbd2_journal_begin_ordered_truncate(5151+ EXT4_SB(inode->i_sb)->s_journal,5252+ &EXT4_I(inode)->jinode,5353+ new_size);5254}53555456static void ext4_invalidatepage(struct page *page, unsigned long offset);···24392437 int no_nrwrite_index_update;24402438 int pages_written = 0;24412439 long pages_skipped;24402440+ int range_cyclic, cycled = 1, io_done = 0;24422441 int needed_blocks, ret = 0, nr_to_writebump = 0;24432442 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);24442443···24912488 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)24922489 range_whole = 1;2493249024942494- if (wbc->range_cyclic)24912491+ range_cyclic = wbc->range_cyclic;24922492+ if (wbc->range_cyclic) {24952493 index = mapping->writeback_index;24962496- else24942494+ if (index)24952495+ cycled = 0;24962496+ wbc->range_start = index << PAGE_CACHE_SHIFT;24972497+ wbc->range_end = LLONG_MAX;24982498+ wbc->range_cyclic = 0;24992499+ } else24972500 index = wbc->range_start >> PAGE_CACHE_SHIFT;2498250124992502 mpd.wbc = wbc;···25132504 wbc->no_nrwrite_index_update = 1;25142505 pages_skipped = wbc->pages_skipped;2515250625072507+retry:25162508 while (!ret && wbc->nr_to_write > 0) {2517250925182510 /*···25562546 pages_written += mpd.pages_written;25572547 wbc->pages_skipped = pages_skipped;25582548 ret = 0;25492549+ io_done = 1;25592550 } else if (wbc->nr_to_write)25602551 /*25612552 * There is no more writeout needed···25652554 */25662555 break;25672556 }25572557+ if (!io_done && !cycled) {25582558+ cycled = 1;25592559+ index = 0;25602560+ wbc->range_start = index << PAGE_CACHE_SHIFT;25612561+ wbc->range_end = mapping->writeback_index - 1;25622562+ goto retry;25632563+ }25682564 if (pages_skipped != wbc->pages_skipped)25692565 printk(KERN_EMERG "This should not happen leaving %s "25702566 "with nr_to_write = %ld ret = %d\n",···2579256125802562 /* Update index */25812563 index += pages_written;25642564+ wbc->range_cyclic = range_cyclic;25822565 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))25832566 /*25842567 * set the writeback_index so that range_cyclic
+19-13
fs/ext4/mballoc.c
···36933693 pa->pa_free = pa->pa_len;36943694 atomic_set(&pa->pa_count, 1);36953695 spin_lock_init(&pa->pa_lock);36963696+ INIT_LIST_HEAD(&pa->pa_inode_list);36973697+ INIT_LIST_HEAD(&pa->pa_group_list);36963698 pa->pa_deleted = 0;36973699 pa->pa_linear = 0;36983700···37573755 atomic_set(&pa->pa_count, 1);37583756 spin_lock_init(&pa->pa_lock);37593757 INIT_LIST_HEAD(&pa->pa_inode_list);37583758+ INIT_LIST_HEAD(&pa->pa_group_list);37603759 pa->pa_deleted = 0;37613760 pa->pa_linear = 1;37623761···44794476 pa->pa_free -= ac->ac_b_ex.fe_len;44804477 pa->pa_len -= ac->ac_b_ex.fe_len;44814478 spin_unlock(&pa->pa_lock);44824482- /*44834483- * We want to add the pa to the right bucket.44844484- * Remove it from the list and while adding44854485- * make sure the list to which we are adding44864486- * doesn't grow big.44874487- */44884488- if (likely(pa->pa_free)) {44894489- spin_lock(pa->pa_obj_lock);44904490- list_del_rcu(&pa->pa_inode_list);44914491- spin_unlock(pa->pa_obj_lock);44924492- ext4_mb_add_n_trim(ac);44934493- }44944479 }44954495- ext4_mb_put_pa(ac, ac->ac_sb, pa);44964480 }44974481 if (ac->alloc_semp)44984482 up_read(ac->alloc_semp);44834483+ if (pa) {44844484+ /*44854485+ * We want to add the pa to the right bucket.44864486+ * Remove it from the list and while adding44874487+ * make sure the list to which we are adding44884488+ * doesn't grow big. We need to release44894489+ * alloc_semp before calling ext4_mb_add_n_trim()44904490+ */44914491+ if (pa->pa_linear && likely(pa->pa_free)) {44924492+ spin_lock(pa->pa_obj_lock);44934493+ list_del_rcu(&pa->pa_inode_list);44944494+ spin_unlock(pa->pa_obj_lock);44954495+ ext4_mb_add_n_trim(ac);44964496+ }44974497+ ext4_mb_put_pa(ac, ac->ac_sb, pa);44984498+ }44994499 if (ac->ac_bitmap_page)45004500 page_cache_release(ac->ac_bitmap_page);45014501 if (ac->ac_buddy_page)
···30463046static int ext4_sync_fs(struct super_block *sb, int wait)30473047{30483048 int ret = 0;30493049+ tid_t target;3049305030503051 trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);30513052 sb->s_dirt = 0;30523053 if (EXT4_SB(sb)->s_journal) {30533053- if (wait)30543054- ret = ext4_force_commit(sb);30553055- else30563056- jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL);30543054+ if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal,30553055+ &target)) {30563056+ if (wait)30573057+ jbd2_log_wait_commit(EXT4_SB(sb)->s_journal,30583058+ target);30593059+ }30573060 } else {30583061 ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait);30593062 }
+11-6
fs/jbd2/journal.c
···450450}451451452452/*453453- * Called under j_state_lock. Returns true if a transaction was started.453453+ * Called under j_state_lock. Returns true if a transaction commit was started.454454 */455455int __jbd2_log_start_commit(journal_t *journal, tid_t target)456456{···518518519519/*520520 * Start a commit of the current running transaction (if any). Returns true521521- * if a transaction was started, and fills its tid in at *ptid521521+ * if a transaction is going to be committed (or is currently already522522+ * committing), and fills its tid in at *ptid522523 */523524int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)524525{···529528 if (journal->j_running_transaction) {530529 tid_t tid = journal->j_running_transaction->t_tid;531530532532- ret = __jbd2_log_start_commit(journal, tid);533533- if (ret && ptid)531531+ __jbd2_log_start_commit(journal, tid);532532+ /* There's a running transaction and we've just made sure533533+ * it's commit has been scheduled. */534534+ if (ptid)534535 *ptid = tid;535535- } else if (journal->j_committing_transaction && ptid) {536536+ ret = 1;537537+ } else if (journal->j_committing_transaction) {536538 /*537539 * If ext3_write_super() recently started a commit, then we538540 * have to wait for completion of that transaction539541 */540540- *ptid = journal->j_committing_transaction->t_tid;542542+ if (ptid)543543+ *ptid = journal->j_committing_transaction->t_tid;541544 ret = 1;542545 }543546 spin_unlock(&journal->j_state_lock);
+31-11
fs/jbd2/transaction.c
···21292129}2130213021312131/*21322132- * This function must be called when inode is journaled in ordered mode21332133- * before truncation happens. It starts writeout of truncated part in21342134- * case it is in the committing transaction so that we stand to ordered21352135- * mode consistency guarantees.21322132+ * File truncate and transaction commit interact with each other in a21332133+ * non-trivial way. If a transaction writing data block A is21342134+ * committing, we cannot discard the data by truncate until we have21352135+ * written them. Otherwise if we crashed after the transaction with21362136+ * write has committed but before the transaction with truncate has21372137+ * committed, we could see stale data in block A. This function is a21382138+ * helper to solve this problem. It starts writeout of the truncated21392139+ * part in case it is in the committing transaction.21402140+ *21412141+ * Filesystem code must call this function when inode is journaled in21422142+ * ordered mode before truncation happens and after the inode has been21432143+ * placed on orphan list with the new inode size. The second condition21442144+ * avoids the race that someone writes new data and we start21452145+ * committing the transaction after this function has been called but21462146+ * before a transaction for truncate is started (and furthermore it21472147+ * allows us to optimize the case where the addition to orphan list21482148+ * happens in the same transaction as write --- we don't have to write21492149+ * any data in such case).21362150 */21372137-int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode,21512151+int jbd2_journal_begin_ordered_truncate(journal_t *journal,21522152+ struct jbd2_inode *jinode,21382153 loff_t new_size)21392154{21402140- journal_t *journal;21412141- transaction_t *commit_trans;21552155+ transaction_t *inode_trans, *commit_trans;21422156 int ret = 0;2143215721442144- if (!inode->i_transaction && !inode->i_next_transaction)21582158+ /* This is a quick check to avoid locking if not necessary */21592159+ if (!jinode->i_transaction)21452160 goto out;21462146- journal = inode->i_transaction->t_journal;21612161+ /* Locks are here just to force reading of recent values, it is21622162+ * enough that the transaction was not committing before we started21632163+ * a transaction adding the inode to orphan list */21472164 spin_lock(&journal->j_state_lock);21482165 commit_trans = journal->j_committing_transaction;21492166 spin_unlock(&journal->j_state_lock);21502150- if (inode->i_transaction == commit_trans) {21512151- ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping,21672167+ spin_lock(&journal->j_list_lock);21682168+ inode_trans = jinode->i_transaction;21692169+ spin_unlock(&journal->j_list_lock);21702170+ if (inode_trans == commit_trans) {21712171+ ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping,21522172 new_size, LLONG_MAX);21532173 if (ret)21542174 jbd2_journal_abort(journal, ret);
···156156 int ret;157157158158 do {159159- if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL)))159159+ if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS)))160160 return -ENOSPC;161161 ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd);162162 } while (ret == -EAGAIN);
···4848 */4949 file->f_version = 0;50505151- /* SEQ files support lseek, but not pread/pwrite */5252- file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);5151+ /*5252+ * seq_files support lseek() and pread(). They do not implement5353+ * write() at all, but we clear FMODE_PWRITE here for historical5454+ * reasons.5555+ *5656+ * If a client of seq_files a) implements file.write() and b) wishes to5757+ * support pwrite() then that client will need to implement its own5858+ * file.open() which calls seq_open() and then sets FMODE_PWRITE.5959+ */6060+ file->f_mode &= ~FMODE_PWRITE;5361 return 0;5462}5563EXPORT_SYMBOL(seq_open);···139131 int err = 0;140132141133 mutex_lock(&m->lock);134134+135135+ /* Don't assume *ppos is where we left it */136136+ if (unlikely(*ppos != m->read_pos)) {137137+ m->read_pos = *ppos;138138+ while ((err = traverse(m, *ppos)) == -EAGAIN)139139+ ;140140+ if (err) {141141+ /* With prejudice... */142142+ m->read_pos = 0;143143+ m->version = 0;144144+ m->index = 0;145145+ m->count = 0;146146+ goto Done;147147+ }148148+ }149149+142150 /*143151 * seq_file->op->..m_start/m_stop/m_next may do special actions144152 * or optimisations based on the file->f_version, so we want to···254230Done:255231 if (!copied)256232 copied = err;257257- else233233+ else {258234 *ppos += copied;235235+ m->read_pos += copied;236236+ }259237 file->f_version = m->version;260238 mutex_unlock(&m->lock);261239 return copied;···292266 if (offset < 0)293267 break;294268 retval = offset;295295- if (offset != file->f_pos) {269269+ if (offset != m->read_pos) {296270 while ((retval=traverse(m, offset)) == -EAGAIN)297271 ;298272 if (retval) {299273 /* with extreme prejudice... */300274 file->f_pos = 0;275275+ m->read_pos = 0;301276 m->version = 0;302277 m->index = 0;303278 m->count = 0;304279 } else {280280+ m->read_pos = offset;305281 retval = file->f_pos = offset;306282 }307283 }
+16-1
fs/super.c
···8282 * lock ordering than usbfs:8383 */8484 lockdep_set_class(&s->s_lock, &type->s_lock_key);8585- down_write(&s->s_umount);8585+ /*8686+ * sget() can have s_umount recursion.8787+ *8888+ * When it cannot find a suitable sb, it allocates a new8989+ * one (this one), and tries again to find a suitable old9090+ * one.9191+ *9292+ * In case that succeeds, it will acquire the s_umount9393+ * lock of the old one. Since these are clearly distrinct9494+ * locks, and this object isn't exposed yet, there's no9595+ * risk of deadlocks.9696+ *9797+ * Annotate this by putting this lock in a different9898+ * subclass.9999+ */100100+ down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING);86101 s->s_count = S_BIAS;87102 atomic_set(&s->s_active, 1);88103 mutex_init(&s->s_vfs_rename_mutex);
···121121 * @local: per-cpu pointer to a struct dma_chan_percpu122122 * @client-count: how many clients are using this channel123123 * @table_count: number of appearances in the mem-to-mem allocation table124124+ * @private: private data for certain client-channel associations124125 */125126struct dma_chan {126127 struct dma_device *device;···135134 struct dma_chan_percpu *local;136135 int client_count;137136 int table_count;137137+ void *private;138138};139139140140/**
+1-1
include/linux/firmware-map.h
···11/*22 * include/linux/firmware-map.h:33 * Copyright (C) 2008 SUSE LINUX Products GmbH44- * by Bernhard Walle <bwalle@suse.de>44+ * by Bernhard Walle <bernhard.walle@gmx.de>55 *66 * This program is free software; you can redistribute it and/or modify77 * it under the terms of the GNU General Public License v2.0 as published by
+15-9
include/linux/fs.h
···5454#define MAY_ACCESS 165555#define MAY_OPEN 3256565757+/*5858+ * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond5959+ * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()6060+ */6161+5762/* file is open for reading */5863#define FMODE_READ ((__force fmode_t)1)5964/* file is open for writing */6065#define FMODE_WRITE ((__force fmode_t)2)6166/* file is seekable */6267#define FMODE_LSEEK ((__force fmode_t)4)6363-/* file can be accessed using pread/pwrite */6868+/* file can be accessed using pread */6469#define FMODE_PREAD ((__force fmode_t)8)6565-#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */7070+/* file can be accessed using pwrite */7171+#define FMODE_PWRITE ((__force fmode_t)16)6672/* File is opened for execution with sys_execve / sys_uselib */6767-#define FMODE_EXEC ((__force fmode_t)16)7373+#define FMODE_EXEC ((__force fmode_t)32)6874/* File is opened with O_NDELAY (only set for block devices) */6969-#define FMODE_NDELAY ((__force fmode_t)32)7575+#define FMODE_NDELAY ((__force fmode_t)64)7076/* File is opened with O_EXCL (only set for block devices) */7171-#define FMODE_EXCL ((__force fmode_t)64)7777+#define FMODE_EXCL ((__force fmode_t)128)7278/* File is opened using open(.., 3, ..) and is writeable only for ioctls7379 (specialy hack for floppy.c) */7474-#define FMODE_WRITE_IOCTL ((__force fmode_t)128)8080+#define FMODE_WRITE_IOCTL ((__force fmode_t)256)75817682/*7783 * Don't update ctime and mtime.···9387#define WRITE 19488#define READA 2 /* read-ahead - don't block if no resources */9589#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */9696-#define READ_SYNC (READ | (1 << BIO_RW_SYNC))9090+#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))9791#define READ_META (READ | (1 << BIO_RW_META))9898-#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))9999-#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))9292+#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))9393+#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))10094#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))10195#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)10296#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
+2-1
include/linux/jbd2.h
···11501150extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);11511151extern int jbd2_journal_force_commit(journal_t *);11521152extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);11531153-extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);11531153+extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,11541154+ struct jbd2_inode *inode, loff_t new_size);11541155extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);11551156extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);11561157
···1111/* For O_CLOEXEC and O_NONBLOCK */1212#include <linux/fcntl.h>13131414-/* Flags for timerfd_settime. */1414+/*1515+ * CAREFUL: Check include/asm-generic/fcntl.h when defining1616+ * new flags, since they might collide with O_* ones. We want1717+ * to re-use O_* flags that couldn't possibly have a meaning1818+ * from eventfd, in order to leave a free define-space for1919+ * shared O_* flags.2020+ */1521#define TFD_TIMER_ABSTIME (1 << 0)1616-1717-/* Flags for timerfd_create. */1822#define TFD_CLOEXEC O_CLOEXEC1923#define TFD_NONBLOCK O_NONBLOCK20242525+#define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK)2626+/* Flags for timerfd_create. */2727+#define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS2828+/* Flags for timerfd_settime. */2929+#define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME21302231#endif /* _LINUX_TIMERFD_H */2323-
+4
include/linux/vmalloc.h
···8484 unsigned long flags, void *caller);8585extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,8686 unsigned long start, unsigned long end);8787+extern struct vm_struct *__get_vm_area_caller(unsigned long size,8888+ unsigned long flags,8989+ unsigned long start, unsigned long end,9090+ void *caller);8791extern struct vm_struct *get_vm_area_node(unsigned long size,8892 unsigned long flags, int node,8993 gfp_t gfp_mask);
···11651165 u32 val, ktime_t *abs_time, u32 bitset, int clockrt)11661166{11671167 struct task_struct *curr = current;11681168+ struct restart_block *restart;11681169 DECLARE_WAITQUEUE(wait, curr);11691170 struct futex_hash_bucket *hb;11701171 struct futex_q q;···1217121612181217 if (!ret)12191218 goto retry;12201220- return ret;12191219+ goto out;12211220 }12221221 ret = -EWOULDBLOCK;12231223- if (uval != val)12241224- goto out_unlock_put_key;12221222+ if (unlikely(uval != val)) {12231223+ queue_unlock(&q, hb);12241224+ goto out_put_key;12251225+ }1225122612261227 /* Only actually queue if *uaddr contained val. */12271228 queue_me(&q, hb);···12871284 */1288128512891286 /* If we were woken (and unqueued), we succeeded, whatever. */12871287+ ret = 0;12901288 if (!unqueue_me(&q))12911291- return 0;12891289+ goto out_put_key;12901290+ ret = -ETIMEDOUT;12921291 if (rem)12931293- return -ETIMEDOUT;12921292+ goto out_put_key;1294129312951294 /*12961295 * We expect signal_pending(current), but another thread may12971296 * have handled it for us already.12981297 */12981298+ ret = -ERESTARTSYS;12991299 if (!abs_time)13001300- return -ERESTARTSYS;13011301- else {13021302- struct restart_block *restart;13031303- restart = ¤t_thread_info()->restart_block;13041304- restart->fn = futex_wait_restart;13051305- restart->futex.uaddr = (u32 *)uaddr;13061306- restart->futex.val = val;13071307- restart->futex.time = abs_time->tv64;13081308- restart->futex.bitset = bitset;13091309- restart->futex.flags = 0;13001300+ goto out_put_key;1310130113111311- if (fshared)13121312- restart->futex.flags |= FLAGS_SHARED;13131313- if (clockrt)13141314- restart->futex.flags |= FLAGS_CLOCKRT;13151315- return -ERESTART_RESTARTBLOCK;13161316- }13021302+ restart = ¤t_thread_info()->restart_block;13031303+ restart->fn = futex_wait_restart;13041304+ restart->futex.uaddr = (u32 *)uaddr;13051305+ restart->futex.val = val;13061306+ restart->futex.time = abs_time->tv64;13071307+ restart->futex.bitset = bitset;13081308+ restart->futex.flags = 0;1317130913181318-out_unlock_put_key:13191319- queue_unlock(&q, hb);13101310+ if (fshared)13111311+ restart->futex.flags |= FLAGS_SHARED;13121312+ if (clockrt)13131313+ restart->futex.flags |= FLAGS_CLOCKRT;13141314+13151315+ ret = -ERESTART_RESTARTBLOCK;13161316+13171317+out_put_key:13201318 put_futex_key(fshared, &q.key);13211321-13221319out:13231320 return ret;13241321}
+30-30
kernel/posix-cpu-timers.c
···681681}682682683683/*684684+ * Sample a process (thread group) timer for the given group_leader task.685685+ * Must be called with tasklist_lock held for reading.686686+ */687687+static int cpu_timer_sample_group(const clockid_t which_clock,688688+ struct task_struct *p,689689+ union cpu_time_count *cpu)690690+{691691+ struct task_cputime cputime;692692+693693+ thread_group_cputimer(p, &cputime);694694+ switch (CPUCLOCK_WHICH(which_clock)) {695695+ default:696696+ return -EINVAL;697697+ case CPUCLOCK_PROF:698698+ cpu->cpu = cputime_add(cputime.utime, cputime.stime);699699+ break;700700+ case CPUCLOCK_VIRT:701701+ cpu->cpu = cputime.utime;702702+ break;703703+ case CPUCLOCK_SCHED:704704+ cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p);705705+ break;706706+ }707707+ return 0;708708+}709709+710710+/*684711 * Guts of sys_timer_settime for CPU timers.685712 * This is called with the timer locked and interrupts disabled.686713 * If we return TIMER_RETRY, it's necessary to release the timer's lock···768741 if (CPUCLOCK_PERTHREAD(timer->it_clock)) {769742 cpu_clock_sample(timer->it_clock, p, &val);770743 } else {771771- cpu_clock_sample_group(timer->it_clock, p, &val);744744+ cpu_timer_sample_group(timer->it_clock, p, &val);772745 }773746774747 if (old) {···916889 read_unlock(&tasklist_lock);917890 goto dead;918891 } else {919919- cpu_clock_sample_group(timer->it_clock, p, &now);892892+ cpu_timer_sample_group(timer->it_clock, p, &now);920893 clear_dead = (unlikely(p->exit_state) &&921894 thread_group_empty(p));922895 }···12711244 clear_dead_task(timer, now);12721245 goto out_unlock;12731246 }12741274- cpu_clock_sample_group(timer->it_clock, p, &now);12471247+ cpu_timer_sample_group(timer->it_clock, p, &now);12751248 bump_cpu_timer(timer, now);12761249 /* Leave the tasklist_lock locked for the call below. */12771250 }···14331406 }14341407 spin_unlock(&timer->it_lock);14351408 }14361436-}14371437-14381438-/*14391439- * Sample a process (thread group) timer for the given group_leader task.14401440- * Must be called with tasklist_lock held for reading.14411441- */14421442-static int cpu_timer_sample_group(const clockid_t which_clock,14431443- struct task_struct *p,14441444- union cpu_time_count *cpu)14451445-{14461446- struct task_cputime cputime;14471447-14481448- thread_group_cputimer(p, &cputime);14491449- switch (CPUCLOCK_WHICH(which_clock)) {14501450- default:14511451- return -EINVAL;14521452- case CPUCLOCK_PROF:14531453- cpu->cpu = cputime_add(cputime.utime, cputime.stime);14541454- break;14551455- case CPUCLOCK_VIRT:14561456- cpu->cpu = cputime.utime;14571457- break;14581458- case CPUCLOCK_SCHED:14591459- cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p);14601460- break;14611461- }14621462- return 0;14631409}1464141014651411/*
···6060static int submit(int rw, pgoff_t page_off, struct page *page,6161 struct bio **bio_chain)6262{6363+ const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);6364 struct bio *bio;64656566 bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1);···8180 bio_get(bio);82818382 if (bio_chain == NULL) {8484- submit_bio(rw | (1 << BIO_RW_SYNC), bio);8383+ submit_bio(bio_rw, bio);8584 wait_on_page_locked(page);8685 if (rw == READ)8786 bio_set_pages_dirty(bio);···9190 get_page(page); /* These pages are freed later */9291 bio->bi_private = *bio_chain;9392 *bio_chain = bio;9494- submit_bio(rw | (1 << BIO_RW_SYNC), bio);9393+ submit_bio(bio_rw, bio);9594 }9695 return 0;9796}
+12-3
kernel/sched.c
···6944694469456945static void rq_attach_root(struct rq *rq, struct root_domain *rd)69466946{69476947+ struct root_domain *old_rd = NULL;69476948 unsigned long flags;6948694969496950 spin_lock_irqsave(&rq->lock, flags);6950695169516952 if (rq->rd) {69526952- struct root_domain *old_rd = rq->rd;69536953+ old_rd = rq->rd;6953695469546955 if (cpumask_test_cpu(rq->cpu, old_rd->online))69556956 set_rq_offline(rq);6956695769576958 cpumask_clear_cpu(rq->cpu, old_rd->span);6958695969596959- if (atomic_dec_and_test(&old_rd->refcount))69606960- free_rootdomain(old_rd);69606960+ /*69616961+ * If we dont want to free the old_rt yet then69626962+ * set old_rd to NULL to skip the freeing later69636963+ * in this function:69646964+ */69656965+ if (!atomic_dec_and_test(&old_rd->refcount))69666966+ old_rd = NULL;69616967 }6962696869636969 atomic_inc(&rd->refcount);···69746968 set_rq_online(rq);6975696969766970 spin_unlock_irqrestore(&rq->lock, flags);69716971+69726972+ if (old_rd)69736973+ free_rootdomain(old_rd);69776974}6978697569796976static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
+1-1
kernel/trace/blktrace.c
···176176177177 what |= ddir_act[rw & WRITE];178178 what |= MASK_TC_BIT(rw, BARRIER);179179- what |= MASK_TC_BIT(rw, SYNC);179179+ what |= MASK_TC_BIT(rw, SYNCIO);180180 what |= MASK_TC_BIT(rw, AHEAD);181181 what |= MASK_TC_BIT(rw, META);182182 what |= MASK_TC_BIT(rw, DISCARD);
···240240}241241EXPORT_SYMBOL_GPL(bdi_writeout_inc);242242243243-static inline void task_dirty_inc(struct task_struct *tsk)243243+void task_dirty_inc(struct task_struct *tsk)244244{245245 prop_inc_single(&vm_dirties, &tsk->dirties);246246}···12301230 __inc_zone_page_state(page, NR_FILE_DIRTY);12311231 __inc_bdi_stat(mapping->backing_dev_info,12321232 BDI_RECLAIMABLE);12331233+ task_dirty_inc(current);12331234 task_io_account_write(PAGE_CACHE_SIZE);12341235 }12351236 radix_tree_tag_set(&mapping->page_tree,···12631262 * If the mapping doesn't provide a set_page_dirty a_op, then12641263 * just fall through and assume that it wants buffer_heads.12651264 */12661266-static int __set_page_dirty(struct page *page)12651265+int set_page_dirty(struct page *page)12671266{12681267 struct address_space *mapping = page_mapping(page);12691268···12801279 return 1;12811280 }12821281 return 0;12831283-}12841284-12851285-int set_page_dirty(struct page *page)12861286-{12871287- int ret = __set_page_dirty(page);12881288- if (ret)12891289- task_dirty_inc(current);12901290- return ret;12911282}12921283EXPORT_SYMBOL(set_page_dirty);12931284
+26-3
mm/page_alloc.c
···29892989 * was used and there are no special requirements, this is a convenient29902990 * alternative29912991 */29922992-int __meminit early_pfn_to_nid(unsigned long pfn)29922992+int __meminit __early_pfn_to_nid(unsigned long pfn)29932993{29942994 int i;29952995···30003000 if (start_pfn <= pfn && pfn < end_pfn)30013001 return early_node_map[i].nid;30023002 }30033003-30043004- return 0;30033003+ /* This is a memory hole */30043004+ return -1;30053005}30063006#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */30073007+30083008+int __meminit early_pfn_to_nid(unsigned long pfn)30093009+{30103010+ int nid;30113011+30123012+ nid = __early_pfn_to_nid(pfn);30133013+ if (nid >= 0)30143014+ return nid;30153015+ /* just returns 0 */30163016+ return 0;30173017+}30183018+30193019+#ifdef CONFIG_NODES_SPAN_OTHER_NODES30203020+bool __meminit early_pfn_in_nid(unsigned long pfn, int node)30213021+{30223022+ int nid;30233023+30243024+ nid = __early_pfn_to_nid(pfn);30253025+ if (nid >= 0 && nid != node)30263026+ return false;30273027+ return true;30283028+}30293029+#endif3007303030083031/* Basic iterator support to walk early_node_map[] */30093032#define for_each_active_range_index_in_nid(i, nid) \
···11061106}11071107EXPORT_SYMBOL_GPL(__get_vm_area);1108110811091109+struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags,11101110+ unsigned long start, unsigned long end,11111111+ void *caller)11121112+{11131113+ return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL,11141114+ caller);11151115+}11161116+11091117/**11101118 * get_vm_area - reserve a contiguous kernel virtual area11111119 * @size: size of the area
+2-2
scripts/bootgraph.pl
···51515252while (<>) {5353 my $line = $_;5454- if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) {5454+ if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) {5555 my $func = $2;5656 if ($done == 0) {5757 $start{$func} = $1;···8787 $count = $count + 1;8888 }89899090- if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) {9090+ if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_\.]+)\+.*returned/) {9191 if ($done == 0) {9292 $end{$2} = $1;9393 $maxtime = $1;
+158-13
scripts/markup_oops.pl
···11-#!/usr/bin/perl -w11+#!/usr/bin/perl2233use File::Basename;44···2929my $target = "0";3030my $function;3131my $module = "";3232-my $func_offset;3232+my $func_offset = 0;3333my $vmaoffset = 0;34343535+my %regs;3636+3737+3838+sub parse_x86_regs3939+{4040+ my ($line) = @_;4141+ if ($line =~ /EAX: ([0-9a-f]+) EBX: ([0-9a-f]+) ECX: ([0-9a-f]+) EDX: ([0-9a-f]+)/) {4242+ $regs{"%eax"} = $1;4343+ $regs{"%ebx"} = $2;4444+ $regs{"%ecx"} = $3;4545+ $regs{"%edx"} = $4;4646+ }4747+ if ($line =~ /ESI: ([0-9a-f]+) EDI: ([0-9a-f]+) EBP: ([0-9a-f]+) ESP: ([0-9a-f]+)/) {4848+ $regs{"%esi"} = $1;4949+ $regs{"%edi"} = $2;5050+ $regs{"%esp"} = $4;5151+ }5252+ if ($line =~ /RAX: ([0-9a-f]+) RBX: ([0-9a-f]+) RCX: ([0-9a-f]+)/) {5353+ $regs{"%eax"} = $1;5454+ $regs{"%ebx"} = $2;5555+ $regs{"%ecx"} = $3;5656+ }5757+ if ($line =~ /RDX: ([0-9a-f]+) RSI: ([0-9a-f]+) RDI: ([0-9a-f]+)/) {5858+ $regs{"%edx"} = $1;5959+ $regs{"%esi"} = $2;6060+ $regs{"%edi"} = $3;6161+ }6262+ if ($line =~ /RBP: ([0-9a-f]+) R08: ([0-9a-f]+) R09: ([0-9a-f]+)/) {6363+ $regs{"%r08"} = $2;6464+ $regs{"%r09"} = $3;6565+ }6666+ if ($line =~ /R10: ([0-9a-f]+) R11: ([0-9a-f]+) R12: ([0-9a-f]+)/) {6767+ $regs{"%r10"} = $1;6868+ $regs{"%r11"} = $2;6969+ $regs{"%r12"} = $3;7070+ }7171+ if ($line =~ /R13: ([0-9a-f]+) R14: ([0-9a-f]+) R15: ([0-9a-f]+)/) {7272+ $regs{"%r13"} = $1;7373+ $regs{"%r14"} = $2;7474+ $regs{"%r15"} = $3;7575+ }7676+}7777+7878+sub reg_name7979+{8080+ my ($reg) = @_;8181+ $reg =~ s/r(.)x/e\1x/;8282+ $reg =~ s/r(.)i/e\1i/;8383+ $reg =~ s/r(.)p/e\1p/;8484+ return $reg;8585+}8686+8787+sub process_x86_regs8888+{8989+ my ($line, $cntr) = @_;9090+ my $str = "";9191+ if (length($line) < 40) {9292+ return ""; # not an asm istruction9393+ }9494+9595+ # find the arguments to the instruction9696+ if ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/) {9797+ $lastword = $1;9898+ } else {9999+ return "";100100+ }101101+102102+ # we need to find the registers that get clobbered,103103+ # since their value is no longer relevant for previous104104+ # instructions in the stream.105105+106106+ $clobber = $lastword;107107+ # first, remove all memory operands, they're read only108108+ $clobber =~ s/\([a-z0-9\%\,]+\)//g;109109+ # then, remove everything before the comma, thats the read part110110+ $clobber =~ s/.*\,//g;111111+112112+ # if this is the instruction that faulted, we haven't actually done113113+ # the write yet... nothing is clobbered.114114+ if ($cntr == 0) {115115+ $clobber = "";116116+ }117117+118118+ foreach $reg (keys(%regs)) {119119+ my $clobberprime = reg_name($clobber);120120+ my $lastwordprime = reg_name($lastword);121121+ my $val = $regs{$reg};122122+ if ($val =~ /^[0]+$/) {123123+ $val = "0";124124+ } else {125125+ $val =~ s/^0*//;126126+ }127127+128128+ # first check if we're clobbering this register; if we do129129+ # we print it with a =>, and then delete its value130130+ if ($clobber =~ /$reg/ || $clobberprime =~ /$reg/) {131131+ if (length($val) > 0) {132132+ $str = $str . " $reg => $val ";133133+ }134134+ $regs{$reg} = "";135135+ $val = "";136136+ }137137+ # now check if we're reading this register138138+ if ($lastword =~ /$reg/ || $lastwordprime =~ /$reg/) {139139+ if (length($val) > 0) {140140+ $str = $str . " $reg = $val ";141141+ }142142+ }143143+ }144144+ return $str;145145+}146146+147147+# parse the oops35148while (<STDIN>) {36149 my $line = $_;37150 if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) {38151 $target = $1;39152 }153153+ if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) {154154+ $target = $1;155155+ }40156 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {157157+ $function = $1;158158+ $func_offset = $2;159159+ }160160+ if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {41161 $function = $1;42162 $func_offset = $2;43163 }···16646 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {16747 $module = $3;16848 }4949+ if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {5050+ $module = $3;5151+ }5252+ parse_x86_regs($line);16953}1705417155my $decodestart = hex($target) - hex($func_offset);172172-my $decodestop = $decodestart + 8192;5656+my $decodestop = hex($target) + 8192;17357if ($target eq "0") {17458 print "No oops found!\n";17559 print "Usage: \n";···20884my $state = 0;20985my $center = 0;21086my @lines;8787+my @reglines;2118821289sub InRange {21390 my ($address, $target) = @_;···313188314189my $i;315190316316-my $fulltext = "";317317-$i = $start;318318-while ($i < $finish) {319319- if ($i == $center) {320320- $fulltext = $fulltext . "*$lines[$i] <----- faulting instruction\n";321321- } else {322322- $fulltext = $fulltext . " $lines[$i]\n";323323- }324324- $i = $i +1;191191+192192+# start annotating the registers in the asm.193193+# this goes from the oopsing point back, so that the annotator194194+# can track (opportunistically) which registers got written and195195+# whos value no longer is relevant.196196+197197+$i = $center;198198+while ($i >= $start) {199199+ $reglines[$i] = process_x86_regs($lines[$i], $center - $i);200200+ $i = $i - 1;325201}326202327327-print $fulltext;203203+$i = $start;204204+while ($i < $finish) {205205+ my $line;206206+ if ($i == $center) {207207+ $line = "*$lines[$i] ";208208+ } else {209209+ $line = " $lines[$i] ";210210+ }211211+ print $line;212212+ if (defined($reglines[$i]) && length($reglines[$i]) > 0) {213213+ my $c = 60 - length($line);214214+ while ($c > 0) { print " "; $c = $c - 1; };215215+ print "| $reglines[$i]";216216+ }217217+ if ($i == $center) {218218+ print "<--- faulting instruction";219219+ }220220+ print "\n";221221+ $i = $i +1;222222+}328223
···7373{7474 int i, r = 0;75757676- down_read(&kvm->slots_lock);7776 for (i = 0; i < kvm->nmemslots; i++) {7877 r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn,7978 kvm->memslots[i].npages);8079 if (r)8180 break;8281 }8383- up_read(&kvm->slots_lock);8282+8483 return r;8584}8685···189190static int kvm_iommu_unmap_memslots(struct kvm *kvm)190191{191192 int i;192192- down_read(&kvm->slots_lock);193193+193194 for (i = 0; i < kvm->nmemslots; i++) {194195 kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn,195196 kvm->memslots[i].npages);196197 }197197- up_read(&kvm->slots_lock);198198199199 return 0;200200}
+33-10
virt/kvm/kvm_main.c
···173173 assigned_dev->host_irq_disabled = false;174174 }175175 mutex_unlock(&assigned_dev->kvm->lock);176176- kvm_put_kvm(assigned_dev->kvm);177176}178177179178static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id)180179{181180 struct kvm_assigned_dev_kernel *assigned_dev =182181 (struct kvm_assigned_dev_kernel *) dev_id;183183-184184- kvm_get_kvm(assigned_dev->kvm);185182186183 schedule_work(&assigned_dev->interrupt_work);187184···210213 }211214}212215216216+/* The function implicit hold kvm->lock mutex due to cancel_work_sync() */213217static void kvm_free_assigned_irq(struct kvm *kvm,214218 struct kvm_assigned_dev_kernel *assigned_dev)215219{···226228 if (!assigned_dev->irq_requested_type)227229 return;228230229229- if (cancel_work_sync(&assigned_dev->interrupt_work))230230- /* We had pending work. That means we will have to take231231- * care of kvm_put_kvm.232232- */233233- kvm_put_kvm(kvm);231231+ /*232232+ * In kvm_free_device_irq, cancel_work_sync return true if:233233+ * 1. work is scheduled, and then cancelled.234234+ * 2. work callback is executed.235235+ *236236+ * The first one ensured that the irq is disabled and no more events237237+ * would happen. But for the second one, the irq may be enabled (e.g.238238+ * for MSI). So we disable irq here to prevent further events.239239+ *240240+ * Notice this maybe result in nested disable if the interrupt type is241241+ * INTx, but it's OK for we are going to free it.242242+ *243243+ * If this function is a part of VM destroy, please ensure that till244244+ * now, the kvm state is still legal for probably we also have to wait245245+ * interrupt_work done.246246+ */247247+ disable_irq_nosync(assigned_dev->host_irq);248248+ cancel_work_sync(&assigned_dev->interrupt_work);234249235250 free_irq(assigned_dev->host_irq, (void *)assigned_dev);236251···296285297286 if (irqchip_in_kernel(kvm)) {298287 if (!msi2intx &&299299- adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI) {300300- free_irq(adev->host_irq, (void *)kvm);288288+ (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI)) {289289+ free_irq(adev->host_irq, (void *)adev);301290 pci_disable_msi(adev->dev);302291 }303292···466455 struct kvm_assigned_dev_kernel *match;467456 struct pci_dev *dev;468457458458+ down_read(&kvm->slots_lock);469459 mutex_lock(&kvm->lock);470460471461 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,···528516529517out:530518 mutex_unlock(&kvm->lock);519519+ up_read(&kvm->slots_lock);531520 return r;532521out_list_del:533522 list_del(&match->list);···540527out_free:541528 kfree(match);542529 mutex_unlock(&kvm->lock);530530+ up_read(&kvm->slots_lock);543531 return r;544532}545533#endif···803789 return young;804790}805791792792+static void kvm_mmu_notifier_release(struct mmu_notifier *mn,793793+ struct mm_struct *mm)794794+{795795+ struct kvm *kvm = mmu_notifier_to_kvm(mn);796796+ kvm_arch_flush_shadow(kvm);797797+}798798+806799static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {807800 .invalidate_page = kvm_mmu_notifier_invalidate_page,808801 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start,809802 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end,810803 .clear_flush_young = kvm_mmu_notifier_clear_flush_young,804804+ .release = kvm_mmu_notifier_release,811805};812806#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */813807···905883{906884 struct mm_struct *mm = kvm->mm;907885886886+ kvm_arch_sync_events(kvm);908887 spin_lock(&kvm_lock);909888 list_del(&kvm->vm_list);910889 spin_unlock(&kvm_lock);