Use the Block Transfer Engine in the Altix SN2 SHub for background
zeroing

Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>

Index: linux-2.6.10/arch/ia64/sn/kernel/bte.c
===================================================================
--- linux-2.6.10.orig/arch/ia64/sn/kernel/bte.c 2005-02-03 17:13:07.000000000 
-0800
+++ linux-2.6.10/arch/ia64/sn/kernel/bte.c      2005-02-03 18:11:45.000000000 
-0800
@@ -3,7 +3,9 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * Support for zeroing pages, Christoph Lameter, SGI, December 2004.
  */

 #include <linux/config.h>
@@ -20,6 +22,8 @@
 #include <linux/bootmem.h>
 #include <linux/string.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/scrub.h>

 #include <asm/sn/bte.h>

@@ -30,7 +34,7 @@
 /* two interfaces on two btes */
 #define MAX_INTERFACES_TO_TRY          4

-static struct bteinfo_s *bte_if_on_node(nasid_t nasid, int interface)
+static inline struct bteinfo_s *bte_if_on_node(nasid_t nasid, int interface)
 {
        nodepda_t *tmp_nodepda;

@@ -199,6 +203,7 @@ retry_bteop:
        }

        while ((transfer_stat = *bte->most_rcnt_na) == BTE_WORD_BUSY) {
+               cpu_relax();
                if (ia64_get_itc() > itc_end) {
                        BTE_PRINTK(("BTE timeout nasid 0x%x bte%d IBLS = 0x%lx 
na 0x%lx\n",
                                NASID_GET(bte->bte_base_addr), bte->bte_num,
@@ -449,5 +454,25 @@ void bte_init_node(nodepda_t * mynodepda
                mynodepda->bte_if[i].cleanup_active = 0;
                mynodepda->bte_if[i].bh_error = 0;
        }
+}
+
+static int bte_start_bzero(void *p, unsigned long len)
+{
+
+       /* Check limitations.
+               1. System must be running (weird things happen during bootup)
+               2. Size >64KB. Smaller requests cause too much bte traffic
+        */
+       if (len >= BTE_MAX_XFER || len < 60000 || system_state != 
SYSTEM_RUNNING)
+               return EINVAL;
+
+       return bte_zero(ia64_tpa(p), len, 0, NULL);
+}
+
+static struct zero_driver bte_bzero = {
+       .start = bte_start_bzero,
+};

+void sn_bte_bzero_init(void) {
+       register_zero_driver(&bte_bzero);
 }
Index: linux-2.6.10/arch/ia64/sn/kernel/setup.c
===================================================================
--- linux-2.6.10.orig/arch/ia64/sn/kernel/setup.c       2005-02-03 
13:33:33.000000000 -0800
+++ linux-2.6.10/arch/ia64/sn/kernel/setup.c    2005-02-03 18:08:26.000000000 
-0800
@@ -251,6 +251,7 @@ void __init sn_setup(char **cmdline_p)
        int pxm;
        int major = sn_sal_rev_major(), minor = sn_sal_rev_minor();
        extern void sn_cpu_init(void);
+       extern void sn_bte_bzero_init(void);

        /*
         * If the generic code has enabled vga console support - lets
@@ -341,6 +342,7 @@ void __init sn_setup(char **cmdline_p)
        screen_info = sn_screen_info;

        sn_timer_init();
+       sn_bte_bzero_init();
 }

 /**

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to