akaros.git
3 years agoRemove SYS_cputs (XCC)
Barret Rhoden [Wed, 23 Mar 2016 22:06:53 +0000 (18:06 -0400)]
Remove SYS_cputs (XCC)

As Ron said, "Alas, SYS_cputs, we knew you well."  It was probably our
first syscall, but we no longer need it.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUse write() in parlib/debug.c
Barret Rhoden [Wed, 23 Mar 2016 22:05:51 +0000 (18:05 -0400)]
Use write() in parlib/debug.c

This is the printf that gets called from vcore context.  We want those
prints to go to wherever stdout is, instead of always to the kernel
directly.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUse the POSIX isatty() (XCC)
Barret Rhoden [Wed, 23 Mar 2016 20:16:41 +0000 (16:16 -0400)]
Use the POSIX isatty() (XCC)

This is somewhat bullshit, since our tcgetattr() always returns whatever my
Linux terminal said back in 2009.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMap PTEs for MAP_SHARED | MAP_LOCKED files on fork
Barret Rhoden [Wed, 23 Mar 2016 19:23:05 +0000 (15:23 -0400)]
Map PTEs for MAP_SHARED | MAP_LOCKED files on fork

If you had a process that forked but did not exec, then the read-only parts
of the binary would not be in its address space.  Those parts would be in
the page cache, so long as the parent was still around (which had the VMR
MAP_LOCKED) (or if it left and we flushed the cache).

Then later, the child asks the kernel to perform a syscall on one of its
addresses in the read-only section, e.g. .rodata.  The kernel would then
page fault.

Right now, the kernel won't attempt to handle a PF *of its own* by talking
to the page cache.  Eventually we'll need to do this.  But it's also just
wrong for us to not have MAP_LOCKED VMRs present in a process's page table.

I <3 fork.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix minor leaks in mm.c
Barret Rhoden [Wed, 23 Mar 2016 19:21:08 +0000 (15:21 -0400)]
Fix minor leaks in mm.c

If we ever had an error, we'd bail out but forget to decref and free
memory.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove the double-close() warning
Barret Rhoden [Tue, 22 Mar 2016 21:45:49 +0000 (17:45 -0400)]
Remove the double-close() warning

It's legal to attempt to close a bad FD.  We had a nasty bug that this
caught a long time ago, but now we have programs that do this all the time
(ssh).

Since I fixed the shutdown() problem, we no longer have any known-buggy
programs that are double-closing.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBump the size of the ancillary state (XCC)
Michael Taufen [Thu, 31 Mar 2016 16:19:14 +0000 (09:19 -0700)]
Bump the size of the ancillary state (XCC)

Increases the size of extended_region by 8 bytes to accommodate
the PKRU

Reinstall your kernel headers and maybe rebuild apps.

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
[rebuild warning]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMoved timing parameters into proc_global_info (XCC)
GanShun [Tue, 29 Mar 2016 18:26:31 +0000 (11:26 -0700)]
Moved timing parameters into proc_global_info (XCC)

Moved tsc_freq, timing_overhead and bus freq into __proc_global_info.
PIT stuff is now in k/a/x/time.c as a static. timing_overhead has been
renamed to tsc_overhead.

Reinstall your kernel headers.

Signed-off-by: GanShun <ganshun@gmail.com>
[kernel headers warning, removed extraneous comment]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove unused variable from prep_syscalls().
Dan Cross [Wed, 30 Mar 2016 20:44:28 +0000 (16:44 -0400)]
Remove unused variable from prep_syscalls().

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd a control file in #cons to support killing children.
Ronald G. Minnich [Fri, 25 Mar 2016 15:59:42 +0000 (08:59 -0700)]
Add a control file in #cons to support killing children.

This is needed for ssh support for ^C.
The ssh server, when it sees a ^C, opens and writes a command
to #cons/killkids.

Right now the command is ignored, but that might change.

We might at some point decide to implement /proc/self, and this can
move there. It's arguably a bit gross to have it in #cons.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
[ slight touchups ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agopasswd: put in a one line passwd file for Unix programs
Ronald G. Minnich [Thu, 24 Mar 2016 21:19:25 +0000 (14:19 -0700)]
passwd: put in a one line passwd file for Unix programs

This is unfortunate but we'll never see the end of it otherwise.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoApic msr exit handling added with timer thread support
GanShun [Thu, 24 Mar 2016 17:54:05 +0000 (10:54 -0700)]
Apic msr exit handling added with timer thread support

Added emsr_apic in user/vmm/vmxmsr to write all apic msr writes to the
vapic page. Started the timer thread using the vector linux writes to the
timer msr. We ignore the initial count as long as its not 0 and we just
inject a timer interrupt at 100hz.

Signed-off-by: GanShun <ganshun@gmail.com>
[touched up function declaration formatting]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMoved Trap Injection macros to the correct location (XCC)
GanShun [Wed, 23 Mar 2016 16:59:36 +0000 (09:59 -0700)]
Moved Trap Injection macros to the correct location (XCC)

Reinstall your kernel headers.

Signed-off-by: GanShun <ganshun@gmail.com>
[kernel header warning]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoCosmetic: Change tabs to spaces in glibc Versions file.
Dan Cross [Tue, 22 Mar 2016 21:20:42 +0000 (17:20 -0400)]
Cosmetic: Change tabs to spaces in glibc Versions file.

This is purely a cosmetic change: change tabs to spaces
in glibc-2.19-akaros/sysdeps/akaros/Versions for consistency.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoCorrect multicast setup to make ipv6 work reliably.
Geoff Collyer [Thu, 17 Mar 2016 23:32:43 +0000 (16:32 -0700)]
Correct multicast setup to make ipv6 work reliably.

Signed-off-by: Geoff Collyer <geoff.collyer@gmail.com>
[checkpatch touchups]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUpgrade parlib fp state handling, use proc_global_info (XCC)
Michael Taufen [Fri, 11 Mar 2016 00:04:50 +0000 (16:04 -0800)]
Upgrade parlib fp state handling, use proc_global_info (XCC)

Rebuild kernel headers and all user apps!

This upgrades parlib so it also has the fp state upgrades
recently made to the Akaros kernel (xsave, xsaveopt, xrstor),
and also makes Akaros use proc_global_info for x86_default_xcr0

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
[ touched up a checkpatch warning ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUser library changes to take a guest_thread instead of a vmctl.
GanShun [Tue, 22 Mar 2016 00:15:21 +0000 (17:15 -0700)]
User library changes to take a guest_thread instead of a vmctl.

Removed vmctls from user/. user libraries just use a guest_thread now.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoModify cpu feat barrier for enabling CR4_OSXSAVE
Michael Taufen [Tue, 22 Mar 2016 16:17:46 +0000 (09:17 -0700)]
Modify cpu feat barrier for enabling CR4_OSXSAVE

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoImplement sched_getcpu() (XCC)
Dan Cross [Tue, 22 Mar 2016 19:45:56 +0000 (15:45 -0400)]
Implement sched_getcpu() (XCC)

Added a 'sched_getcpu()' routine that returns the
current pcore ID, as an analog to the routine of
the same name in Linux. Rebuild your toolchain.

Signed-off-by: Dan Cross <crossd@gmail.com>
[changed the commit subject from Linux compat changes]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMinor changes to build C++ threads in gcc (XCC)
Dan Cross [Tue, 22 Mar 2016 16:32:47 +0000 (12:32 -0400)]
Minor changes to build C++ threads in gcc (XCC)

Added a constant and modified our Makefile to enable
C++ thread support when building GCC. Rebuild your
toolchain.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd debugging info to ipchaninfo()
Barret Rhoden [Tue, 22 Mar 2016 19:43:08 +0000 (15:43 -0400)]
Add debugging info to ipchaninfo()

Reports nonblock status and whether or not the conv is tapped.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoImplement shutdown() (XCC)
Barret Rhoden [Tue, 22 Mar 2016 19:39:22 +0000 (15:39 -0400)]
Implement shutdown() (XCC)

We had been just closing the FD, which is clearly wrong (you may have been
getting warnings from the kernel about this).  Best case, you just get a
warning.  Worst case, you accidentally close another FD in a concurrent
program.

I don't know if the TCP code is right.  It sends a FIN.  Maybe it doesn't
send it the right way, or maybe we should do things for the other states
too.

It's better than it was before.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix a bunch of Rock warnings (XCC)
Barret Rhoden [Tue, 22 Mar 2016 15:53:38 +0000 (11:53 -0400)]
Fix a bunch of Rock warnings (XCC)

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUse a fork callback in select()
Barret Rhoden [Tue, 22 Mar 2016 15:20:03 +0000 (11:20 -0400)]
Use a fork callback in select()

We need to flush our state in the child on a fork.  Otherwise we'll think
we are still tracking the FDs, even though the underlying taps weren't
inherited.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd callbacks for fork() (XCC)
Barret Rhoden [Tue, 22 Mar 2016 15:16:09 +0000 (11:16 -0400)]
Add callbacks for fork() (XCC)

If a process forks but does not exec, some user-level subsystems (e.g.
select) will need to run a callback in the child.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoqio: Fire read taps on actual edges
Barret Rhoden [Tue, 22 Mar 2016 14:02:05 +0000 (10:02 -0400)]
qio: Fire read taps on actual edges

We were only firing when the queue was Qstarved, which means that someone
had to attempt to drain the queue at some point.  Thus if the queue was
drained exactly, but no one waited, then the tap wouldn't fire.

Now we fire whenever the queue was empty, not when it thought it had a
someone who starved it.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoqio: Fire writeable taps immediately
Barret Rhoden [Tue, 22 Mar 2016 14:01:08 +0000 (10:01 -0400)]
qio: Fire writeable taps immediately

We were only firing when the queue was drained below the flow control
limit.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd git helper scripts and update Doc/Contributing
Barret Rhoden [Wed, 16 Mar 2016 17:40:10 +0000 (13:40 -0400)]
Add git helper scripts and update Doc/Contributing

This updates the Contributing guidelines, providing instructions and
examples for how to submit code to the mailing list, e.g. send-email and
request-pull.

Of the scripts/git files, contributors will be most interested in
git-checkpatch and git-akaros-request-pull.  All of the git scripts will
work as git subcommands if you put them in your PATH.  e.g.

$ git checkpatch master..my_branch

or

$ git akaros-request-pull master my_repo my_branch

akaros-request-pull is just like the request-pull, but with an added
github URL for those who want to look at the patches on the world wide
web.

The other scripts, such as track-review, are mostly useful for code
reviewers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoImplement write combining on x86
Kanoj Sarcar [Thu, 10 Mar 2016 19:28:26 +0000 (11:28 -0800)]
Implement write combining on x86

MLX uses WC to write data payload into HCA buffers. The performance boost
over UC/UC- is significant.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
[ removed pat_init() and used the new PTE_ flags ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd write-combining memory mapping mode (XCC)
Barret Rhoden [Fri, 11 Mar 2016 19:40:39 +0000 (14:40 -0500)]
Add write-combining memory mapping mode (XCC)

Use PTE_WRITECOMB for PTEs if you're manually building a mapping.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Initialize the PAT MSR
Barret Rhoden [Fri, 11 Mar 2016 19:33:14 +0000 (14:33 -0500)]
x86: Initialize the PAT MSR

This sets up PAT so we can have WB, WC, WT, and UC- memory types via the
__PTE flags.  The PCD and PWT bits don't necessarily disable caching or set
write-through anymore; they are indexes into the PAT table.  (This was
always happening btw, since anything we run on has PAT support).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoStop using PTE_PCD and PTE_PWT directly (XCC)
Barret Rhoden [Fri, 11 Mar 2016 19:21:22 +0000 (14:21 -0500)]
Stop using PTE_PCD and PTE_PWT directly (XCC)

If you want caching disabled, use PTE_NOCACHE.  I'll be changing the
specific PAT settings shortly so accessing those bits directly will cause
trouble.

Regarding the change to compat.h, there's no difference between PTE_NOCACHE
and just a raw PTE_PCD in Akaros as of right now (PCD == UC- and
PCD|PWT == UC, and the minus only matters if MTRRs set WC, which they
aren't at the moment).

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix implicit declaration in procinfo.h (XCC)
Barret Rhoden [Fri, 11 Mar 2016 15:06:59 +0000 (10:06 -0500)]
Fix implicit declaration in procinfo.h (XCC)

The user-specific part of procinfo has a helper function that makes a
syscall.  That was implying __ros_syscall_errno() existed.  Ideally, we
wouldn't do that, but doing otherwise causes include loops.

Alternatively, we could just move or remove the functions.  Considering
they are for debugging, just externing in the function seems fine.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove cpu_feats from kernel-features.h (XCC)
Barret Rhoden [Fri, 11 Mar 2016 14:55:21 +0000 (09:55 -0500)]
Remove cpu_feats from kernel-features.h (XCC)

It turns out that glibc doesn't need its own copy of the cpu_feats, and it
can just include parlib's.  It may be that some code in glibc won't be
able to include parlib files.  If that's the case, and those files need
cpu_feats, then we can revisit this.

This popped up as a problem when a file in glibc included both
kernel-features. and parlib/cpu_feat.h.

Rebuild glibc if you want.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemoving extra run_vmthread calls.
GanShun [Thu, 10 Mar 2016 21:39:15 +0000 (13:39 -0800)]
Removing extra run_vmthread calls.

These calls should only be made at the bottom of the while loop, otherwise
we run the risk of missing a vmexit.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoReturn real vendor/part id in query_device
Kanoj Sarcar [Thu, 10 Mar 2016 19:24:57 +0000 (11:24 -0800)]
Return real vendor/part id in query_device

ofed_perftest tool cares about vendor/part id.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoClean up logic in MSR read/write functions.
Dan Cross [Tue, 8 Mar 2016 19:48:59 +0000 (14:48 -0500)]
Clean up logic in MSR read/write functions.

These code paths could be cleaned up and a level of indentation removed.
Also, remove the use of atomic types as they are unneeded in this case.

Signed-off-by: Dan Cross <crossd@gmail.com>
[minor git-fu]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdded comment to note that fninit clears FOP
Michael Taufen [Sat, 5 Mar 2016 00:27:20 +0000 (16:27 -0800)]
Added comment to note that fninit clears FOP

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFP save/restore security patch for AMD processors
Michael Taufen [Sat, 5 Mar 2016 00:25:44 +0000 (16:25 -0800)]
FP save/restore security patch for AMD processors

AMD processors do not save/restore the FOP/FIP/FDP values from/to the
x87 FPU unless an unmasked FPU exception is pending. This can result in
a state leak between processes during a context switch, and is a
potential security hole.

See CVE-2006-1056 and CVE-2013-2076 on cve.mitre.org.

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoExtended state AMD backwards compatibility updates (XCC)
Michael Taufen [Thu, 3 Mar 2016 21:32:05 +0000 (13:32 -0800)]
Extended state AMD backwards compatibility updates (XCC)

Rebuild your universe (kernel headers and user apps)!

These updates allow Akaros to defer to FXSAVE instructions in the event
that the processor does not support the XSAVE instructions. This is
necessary for Akaros to run on older AMD processors (pre bulldozer).

Akaros will still refuse to boot if you do not have support for FXSAVE.

These updates also include additional CPU feature detection,
particularly x86 vendor detection and support for the XSAVE instruction.

Finally, these updates allow the use of XSAVE in the absence of
XSAVEOPT, because it was an easy patch and we don't have to be that
mean.

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdded vmrunkernel option for extending the kernel command line passed to the guest
Michael Taufen [Sat, 27 Feb 2016 00:03:11 +0000 (16:03 -0800)]
Added vmrunkernel option for extending the kernel command line passed to the guest

vmrunkernel now targets the launcher program in our linux fork's initramfs
instead of init (see rminnich/linux and mtaufen/ak-vm-tests)

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoClean up IPv6 sources.
Dan Cross [Wed, 9 Mar 2016 16:30:10 +0000 (11:30 -0500)]
Clean up IPv6 sources.

I'm diving into IPv6 code to get it working. These are trivial
cleanups that I don't want to obscure potential future changes
that would be more substantive.

Remove redundant or unused headers, whitespace cleanups, etc.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoARRAY_SIZE is the standard in the kernel.
Dan Cross [Tue, 8 Mar 2016 20:38:15 +0000 (15:38 -0500)]
ARRAY_SIZE is the standard in the kernel.

Trivial change to follow the convention used elsehwere in the
kernel.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoClean up profiler configure and usage functions.
Dan Cross [Tue, 8 Mar 2016 16:54:42 +0000 (11:54 -0500)]
Clean up profiler configure and usage functions.

An incidental cleanup that became evident from the last cleanup;
the 'profiler_configure' function was unnecessarily hard to
follow due to lack of an early return.

Also, there was this odd function to return an array of strings
that could be used to construct an error message, but that were
used nowhere else; this was an encapsulation failure.  Change
that to just construct the error message and call it.

Arguably, the configure function should just call 'error()'. Oh
well.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoClean up profiler variables and formatting.
Dan Cross [Tue, 8 Mar 2016 16:39:46 +0000 (11:39 -0500)]
Clean up profiler variables and formatting.

Remove unused variables, move loop indices to their loop,
use void* instead of char* in several places, clean up
declaration formatting.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix formatting: leading spaces to tabs, and fix continued-line alignment.
Dan Cross [Tue, 8 Mar 2016 15:37:27 +0000 (10:37 -0500)]
Fix formatting: leading spaces to tabs, and fix continued-line alignment.

Indent using tabs, not spaces.

In the event that a line must be broken due to length, the coding
standard says to break it so that we use tabs to advance the
continued line to the level of indentation of the broken line,
and then spaces to align to the opening parenthesis.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd in more uverbs backward compatilibity
Kanoj Sarcar [Tue, 8 Mar 2016 00:33:32 +0000 (16:33 -0800)]
Add in more uverbs backward compatilibity

Add in support for older style extended query device.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd rdmsr and wrmsr utilities
Barret Rhoden [Mon, 7 Mar 2016 19:07:17 +0000 (14:07 -0500)]
Add rdmsr and wrmsr utilities

Note that wrmsr writes the same MSR value to *all* cores.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd a helper for querying the number of cores
Barret Rhoden [Mon, 7 Mar 2016 19:04:04 +0000 (14:04 -0500)]
Add a helper for querying the number of cores

The info is exposed via #vars.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove MAX_VCORES
Barret Rhoden [Mon, 7 Mar 2016 19:23:11 +0000 (14:23 -0500)]
Remove MAX_VCORES

This was limiting us to 64 vcores.  Instead of cranking the number up, I
opted to just remove the #define completely.  We should be able to figure
these things out dynamically.

Right now MAX_NUM_CORES is 256 for x86.  That was due to the old xAPIC.
One of these days we'll actually want to run on a large-scale SMP machine
and will want to increase that.  And then we'll also start worrying about
the size of things that grow O(MAX_NUM_CORES) for every process, e.g.
procdata.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove MCS dissemination barrier
Barret Rhoden [Mon, 7 Mar 2016 19:20:12 +0000 (14:20 -0500)]
Remove MCS dissemination barrier

It's a cool thing, but it has a few problems.
- It wants to know statically how many vcores there are (max, at least).
- It doesn't pad its dissem structure properly (it adds 64 bytes extra, not
  of padding, but just an array).
- It doesn't handle preemption.

All of these can be fixed, if we actually want the barriers.  In that case,
we can bring this code back and fix up the above three things.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Fix devarch's MSR error handling
Barret Rhoden [Mon, 7 Mar 2016 18:58:59 +0000 (13:58 -0500)]
x86: Fix devarch's MSR error handling

In some cases, we weren't even setting errno, just returning -1.  Then on
error, we'd get crap from perror() like:

pread: Success

Now get meaningful errstrs and at least have errno set.

E.g.

(On a machine without IA32_PERF_CTL)
/ $ rdmsr 0x199
pread: Bad address, read_msr() faulted on MSR 0x199
/ $ wrmsr 0x198 88888
pwrite: Operation not permitted, MSR 0x198 not in write whitelist

Most of the other errors would be triggered by a rdmsr or wrmsr bugging
out.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Properly initialize MSR whitelists
Barret Rhoden [Mon, 7 Mar 2016 18:56:37 +0000 (13:56 -0500)]
x86: Properly initialize MSR whitelists

The address ranges need to be initialized so that they are sorted.
Otherwise, whoever adds entries needs to know the actual value of the MSRs
and maintain their ordering manually.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Use FSGSBASE for TLS changes (XCC)
Barret Rhoden [Mon, 29 Feb 2016 23:34:45 +0000 (18:34 -0500)]
x86: Use FSGSBASE for TLS changes (XCC)

When the CPU feature is available, userspace and the kernel will use the
instructions (e.g. wrfsbase) to change TLS.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: use setters/getters for MSR_{FS,GS}_BASE
Barret Rhoden [Mon, 29 Feb 2016 23:24:40 +0000 (18:24 -0500)]
x86: use setters/getters for MSR_{FS,GS}_BASE

We need to be a little careful in the kernel with using these before cr4 is
set.  We'll eventually set cr4 to enable this usage in arch_pcpu_init.  For
the most part, any MSR accesses of this sort will happen after smp_boot,
which is fine.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Detect XSAVEOPT
Barret Rhoden [Mon, 29 Feb 2016 20:49:24 +0000 (15:49 -0500)]
x86: Detect XSAVEOPT

This is an  examples of how the kernel can set and query CPU features.  For
the most part, we should do all of the cpu_set_feat() very early during
boot in cpuinfo.

XSAVEOPT implies XSAVE, so we have just CPU_FEAT_X86_XSAVEOPT.

With these changes, both the user and the kernel can check at runtime for
XSAVEOPT and adapt accordingly.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd CPU feature detection (XCC)
Barret Rhoden [Mon, 29 Feb 2016 20:45:13 +0000 (15:45 -0500)]
Add CPU feature detection (XCC)

Userspace, Glibc, and the kernel can now query whether the CPU has certain
features with

bool cpu_has_feat(int feature);

Some CPU features are architecture independent, such as the support for
virtual machines.  Most others will be architecture dependent.  I added a
few feature bits as an example, though they are not used yet.

To use within the kernel:

#include <cpu_feat.h>

To use within glibc:

#include <kernel-features.h>

To use in generic userspace (e.g. user/*, tests/*, etc):

#include <parlib/cpu_feat.h>

Reinstall your kernel headers to use the features.  Rebuild glibc to make
sure I didn't mess anything up.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd proc_global_info (XCC)
Barret Rhoden [Mon, 29 Feb 2016 18:38:35 +0000 (13:38 -0500)]
Add proc_global_info (XCC)

This is a read-only, shared-memory region mapped into every process's
address space.

Rebuild the world.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix mxcsr boot time init
Michael Taufen [Mon, 29 Feb 2016 16:57:53 +0000 (08:57 -0800)]
Fix mxcsr boot time init

The mxcsr register should be initialized to its power on default of 0x1f80.
This masks all SIMD floating point exceptions and clears all SIMD
floating-point exception flags, sets rounding control to round-nearest
disables flush-to-zero mode, and disables denormals-are-zero mode.

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
[ removed a couple extra newlines ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVirtualization changes to handle X2APIC mode.
GanShun [Thu, 17 Dec 2015 22:43:30 +0000 (14:43 -0800)]
Virtualization changes to handle X2APIC mode.

These are changes to the vmm to allow it to handle the new MSR based
accesses. This includes allowing the direct msr access in vmx.c,
otherwise vmexiting will occur.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoEnabling X2APIC
GanShun [Thu, 17 Dec 2015 01:36:39 +0000 (17:36 -0800)]
Enabling X2APIC

Changing all offsets from the old XAPIC mode to the newer X2APIC mode and
removing lapic_wait_to_send. All interaction with the X2APIC is done with
apicrput, apicrget or apicsendipi. Removed memory allocation in pmap64.c
and value check in check_sym_val

Signed-off-by: GanShun <ganshun@gmail.com>
[ removed some debugging comments, fixed pb_ktest ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemoved lapic_set_id and lapic_set_logid functions
GanShun [Wed, 16 Dec 2015 20:21:09 +0000 (12:21 -0800)]
Removed lapic_set_id and lapic_set_logid functions

These functions are not used and are no longer allowed once we swap to the
X2APIC. Removing them in preparation for activating the X2APIC

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agofp state save, restore, and error handling
Michael Taufen [Mon, 22 Feb 2016 22:55:52 +0000 (14:55 -0800)]
fp state save, restore, and error handling

save_fp_state and restore_fp_state now use xsaveopt64 and xrstor64,
restore_fp_state handles faults. In the event of a fault,
restore_fp_state prints an error message and then restores
the fp state to a default that was determined at boot.

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovm exit handler for xsetbv
Michael Taufen [Mon, 22 Feb 2016 22:47:54 +0000 (14:47 -0800)]
vm exit handler for xsetbv

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoInitialize guest xcr0, save and restore xcr0 between guest and Akaros
Michael Taufen [Mon, 22 Feb 2016 22:42:31 +0000 (14:42 -0800)]
Initialize guest xcr0, save and restore xcr0 between guest and Akaros

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBoot time and per-cpu extended state setup
Michael Taufen [Mon, 22 Feb 2016 22:35:42 +0000 (14:35 -0800)]
Boot time and per-cpu extended state setup

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd load, safe load, read xcr0 functions
Michael Taufen [Mon, 22 Feb 2016 22:27:02 +0000 (14:27 -0800)]
Add load, safe load, read xcr0 functions

void lxcr0(uint64_t xcr0)
int safe_lxcr0(uint64_t xcr0)
uint64_t rxcr0(void)

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRelocated fixup table macros
Michael Taufen [Wed, 24 Feb 2016 23:15:48 +0000 (15:15 -0800)]
Relocated fixup table macros

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoExtended state data structures (XCC)
Michael Taufen [Mon, 22 Feb 2016 22:11:37 +0000 (14:11 -0800)]
Extended state data structures (XCC)

Rebuild your kenrel headers and rebuild all user apps!

new ancillary_state state components
x86_default_xcr0
xcr0 in guest_pcore

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove some trailing whitespace.
Michael Taufen [Thu, 11 Feb 2016 17:50:47 +0000 (09:50 -0800)]
Remove some trailing whitespace.

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoTurn off TSD in slave processors.
Kanoj Sarcar [Wed, 24 Feb 2016 19:08:13 +0000 (14:08 -0500)]
Turn off TSD in slave processors.

Turn off TSD (Time Stamp Disable) on slaves.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd page reference counting to mm hooks.
Kanoj Sarcar [Mon, 22 Feb 2016 23:42:20 +0000 (15:42 -0800)]
Add page reference counting to mm hooks.

Add page reference counting logic to some of the user map helper functions.

Expose one of the mlx4 parameters to user space.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMake query_port not report port_down always.
Kanoj Sarcar [Mon, 22 Feb 2016 23:35:17 +0000 (15:35 -0800)]
Make query_port not report port_down always.

Hack existing linux logic to avoid netdev stuff that was reporting port_down
always.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix couple of problems in compat code.
Kanoj Sarcar' via Akaros [Thu, 18 Feb 2016 22:11:00 +0000 (14:11 -0800)]
Fix couple of problems in compat code.

While trying newer tests, the non-initialization logic of SGL's became
apparent. Also, newer tests invoke get_user_pages() without faulting in
corresponding pages, so we need to automatically allocate the pages.

Clean up to do reference counting in get_user_pages() etc will come later.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove user include hacks
Barret Rhoden [Tue, 16 Feb 2016 21:15:34 +0000 (16:15 -0500)]
Remove user include hacks

Due to the old style of having user libraries include their own headers as
both <libname/foo.h> and <foo.h>, we had to have a few hacks to force us to
include the 'real' headers that we wanted.

Now that we do things the right way, we don't need to carry those hacks
around.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoClean up user library include paths (XCC)
Barret Rhoden [Tue, 16 Feb 2016 19:33:42 +0000 (14:33 -0500)]
Clean up user library include paths (XCC)

Allowing libraries to search their own include/ for <foo.h> is a huge mess
that results in issues when glibc has foo.h.  The fix is to not allow that,
and to insist libraries refer to their own files by their full name
(libname/foo.h).

All user libraries (other than pthread) now have their include directories
arranged as:

user/LIBNAME/include/LIBNAME/FOO.h

With their include path being set to user/LIBNAME/include/, and all
 #includes explicitly list the libname.

Due to moving parlib's arch symlink, you'll need to do something like:

$ rm user/parlib/include/arch
$ make mrproper
$ mv .config.old .config
$ make ARCH=x86 oldconfig
$ make userclean

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoActivate kernel bypass logic
Kanoj Sarcar' via Akaros [Thu, 11 Feb 2016 01:11:53 +0000 (17:11 -0800)]
Activate kernel bypass logic

Hook in mlx4/ driver to activate kernel bypass logic.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoPort over linux 4.1.15 infiniband/core logic for kernel bypass NIC access
Kanoj Sarcar' via Akaros [Thu, 11 Feb 2016 01:09:47 +0000 (17:09 -0800)]
Port over linux 4.1.15 infiniband/core logic for kernel bypass NIC access

Port over linux 4.1.15 drivers/infiniband/core logic essential for
kernel bypass NIC access. Slight edits to adapt to Akaros environment
(#if exclusion of non essential code blocks, panic stubs etc), described
in README file.

Most of the interlock logic with core kernel (mm/vfs etc) is captured
in compat.[ch].

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoPort over linux 4.1.15 mlx4 kernel bypass driver
Kanoj Sarcar' via Akaros [Wed, 10 Feb 2016 23:54:30 +0000 (15:54 -0800)]
Port over linux 4.1.15 mlx4 kernel bypass driver

Port over linux 4.1.15 drivers/infiniband/hw/mlx4 logic essential for
kernel bypass NIC access. Slight edits to adapt to Akaros environment
(#if exclusion of non essential code blocks, panic stubs etc), described
in README file.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUpdates from vmm-akaros
Michael Taufen [Wed, 10 Feb 2016 17:37:58 +0000 (09:37 -0800)]
Updates from vmm-akaros

Boot params
e820 info
Use copy_vmctl_tovmtf(*) in __build_vm_ctx_cp(*)
Inject GPF on unsupported MSR access
Add linux_bootparam.h

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
[ pragma once, static_assert->parlib_static_assert ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove kernel errno string processing
Barret Rhoden [Sat, 13 Feb 2016 20:57:08 +0000 (15:57 -0500)]
Remove kernel errno string processing

The kernel doesn't really need to know about the string names for errno
values.  We were using that mostly as a hack to not use proper
errstrings.

I kept parse_errno.sh around, since we (theoretically) still use that to
generate error lists in glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove uses of errno_to_string()
Barret Rhoden [Sat, 13 Feb 2016 19:03:57 +0000 (14:03 -0500)]
Remove uses of errno_to_string()

Using errno_to_string() was a hack.

In addition to removing that, this commit cleans up a few nasty things.
In namec(), we just had a static string floating around for some reason.
Good times.

More importantly, in sysfile we were doing a brain-dead strcmp on
ENODATA.  Computers should do comparisons on errno.  Errstr is for
humans.  The danger there is that if someone did:

error(ENODATA, "Actually a useful message that was not NULL")

then the strcmp on errstr would fail, since it's not the "string that
meant ENODATA).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoOutlaw the setting of NULL errstrs
Barret Rhoden [Sat, 13 Feb 2016 19:12:01 +0000 (14:12 -0500)]
Outlaw the setting of NULL errstrs

This will catch them if we try to use them.  O/w we'll have to rely on
other methods (code review/tools) to find them.

Maybe there's an argument to be made for a simple error(EFOO, 0),
where you just don't want to bother making a string.  Then for now you
can use ERROR_FIXME.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove the printk format %e
Barret Rhoden [Sat, 13 Feb 2016 19:00:35 +0000 (14:00 -0500)]
Remove the printk format %e

We were using it in two places, and one of them was incorrect (getchar()
wasn't returning an errno).

It was also blindly inferring errstr() from the context.  If we're going to
do that, we might as well not even pass in the err.  It was basically an
unused perror() for the kernel.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoqio: Use an empty string to mark a closed queue
Barret Rhoden [Sat, 13 Feb 2016 17:48:14 +0000 (12:48 -0500)]
qio: Use an empty string to mark a closed queue

Instead of converting ECONNABORTED to a string and then doing a
brain-dead strcmp, we can just use an empty string.  AFAIK, qclose() or
hangups with no message are meant to be normal closes.  Reads will just
return 0 (no data, EOF, etc.), instead of throwing an error.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip protocol's bind()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 17:21:16 +0000 (12:21 -0500)]
Have #ip protocol's bind()s throw errors

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip protocol's announce()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 17:16:20 +0000 (12:16 -0500)]
Have #ip protocol's announce()s throw errors

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip protocol's connect()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 17:06:23 +0000 (12:06 -0500)]
Have #ip protocol's connect()s throw errors

A couple extra things:

Fsstdbind and Fsstdannounce have temporary waserror shims, until those
get changed.  I needed to change setladdrport to throw, and these needed
to catch it for now.

udpconnect() was the only connect method to call Fsconnected() even if
Fsstdconnect() failed.  All of the others just return immediately.  A
potential effect of Fsconnected() is that it calls rendez_wake on the
"connection rendez" in the conversation (c->cr).  It might be the case
that someone could be sleeping, and we fail to wake them up.  Perhaps a
connect or announce succeeded, but then we failed with this connect, and
now we don't wake anyone.

Given that udpannounce is structured the same as the other connects
(doesn't call Fsconnected() on error), and the qlocks on the CV for
connect and announce, I think this can't happen.  And if it does, then
we just need to fix this connect/announce mess to make it not happen
globally.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip's protocol ctl()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 16:29:03 +0000 (11:29 -0500)]
Have #ip's protocol ctl()s throw errors

I took care of UDP and ICMP6 in this commit, since they were fairly
simple.  TCP and IPIFC were a bit more complex.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoThrow errors from within ipifcctl()
Barret Rhoden [Sat, 13 Feb 2016 16:16:34 +0000 (11:16 -0500)]
Throw errors from within ipifcctl()

This commit changes the internals of ipifcctl() to use error().  Note
that this does not change ipifcconnect() (yet), though it mucks with
that functions slightly due to a common helper.

I also added a helper for ipifc_iprouting, instead of performing the
"iprouting" operation in-line.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoThrow errors from within tcpctl()
Barret Rhoden [Fri, 12 Feb 2016 22:24:17 +0000 (17:24 -0500)]
Throw errors from within tcpctl()

The #ip ctl message framework expects to get a string for an error, then
it just calls error() with that string.  We even go so far as to catch the
error, then return the current_errstr().  All a bit ridiculous.

Changing TCP's ctl message is the first in a few steps to change #ip's ctl
interface.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove bootp
Barret Rhoden [Fri, 12 Feb 2016 22:48:22 +0000 (17:48 -0500)]
Remove bootp

This was just a source of null pointer faults in the kernel.  bootp was a
function pointer, set to null.  You can crash the kernel with:

/ $ echo "bootp" > /net/ipifc/0/ctl

As Ron aptly put it: "bootp is dead to me."

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBuild the kernel with -Werror
Barret Rhoden [Sat, 13 Feb 2016 17:31:32 +0000 (12:31 -0500)]
Build the kernel with -Werror

For people doing development, they can turn it off locally (i.e. not
committed) in the Makefile.  But by default, all builds need to have
-Werror.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove the static_link_warning from glibc (XCC)
Barret Rhoden [Fri, 12 Feb 2016 20:02:52 +0000 (15:02 -0500)]
Remove the static_link_warning from glibc (XCC)

If you build a program statically and use dlopen (or one of a few other
functions), you'll get a warning.  The warning is meant to tell you that
even though you built statically, you still need to have the right .so's
for things to work at runtime.  That's fine.

The problem is that, while this information is nice, it is a warning, and
not just informational, and it breaks with -Werror.

Rebuild your toolchain.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agomlx4: Port over Linux header files related to NIC kernel bypass
Kanoj Sarcar' via Akaros [Wed, 10 Feb 2016 23:31:00 +0000 (15:31 -0800)]
mlx4: Port over Linux header files related to NIC kernel bypass

Slight edits on top of Linux 4.1.15 header files for Akaros builds.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
[fixed a checkpatch warning]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoEnable build info rebuild upon HEAD commit ID change
Davide Libenzi [Mon, 21 Dec 2015 19:24:36 +0000 (11:24 -0800)]
Enable build info rebuild upon HEAD commit ID change

Enable build info rebuild upon HEAD commit ID change.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd QEMU port forwarding options for UDP as well as TCP
Edward Hyunkoo Jee [Thu, 11 Feb 2016 01:26:13 +0000 (17:26 -0800)]
Add QEMU port forwarding options for UDP as well as TCP

Signed-off-by: Edward Hyunkoo Jee <edjee@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove #nix
Barret Rhoden [Wed, 10 Feb 2016 23:22:44 +0000 (18:22 -0500)]
Remove #nix

That was an old experiment that we haven't touched in over a year and will
probably never use again.  If we do, we can resurrect it.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Fix missed posted IRQs
Barret Rhoden [Wed, 10 Feb 2016 19:22:52 +0000 (14:22 -0500)]
VMM: Fix missed posted IRQs

There's a couple parts to it:

- vmrunkernel was not posting the IRQ properly; it wasn't setting the
  outstanding notification bit.

- We need to self_ipi when that bit is set.  We had previously lost a race
  when poking the guest pcore (IPI was sent, but not received while in a
VM).  We just resend the IPI.

For ease of access, I now store the posted_irq_desc in the GPC.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add a syscall to poke a guest pcore (XCC)
Barret Rhoden [Mon, 8 Feb 2016 17:29:27 +0000 (12:29 -0500)]
VMM: Add a syscall to poke a guest pcore (XCC)

Posted IRQs in VMX are a lot like poking the guest pcore, so we'll just use
a syscall for it.

There's a bit of nastiness with error handling.  So far, it's a real pain
to find out if a posted IRQ landed on the VM and handling if it didn't.
(When the POKE IRQ lands and the core wasn't a VM, how do we know for
certain which VM we were supposed to interrupt, without doing something
painful?).

The general Akaros philosophy here is to post a bit in memory and poke
spuriously.  When it comes to notifying vcores, we set notif_pending, send
a (possibly spurious) __notify, and if we missed it, we'll see the
notif_pending the next time we __startcore.  Hopefully we can do something
similar with posted IRQs.

This also cleans up all of the vmctl hacks, none of which are needed
anymore.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>