pthread_test() and supporting changes

The ugly bit is that the pthread 2LS wants to adjust the number of
vcores, but for testing, we want a fixed amount.  Hence the function to
toggle the bool.  We can sort out something better once we have a real
2LS.
Ghetto benchmark test

Juan had a problem with code similar to this.  If you don't do
	res += whatever
and juse do
	res = whatever
(his example code), then you could get varying results based on what
else you put in the loop.  Specifically, if you do some extra stuff like
a read_tsc() and track the number of loop iterations, then the critical
path of the inner loop is actually shorter than without, leading to a
10-20% performance difference.
x86: sends the EOI earlier in the IRQ path

This makes it easier to merge all the architecture's KMSG code.  Also,
Linux does this, at least it looks like they do based on a cursory
glance a few months ago.
KMSGs no longer self-ipi for routine messages

We used to need this when we had routine messages that popped into
userspace.  The self-ipi forced us to trap back into the kernel to
process the rest of the messages.  Now that our proc management kmsgs
all return (let alone not popping into userspace), this isn't a concern.

We can still have kmsgs that don't return (like __launch_kthread()),
since we'll always run our routine KMSGs at some point in the future
(smp_idle() or proc_restartcore()).

I'd normally wait til combining all the KMSG code to do this, but the
non-x86 arches didn't have ipi_is_pending().
x86: send_ipi takes an OS coreid

Instead of a hw_coreid, making like the other architectures.
RISCV/SPARC: send_ipi() takes a vector

We could either make an arch-function that is "send a kernel message
IPI", which is what the current versions are doing, or extend send_ipi()
to take other vectors.

Since we might have other IPI vectors in the future, I went with this.
If it's something that is completely impossible for these architectures,
then we can do something else.

Haven't compiled this btw - I still can't run the RISCV compiler on my
machine.
Makes kmsg code arch independent

Should be no change to functionality.  SPARC/RISCV people: see if this
works for you.  I don't have a working RISCV compiler, and does anyone
even use SPARC?  =)
Kernel message overhaul

We no longer run routines from the IRQ handler, and no longer run
immediates from PRKM().

The difference in the former is in cases where we are in userspace and
we receive an IPI to run kernel messages.  Previously, we handled the
routine messages in the IRQ handler.  Now we do nothing, and handle them
"on the way out" (in the proc_restartcore() / smp_idle() path).

The differences in the latter are that we simply wait til we actually
get the KMSG IPI to run the immediate handlers.  Note there is no
ordering guarantees between different KMSG classes.
Kernel context (IRQ, etc) tracking

We can now detect what sort of context we are in.  The main use for this
is deadlock detection.

RISC/SPARC people, take a look at your architectures please.
Asserts/checks for early RKMSG context

The kernel tracks if it is in 'early routine kernel message context,'
which is an RKMSG before it blocks.  Once it blocks/kthreads, the core
leaves that context (in smp_idle), never to return for that kthread.
When the kthread starts up again, it'll be in default context.

Other than allowing us to assert messages that must be routine are in
fact routine, we can detect when a kmsg blocked, thus removing the
restriction on kmsg handler writers to put smp_idle at the bottom of
their functions.

There might be a better way to do this (permanent kthreads, track
whether it blocked in there?), but the basics are the same: when we come
back in to PRKM, we need to detect if we blocked or not, and if so, we
smp_idle.  And if not, we clear whatever flag we were using.  And that
same flag gets cleared in smp_idle as well.
No longer inlines spin_lock

Arch-specific locking is done in __spin_{lock,unlock,init}.  Debugging
and whatnot is all done in k/s/atomic.c.

Also adds irq_okay fields and different types of spinlock inits, based
on whether or not it is okay to use the lock in IRQ context or not.  We
don't enforce anything yet (wait for the next patch or three).
Semaphores and CVs have irqsave initializers

We also now assert we can block when blocking.  We don't enforce the
spinlock checks yet.
Spinlock irqsave usage checks

Controlled with CONFIG_SPINLOCK_DEBUG.  One big issue is that we usually
need locks to tell ourselves about the deadlock - print locks, kmsgs
locks, etc.  We'll need something else to deal with this.

Here's a list of all irqsave locks.  A few of them weren't even
initialized.  Others probably don't need to be irqsave.  And a few are
from some really ancient code.  Some of these were only detected at
runtime by the usage checks.

Take a look at these and any of your other locks, and fix them up
accordingly.

 /* sync stuff */
 barrier->lock
 list->lock (checklists)

 /* page allocation / coloring */
 cache_colors_lock
 colored_page_free_list_lock (arch dependent btw)

 /* slab allocator */
 cp->cache_lock
 kmem_caches_lock

 /* riscv/sparc */
 fesvr_lock
 cas_lock (needs attention, might not compile)

 /* console printing and reading */
 lock (x86 console lock, cons_putc needs renamed)
 output_lock (serializes all printks)
 print_info_lock (testing.c)
 ptf_lock (x86 trapframe printing lock)
 readline_lock

 /* kmsg */
 per_cpu_info[i].immed_amsg_lock
 per_cpu_info[i].routine_amsg_lock

 /* misc */
 arsc_proc_lock
 systrace_lock (does this need irqsave?)
 ucq hash locks
 packet_buffers_lock
Add semaphore stuff for pthreads
Implemented a few more stubs for PTHREAD compliance

(Including signal stuff)
Change default directory for installing riscv
Make procinfo.h c89 compliant (i.e. no gnu99isms)
Make exit call _exit instead of syscall directly

Needed to get libgomp to work correctly because it required its call to
exit() to be for a function that had a noreturn attribute.  Arguably, we
should have been doing this all along, and the direct syscall was
probably extreme legacy code before we had glibc properly integrated.
Added gcc compiler magic to get libgomp to build for akaros

Still need to implement stubs for pthread_key nonsense, but hopefully
after that, things will just work.
Added force_parlib_symbols as default param to gcc

Allowed us to remove the busybox patch that diabled looping over
included libs and not including them if they wre not needed.

We previously had to override this because we always wanted parlib
included, but now it is included by default as part of invoking gcc.