- Sep 05, 2008
-
-
Jeremy Kerr authored
We currently have a race for a free SPE. With one thread doing a spu_yield(), and another doing a spu_activate(): thread 1 thread 2 spu_yield(oldctx) spu_activate(ctx) __spu_deactivate(oldctx) spu_unschedule(oldctx, spu) spu->alloc_state = SPU_FREE spu = spu_get_idle(ctx) - searches for a SPE in state SPU_FREE, gets the context just freed by thread 1 spu_schedule(ctx, spu) spu->alloc_state = SPU_USED spu_schedule(newctx, spu) - assumes spu is still free - tries to schedule context on already-used spu This change introduces a 'free_spu' flag to spu_unschedule, to indicate whether or not the function should free the spu after descheduling the context. We only set this flag if we're not going to re-schedule another context on this SPU. Add a comment to document this behaviour. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
Commit 8d5636fb introduced a reference count on SPU contexts during find_victim, but this may cause a leak in the reference count if we later find a better contender for a context to unschedule. Change the reference to after we've found our victim context, so we don't do the extra get_spu_context(). Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- Aug 19, 2008
-
-
Ilpo Järvinen authored
Signed-off-by:
Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- Aug 14, 2008
-
-
Jeremy Kerr authored
Based on an original patch from Christoph Hellwig <hch@lst.de>. Currently, there is a possible reference-after-free in the spusched code - contexts may be freed after we have released their state_mutex in spusched_tick and find_victim. This change takes a reference to the context before releasing the mutex, so that the context doesn't get destroyed. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- Aug 13, 2008
-
-
Jeremy Kerr authored
Currently, spu_run ignores the npc argument for contexts created with SPU_CREATE_NOSCHED. While this is correct for isolated contexts, there's no need to enforce the npc restriction on non-isolated NOSCHED contexts. This means that NOSCHED contexts can only ever run with an entry point of 0x0. This change to spu_run_init allows setting of the npc (and, while we're at it, the privcntl) for non-isolated NOSCHED contexts. This allows us to run NOSCHED contexts from any entry point. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- Jul 26, 2008
-
-
Alexey Dobriyan authored
Kmem cache passed to constructor is only needed for constructors that are themselves multiplexeres. Nobody uses this "feature", nor does anybody uses passed kmem cache in non-trivial way, so pass only pointer to object. Non-trivial places are: arch/powerpc/mm/init_64.c arch/powerpc/mm/hugetlbpage.c This is flag day, yes. Signed-off-by:
Alexey Dobriyan <adobriyan@gmail.com> Acked-by:
Pekka Enberg <penberg@cs.helsinki.fi> Acked-by:
Christoph Lameter <cl@linux-foundation.org> Cc: Jon Tollefson <kniht@linux.vnet.ibm.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Matt Mackall <mpm@selenic.com> [akpm@linux-foundation.org: fix arch/powerpc/mm/hugetlbpage.c] [akpm@linux-foundation.org: fix mm/slab.c] [akpm@linux-foundation.org: fix ubifs] Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Jul 24, 2008
-
-
Benjamin Herrenschmidt authored
This uses the new vm_ops->access to allow gdb to access the SPU local store. We currently prevent access to problem state registers, this can be done later if really needed but it's safer not to. [akpm@linux-foundation.org: fix typo] Signed-off-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Rik van Riel <riel@redhat.com> Cc: Dave Airlie <airlied@linux.ie> Cc: Hugh Dickins <hugh@veritas.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
Andre Detsch authored
This patch adjusts the placement of a reference context from a spu affinity chain. The reference context can now be placed only on nodes that have enough spus not intended to be used by another gang (already running on the node). Signed-off-by:
Andre Detsch <adetsch@br.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Andre Detsch authored
Currenlt,, it is possible to lock aff_mutex and cbe_spu_info[n].list_mutex in different orders, allowing a deadlock to occur. With this change, aff_mutex is not taken within a list_mutex critical section anymore. Signed-off-by:
Andre Detsch <adetsch@br.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- Jul 22, 2008
-
-
Milton Miller authored
kcalloc is supposed to be called with the count as its first argument and the element size as the second. Signed-off-by:
Milton Miller <miltonm@bga.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- Jul 09, 2008
-
-
Maxim Shchetynin authored
As nr_active counter includes also spus waiting for syscalls to return we need a seperate counter that only counts spus that are currently running on spu side. This counter shall be used by a cpufreq governor that targets a frequency dependent from the number of running spus. Signed-off-by:
Christian Krafft <krafft@de.ibm.com> Acked-by:
Jeremy Kerr <jk@ozlabs.org> Signed-off-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org>
-
Jeremy Kerr authored
Currently, the .ctx debug file in spu context directories is always present. We'd prefer to prevent users from relying on this file, so add a "debug" mount option to spufs. The .ctx file will only be added to the context directories when this option is present. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
Populate the size member of a few context files. Leave out files that have different semantics with read vs mmap, or contain a variable-length hex string. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
Currently, spufs never specifies the i_size for the files in context directories, so stat() always reports 0-byte files. This change adds allows the spufs_dir_(nosched_)contents arrays to specify a file size. This allows stat() to report correct file sizes, and makes SEEK_END work. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
Use a set of #defines for the size of context mappings, instead of magic numbers. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
An spu context shouldn't get an extra tick if the time slice code couldn't find something else to run. This means contexts that are not within spu_run (ie, SPU_SCHED_SPU_RUN is cleared) will not receive extra ticks while we have no other contexts waiting. Signed-off-by:
Luke Browning <lukebrowning@us.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
Add a ctxt file to spufs that shows spu context information that is used in scheduling. This info can be used for debugging spufs scheduler issues, and to isolate between application and spufs problems as it shows a lot of state such as priorities and dispatch counts. This file contains internal spufs state and is subject to change at any time, and therefore no applications should depend on it. The file is intended for the use of spufs kernel developers. Signed-off-by:
Luke Browning <lukebrowning@us.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- Jun 30, 2008
-
-
Nicholas Piggin authored
Signed-off-by:
Nick Piggin <npiggin@suse.de> Acked-by:
Jeremy Kerr <jk@ozlabs.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Acked-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Paul Mackerras <paulus@samba.org>
-
- Jun 16, 2008
-
-
Luke Browning authored
There is a delay in the transition to the stopped state for class 2 interrupts. In some cases, the controlling thread detects the state of the spu as running, and goes back to sleep resulting in a hung application as the event is missed. This change detects the stop condition and re-generates the wakeup event after a context save. Signed-off-by:
Luke Browning <lukebrowning@us.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
Time slicing can occur at the same time as spu exception handling resulting in the wakeup of the wrong thread. This change uses the the spu's register_lock to enforce synchronization between bind/unbind and spu exception handling so that they are mutually exclusive. Signed-off-by:
Luke Browning <lukebrowning@us.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
According to the CBEA, the SPU dsisr is not updated for class 0 exceptions. spu_stopped() is testing the dsisr that was passed to it from the class 0 exception handler, so we return a false positive here. This patch cleans up the interrupt handler and erroneous tests in spu_stopped. It also removes the fields from the csa since it is not needed to process class 0 events. Signed-off-by:
Luke Browning <lukebrowning@us.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
If the spu is stopping (ie, the SPU_STATUS_RUNNING bit is still set), re-read the register to get the final stopped value. Signed-off-by:
Luke Browning <lukebrowning@us.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- May 15, 2008
-
-
FUJITA Tomonori authored
With CONFIG_VIRT_CPU_ACCOUNTING disabled, I got the following error: linux-2.6/arch/powerpc/platforms/cell/spufs/file.c: In function 'spu_switch_log_notify': linux-2.6/arch/powerpc/platforms/cell/spufs/file.c:2542: error: implicit declaration of function 'get_tb' make[4]: *** [arch/powerpc/platforms/cell/spufs/file.o] Error 1 Signed-off-by:
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by:
Paul Mackerras <paulus@samba.org>
-
Luke Browning authored
If victim (not ctx) is in spu_run, add victim to rq. Signed-off-by:
Luke Browning <lukebrowning@us.ibm.com> Acked-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Paul Mackerras <paulus@samba.org>
-
- May 08, 2008
-
-
Christoph Hellwig authored
We need to acquire the parent i_mutex with I_MUTEX_PARENT to keep lockdep happy. Signed-off-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Christoph Hellwig authored
We should not requeue the victim context in find_victim if the owner is not in spu_run. It's first not needed because leaving the context on the spu is an optimization and second is harmful because it means the owner could re-enter spu_run when the context is on the runqueue and trip the BUG_ON in __spu_update_sched_info. Signed-off-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- May 05, 2008
-
-
Christoph Hellwig authored
Creating a spufs context or gand using spu_create should send an inotify event so that things like performance monitors have an easy way to find out about newly created contexts. Signed-off-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
Currently, page fault handlers don't issue a mfc restart if the context switch pending flag is set, which can leave us with a hanging DMA after a context restore. This patch introduces fault pending flag that is set by the fault handler and read by the context switch code, so that the latter can add the restart bit at the right spot, after it has successfuly saved the state of the mfc control register. Signed-off-by:
Luke Browning <lukebr@linux.vnet.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
SPU class 0 & 1 exceptions may occur in parallel, so we may end up overwriting csa.dsisr. This change adds dedicated fields for each class to the spu and the spu context so that fault data is not overwritten. Signed-off-by:
Luke Browning <lukebr@linux.vnet.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
Currently, we re-route SPU interrupts to the current cpu, which may be on a remote node. In the case of time slicing, all spu interrupts will end up routed to the same cpu, where the spusched_tick occurs. This change routes mfc interrupts to the cpu where the controlling thread last ran, provided that cpu is on the same node as the spu (otherwise don't reroute interrupts). This should improve performance and provide a more predictable environment for processing spu exceptions. In the past we have seen concurrent delivery of spu exceptions to two cpus. This eliminates that concern. Signed-off-by:
Luke Browning <lukebr@linux.vnet.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Luke Browning authored
synchronize_irq() provides the serialization for SPU_CONTEXT_SWITCH_PENDING which is read with a simple load. This routine guarantees that the relevant interrupt handlers are not running, so that the next time they do run they will see the update memory value. This must be done correctly so that exception handling code does not restart the mfc in the middle of a context switch while we are trying to atomically stop it and save state. Signed-off-by:
Luke Browning <lukebr@linux.vnet.ibm.com> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
There's currently no way to tell if spu_process_callback has returned with the state mutex held, as -EINTR may be returned by either the syscall or the spu_acquire fail case. Instead, just do a non-interruptible mutex_lock here. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
Currently, we update the SPU master run control bit (ie, spu_enable_spu) in spufs_run_spu before we grab the context mutex. This can result in races with other processes accessing this context's resources. This change moves the spu_enable_spu to after we have acquired the context lock. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
We currently have two issues with the MFC save code: * save_mfc_decr doesn't handle a transition of 1 -> 0 of the Ds bit * The Q bit may be stale in the CSA This change fixes the first issue by clearing the relevant bits from the MFC_CNTL value in the CSA before or-ing in the updated status. Also, we add the Q bit to the updated status. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
Currently, we can introduce invalid entries into the MFC queues: 1) context starts a DMA 2) context gets scheduled out during a DMA - kernel saves MFC queue to CSA - kernel saves 0x0 in csa->mfc_control_RW 3) context gets scheduled in - csa->mfc_control[Q] ('queues empty') isn't set, so DMA queues are restored from the CSA 4) context's DMA is completed 5) context gets scheduled out again, no DMA occuring this time - kernel sees that MFC_CNTL[Q] ('queues empty') is set, so doesn't touch saved queue data in CSA - kernel saves 0x0 in csa->mfc_control_RW 6) context gets scheduled in - csa->mfc_control[Q] ('queues empty') isn't set (we saved is as 0!), so DMA queues are restored from the CSA In this last restore, we've restored the queue status from step 2, which are now invalid. This change makes save_mfc_cntl() closer to the save/restore sequence, as specified in the CBE handbook. With changes from Luke Browning. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Jeremy Kerr authored
When we issue a MFC purge request, we may inadvertantly clear the suspended status. This change adds the MFC_CNTL_SUSPEND_MASK when we issue a purge request, so that the suspend bit is masked out. Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
- May 01, 2008
-
-
Al Viro authored
Initial splitoff of the low-level stuff; taken to fdtable.h Signed-off-by:
Al Viro <viro@zeniv.linux.org.uk>
-
- Apr 30, 2008
-
-
Kumar Gala authored
Signed-off-by:
Kumar Gala <galak@kernel.crashing.org> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Julio M. Merino Vidal authored
The sputrace module contained a trace entry for spu_acquire_saved, but this marker was not placed anywhere. Fix this by adding a marker to the routine. Signed-off-by:
Julio M. Merino Vidal <jmerino@ac.upc.edu> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-
Julio M. Merino Vidal authored
Fix a typo in the marker for the find_victim function, which prevented it from being traced. It previously read find_vitim. Signed-off-by:
Julio M. Merino Vidal <jmerino@ac.upc.edu> Signed-off-by:
Jeremy Kerr <jk@ozlabs.org>
-