1. 19 2月, 2011 3 次提交
    • T
      genirq: Protect tglx from tripping over his own feet · e6bea9c4
      Thomas Gleixner 提交于
      The irq_desc.status field will either go away or renamed to
      settings. Anyway we need to maintain compatibility to avoid breaking
      the world and some more. While moving bits into the core, I need to
      avoid that I use any of the still existing IRQ_ bits in the core code
      by typos. So that file will hold the inline wrappers and some nasty
      CPP tricks to break the build when typoed.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      e6bea9c4
    • T
      genirq: Make nr_irqs runtime expandable · e7bcecb7
      Thomas Gleixner 提交于
      We face more and more the requirement to expand nr_irqs at
      runtime. The reason are irq expanders which can not be detected in the
      early boot stage. So we speculate nr_irqs to have enough room. Further
      Xen needs extra irq numbers and we really want to avoid adding more
      "detection" code into the early boot. There is no real good reason why
      we need to limit nr_irqs at early boot.
      
      Allow the allocation code to expand nr_irqs. We have already 8k extra
      number space in the allocation bitmap, so lets use it.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      e7bcecb7
    • T
      genirq: Prevent access beyond allocated_irqs bitmap · c1ee6264
      Thomas Gleixner 提交于
      Lars-Peter Clausen pointed out:
      
         I stumbled upon this while looking through the existing archs using
         SPARSE_IRQ.  Even with SPARSE_IRQ the NR_IRQS is still the upper
         limit for the number of IRQs.
      
         Both PXA and MMP set NR_IRQS to IRQ_BOARD_START, with
         IRQ_BOARD_START being the number of IRQs used by the core.
      
         In various machine files the nr_irqs field of the ARM machine
         defintion struct is then set to "IRQ_BOARD_START + NR_BOARD_IRQS".
      
         As a result "nr_irqs" will greater then NR_IRQS which then again
         causes the "allocated_irqs" bitmap in the core irq code to be
         accessed beyond its size overwriting unrelated data.
      
      The core code really misses a sanity check there.
      
      This went unnoticed so far as by chance the compiler/linker places
      data behind that bitmap which gets initialized later on those affected
      platforms.
      
      So the obvious fix would be to add a sanity check in early_irq_init()
      and break all affected platforms. Though that check wants to be
      backported to stable as well, which will require to fix all known
      problematic platforms and probably some more yet not known ones as
      well. Lots of churn.
      
      A way simpler solution is to allocate a slightly larger bitmap and
      avoid the whole churn w/o breaking anything. Add a few warnings when
      an arch returns utter crap.
      Reported-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable@kernel.org # .37
      Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
      Cc: Eric Miao <eric.y.miao@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      c1ee6264
  2. 09 2月, 2011 1 次提交
  3. 14 1月, 2011 1 次提交
    • E
      irq: use per_cpu kstat_irqs · 6c9ae009
      Eric Dumazet 提交于
      Use modern per_cpu API to increment {soft|hard}irq counters, and use
      per_cpu allocation for (struct irq_desc)->kstats_irq instead of an array.
      
      This gives better SMP/NUMA locality and saves few instructions per irq.
      
      With small nr_cpuids values (8 for example), kstats_irq was a small array
      (less than L1_CACHE_BYTES), potentially source of false sharing.
      
      In the !CONFIG_SPARSE_IRQ case, remove the huge, NUMA/cache unfriendly
      kstat_irqs_all[NR_IRQS][NR_CPUS] array.
      
      Note: we still populate kstats_irq for all possible irqs in
      early_irq_init().  We probably could use on-demand allocations.  (Code
      included in alloc_descs()).  Problem is not all IRQS are used with a prior
      alloc_descs() call.
      
      kstat_irqs_this_cpu() is not used anymore, remove it.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Reviewed-by: NChristoph Lameter <cl@linux.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6c9ae009
  4. 28 10月, 2010 1 次提交
    • K
      /proc/stat: fix scalability of irq sum of all cpu · 478735e3
      KAMEZAWA Hiroyuki 提交于
      In /proc/stat, the number of per-IRQ event is shown by making a sum each
      irq's events on all cpus.  But we can make use of kstat_irqs().
      
      kstat_irqs() do the same calculation, If !CONFIG_GENERIC_HARDIRQ,
      it's not a big cost. (Both of the number of cpus and irqs are small.)
      
      If a system is very big and CONFIG_GENERIC_HARDIRQ, it does
      
      	for_each_irq()
      		for_each_cpu()
      			- look up a radix tree
      			- read desc->irq_stat[cpu]
      This seems not efficient. This patch adds kstat_irqs() for
      CONFIG_GENRIC_HARDIRQ and change the calculation as
      
      	for_each_irq()
      		look up radix tree
      		for_each_cpu()
      			- read desc->irq_stat[cpu]
      
      This reduces cost.
      
      A test on (4096cpusp, 256 nodes, 4592 irqs) host (by Jack Steiner)
      
      %time cat /proc/stat > /dev/null
      
      Before Patch:	 2.459 sec
      After Patch :	  .561 sec
      
      [akpm@linux-foundation.org: unexport kstat_irqs, coding-style tweaks]
      [akpm@linux-foundation.org: fix unused variable 'per_irq_sum']
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Tested-by: NJack Steiner <steiner@sgi.com>
      Acked-by: NJack Steiner <steiner@sgi.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      478735e3
  5. 13 10月, 2010 1 次提交
  6. 12 10月, 2010 15 次提交