* Log filtering from Alex and Peter

* Chardev fix from Marc-André
 * config.status tweak from David
 * Header file tweaks from Markus, myself and Veronia (Outreachy candidate)
 * get_ticks_per_sec() removal from Rutuja (Outreachy candidate)
 * Coverity fix from myself
 * PKE implementation from myself, based on rth's XSAVE support
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABCAAGBQJW9ErPAAoJEL/70l94x66DJfEH/A/QkMpAhrgNdyVsahzsGrzE
 wx5gHFIc1nBYxyr62w4apUb5jPB7zaXu0LA7EAWDeAe0pyP8hZzLT9kJyOEDsuJu
 zwKN2QeLSNMtPbnbKN0I/YQ2za2xX1V5ruhSeOJoVslUI214hgnAURaGshhQNzuZ
 2CluDT9KgL5cQifAnKs5kJrwhIYShYNQB+1eDC/7wk28dd/EH+sPALIoF+rqrSmt
 Zu4Mdqd+9Ns+oKOjA6br9ULq/Hzg0aDfY82J+XLVVqfF3PXQe8rTDmuMf/7jTn+M
 Un7ZOcei9oZF2/9vfAfKQpDCcgD9HvOUSbgqV/ubmkPPmN/LNJzeKj0fBhrRN+Y=
 =K12D
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* Log filtering from Alex and Peter
* Chardev fix from Marc-André
* config.status tweak from David
* Header file tweaks from Markus, myself and Veronia (Outreachy candidate)
* get_ticks_per_sec() removal from Rutuja (Outreachy candidate)
* Coverity fix from myself
* PKE implementation from myself, based on rth's XSAVE support

# gpg: Signature made Thu 24 Mar 2016 20:15:11 GMT using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"

* remotes/bonzini/tags/for-upstream: (28 commits)
  target-i386: implement PKE for TCG
  config.status: Pass extra parameters
  char: translate from QIOChannel error to errno
  exec: fix error handling in file_ram_alloc
  cputlb: modernise the debug support
  qemu-log: support simple pid substitution for logs
  target-arm: dfilter support for in_asm
  qemu-log: dfilter-ise exec, out_asm, op and opt_op
  qemu-log: new option -dfilter to limit output
  qemu-log: Improve the "exec" TB execution logging
  qemu-log: Avoid function call for disabled qemu_log_mask logging
  qemu-log: correct help text for -d cpu
  tcg: pass down TranslationBlock to tcg_code_gen
  util: move declarations out of qemu-common.h
  Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND
  hw: explicitly include qemu-common.h and cpu.h
  include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h
  isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h
  Move ParallelIOArg from qemu-common.h to sysemu/char.h
  Move QEMU_ALIGN_*() from qemu-common.h to qemu/osdep.h
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Conflicts:
	scripts/clean-includes
This commit is contained in:
Peter Maydell 2016-03-24 21:42:12 +00:00
commit 84a5a80148
620 changed files with 1774 additions and 755 deletions

View file

@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/base64.h"
static const char *base64_valid_chars =

View file

@ -29,6 +29,7 @@
#include "qemu/sockets.h"
#include "qemu/iov.h"
#include "net/net.h"
#include "qemu/cutils.h"
void strpadcpy(char *buf, int buf_size, const char *str, char pad)
{
@ -160,6 +161,38 @@ int qemu_fdatasync(int fd)
#endif
}
/* vector definitions */
#ifdef __ALTIVEC__
#include <altivec.h>
/* The altivec.h header says we're allowed to undef these for
* C++ compatibility. Here we don't care about C++, but we
* undef them anyway to avoid namespace pollution.
*/
#undef vector
#undef pixel
#undef bool
#define VECTYPE __vector unsigned char
#define SPLAT(p) vec_splat(vec_ld(0, p), 0)
#define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
#define VEC_OR(v1, v2) ((v1) | (v2))
/* altivec.h may redefine the bool macro as vector type.
* Reset it to POSIX semantics. */
#define bool _Bool
#elif defined __SSE2__
#include <emmintrin.h>
#define VECTYPE __m128i
#define SPLAT(p) _mm_set1_epi8(*(p))
#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF)
#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2))
#else
#define VECTYPE unsigned long
#define SPLAT(p) (*(p) * (~0UL / 255))
#define ALL_EQ(v1, v2) ((v1) == (v2))
#define VEC_OR(v1, v2) ((v1) | (v2))
#endif
#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8
static bool
can_use_buffer_find_nonzero_offset_inner(const void *buf, size_t len)
{

View file

@ -13,6 +13,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/error-report.h"

View file

@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/cutils.h"
#include "qemu/event_notifier.h"
#include "sysemu/char.h"
#include "qemu/main-loop.h"

View file

@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/id.h"
bool id_wellformed(const char *id)
{

View file

@ -17,8 +17,10 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/iov.h"
#include "qemu/sockets.h"
#include "qemu/cutils.h"
size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt,
size_t offset, const void *buf, size_t bytes)

View file

@ -20,12 +20,16 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/log.h"
#include "qemu/range.h"
#include "qemu/error-report.h"
#include "qemu/cutils.h"
#include "trace/control.h"
static char *logfilename;
FILE *qemu_logfile;
int qemu_loglevel;
static int log_append = 0;
static GArray *debug_regions;
void qemu_log(const char *fmt, ...)
{
@ -38,17 +42,6 @@ void qemu_log(const char *fmt, ...)
va_end(ap);
}
void qemu_log_mask(int mask, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if ((qemu_loglevel & mask) && qemu_logfile) {
vfprintf(qemu_logfile, fmt, ap);
}
va_end(ap);
}
/* enable or disable low levels log */
void do_qemu_set_log(int log_flags, bool use_own_buffers)
{
@ -96,15 +89,115 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
qemu_log_close();
}
}
/*
* Allow the user to include %d in their logfile which will be
* substituted with the current PID. This is useful for debugging many
* nested linux-user tasks but will result in lots of logs.
*/
void qemu_set_log_filename(const char *filename)
{
char *pidstr;
g_free(logfilename);
logfilename = g_strdup(filename);
pidstr = strstr(filename, "%");
if (pidstr) {
/* We only accept one %d, no other format strings */
if (pidstr[1] != 'd' || strchr(pidstr + 2, '%')) {
error_report("Bad logfile format: %s", filename);
logfilename = NULL;
} else {
logfilename = g_strdup_printf(filename, getpid());
}
} else {
logfilename = g_strdup(filename);
}
qemu_log_close();
qemu_set_log(qemu_loglevel);
}
/* Returns true if addr is in our debug filter or no filter defined
*/
bool qemu_log_in_addr_range(uint64_t addr)
{
if (debug_regions) {
int i = 0;
for (i = 0; i < debug_regions->len; i++) {
struct Range *range = &g_array_index(debug_regions, Range, i);
if (addr >= range->begin && addr <= range->end) {
return true;
}
}
return false;
} else {
return true;
}
}
void qemu_set_dfilter_ranges(const char *filter_spec)
{
gchar **ranges = g_strsplit(filter_spec, ",", 0);
if (ranges) {
gchar **next = ranges;
gchar *r = *next++;
debug_regions = g_array_sized_new(FALSE, FALSE,
sizeof(Range), g_strv_length(ranges));
while (r) {
char *range_op = strstr(r, "-");
char *r2 = range_op ? range_op + 1 : NULL;
if (!range_op) {
range_op = strstr(r, "+");
r2 = range_op ? range_op + 1 : NULL;
}
if (!range_op) {
range_op = strstr(r, "..");
r2 = range_op ? range_op + 2 : NULL;
}
if (range_op) {
const char *e = NULL;
uint64_t r1val, r2val;
if ((qemu_strtoull(r, &e, 0, &r1val) == 0) &&
(qemu_strtoull(r2, NULL, 0, &r2val) == 0) &&
r2val > 0) {
struct Range range;
g_assert(e == range_op);
switch (*range_op) {
case '+':
{
range.begin = r1val;
range.end = r1val + (r2val - 1);
break;
}
case '-':
{
range.end = r1val;
range.begin = r1val - (r2val - 1);
break;
}
case '.':
range.begin = r1val;
range.end = r2val;
break;
default:
g_assert_not_reached();
}
g_array_append_val(debug_regions, range);
} else {
g_error("Failed to parse range in: %s", r);
}
} else {
g_error("Bad range specifier in: %s", r);
}
r = *next++;
}
g_strfreev(ranges);
}
}
const QEMULogItem qemu_log_items[] = {
{ CPU_LOG_TB_OUT_ASM, "out_asm",
"show generated host assembly code for each compiled TB" },
@ -120,7 +213,7 @@ const QEMULogItem qemu_log_items[] = {
{ CPU_LOG_EXEC, "exec",
"show trace before each executed TB (lots of logs)" },
{ CPU_LOG_TB_CPU, "cpu",
"show CPU state before block translation" },
"show CPU registers before entering a TB (lots of logs)" },
{ CPU_LOG_MMU, "mmu",
"log MMU-related activities" },
{ CPU_LOG_PCALL, "pcall",

View file

@ -37,6 +37,7 @@ extern int madvise(caddr_t, size_t, int);
#endif
#include "qemu-common.h"
#include "qemu/cutils.h"
#include "qemu/sockets.h"
#include "qemu/error-report.h"
#include "monitor/monitor.h"

View file

@ -46,10 +46,12 @@
#include "sysemu/sysemu.h"
#include "trace.h"
#include "qapi/error.h"
#include "qemu/sockets.h"
#include <sys/mman.h>
#include <libgen.h>
#include <sys/signal.h>
#include "qemu/cutils.h"
#ifdef CONFIG_LINUX
#include <sys/syscall.h>

View file

@ -32,10 +32,12 @@
#include "qemu/osdep.h"
#include <windows.h>
#include <glib.h>
#include "qapi/error.h"
#include "sysemu/sysemu.h"
#include "qemu/main-loop.h"
#include "trace.h"
#include "qemu/sockets.h"
#include "qemu/cutils.h"
/* this must come after including "trace.h" */
#include <shlobj.h>

View file

@ -7,6 +7,8 @@
#include <sys/param.h>
#include <dirent.h>
#include "qemu-common.h"
#include "qemu/cutils.h"
#include "qemu/path.h"
struct pathelem
{

View file

@ -25,11 +25,15 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/error-report.h"
#include "qapi/qmp/types.h"
#include "qapi/qmp/qerror.h"
#include "qemu/option_int.h"
#include "qemu/cutils.h"
#include "qemu/id.h"
#include "qemu/help_option.h"
/*
* Extracts the name of an option from the parameter string (p points at the

View file

@ -18,11 +18,13 @@
#include "qemu/osdep.h"
#include "monitor/monitor.h"
#include "qapi/error.h"
#include "qemu/sockets.h"
#include "qemu/main-loop.h"
#include "qapi/qmp-input-visitor.h"
#include "qapi/qmp-output-visitor.h"
#include "qapi-visit.h"
#include "qemu/cutils.h"
#ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0

View file

@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/readline.h"
#include "qemu/cutils.h"
#define IS_NORM 0
#define IS_ESC 1

View file

@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/throttle.h"
#include "qemu/timer.h"
#include "block/aio.h"

View file

@ -11,7 +11,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/unicode.h"
/**
* mod_utf8_codepoint: