📄 qsnet-rhel4-2.6.patch
字号:
+-- Last update Daniel J Blueman - 24 Mar 2006Index: linux-269-5502/mm/ioproc.c===================================================================--- /dev/null+++ linux-269-5502/mm/ioproc.c@@ -0,0 +1,52 @@+/*+ * Copyright (C) 2006 Quadrics Ltd+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation; either version 2 of the License, or+ * (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+ */++/*+ * Registration for IO processor page table updates.+ */++#include <linux/kernel.h>+#include <linux/module.h>++#include <linux/mm.h>+#include <linux/ioproc.h>++int ioproc_register_ops(struct mm_struct *mm, struct ioproc_ops *ip)+{+ ip->next = mm->ioproc_ops;+ mm->ioproc_ops = ip;++ return 0;+}++EXPORT_SYMBOL_GPL(ioproc_register_ops);++int ioproc_unregister_ops(struct mm_struct *mm, struct ioproc_ops *ip)+{+ struct ioproc_ops **tmp;++ for (tmp = &mm->ioproc_ops; *tmp && *tmp != ip; tmp = &(*tmp)->next) ;+ if (*tmp) {+ *tmp = ip->next;+ return 0;+ }++ return -EINVAL;+}++EXPORT_SYMBOL_GPL(ioproc_unregister_ops);Index: linux-269-5502/mm/hugetlb.c===================================================================--- linux-269-5502.orig/mm/hugetlb.c+++ linux-269-5502/mm/hugetlb.c@@ -10,6 +10,7 @@ #include <linux/hugetlb.h> #include <linux/sysctl.h> #include <linux/highmem.h>+#include <linux/ioproc.h> const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL; static unsigned long nr_huge_pages, free_huge_pages;@@ -260,6 +261,7 @@ void zap_hugepage_range(struct vm_area_s struct mm_struct *mm = vma->vm_mm; spin_lock(&mm->page_table_lock);+ ioproc_invalidate_range(vma, start, start + length); unmap_hugepage_range(vma, start, start + length); spin_unlock(&mm->page_table_lock); }Index: linux-269-5502/mm/Kconfig===================================================================--- /dev/null+++ linux-269-5502/mm/Kconfig@@ -0,0 +1,15 @@+#+# VM subsystem specific config+# ++# Support for IO processors which have advanced RDMA capabilities+#+config IOPROC+ bool "Enable IOPROC VM hooks"+ depends on MMU+ default y+ help+ This option enables hooks in the VM subsystem so that IO devices which+ incorporate advanced RDMA capabilities can be kept in sync with CPU + page table changes.+ See Documentation/vm/ioproc.txt for more details.Index: linux-269-5502/mm/Makefile===================================================================--- linux-269-5502.orig/mm/Makefile+++ linux-269-5502/mm/Makefile@@ -16,6 +16,7 @@ obj-$(CONFIG_SWAP) += page_io.o swap_sta obj-$(CONFIG_X86_4G) += usercopy.o obj-$(CONFIG_HUGETLBFS) += hugetlb.o obj-$(CONFIG_NUMA) += mempolicy.o+obj-$(CONFIG_IOPROC) += ioproc.o obj-$(CONFIG_SHMEM) += shmem.o obj-$(CONFIG_TINY_SHMEM) += tiny-shmem.o Index: linux-269-5502/mm/mprotect.c===================================================================--- linux-269-5502.orig/mm/mprotect.c+++ linux-269-5502/mm/mprotect.c@@ -10,6 +10,7 @@ #include <linux/mm.h> #include <linux/hugetlb.h>+#include <linux/ioproc.h> #include <linux/slab.h> #include <linux/shm.h> #include <linux/mman.h>@@ -100,6 +101,7 @@ change_protection(struct vm_area_struct if (start >= end) BUG(); spin_lock(¤t->mm->page_table_lock);+ ioproc_change_protection(vma, start, end, newprot); do { change_pmd_range(dir, start, end - start, newprot); start = (start + PGDIR_SIZE) & PGDIR_MASK;Index: linux-269-5502/mm/msync.c===================================================================--- linux-269-5502.orig/mm/msync.c+++ linux-269-5502/mm/msync.c@@ -12,6 +12,7 @@ #include <linux/mm.h> #include <linux/mman.h> #include <linux/hugetlb.h>+#include <linux/ioproc.h> #include <asm/pgtable.h> #include <asm/tlbflush.h>@@ -115,6 +116,7 @@ static int filemap_sync(struct vm_area_s if (address >= end) BUG();+ ioproc_sync_range(vma, address, end); do { error |= filemap_sync_pmd_range(dir, address, end, vma, flags); address = (address + PGDIR_SIZE) & PGDIR_MASK;Index: linux-269-5502/mm/mremap.c===================================================================--- linux-269-5502.orig/mm/mremap.c+++ linux-269-5502/mm/mremap.c@@ -9,6 +9,7 @@ #include <linux/mm.h> #include <linux/hugetlb.h>+#include <linux/ioproc.h> #include <linux/slab.h> #include <linux/shm.h> #include <linux/mman.h>@@ -148,6 +149,8 @@ static unsigned long move_page_tables(st { unsigned long offset; + ioproc_invalidate_range(vma, old_addr, old_addr + len);+ ioproc_invalidate_range(vma, new_addr, new_addr + len); flush_cache_range(vma, old_addr, old_addr + len); /*Index: linux-269-5502/mm/fremap.c===================================================================--- linux-269-5502.orig/mm/fremap.c+++ linux-269-5502/mm/fremap.c@@ -12,6 +12,7 @@ #include <linux/mman.h> #include <linux/pagemap.h> #include <linux/swapops.h>+#include <linux/ioproc.h> #include <linux/rmap.h> #include <linux/module.h> @@ -29,6 +30,7 @@ static inline void zap_pte(struct mm_str if (pte_present(pte)) { unsigned long pfn = pte_pfn(pte); + ioproc_invalidate_page(vma, addr); flush_cache_page(vma, addr); pte = ptep_clear_flush(vma, addr, ptep); if (pfn_valid(pfn)) {@@ -93,6 +95,7 @@ int install_page(struct mm_struct *mm, s pte_val = *pte; pte_unmap(pte); update_mmu_cache(vma, addr, pte_val);+ ioproc_update_page(vma, addr); err = 0; err_unlock:@@ -132,6 +135,7 @@ int install_file_pte(struct mm_struct *m pte_val = *pte; pte_unmap(pte); update_mmu_cache(vma, addr, pte_val);+ ioproc_update_page(vma, addr); spin_unlock(&mm->page_table_lock); return 0; Index: linux-269-5502/mm/rmap.c===================================================================--- linux-269-5502.orig/mm/rmap.c+++ linux-269-5502/mm/rmap.c@@ -51,6 +51,7 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/rmap.h>+#include <linux/ioproc.h> #include <linux/rcupdate.h> #include <asm/tlbflush.h>@@ -566,6 +567,7 @@ static int try_to_unmap_one(struct page } /* Nuke the page table entry. */+ ioproc_invalidate_page(vma, address); flush_cache_page(vma, address); pteval = ptep_clear_flush(vma, address, pte); @@ -673,6 +675,7 @@ static void try_to_unmap_cluster(unsigne continue; /* Nuke the page table entry. */+ ioproc_invalidate_page(vma, address); flush_cache_page(vma, address); pteval = ptep_clear_flush(vma, address, pte); Index: linux-269-5502/mm/memory.c===================================================================--- linux-269-5502.orig/mm/memory.c+++ linux-269-5502/mm/memory.c@@ -43,6 +43,7 @@ #include <linux/swap.h> #include <linux/highmem.h> #include <linux/pagemap.h>+#include <linux/ioproc.h> #include <linux/rmap.h> #include <linux/module.h> #include <linux/init.h>@@ -630,6 +631,7 @@ void zap_page_range(struct vm_area_struc lru_add_drain(); spin_lock(&mm->page_table_lock);+ ioproc_invalidate_range(vma, address, end); tlb = tlb_gather_mmu(mm, 0); unmap_vmas(&tlb, mm, vma, address, end, &nr_accounted, details); tlb_finish_mmu(tlb, address, end);@@ -998,6 +1000,7 @@ int zeromap_page_range(struct vm_area_st BUG(); spin_lock(&mm->page_table_lock);+ ioproc_invalidate_range(vma, beg, end); do { pmd_t *pmd = pmd_alloc(mm, dir, address); error = -ENOMEM;@@ -1012,6 +1015,7 @@ int zeromap_page_range(struct vm_area_st /* * Why flush? zeromap_pte_range has a BUG_ON for !pte_none() */+ ioproc_update_range(vma, beg, end); flush_tlb_range(vma, beg, end); spin_unlock(&mm->page_table_lock); return error;@@ -1092,6 +1096,7 @@ int remap_page_range(struct vm_area_stru vma->vm_flags |= VM_IO | VM_RESERVED; spin_lock(&mm->page_table_lock);+ ioproc_invalidate_range(vma, beg, end); do { pmd_t *pmd = pmd_alloc(mm, dir, from); error = -ENOMEM;@@ -1106,6 +1111,7 @@ int remap_page_range(struct vm_area_stru /* * Why flush? remap_pte_range has a BUG_ON for !pte_none() */+ ioproc_update_range(vma, beg, end); flush_tlb_range(vma, beg, end); spin_unlock(&mm->page_table_lock); return error;@@ -1194,6 +1200,7 @@ static int do_wp_page(struct mm_struct * update_mmu_cache(vma, address, entry); lazy_mmu_prot_update(entry); pte_unmap(page_table);+ ioproc_update_page(vma, address); spin_unlock(&mm->page_table_lock); return VM_FAULT_MINOR; }@@ -1226,6 +1233,7 @@ static int do_wp_page(struct mm_struct * ++mm->rss; else page_remove_rmap(old_page);+ ioproc_invalidate_page(vma, address); break_cow(vma, new_page, address, page_table); lru_cache_add_active(new_page); page_add_anon_rmap(new_page, vma, address);@@ -1234,6 +1242,7 @@ static int do_wp_page(struct mm_struct * new_page = old_page; } pte_unmap(page_table);+ ioproc_update_page(vma, address); page_cache_release(new_page); page_cache_release(old_page); spin_unlock(&mm->page_table_lock);@@ -1630,6 +1639,7 @@ static int do_swap_page(struct mm_struct update_mmu_cache(vma, address, pte); lazy_mmu_prot_update(pte); pte_unmap(page_table);+ ioproc_update_page(vma, address); spin_unlock(&mm->page_table_lock); out: return ret;@@ -1695,6 +1705,7 @@ do_anonymous_page(struct mm_struct *mm, /* No need to invalidate - it was non-present before */ update_mmu_cache(vma, addr, entry); lazy_mmu_prot_update(entry);+ ioproc_update_page(vma, addr); spin_unlock(&mm->page_table_lock); out: return VM_FAULT_MINOR;@@ -1813,6 +1824,7 @@ retry: /* no need to invalidate: a not-present page shouldn't be cached */ update_mmu_cache(vma, address, entry); lazy_mmu_prot_update(entry);+ ioproc_update_page(vma, address); spin_unlock(&mm->page_table_lock); out: return ret;@@ -1998,6 +2010,7 @@ int make_pages_present(unsigned long add return ret; return ret == len ? 0 : -1; }+EXPORT_SYMBOL(make_pages_present); /* * Map a vmalloc()-space virtual address to the physical page.Index: linux-269-5502/mm/mmap.c===================================================================--- linux-269-5502.orig/mm/mmap.c+++ linux-269-5502/mm/mmap.c@@ -15,6 +15,7 @@ #include <linux/init.h> #include <linux/file.h> #include <linux/fs.h>+#include <linux/ioproc.h> #include <linux/personality.h> #include <linux/security.h> #include <linux/hugetlb.h>@@ -1703,6 +1704,7 @@ static void unmap_region(struct mm_struc unsigned long nr_accounted = 0; lru_add_drain();+ ioproc_invalidate_range(vma, start, end); tlb = tlb_gather_mmu(mm, 0); unmap_vmas(&tlb, mm, vma, start, end, &nr_accounted, NULL); vm_unacct_memory(nr_accounted);@@ -1995,6 +1997,7 @@ void exit_mmap(struct mm_struct *mm) spin_lock(&mm->page_table_lock); + ioproc_release(mm); tlb = tlb_gather_mmu(mm, 1); flush_cache_mm(mm); /* Use ~0UL here to ensure all VMAs in the mm are unmapped */Index: linux-269-5502/ipc/shm.c===================================================================--- linux-269-5502.orig/ipc/shm.c+++ linux-269-5502/ipc/shm.c@@ -26,6 +26,7 @@ #include <linux/proc_fs.h> #include <linux/shmem_fs.h> #include <linux/security.h>+#include <linux/module.h> #include <linux/audit.h> #include <asm/uaccess.h> @@ -856,6 +857,44 @@ asmlinkage long sys_shmdt(char __user *s return retval; } +/*+ * Mark all segments created by this process for destruction+ */+int shm_cleanup (void)+{+ int i;++ down(&shm_ids.sem);++ for (i = 0; i <= shm_ids.max_id; i++) {+ struct shmid_kernel *shp;++ shp = shm_lock(i);+ if (shp != NULL) {+ /* mark this segment for destruction if we created it */+ if (current->pid == shp->shm_cprid)+ {+ /* copy of IPC_RMID code */+ if (shp->shm_nattch) {+ shp->shm_flags |= SHM_DEST;+ /* do not find it any more */+ shp->shm_perm.key = IPC_PRIVATE;+ } else {+ shm_destroy(shp);+ continue;+ }+ }++ shm_unlock(shp);+ }+ }++ up(&shm_ids.sem);++ return 0;+}+EXPORT_SYMBOL_GPL(shm_cleanup);+ #ifdef CONFIG_PROC_FS static int sysvipc_shm_read_proc(char *buffer, char **start, off_t offset, int length, int *eof, void *data) {Index: linux-269-5502/include/linux/init_task.h===================================================================--- linux-269-5502.orig/include/linux/init_task.h+++ linux-269-5502/include/linux/init_task.h@@ -2,6 +2,7 @@ #define _LINUX__INIT_TASK_H #include <linux/file.h>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -