The OpenIndiana (Solaris) e1000g driver drops frames that are too long
or too short. It expects to receive frames of at least the Ethernet
minimum size. ARP requests in particular are small and will be dropped
if they are not padded appropriately, preventing a Solaris VM from
becoming visible on the network.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
file.index is unsigned, hence 'while (--file.index >= 0)'
will loop > forever. Change to while (file.index-- > 0).
Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Sending ESP a command caused it to trigger DMA immediately
even if DMA was not enabled at the DMA controller.
Add a signal from DMA controller to ESP to tell ESP about changes in
DMA enable bit. Also use the correct function for setting up GPIO outputs.
This fixes NetBSD 1.6.1 through 3.0 boot.
Thanks to Artyom Tarasenko for extensive debugging of the problem.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
The /bin/sh in Milax has problems with the regex:
Error: invalid trace backend
Please choose a supported trace backend.
Fix it by escaping ')' like the regexes with '('.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Add C type rules, adapted from libvirt HACKING. Also include
a description of special QEMU scalar types.
Move typedef rule from CODING_STYLE rule 3 to HACKING rule 6
where it belongs.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Add a new file, HACKING, in order to collect recurring
issues with submitted patches.
Start with preprocessor rules, adapted from libvirt HACKING.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Janne Huttunen noticed that the FIFO end pointer is updated by the
guest after writing each word to the FIFO, at least the X.org driver
which is open does this. This means that there's no way for the
host to know if the guest is in the middle a write operation. Qemu
thus needs to read the beginning of the command up to when it's able
to tell how many words are expected for the given command. It will
abort reading and rewind the FIFO if there aren't enough words yet,
this should be relatively rare but it is suspected to have been the
cause of the occasional FIFO overrun that killed the display.
Character devices created by qemu_chr_open don't
allow duplicate device names, so naming all
UART devices "null" no longer works.
Running "qemu-system-arm -M n800" (and some other machines)
results in this error message:
qemu-system-arm: Duplicate ID 'null' for chardev
Can't create serial device, empty char device
This is fixed by setting a default label "uart1",
"uart2" or "uart3".
Cc: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
This patch adds trace events for virtqueue operations including
adding/removing buffers, notifying the guest, and receiving a notify
from the guest.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
It is often useful to instrument memory management functions in order to
find leaks or performance problems. This patch adds trace events for
the memory allocation primitives.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch adds LTTng Userspace Tracer (UST) backend support. The UST
system requires no kernel support but libust and liburcu must be
installed.
$ ./configure --trace-backend ust
$ make
Start the UST daemon:
$ ustd &
List available tracepoints and enable some:
$ ustctl --list-markers $(pgrep qemu)
[...]
{PID: 5458, channel/marker: ust/paio_submit, state: 0, fmt: "acb %p
opaque %p sector_num %lu nb_sectors %lu type %lu" 0x4b32ba}
$ ustctl --enable-marker "ust/paio_submit" $(pgrep qemu)
Run the trace:
$ ustctl --create-trace $(pgrep qemu)
$ ustctl --start-trace $(pgrep qemu)
[...]
$ ustctl --stop-trace $(pgrep qemu)
$ ustctl --destroy-trace $(pgrep qemu)
Trace results can be viewed using lttv-gui.
More information about UST:
http://lttng.org/ust
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
trace: Check for LTTng Userspace Tracer headers
When using the 'ust' backend, check if the relevant headers are
available at host.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch adds an optional command line switch '-trace' to specify the
filename to write traces to, when qemu starts.
Eg, If compiled with the 'simple' trace backend,
[temp@system]$ qemu -trace FILENAME IMAGE
Allows the binary traces to be written to FILENAME instead of the option
set at config-time.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch adds the trace-file command:
trace-file [on|off|flush]
Open, close, or flush the trace file. If no argument is given,
the status of the trace file is displayed.
The trace file is turned on by default but is only written out when the
trace buffer becomes full. The flush operation can be used to force
write out at any time.
Turning off the trace file does not change the state of trace events;
tracing will continue to the trace buffer. When the trace file is off,
use "info trace" to display the contents of the trace buffer in memory.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This commit also contains the trace-file sub-command from the following
commit:
commit 5ce8d1a957afae2c52ad748944ce72848ccf57bd
Author: Prerna Saxena <prerna@linux.vnet.ibm.com>
Date: Wed Aug 4 16:23:54 2010 +0530
trace: Add options to specify trace file name at startup and runtime
This patch adds an optional command line switch '-trace' to specify the
filename to write traces to, when qemu starts.
Eg, If compiled with the 'simple' trace backend,
[temp@system]$ qemu -trace FILENAME IMAGE
Allows the binary traces to be written to FILENAME instead of the option
set at config-time.
Also, this adds monitor sub-command 'set' to trace-file commands to
dynamically change trace log file at runtime.
Eg,
(qemu)trace-file set FILENAME
This allows one to set trace outputs to FILENAME from the default
specified at startup.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Allow users to specify a file for trace-outputs at configuration.
Also, allow trace files to be annotated by <pid> so each qemu instance has
unique traces.
The trace file name can be passed as a config option:
--trace-file=/path/to/file
(Default: trace )
At runtime, the pid of the qemu process is appended to the filename so
that mutiple qemu instances do not have overlapping logs.
Eg : trace-1234 for qemu launched with pid 1234.
I have yet to test this on windows. getpid() is used at many places
in code(including vnc.c), so I'm hoping this would be okay too.
Edited-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Sometimes it is useful to disable a trace event. Removing the event
from trace-events is not enough since source code will call the
trace_*() function for the event.
This patch makes it easy to build without specific trace events by
marking them disabled in trace-events:
disable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"
This builds without the multiwrite_cb trace event.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
trace: Allow bulk enabling/disabling of trace events at compile time
For 'simple' trace backend, allow bulk enabling/disabling of trace
events at compile time. Trace events that are preceded by 'disable'
keyword are compiled in, but turned off by default. These can
individually be turned on using the monitor. All other trace events are
enabled by default.
TODO :
This could be enhanced when the trace-event namespace is partitioned into a
group and an ID within that group. In such a case, marking a group as enabled
would automatically enable all trace-events listed under it.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch adds support for dynamically enabling/disabling of trace events.
This is done by internally maintaining each trace event's state, and
permitting logging of data from a trace event only if it is in an
'active' state.
Monitor commands added :
1) info trace-events : to view all available trace events and
their state.
2) trace-event NAME on|off : to enable/disable data logging from a
given trace event.
Eg, trace-event paio_submit off
disables logging of data when
paio_submit is hit.
By default, all trace-events are disabled. One can enable desired trace-events
via the monitor.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
trace: Monitor command 'info trace'
Monitor command 'info trace' to display contents of trace buffer
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
trace: Remove monitor.h dependency from simpletrace
User-mode targets don't have a monitor so the simple trace backend
currently does not build on those targets. This patch abstracts the
monitor printing interface so there is no direct coupling between
simpletrace and the monitor.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch adds a simple tracer which produces binary trace files. To
try out the simple backend:
$ ./configure --trace-backend=simple
$ make
After running QEMU you can pretty-print the trace:
$ ./simpletrace.py trace-events trace.log
The output of simpletrace.py looks like this:
qemu_realloc 0.699 ptr=0x24363f0 size=0x3 newptr=0x24363f0
qemu_free 0.768 ptr=0x24363f0
^ ^---- timestamp delta (us)
|____ trace event name
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
trace: Make trace record fields 64-bit
Explicitly use 64-bit fields in trace records so that timestamps and
magic numbers work for 32-bit host builds.
Includes fixes from Prerna Saxena <prerna@linux.vnet.ibm.com>.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch introduces the trace-events file where trace events can be
declared like so:
qemu_malloc(size_t size) "size %zu"
qemu_free(void *ptr) "ptr %p"
These trace event declarations are processed by a new tool called
tracetool to generate code for the trace events. Trace event
declarations are independent of the backend tracing system (LTTng User
Space Tracing, ftrace markers, DTrace).
The default "nop" backend generates empty trace event functions.
Therefore trace events are disabled by default.
The trace-events file serves two purposes:
1. Adding trace events is easy. It is not necessary to understand the
details of a backend tracing system. The trace-events file is a
single location where trace events can be declared without code
duplication.
2. QEMU is not tightly coupled to one particular backend tracing system.
In order to support tracing across QEMU host platforms and to
anticipate new backend tracing systems that are currently maturing,
it is important to be flexible and not tied to one system.
This commit includes fixes from Prerna Saxena
<prerna@linux.vnet.ibm.com> and Blue Swirl <blauwirbel@gmail.com>.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Symbols with a size of 0 are unusable for the disassembler.
Example:
While running an arm linux kernel, no symbolic names are
used in qemu.log when the cpu is executing an assembler function.
Assume that the size of such symbols is the difference to the
next symbol value.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix this warning:
CC savevm.o
/src/qemu/savevm.c: In function `do_savevm':
/src/qemu/savevm.c:1900: warning: passing arg 1 of `localtime_r' from incompatible pointer type
It looks like on OpenBSD the type of tv_sec in struct timeval is still
'long' instead of time_t as in most other OS. Fix by adding a cast.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This reverts commit 79368c81bf.
Conflicts:
block.c
I haven't been able to come up with a solution yet for the corruption caused by
unaligned requests from the IDE disk so revert until a solution can be written.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This patch applies on top of 9P2000.L patches that we have on the list.
I took a look at how 9P server is handling open() flags in 9P2000.L path.
I think we can do away with the valid_flags() function and simplify the
code. The reasoning is as follows:
O_NOCTTY: (If the file is a terminal, don't make it the controlling
terminal of the process even though the process does not have a controlling
terminal) By the time the control reaches 9P client it is clear that what
we have is not a terminal device. Hence it does not matter what we do with
this flag. In any case 9P server can filter this flag out before making the
syscall.
O_NONBLOCK: (Don't block if i) Can't read/write to the file ii) Can't get
locks) This has an impact on FIFOs, but also on file locks. Hence we can
pass it down to the system call.
O_ASYNC: From the manpage:
O_ASYNC
Enable signal-driven I/O: generate a signal (SIGIO by default, but
this can be changed via fcntl(2)) when input or output becomes pos-
sible on this file descriptor. This feature is only available for
terminals, pseudo-terminals, sockets, and (since Linux 2.6) pipes
and FIFOs. See fcntl(2) for further details.
Again, this does not make any impact on regular files handled by 9P. Also,
we don't want 9P server to receive SIGIO. Hence I think 9P server can
filter this flag out before making the syscall.
O_CLOEXEC: This flag makes sense only on the client. If guest user space
sets this flag the guest VFS will take care of calling close() on the fd if
an exec() happens. Hence 9P client need not be bothered with this flag.
Also I think QEMU will not do an exec, but if it does, it makes sense to
close these fds. Hence we can pass this flag down to the syscall.
O_CREAT: Since we are in open() path it means we have confirmed that the file
exists. Hence there is no need to pass O_CREAT flag down to the system. In fact
on some versions of glibc this causes problems, because we pass O_CREAT flag,
but don't have permission bits. Hence we can just mask this flag out.
So in summary:
Mask out:
O_NOCTTY
O_ASYNC
O_CREAT
Pass-through:
O_NONBLOCK
O_CLOEXEC
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
This is equivalent to SM_PASSTHROUGH security model.
The only exception is, failure of privilige operation like chown
are ignored. This makes a passthrough like security model usable
for people who runs kvm as non root
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
With mapped security mode we use "user.virtfs" namespace is used
to store the virtFs related attributes. So hide it from user.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
TXATTRCREATE: Prepare a fid for setting xattr value on a file system object.
size[4] TXATTRCREATE tag[2] fid[4] name[s] attr_size[8] flags[4]
size[4] RXATTRWALK tag[2]
txattrcreate gets a fid pointing to xattr. This fid can later be
used to get set the xattr value.
flag value is derived from set Linux setxattr. The manpage says
"The flags parameter can be used to refine the semantics of the operation.
XATTR_CREATE specifies a pure create, which fails if the named attribute
exists already. XATTR_REPLACE specifies a pure replace operation, which
fails if the named attribute does not already exist. By default (no flags),
the extended attribute will be created if need be, or will simply replace
the value if the attribute exists."
The actual setxattr operation happens when the fid is clunked. At that point
the written byte count and the attr_size specified in TXATTRCREATE should be
same otherwise an error will be returned.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>