Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Aug 2009 00:23:39 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        freebsd-emulation@FreeBSD.org
Cc:        qemu-devel@nongnu.org, Jung-uk Kim <jkim@FreeBSD.org>
Subject:   experimental FreeBSD qemu-devel git head port update for testing
Message-ID:  <20090829222339.GA93608@triton8.kn-bremen.de>

next in thread | raw e-mail | index | archive | help
Hi!

 Jan Kiszka asked me if the unstable guest timer irq problem still
exists on qemu git head, so I made an update for that today:
	http://people.freebsd.org/~nox/qemu/qemu-devel-20090829.patch
(and found out it does.)

 The bad news (for FreeBSD users anyway) is kqemu support has now been
removed as `promised' (by the upstream qemu developers), so testing this
version is probably less interesting for many FreeBSD users than the
qemu 0.11 stable branch snapshot I posted about here,
	http://lists.freebsd.org/pipermail/freebsd-emulation/2009-August/006646.html
but e.g. users of non-x86 targets probably will still be interested.

 Also the pcap patch stopped working in this snapshot and I don't yet
know why.  (I think the original version of that patch was submitted by
Jung-uk Kim, maybe he has an idea; Cc'd.)

 Other misc notes:

1. I had to replace the line
	CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
by
	CFLAGS += -fno-stack-protector
in qemu/pc-bios/optionrom/Makefile because now make complained about
recursive use of CFLAGS (in addition to forcing use of a newer as(1)
for multiboot.S as already mentioned for the 0.11 rc, see
files/patch-pc-bios-optionrom-Makefile in the update.)

2. vl.c references __FreeBSD_version in a few places but still didn't
#include <sys/param.h> to get the definition:

Index: qemu/vl.c
@@ -57,6 +57,7 @@
 #include <sys/stat.h>
 #if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <libutil.h>
+#include <sys/param.h>
 #else
 #include <util.h>
 #endif

3. Do you guys think the posix timer patch is ready to be committed now?
It _might_ cause -lrt to end up in $LIBS twice now tho.  (not on FreeBSD
since clock_gettime() is in libc there.)  Btw it (-clock dynticks)
also does't help the mentioned timer irq problems...

Index: qemu/configure
@@ -1538,6 +1538,20 @@
   LIBS="-lrt $LIBS"
 fi
 
+##########################################
+# posix timer probe
+cat > $TMPC <<EOF
+#include <time.h>
+int main(void) { timer_create(CLOCK_REALTIME, (struct sigevent *)NULL, (timer_t *)NULL); return 0; }
+EOF
+posixtimer=no
+if compile_prog "" "" ; then
+  posixtimer=yes
+elif compile_prog "" "-lrt" ; then
+  posixtimer=yes
+  LIBS="-lrt $LIBS"
+fi
+
 # Determine what linker flags to use to force archive inclusion
 check_linker_flags()
 {
@@ -1872,6 +1886,9 @@
 if test "$fdt" = "yes" ; then
   echo "CONFIG_FDT=y" >> $config_host_mak
 fi
+if test "$posixtimer" = "yes" ; then
+  echo "CONFIG_POSIX_TIMER=y" >> $config_host_mak
+fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
Index: qemu/vl.c
@@ -918,12 +918,16 @@
 static int unix_start_timer(struct qemu_alarm_timer *t);
 static void unix_stop_timer(struct qemu_alarm_timer *t);
 
-#ifdef __linux__
+#ifdef CONFIG_POSIX_TIMER
 
 static int dynticks_start_timer(struct qemu_alarm_timer *t);
 static void dynticks_stop_timer(struct qemu_alarm_timer *t);
 static void dynticks_rearm_timer(struct qemu_alarm_timer *t);
 
+#endif
+
+#ifdef __linux__
+
 static int hpet_start_timer(struct qemu_alarm_timer *t);
 static void hpet_stop_timer(struct qemu_alarm_timer *t);
 
@@ -1001,9 +1005,11 @@
 
 static struct qemu_alarm_timer alarm_timers[] = {
 #ifndef _WIN32
-#ifdef __linux__
+#ifdef CONFIG_POSIX_TIMER
     {"dynticks", ALARM_FLAG_DYNTICKS, dynticks_start_timer,
      dynticks_stop_timer, dynticks_rearm_timer, NULL},
+#endif
+#ifdef __linux__
     /* HPET - if available - is preferred */
     {"hpet", 0, hpet_start_timer, hpet_stop_timer, NULL, NULL},
     /* ...otherwise try RTC */
@@ -1361,7 +1367,7 @@
     return delta;
 }
 
-#if defined(__linux__) || defined(_WIN32)
+#if defined(CONFIG_POSIX_TIMER) || defined(_WIN32)
 static uint64_t qemu_next_deadline_dyntick(void)
 {
     int64_t delta;
@@ -1506,6 +1512,10 @@
     close(rtc_fd);
 }
 
+#endif /* defined(__linux__) */
+
+#ifdef CONFIG_POSIX_TIMER
+
 static int dynticks_start_timer(struct qemu_alarm_timer *t)
 {
     struct sigevent ev;
@@ -1577,7 +1587,7 @@
     }
 }
 
-#endif /* defined(__linux__) */
+#endif /* defined(CONFIG_POSIX_TIMER) */
 
 static int unix_start_timer(struct qemu_alarm_timer *t)
 {

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090829222339.GA93608>