Skip to content
Snippets Groups Projects
Select Git revision
  • 88d02a2ba6c52350f9a73ff1b01a5be839c3ca17
  • master default
  • android-container
  • nanopc-t4
  • for-kernelci
  • WIP-syscall
  • v4.16-rc5
  • v4.16-rc4
  • v4.16-rc3
  • v4.16-rc2
  • v4.16-rc1
  • v4.15
  • v4.15-rc9
  • v4.15-rc8
  • v4.15-rc7
  • v4.15-rc6
  • v4.15-rc5
  • v4.15-rc4
  • v4.15-rc3
  • v4.15-rc2
  • v4.15-rc1
  • v4.14
  • v4.14-rc8
  • v4.14-rc7
  • v4.14-rc6
  • v4.14-rc5
26 results

pgtable.h

Blame
    • David Daney's avatar
      88d02a2b
      MIPS: Fix page table corruption on THP permission changes. · 88d02a2b
      David Daney authored
      
      When the core THP code is modifying the permissions of a huge page it
      calls pmd_modify(), which unfortunately was clearing the _PAGE_HUGE bit
      of the page table entry.  The result can be kernel messages like:
      
      mm/memory.c:397: bad pmd 000000040080004d.
      mm/memory.c:397: bad pmd 00000003ff00004d.
      mm/memory.c:397: bad pmd 000000040100004d.
      
      or:
      
      ------------[ cut here ]------------
      WARNING: at mm/mmap.c:3200 exit_mmap+0x150/0x158()
      Modules linked in: ipv6 at24 octeon3_ethernet octeon_srio_nexus m25p80
      CPU: 12 PID: 1295 Comm: pmderr Not tainted 3.10.87-rt80-Cavium-Octeon #4
      Stack : 0000000040808000 0000000014009ce1 0000000000400004 ffffffff81076ba0
                0000000000000000 0000000000000000 ffffffff85110000 0000000000000119
                0000000000000004 0000000000000000 0000000000000119 43617669756d2d4f
                0000000000000000 ffffffff850fda40 ffffffff85110000 0000000000000000
                0000000000000000 0000000000000009 ffffffff809207a0 0000000000000c80
                ffffffff80f1bf20 0000000000000001 000000ffeca36828 0000000000000001
                0000000000000000 0000000000000001 000000ffeca7e700 ffffffff80886924
                80000003fd7a0000 80000003fd7a39b0 80000003fdea8000 ffffffff80885780
                80000003fdea8000 ffffffff80f12218 000000000000000c 000000000000050f
                0000000000000000 ffffffff80865c4c 0000000000000000 0000000000000000
                ...
      Call Trace:
      [<ffffffff80865c4c>] show_stack+0x6c/0xf8
      [<ffffffff80885780>] warn_slowpath_common+0x78/0xa8
      [<ffffffff809207a0>] exit_mmap+0x150/0x158
      [<ffffffff80882d44>] mmput+0x5c/0x110
      [<ffffffff8088b450>] do_exit+0x230/0xa68
      [<ffffffff8088be34>] do_group_exit+0x54/0x1d0
      [<ffffffff8088bfc0>] __wake_up_parent+0x0/0x18
      
      ---[ end trace c7b38293191c57dc ]---
      BUG: Bad rss-counter state mm:80000003fa168000 idx:1 val:1536
      
      Fix by not clearing _PAGE_HUGE bit.
      
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Tested-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
      Cc: stable@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13687/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      88d02a2b
      History
      MIPS: Fix page table corruption on THP permission changes.
      David Daney authored
      
      When the core THP code is modifying the permissions of a huge page it
      calls pmd_modify(), which unfortunately was clearing the _PAGE_HUGE bit
      of the page table entry.  The result can be kernel messages like:
      
      mm/memory.c:397: bad pmd 000000040080004d.
      mm/memory.c:397: bad pmd 00000003ff00004d.
      mm/memory.c:397: bad pmd 000000040100004d.
      
      or:
      
      ------------[ cut here ]------------
      WARNING: at mm/mmap.c:3200 exit_mmap+0x150/0x158()
      Modules linked in: ipv6 at24 octeon3_ethernet octeon_srio_nexus m25p80
      CPU: 12 PID: 1295 Comm: pmderr Not tainted 3.10.87-rt80-Cavium-Octeon #4
      Stack : 0000000040808000 0000000014009ce1 0000000000400004 ffffffff81076ba0
                0000000000000000 0000000000000000 ffffffff85110000 0000000000000119
                0000000000000004 0000000000000000 0000000000000119 43617669756d2d4f
                0000000000000000 ffffffff850fda40 ffffffff85110000 0000000000000000
                0000000000000000 0000000000000009 ffffffff809207a0 0000000000000c80
                ffffffff80f1bf20 0000000000000001 000000ffeca36828 0000000000000001
                0000000000000000 0000000000000001 000000ffeca7e700 ffffffff80886924
                80000003fd7a0000 80000003fd7a39b0 80000003fdea8000 ffffffff80885780
                80000003fdea8000 ffffffff80f12218 000000000000000c 000000000000050f
                0000000000000000 ffffffff80865c4c 0000000000000000 0000000000000000
                ...
      Call Trace:
      [<ffffffff80865c4c>] show_stack+0x6c/0xf8
      [<ffffffff80885780>] warn_slowpath_common+0x78/0xa8
      [<ffffffff809207a0>] exit_mmap+0x150/0x158
      [<ffffffff80882d44>] mmput+0x5c/0x110
      [<ffffffff8088b450>] do_exit+0x230/0xa68
      [<ffffffff8088be34>] do_group_exit+0x54/0x1d0
      [<ffffffff8088bfc0>] __wake_up_parent+0x0/0x18
      
      ---[ end trace c7b38293191c57dc ]---
      BUG: Bad rss-counter state mm:80000003fa168000 idx:1 val:1536
      
      Fix by not clearing _PAGE_HUGE bit.
      
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Tested-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
      Cc: stable@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13687/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    setup.c 2.59 KiB
    /*
     * Machine specific setup for xen
     *
     * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
     */
    
    #include <linux/module.h>
    #include <linux/sched.h>
    #include <linux/mm.h>
    #include <linux/pm.h>
    
    #include <asm/elf.h>
    #include <asm/e820.h>
    #include <asm/setup.h>
    #include <asm/xen/hypervisor.h>
    #include <asm/xen/hypercall.h>
    
    #include <xen/interface/physdev.h>
    #include <xen/features.h>
    
    #include "xen-ops.h"
    #include "vdso.h"
    
    /* These are code, but not functions.  Defined in entry.S */
    extern const char xen_hypervisor_callback[];
    extern const char xen_failsafe_callback[];
    
    unsigned long *phys_to_machine_mapping;
    EXPORT_SYMBOL(phys_to_machine_mapping);
    
    /**
     * machine_specific_memory_setup - Hook for machine specific memory setup.
     **/
    
    char * __init xen_memory_setup(void)
    {
    	unsigned long max_pfn = xen_start_info->nr_pages;
    
    	e820.nr_map = 0;
    	add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
    
    	return "Xen";
    }
    
    static void xen_idle(void)
    {
    	local_irq_disable();
    
    	if (need_resched())
    		local_irq_enable();
    	else {
    		current_thread_info()->status &= ~TS_POLLING;
    		smp_mb__after_clear_bit();
    		safe_halt();
    		current_thread_info()->status |= TS_POLLING;
    	}
    }
    
    /*
     * Set the bit indicating "nosegneg" library variants should be used.
     */
    static void fiddle_vdso(void)
    {
    	extern u32 VDSO_NOTE_MASK; /* See ../kernel/vsyscall-note.S.  */
    	extern char vsyscall_int80_start;
    	u32 *mask = (u32 *) ((unsigned long) &VDSO_NOTE_MASK - VDSO_PRELINK +
    			     &vsyscall_int80_start);
    	*mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
    }
    
    void __init xen_arch_setup(void)
    {
    	struct physdev_set_iopl set_iopl;
    	int rc;
    
    	HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
    	HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
    
    	if (!xen_feature(XENFEAT_auto_translated_physmap))
    		HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
    
    	HYPERVISOR_set_callbacks(__KERNEL_CS, (unsigned long)xen_hypervisor_callback,
    				 __KERNEL_CS, (unsigned long)xen_failsafe_callback);
    
    	set_iopl.iopl = 1;
    	rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
    	if (rc != 0)
    		printk(KERN_INFO "physdev_op failed %d\n", rc);
    
    #ifdef CONFIG_ACPI
    	if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
    		printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
    		disable_acpi();
    	}
    #endif
    
    	memcpy(boot_command_line, xen_start_info->cmd_line,
    	       MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ?
    	       COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE);
    
    	pm_idle = xen_idle;
    
    #ifdef CONFIG_SMP
    	/* fill cpus_possible with all available cpus */
    	xen_fill_possible_map();
    #endif
    
    	paravirt_disable_iospace();
    
    	fiddle_vdso();
    }