diff options
| -rw-r--r-- | Documentation/lguest/lguest.c | 23 | ||||
| -rw-r--r-- | arch/powerpc/Kconfig | 3 | ||||
| -rw-r--r-- | arch/x86/Kconfig | 1 | ||||
| -rw-r--r-- | arch/x86/mm/Makefile | 3 | ||||
| -rw-r--r-- | drivers/char/hvc_console.c | 5 | ||||
| -rw-r--r-- | drivers/lguest/page_tables.c | 25 | ||||
| -rw-r--r-- | include/linux/Kbuild | 1 | ||||
| -rw-r--r-- | include/linux/init.h | 1 | ||||
| -rw-r--r-- | include/linux/mm.h | 20 | ||||
| -rw-r--r-- | init/main.c | 6 | ||||
| -rw-r--r-- | kernel/module.c | 2 | ||||
| -rw-r--r-- | kernel/stop_machine.c | 1 | ||||
| -rw-r--r-- | mm/Kconfig | 3 | ||||
| -rw-r--r-- | mm/util.c | 15 |
14 files changed, 35 insertions, 74 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index b88b0ea54e90..655414821edc 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
| @@ -1447,21 +1447,6 @@ static void configure_device(int fd, const char *tapif, u32 ipaddr) | |||
| 1447 | err(1, "Bringing interface %s up", tapif); | 1447 | err(1, "Bringing interface %s up", tapif); |
| 1448 | } | 1448 | } |
| 1449 | 1449 | ||
| 1450 | static void get_mac(int fd, const char *tapif, unsigned char hwaddr[6]) | ||
| 1451 | { | ||
| 1452 | struct ifreq ifr; | ||
| 1453 | |||
| 1454 | memset(&ifr, 0, sizeof(ifr)); | ||
| 1455 | strcpy(ifr.ifr_name, tapif); | ||
| 1456 | |||
| 1457 | /* SIOC stands for Socket I/O Control. G means Get (vs S for Set | ||
| 1458 | * above). IF means Interface, and HWADDR is hardware address. | ||
| 1459 | * Simple! */ | ||
| 1460 | if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0) | ||
| 1461 | err(1, "getting hw address for %s", tapif); | ||
| 1462 | memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6); | ||
| 1463 | } | ||
| 1464 | |||
| 1465 | static int get_tun_device(char tapif[IFNAMSIZ]) | 1450 | static int get_tun_device(char tapif[IFNAMSIZ]) |
| 1466 | { | 1451 | { |
| 1467 | struct ifreq ifr; | 1452 | struct ifreq ifr; |
| @@ -1531,11 +1516,8 @@ static void setup_tun_net(char *arg) | |||
| 1531 | p = strchr(arg, ':'); | 1516 | p = strchr(arg, ':'); |
| 1532 | if (p) { | 1517 | if (p) { |
| 1533 | str2mac(p+1, conf.mac); | 1518 | str2mac(p+1, conf.mac); |
| 1519 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
| 1534 | *p = '\0'; | 1520 | *p = '\0'; |
| 1535 | } else { | ||
| 1536 | p = arg + strlen(arg); | ||
| 1537 | /* None supplied; query the randomly assigned mac. */ | ||
| 1538 | get_mac(ipfd, tapif, conf.mac); | ||
| 1539 | } | 1521 | } |
| 1540 | 1522 | ||
| 1541 | /* arg is now either an IP address or a bridge name */ | 1523 | /* arg is now either an IP address or a bridge name */ |
| @@ -1547,13 +1529,10 @@ static void setup_tun_net(char *arg) | |||
| 1547 | /* Set up the tun device. */ | 1529 | /* Set up the tun device. */ |
| 1548 | configure_device(ipfd, tapif, ip); | 1530 | configure_device(ipfd, tapif, ip); |
| 1549 | 1531 | ||
| 1550 | /* Tell Guest what MAC address to use. */ | ||
| 1551 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
| 1552 | add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); | 1532 | add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); |
| 1553 | /* Expect Guest to handle everything except UFO */ | 1533 | /* Expect Guest to handle everything except UFO */ |
| 1554 | add_feature(dev, VIRTIO_NET_F_CSUM); | 1534 | add_feature(dev, VIRTIO_NET_F_CSUM); |
| 1555 | add_feature(dev, VIRTIO_NET_F_GUEST_CSUM); | 1535 | add_feature(dev, VIRTIO_NET_F_GUEST_CSUM); |
| 1556 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
| 1557 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO4); | 1536 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO4); |
| 1558 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO6); | 1537 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO6); |
| 1559 | add_feature(dev, VIRTIO_NET_F_GUEST_ECN); | 1538 | add_feature(dev, VIRTIO_NET_F_GUEST_ECN); |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 63c9cafda9c4..587da5e0990f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
| @@ -42,9 +42,6 @@ config GENERIC_HARDIRQS | |||
| 42 | bool | 42 | bool |
| 43 | default y | 43 | default y |
| 44 | 44 | ||
| 45 | config HAVE_GET_USER_PAGES_FAST | ||
| 46 | def_bool PPC64 | ||
| 47 | |||
| 48 | config HAVE_SETUP_PER_CPU_AREA | 45 | config HAVE_SETUP_PER_CPU_AREA |
| 49 | def_bool PPC64 | 46 | def_bool PPC64 |
| 50 | 47 | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 3d0f2b6a5a16..ac2fb0641a04 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -22,7 +22,6 @@ config X86 | |||
| 22 | select HAVE_IDE | 22 | select HAVE_IDE |
| 23 | select HAVE_OPROFILE | 23 | select HAVE_OPROFILE |
| 24 | select HAVE_IOREMAP_PROT | 24 | select HAVE_IOREMAP_PROT |
| 25 | select HAVE_GET_USER_PAGES_FAST | ||
| 26 | select HAVE_KPROBES | 25 | select HAVE_KPROBES |
| 27 | select ARCH_WANT_OPTIONAL_GPIOLIB | 26 | select ARCH_WANT_OPTIONAL_GPIOLIB |
| 28 | select HAVE_KRETPROBES | 27 | select HAVE_KRETPROBES |
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 2977ea37791f..dfb932dcf136 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ | 1 | obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ |
| 2 | pat.o pgtable.o | 2 | pat.o pgtable.o gup.o |
| 3 | 3 | ||
| 4 | obj-$(CONFIG_HAVE_GET_USER_PAGES_FAST) += gup.o | ||
| 5 | obj-$(CONFIG_X86_32) += pgtable_32.o | 4 | obj-$(CONFIG_X86_32) += pgtable_32.o |
| 6 | 5 | ||
| 7 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | 6 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 02aac104842d..fd64137b1ab9 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
| @@ -322,11 +322,10 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) | |||
| 322 | 322 | ||
| 323 | hp->tty = tty; | 323 | hp->tty = tty; |
| 324 | 324 | ||
| 325 | if (hp->ops->notifier_add) | ||
| 326 | rc = hp->ops->notifier_add(hp, hp->data); | ||
| 327 | |||
| 328 | spin_unlock_irqrestore(&hp->lock, flags); | 325 | spin_unlock_irqrestore(&hp->lock, flags); |
| 329 | 326 | ||
| 327 | if (hp->ops->notifier_add) | ||
| 328 | rc = hp->ops->notifier_add(hp, hp->data); | ||
| 330 | 329 | ||
| 331 | /* | 330 | /* |
| 332 | * If the notifier fails we return an error. The tty layer | 331 | * If the notifier fails we return an error. The tty layer |
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index d93500f24fbb..81d0c6053447 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
| @@ -108,9 +108,8 @@ static unsigned long gpte_addr(pgd_t gpgd, unsigned long vaddr) | |||
| 108 | } | 108 | } |
| 109 | /*:*/ | 109 | /*:*/ |
| 110 | 110 | ||
| 111 | /*M:014 get_pfn is slow; it takes the mmap sem and calls get_user_pages. We | 111 | /*M:014 get_pfn is slow: we could probably try to grab batches of pages here as |
| 112 | * could probably try to grab batches of pages here as an optimization | 112 | * an optimization (ie. pre-faulting). :*/ |
| 113 | * (ie. pre-faulting). :*/ | ||
| 114 | 113 | ||
| 115 | /*H:350 This routine takes a page number given by the Guest and converts it to | 114 | /*H:350 This routine takes a page number given by the Guest and converts it to |
| 116 | * an actual, physical page number. It can fail for several reasons: the | 115 | * an actual, physical page number. It can fail for several reasons: the |
| @@ -123,19 +122,13 @@ static unsigned long gpte_addr(pgd_t gpgd, unsigned long vaddr) | |||
| 123 | static unsigned long get_pfn(unsigned long virtpfn, int write) | 122 | static unsigned long get_pfn(unsigned long virtpfn, int write) |
| 124 | { | 123 | { |
| 125 | struct page *page; | 124 | struct page *page; |
| 126 | /* This value indicates failure. */ | ||
| 127 | unsigned long ret = -1UL; | ||
| 128 | 125 | ||
| 129 | /* get_user_pages() is a complex interface: it gets the "struct | 126 | /* gup me one page at this address please! */ |
| 130 | * vm_area_struct" and "struct page" assocated with a range of pages. | 127 | if (get_user_pages_fast(virtpfn << PAGE_SHIFT, 1, write, &page) == 1) |
| 131 | * It also needs the task's mmap_sem held, and is not very quick. | 128 | return page_to_pfn(page); |
| 132 | * It returns the number of pages it got. */ | 129 | |
| 133 | down_read(¤t->mm->mmap_sem); | 130 | /* This value indicates failure. */ |
| 134 | if (get_user_pages(current, current->mm, virtpfn << PAGE_SHIFT, | 131 | return -1UL; |
| 135 | 1, write, 1, &page, NULL) == 1) | ||
| 136 | ret = page_to_pfn(page); | ||
| 137 | up_read(¤t->mm->mmap_sem); | ||
| 138 | return ret; | ||
| 139 | } | 132 | } |
| 140 | 133 | ||
| 141 | /*H:340 Converting a Guest page table entry to a shadow (ie. real) page table | 134 | /*H:340 Converting a Guest page table entry to a shadow (ie. real) page table |
| @@ -174,7 +167,7 @@ static pte_t gpte_to_spte(struct lg_cpu *cpu, pte_t gpte, int write) | |||
| 174 | /*H:460 And to complete the chain, release_pte() looks like this: */ | 167 | /*H:460 And to complete the chain, release_pte() looks like this: */ |
| 175 | static void release_pte(pte_t pte) | 168 | static void release_pte(pte_t pte) |
| 176 | { | 169 | { |
| 177 | /* Remember that get_user_pages() took a reference to the page, in | 170 | /* Remember that get_user_pages_fast() took a reference to the page, in |
| 178 | * get_pfn()? We have to put it back now. */ | 171 | * get_pfn()? We have to put it back now. */ |
| 179 | if (pte_flags(pte) & _PAGE_PRESENT) | 172 | if (pte_flags(pte) & _PAGE_PRESENT) |
| 180 | put_page(pfn_to_page(pte_pfn(pte))); | 173 | put_page(pfn_to_page(pte_pfn(pte))); |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index a26f565e8189..327f60658d94 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -356,6 +356,7 @@ unifdef-y += virtio_balloon.h | |||
| 356 | unifdef-y += virtio_console.h | 356 | unifdef-y += virtio_console.h |
| 357 | unifdef-y += virtio_pci.h | 357 | unifdef-y += virtio_pci.h |
| 358 | unifdef-y += virtio_ring.h | 358 | unifdef-y += virtio_ring.h |
| 359 | unifdef-y += virtio_rng.h | ||
| 359 | unifdef-y += vt.h | 360 | unifdef-y += vt.h |
| 360 | unifdef-y += wait.h | 361 | unifdef-y += wait.h |
| 361 | unifdef-y += wanrouter.h | 362 | unifdef-y += wanrouter.h |
diff --git a/include/linux/init.h b/include/linux/init.h index 11b84e106053..93538b696e3d 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
| @@ -139,6 +139,7 @@ extern initcall_t __con_initcall_start[], __con_initcall_end[]; | |||
| 139 | extern initcall_t __security_initcall_start[], __security_initcall_end[]; | 139 | extern initcall_t __security_initcall_start[], __security_initcall_end[]; |
| 140 | 140 | ||
| 141 | /* Defined in init/main.c */ | 141 | /* Defined in init/main.c */ |
| 142 | extern int do_one_initcall(initcall_t fn); | ||
| 142 | extern char __initdata boot_command_line[]; | 143 | extern char __initdata boot_command_line[]; |
| 143 | extern char *saved_command_line; | 144 | extern char *saved_command_line; |
| 144 | extern unsigned int reset_devices; | 145 | extern unsigned int reset_devices; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 335288bff1b7..fa651609b65d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -834,7 +834,6 @@ extern int mprotect_fixup(struct vm_area_struct *vma, | |||
| 834 | struct vm_area_struct **pprev, unsigned long start, | 834 | struct vm_area_struct **pprev, unsigned long start, |
| 835 | unsigned long end, unsigned long newflags); | 835 | unsigned long end, unsigned long newflags); |
| 836 | 836 | ||
| 837 | #ifdef CONFIG_HAVE_GET_USER_PAGES_FAST | ||
| 838 | /* | 837 | /* |
| 839 | * get_user_pages_fast provides equivalent functionality to get_user_pages, | 838 | * get_user_pages_fast provides equivalent functionality to get_user_pages, |
| 840 | * operating on current and current->mm (force=0 and doesn't return any vmas). | 839 | * operating on current and current->mm (force=0 and doesn't return any vmas). |
| @@ -848,25 +847,6 @@ extern int mprotect_fixup(struct vm_area_struct *vma, | |||
| 848 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | 847 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
| 849 | struct page **pages); | 848 | struct page **pages); |
| 850 | 849 | ||
| 851 | #else | ||
| 852 | /* | ||
| 853 | * Should probably be moved to asm-generic, and architectures can include it if | ||
| 854 | * they don't implement their own get_user_pages_fast. | ||
| 855 | */ | ||
| 856 | #define get_user_pages_fast(start, nr_pages, write, pages) \ | ||
| 857 | ({ \ | ||
| 858 | struct mm_struct *mm = current->mm; \ | ||
| 859 | int ret; \ | ||
| 860 | \ | ||
| 861 | down_read(&mm->mmap_sem); \ | ||
| 862 | ret = get_user_pages(current, mm, start, nr_pages, \ | ||
| 863 | write, 0, pages, NULL); \ | ||
| 864 | up_read(&mm->mmap_sem); \ | ||
| 865 | \ | ||
| 866 | ret; \ | ||
| 867 | }) | ||
| 868 | #endif | ||
| 869 | |||
| 870 | /* | 850 | /* |
| 871 | * A callback you can register to apply pressure to ageable caches. | 851 | * A callback you can register to apply pressure to ageable caches. |
| 872 | * | 852 | * |
diff --git a/init/main.c b/init/main.c index 0bc7e167bf45..f6f7042331dc 100644 --- a/init/main.c +++ b/init/main.c | |||
| @@ -691,7 +691,7 @@ asmlinkage void __init start_kernel(void) | |||
| 691 | rest_init(); | 691 | rest_init(); |
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | static int __initdata initcall_debug; | 694 | static int initcall_debug; |
| 695 | 695 | ||
| 696 | static int __init initcall_debug_setup(char *str) | 696 | static int __init initcall_debug_setup(char *str) |
| 697 | { | 697 | { |
| @@ -700,7 +700,7 @@ static int __init initcall_debug_setup(char *str) | |||
| 700 | } | 700 | } |
| 701 | __setup("initcall_debug", initcall_debug_setup); | 701 | __setup("initcall_debug", initcall_debug_setup); |
| 702 | 702 | ||
| 703 | static void __init do_one_initcall(initcall_t fn) | 703 | int do_one_initcall(initcall_t fn) |
| 704 | { | 704 | { |
| 705 | int count = preempt_count(); | 705 | int count = preempt_count(); |
| 706 | ktime_t t0, t1, delta; | 706 | ktime_t t0, t1, delta; |
| @@ -740,6 +740,8 @@ static void __init do_one_initcall(initcall_t fn) | |||
| 740 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn); | 740 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn); |
| 741 | printk(" returned with %s\n", msgbuf); | 741 | printk(" returned with %s\n", msgbuf); |
| 742 | } | 742 | } |
| 743 | |||
| 744 | return result; | ||
| 743 | } | 745 | } |
| 744 | 746 | ||
| 745 | 747 | ||
diff --git a/kernel/module.c b/kernel/module.c index 61d212120df4..08864d257eb0 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -2288,7 +2288,7 @@ sys_init_module(void __user *umod, | |||
| 2288 | 2288 | ||
| 2289 | /* Start the module */ | 2289 | /* Start the module */ |
| 2290 | if (mod->init != NULL) | 2290 | if (mod->init != NULL) |
| 2291 | ret = mod->init(); | 2291 | ret = do_one_initcall(mod->init); |
| 2292 | if (ret < 0) { | 2292 | if (ret < 0) { |
| 2293 | /* Init routine failed: abort. Try to protect us from | 2293 | /* Init routine failed: abort. Try to protect us from |
| 2294 | buggy refcounters. */ | 2294 | buggy refcounters. */ |
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index e446c7c7d6a9..af3c7cea258b 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c | |||
| @@ -65,7 +65,6 @@ static void ack_state(void) | |||
| 65 | static int stop_cpu(struct stop_machine_data *smdata) | 65 | static int stop_cpu(struct stop_machine_data *smdata) |
| 66 | { | 66 | { |
| 67 | enum stopmachine_state curstate = STOPMACHINE_NONE; | 67 | enum stopmachine_state curstate = STOPMACHINE_NONE; |
| 68 | int uninitialized_var(ret); | ||
| 69 | 68 | ||
| 70 | /* Simple state machine */ | 69 | /* Simple state machine */ |
| 71 | do { | 70 | do { |
diff --git a/mm/Kconfig b/mm/Kconfig index 446c6588c753..0bd9c2dbb2a0 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
| @@ -77,9 +77,6 @@ config FLAT_NODE_MEM_MAP | |||
| 77 | def_bool y | 77 | def_bool y |
| 78 | depends on !SPARSEMEM | 78 | depends on !SPARSEMEM |
| 79 | 79 | ||
| 80 | config HAVE_GET_USER_PAGES_FAST | ||
| 81 | bool | ||
| 82 | |||
| 83 | # | 80 | # |
| 84 | # Both the NUMA code and DISCONTIGMEM use arrays of pg_data_t's | 81 | # Both the NUMA code and DISCONTIGMEM use arrays of pg_data_t's |
| 85 | # to represent different areas of memory. This variable allows | 82 | # to represent different areas of memory. This variable allows |
| @@ -171,3 +171,18 @@ void arch_pick_mmap_layout(struct mm_struct *mm) | |||
| 171 | mm->unmap_area = arch_unmap_area; | 171 | mm->unmap_area = arch_unmap_area; |
| 172 | } | 172 | } |
| 173 | #endif | 173 | #endif |
| 174 | |||
| 175 | int __attribute__((weak)) get_user_pages_fast(unsigned long start, | ||
| 176 | int nr_pages, int write, struct page **pages) | ||
| 177 | { | ||
| 178 | struct mm_struct *mm = current->mm; | ||
| 179 | int ret; | ||
| 180 | |||
| 181 | down_read(&mm->mmap_sem); | ||
| 182 | ret = get_user_pages(current, mm, start, nr_pages, | ||
| 183 | write, 0, pages, NULL); | ||
| 184 | up_read(&mm->mmap_sem); | ||
| 185 | |||
| 186 | return ret; | ||
| 187 | } | ||
| 188 | EXPORT_SYMBOL_GPL(get_user_pages_fast); | ||
