summaryrefslogtreecommitdiff
path: root/core/thread
Commit message (Collapse)AuthorAgeFilesLines
* debug: Adding -DDEBUG_THREADErwan Velu2015-09-041-0/+4
| | | | | | | | | When debugging some syslinux code with debugging enabled, the threading code is so verbose that it completly slow down syslinux but also is so verbose that any other trace is invisible in the flood. This commit aims at requesting people to explicitly enable the threading logs by using -DDEBUG_THREAD.
* core: make mbox_post()/__sem_down_slow() check if validGene Cumm2013-08-032-2/+2
| | | | | | If the mailbox/semaphore is invalid, disallow additions. Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* core: mbox/semaphore NULL checksGene Cumm2013-08-032-19/+31
| | | | | | Also set mbox invalid and mbox pointer NULL when free()d Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* pxe: always start the idle thread, in case we need itsyslinux-4.10-pre21H. Peter Anvin2012-05-291-0/+7
| | | | | | | Always start the idle thread, but leave it blocked unless we have an indication that interrupts are not working. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* thread: Add magic number, debugging code, min stack sizeH. Peter Anvin2012-03-303-3/+41
| | | | | | | | | | | Add a magic number to the thread control block; this helps check for memory overwrites. Add dprintf()s to the scheduler. Force a minimum stack size. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* idle_thread: safer interrupt handlingH. Peter Anvin2012-03-271-3/+3
| | | | | | | Make sure we use "sti ; hlt" to make sure we don't go to sleep when we suddenly have an interrupt coming in. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* thread: fix warningsH. Peter Anvin2011-05-012-3/+4
| | | | | | Fix set-but-not-used variable warnings and undefined references. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* thread: simplify the schedulerH. Peter Anvin2011-04-301-11/+12
| | | | | | | | | | | | need_schedule was no longer used by anything else, and schedule_lock only verified if we were being called from inside sched_hook_func(). Make the localness of this data explicit. While we're at it, call kaboom if we ever find ourselves without a runnable thread (which should not be possible, as the idle thread is not allowed to block.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* exit_thread: easier form of the same test...H. Peter Anvin2011-04-301-8/+1
| | | | | | | | | Instead of testing __schedule_lock explicitly, we can just call kaboom() if the scheduler returns, since that can only happen if the scheduler lock is set, and is in fact the reason we can't be here with the scheduler locked in the first place. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* exit_thread: make sure we don't run under scheduler lockH. Peter Anvin2011-04-301-0/+5
| | | | | | | If we ever end up in __exit_thread with the scheduler locked, we're completely fscked. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* thread: make kill_thread() actually do its jobH. Peter Anvin2011-04-272-11/+1
| | | | | | | kill_thread() had been modifying errno(!) as if it had been the return value... in other words, it really did absolutely nothing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pxe: use a separate poll thread instead of using an idle thread hookH. Peter Anvin2011-04-241-7/+2
| | | | | | | | | | | The idle thread can never sleep, so it's not really safe to do anything inside it. Instead, run a separate poll thread at low priority; we can also do that to poll the serial console if needed. Overall, the "classic" Syslinux idle handling really should go away and be replaced by the idle thread. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* thread: free curr->rmstackSebastian Herbszt2011-04-231-1/+1
| | | | | | | Free curr->rmstack instead of double free of curr->stack. Signed-off-by: Sebastian Herbszt <herbszt@gmx.de> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* thread: free(NULL) is safe, lmalloc() always return para-alignedH. Peter Anvin2011-04-222-6/+4
| | | | | | | | | | free(NULL) is safe and permitted, no reason to conditionalize calling free(). lmalloc() will always return a paragraph-aligned memory block, so we don't have to play games with the offset. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* lwip: handle UNDI stacks which need to be polledH. Peter Anvin2011-04-221-1/+6
| | | | | | | | | | | If the UNDI stack reports either IRQ 0 or does NOT report the NDIS IRQ supported flag, then poll the interrupt routine from the idle thread instead. This is somewhat limited; we really should have a chain of idle poll routines to support things like serial console. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* thread: thread-switch the real-mode stack, tooH. Peter Anvin2011-04-213-3/+25
| | | | | | | | | | | | When this code was originally written, we didn't have lmalloc(). Now when lmalloc() is implemented, let each real-mode task have its own stack. Note that this means we absolutely have to continue to support the SS != CS, DS model in the real-mode code, which should already be the case, but... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: thread: Implement polling for wakeups.Eric W. Biederman2011-04-121-0/+10
| | | | | | | | | | | | | | | | | | For some reason the core_pm_hook is not getting called every time we get an interrupt with the result that in some situations like arping for our neighbours mac address or a tftp transfer we can stall, we never move forward again. The reason for those stalls likely bears more investigating but for now it is sufficient for me to know that they exist and that I can work around them by polling for wakekup conditions everytime we call schedule. That gives us code that works reliably and stays within the letter of the pxe spec. The oddities of the pxelinux core can be ironed out later. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
* core thread: Make the code a little clearer.Eric W. Biederman2011-04-121-1/+1
| | | | Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
* core: thread: return 0 from sem_down() if we didn't have to waitH. Peter Anvin2011-04-121-0/+1
| | | | | | Return 0 from sem_down if we passed right through the assembly code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core thread: Don't include core.h from thread.hEric W. Biederman2011-04-091-0/+1
| | | | | | | | | | | core.h brings in a lot of symbols and causes conflicts when included into lwip, in particular conflicts on the symbol lfree. So do the simple thing and simplify what thread.h brings in to reduce the change of symbol conflicts. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
* core: thread: add a name fieldH. Peter Anvin2011-04-093-2/+4
| | | | | | Add a name field to struct thread, for debugging's sake. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
* thread: add support for locking the schedulerH. Peter Anvin2011-04-092-0/+12
| | | | | | | Add support for locking the scheduler; this is needed for the pm return hook to operate properly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: thread: move most thread state to stack; task switch errnoH. Peter Anvin2011-04-093-19/+38
| | | | | | | Move most our thread state to the stack. Task switch the errno variable. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: thread: merge mbox_post() and mbox_trypost()H. Peter Anvin2011-04-081-14/+3
| | | | | | | Merge mbox_post() and mbox_trypost() into a single function with a timeout parameter. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: add simple mailbox libraryH. Peter Anvin2011-04-081-0/+68
| | | | | | A very simple mailbox library, designed for lwIP porting. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: thread: add option to not wait on a semaphore at allH. Peter Anvin2011-04-081-26/+33
| | | | | | | Implement a "trywait" option... if timeout is set to -1, then timeout immediately if the semaphore isn't available. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: thread: have start_thread() allocate memory dynamicallyH. Peter Anvin2011-04-082-9/+15
| | | | | | | | Have start_thread() allocate memory dynamically, using malloc(). XXX: should probably free that memory in __exit_thread()... could be "interesting". Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: simple thread libraryH. Peter Anvin2011-04-0810-0/+332
Simple thread library with the intent of making lwIP easier to port. -- Modified to use milliseconds instead of jiffies, as lwIP expresses everything in milliseconds. EWB Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>