1. 06 11月, 2013 20 次提交
    • V
      ARC: [SMP] TLB flush · 5ea72a90
      Vineet Gupta 提交于
      - Add mm_cpumask setting (aggregating only, unlike some other arches)
        used to restrict the TLB flush cross-calling
      
      - cross-calling versions of TLB flush routines (thanks to Noam)
      Signed-off-by: NNoam Camus <noamc@ezchip.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      5ea72a90
    • V
      ARC: [SMP] ASID allocation · 63eca94c
      Vineet Gupta 提交于
      -Track a Per CPU ASID counter
      -mm-per-cpu ASID (multiple threads, or mm migrated around)
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      63eca94c
    • C
      arc: export symbol for pm_power_off in reset.c · b6fe8e7c
      Chen Gang 提交于
      Need export symbol for it, or can not pass compiling, the related error
      with allmodconfig:
      
          MODPOST 2994 modules
        ERROR: "pm_power_off" [drivers/mfd/retu-mfd.ko] undefined!
        ERROR: "pm_power_off" [drivers/char/ipmi/ipmi_poweroff.ko] undefined!
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      b6fe8e7c
    • C
      arc: export symbol for save_stack_trace() in stacktrace.c · 8f146d02
      Chen Gang 提交于
      Need export its symbol just like other architectures done, or can not
      pass compiling with allmodconfig, the related error:
      
          MODPOST 2994 modules
        ERROR: "save_stack_trace" [kernel/backtracetest.ko] undefined!
        ERROR: "save_stack_trace" [drivers/md/persistent-data/dm-persistent-data.ko] undefined!
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      8f146d02
    • C
      arc: remove '__init' for get_hw_config_num_irq() · 4782f7f9
      Chen Gang 提交于
      get_hw_config_num_irq() may be called by normal iss_model_init_smp()
      which is a function pointer for 'init_smp' which may be called by
      first_lines_of_secondary() which also need be normal too.
      
      The related warning (with allmodconfig):
      
          MODPOST vmlinux.o
        WARNING: vmlinux.o(.text+0x5814): Section mismatch in reference from the function iss_model_init_smp() to the function .init.text:get_hw_config_num_irq()
        The function iss_model_init_smp() references
        the function __init get_hw_config_num_irq().
        This is often because iss_model_init_smp lacks a __init
        annotation or the annotation of get_hw_config_num_irq is wrong.
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      4782f7f9
    • C
      arc: remove '__init' for first_lines_of_secondary() · 8f5d221b
      Chen Gang 提交于
      first_lines_of_secondary() is a '__init' function, but it may be called
      by __cpu_up() by _cpu_up() by cpu_up() which is a normal export symbol
      function. So recommend to remove '__init'.
      
      The related warning (with allmodconfig):
      
          MODPOST vmlinux.o
        WARNING: vmlinux.o(.text+0x315c): Section mismatch in reference from the function __cpu_up() to the function .init.text:first_lines_of_secondary()
        The function __cpu_up() references
        the function __init first_lines_of_secondary().
        This is often because __cpu_up lacks a __init
        annotation or the annotation of first_lines_of_secondary is wrong.
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      8f5d221b
    • C
      arc: remove '__init' for setup_processor() and arc_init_IRQ() · ef3a661a
      Chen Gang 提交于
      They haven't '__init' in definition, but has '__init' in declaration.
      And normal function start_kernel_secondary() may call setup_processor()
      which will call arc_init_IRQ().
      
      So need remove '__init' for both of them. The related warning (with
      allmodconfig):
      
          MODPOST vmlinux.o
        WARNING: vmlinux.o(.text+0x3084): Section mismatch in reference from the function start_kernel_secondary() to the function .init.text:setup_processor()
        The function start_kernel_secondary() references
        the function __init setup_processor().
        This is often because start_kernel_secondary lacks a __init
        annotation or the annotation of setup_processor is wrong.
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      ef3a661a
    • C
      arc: kgdb: add default implementation for kgdb_roundup_cpus() · 3d01c1ce
      Chen Gang 提交于
      arc supports kgdb, but need update -- add function kgdb_roundup_cpus(),
      or can not pass compiling. At present, add the simple generic one just
      like other architectures(e.g. tile, mips ...).
      
      The related error (with allmodconfig):
      
        kernel/built-in.o: In function `kgdb_cpu_enter':
        kernel/debug/debug_core.c:580: undefined reference to `kgdb_roundup_cpus'
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      3d01c1ce
    • V
      ARC: Fix bogus gcc warning and micro-optimise TLB iteration loop · 0a4c40a3
      Vineet Gupta 提交于
      ```--------------->8----------------------
      arch/arc/mm/tlb.c: In function ‘do_tlb_overlap_fault’:
      arch/arc/mm/tlb.c:688:13: warning: array subscript is above array bounds
      [-Warray-bounds]
               (pd0[n] & PAGE_MASK)) {
                   ^
      ```
      
      --------------->8----------------------
      
      While at it, remove the usless last iteration of outer loop when reading
      a TLB SET for duplicate entries.
      Suggested-by: NMischa Jonker <mjonker@synopsys.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      0a4c40a3
    • V
      ARC: Add support for irqflags tracing and lockdep · 0dafafc3
      Vineet Gupta 提交于
      Lockdep required a small fix to stacktrace API which was incorrectly
      unwindign out of __switch_to for the current call frame.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      0dafafc3
    • V
      ARC: Reset the value of Interrupt Priority Register · 54c8bff1
      Vineet Gupta 提交于
      In case bootloader has changed the priority of one/more IRQ lines
      Reported-by: NNoam Camus <noamc@ezchip.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      54c8bff1
    • V
      ARC: Reduce #ifdef'ery for unaligned access emulation · 07ba69a4
      Vineet Gupta 提交于
      Emulation not enabled is treated as if the fixup failed, so no need for
      special #ifdef checks.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      07ba69a4
    • V
      ARC: Change calling convention of do_page_fault() · 21a63b56
      Vineet Gupta 提交于
      switch the args (address, pt_regs) to match with all the other "C"
      exception handlers.
      
      This removes the awkwardness in EV_ProtV for page fault vs. unaligned
      access.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      21a63b56
    • V
      ARC: cacheflush optim - PTAG can be loop invariant if V-P is const · d4599baf
      Vineet Gupta 提交于
      Line op needs vaddr (indexing) and paddr (tag match). For page sized
      flushes (V-P const), each line op will need a different index, but the
      tag bits wil remain constant, hence paddr can be setup once outside the
      loop.
      
      This improves select LMBench numbers for Aliasing dcache where we have
      more "preventive" cache flushing.
      
      Processor, Processes - times in microseconds - smaller is better
      ------------------------------------------------------------------------------
      Host                 OS  Mhz null null      open slct sig  sig  fork exec sh
                                   call  I/O stat clos TCP  inst hndl proc proc proc
      --------- ------------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
      3.11-rc7- Linux 3.11.0-   80 4.66 8.88 69.7 112. 268. 8.60 28.0 3489 13.K 27.K	# Non alias ARC700
      3.11-rc7- Linux 3.11.0-   80 4.64 8.51 68.6 98.5 271. 8.58 28.1 4160 15.K 32.K	# Aliasing
      3.11-rc7- Linux 3.11.0-   80 4.64 8.51 69.8 99.4 270. 8.73 27.5 3880 15.K 31.K	# PTAG loop Inv
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      d4599baf
    • V
      ARC: cacheflush refactor #3: Unify the {d,i}cache flush leaf helpers · bd12976c
      Vineet Gupta 提交于
      With Line length being constant now, we can fold the 2 helpers into 1.
      This allows applying any optimizations (forthcoming) to single place.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      bd12976c
    • V
      ARC: cacheflush refactor #2: I and D caches lines to have same size · 63d2dfdb
      Vineet Gupta 提交于
      Having them be different seems an obscure configuration.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      63d2dfdb
    • V
      ARC: cacheflush refactor #1: push aux reg ascertaining into leaf routine · f3e4de32
      Vineet Gupta 提交于
      ARC dcache supports 3 ops - Inv, Flush, Flush-n-Inv.
      The programming model however provides 2 commands FLUSH, INV.
      INV will either discard or flush-n-discard (based on DT_CTRL bit)
      
      The leaf helper __dc_line_loop() used to take the AUX register
      (corresponding to the 2 commands). Now we push that to within the
      helper, paving way for code consolidations to follow.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      f3e4de32
    • V
      ARC: use __weak instead of __attribute__((weak)) · 064a6269
      Vineet Gupta 提交于
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      064a6269
    • V
      ARC: Annotate some functions as static · 8e457d6a
      Vineet Gupta 提交于
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      8e457d6a
    • C
      arc: Replace __get_cpu_var uses · 6855e95c
      Christoph Lameter 提交于
      __get_cpu_var() is used for multiple purposes in the kernel source. One of them is
      address calculation via the form &__get_cpu_var(x). This calculates the address for
      the instance of the percpu variable of the current processor based on an offset.
      
      Other use cases are for storing and retrieving data from the current processors percpu area.
      __get_cpu_var() can be used as an lvalue when writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store and retrieve operations
      could use a segment prefix (or global register on other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a percpu area and use
      optimized assembly code to read and write per cpu variables.
      
      This patch converts __get_cpu_var into either an explicit address calculation using this_cpu_ptr()
      or into a use of this_cpu operations that use the offset. Thereby address calcualtions are avoided
      and less registers are used when code is generated.
      
      At the end of the patchset all uses of __get_cpu_var have been removed so the macro is removed too.
      
      The patchset includes passes over all arches as well. Once these operations are used throughout then
      specialized macros can be defined in non -x86 arches as well in order to optimize per cpu access by
      f.e. using a global register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu variable.
      
      	DEFINE_PER_CPU(int, u);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(this_cpu_ptr(&x), y, sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	this_cpu_inc(y)
      Acked-by: NVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: NChristoph Lameter <cl@linux.com>
      6855e95c
  2. 03 11月, 2013 1 次提交
    • V
      ARC: Incorrect mm reference used in vmalloc fault handler · 9c41f4ee
      Vineet Gupta 提交于
      A vmalloc fault needs to sync up PGD/PTE entry from init_mm to current
      task's "active_mm".  ARC vmalloc fault handler however was using mm.
      
      A vmalloc fault for non user task context (actually pre-userland, from
      init thread's open for /dev/console) caused the handler to deref NULL mm
      (for mm->pgd)
      
      The reasons it worked so far is amazing:
      
      1. By default (!SMP), vmalloc fault handler uses a cached value of PGD.
         In SMP that MMU register is repurposed hence need for mm pointer deref.
      
      2. In pre-3.12 SMP kernel, the problem triggering vmalloc didn't exist in
         pre-userland code path - it was introduced with commit 20bafb3d
         "n_tty: Move buffers into n_tty_data"
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Cc: Gilad Ben-Yossef <gilad@benyossef.com>
      Cc: Noam Camus <noamc@ezchip.com>
      Cc: stable@vger.kernel.org    #3.10 and 3.11
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9c41f4ee
  3. 12 10月, 2013 1 次提交
    • V
      ARC: Ignore ptrace SETREGSET request for synthetic register "stop_pc" · 5b242828
      Vineet Gupta 提交于
      ARCompact TRAP_S insn used for breakpoints, commits before exception is
      taken (updating architectural PC). So ptregs->ret contains next-PC and
      not the breakpoint PC itself. This is different from other restartable
      exceptions such as TLB Miss where ptregs->ret has exact faulting PC.
      gdb needs to know exact-PC hence ARC ptrace GETREGSET provides for
      @stop_pc which returns ptregs->ret vs. EFA depending on the
      situation.
      
      However, writing stop_pc (SETREGSET request), which updates ptregs->ret
      doesn't makes sense stop_pc doesn't always correspond to that reg as
      described above.
      
      This was not an issue so far since user_regs->ret / user_regs->stop_pc
      had same value and both writing to ptregs->ret was OK, needless, but NOT
      broken, hence not observed.
      
      With gdb "jump", they diverge, and user_regs->ret updating ptregs is
      overwritten immediately with stop_pc, which this patch fixes.
      Reported-by: NAnton Kolesov <akolesov@synopsys.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      5b242828
  4. 03 10月, 2013 1 次提交
  5. 27 9月, 2013 4 次提交
    • U
      ARC: Use clockevents_config_and_register over clockevents_register_device · 55c2e262
      Uwe Kleine-König 提交于
      clockevents_config_and_register is more clever and correct than doing it
      by hand; so use it.
      
      [vgupta: fixed build failure due to missing ; in patch]
      Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      55c2e262
    • V
      ARC: Workaround spinlock livelock in SMP SystemC simulation · 6c00350b
      Vineet Gupta 提交于
      Some ARC SMP systems lack native atomic R-M-W (LLOCK/SCOND) insns and
      can only use atomic EX insn (reg with mem) to build higher level R-M-W
      primitives. This includes a SystemC based SMP simulation model.
      
      So rwlocks need to use a protecting spinlock for atomic cmp-n-exchange
      operation to update reader(s)/writer count.
      
      The spinlock operation itself looks as follows:
      
      	mov reg, 1		; 1=locked, 0=unlocked
      retry:
      	EX reg, [lock]		; load existing, store 1, atomically
      	BREQ reg, 1, rety	; if already locked, retry
      
      In single-threaded simulation, SystemC alternates between the 2 cores
      with "N" insn each based scheduling. Additionally for insn with global
      side effect, such as EX writing to shared mem, a core switch is
      enforced too.
      
      Given that, 2 cores doing a repeated EX on same location, Linux often
      got into a livelock e.g. when both cores were fiddling with tasklist
      lock (gdbserver / hackbench) for read/write respectively as the
      sequence diagram below shows:
      
                 core1                                   core2
               --------                                --------
      1. spin lock [EX r=0, w=1] - LOCKED
      2. rwlock(Read)            - LOCKED
      3. spin unlock  [ST 0]     - UNLOCKED
                                               spin lock [EX r=0,w=1] - LOCKED
                            -- resched core 1----
      
      5. spin lock [EX r=1] - ALREADY-LOCKED
      
                            -- resched core 2----
      6.                                       rwlock(Write) - READER-LOCKED
      7.                                       spin unlock [ST 0]
      8.                                       rwlock failed, retry again
      
      9.                                       spin lock  [EX r=0, w=1]
                            -- resched core 1----
      
      10  spinlock locked in #9, retry #5
      11. spin lock [EX gets 1]
                            -- resched core 2----
      ...
      ...
      
      The fix was to unlock using the EX insn too (step 7), to trigger another
      SystemC scheduling pass which would let core1 proceed, eliding the
      livelock.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      6c00350b
    • V
      ARC: Fix 32-bit wrap around in access_ok() · 0752adfd
      Vineet Gupta 提交于
      Anton reported
      
       | LTP tests syscalls/process_vm_readv01 and process_vm_writev01 fail
       | similarly in one testcase test_iov_invalid -> lvec->iov_base.
       | Testcase expects errno EFAULT and return code -1,
       | but it gets return code 1 and ERRNO is 0 what means success.
      
      Essentially test case was passing a pointer of -1 which access_ok()
      was not catching. It was doing [@addr + @sz <= TASK_SIZE] which would
      pass for @addr == -1
      
      Fixed that by rewriting as [@addr <= TASK_SIZE - @sz]
      Reported-by: NAnton Kolesov <Anton.Kolesov@synopsys.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      0752adfd
    • M
      ARC: Handle zero-overhead-loop in unaligned access handler · c11eb222
      Mischa Jonker 提交于
      If a load or store is the last instruction in a zero-overhead-loop, and
      it's misaligned, the loop would execute only once.
      
      This fixes that problem.
      Signed-off-by: NMischa Jonker <mjonker@synopsys.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      c11eb222
  6. 13 9月, 2013 3 次提交
    • M
      Remove GENERIC_HARDIRQ config option · 0244ad00
      Martin Schwidefsky 提交于
      After the last architecture switched to generic hard irqs the config
      options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
      for !CONFIG_GENERIC_HARDIRQS can be removed.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      0244ad00
    • J
      arch: mm: pass userspace fault flag to generic fault handler · 759496ba
      Johannes Weiner 提交于
      Unlike global OOM handling, memory cgroup code will invoke the OOM killer
      in any OOM situation because it has no way of telling faults occuring in
      kernel context - which could be handled more gracefully - from
      user-triggered faults.
      
      Pass a flag that identifies faults originating in user space from the
      architecture-specific fault handlers to generic code so that memcg OOM
      handling can be improved.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NMichal Hocko <mhocko@suse.cz>
      Cc: David Rientjes <rientjes@google.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: azurIt <azurit@pobox.sk>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      759496ba
    • J
      arch: mm: remove obsolete init OOM protection · 94bce453
      Johannes Weiner 提交于
      The memcg code can trap tasks in the context of the failing allocation
      until an OOM situation is resolved.  They can hold all kinds of locks
      (fs, mm) at this point, which makes it prone to deadlocking.
      
      This series converts memcg OOM handling into a two step process that is
      started in the charge context, but any waiting is done after the fault
      stack is fully unwound.
      
      Patches 1-4 prepare architecture handlers to support the new memcg
      requirements, but in doing so they also remove old cruft and unify
      out-of-memory behavior across architectures.
      
      Patch 5 disables the memcg OOM handling for syscalls, readahead, kernel
      faults, because they can gracefully unwind the stack with -ENOMEM.  OOM
      handling is restricted to user triggered faults that have no other
      option.
      
      Patch 6 reworks memcg's hierarchical OOM locking to make it a little
      more obvious wth is going on in there: reduce locked regions, rename
      locking functions, reorder and document.
      
      Patch 7 implements the two-part OOM handling such that tasks are never
      trapped with the full charge stack in an OOM situation.
      
      This patch:
      
      Back before smart OOM killing, when faulting tasks were killed directly on
      allocation failures, the arch-specific fault handlers needed special
      protection for the init process.
      
      Now that all fault handlers call into the generic OOM killer (see commit
      609838cf: "mm: invoke oom-killer from remaining unconverted page
      fault handlers"), which already provides init protection, the
      arch-specific leftovers can be removed.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NMichal Hocko <mhocko@suse.cz>
      Acked-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: azurIt <azurit@pobox.sk>
      Acked-by: Vineet Gupta <vgupta@synopsys.com>	[arch/arc bits]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      94bce453
  7. 12 9月, 2013 1 次提交
    • N
      ARC: SMP failed to boot due to missing IVT setup · c3567f8a
      Noam Camus 提交于
      Commit 05b016ec "ARC: Setup Vector Table Base in early boot" moved
      the Interrupt vector Table setup out of arc_init_IRQ() which is called
      for all CPUs, to entry point of boot cpu only, breaking booting of others.
      
      Fix by adding the same to entry point of non-boot CPUs too.
      
      read_arc_build_cfg_regs() printing IVT Base Register didn't help the
      casue since it prints a synthetic value if zero which is totally bogus,
      so fix that to print the exact Register.
      
      [vgupta: Remove the now stale comment from header of arc_init_IRQ and
      also added the commentary for halt-on-reset]
      
      Cc: Gilad Ben-Yossef <gilad@benyossef.com>
      Cc: Cc: <stable@vger.kernel.org> #3.11
      Signed-off-by: NNoam Camus <noamc@ezchip.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c3567f8a
  8. 05 9月, 2013 5 次提交
  9. 31 8月, 2013 4 次提交
    • V
      ARC: [ASID] Track ASID allocation cycles/generations · 947bf103
      Vineet Gupta 提交于
      This helps remove asid-to-mm reverse map
      
      While mm->context.id contains the ASID assigned to a process, our ASID
      allocator also used asid_mm_map[] reverse map. In a new allocation
      cycle (mm->ASID >= @asid_cache), the Round Robin ASID allocator used this
      to check if new @asid_cache belonged to some mm2 (from prev cycle).
      If so, it could locate that mm using the ASID reverse map, and mark that
      mm as unallocated ASID, to force it to refresh at the time of switch_mm()
      
      However, for SMP, the reverse map has to be maintained per CPU, so
      becomes 2 dimensional, hence got rid of it.
      
      With reverse map gone, it is NOT possible to reach out to current
      assignee. So we track the ASID allocation generation/cycle and
      on every switch_mm(), check if the current generation of CPU ASID is
      same as mm's ASID; If not it is refreshed.
      
      (Based loosely on arch/sh implementation)
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      947bf103
    • V
      ARC: [ASID] activate_mm() == switch_mm() · c6011553
      Vineet Gupta 提交于
      ASID allocation changes/2
      
      Use the fact that switch_mm() and activate_mm() are exactly same code
      now while acknowledging the semantical difference in comment
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      c6011553
    • V
      ARC: [ASID] get_new_mmu_context() to conditionally allocate new ASID · 3daa48d1
      Vineet Gupta 提交于
      ASID allocation changes/1
      
      This patch does 2 things:
      
      (1) get_new_mmu_context() NOW moves mm->ASID to a new value ONLY if it
          was from a prev allocation cycle/generation OR if mm had no ASID
          allocated (vs. before would unconditionally moving to a new ASID)
      
          Callers desiring unconditional update of ASID, e.g.local_flush_tlb_mm()
          (for parent's address space invalidation at fork) need to first force
          the parent to an unallocated ASID.
      
      (2) get_new_mmu_context() always sets the MMU PID reg with unchanged/new
          ASID value.
      
      The gains are:
      - consolidation of all asid alloc logic into get_new_mmu_context()
      - avoiding code duplication in switch_mm() for PID reg setting
      - Enables future change to fold activate_mm() into switch_mm()
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      3daa48d1
    • V
      ARC: [ASID] Refactor the TLB paranoid debug code · 5bd87adf
      Vineet Gupta 提交于
      -Asm code already has values of SW and HW ASID values, so they can be
       passed to the printing routine.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      5bd87adf