]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Pull miscellaneous into release branch
authorTony Luck <tony.luck@intel.com>
Thu, 17 Apr 2008 17:14:51 +0000 (10:14 -0700)
committerTony Luck <tony.luck@intel.com>
Thu, 17 Apr 2008 17:14:51 +0000 (10:14 -0700)
Conflicts:

arch/ia64/kernel/mca.c

1  2 
arch/ia64/Kconfig
arch/ia64/kernel/asm-offsets.c
arch/ia64/kernel/fsys.S
arch/ia64/kernel/mca.c
arch/ia64/kernel/setup.c
arch/ia64/mm/discontig.c

diff --combined arch/ia64/Kconfig
index eef457fda08fad53d45283fe80379a1920ed14ba,1b73ffe746d9af170f5a20060cd7097331923438..ed21737a00c584ee741cdbc50087d7f76ab84b6f
@@@ -283,17 -283,6 +283,17 @@@ config FORCE_MAX_ZONEORDE
        default "17" if HUGETLB_PAGE
        default "11"
  
 +config VIRT_CPU_ACCOUNTING
 +      bool "Deterministic task and CPU time accounting"
 +      default n
 +      help
 +        Select this option to enable more accurate task and CPU time
 +        accounting.  This is done by reading a CPU counter on each
 +        kernel entry and exit and on transitions within the kernel
 +        between system, softirq and hardirq state, so there is a
 +        small performance impact.
 +        If in doubt, say N here.
 +
  config SMP
        bool "Symmetric multi-processing support"
        help
@@@ -622,6 -611,9 +622,9 @@@ config IRQ_PER_CP
        bool
        default y
  
+ config IOMMU_HELPER
+       def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC)
  source "arch/ia64/hp/sim/Kconfig"
  
  source "arch/ia64/Kconfig.debug"
index 5865130b0a921fc69cf26ae9e80286eddf60519b,f7bc40dee43d0c8e814519a536ecf9c2ee5329d1..230a6f92367fc3a966d362e2f8126419396b1a55
@@@ -7,6 -7,7 +7,7 @@@
  #define ASM_OFFSETS_C 1
  
  #include <linux/sched.h>
+ #include <linux/pid.h>
  #include <linux/clocksource.h>
  
  #include <asm-ia64/processor.h>
@@@ -34,23 -35,23 +35,29 @@@ void foo(void
        DEFINE(SIGFRAME_SIZE, sizeof (struct sigframe));
        DEFINE(UNW_FRAME_INFO_SIZE, sizeof (struct unw_frame_info));
  
+       BUILD_BUG_ON(sizeof(struct upid) != 32);
+       DEFINE(IA64_UPID_SHIFT, 5);
        BLANK();
  
        DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
        DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
        DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
 +#ifdef CONFIG_VIRT_CPU_ACCOUNTING
 +      DEFINE(TI_AC_STAMP, offsetof(struct thread_info, ac_stamp));
 +      DEFINE(TI_AC_LEAVE, offsetof(struct thread_info, ac_leave));
 +      DEFINE(TI_AC_STIME, offsetof(struct thread_info, ac_stime));
 +      DEFINE(TI_AC_UTIME, offsetof(struct thread_info, ac_utime));
 +#endif
  
        BLANK();
  
        DEFINE(IA64_TASK_BLOCKED_OFFSET,offsetof (struct task_struct, blocked));
        DEFINE(IA64_TASK_CLEAR_CHILD_TID_OFFSET,offsetof (struct task_struct, clear_child_tid));
        DEFINE(IA64_TASK_GROUP_LEADER_OFFSET, offsetof (struct task_struct, group_leader));
+       DEFINE(IA64_TASK_TGIDLINK_OFFSET, offsetof (struct task_struct, pids[PIDTYPE_PID].pid));
+       DEFINE(IA64_PID_LEVEL_OFFSET, offsetof (struct pid, level));
+       DEFINE(IA64_PID_UPID_OFFSET, offsetof (struct pid, numbers[0]));
        DEFINE(IA64_TASK_PENDING_OFFSET,offsetof (struct task_struct, pending));
        DEFINE(IA64_TASK_PID_OFFSET, offsetof (struct task_struct, pid));
        DEFINE(IA64_TASK_REAL_PARENT_OFFSET, offsetof (struct task_struct, real_parent));
diff --combined arch/ia64/kernel/fsys.S
index 357b7e2adc63b52901f3cfe34dbe40d1c79057c4,3f570e6fcd9c5fdb9a3dadc65c8cf92404a5dfe5..c1625c7e17795b093acd281eb7d2a56fd1a6be47
@@@ -61,13 -61,29 +61,29 @@@ ENTRY(fsys_getpid
        .prologue
        .altrp b6
        .body
+       add r17=IA64_TASK_GROUP_LEADER_OFFSET,r16
+       ;;
+       ld8 r17=[r17]                           // r17 = current->group_leader
        add r9=TI_FLAGS+IA64_TASK_SIZE,r16
        ;;
        ld4 r9=[r9]
-       add r8=IA64_TASK_TGID_OFFSET,r16
+       add r17=IA64_TASK_TGIDLINK_OFFSET,r17
        ;;
        and r9=TIF_ALLWORK_MASK,r9
-       ld4 r8=[r8]                             // r8 = current->tgid
+       ld8 r17=[r17]                           // r17 = current->group_leader->pids[PIDTYPE_PID].pid
+       ;;
+       add r8=IA64_PID_LEVEL_OFFSET,r17
+       ;;
+       ld4 r8=[r8]                             // r8 = pid->level
+       add r17=IA64_PID_UPID_OFFSET,r17        // r17 = &pid->numbers[0]
+       ;;
+       shl r8=r8,IA64_UPID_SHIFT
+       ;;
+       add r17=r17,r8                          // r17 = &pid->numbers[pid->level]
+       ;;
+       ld4 r8=[r17]                            // r8 = pid->numbers[pid->level].nr
+       ;;
+       mov r17=0
        ;;
        cmp.ne p8,p0=0,r9
  (p8)  br.spnt.many fsys_fallback_syscall
@@@ -126,15 -142,25 +142,25 @@@ ENTRY(fsys_set_tid_address
        .altrp b6
        .body
        add r9=TI_FLAGS+IA64_TASK_SIZE,r16
+       add r17=IA64_TASK_TGIDLINK_OFFSET,r16
        ;;
        ld4 r9=[r9]
        tnat.z p6,p7=r32                // check argument register for being NaT
+       ld8 r17=[r17]                           // r17 = current->pids[PIDTYPE_PID].pid
        ;;
        and r9=TIF_ALLWORK_MASK,r9
-       add r8=IA64_TASK_PID_OFFSET,r16
+       add r8=IA64_PID_LEVEL_OFFSET,r17
        add r18=IA64_TASK_CLEAR_CHILD_TID_OFFSET,r16
        ;;
-       ld4 r8=[r8]
+       ld4 r8=[r8]                             // r8 = pid->level
+       add r17=IA64_PID_UPID_OFFSET,r17        // r17 = &pid->numbers[0]
+       ;;
+       shl r8=r8,IA64_UPID_SHIFT
+       ;;
+       add r17=r17,r8                          // r17 = &pid->numbers[pid->level]
+       ;;
+       ld4 r8=[r17]                            // r8 = pid->numbers[pid->level].nr
+       ;;
        cmp.ne p8,p0=0,r9
        mov r17=-1
        ;;
@@@ -210,25 -236,27 +236,25 @@@ ENTRY(fsys_gettimeofday
        // Note that instructions are optimized for McKinley. McKinley can
        // process two bundles simultaneously and therefore we continuously
        // try to feed the CPU two bundles and then a stop.
 -      //
 -      // Additional note that code has changed a lot. Optimization is TBD.
 -      // Comments begin with "?" are maybe outdated.
 -      tnat.nz p6,p0 = r31     // ? branch deferred to fit later bundle
 -      mov pr = r30,0xc000     // Set predicates according to function
 +
        add r2 = TI_FLAGS+IA64_TASK_SIZE,r16
 +      tnat.nz p6,p0 = r31             // guard against Nat argument
 +(p6)  br.cond.spnt.few .fail_einval
        movl r20 = fsyscall_gtod_data // load fsyscall gettimeofday data address
        ;;
 +      ld4 r2 = [r2]                   // process work pending flags
        movl r29 = itc_jitter_data      // itc_jitter
        add r22 = IA64_GTOD_WALL_TIME_OFFSET,r20        // wall_time
 -      ld4 r2 = [r2]           // process work pending flags
 -      ;;
 -(p15) add r22 = IA64_GTOD_MONO_TIME_OFFSET,r20        // monotonic_time
        add r21 = IA64_CLKSRC_MMIO_OFFSET,r20
 -      add r19 = IA64_ITC_LASTCYCLE_OFFSET,r29
 +      mov pr = r30,0xc000     // Set predicates according to function
 +      ;;
        and r2 = TIF_ALLWORK_MASK,r2
 -(p6)    br.cond.spnt.few .fail_einval // ? deferred branch
 +      add r19 = IA64_ITC_LASTCYCLE_OFFSET,r29
 +(p15) add r22 = IA64_GTOD_MONO_TIME_OFFSET,r20        // monotonic_time
        ;;
 -      add r26 = IA64_CLKSRC_CYCLE_LAST_OFFSET,r20 // clksrc_cycle_last
 +      add r26 = IA64_CLKSRC_CYCLE_LAST_OFFSET,r20     // clksrc_cycle_last
        cmp.ne p6, p0 = 0, r2   // Fallback if work is scheduled
 -(p6)    br.cond.spnt.many fsys_fallback_syscall
 +(p6)  br.cond.spnt.many fsys_fallback_syscall
        ;;
        // Begin critical section
  .time_redo:
  (p8)  mov r2 = ar.itc         // CPU_TIMER. 36 clocks latency!!!
  (p9)  ld8 r2 = [r30]          // MMIO_TIMER. Could also have latency issues..
  (p13) ld8 r25 = [r19]         // get itc_lastcycle value
 -      ;;              // ? could be removed by moving the last add upward
        ld8 r9 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET     // tv_sec
        ;;
        ld8 r8 = [r22],-IA64_TIMESPEC_TV_NSEC_OFFSET    // tv_nsec
  EX(.fail_efault, probe.w.fault r31, 3)
        xmpy.l f8 = f8,f7       // nsec_per_cyc*(counter-last_counter)
        ;;
 -      // ? simulate tbit.nz.or p7,p0 = r28,0
        getf.sig r2 = f8
        mf
        ;;
        ld4 r10 = [r20]         // gtod_lock.sequence
        shr.u r2 = r2,r23       // shift by factor
 -      ;;              // ? overloaded 3 bundles!
 +      ;;
        add r8 = r8,r2          // Add xtime.nsecs
        cmp4.ne p7,p0 = r28,r10
  (p7)  br.cond.dpnt.few .time_redo     // sequence number changed, redo
  EX(.fail_efault, probe.w.fault r23, 3)        // This also costs 5 cycles
  (p14) xmpy.hu f8 = f8, f7             // xmpy has 5 cycles latency so use it
        ;;
 -      mov r8 = r0
  (p14) getf.sig r2 = f8
        ;;
 +      mov r8 = r0
  (p14) shr.u r21 = r2, 4
        ;;
  EX(.fail_efault, st8 [r31] = r9)
@@@ -656,11 -686,7 +682,11 @@@ GLOBAL_ENTRY(fsys_bubble_down
        nop.i 0
        ;;
        mov ar.rsc=0                            // M2   set enforced lazy mode, pl 0, LE, loadrs=0
 +#ifdef CONFIG_VIRT_CPU_ACCOUNTING
 +      mov.m r30=ar.itc                        // M    get cycle for accounting
 +#else
        nop.m 0
 +#endif
        nop.i 0
        ;;
        mov r23=ar.bspstore                     // M2 (12 cyc) save ar.bspstore
        cmp.ne pKStk,pUStk=r0,r0                // A    set pKStk <- 0, pUStk <- 1
        br.call.sptk.many b7=ia64_syscall_setup // B
        ;;
 +#ifdef CONFIG_VIRT_CPU_ACCOUNTING
 +      // mov.m r30=ar.itc is called in advance
 +      add r16=TI_AC_STAMP+IA64_TASK_SIZE,r2
 +      add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r2
 +      ;;
 +      ld8 r18=[r16],TI_AC_STIME-TI_AC_STAMP   // time at last check in kernel
 +      ld8 r19=[r17],TI_AC_UTIME-TI_AC_LEAVE   // time at leave kernel
 +      ;;
 +      ld8 r20=[r16],TI_AC_STAMP-TI_AC_STIME   // cumulated stime
 +      ld8 r21=[r17]                           // cumulated utime
 +      sub r22=r19,r18                         // stime before leave kernel
 +      ;;
 +      st8 [r16]=r30,TI_AC_STIME-TI_AC_STAMP   // update stamp
 +      sub r18=r30,r19                         // elapsed time in user mode
 +      ;;
 +      add r20=r20,r22                         // sum stime
 +      add r21=r21,r18                         // sum utime
 +      ;;
 +      st8 [r16]=r20                           // update stime
 +      st8 [r17]=r21                           // update utime
 +      ;;
 +#endif
        mov ar.rsc=0x3                          // M2   set eager mode, pl 0, LE, loadrs=0
        mov rp=r14                              // I0   set the real return addr
        and r3=_TIF_SYSCALL_TRACEAUDIT,r3       // A
diff --combined arch/ia64/kernel/mca.c
index 607006a6a976750d4b050b3032b77d52940ad946,1ae512910870da963c3cfe6fe9695dd443bf821d..e51bced3b0fad2b6bbbb050cc0ac828ba6b68c15
@@@ -69,6 -69,7 +69,7 @@@
   * 2007-04-27 Russ Anderson <rja@sgi.com>
   *          Support multiple cpus going through OS_MCA in the same event.
   */
+ #include <linux/jiffies.h>
  #include <linux/types.h>
  #include <linux/init.h>
  #include <linux/sched.h>
@@@ -97,7 -98,6 +98,7 @@@
  
  #include <asm/irq.h>
  #include <asm/hw_irq.h>
 +#include <asm/tlb.h>
  
  #include "mca_drv.h"
  #include "entry.h"
@@@ -113,7 -113,6 +114,7 @@@ DEFINE_PER_CPU(u64, ia64_mca_data); /* 
  DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */
  DEFINE_PER_CPU(u64, ia64_mca_pal_pte);            /* PTE to map PAL code */
  DEFINE_PER_CPU(u64, ia64_mca_pal_base);    /* vaddr PAL code granule */
 +DEFINE_PER_CPU(u64, ia64_mca_tr_reload);   /* Flag for TR reload */
  
  unsigned long __per_cpu_mca[NR_CPUS];
  
@@@ -295,7 -294,8 +296,8 @@@ static void ia64_mlogbuf_dump_from_init
        if (mlogbuf_finished)
                return;
  
-       if (mlogbuf_timestamp && (mlogbuf_timestamp + 30*HZ > jiffies)) {
+       if (mlogbuf_timestamp &&
+                       time_before(jiffies, mlogbuf_timestamp + 30 * HZ)) {
                printk(KERN_ERR "INIT: mlogbuf_dump is interrupted by INIT "
                        " and the system seems to be messed up.\n");
                ia64_mlogbuf_finish(0);
@@@ -1184,49 -1184,6 +1186,49 @@@ all_in
        return;
  }
  
 +/*  mca_insert_tr
 + *
 + *  Switch rid when TR reload and needed!
 + *  iord: 1: itr, 2: itr;
 + *
 +*/
 +static void mca_insert_tr(u64 iord)
 +{
 +
 +      int i;
 +      u64 old_rr;
 +      struct ia64_tr_entry *p;
 +      unsigned long psr;
 +      int cpu = smp_processor_id();
 +
 +      psr = ia64_clear_ic();
 +      for (i = IA64_TR_ALLOC_BASE; i < IA64_TR_ALLOC_MAX; i++) {
 +              p = &__per_cpu_idtrs[cpu][iord-1][i];
 +              if (p->pte & 0x1) {
 +                      old_rr = ia64_get_rr(p->ifa);
 +                      if (old_rr != p->rr) {
 +                              ia64_set_rr(p->ifa, p->rr);
 +                              ia64_srlz_d();
 +                      }
 +                      ia64_ptr(iord, p->ifa, p->itir >> 2);
 +                      ia64_srlz_i();
 +                      if (iord & 0x1) {
 +                              ia64_itr(0x1, i, p->ifa, p->pte, p->itir >> 2);
 +                              ia64_srlz_i();
 +                      }
 +                      if (iord & 0x2) {
 +                              ia64_itr(0x2, i, p->ifa, p->pte, p->itir >> 2);
 +                              ia64_srlz_i();
 +                      }
 +                      if (old_rr != p->rr) {
 +                              ia64_set_rr(p->ifa, old_rr);
 +                              ia64_srlz_d();
 +                      }
 +              }
 +      }
 +      ia64_set_psr(psr);
 +}
 +
  /*
   * ia64_mca_handler
   *
@@@ -1311,20 -1268,12 +1313,17 @@@ ia64_mca_handler(struct pt_regs *regs, 
        } else {
                /* Dump buffered message to console */
                ia64_mlogbuf_finish(1);
- #ifdef CONFIG_KEXEC
-               atomic_set(&kdump_in_progress, 1);
-               monarch_cpu = -1;
- #endif
        }
 +      if (__get_cpu_var(ia64_mca_tr_reload)) {
 +              mca_insert_tr(0x1); /*Reload dynamic itrs*/
 +              mca_insert_tr(0x2); /*Reload dynamic itrs*/
 +      }
++
        if (notify_die(DIE_MCA_MONARCH_LEAVE, "MCA", regs, (long)&nd, 0, recover)
                        == NOTIFY_STOP)
                ia64_mca_spin(__func__);
  
        if (atomic_dec_return(&mca_count) > 0) {
                int i;
  
diff --combined arch/ia64/kernel/setup.c
index b86a072418a2562f3aa4447ffc49bbf11a4523da,c85b7dd6ef338d408f785beeb27166d35a040ac2..5015ca1275ca0520f4e0530e94fd57eae9b7cbef
@@@ -59,7 -59,6 +59,7 @@@
  #include <asm/setup.h>
  #include <asm/smp.h>
  #include <asm/system.h>
 +#include <asm/tlbflush.h>
  #include <asm/unistd.h>
  #include <asm/hpsim.h>
  
@@@ -177,6 -176,29 +177,29 @@@ filter_rsvd_memory (unsigned long start
        return 0;
  }
  
+ /*
+  * Similar to "filter_rsvd_memory()", but the reserved memory ranges
+  * are not filtered out.
+  */
+ int __init
+ filter_memory(unsigned long start, unsigned long end, void *arg)
+ {
+       void (*func)(unsigned long, unsigned long, int);
+ #if IGNORE_PFN0
+       if (start == PAGE_OFFSET) {
+               printk(KERN_WARNING "warning: skipping physical page 0\n");
+               start += PAGE_SIZE;
+               if (start >= end)
+                       return 0;
+       }
+ #endif
+       func = arg;
+       if (start < end)
+               call_pernode_memory(__pa(start), end - start, func);
+       return 0;
+ }
  static void __init
  sort_regions (struct rsvd_region *rsvd_region, int max)
  {
@@@ -494,8 -516,6 +517,8 @@@ setup_arch (char **cmdline_p
        acpi_table_init();
  # ifdef CONFIG_ACPI_NUMA
        acpi_numa_init();
 +      per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) == 0 ?
 +              32 : cpus_weight(early_cpu_possible_map)), additional_cpus);
  # endif
  #else
  # ifdef CONFIG_SMP
@@@ -949,10 -969,9 +972,10 @@@ cpu_init (void
  #endif
  
        /* set ia64_ctx.max_rid to the maximum RID that is supported by all CPUs: */
 -      if (ia64_pal_vm_summary(NULL, &vmi) == 0)
 +      if (ia64_pal_vm_summary(NULL, &vmi) == 0) {
                max_ctx = (1U << (vmi.pal_vm_info_2_s.rid_size - 3)) - 1;
 -      else {
 +              setup_ptcg_sem(vmi.pal_vm_info_2_s.max_purges, NPTCG_FROM_PAL);
 +      } else {
                printk(KERN_WARNING "cpu_init: PAL VM summary failed, assuming 18 RID bits\n");
                max_ctx = (1U << 15) - 1;       /* use architected minimum */
        }
diff --combined arch/ia64/mm/discontig.c
index 6136a4c6df11dddf90560eaf13f93537216685f3,96d5fbfa44a4b201dbb4c101ae422aa3263c0908..544dc420c65ed06cf00f043c10f041c70ea87633
@@@ -104,7 -104,7 +104,7 @@@ static int __meminit early_nr_cpus_node
  {
        int cpu, n = 0;
  
 -      for (cpu = 0; cpu < NR_CPUS; cpu++)
 +      for_each_possible_early_cpu(cpu)
                if (node == node_cpuid[cpu].nid)
                        n++;
  
@@@ -124,7 -124,6 +124,7 @@@ static unsigned long __meminit compute_
        pernodesize += node * L1_CACHE_BYTES;
        pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
        pernodesize += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
 +      pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
        pernodesize = PAGE_ALIGN(pernodesize);
        return pernodesize;
  }
@@@ -143,7 -142,7 +143,7 @@@ static void *per_cpu_node_setup(void *c
  #ifdef CONFIG_SMP
        int cpu;
  
 -      for (cpu = 0; cpu < NR_CPUS; cpu++) {
 +      for_each_possible_early_cpu(cpu) {
                if (node == node_cpuid[cpu].nid) {
                        memcpy(__va(cpu_data), __phys_per_cpu_start,
                               __per_cpu_end - __per_cpu_start);
@@@ -346,7 -345,7 +346,7 @@@ static void __init initialize_pernode_d
  
  #ifdef CONFIG_SMP
        /* Set the node_data pointer for each per-cpu struct */
 -      for (cpu = 0; cpu < NR_CPUS; cpu++) {
 +      for_each_possible_early_cpu(cpu) {
                node = node_cpuid[cpu].nid;
                per_cpu(cpu_info, cpu).node_data = mem_data[node].node_data;
        }
@@@ -445,7 -444,7 +445,7 @@@ void __init find_memory(void
                        mem_data[node].min_pfn = ~0UL;
                }
  
-       efi_memmap_walk(register_active_ranges, NULL);
+       efi_memmap_walk(filter_memory, register_active_ranges);
  
        /*
         * Initialize the boot memory maps in reverse order since that's
@@@ -494,9 -493,13 +494,9 @@@ void __cpuinit *per_cpu_init(void
        int cpu;
        static int first_time = 1;
  
 -
 -      if (smp_processor_id() != 0)
 -              return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
 -
        if (first_time) {
                first_time = 0;
 -              for (cpu = 0; cpu < NR_CPUS; cpu++)
 +              for_each_possible_early_cpu(cpu)
                        per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
        }
  
@@@ -519,8 -522,6 +519,6 @@@ void show_mem(void
  
        printk(KERN_INFO "Mem-info:\n");
        show_free_areas();
-       printk(KERN_INFO "Free swap:       %6ldkB\n",
-              nr_swap_pages<<(PAGE_SHIFT-10));
        printk(KERN_INFO "Node memory in pages:\n");
        for_each_online_pgdat(pgdat) {
                unsigned long present;