[Qemu-devel] buildbot failure in qemu on xen41
The Buildbot has detected a new failure on builder xen41 while building qemu. Full details are available at: http://buildbot.b1-systems.de/qemu/builders/xen41/builds/172 Buildbot URL: http://buildbot.b1-systems.de/qemu/ Buildslave for this Build: anthony_xen Build Reason: The Nightly scheduler named 'nightly_xen41' triggered this build Build Source Stamp: [branch master] HEAD Blamelist: BUILD FAILED: failed configure sincerely, -The Buildbot
Re: [Qemu-devel] buildbot failure in qemu on xen41
Anthony, your buildslave is missing a package: ERROR: pixman not present. Your options: (1) Prefered: Install the pixman devel package (any recent distro should have packages as Xorg needs pixman too). (2) Fetch the pixman submodule, using: git submodule update --init pixman On Fri, Nov 2, 2012 at 8:03 AM, wrote: > The Buildbot has detected a new failure on builder xen41 while building qemu. > Full details are available at: > http://buildbot.b1-systems.de/qemu/builders/xen41/builds/172 > > Buildbot URL: http://buildbot.b1-systems.de/qemu/ > > Buildslave for this Build: anthony_xen > > Build Reason: The Nightly scheduler named 'nightly_xen41' triggered this build > Build Source Stamp: [branch master] HEAD > Blamelist: > > BUILD FAILED: failed configure > > sincerely, > -The Buildbot >
[Qemu-devel] [PATCH] Fix spelling (prefered -> preferred)
Signed-off-by: Stefan Weil --- configure |2 +- net/tap-win32.c |7 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 79701ea..860859b 100755 --- a/configure +++ b/configure @@ -2115,7 +2115,7 @@ if test "$pixman" = "system"; then else if test ! -d ${source_path}/pixman/pixman; then echo "ERROR: pixman not present. Your options:" -echo " (1) Prefered: Install the pixman devel package (any recent" +echo " (1) Preferred: Install the pixman devel package (any recent" echo " distro should have packages as Xorg needs pixman too)." echo " (2) Fetch the pixman submodule, using:" echo " git submodule update --init pixman" diff --git a/net/tap-win32.c b/net/tap-win32.c index 8d2d32b..f9bd741 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -565,7 +565,7 @@ static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped, } static int tap_win32_open(tap_win32_overlapped_t **phandle, - const char *prefered_name) + const char *preferred_name) { char device_path[256]; char device_guid[0x100]; @@ -581,8 +581,9 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle, DWORD version_len; DWORD idThread; -if (prefered_name != NULL) -snprintf(name_buffer, sizeof(name_buffer), "%s", prefered_name); +if (preferred_name != NULL) { +snprintf(name_buffer, sizeof(name_buffer), "%s", preferred_name); +} rc = get_device_guid(device_guid, sizeof(device_guid), name_buffer, sizeof(name_buffer)); if (rc) -- 1.7.10.4
Re: [Qemu-devel] [PATCH v3] correct error message qemu-img reported
On Fri, Nov 2, 2012 at 6:11 AM, liguang wrote: > diff --git a/qemu-img.c b/qemu-img.c > index b41e670..d4ea800 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -337,10 +337,15 @@ static int img_create(int argc, char **argv) > > /* Get image size, if specified */ > if (optind < argc) { > -int64_t sval; > +int64_t sval = 0; sval is assigned below so there is no need for this change. > char *end; > sval = strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFIX_B); > -if (sval < 0 || *end) { > +if (sval < 0) { > +error_report("image size is too large!"); I suggest being specific about the upper limit so the user knows which values are valid: "Image size must be less than 8 exabytes!" Stefan
Re: [Qemu-devel] buildbot failure in qemu on default_i386_macosx
Corey, any ideas here? LINK qemu-ga Undefined symbols: "_monitor_get_fd", referenced from: _socket_connect in qemu-sockets.o _socket_listen in qemu-sockets.o "_monitor_fdset_dup_fd_find", referenced from: _qemu_close in osdep.o "_sem_timedwait", referenced from: _qemu_sem_timedwait in qemu-thread-posix.o "_monitor_fdset_dup_fd_remove", referenced from: _qemu_close in osdep.o "_monitor_fdset_get_fd", referenced from: _qemu_open in osdep.o "_qemu_set_fd_handler2", referenced from: _inet_connect_addr in qemu-sockets.o _wait_for_connect in qemu-sockets.o _unix_connect_opts in qemu-sockets.o "_monitor_fdset_dup_fd_add", referenced from: _qemu_open in osdep.o ld: symbol(s) not found On Fri, Nov 2, 2012 at 5:01 AM, wrote: > The Buildbot has detected a new failure on builder default_i386_macosx while > building qemu. > Full details are available at: > http://buildbot.b1-systems.de/qemu/builders/default_i386_macosx/builds/2 > > Buildbot URL: http://buildbot.b1-systems.de/qemu/ > > Buildslave for this Build: MacOSX-10.5 > > Build Reason: The Nightly scheduler named 'nightly_default_5oclock' triggered > this build > Build Source Stamp: [branch master] HEAD > Blamelist: > > BUILD FAILED: failed compile > > sincerely, > -The Buildbot >
Re: [Qemu-devel] live migration which includes previos snapshot
On Fri, Nov 2, 2012 at 4:15 AM, Kuniyasu Suzaki wrote: > Can live migration of QEMU include previous snapshot images? > I want to roll back to a previous snapshot image on another machine > after live migration. > > I was thinking Block Migration bring the snapshot images of QCOW2, but > Block Migration transfers the hard disk image only. > Do I have other methods to move snapshot image at live migration? Can you host your qcow2 image files on shared storage like an NFS server? QEMU does not have a built-in way to migrate the original qcow2 file itself. Stefan
Re: [Qemu-devel] [PATCH 05/22] console: untangle gfx & txt updates
On 2012-11-01 14:04, Gerd Hoffmann wrote: > Stop abusing displaysurface fields for text mode displays. > (bpp = 0, width = cols, height = lines). > > Add flags to displaystate indicating whenever text mode display > (curses) or gfx mode displays (sdl, vnc, ...) are present. > > Add separate displaychangelistener callbacks for text / gfx mode > resize & updates. > > This allows to enable gfx and txt diplays at the same time and also > paves the way for more cleanups in the future. Breaks building xenfb.c. Jan > > Signed-off-by: Gerd Hoffmann > --- > console.c| 59 +--- > console.h| 74 > +++--- > hw/blizzard.c|4 +- > hw/exynos4210_fimd.c |2 +- > hw/g364fb.c |7 +++-- > hw/jazz_led.c|4 +- > hw/milkymist-vgafb.c |2 +- > hw/musicpal.c|2 +- > hw/nseries.c |2 +- > hw/omap_lcdc.c |2 +- > hw/palm.c|2 +- > hw/pl110.c |2 +- > hw/pxa2xx_lcd.c |8 +++--- > hw/qxl-render.c | 10 +++--- > hw/qxl.c |4 +- > hw/sm501.c |4 +- > hw/ssd0303.c |2 +- > hw/ssd0323.c |2 +- > hw/tc6393xb.c|4 +- > hw/tcx.c | 16 +- > hw/vga.c | 34 ++- > hw/vmware_vga.c |4 +- > ui/curses.c | 21 +- > ui/sdl.c | 12 > ui/spice-display.c |4 +- > ui/vnc.c |8 +++--- > vl.c | 14 - > 27 files changed, 171 insertions(+), 138 deletions(-) > > diff --git a/console.c b/console.c > index b53dc1b..61812c7 100644 > --- a/console.c > +++ b/console.c > @@ -638,30 +638,33 @@ static void console_refresh(QemuConsole *s) > > if (s != active_console) > return; > -if (!ds_get_bits_per_pixel(s->ds)) { > + > +if (s->ds->have_text) { > s->text_x[0] = 0; > s->text_y[0] = 0; > s->text_x[1] = s->width - 1; > s->text_y[1] = s->height - 1; > s->cursor_invalidate = 1; > -return; > } > > -vga_fill_rect(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds), > - color_table[0][COLOR_BLACK]); > -y1 = s->y_displayed; > -for(y = 0; y < s->height; y++) { > -c = s->cells + y1 * s->width; > -for(x = 0; x < s->width; x++) { > -vga_putcharxy(s->ds, x, y, c->ch, > - &(c->t_attrib)); > -c++; > +if (s->ds->have_gfx) { > +vga_fill_rect(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds), > + color_table[0][COLOR_BLACK]); > +y1 = s->y_displayed; > +for (y = 0; y < s->height; y++) { > +c = s->cells + y1 * s->width; > +for (x = 0; x < s->width; x++) { > +vga_putcharxy(s->ds, x, y, c->ch, > + &(c->t_attrib)); > +c++; > +} > +if (++y1 == s->total_height) { > +y1 = 0; > +} > } > -if (++y1 == s->total_height) > -y1 = 0; > +console_show_cursor(s, 1); > +dpy_gfx_update(s->ds, 0, 0, ds_get_width(s->ds), > ds_get_height(s->ds)); > } > -console_show_cursor(s, 1); > -dpy_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds)); > } > > static void console_scroll(int ydelta) > @@ -1094,17 +1097,17 @@ void console_select(unsigned int index) > qemu_del_timer(active_console->cursor_timer); > } > active_console = s; > -if (ds_get_bits_per_pixel(s->ds)) { > +if (ds->have_gfx) { > ds->surface = qemu_resize_displaysurface(ds, s->g_width, > s->g_height); > -} else { > -s->ds->surface->width = s->width; > -s->ds->surface->height = s->height; > +dpy_gfx_resize(ds); > +} > +if (ds->have_text) { > +dpy_text_resize(ds, s->width, s->height); > } > if (s->cursor_timer) { > qemu_mod_timer(s->cursor_timer, > qemu_get_clock_ms(rt_clock) + CONSOLE_CURSOR_PERIOD / 2); > } > -dpy_resize(s->ds); > vga_hw_invalidate(); > } > } > @@ -1123,10 +1126,10 @@ static int console_puts(CharDriverState *chr, const > uint8_t *buf, int len) > console_putchar(s, buf[i]); > } > console_show_cursor(s, 1); > -if (ds_get_bits_per_pixel(s->ds) && s->update_x0 < s->update_x1) { > -dpy_update(s->ds, s->update_x0, s->update_y0, > - s->update_x1 - s->update_x0, > - s->update_y1 - s->update_y0); > +if (s->ds->have_gfx && s->update_x0 < s->update_x1) { > +dpy_gfx_update(s->ds, s->update_x0, s->update_y0, > + s->update_x1 - s->update_x0
Re: [Qemu-devel] [PATCH v2 15/39] vl: init main loop earlier
On 2012-10-31 16:30, Paolo Bonzini wrote: > Otherwise, chardevs will not be able to create a bottom half as soon > as that will require an AioContext. > > Signed-off-by: Paolo Bonzini > --- > vl.c | 12 ++-- > 1 file modificato, 6 inserzioni(+), 6 rimozioni(-) > > diff --git a/vl.c b/vl.c > index b3186fa..f84e969 100644 > --- a/vl.c > +++ b/vl.c > @@ -3311,6 +3311,12 @@ int main(int argc, char **argv, char **envp) > } > loc_set_none(); > > +qemu_init_cpu_loop(); > +if (qemu_init_main_loop()) { > +fprintf(stderr, "qemu_init_main_loop failed\n"); > +exit(1); > +} > + > if (qemu_opts_foreach(qemu_find_opts("sandbox"), parse_sandbox, NULL, > 0)) { > exit(1); > } > @@ -3463,12 +3469,6 @@ int main(int argc, char **argv, char **envp) > > configure_accelerator(); > > -qemu_init_cpu_loop(); > -if (qemu_init_main_loop()) { > -fprintf(stderr, "qemu_init_main_loop failed\n"); > -exit(1); > -} > - > machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > if (machine_opts) { > kernel_filename = qemu_opt_get(machine_opts, "kernel"); > This breaks daemonize as the BQL is marked as owned by the father process. See also [1] in this context. Can we move os_daemonize before that, or what are its dependencies? I have an increasingly bad feeling about this code shuffling. Jan [1] http://thread.gmane.org/gmane.comp.emulators.qemu/179311 signature.asc Description: OpenPGP digital signature
[Qemu-devel] [PATCH] Fix comments (adress -> address, layed -> laid, wierd -> weird)
Remove also a duplicated 'the'. Signed-off-by: Stefan Weil --- slirp/ip_icmp.c |2 +- tcg/tcg.h |4 ++-- uri.c |4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index d571fd0..9f1cb08 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -352,7 +352,7 @@ icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize, ip->ip_ttl = MAXTTL; ip->ip_p = IPPROTO_ICMP; - ip->ip_dst = ip->ip_src;/* ip adresses */ + ip->ip_dst = ip->ip_src;/* ip addresses */ ip->ip_src = m->slirp->vhost_addr; (void ) ip_output((struct socket *)NULL, m); diff --git a/tcg/tcg.h b/tcg/tcg.h index a6c9256..db86a73 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -272,8 +272,8 @@ typedef int TCGv_i64; #define TCG_CALL_DUMMY_TCGV MAKE_TCGV_I32(-1) #define TCG_CALL_DUMMY_ARG ((TCGArg)(-1)) -/* Conditions. Note that these are layed out for easy manipulation by - the the functions below: +/* Conditions. Note that these are laid out for easy manipulation by + the functions below: bit 0 is used for inverting; bit 1 is signed, bit 2 is unsigned, diff --git a/uri.c b/uri.c index dd922de..138547b 100644 --- a/uri.c +++ b/uri.c @@ -432,7 +432,7 @@ rfc3986_parse_host(URI *uri, const char **str) host = cur; /* - * IPv6 and future adressing scheme are enclosed between brackets + * IPv6 and future addressing scheme are enclosed between brackets */ if (*cur == '[') { cur++; @@ -1917,7 +1917,7 @@ done: * http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif * * - * Note: if the URI reference is really wierd or complicated, it may be + * Note: if the URI reference is really weird or complicated, it may be * worthwhile to first convert it into a "nice" one by calling * uri_resolve (using 'base') before calling this routine, * since this routine (for reasonable efficiency) assumes URI has -- 1.7.10.4
Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs
Hi, > +static inline void xhci_dma_write_u32s(XHCIState *xhci, dma_addr_t addr, > + uint32_t *buf, size_t len) > +{ > +int i; > + > +for (i = 0; i < (len / sizeof(uint32_t)); i++) { > +buf[i] = cpu_to_le32(buf[i]); > +} > +pci_dma_write(&xhci->pci_dev, addr, buf, len); > +} I think we should use a temporary buffer here, otherwise you leave the values byteswapped in buf which likely has unwanted side effects. cheers, Gerd
[Qemu-devel] [PATCH] s390x: Spelling fixes (endianess -> endianness, occured -> occurred)
Replace also "write into" by "write to". Signed-off-by: Stefan Weil --- I think "write to" is better, but I am not sure about this, so please wait until a native speaker has reviewed that patch. Regards Stefan Weil hw/s390x/sclp.h|4 ++-- hw/s390x/sclpconsole.c |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/s390x/sclp.h b/hw/s390x/sclp.h index fe89dad..231a38a 100644 --- a/hw/s390x/sclp.h +++ b/hw/s390x/sclp.h @@ -51,7 +51,7 @@ /* * Normally packed structures are not the right thing to do, since all code - * must take care of endianess. We cant use ldl_phys and friends for two + * must take care of endianness. We cannot use ldl_phys and friends for two * reasons, though: * - some of the embedded structures below the SCCB can appear multiple times * at different locations, so there is no fixed offset @@ -60,7 +60,7 @@ * alter the structure while we parse it. We cannot use ldl_p and friends * either without doing pointer arithmetics * So we have to double check that all users of sclp data structures use the - * right endianess wrappers. + * right endianness wrappers. */ typedef struct SCCBHeader { uint16_t length; diff --git a/hw/s390x/sclpconsole.c b/hw/s390x/sclpconsole.c index 0ec5623..fece878 100644 --- a/hw/s390x/sclpconsole.c +++ b/hw/s390x/sclpconsole.c @@ -179,8 +179,8 @@ static int read_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr, } /* triggered by SCLP's write_event_data - * - write console data into character layer - * returns < 0 if an error occured + * - write console data to character layer + * returns < 0 if an error occurred */ static ssize_t write_console_data(SCLPEvent *event, const uint8_t *buf, size_t len) -- 1.7.10.4
Re: [Qemu-devel] [PATCH] net: avoid segfault in case netdev_del non-host network device
On Fri, Nov 2, 2012 at 3:10 AM, Lei Li wrote: > On 11/01/2012 05:42 PM, Stefan Hajnoczi wrote: >> >> On Thu, Nov 1, 2012 at 8:48 AM, Lei Li wrote: >>> >>> netdev_del assume that remove host network device. >>> However, when try to remove a non-host network device >>> by netdev_del, it will cause a segfault. >> >> I recently sent a similar fix which forbids deleting non-netdev net >> clients from netdev_del: >> http://patchwork.ozlabs.org/patch/193759/ > > > Hi Stefan, > > Sorry I did not see it... Seems I miss this chance to submit a patch. :-P > > BTW, I was thinking that should we add another hacking to check > if the deleting object is a netdev or a VLAN client? netdev_del now only deletes -netdev or netdev_add net clients. It refuses to delete -net clients because they are not in the "netdev" QemuOptsList. It also refuses to delete net/hub.c ports that were added by net_hub_add_port() because they are not in the "netdev" QemuOptsList. I'm not sure I understand what you are suggesting? Stefan
[Qemu-devel] [PATCH] xenfb: fix build breakage caused by console cleanup series
Console cleanup series renamed dpy_resize and dpy_update all over the tree, but hw/xenfb.c was forgotten. Update it too so it builds again. Reported-by: Jan Kiszka Signed-off-by: Gerd Hoffmann --- hw/xenfb.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xenfb.c b/hw/xenfb.c index ef24c33..442a63a 100644 --- a/hw/xenfb.c +++ b/hw/xenfb.c @@ -648,7 +648,7 @@ static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h) xen_be_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n", __FUNCTION__, xenfb->depth, bpp); -dpy_update(xenfb->c.ds, x, y, w, h); +dpy_gfx_update(xenfb->c.ds, x, y, w, h); } #ifdef XENFB_TYPE_REFRESH_PERIOD @@ -766,7 +766,7 @@ static void xenfb_update(void *opaque) xen_be_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d @ %d bpp%s\n", xenfb->width, xenfb->height, xenfb->depth, is_buffer_shared(xenfb->c.ds->surface) ? " (shared)" : ""); -dpy_resize(xenfb->c.ds); +dpy_gfx_resize(xenfb->c.ds); xenfb->up_fullscreen = 1; } -- 1.7.1
[Qemu-devel] Fwd: buildbot failure in qemu on fedora-default
-- Forwarded message -- From: Date: 2012/10/30 Subject: buildbot failure in qemu on fedora-default To: kraxel...@gmail.com The Buildbot has detected a failed build on builder fedora-default while building qemu. Full details are available at: http://www.kraxel.org/bb/builders/fedora-default/builds/959 Buildbot URL: http://www.kraxel.org/bb/ Buildslave for this Build: fedora.xeni Build Reason: scheduler Build Source Stamp: [branch master] aee0bf7d8d7564f8f2c40e4501695c492b7dd8d1 Blamelist: Blue Swirl ,Catalin Patulea ,Michael S. Tsirkin ,Peter Crosthwaite ,Peter Maydell ,Richard Henderson BUILD FAILED: failed compile sincerely, -The Buildbot == log tail == CCblock/vvfat.o CCblock/qcow2.o CCblock/qcow2-refcount.o CCblock/qcow2-cluster.o CCblock/qcow2-snapshot.o CCblock/qcow2-cache.o CCblock/qed.o CCblock/qed-gencb.o CCblock/qed-l2-cache.o CCblock/qed-table.o CCblock/qed-cluster.o CCblock/qed-check.o CCblock/parallels.o CCblock/nbd.o CCblock/blkdebug.o CCblock/sheepdog.o CCblock/blkverify.o CCblock/raw-posix.o CCblock/curl.o LINK qemu-nbd GEN qemu-img-cmds.h CCqemu-img.o LINK qemu-img CCqemu-io.o CCcmd.o LINK qemu-io CCfsdev/virtfs-proxy-helper.o fsdev/virtfs-proxy-helper.c: In function ‘setfsugid’: fsdev/virtfs-proxy-helper.c:293:13: error: ignoring return value of ‘setfsgid’, declared with attribute warn_unused_result [-Werror=unused-result] fsdev/virtfs-proxy-helper.c:294:13: error: ignoring return value of ‘setfsuid’, declared with attribute warn_unused_result [-Werror=unused-result] cc1: all warnings being treated as errors make: *** [fsdev/virtfs-proxy-helper.o] Error 1 == full log == http://www.kraxel.org/bb/builders/fedora-default/builds/959/steps/compile/logs/stdio
Re: [Qemu-devel] [patch v5 5/8] memory: introduce local lock for address space
On 2012-11-02 01:52, liu ping fan wrote: > On Fri, Nov 2, 2012 at 2:44 AM, Jan Kiszka wrote: >> On 2012-11-01 16:45, Avi Kivity wrote: >>> On 10/29/2012 11:46 AM, liu ping fan wrote: On Mon, Oct 29, 2012 at 5:32 PM, Avi Kivity wrote: > On 10/29/2012 01:48 AM, Liu Ping Fan wrote: >> For those address spaces which want to be able out of big lock, they >> will be protected by their own local. >> >> Signed-off-by: Liu Ping Fan >> --- >> memory.c | 11 ++- >> memory.h |5 - >> 2 files changed, 14 insertions(+), 2 deletions(-) >> >> diff --git a/memory.c b/memory.c >> index 2f68d67..ff34aed 100644 >> --- a/memory.c >> +++ b/memory.c >> @@ -1532,9 +1532,15 @@ void memory_listener_unregister(MemoryListener >> *listener) >> QTAILQ_REMOVE(&memory_listeners, listener, link); >> } >> >> -void address_space_init(AddressSpace *as, MemoryRegion *root) >> +void address_space_init(AddressSpace *as, MemoryRegion *root, bool lock) > > > Why not always use the lock? Even if the big lock is taken, it doesn't > hurt. And eventually all address spaces will be fine-grained. > I had thought only mmio is out of big lock's protection. While others address space will take extra expense. So leave them until they are ready to be out of big lock. >>> >>> The other address spaces are pio (which also needs fine-grained locking) >>> and the dma address spaces (which are like address_space_memory, except >>> they are accessed via DMA instead of from the vcpu). >> >> The problem is with memory regions that don't do fine-grained locking >> yet, thus don't provide ref/unref. Then we fall back to taking BQL >> across dispatch. If the dispatch caller already holds the BQL, we will >> bail out. >> > Yes, these asymmetrice callers are bothering. Currently, I just make > exceptions for them, and would like to make the biglock recursive. > But this motivation may make bug not easy to find. > >> As I understand the series, as->lock == NULL means that we will never >> take any lock during dispatch as the caller is not yet ready for >> fine-grained locking. This prevents the problem - for PIO at least. But >> this series should break TCG as it calls into MMIO dispatch from the >> VCPU while holding the BQL. >> > What about add another condition "dispatch_type == DISPATCH_MMIO" to > tell this situation. An alternative pattern that we will also use for core services is to provide an additional entry point, one that indicates that the caller doesn't hold the BQL. Then we will gradually move things over until the existing entry point is obsolete. Jan signature.asc Description: OpenPGP digital signature
[Qemu-devel] buildbot failure in qemu on xen40
The Buildbot has detected a new failure on builder xen40 while building qemu. Full details are available at: http://buildbot.b1-systems.de/qemu/builders/xen40/builds/174 Buildbot URL: http://buildbot.b1-systems.de/qemu/ Buildslave for this Build: anthony_xen Build Reason: The Nightly scheduler named 'nightly_xen40' triggered this build Build Source Stamp: [branch master] HEAD Blamelist: BUILD FAILED: failed configure sincerely, -The Buildbot
Re: [Qemu-devel] live migration which includes previos snapshot
Hello Stefan, From: Stefan Hajnoczi Subject: Re: [Qemu-devel] live migration which includes previos snapshot Date: Fri, 2 Nov 2012 08:19:15 +0100 > On Fri, Nov 2, 2012 at 4:15 AM, Kuniyasu Suzaki wrote: > > Can live migration of QEMU include previous snapshot images? > > I want to roll back to a previous snapshot image on another machine > > after live migration. > > > > I was thinking Block Migration bring the snapshot images of QCOW2, but > > Block Migration transfers the hard disk image only. > > Do I have other methods to move snapshot image at live migration? > > Can you host your qcow2 image files on shared storage like an NFS server? Excuse me. My explanation was not enough. I want to fork a running VM to another machine. I hope that each VM has same QCOW2 file on each machine. Therefore I tried to use Block Migration but it did not bring snapshot images. > QEMU does not have a built-in way to migrate the original qcow2 file itself. Are there any good ideas to fork a running VM with previous snapshot image? -- suzaki
Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs
On Fri, Nov 02, 2012 at 08:31:23AM +0100, Gerd Hoffmann wrote: > Hi, > > > +static inline void xhci_dma_write_u32s(XHCIState *xhci, dma_addr_t addr, > > + uint32_t *buf, size_t len) > > +{ > > +int i; > > + > > +for (i = 0; i < (len / sizeof(uint32_t)); i++) { > > +buf[i] = cpu_to_le32(buf[i]); > > +} > > +pci_dma_write(&xhci->pci_dev, addr, buf, len); > > +} > > I think we should use a temporary buffer here, otherwise you leave the > values byteswapped in buf which likely has unwanted side effects. Yeah, I wondered about that. I did check that the side-effect doesn't matter in any of the existing callers, so I left it that way to avoid the extra copies. But you're right, it's a pretty subtle constraint that could easily be broken by future changes. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH] tests: allow qemu-iotests to be run against nbd backend
Am 01.11.2012 12:30, schrieb Nicholas Thomas: > On Wed, 2012-10-31 at 17:44 +0100, Kevin Wolf wrote: >> Am 31.10.2012 15:33, schrieb Paolo Bonzini: >>> Il 31/10/2012 15:01, n...@bytemark.co.uk ha scritto: From: Nick Thomas To do this, we start a qemu-nbd process at _make_test_img and kill it in _cleanup_test_img. $TEST_IMG is changed to point at the TCP server. Signed-off-by: Nick Thomas --- tests/qemu-iotests/common|7 +-- tests/qemu-iotests/common.config |8 +++- tests/qemu-iotests/common.rc | 23 ++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 1f6fdf5..09dfdf1 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -136,6 +136,7 @@ check options -vmdk test vmdk -rbdtest rbd -sheepdog test sheepdog +-nbdtest nbd -xdiffgraphical mode diff -nocache use O_DIRECT on backing file -misalign misalign memory allocations @@ -197,12 +198,14 @@ testlist options IMGPROTO=rbd xpand=false ;; - -sheepdog) IMGPROTO=sheepdog xpand=false ;; - +-nbd) +IMGPROTO=nbd +xpand=false +;; -nocache) QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --nocache" xpand=false diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config index df082e7..5383e4d 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -102,9 +102,15 @@ if [ -z "$QEMU_IO_PROG" ]; then fi [ "$QEMU_IO_PROG" = "" ] && _fatal "qemu-io not found" +if [ -z "$QEMU_NBD_PROG" ]; then +export QEMU_NBD_PROG="`set_prog_path qemu-nbd`" +fi +[ "$QEMU_IO_PROG" = "" ] && _fatal "qemu-io not found" >> >> I think you intended to check $QEMU_NBD_PROG. > > Good catch, thanks. > >> It would be nice to require it only if we're really using NBD, is this >> already known at this place? > > $IMGPROTO is how we'd discriminate, and that's set in > qemu-iotests/common, which is sourced after qemu-iotests/common.config, > at least by qemu-iotests/check. > > There's actually a similar set of tests in common (where we *do* have > $IMGPROTO), so maybe the ones in common.config are unnecessary, and can > be removed? Hm, yes, I think so. And when you touch common to add a qemu-nbd check, you can fix the message for qemu-io, too: [ "$QEMU_IO" = "" ] && _fatal "qemu-img not found" Kevin
[Qemu-devel] [PATCH 1/7] hw/qxl: guest bug on primary create with stride %4 != 0
From: Alon Levy Due to usage of pixman for rendering on all spice surfaces we have pixman's requirement that the stride be word aligned. A guest not honoring that can crash spice and qemu with it due to failure to create a surface (in spice-server). Avoid this early on in primary surface creation and offscreen surface creation. Recently windows guests got odd width support which triggers a non word aligned primary surface in 16bit color depth. Off screen surfaces have always been word aligned, but doesn't hurt to check them here too. Signed-off-by: Alon Levy Signed-off-by: Gerd Hoffmann --- hw/qxl.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 1f56fcd..cc16eaf 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -447,6 +447,12 @@ static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext) qxl->ssd.num_surfaces); return 1; } +if (cmd->type == QXL_SURFACE_CMD_CREATE && +(cmd->u.surface_create.stride & 0x03) != 0) { +qxl_set_guest_bug(qxl, "QXL_CMD_SURFACE stride = %d %% 4 != 0\n", + cmd->u.surface_create.stride); +return 1; +} qemu_mutex_lock(&qxl->track_lock); if (cmd->type == QXL_SURFACE_CMD_CREATE) { qxl->guest_surfaces.cmds[id] = ext->cmd.data; @@ -1357,6 +1363,12 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm, trace_qxl_create_guest_primary_rest(qxl->id, sc->stride, sc->type, sc->flags); +if ((surface.stride & 0x3) != 0) { +qxl_set_guest_bug(qxl, "primary surface stride = %d %% 4 != 0", + surface.stride); +return; +} + surface.mouse_mode = true; surface.group_id = MEMSLOT_GROUP_GUEST; if (loadvm) { -- 1.7.1
[Qemu-devel] [PATCH 5/7] spice: switch to pixman
Switch over spice-display.c to use the pixman library instead of the home-grown pflib bits. Signed-off-by: Gerd Hoffmann --- console.h |5 + qemu-pixman.c | 13 + qemu-pixman.h |2 ++ ui/spice-display.c | 51 ++- ui/spice-display.h |7 +++ 5 files changed, 45 insertions(+), 33 deletions(-) diff --git a/console.h b/console.h index 33ad69b..a52a607 100644 --- a/console.h +++ b/console.h @@ -377,6 +377,11 @@ static inline pixman_format_code_t ds_get_format(DisplayState *ds) return ds->surface->format; } +static inline pixman_image_t *ds_get_image(DisplayState *ds) +{ +return ds->surface->image; +} + #ifdef CONFIG_CURSES #include typedef chtype console_ch_t; diff --git a/qemu-pixman.c b/qemu-pixman.c index 7547ed7..71a9ea4 100644 --- a/qemu-pixman.c +++ b/qemu-pixman.c @@ -51,6 +51,19 @@ void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb, 0, y, 0, 0, 0, 0, width, 1); } +pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format, + pixman_image_t *image) +{ +pixman_image_t *mirror; + +mirror = pixman_image_create_bits(format, + pixman_image_get_width(image), + pixman_image_get_height(image), + NULL, + pixman_image_get_stride(image)); +return mirror; +} + void qemu_pixman_image_unref(pixman_image_t *image) { if (image == NULL) { diff --git a/qemu-pixman.h b/qemu-pixman.h index 7652c41..e267d73 100644 --- a/qemu-pixman.h +++ b/qemu-pixman.h @@ -27,6 +27,8 @@ pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format, int width); void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb, int width, int y); +pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format, + pixman_image_t *image); void qemu_pixman_image_unref(pixman_image_t *image); #endif /* QEMU_PIXMAN_H */ diff --git a/ui/spice-display.c b/ui/spice-display.c index fb99148..fe2fdfb 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -150,9 +150,9 @@ static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd, QXLDrawable *drawable; QXLImage *image; QXLCommand *cmd; -uint8_t *src, *mirror, *dst; -int by, bw, bh, offset, bytes; +int bw, bh; struct timespec time_space; +pixman_image_t *dest; trace_qemu_spice_create_update( rect->left, rect->right, @@ -195,20 +195,15 @@ static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd, image->bitmap.palette = 0; image->bitmap.format = SPICE_BITMAP_FMT_32BIT; -offset = -rect->top * ds_get_linesize(ssd->ds) + -rect->left * ds_get_bytes_per_pixel(ssd->ds); -bytes = ds_get_bytes_per_pixel(ssd->ds) * bw; -src = ds_get_data(ssd->ds) + offset; -mirror = ssd->ds_mirror + offset; -dst = update->bitmap; -for (by = 0; by < bh; by++) { -memcpy(mirror, src, bytes); -qemu_pf_conv_run(ssd->conv, dst, mirror, bw); -src += ds_get_linesize(ssd->ds); -mirror += ds_get_linesize(ssd->ds); -dst += image->bitmap.stride; -} +dest = pixman_image_create_bits(PIXMAN_x8r8g8b8, bw, bh, +(void *)update->bitmap, bw * 4); +pixman_image_composite(PIXMAN_OP_SRC, ssd->surface, NULL, ssd->mirror, + rect->left, rect->top, 0, 0, + rect->left, rect->top, bw, bh); +pixman_image_composite(PIXMAN_OP_SRC, ssd->mirror, NULL, dest, + rect->left, rect->top, 0, 0, + 0, 0, bw, bh); +pixman_image_unref(dest); cmd->type = QXL_CMD_DRAW; cmd->data = (uintptr_t)drawable; @@ -229,14 +224,10 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) return; }; -if (ssd->conv == NULL) { -PixelFormat dst = qemu_default_pixelformat(32); -ssd->conv = qemu_pf_conv_get(&dst, &ssd->ds->surface->pf); -assert(ssd->conv); -} -if (ssd->ds_mirror == NULL) { -int size = ds_get_height(ssd->ds) * ds_get_linesize(ssd->ds); -ssd->ds_mirror = g_malloc0(size); +if (ssd->surface == NULL) { +ssd->surface = pixman_image_ref(ds_get_image(ssd->ds)); +ssd->mirror = qemu_pixman_mirror_create(ds_get_format(ssd->ds), + ds_get_image(ssd->ds)); } for (blk = 0; blk < blocks; blk++) { @@ -244,7 +235,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) } guest = ds_get_data(ssd->ds); -mirror = ssd->ds_mirror; +mirror = (void *)pi
[Qemu-devel] [PATCH 4/7] qxl: call dpy_gfx_resize when entering vga mode
When entering vga mode the display size likely changes, notify all displaychangelisteners about this. Probably went unnoticed for a while as one if the first things the guest does after leaving qxl native mode and entering qxl vga mode is to set the vga video mode. But there is still a small window where qemu can operate on stale data, leading to crashes now and then. https://bugzilla.redhat.com/show_bug.cgi?id=865767 Signed-off-by: Gerd Hoffmann --- hw/qxl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 063970d..e7bf3a1 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1069,7 +1069,7 @@ static void qxl_enter_vga_mode(PCIQXLDevice *d) trace_qxl_enter_vga_mode(d->id); qemu_spice_create_host_primary(&d->ssd); d->mode = QXL_MODE_VGA; -memset(&d->ssd.dirty, 0, sizeof(d->ssd.dirty)); +dpy_gfx_resize(d->ssd.ds); vga_dirty_log_start(&d->vga); } -- 1.7.1
[Qemu-devel] [PATCH 7/7] spice: fix initialization order
Register displaychangelistener last, after spice is fully initialized, otherwise we may hit NULL pointer dereferences when qemu starts calling our callbacks. Commit e250d949feb1334828f27f0d145c35f29c4b7639 triggers this bug. Signed-off-by: Gerd Hoffmann --- hw/qxl.c | 10 -- ui/spice-display.c |2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index e7bf3a1..1bc2d32 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -2049,6 +2049,7 @@ static int qxl_init_primary(PCIDevice *dev) PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev); VGACommonState *vga = &qxl->vga; PortioList *qxl_vga_port_list = g_new(PortioList, 1); +int rc; qxl->id = 0; qxl_init_ramsize(qxl); @@ -2063,9 +2064,14 @@ static int qxl_init_primary(PCIDevice *dev) qemu_spice_display_init_common(&qxl->ssd, vga->ds); qxl0 = qxl; -register_displaychangelistener(vga->ds, &display_listener); -return qxl_init_common(qxl); +rc = qxl_init_common(qxl); +if (rc != 0) { +return rc; +} + +register_displaychangelistener(vga->ds, &display_listener); +return rc; } static int qxl_init_secondary(PCIDevice *dev) diff --git a/ui/spice-display.c b/ui/spice-display.c index fe2fdfb..0cc0116 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -573,7 +573,6 @@ void qemu_spice_display_init(DisplayState *ds) { assert(sdpy.ds == NULL); qemu_spice_display_init_common(&sdpy, ds); -register_displaychangelistener(ds, &display_listener); sdpy.qxl.base.sif = &dpy_interface.base; qemu_spice_add_interface(&sdpy.qxl.base); @@ -581,4 +580,5 @@ void qemu_spice_display_init(DisplayState *ds) qemu_spice_create_host_memslot(&sdpy); qemu_spice_create_host_primary(&sdpy); +register_displaychangelistener(ds, &display_listener); } -- 1.7.1
Re: [Qemu-devel] [PATCH v2 15/39] vl: init main loop earlier
Il 02/11/2012 08:26, Jan Kiszka ha scritto: > Can we move os_daemonize before that, or what are its dependencies? I > have an increasingly bad feeling about this code shuffling. Moving os_daemonize too early ruins error messages. I would just pull qemu_mutex_lock_iothread later, even just before cpu_exec_init_all. Something like this (untested): diff --git a/main-loop.c b/main-loop.c index e43c7c8..07c4b84 100644 --- a/main-loop.c +++ b/main-loop.c @@ -125,7 +125,6 @@ int qemu_init_main_loop(void) init_clocks(); init_timer_alarm(); -qemu_mutex_lock_iothread(); ret = qemu_signal_init(); if (ret) { return ret; diff --git a/vl.c b/vl.c index 99681da..210d525 100644 --- a/vl.c +++ b/vl.c @@ -3631,13 +3631,6 @@ int main(int argc, char **argv, char **envp) } #endif -os_daemonize(); - -if (pid_file && qemu_create_pidfile(pid_file) != 0) { -os_pidfile_error(); -exit(1); -} - /* init the memory */ if (ram_size == 0) { ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; @@ -3682,11 +3675,6 @@ int main(int argc, char **argv, char **envp) os_set_line_buffering(); -#ifdef CONFIG_SPICE -/* spice needs the timers to be initialized by this point */ -qemu_spice_init(); -#endif - if (icount_option && (kvm_enabled() || xen_enabled())) { fprintf(stderr, "-icount is not allowed with kvm or xen\n"); exit(1); @@ -3709,6 +3697,20 @@ int main(int argc, char **argv, char **envp) } } +os_daemonize(); + +if (pid_file && qemu_create_pidfile(pid_file) != 0) { +os_pidfile_error(); +exit(1); +} + +qemu_mutex_lock_iothread(); + +#ifdef CONFIG_SPICE +/* spice needs timers & threads to be initialized by this point */ +qemu_spice_init(); +#endif + cpu_exec_init_all(); bdrv_init_with_whitelist();
Re: [Qemu-devel] Fwd: buildbot failure in qemu on fedora-default
Il 02/11/2012 08:45, Gerd Hoffmann ha scritto: > CCfsdev/virtfs-proxy-helper.o > fsdev/virtfs-proxy-helper.c: In function ‘setfsugid’: > fsdev/virtfs-proxy-helper.c:293:13: error: ignoring return value of > ‘setfsgid’, declared with attribute warn_unused_result > [-Werror=unused-result] > fsdev/virtfs-proxy-helper.c:294:13: error: ignoring return value of > ‘setfsuid’, declared with attribute warn_unused_result > [-Werror=unused-result] > cc1: all warnings being treated as errors > make: *** [fsdev/virtfs-proxy-helper.o] Error 1 > > == full log == > http://www.kraxel.org/bb/builders/fedora-default/builds/959/steps/compile/logs/stdio > See thread ending at http://permalink.gmane.org/gmane.comp.emulators.qemu/175362 Paolo
Re: [Qemu-devel] [PATCH] virtio: limit avail bytes lookahead
On (Thu) 01 Nov 2012 [18:07:21], Michael S. Tsirkin wrote: > Commit 0d8d7690850eb0cf2b2b60933cf47669a6b6f18f introduced > a regression in virtio-net performance because it looks > into the ring aggressively while we really only care > about a single packet worth of buffers. > To fix, add parameters limiting lookahead, and > use in virtqueue_avail_bytes. > > Signed-off-by: Michael S. Tsirkin > Reported-by: Edivaldo de Araujo Pereira Acked-by: Amit Shah Amit
[Qemu-devel] compile failure on macos: "only weak aliases are supported on darwin"
Building on MacOS with clang has broken: qmp.c:474:1: error: only weak aliases are supported on darwin QEMU_WEAK_ALIAS(arch_query_cpu_definitions, default_arch_query_cpu_definitions); ^ ./compiler.h:54:54: note: expanded from macro 'QEMU_WEAK_ALIAS' typeof(oldname) newname __attribute__((weak, alias (#oldname))) ^ 1 error generated. Looks like commit 67d223be is the culprit (and QEMU_WEAK_ALIAS isn't actually generated weak aliases?) -- PMM
[Qemu-devel] [PULL 0/7] spice patch queue
Hi, Here comes the spice patch queue. It carries some qxl bugfixes, switches spice-display over to pixman, drops the obsolete pflib bits and fixes some fallout from the console cleanup patch series. please pull, Gerd The following changes since commit 4ba79505f43bd0ace35c3fe42197eb02e7e0478e: Merge remote-tracking branch 'kraxel/pixman.v3' into staging (2012-11-01 11:14:39 -0500) are available in the git repository at: git://anongit.freedesktop.org/spice/qemu spice.v62 Alon Levy (2): hw/qxl: guest bug on primary create with stride %4 != 0 hw/qxl: qxl_send_events: nop if stopped Gerd Hoffmann (5): qxl: fix cursor reset qxl: call dpy_gfx_resize when entering vga mode spice: switch to pixman pflib: unused, remove it. spice: fix initialization order Makefile.objs |1 - console.h |5 + hw/qxl.c | 36 - pflib.c| 215 pflib.h| 20 - qemu-pixman.c | 13 +++ qemu-pixman.h |2 + trace-events |1 + ui/spice-display.c | 53 ++--- ui/spice-display.h |7 +- 10 files changed, 79 insertions(+), 274 deletions(-) delete mode 100644 pflib.c delete mode 100644 pflib.h
[Qemu-devel] [PATCH 6/7] pflib: unused, remove it.
Replaced by pixman library. Signed-off-by: Gerd Hoffmann --- Makefile.objs |1 - pflib.c | 215 - pflib.h | 20 - 3 files changed, 0 insertions(+), 236 deletions(-) delete mode 100644 pflib.c delete mode 100644 pflib.h diff --git a/Makefile.objs b/Makefile.objs index 593a592..37be7e2 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -78,7 +78,6 @@ common-obj-y += input.o common-obj-y += buffered_file.o migration.o migration-tcp.o common-obj-y += qemu-char.o #aio.o common-obj-y += block-migration.o iohandler.o -common-obj-y += pflib.o common-obj-y += bitmap.o bitops.o common-obj-y += page_cache.o diff --git a/pflib.c b/pflib.c deleted file mode 100644 index 987e110..000 --- a/pflib.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * PixelFormat conversion library. - * - * Author: Gerd Hoffmann - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - * Contributions after 2012-01-13 are licensed under the terms of the - * GNU GPL, version 2 or (at your option) any later version. - */ -#include "qemu-common.h" -#include "console.h" -#include "pflib.h" - -typedef struct QemuPixel QemuPixel; - -typedef void (*pf_convert)(QemuPfConv *conv, - void *dst, void *src, uint32_t cnt); -typedef void (*pf_convert_from)(PixelFormat *pf, -QemuPixel *dst, void *src, uint32_t cnt); -typedef void (*pf_convert_to)(PixelFormat *pf, - void *dst, QemuPixel *src, uint32_t cnt); - -struct QemuPfConv { -pf_convertconvert; -PixelFormat src; -PixelFormat dst; - -/* for copy_generic() */ -pf_convert_from conv_from; -pf_convert_to conv_to; -QemuPixel *conv_buf; -uint32_t conv_cnt; -}; - -struct QemuPixel { -uint8_t red; -uint8_t green; -uint8_t blue; -uint8_t alpha; -}; - -/* --- */ -/* PixelFormat -> QemuPixel conversions*/ - -static void conv_16_to_pixel(PixelFormat *pf, - QemuPixel *dst, void *src, uint32_t cnt) -{ -uint16_t *src16 = src; - -while (cnt > 0) { -dst->red = ((*src16 & pf->rmask) >> pf->rshift) << (8 - pf->rbits); -dst->green = ((*src16 & pf->gmask) >> pf->gshift) << (8 - pf->gbits); -dst->blue = ((*src16 & pf->bmask) >> pf->bshift) << (8 - pf->bbits); -dst->alpha = ((*src16 & pf->amask) >> pf->ashift) << (8 - pf->abits); -dst++, src16++, cnt--; -} -} - -/* assumes pf->{r,g,b,a}bits == 8 */ -static void conv_32_to_pixel_fast(PixelFormat *pf, - QemuPixel *dst, void *src, uint32_t cnt) -{ -uint32_t *src32 = src; - -while (cnt > 0) { -dst->red = (*src32 & pf->rmask) >> pf->rshift; -dst->green = (*src32 & pf->gmask) >> pf->gshift; -dst->blue = (*src32 & pf->bmask) >> pf->bshift; -dst->alpha = (*src32 & pf->amask) >> pf->ashift; -dst++, src32++, cnt--; -} -} - -static void conv_32_to_pixel_generic(PixelFormat *pf, - QemuPixel *dst, void *src, uint32_t cnt) -{ -uint32_t *src32 = src; - -while (cnt > 0) { -if (pf->rbits < 8) { -dst->red = ((*src32 & pf->rmask) >> pf->rshift) << (8 - pf->rbits); -} else { -dst->red = ((*src32 & pf->rmask) >> pf->rshift) >> (pf->rbits - 8); -} -if (pf->gbits < 8) { -dst->green = ((*src32 & pf->gmask) >> pf->gshift) << (8 - pf->gbits); -} else { -dst->green = ((*src32 & pf->gmask) >> pf->gshift) >> (pf->gbits - 8); -} -if (pf->bbits < 8) { -dst->blue = ((*src32 & pf->bmask) >> pf->bshift) << (8 - pf->bbits); -} else { -dst->blue = ((*src32 & pf->bmask) >> pf->bshift) >> (pf->bbits - 8); -} -if (pf->abits < 8) { -dst->alpha = ((*src32 & pf->amask) >> pf->ashift) << (8 - pf->abits); -} else { -dst->alpha = ((*src32 & pf->amask) >> pf->ashift) >> (pf->abits - 8); -} -dst++, src32++, cnt--; -} -} - -/* --- */ -/* QemuPixel -> PixelFormat conversions*/ - -static void conv_pixel_to_16(PixelFormat *pf, - void *dst, QemuPixel *src, uint32_t cnt) -{ -uint16_t *dst16 = dst; - -while (cnt > 0) { -*dst16 = ((uint16_t)src->red >> (8 - pf->rbits)) << pf->rshift; -*dst16 |= ((uint16_t)src->green >> (8 - pf->gbits)) << pf->gshift; -*dst16 |= ((uint16_t)src->blue >> (8 - pf->bbits)) << pf->bshift; -*dst16 |= ((uint16_t)src->alpha >> (8 - pf->abits)) << pf->ashift; -dst16++
[Qemu-devel] [PATCH 3/7] qxl: fix cursor reset
When resetting the qxl cursor notify the qemu displaystate too. Signed-off-by: Gerd Hoffmann --- hw/qxl.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index f19451b..063970d 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -293,6 +293,10 @@ void qxl_spice_reset_cursor(PCIQXLDevice *qxl) qemu_mutex_lock(&qxl->track_lock); qxl->guest_cursor = 0; qemu_mutex_unlock(&qxl->track_lock); +if (qxl->ssd.cursor) { +cursor_put(qxl->ssd.cursor); +} +qxl->ssd.cursor = cursor_builtin_hidden(); } -- 1.7.1
Re: [Qemu-devel] [PATCH] virtio: limit avail bytes lookahead
On Thu, Nov 1, 2012 at 5:07 PM, Michael S. Tsirkin wrote: > Commit 0d8d7690850eb0cf2b2b60933cf47669a6b6f18f introduced > a regression in virtio-net performance because it looks > into the ring aggressively while we really only care > about a single packet worth of buffers. > To fix, add parameters limiting lookahead, and > use in virtqueue_avail_bytes. > > Signed-off-by: Michael S. Tsirkin > Reported-by: Edivaldo de Araujo Pereira Nice, much simpler than the ideas I had. Reviewed-by: Stefan Hajnoczi
[Qemu-devel] [PATCH 2/7] hw/qxl: qxl_send_events: nop if stopped
From: Alon Levy Added a trace point for easy logging. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=870972 Signed-off-by: Alon Levy Signed-off-by: Gerd Hoffmann --- hw/qxl.c |8 +++- trace-events |1 + 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index cc16eaf..f19451b 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1701,7 +1701,13 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t events) uint32_t le_events = cpu_to_le32(events); trace_qxl_send_events(d->id, events); -assert(qemu_spice_display_is_running(&d->ssd)); +if (!qemu_spice_display_is_running(&d->ssd)) { +/* spice-server tracks guest running state and should not do this */ +fprintf(stderr, "%s: spice-server bug: guest stopped, ignoring\n", +__func__); +trace_qxl_send_events_vm_stopped(d->id, events); +return; +} old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events); if ((old_pending & le_events) == le_events) { return; diff --git a/trace-events b/trace-events index 066cdaf..33846bb 100644 --- a/trace-events +++ b/trace-events @@ -999,6 +999,7 @@ qxl_spice_update_area(int qid, uint32_t surface_id, uint32_t left, uint32_t righ qxl_spice_update_area_rest(int qid, uint32_t num_dirty_rects, uint32_t clear_dirty_region) "%d #d=%d clear=%d" qxl_surfaces_dirty(int qid, int surface, int offset, int size) "%d surface=%d offset=%d size=%d" qxl_send_events(int qid, uint32_t events) "%d %d" +qxl_send_events_vm_stopped(int qid, uint32_t events) "%d %d" qxl_set_guest_bug(int qid) "%d" qxl_interrupt_client_monitors_config(int qid, int num_heads, void *heads) "%d %d %p" qxl_client_monitors_config_unsupported_by_guest(int qid, uint32_t int_mask, void *client_monitors_config) "%d %X %p" -- 1.7.1
[Qemu-devel] [PATCH v2] tests: allow qemu-iotests to be run against nbd backend
From: Nick Thomas To do this, we start a qemu-nbd process at _make_test_img and kill it in _cleanup_test_img. $TEST_IMG is changed to point at the TCP server. We also remove the checks for existence of binaries from common.config - they're duplicated in common, and we can make the qemu-nbd check conditional on $IMGPROTO being "nbd" if we do it there. Signed-off-by: Nick Thomas --- tests/qemu-iotests/common| 14 +++--- tests/qemu-iotests/common.config | 10 ++ tests/qemu-iotests/common.rc | 23 ++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 1f6fdf5..195722e 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -136,6 +136,7 @@ check options -vmdk test vmdk -rbdtest rbd -sheepdog test sheepdog +-nbdtest nbd -xdiff graphical mode diff -nocache use O_DIRECT on backing file -misalign misalign memory allocations @@ -197,12 +198,14 @@ testlist options IMGPROTO=rbd xpand=false ;; - -sheepdog) IMGPROTO=sheepdog xpand=false ;; - +-nbd) +IMGPROTO=nbd +xpand=false +;; -nocache) QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --nocache" xpand=false @@ -350,9 +353,14 @@ fi [ "$QEMU" = "" ] && _fatal "qemu not found" [ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found" -[ "$QEMU_IO" = "" ] && _fatal "qemu-img not found" +[ "$QEMU_IO" = "" ] && _fatal "qemu-io not found" + +if [ "$IMGPROTO" = "nbd" ] ; then +[ "$QEMU_NBD" = "" ] && _fatal "qemu-nbd not found" +fi if $valgrind; then export REAL_QEMU_IO="$QEMU_IO_PROG" export QEMU_IO_PROG=valgrind_qemu_io fi + diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config index df082e7..08a3f10 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -90,21 +90,23 @@ export PS_ALL_FLAGS="-ef" if [ -z "$QEMU_PROG" ]; then export QEMU_PROG="`set_prog_path qemu`" fi -[ "$QEMU_PROG" = "" ] && _fatal "qemu not found" if [ -z "$QEMU_IMG_PROG" ]; then export QEMU_IMG_PROG="`set_prog_path qemu-img`" fi -[ "$QEMU_IMG_PROG" = "" ] && _fatal "qemu-img not found" if [ -z "$QEMU_IO_PROG" ]; then export QEMU_IO_PROG="`set_prog_path qemu-io`" fi -[ "$QEMU_IO_PROG" = "" ] && _fatal "qemu-io not found" + +if [ -z "$QEMU_NBD_PROG" ]; then +export QEMU_NBD_PROG="`set_prog_path qemu-nbd`" +fi export QEMU=$QEMU_PROG -export QEMU_IMG=$QEMU_IMG_PROG +export QEMU_IMG=$QEMU_IMG_PROG export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS" +export QEMU_NBD=$QEMU_NBD_PROG [ -f /etc/qemu-iotest.config ] && . /etc/qemu-iotest.config diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 334534f..aef5f52 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -49,6 +49,9 @@ umask 022 if [ "$IMGPROTO" = "file" ]; then TEST_IMG=$TEST_DIR/t.$IMGFMT +elif [ "$IMGPROTO" = "nbd" ]; then +TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT +TEST_IMG="nbd:127.0.0.1:10810" else TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT fi @@ -86,6 +89,13 @@ _make_test_img() local extra_img_options="" local image_size=$* local optstr="" +local img_name="" + +if [ -n "$TEST_IMG_FILE" ]; then +img_name=$TEST_IMG_FILE +else +img_name=$TEST_IMG +fi if [ -n "$IMGOPTS" ]; then optstr=$(_optstr_add "$optstr" "$IMGOPTS") @@ -104,7 +114,7 @@ _make_test_img() fi # XXX(hch): have global image options? -$QEMU_IMG create -f $IMGFMT $extra_img_options $TEST_IMG $image_size | \ +$QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size | \ sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ -e "s#$TEST_DIR#TEST_DIR#g" \ -e "s#$IMGFMT#IMGFMT#g" \ @@ -115,12 +125,23 @@ _make_test_img() -e "s# compat6=\\(on\\|off\\)##g" \ -e "s# static=\\(on\\|off\\)##g" \ -e "s# lazy_refcounts=\\(on\\|off\\)##g" + +# Start an NBD server on the image file, which is what we'll be talking to +if [ $IMGPROTO = "nbd" ]; then +eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 $TEST_IMG_FILE &" +QEMU_NBD_PID=$! +sleep 1 # FIXME: qemu-nbd needs to be listening before we continue +fi } _cleanup_test_img() { case "$IMGPROTO" in +nbd) +kill $QEMU_NBD_PID +rm -f $TEST_IMG_FILE +;; file) rm -f $TEST_DIR/t.$IMGFMT rm -f $TEST_DIR/t.$IMGFMT.orig -- 1.7.2.5
Re: [Qemu-devel] live migration which includes previos snapshot
On Fri, Nov 2, 2012 at 9:24 AM, Kuniyasu Suzaki wrote: > > Hello Stefan, > > From: Stefan Hajnoczi > Subject: Re: [Qemu-devel] live migration which includes previos snapshot > Date: Fri, 2 Nov 2012 08:19:15 +0100 > >> On Fri, Nov 2, 2012 at 4:15 AM, Kuniyasu Suzaki wrote: >> > Can live migration of QEMU include previous snapshot images? >> > I want to roll back to a previous snapshot image on another machine >> > after live migration. >> > >> > I was thinking Block Migration bring the snapshot images of QCOW2, but >> > Block Migration transfers the hard disk image only. >> > Do I have other methods to move snapshot image at live migration? >> >> Can you host your qcow2 image files on shared storage like an NFS server? > > Excuse me. My explanation was not enough. > I want to fork a running VM to another machine. I hope that each VM > has same QCOW2 file on each machine. Therefore I tried to use Block > Migration but it did not bring snapshot images. > >> QEMU does not have a built-in way to migrate the original qcow2 file itself. > > Are there any good ideas to fork a running VM with previous snapshot image? If you are forking the VM so that there will be two VMs running simultaneously, then a single qcow2 file cannot be used. Here are two approaches that will work but require you to modify QEMU code: I. Perhaps you can make it work with external snapshots: 1. Make the original image read-only accessible over NFS. 2. Modify QEMU to create two external snapshot files when the VM is paused for migration (during your fork operation): /host-a/original.qcow2 /host-a/new.qcow2 (backing file: /host-a/original.qcow2) /host-b/new.qcow2 (backing file: /host-b/original.qcow2) 3. After fork the two VMs will write into their respective new.qcow2 files. original.qcow2 is never modified anymore. II. If you want to use internal snapshots in a single qcow2 file, you will need to modify QEMU code more: 1. Implement BlockDriverState snapshot slave support so a qcow2 snapshot can be read-only accessed as a BlockDriverState while the master BlockDriverState for the image still writes into the image file. This is mainly qcow2 refactoring and block.c glue code. 2. Use Paolo's runtime NBD server to export the snapshot slave when the VM is forked: /host-a/original.qcow2: * Snapshot: fork-snapshot (state of the disk when the VM was forked) /host-b/new.qcow2 (backing file: nbd:host-a/original.qcow2/fork-snapshot) Taking the second approach doesn't buy you much and is a lot more work. Stefan
Re: [Qemu-devel] [PATCH v2 15/39] vl: init main loop earlier
On 2012-11-02 10:55, Paolo Bonzini wrote: > Il 02/11/2012 08:26, Jan Kiszka ha scritto: >> Can we move os_daemonize before that, or what are its dependencies? I >> have an increasingly bad feeling about this code shuffling. > > Moving os_daemonize too early ruins error messages. I would just > pull qemu_mutex_lock_iothread later, even just before cpu_exec_init_all. > Something like this (untested): > > diff --git a/main-loop.c b/main-loop.c > index e43c7c8..07c4b84 100644 > --- a/main-loop.c > +++ b/main-loop.c > @@ -125,7 +125,6 @@ int qemu_init_main_loop(void) > init_clocks(); > init_timer_alarm(); > > -qemu_mutex_lock_iothread(); > ret = qemu_signal_init(); > if (ret) { > return ret; > diff --git a/vl.c b/vl.c > index 99681da..210d525 100644 > --- a/vl.c > +++ b/vl.c > @@ -3631,13 +3631,6 @@ int main(int argc, char **argv, char **envp) > } > #endif > > -os_daemonize(); > - > -if (pid_file && qemu_create_pidfile(pid_file) != 0) { > -os_pidfile_error(); > -exit(1); > -} > - > /* init the memory */ > if (ram_size == 0) { > ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; > @@ -3682,11 +3675,6 @@ int main(int argc, char **argv, char **envp) > > os_set_line_buffering(); > > -#ifdef CONFIG_SPICE > -/* spice needs the timers to be initialized by this point */ > -qemu_spice_init(); > -#endif > - > if (icount_option && (kvm_enabled() || xen_enabled())) { > fprintf(stderr, "-icount is not allowed with kvm or xen\n"); > exit(1); > @@ -3709,6 +3697,20 @@ int main(int argc, char **argv, char **envp) > } > } > > +os_daemonize(); > + > +if (pid_file && qemu_create_pidfile(pid_file) != 0) { > +os_pidfile_error(); > +exit(1); > +} > + > +qemu_mutex_lock_iothread(); > + > +#ifdef CONFIG_SPICE > +/* spice needs timers & threads to be initialized by this point */ > +qemu_spice_init(); > +#endif > + > cpu_exec_init_all(); > > bdrv_init_with_whitelist(); > Would have been too easy: # qemu-system-x86_64 -daemonize gettime: Invalid argument Internal timer error: aborting Haven't looked at details yet. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [RFC] net: Peer with existing NIC in netdev_add
On Thu, Nov 1, 2012 at 12:31 PM, Michael S. Tsirkin wrote: > On Thu, Nov 01, 2012 at 10:53:52AM +0100, Stefan Hajnoczi wrote: >> On Wed, Oct 31, 2012 at 06:34:07PM +0200, Michael S. Tsirkin wrote: >> > On Wed, Oct 31, 2012 at 03:51:08PM +0100, Stefan Hajnoczi wrote: >> > > On Wed, Oct 31, 2012 at 10:57:24AM +0200, Michael S. Tsirkin wrote: >> > > > On Wed, Oct 31, 2012 at 09:07:27AM +0100, Stefan Hajnoczi wrote: >> > > > > On Tue, Oct 30, 2012 at 05:24:06PM +0200, Michael S. Tsirkin wrote: >> > > > > > On Wed, Oct 24, 2012 at 02:49:21PM +0200, Stefan Hajnoczi wrote: >> > > > > > > Allow netdev_del followed by netdev_add to re-peer a NIC and its >> > > > > > > netdev: >> > > > > > > >> > > > > > > (qemu) info network >> > > > > > > virtio-net-pci.0: >> > > > > > > type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 >> > > > > > >\ netdev0: type=user,net=10.0.2.0,restrict=off >> > > > > > > >> > > > > > > (qemu) netdev_del netdev0 >> > > > > > > >> > > > > > > (qemu) netdev_add socket,id=netdev0,listen=:1234 >> > > > > > > >> > > > > > > (qemu) info network >> > > > > > > virtio-net-pci.0: >> > > > > > > type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 >> > > > > > >\ netdev0: type=socket, >> > > > > > > >> > > > > > > This makes it possible to switch netdev while the guest is >> > > > > > > running. It >> > > > > > > is not necessary to reset the NIC. >> > > > > > > >> > > > > > > Note that the NIC's link goes down in netdev_del and back up >> > > > > > > again in >> > > > > > > netdev_add. Therefore the guest becomes aware that the network >> > > > > > > has >> > > > > > > changed, although this depends on the emulated NIC model >> > > > > > > providing link >> > > > > > > status change interrupts. >> > > > > > > >> > > > > > > Signed-off-by: Stefan Hajnoczi >> > > > > > >> > > > > > I'd be surprised if this patch worked when one or both backends >> > > > > > are tap. >> > > > > > tap supports offloads but slirp doesn't, since guest >> > > > > > probes offloads at startup, it assumes it can use offloads. >> > > > > > We also program tap during device operation e.g. on set features. >> > > > > > vhost operation could also be interesting, have not looked into it. >> > > > > >> > > > > Yes, I left a TODO in the RFC patch and described the issue below. >> > > > > We'll have to reject incompatible netdevs. >> > > > >> > > > Ideally, we'd probe all backend capabilities at init time. >> > > > However, looks like we allowed netdev and device creation in any order. >> > > > Can we change this and require netdev always be there before device? >> > > >> > > I don't think the order is a problem. The relaxed order is only >> > > relevant during startup from main() - but in that case we have no >> > > constraints yet anyway. >> > > The problem only occurs when netdev_add is used to create an >> > > incompatible netdev after devices have initialized. We should be able >> > > to check and error out in the code that my RFC patch modifies. If >> > > constraints are violated then netdev_add can fail with an error (the new >> > > netdev is not created and the QMP client needs to try again with a >> > > compatible netdev configuration). >> > > >> > > Maybe I'm misunderstanding your point? >> > > >> > > Stefan >> > >> > OK so if we basically require same type backend then I think it's mostly >> > fine. I was trying to think of a way to allow changing backend type, >> > this becomes messy very quickly. In partuclar macvtap probably >> > shouldn't be swapped with tap even though they are the same type >> > formally. >> >> As long as they are offload-compatible, I think they can be swapped. >> It's up to the user or the management stack to make sure switching >> netdevs makes "sense". So the network may be different and the guest >> needs to DHCP again, but that's the user's problem. > > I think a simple rule like "use same backend type" is better than > an opaque one "are offload-compatible" - user has no idea > which offloads do each of the frontends and backends support. > Also if in future we add offloads to backend X suddenly we > break ability to swap with backend Y. > Let's keep it simple. Okay, that's a safe constraint that we can start with. If users request more freedom later we can get fancy. Stefan
Re: [Qemu-devel] [RFC] net: Peer with existing NIC in netdev_add
On Wed, Oct 24, 2012 at 2:49 PM, Stefan Hajnoczi wrote: > Laine: Please try this out and see if it works for your use case. Waiting for your feedback before I prepare a final patch that can go into QEMU. There's no time pressure from my side to get this feature in so take as much time as you need. Stefan
Re: [Qemu-devel] compile failure on macos: "only weak aliases are supported on darwin"
Il 02/11/2012 10:54, Peter Maydell ha scritto: > Building on MacOS with clang has broken: > > qmp.c:474:1: error: only weak aliases are supported on darwin > QEMU_WEAK_ALIAS(arch_query_cpu_definitions, > default_arch_query_cpu_definitions); > ^ > ./compiler.h:54:54: note: expanded from macro 'QEMU_WEAK_ALIAS' > typeof(oldname) newname __attribute__((weak, alias (#oldname))) > ^ > 1 error generated. > > > Looks like commit 67d223be is the culprit (and QEMU_WEAK_ALIAS > isn't actually generated weak aliases?) It's a bad error message. It should be "only weakref aliases are supported on Darwin", apparently. It can be fixed, I'm testing a patch but it will have to wait for after KVM Forum. BTW, since I read disagreeing reports on this, can you check if Darwin has sem_timedwait? Paolo
Re: [Qemu-devel] [patch v5 7/8] memory: introduce tls context to record nested dma
On 2012-10-29 00:48, Liu Ping Fan wrote: > Signed-off-by: Liu Ping Fan > --- > cpus.c|3 ++ > exec.c| 58 > + > qemu-thread.h |8 +++ > vl.c |1 + > 4 files changed, 70 insertions(+), 0 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 191cbf5..e67d80f 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -733,6 +733,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) > > qemu_mutex_lock(&qemu_global_mutex); > qemu_thread_get_self(cpu->thread); > +qemu_thread_init_context(); > env->thread_id = qemu_get_thread_id(); > cpu_single_env = env; > > @@ -774,6 +775,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) > > qemu_mutex_lock_iothread(); > qemu_thread_get_self(cpu->thread); > +qemu_thread_init_context(); > env->thread_id = qemu_get_thread_id(); > > sigemptyset(&waitset); > @@ -813,6 +815,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) > > qemu_tcg_init_cpu_signals(); > qemu_thread_get_self(cpu->thread); > +qemu_thread_init_context(); > > /* signal CPU creation */ > qemu_mutex_lock(&qemu_global_mutex); > diff --git a/exec.c b/exec.c > index 46da08c..ea672c6 100644 > --- a/exec.c > +++ b/exec.c > @@ -3449,6 +3449,49 @@ static bool > address_space_section_lookup_ref(AddressSpace *as, > return safe_ref; > } > > +typedef struct ThreadContext { > + DispatchType dispatch_type; > + unsigned int mmio_req_pending; > +} ThreadContext; > + > +static __thread ThreadContext *thread_context; > + > +void qemu_thread_init_context(void) > +{ > +thread_context = g_new(ThreadContext, 1); > +thread_context->dispatch_type = DISPATCH_INIT; > +thread_context->mmio_req_pending = 0; > +} > + > +void qemu_thread_set_dispatch_type(DispatchType type) > +{ > +thread_context->dispatch_type = type; > +} > + > +void qemu_thread_reset_dispatch_type(void) > +{ > +thread_context->dispatch_type = DISPATCH_INIT; > +} > + > +static bool address_space_inc_req_pending(void) > +{ > +bool nested = false; > + > +/* currently, only mmio out of big lock, and need this to avoid dead > lock */ > +if (thread_context->dispatch_type == DISPATCH_MMIO) { > +nested = ++thread_context->mmio_req_pending > 1 ? true : false; > +} > + > +return nested; > +} > + > +static void address_space_dec_req_pending(void) > +{ > +if (thread_context->dispatch_type == DISPATCH_MMIO) { > +thread_context->mmio_req_pending--; > +} > +} > + > void address_space_rw(AddressSpace *as, target_phys_addr_t addr, uint8_t > *buf, >int len, bool is_write) > { > @@ -3459,6 +3502,7 @@ void address_space_rw(AddressSpace *as, > target_phys_addr_t addr, uint8_t *buf, > target_phys_addr_t page; > bool safe_ref = false; > MemoryRegionSection *section, obj_mrs; > +bool nested_dma = false; > > while (len > 0) { > page = addr & TARGET_PAGE_MASK; > @@ -3485,10 +3529,17 @@ void address_space_rw(AddressSpace *as, > target_phys_addr_t addr, uint8_t *buf, > memory_region_section_lookup_ref(d, page, &obj_mrs); > } > section = &obj_mrs; > +nested_dma = address_space_inc_req_pending(); > > if (is_write) { > if (!memory_region_is_ram(section->mr)) { > target_phys_addr_t addr1; > + > +/* To fix, will filter iommu case */ > +if (nested_dma) { > +fprintf(stderr, "can not support nested DMA"); > +abort(); > +} > addr1 = memory_region_section_addr(section, addr); > /* XXX: could force cpu_single_env to NULL to avoid > potential bugs */ > @@ -3522,6 +3573,12 @@ void address_space_rw(AddressSpace *as, > target_phys_addr_t addr, uint8_t *buf, > if (!(memory_region_is_ram(section->mr) || >memory_region_is_romd(section->mr))) { > target_phys_addr_t addr1; > + > +/* To fix, will filter iommu case */ > +if (nested_dma) { > +fprintf(stderr, "can not support nested DMA"); > +abort(); > +} > /* I/O case */ > addr1 = memory_region_section_addr(section, addr); > if (l >= 4 && ((addr1 & 3) == 0)) { > @@ -3549,6 +3606,7 @@ void address_space_rw(AddressSpace *as, > target_phys_addr_t addr, uint8_t *buf, > qemu_put_ram_ptr(ptr); > } > } > +address_space_dec_req_pending(); > memory_region_section_unref(&obj_mrs); > len -= l; > buf += l; > diff --git a/qemu-thread.h b/qemu-thread.h > index 05fdaaf..bb9535e 100644 > --- a/qemu-thread.h > +++ b/qemu-thread.h > @@ -7,6 +7,11 @@ > typedef struct QemuMutex QemuMutex; > typedef struct Q
Re: [Qemu-devel] compile failure on macos: "only weak aliases are supported on darwin"
On 2 November 2012 11:39, Paolo Bonzini wrote: > Il 02/11/2012 10:54, Peter Maydell ha scritto: >> Looks like commit 67d223be is the culprit (and QEMU_WEAK_ALIAS >> isn't actually generated weak aliases?) > > It's a bad error message. It should be "only weakref aliases are > supported on Darwin", apparently. > > It can be fixed, I'm testing a patch but it will have to wait for after > KVM Forum. As long as we fix it before the 1.3 release (since this would otherwise be a serious regression) I'm happy. > BTW, since I read disagreeing reports on this, can you check if Darwin > has sem_timedwait? My Mountain Lion (10.8.2) system does not have sem_timedwait. -- PMM
Re: [Qemu-devel] [PATCH] Fix off-by-1 error in RAM migration code
David Gibson wrote: > On Wed, Oct 31, 2012 at 01:08:16PM +0200, Orit Wasserman wrote: >> On 10/31/2012 05:43 AM, David Gibson wrote: >> > The code for migrating (or savevm-ing) memory pages starts off by creating >> > a dirty bitmap and filling it with 1s. Except, actually, because bit >> > addresses are 0-based it fills every bit except bit 0 with 1s and puts an >> > extra 1 beyond the end of the bitmap, potentially corrupting unrelated >> > memory. Oops. This patch fixes it. >> > >> > Signed-off-by: David Gibson >> > --- >> > arch_init.c |2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/arch_init.c b/arch_init.c >> > index e6effe8..b75a4c5 100644 >> > --- a/arch_init.c >> > +++ b/arch_init.c >> > @@ -568,7 +568,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) >> > int64_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS; >> > >> > migration_bitmap = bitmap_new(ram_pages); >> > -bitmap_set(migration_bitmap, 1, ram_pages); >> > +bitmap_set(migration_bitmap, 0, ram_pages); >> > migration_dirty_pages = ram_pages; >> > >> > bytes_transferred = 0; >> > >> You are correct, good catch. >> Reviewed-by: Orit Wasserman > > Juan, > > Sorry, forgot to CC you on the original mailing here, which I should > have done. This is a serious bug in the migration code and we should > apply to mainline ASAP. Reviewed-by: Juan Quintela Good catch, I missunderstood the function when fixing a different bug, and never undrestood why it fixed it. Thanks, Juan.
Re: [Qemu-devel] [PATCH v2 15/39] vl: init main loop earlier
Il 02/11/2012 11:32, Jan Kiszka ha scritto: > On 2012-11-02 10:55, Paolo Bonzini wrote: >> Il 02/11/2012 08:26, Jan Kiszka ha scritto: >>> Can we move os_daemonize before that, or what are its dependencies? I >>> have an increasingly bad feeling about this code shuffling. >> >> Moving os_daemonize too early ruins error messages. I would just >> pull qemu_mutex_lock_iothread later, even just before cpu_exec_init_all. >> Something like this (untested): >> >> diff --git a/main-loop.c b/main-loop.c >> index e43c7c8..07c4b84 100644 >> --- a/main-loop.c >> +++ b/main-loop.c >> @@ -125,7 +125,6 @@ int qemu_init_main_loop(void) >> init_clocks(); >> init_timer_alarm(); >> >> -qemu_mutex_lock_iothread(); >> ret = qemu_signal_init(); >> if (ret) { >> return ret; >> diff --git a/vl.c b/vl.c >> index 99681da..210d525 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -3631,13 +3631,6 @@ int main(int argc, char **argv, char **envp) >> } >> #endif >> >> -os_daemonize(); >> - >> -if (pid_file && qemu_create_pidfile(pid_file) != 0) { >> -os_pidfile_error(); >> -exit(1); >> -} >> - >> /* init the memory */ >> if (ram_size == 0) { >> ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; >> @@ -3682,11 +3675,6 @@ int main(int argc, char **argv, char **envp) >> >> os_set_line_buffering(); >> >> -#ifdef CONFIG_SPICE >> -/* spice needs the timers to be initialized by this point */ >> -qemu_spice_init(); >> -#endif >> - >> if (icount_option && (kvm_enabled() || xen_enabled())) { >> fprintf(stderr, "-icount is not allowed with kvm or xen\n"); >> exit(1); >> @@ -3709,6 +3697,20 @@ int main(int argc, char **argv, char **envp) >> } >> } >> >> +os_daemonize(); >> + >> +if (pid_file && qemu_create_pidfile(pid_file) != 0) { >> +os_pidfile_error(); >> +exit(1); >> +} >> + >> +qemu_mutex_lock_iothread(); >> + >> +#ifdef CONFIG_SPICE >> +/* spice needs timers & threads to be initialized by this point */ >> +qemu_spice_init(); >> +#endif >> + >> cpu_exec_init_all(); >> >> bdrv_init_with_whitelist(); >> > > Would have been too easy: > > # qemu-system-x86_64 -daemonize > gettime: Invalid argument > Internal timer error: aborting > > Haven't looked at details yet. np, will do so now. Paolo
Re: [Qemu-devel] [PATCH v7 1/3] hw: introduce standard SD host controller
On 11/02/2012 06:21 AM, Peter Crosthwaite wrote: On Fri, Nov 2, 2012 at 3:21 AM, Igor Mitsyanko wrote: Hi, Peter, I did some testing and noticed significant performance reduction compared to previous version without transfer_timer. For read operation: Testcase (count x blocksize) previous version new version 1000x1Mb 10.9 Mb/s 7.23 Mb/s 16000x4kb 11.01 Mb/s 8.5 Mb/s 30x512b6.47 Mb/s6 Mb/s For write operation: 1000x1Mb 11.72 Mb/s 11.08 Mb/s 16000x4kb 2.9 Mb/s 1.5 Mb/s 20x512b382 kb/s 197 kb/s So, as you can see, degradation in performance is up to 100% for 512b blocks writes! Hi Igor, How does this compare to real hardware? Making it run as fast as possible is a secondary goal to simulating the hardware accurately. If we want the be fussy about performance then we should find out how fast the real hardware runs and make it run at that speed by varying the timer delays accordingly. I think we're not in a situation when we can artificially limit performance yet) I don't even think that we should ever do that on purpose in the future. Maybe using transfer delay exchanges performance for system responsiveness (how can we tell?), then we could temporary leave it while someone implements asynchronous interface to SD card model. As far as I can tell, real-world SD cards performance may vary a lot, there are cards on the market with declared speed up to 90MB/s . Good thing to do would be to work according to specification, our card model states that it supports default and high-speed modes of operation. This means that its maximum speed according to specificationis 4bits x 50 Mhz = 25 MB/s (not accounting for any service information). Usual speed for real modern SD cards is probably around ~20 MB/s for reads, ~10 MB/s for writes. To be honest I just picked a random number (100ns) for the delay which looking at your results, may be too conservative. Have you tried reducing this to say 10ns? You might find your performance comes back. The real solution is to set the delay timer based on how much data there is to transfer. Setting it to 10 ns hadn't helped much. What I'm suggesting to regain performance is: 1. We shouldn't set transfer_timer in sdhci_send_command(), call SDHCI_GET_CLASS(s)->data_transfer(s) directly. Prefer not, because then then different operational modes are inconsistent with each other which will lead to weird performance discrepancies between them. I dont see why ADMA should have delay timers which SDMA doesn't. The delay at this stage is also realistic. Yeah, I also think this delay is present in hardware, but we don't have to have it if we can avoid it. SDMA transfer should stop and exit back to guest at every page boundary anyway, lockup is not an issue for it. 2. Set transfer_timer and return from unfinished ADMA transfer only if we've already did some specific number of ADMA loops (say, 5). Sounds hacky, cant you just divide out the delay timer by 5 for the same speedup but smoother operation? It doesn't help, looks like delay value is not an issue here, but the timer itself is. In reality I havn't seen Linux to compose ADMA descriptor tables with more then 5 descriptor lines, this way our QEMU-lockup concerns will still go away while we regain performance. I also ran tests after applying these two changes above, and got almost the same performance as in "previous version", but it was still lower by 5-10% for ADMA and SDMA-read transfers, and it increased for SDMA write transfers by 20-40%. I can't explain it, dma_memory_*() seems to do the same thing as cpu_physical_memory_rw(). Could be an upstream change?? Regards, Peter On 10/30/2012 09:03 AM, Peter Crosthwaite wrote: +dscr->attr = (uint8_t)extract32(adma1, 0, 7); +dscr->incr = 4; +if ((dscr->attr & SDHC_ADMA_ATTR_ACT_MASK) == SDHC_ADMA_ATTR_SET_LEN) { +dscr->length = (uint16_t)extract32(adma1, 12, 16); +} else { +dscr->length = 4096; +} +break; +case SDHC_CTRL_ADMA2_64: +dma_memory_read(&dma_context_memory, entry_addr, +(uint8_t *)(&dscr->attr), 1); +dma_memory_read(&dma_context_memory, entry_addr + 2, +(uint8_t *)(&dscr->length), 2); +dscr->length = le16_to_cpu(dscr->length); +dma_memory_read(&dma_context_memory, entry_addr + 4, +(uint8_t *)(&dscr->addr), 8); +dscr->attr = le64_to_cpu(dscr->attr); +dscr->attr &= 0xfff8; These two lines should use dscr->addr instead of dscr->attr +dscr->incr = 12; +break; +} +} + +/* Advanced DMA data transfer */ + +static void sdhci_do_adma(SDHCIState *s) +{ +unsigned int n, begin, le
Re: [Qemu-devel] [PATCH] add bochs dispi interface framebuffer driver
On Thu, Nov 01, 2012 at 02:30:35PM +0100, Gerd Hoffmann wrote: > On 10/19/12 12:35, Vasilis Liaskovitis wrote: > > Hi, > > > > On Thu, Mar 08, 2012 at 11:13:46AM +0100, Gerd Hoffmann wrote: > >> This patchs adds a frame buffer driver for (virtual/emulated) vga cards > >> implementing the bochs dispi interface. Supported hardware are the > >> bochs vga card with vbe extension and the qemu standard vga. > >> > >> The driver uses a fixed depth of 32bpp. Otherwise it supports the full > >> (but small) feature set of the bochs dispi interface: Resolution > >> switching and display panning. It is tweaked to maximize fbcon speed, > >> so you'll get the comfort of the framebuffer console in kvm guests > >> without performance penalty. > > > > I am testing this driver with qemu-kvm-1.2 or qemu-kvm master (commit) > > and "-std vga". The driver works fine in general. > > > > When I test a guest that runs X (ubuntu-12.04 desktop amd64), sometimes > > parts of > > the screen and keyboard input is mixed between the X terminal and fbconsole > > terminals. This happens only on the initial X11 login (right after boot or > > reboot) and only sometimes. > > Only with bochsfb or with vesafb (+ fbdev xorg driver) too? vt-switching with vesafb/X11 works fine on a grml 64-bit image. However, xorg uses vesa driver in this case, not fbdev (fbdev / fbdevhw xorg modules are initially loaded but then unloaded). X11 uses 1280x768 and vesafb uses 1024x768 according to dmesg. But i haven't been able to test ubuntu+vesafb. Ubuntu kernels use efifb (CONFIG_FB_EFI=y) and fbconsoles don't work at all with this driver + qemu/seabios/vgastd. I have tried using a custom kernel (CONFIG_FB_EFI not set, CONFIG_FB_VESA=y) but for some reason I can't load vesafb on ubuntu desktop. No fb drivers are blacklisted, but no fb driver is loaded if I specify a vga text mode with "vga=" in the kernel command line. X11 still uses 1280x768 resolution here. Anyway, these are screenshots of the original problem (messed up output with bochsfb + fbdev-xorg on ubuntu 12.04 startup): vt7 http://picpaste.de/bochsfb-badstart-AirrXZuF.png vt1 http://www.picpaste.de/bochsfb-badstart-f1-EO10MVdF.png it still happens with the latest bochsfb driver (tested with 3.6.0 though, not 3.7.0-rc3 yet) > > > Xorg driver used is fbdev (i can send xorg log), not sure if another driver > > should be used/implemented for the bochsfb. > > Yes, that one is fine. > > > CONFIG_FB_BOCHS=m > > CONFIG_FB_VESA=y > > # CONFIG_FB_EFI is not set > > > > Should FB_VESA be turned to "not set" for this test? (it's not tristate in > > Kconfig) > > > > Btw (slightly off-topic) are other framebuffer drivers suitable for the > > standard qemu vga-pci device? Would vesafb or uvesafb work? > > Never tried uvesafb. vesafb will work too, but run with a fixed > resolution. bochsfb allows you to change the display resolution at > runtime using fbset. fbcon is faster too because bochsfb supports > display panning. I assume bochsfb is the way we want to go. I can send more detailed info on the uvesafb issue if needed. thanks, - Vasilis
[Qemu-devel] qemu.org DNS is down, use 140.211.15.109
The DNS for qemu.org is down. Please use the IP address 140.211.15.109 directly in the meantime or add it to your /etc/hosts so you can continue to use the domain name: echo '140.211.15.109 qemu.org wiki.qemu.org git.qemu.org' >>/etc/hosts Stefan
[Qemu-devel] [PATCH trace] Avoid all systemtap reserved words
From: "Daniel P. Berrange" Over time various systemtap reserved words have been blacklisted in the trace backend generator. The list is not complete though, so there is continued risk of problems in the future. Preempt such problems by specifying the full list of systemtap keywords listed in its parser as identified here: http://sourceware.org/ml/systemtap/2012-q4/msg00157.html Signed-off-by: Daniel P. Berrange --- scripts/tracetool/backend/dtrace.py | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py index 6be7047..23c43e2 100644 --- a/scripts/tracetool/backend/dtrace.py +++ b/scripts/tracetool/backend/dtrace.py @@ -73,6 +73,15 @@ def d(events): '};') +# Technically 'self' is not used by systemtap yet, but +# they recommended we keep it in the reserved list anyway +RESERVED_WORDS = ( +'break', 'catch', 'continue', 'delete', 'else', 'for', +'foreach', 'function', 'global', 'if', 'in', 'limit', +'long', 'next', 'probe', 'return', 'self', 'string', +'try', 'while' +) + def stap(events): for e in events: # Define prototype for probe arguments @@ -87,7 +96,7 @@ def stap(events): if len(e.args) > 0: for name in e.args.names(): # Append underscore to reserved keywords -if name in ('limit', 'in', 'next', 'self', 'function'): +if name in RESERVED_WORDS: name += '_' out(' %s = $arg%d;' % (name, i)) i += 1 -- 1.7.11.7
Re: [Qemu-devel] Testing migration under stress
On 11/02/2012 05:10 AM, David Gibson wrote: > Asking for some advice on the list. > > I have prorotype savevm and migration support ready for the pseries > machine. They seem to work under simple circumstances (idle guest). > To test them more extensively I've been attempting to perform live > migrations (just over tcp->localhost) which the guest is active with > something. In particular I've tried while using octave to do matrix > multiply (so exercising the FP unit) and my colleague Alexey has tried > during some video encoding. > As you are doing local migration one option is to setting the speed higher than line speed , as we don't actually send the data, another is to set high downtime. > However, in each of these cases, we've found that the migration only > completes and the source instance only stops after the intensive > workload has (just) completed. What I surmise is happening is that > the workload is touching memory pages fast enough that the ram > migration code is never getting below the threshold to complete the > migration until the guest is idle again. > The workload you chose is really bad for live migration, as all the guest does is dirtying his memory. I recommend looking for workload that does some networking or disk IO. Vinod succeeded running SwingBench and SLOB benchmarks that converged ok, I don't know if they run on pseries, but similar workload should be ok(small database/warehouse). We found out that SpecJbb on the other hand is hard to converge. Web workload or video streaming also do the trick. Cheers, Orit > Does anyone have some ideas for testing this better: workloads that > are less likely to trigger this behaviour, or settings to tweak in the > migration itself to make it more likely to complete migration while > the workload is still active. >
Re: [Qemu-devel] [PATCH v2] tests: allow qemu-iotests to be run against nbd backend
Il 02/11/2012 11:28, n...@bytemark.co.uk ha scritto: > @@ -197,12 +198,14 @@ testlist options > IMGPROTO=rbd > xpand=false > ;; > - > -sheepdog) > IMGPROTO=sheepdog > xpand=false > ;; > - > +-nbd) > +IMGPROTO=nbd > +xpand=false > +;; > -nocache) Spacing problem? Paolo
[Qemu-devel] [PATCH v3] tests: allow qemu-iotests to be run against nbd backend
From: n...@bytemark.co.uk To: qemu-devel@nongnu.org Cc: pbonz...@redhat.com, kw...@redhat.com, Nick Thomas Subject: [PATCH v3] tests: allow qemu-iotests to be run against nbd backend Date: Fri, 2 Nov 2012 10:28:06 + From: Nick Thomas To do this, we start a qemu-nbd process at _make_test_img and kill it in _cleanup_test_img. $TEST_IMG is changed to point at the TCP server. We also remove the checks for existence of binaries from common.config - they're duplicated in common, and we can make the qemu-nbd check conditional on $IMGPROTO being "nbd" if we do it there. Signed-off-by: Nick Thomas --- tests/qemu-iotests/common| 14 +++--- tests/qemu-iotests/common.config | 10 ++ tests/qemu-iotests/common.rc | 23 ++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 1f6fdf5..195722e 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -136,6 +136,7 @@ check options -vmdk test vmdk -rbdtest rbd -sheepdog test sheepdog +-nbdtest nbd -xdiff graphical mode diff -nocache use O_DIRECT on backing file -misalign misalign memory allocations @@ -197,12 +198,14 @@ testlist options IMGPROTO=rbd xpand=false ;; - -sheepdog) IMGPROTO=sheepdog xpand=false ;; - + -nbd) + IMGPROTO=nbd + xpand=false + ;; -nocache) QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --nocache" xpand=false @@ -350,9 +353,14 @@ fi [ "$QEMU" = "" ] && _fatal "qemu not found" [ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found" -[ "$QEMU_IO" = "" ] && _fatal "qemu-img not found" +[ "$QEMU_IO" = "" ] && _fatal "qemu-io not found" + +if [ "$IMGPROTO" = "nbd" ] ; then +[ "$QEMU_NBD" = "" ] && _fatal "qemu-nbd not found" +fi if $valgrind; then export REAL_QEMU_IO="$QEMU_IO_PROG" export QEMU_IO_PROG=valgrind_qemu_io fi + diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config index df082e7..08a3f10 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -90,21 +90,23 @@ export PS_ALL_FLAGS="-ef" if [ -z "$QEMU_PROG" ]; then export QEMU_PROG="`set_prog_path qemu`" fi -[ "$QEMU_PROG" = "" ] && _fatal "qemu not found" if [ -z "$QEMU_IMG_PROG" ]; then export QEMU_IMG_PROG="`set_prog_path qemu-img`" fi -[ "$QEMU_IMG_PROG" = "" ] && _fatal "qemu-img not found" if [ -z "$QEMU_IO_PROG" ]; then export QEMU_IO_PROG="`set_prog_path qemu-io`" fi -[ "$QEMU_IO_PROG" = "" ] && _fatal "qemu-io not found" + +if [ -z "$QEMU_NBD_PROG" ]; then +export QEMU_NBD_PROG="`set_prog_path qemu-nbd`" +fi export QEMU=$QEMU_PROG -export QEMU_IMG=$QEMU_IMG_PROG +export QEMU_IMG=$QEMU_IMG_PROG export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS" +export QEMU_NBD=$QEMU_NBD_PROG [ -f /etc/qemu-iotest.config ] && . /etc/qemu-iotest.config diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 334534f..aef5f52 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -49,6 +49,9 @@ umask 022 if [ "$IMGPROTO" = "file" ]; then TEST_IMG=$TEST_DIR/t.$IMGFMT +elif [ "$IMGPROTO" = "nbd" ]; then +TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT +TEST_IMG="nbd:127.0.0.1:10810" else TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT fi @@ -86,6 +89,13 @@ _make_test_img() local extra_img_options="" local image_size=$* local optstr="" +local img_name="" + +if [ -n "$TEST_IMG_FILE" ]; then +img_name=$TEST_IMG_FILE +else +img_name=$TEST_IMG +fi if [ -n "$IMGOPTS" ]; then optstr=$(_optstr_add "$optstr" "$IMGOPTS") @@ -104,7 +114,7 @@ _make_test_img() fi # XXX(hch): have global image options? -$QEMU_IMG create -f $IMGFMT $extra_img_options $TEST_IMG $image_size | \ +$QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size | \ sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ -e "s#$TEST_DIR#TEST_DIR#g" \ -e "s#$IMGFMT#IMGFMT#g" \ @@ -115,12 +125,23 @@ _make_test_img() -e "s# compat6=\\(on\\|off\\)##g" \ -e "s# static=\\(on\\|off\\)##g" \ -e "s# lazy_refcounts=\\(on\\|off\\)##g" + +# Start an NBD server on the image file, which is what we'll be talking to +if [ $IMGPROTO = "nbd" ]; then +eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 $TEST_IMG_FILE &" +QEMU_NBD_PID=$! +sleep 1 # FIXME: qemu-nbd needs to be listening before we continue +fi } _cleanup_test_img() { case "$IMGPROTO" in +nbd) +kill $QEMU_NBD_PID +rm -f $TEST_IMG_FILE +;; file) rm -f $TEST_DIR/t.$IMGFMT rm
Re: [Qemu-devel] [PATCH v2] tests: allow qemu-iotests to be run against nbd backend
On Fri, 2012-11-02 at 13:41 +0100, Paolo Bonzini wrote: > Il 02/11/2012 11:28, n...@bytemark.co.uk ha scritto: > > @@ -197,12 +198,14 @@ testlist options > > IMGPROTO=rbd > > xpand=false > > ;; > > - > > -sheepdog) > > IMGPROTO=sheepdog > > xpand=false > > ;; > > - > > +-nbd) > > +IMGPROTO=nbd > > +xpand=false > > +;; > > -nocache) > > Spacing problem? > > Paolo Tabs vs. spaces. Blarg. v3 emailed.
Re: [Qemu-devel] Testing migration under stress
Il 02/11/2012 04:10, David Gibson ha scritto: > Asking for some advice on the list. > > I have prorotype savevm and migration support ready for the pseries > machine. They seem to work under simple circumstances (idle guest). > To test them more extensively I've been attempting to perform live > migrations (just over tcp->localhost) which the guest is active with > something. In particular I've tried while using octave to do matrix > multiply (so exercising the FP unit) and my colleague Alexey has tried > during some video encoding. > > However, in each of these cases, we've found that the migration only > completes and the source instance only stops after the intensive > workload has (just) completed. What I surmise is happening is that > the workload is touching memory pages fast enough that the ram > migration code is never getting below the threshold to complete the > migration until the guest is idle again. > > Does anyone have some ideas for testing this better: workloads that > are less likely to trigger this behaviour, or settings to tweak in the > migration itself to make it more likely to complete migration while > the workload is still active. Have you set the migration speed (migrate_set_speed) to something higher than the default 32MB/sec? Paolo
Re: [Qemu-devel] Testing migration under stress
David Gibson wrote: > Asking for some advice on the list. > > I have prorotype savevm and migration support ready for the pseries > machine. They seem to work under simple circumstances (idle guest). > To test them more extensively I've been attempting to perform live > migrations (just over tcp->localhost) which the guest is active with > something. In particular I've tried while using octave to do matrix > multiply (so exercising the FP unit) and my colleague Alexey has tried > during some video encoding. > > However, in each of these cases, we've found that the migration only > completes and the source instance only stops after the intensive > workload has (just) completed. What I surmise is happening is that > the workload is touching memory pages fast enough that the ram > migration code is never getting below the threshold to complete the > migration until the guest is idle again. > > Does anyone have some ideas for testing this better: workloads that > are less likely to trigger this behaviour, or settings to tweak in the > migration itself to make it more likely to complete migration while > the workload is still active. You can: migrate_set_downtime 2s (or so) I normally run stress, and you move the memory that it dirties until it converges (depends a lot of your networking). Doing anything that is really memory intensive is basically never gonig to converge. Later, Juan.
Re: [Qemu-devel] live migration which includes previos snapshot
On 11/02/2012 04:30 AM, Stefan Hajnoczi wrote: > II. If you want to use internal snapshots in a single qcow2 file, you > will need to modify QEMU code more: > 1. Implement BlockDriverState snapshot slave support so a qcow2 > snapshot can be read-only accessed as a BlockDriverState while the > master BlockDriverState for the image still writes into the image > file. This is mainly qcow2 refactoring and block.c glue code. You are not the first to request this - libvirt would also like the ability to have read-only access into the contents of an internal snapshot while the rest of qemu continues to write into the image. > 2. Use Paolo's runtime NBD server to export the snapshot slave when > the VM is forked: An NBD server on top of the read-only state is an additional step that will make access easier. -- Eric Blake ebl...@redhat.com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
[Qemu-devel] [PATCH 0/5] Fixes for thread pool patches.
Three fixes: 1) Darwin does not support weak aliases, use weak references instead. 2) Darwin, NetBSD and OpenBSD do not have sem_timedwait, implement counting semaphores with a mutex and cv there. 3) Daemonize was broken, fixes are in patches 3-5. Paolo Bonzini (5): compiler: support Darwin weak references semaphore: implement fallback counting semaphores with mutex+condvar qemu-timer: reinitialize timers after fork vl: unify calls to init_timer_alarm vl: delay thread initialization after daemonization compiler.h | 9 ++- main-loop.c | 6 +++-- osdep.c | 56 +++- oslib-win32.c | 12 + qemu-sockets.c | 40 - qemu-thread-posix.c | 74 + qemu-thread-posix.h | 6 + qemu-timer.c| 15 ++- qmp.c | 2 ++ vl.c| 9 +++ 10 file modificati, 172 inserzioni(+), 57 rimozioni(-) -- 1.7.12.1
[Qemu-devel] [PATCH 4/5] vl: unify calls to init_timer_alarm
init_timer_alarm was being called twice. This is not needed. Signed-off-by: Paolo Bonzini --- main-loop.c | 5 - vl.c| 5 - 2 file modificati, 4 inserzioni(+), 6 rimozioni(-) diff --git a/main-loop.c b/main-loop.c index e43c7c8..234a313 100644 --- a/main-loop.c +++ b/main-loop.c @@ -123,7 +123,10 @@ int qemu_init_main_loop(void) GSource *src; init_clocks(); -init_timer_alarm(); +if (init_timer_alarm() < 0) { +fprintf(stderr, "could not initialize alarm timer\n"); +exit(1); +} qemu_mutex_lock_iothread(); ret = qemu_signal_init(); diff --git a/vl.c b/vl.c index 99681da..e2d5276 100644 --- a/vl.c +++ b/vl.c @@ -3616,11 +3616,6 @@ int main(int argc, char **argv, char **envp) add_device_config(DEV_VIRTCON, "vc:80Cx24C"); } -if (init_timer_alarm() < 0) { -fprintf(stderr, "could not initialize alarm timer\n"); -exit(1); -} - socket_init(); if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0) -- 1.7.12.1
[Qemu-devel] [PATCH 1/5] compiler: support Darwin weak references
Weakrefs only tell you if the symbol was defined elsewhere, so you need a further check at runtime to pick the default definition when needed. This could be automated by the compiler, but it does not do it. Signed-off-by: Paolo Bonzini --- compiler.h | 9 - osdep.c| 56 oslib-win32.c | 12 +++- qemu-sockets.c | 40 ++-- qmp.c | 2 ++ 5 file modificati, 71 inserzioni(+), 48 rimozioni(-) diff --git a/compiler.h b/compiler.h index 58865d6..4d411be 100644 --- a/compiler.h +++ b/compiler.h @@ -50,8 +50,15 @@ # define __printf__ __gnu_printf__ # endif # endif -# define QEMU_WEAK_ALIAS(newname, oldname) \ +# if defined(__APPLE__) +# define QEMU_WEAK_ALIAS(newname, oldname) \ +static typeof(oldname) weak_##newname __attribute__((weakref(#oldname))) +# define QEMU_WEAK_REF(newname, oldname) (weak_##newname ? weak_##newname : oldname) +# else +# define QEMU_WEAK_ALIAS(newname, oldname) \ typeof(oldname) newname __attribute__((weak, alias (#oldname))) +# define QEMU_WEAK_REF(newname, oldname) newname +# endif #else #define GCC_ATTR /**/ #define GCC_FMT_ATTR(n, m) diff --git a/osdep.c b/osdep.c index a87d4a4..2f7a491 100644 --- a/osdep.c +++ b/osdep.c @@ -54,6 +54,38 @@ static bool fips_enabled = false; static const char *qemu_version = QEMU_VERSION; +static int default_fdset_get_fd(int64_t fdset_id, int flags) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_get_fd, default_fdset_get_fd); +#define monitor_fdset_get_fd \ +QEMU_WEAK_REF(monitor_fdset_get_fd, default_fdset_get_fd) + +static int default_fdset_dup_fd_add(int64_t fdset_id, int dup_fd) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_add, default_fdset_dup_fd_add); +#define monitor_fdset_dup_fd_add \ +QEMU_WEAK_REF(monitor_fdset_dup_fd_add, default_fdset_dup_fd_add) + +static int default_fdset_dup_fd_remove(int dup_fd) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_remove); +#define monitor_fdset_dup_fd_remove \ +QEMU_WEAK_REF(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_remove) + +static int default_fdset_dup_fd_find(int dup_fd) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_find, default_fdset_dup_fd_find); +#define monitor_fdset_dup_fd_find \ +QEMU_WEAK_REF(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_find) + int socket_set_cork(int fd, int v) { #if defined(SOL_TCP) && defined(TCP_CORK) @@ -400,27 +432,3 @@ bool fips_get_state(void) return fips_enabled; } - -static int default_fdset_get_fd(int64_t fdset_id, int flags) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_get_fd, default_fdset_get_fd); - -static int default_fdset_dup_fd_add(int64_t fdset_id, int dup_fd) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_add, default_fdset_dup_fd_add); - -static int default_fdset_dup_fd_remove(int dup_fd) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_remove); - -static int default_fdset_dup_fd_find(int dup_fd) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_find, default_fdset_dup_fd_find); diff --git a/oslib-win32.c b/oslib-win32.c index 9ca83df..326a2bd 100644 --- a/oslib-win32.c +++ b/oslib-win32.c @@ -32,6 +32,13 @@ #include "trace.h" #include "qemu_socket.h" +static void default_qemu_fd_register(int fd) +{ +} +QEMU_WEAK_ALIAS(qemu_fd_register, default_qemu_fd_register); +#define qemu_fd_register \ +QEMU_WEAK_REF(qemu_fd_register, default_qemu_fd_register) + void *qemu_oom_check(void *ptr) { if (ptr == NULL) { @@ -150,8 +157,3 @@ int qemu_get_thread_id(void) { return GetCurrentThreadId(); } - -static void default_qemu_fd_register(int fd) -{ -} -QEMU_WEAK_ALIAS(qemu_fd_register, default_qemu_fd_register); diff --git a/qemu-sockets.c b/qemu-sockets.c index f2a6371..abcd791 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -61,6 +61,28 @@ static QemuOptsList dummy_opts = { }, }; +static int default_monitor_get_fd(Monitor *mon, const char *name, Error **errp) +{ +error_setg(errp, "only QEMU supports file descriptor passing"); +return -1; +} +QEMU_WEAK_ALIAS(monitor_get_fd, default_monitor_get_fd); +#define monitor_get_fd \ +QEMU_WEAK_REF(monitor_get_fd, default_monitor_get_fd) + +static int default_qemu_set_fd_handler2(int fd, +IOCanReadHandler *fd_read_poll, +IOHandler *fd_read, +IOHandler *fd_write, +void *opaque) + +{ +abort(); +} +QEMU_WEAK_ALIAS(qemu_set_fd_handler2, default_qemu_set_fd_handler2); +#define qemu_set_fd_handler2 \ +QEMU_WEAK_REF(qemu_set_fd_handler2, default_qemu_set_fd_handler2) + static int inet_getport(struct addrinfo *e) { struct sockaddr_in *i4; @@ -967,21 +989,3 @@ int socket_i
[Qemu-devel] [PATCH 2/5] semaphore: implement fallback counting semaphores with mutex+condvar
OpenBSD and Darwin do not have sem_timedwait. Implement a fallback for them. Signed-off-by: Paolo Bonzini --- qemu-thread-posix.c | 74 + qemu-thread-posix.h | 6 + 2 file modificati, 80 inserzioni(+) diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c index 6a3d3a1..048db8f 100644 --- a/qemu-thread-posix.c +++ b/qemu-thread-posix.c @@ -122,36 +122,100 @@ void qemu_sem_init(QemuSemaphore *sem, int init) { int rc; +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +rc = pthread_mutex_init(&sem->lock, NULL); +if (rc != 0) { +error_exit(rc, __func__); +} +rc = pthread_cond_init(&sem->cond, NULL); +if (rc != 0) { +error_exit(rc, __func__); +} +if (init < 0) { +error_exit(EINVAL, __func__); +} +sem->count = init; +#else rc = sem_init(&sem->sem, 0, init); if (rc < 0) { error_exit(errno, __func__); } +#endif } void qemu_sem_destroy(QemuSemaphore *sem) { int rc; +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +rc = pthread_cond_destroy(&sem->cond); +if (rc < 0) { +error_exit(rc, __func__); +} +rc = pthread_mutex_destroy(&sem->lock); +if (rc < 0) { +error_exit(rc, __func__); +} +#else rc = sem_destroy(&sem->sem); if (rc < 0) { error_exit(errno, __func__); } +#endif } void qemu_sem_post(QemuSemaphore *sem) { int rc; +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +pthread_mutex_lock(&sem->lock); +if (sem->count == INT_MAX) { +rc = EINVAL; +} else if (sem->count++ < 0) { +rc = pthread_cond_signal(&sem->cond); +} else { +rc = 0; +} +pthread_mutex_unlock(&sem->lock); +if (rc != 0) { +error_exit(rc, __func__); +} +#else rc = sem_post(&sem->sem); if (rc < 0) { error_exit(errno, __func__); } +#endif } int qemu_sem_timedwait(QemuSemaphore *sem, int ms) { int rc; +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +struct timespec ts; +clock_gettime(CLOCK_REALTIME, &ts); +if (ms) { +int nsec = ts.tv_nsec + (ms % 1000) * 100; +ts.tv_sec += ms / 1000 + nsec / 10; +ts.tv_nsec = nsec % 10; +} + +pthread_mutex_lock(&sem->lock); +--sem->count; +while (sem->count < 0) { +rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts); +if (rc == ETIMEDOUT) { +break; +} +if (rc != 0) { +error_exit(rc, __func__); +} +} +pthread_mutex_unlock(&sem->lock); +return (rc == ETIMEDOUT ? -1 : 0); +#else if (ms <= 0) { /* This is cheaper than sem_timedwait. */ do { @@ -181,10 +245,19 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) error_exit(errno, __func__); } return 0; +#endif } void qemu_sem_wait(QemuSemaphore *sem) { +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +pthread_mutex_lock(&sem->lock); +--sem->count; +while (sem->count < 0) { +pthread_cond_wait(&sem->cond, &sem->lock); +} +pthread_mutex_unlock(&sem->lock); +#else int rc; do { @@ -193,6 +266,7 @@ void qemu_sem_wait(QemuSemaphore *sem) if (rc < 0) { error_exit(errno, __func__); } +#endif } void qemu_thread_create(QemuThread *thread, diff --git a/qemu-thread-posix.h b/qemu-thread-posix.h index 2542c15..1c098c2 100644 --- a/qemu-thread-posix.h +++ b/qemu-thread-posix.h @@ -12,7 +12,13 @@ struct QemuCond { }; struct QemuSemaphore { +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +pthread_mutex_t lock; +pthread_cond_t cond; +int count; +#else sem_t sem; +#endif }; struct QemuThread { -- 1.7.12.1
[Qemu-devel] [PATCH 5/5] vl: delay thread initialization after daemonization
Commit ac4119c (chardev: Use timer instead of bottom-half to postpone open event, 2012-10-12) moved the alarm timer initialization to an earlier point but failed to consider that it depends on qemu_init_main_loop. Later, commit 1c53786 (vl: init main loop earlier, 2012-10-30) fixed this, but left -daemonize in two different ways. First, timers need to be reinitialized after forking. Second, the global mutex was being held by the parent, and thus dropped after forking. The first is now fixed using pthread_atfork. For the second part, make sure that the global mutex is not taken before daemonization, and similarly delay qemu_thread_self. Signed-off-by: Paolo Bonzini --- main-loop.c | 1 - vl.c| 4 +++- 2 file modificati, 3 inserzioni(+), 2 rimozioni(-) diff --git a/main-loop.c b/main-loop.c index 234a313..c87624e 100644 --- a/main-loop.c +++ b/main-loop.c @@ -128,7 +128,6 @@ int qemu_init_main_loop(void) exit(1); } -qemu_mutex_lock_iothread(); ret = qemu_signal_init(); if (ret) { return ret; diff --git a/vl.c b/vl.c index e2d5276..0f5b07b 100644 --- a/vl.c +++ b/vl.c @@ -3477,7 +3477,6 @@ int main(int argc, char **argv, char **envp) } loc_set_none(); -qemu_init_cpu_loop(); if (qemu_init_main_loop()) { fprintf(stderr, "qemu_init_main_loop failed\n"); exit(1); @@ -3677,6 +3676,9 @@ int main(int argc, char **argv, char **envp) os_set_line_buffering(); +qemu_init_cpu_loop(); +qemu_mutex_lock_iothread(); + #ifdef CONFIG_SPICE /* spice needs the timers to be initialized by this point */ qemu_spice_init(); -- 1.7.12.1
[Qemu-devel] [PATCH 3/5] qemu-timer: reinitialize timers after fork
Timers are not inherited by the child of a fork(2), so just use pthread_atfork to reinstate them after daemonize. Signed-off-by: Paolo Bonzini --- qemu-timer.c | 15 ++- 1 file modificato, 14 inserzioni(+). 1 rimozione(-) diff --git a/qemu-timer.c b/qemu-timer.c index f3426c9..1d87694 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -742,6 +742,17 @@ static void quit_timers(void) t->stop(t); } +static void reinit_timers(void) +{ +struct qemu_alarm_timer *t = alarm_timer; +t->stop(t); +if (t->start(t)) { +fprintf(stderr, "Internal timer error: aborting\n"); +exit(1); +} +qemu_rearm_alarm_timer(t); +} + int init_timer_alarm(void) { struct qemu_alarm_timer *t = NULL; @@ -765,6 +776,9 @@ int init_timer_alarm(void) } atexit(quit_timers); +#ifdef CONFIG_POSIX +pthread_atfork(NULL, NULL, reinit_timers); +#endif alarm_timer = t; return 0; -- 1.7.12.1
Re: [Qemu-devel] [PATCH] add bochs dispi interface framebuffer driver
>> Only with bochsfb or with vesafb (+ fbdev xorg driver) too? > > vt-switching with vesafb/X11 works fine on a grml 64-bit image. However, xorg > uses vesa driver in this case, not fbdev (fbdev / fbdevhw xorg modules are > initially loaded but then unloaded). X11 uses 1280x768 and vesafb uses > 1024x768 > according to dmesg. You should be able to force the fbdev driver using xorg.conf. > But i haven't been able to test ubuntu+vesafb. Ubuntu kernels use efifb > (CONFIG_FB_EFI=y) and fbconsoles don't work at all with this driver + > qemu/seabios/vgastd. I think this is a grub2 setup issue. Grub2 can pass gfx mode params to the linux kernel in a way efifb is able to handle. > vt7 http://picpaste.de/bochsfb-badstart-AirrXZuF.png > vt1 http://www.picpaste.de/bochsfb-badstart-f1-EO10MVdF.png > it still happens with the latest bochsfb driver (tested with 3.6.0 though, not > 3.7.0-rc3 yet) Most likely this is a guest-side bug and not specific to bochsfb. Console switching depends on all parties being cooperative. Nothing stops an application writing to the framebuffer even it isn't running on the foreground console. cheers, Gerd
Re: [Qemu-devel] [PATCH v2] tests: allow qemu-iotests to be run against nbd backend
Am 02.11.2012 13:41, schrieb Paolo Bonzini: > Il 02/11/2012 11:28, n...@bytemark.co.uk ha scritto: >> @@ -197,12 +198,14 @@ testlist options >> IMGPROTO=rbd >> xpand=false >> ;; >> - >> -sheepdog) >> IMGPROTO=sheepdog >> xpand=false >> ;; >> - >> +-nbd) >> +IMGPROTO=nbd >> +xpand=false >> +;; >> -nocache) > > Spacing problem? Yes, tabs in the original code. Not sure how to deal best with it... Kevin
Re: [Qemu-devel] [PATCH v2 0/6] block: bdrv_img_create(): propagate errors
On Fri, 19 Oct 2012 11:27:59 -0300 Luiz Capitulino wrote: > By adding error propagation to bdrv_img_create() we improve error reporting > in qmp_transaction() and simplify qemu-img.c:img_create() a bit. > > Please, check individual patches for details. Kevin, is this in your review queue?
Re: [Qemu-devel] [PATCH v2 0/6] block: bdrv_img_create(): propagate errors
Am 02.11.2012 14:25, schrieb Luiz Capitulino: > On Fri, 19 Oct 2012 11:27:59 -0300 > Luiz Capitulino wrote: > >> By adding error propagation to bdrv_img_create() we improve error reporting >> in qmp_transaction() and simplify qemu-img.c:img_create() a bit. >> >> Please, check individual patches for details. > > Kevin, is this in your review queue? Yes, it is. With KVM Forum and lots of other patch series, no promises though. Kevin
Re: [Qemu-devel] [PATCH v2 0/6] block: bdrv_img_create(): propagate errors
On Fri, 02 Nov 2012 14:40:03 +0100 Kevin Wolf wrote: > Am 02.11.2012 14:25, schrieb Luiz Capitulino: > > On Fri, 19 Oct 2012 11:27:59 -0300 > > Luiz Capitulino wrote: > > > >> By adding error propagation to bdrv_img_create() we improve error reporting > >> in qmp_transaction() and simplify qemu-img.c:img_create() a bit. > >> > >> Please, check individual patches for details. > > > > Kevin, is this in your review queue? > > Yes, it is. With KVM Forum and lots of other patch series, no promises > though. Sure, just wanted to know if you were aware about it.
Re: [Qemu-devel] buildbot failure in qemu on default_i386_macosx
On 11/02/2012 03:17 AM, Stefan Hajnoczi wrote: Corey, any ideas here? My guess for the majority of these is that monitor.o is not being linked with osdep.o for MacOSX. Is this a nightly build that would have been successful earlier in the week? Also do you know if (and perhaps how) I can cross compile on Fedora to recreate this? -- Regards, Corey Bryant LINK qemu-ga Undefined symbols: "_monitor_get_fd", referenced from: _socket_connect in qemu-sockets.o _socket_listen in qemu-sockets.o "_monitor_fdset_dup_fd_find", referenced from: _qemu_close in osdep.o "_sem_timedwait", referenced from: _qemu_sem_timedwait in qemu-thread-posix.o "_monitor_fdset_dup_fd_remove", referenced from: _qemu_close in osdep.o "_monitor_fdset_get_fd", referenced from: _qemu_open in osdep.o "_qemu_set_fd_handler2", referenced from: _inet_connect_addr in qemu-sockets.o _wait_for_connect in qemu-sockets.o _unix_connect_opts in qemu-sockets.o "_monitor_fdset_dup_fd_add", referenced from: _qemu_open in osdep.o ld: symbol(s) not found On Fri, Nov 2, 2012 at 5:01 AM, wrote: The Buildbot has detected a new failure on builder default_i386_macosx while building qemu. Full details are available at: http://buildbot.b1-systems.de/qemu/builders/default_i386_macosx/builds/2 Buildbot URL: http://buildbot.b1-systems.de/qemu/ Buildslave for this Build: MacOSX-10.5 Build Reason: The Nightly scheduler named 'nightly_default_5oclock' triggered this build Build Source Stamp: [branch master] HEAD Blamelist: BUILD FAILED: failed compile sincerely, -The Buildbot
Re: [Qemu-devel] [PATCH 1/5] compiler: support Darwin weak references
On 2 November 2012 14:14, Paolo Bonzini wrote: > Weakrefs only tell you if the symbol was defined elsewhere, so you > need a further check at runtime to pick the default definition > when needed. > > This could be automated by the compiler, but it does not do it. clang doesn't error out anymore, but this version still provokes a warning: CCosdep.o osdep.c:85:1: warning: unused function 'weak_monitor_fdset_dup_fd_find' [-Wunused-function] QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_find, default_fdset_dup_fd_find); ^ ./compiler.h:55:32: note: expanded from macro 'QEMU_WEAK_ALIAS' static typeof(oldname) weak_##newname __attribute__((weakref(#oldname))) ^ :147:1: note: expanded from macro 'weak_' weak_monitor_fdset_dup_fd_find ^ 1 warning generated. -- PMM
Re: [Qemu-devel] [PATCHv2 1/4] Adding new syscalls (bugzilla 855162)
On 11/01/2012 05:43 PM, Paul Moore wrote: On Tuesday, October 23, 2012 03:55:29 AM Eduardo Otubo wrote: According to the bug 855162[0] - there's the need of adding new syscalls to the whitelist whenn using Qemu with Libvirt. [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 v2: Adding new syscalls to the list: readlink, rt_sigpending, and rt_sigtimedwait Reported-by: Paul Moore Signed-off-by: Eduardo Otubo --- qemu-seccomp.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) I had an opportunity to test this patchset on a F17 machine using QEMU 1.2 and unfortunately it still fails. I'm using a relatively basic guest configuration running F16, the details are documented in the RH BZ that Eduardo mentioned in the patch description. Paul, Here's the latest diff for the whitelist. We're looking to get the patches out in the next few days after a bit more testing. diff --git a/qemu-seccomp.c b/qemu-seccomp.c index 64329a3..81aaf74 100644 --- a/qemu-seccomp.c +++ b/qemu-seccomp.c @@ -45,6 +45,12 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { { SCMP_SYS(access), 245 }, { SCMP_SYS(prctl), 245 }, { SCMP_SYS(signalfd), 245 }, +{ SCMP_SYS(getrlimit), 245 }, +{ SCMP_SYS(set_tid_address), 245 }, +{ SCMP_SYS(socketpair), 245 }, +{ SCMP_SYS(statfs), 245 }, +{ SCMP_SYS(unlink), 245 }, +{ SCMP_SYS(wait4), 245 }, #if defined(__i386__) { SCMP_SYS(fcntl64), 245 }, { SCMP_SYS(fstat64), 245 }, @@ -59,6 +65,8 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { { SCMP_SYS(mmap2), 245}, { SCMP_SYS(sigprocmask), 245 }, #elif defined(__x86_64__) +{ SCMP_SYS(semget), 245}, +#endif { SCMP_SYS(sched_getparam), 245}, { SCMP_SYS(sched_getscheduler), 245}, { SCMP_SYS(fstat), 245}, @@ -69,11 +77,15 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { { SCMP_SYS(socket), 245}, { SCMP_SYS(setsockopt), 245}, { SCMP_SYS(uname), 245}, -{ SCMP_SYS(semget), 245}, -#endif { SCMP_SYS(eventfd2), 245 }, { SCMP_SYS(dup), 245 }, +{ SCMP_SYS(dup2), 245 }, +{ SCMP_SYS(dup3), 245 }, { SCMP_SYS(gettid), 245 }, +{ SCMP_SYS(getgid), 245 }, +{ SCMP_SYS(getegid), 245 }, +{ SCMP_SYS(getuid), 245 }, +{ SCMP_SYS(geteuid), 245 }, { SCMP_SYS(timer_create), 245 }, { SCMP_SYS(exit), 245 }, { SCMP_SYS(clock_gettime), 245 }, @@ -107,7 +119,22 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { { SCMP_SYS(getsockname), 242 }, { SCMP_SYS(getpeername), 242 }, { SCMP_SYS(fdatasync), 242 }, -{ SCMP_SYS(close), 242 } +{ SCMP_SYS(close), 242 }, +{ SCMP_SYS(accept4), 242 }, +{ SCMP_SYS(rt_sigpending), 242 }, +{ SCMP_SYS(rt_sigtimedwait), 242 }, +{ SCMP_SYS(readv), 242 }, +{ SCMP_SYS(writev), 242 }, +{ SCMP_SYS(preadv), 242 }, +{ SCMP_SYS(pwritev), 242 }, +{ SCMP_SYS(setrlimit), 242 }, +{ SCMP_SYS(ftruncate), 242 }, +{ SCMP_SYS(lstat), 242 }, +{ SCMP_SYS(pipe), 242 }, +{ SCMP_SYS(umask), 242 }, +{ SCMP_SYS(chdir), 242 }, +{ SCMP_SYS(setitimer), 242 }, +{ SCMP_SYS(setsid), 242 } }; Regards, Corey Bryant
Re: [Qemu-devel] [PATCH 2/5] semaphore: implement fallback counting semaphores with mutex+condvar
On 2 November 2012 14:14, Paolo Bonzini wrote: > +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) > +struct timespec ts; > +clock_gettime(CLOCK_REALTIME, &ts); qemu-thread-posix.c:198:5: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration] clock_gettime(CLOCK_REALTIME, &ts); ^ qemu-thread-posix.c:198:19: error: use of undeclared identifier 'CLOCK_REALTIME' clock_gettime(CLOCK_REALTIME, &ts); ^ 1 warning and 1 error generated. make: *** [qemu-thread-posix.o] Error 1 MacOS doesn't implement clock_gettime()... -- PMM
[Qemu-devel] First 9 + 1/2 years of QEMU dev history animated
While I was generating an animation of libvirt dev history[1] using gource, I also took the time to generate one showing the first 9+1/2 years of QEMU's dev history. https://www.youtube.com/watch?v=IujBYP7cw8E I see QEMU has its 10th birthday coming up early next year on Feb 18, 2013, assuming the imported cvs->svn->git history dates are correct: commit e63c3dc74bfb90e4522d075d0d5a7600c5145745 Author: (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162> Date: Tue Feb 18 22:55:36 2003 + Standard project directories initialized by cvs2svn. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1 c046a42c-6fe2-441c-8c8c-71466251a162 Regards, Daniel [1] https://www.youtube.com/watch?v=TKynN8TwC0M -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PATCHv2 1/4] Adding new syscalls (bugzilla 855162)
On Friday, November 02, 2012 09:48:55 AM Corey Bryant wrote: > On 11/01/2012 05:43 PM, Paul Moore wrote: > > On Tuesday, October 23, 2012 03:55:29 AM Eduardo Otubo wrote: > >> According to the bug 855162[0] - there's the need of adding new syscalls > >> to the whitelist whenn using Qemu with Libvirt. > >> > >> [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 > >> > >> v2: Adding new syscalls to the list: readlink, rt_sigpending, and > >> > >> rt_sigtimedwait > >> > >> Reported-by: Paul Moore > >> Signed-off-by: Eduardo Otubo > >> --- > >> > >> qemu-seccomp.c | 13 - > >> 1 file changed, 12 insertions(+), 1 deletion(-) > > > > I had an opportunity to test this patchset on a F17 machine using QEMU 1.2 > > and unfortunately it still fails. I'm using a relatively basic guest > > configuration running F16, the details are documented in the RH BZ that > > Eduardo mentioned in the patch description. > > Paul, Here's the latest diff for the whitelist. We're looking to get > the patches out in the next few days after a bit more testing. Okay, thanks for the updated list ... I'm rebuilding QEMU right now and I'll report back with the results later today. -- paul moore security and virtualization @ redhat
Re: [Qemu-devel] [PATCHv2 1/4] Adding new syscalls (bugzilla 855162)
On Friday, November 02, 2012 12:29:37 AM Eduardo Otubo wrote: > On Thu, Nov 01, 2012 at 05:43:03PM -0400, Paul Moore wrote: > > On Tuesday, October 23, 2012 03:55:29 AM Eduardo Otubo wrote: > > > According to the bug 855162[0] - there's the need of adding new syscalls > > > to the whitelist whenn using Qemu with Libvirt. > > > > > > [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 > > > > > > v2: Adding new syscalls to the list: readlink, rt_sigpending, and > > > > > > rt_sigtimedwait > > > > > > Reported-by: Paul Moore > > > Signed-off-by: Eduardo Otubo > > > --- > > > > > > qemu-seccomp.c | 13 - > > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > I had an opportunity to test this patchset on a F17 machine using QEMU 1.2 > > and unfortunately it still fails. I'm using a relatively basic guest > > configuration running F16, the details are documented in the RH BZ that > > Eduardo mentioned in the patch description. > > > > Eduardo, I assume you are not able to reproduce this? > > Unfortunately no. But we have the v3 patchset coming soon with new > syscalls and we're hoping to get this fixed. Thanks for the feedback > Paul! No problem, thanks for all your work on this patchset. -- paul moore security and virtualization @ redhat
Re: [Qemu-devel] RBD trim / unmap support?
Hello qemu list, i cc you as i'm not sure where the problem is. When i use scsi-hd with discard_granularity the discard works fine on target size but the client print these - immediatly after sending discard / trim commands with mkfs.btrfs. [ 75.076895] sd 2:0:0:4: [sdc] [ 75.078353] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.079377] sd 2:0:0:4: [sdc] [ 75.080410] Sense Key : Aborted Command [current] [ 75.081446] sd 2:0:0:4: [sdc] [ 75.082459] Add. Sense: I/O process terminated [ 75.083466] sd 2:0:0:4: [sdc] CDB: [ 75.084473] Write same(16): 93 08 00 00 00 00 00 00 00 00 00 7f ff ff 00 00 [ 75.085535] end_request: I/O error, dev sdc, sector 0 [ 75.086567] sd 2:0:0:4: [sdc] [ 75.087569] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.088605] sd 2:0:0:4: [sdc] [ 75.089610] Sense Key : Aborted Command [current] [ 75.090630] sd 2:0:0:4: [sdc] [ 75.091631] Add. Sense: I/O process terminated [ 75.092621] sd 2:0:0:4: [sdc] CDB: [ 75.093579] Write same(16): 93 08 00 00 00 00 00 7f ff ff 00 7f ff ff 00 00 [ 75.094581] end_request: I/O error, dev sdc, sector 8388607 [ 75.095558] sd 2:0:0:4: [sdc] [ 75.096561] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.097553] sd 2:0:0:4: [sdc] [ 75.098520] Sense Key : Aborted Command [current] [ 75.099484] sd 2:0:0:4: [sdc] [ 75.100471] Add. Sense: I/O process terminated [ 75.101439] sd 2:0:0:4: [sdc] CDB: [ 75.102432] Write same(16): 93 08 00 00 00 00 00 ff ff fe 00 7f ff ff 00 00 [ 75.103464] end_request: I/O error, dev sdc, sector 16777214 [ 75.104503] sd 2:0:0:4: [sdc] [ 75.105507] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.106514] sd 2:0:0:4: [sdc] [ 75.107525] Sense Key : Aborted Command [current] [ 75.108545] sd 2:0:0:4: [sdc] [ 75.109525] Add. Sense: I/O process terminated [ 75.110487] sd 2:0:0:4: [sdc] CDB: [ 75.111418] Write same(16): 93 08 00 00 00 00 01 7f ff fd 00 7f ff ff 00 00 [ 75.112419] end_request: I/O error, dev sdc, sector 25165821 [ 75.238627] sd 2:0:0:4: [sdc] [ 75.239946] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.241197] sd 2:0:0:4: [sdc] [ 75.242097] Sense Key : Aborted Command [current] [ 75.242627] sd 2:0:0:4: [sdc] [ 75.242627] Add. Sense: I/O process terminated [ 75.242627] sd 2:0:0:4: [sdc] CDB: [ 75.242627] Write same(16): 93 08 00 00 00 00 01 ff ff fc 00 7f ff ff 00 00 [ 75.242627] end_request: I/O error, dev sdc, sector 33554428 [ 75.447311] sd 2:0:0:4: [sdc] [ 75.448505] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.449392] sd 2:0:0:4: [sdc] [ 75.450262] Sense Key : Aborted Command [current] [ 75.451134] sd 2:0:0:4: [sdc] [ 75.451312] Add. Sense: I/O process terminated [ 75.451312] sd 2:0:0:4: [sdc] CDB: [ 75.451312] Write same(16): 93 08 00 00 00 00 02 7f ff fb 00 7f ff ff 00 00 [ 75.451312] end_request: I/O error, dev sdc, sector 41943035 [ 75.476364] sd 2:0:0:4: [sdc] [ 75.477252] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.478135] sd 2:0:0:4: [sdc] [ 75.479004] Sense Key : Aborted Command [current] [ 75.479891] sd 2:0:0:4: [sdc] [ 75.480358] Add. Sense: I/O process terminated [ 75.480358] sd 2:0:0:4: [sdc] CDB: [ 75.480358] Write same(16): 93 08 00 00 00 00 02 ff ff fa 00 7f ff ff 00 00 [ 75.480358] end_request: I/O error, dev sdc, sector 50331642 [ 75.496374] sd 2:0:0:4: [sdc] [ 75.497202] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 75.498077] sd 2:0:0:4: [sdc] [ 75.498948] Sense Key : Aborted Command [current] [ 75.499818] sd 2:0:0:4: [sdc] [ 75.500374] Add. Sense: I/O process terminated [ 75.500374] sd 2:0:0:4: [sdc] CDB: [ 75.500374] Write same(16): 93 08 00 00 00 00 03 7f ff f9 00 7f ff ff 00 00 [ 75.500374] end_request: I/O error, dev sdc, sector 58720249 Stefan Am 02.11.2012 09:20, schrieb Stefan Priebe - Profihost AG: Am 02.11.2012 00:36, schrieb Josh Durgin: On 11/01/2012 04:33 PM, Stefan Priebe wrote: Hello list, does rbd support trim / unmap? Or is it planned to support it? Greets, Stefan librbd (and thus qemu) support it. The rbd kernel module does not yet. See http://ceph.com/docs/master/rbd/qemu-rbd/#enabling-discard-trim Thanks! Is there any recommanded value for discard_granularity? With fstrim and iscsi i use 128kb. Stefan
Re: [Qemu-devel] [PATCHv2 1/4] Adding new syscalls (bugzilla 855162)
On Friday, November 02, 2012 10:10:02 AM Paul Moore wrote: > On Friday, November 02, 2012 09:48:55 AM Corey Bryant wrote: > > On 11/01/2012 05:43 PM, Paul Moore wrote: > > > On Tuesday, October 23, 2012 03:55:29 AM Eduardo Otubo wrote: > > >> According to the bug 855162[0] - there's the need of adding new > > >> syscalls > > >> to the whitelist whenn using Qemu with Libvirt. > > >> > > >> [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 > > >> > > >> v2: Adding new syscalls to the list: readlink, rt_sigpending, and > > >> > > >> rt_sigtimedwait > > >> > > >> Reported-by: Paul Moore > > >> Signed-off-by: Eduardo Otubo > > >> --- > > >> > > >> qemu-seccomp.c | 13 - > > >> 1 file changed, 12 insertions(+), 1 deletion(-) > > > > > > I had an opportunity to test this patchset on a F17 machine using QEMU > > > 1.2 > > > and unfortunately it still fails. I'm using a relatively basic guest > > > configuration running F16, the details are documented in the RH BZ that > > > Eduardo mentioned in the patch description. > > > > Paul, Here's the latest diff for the whitelist. We're looking to get > > the patches out in the next few days after a bit more testing. > > Okay, thanks for the updated list ... I'm rebuilding QEMU right now and I'll > report back with the results later today. Sadly, no luck, it still fails. -- paul moore security and virtualization @ redhat
[Qemu-devel] [PATCH v2 0/5] Fixes for thread pool patches.
Three fixes: 1) Darwin does not support weak aliases, use weak references instead. 2) Darwin, NetBSD and OpenBSD do not have sem_timedwait, implement counting semaphores with a mutex and cv there. 3) Daemonize was broken, fixes are in patches 3-5. Paolo Bonzini (5): compiler: support Darwin weak references semaphore: implement fallback counting semaphores with mutex+condvar qemu-timer: reinitialize timers after fork vl: unify calls to init_timer_alarm vl: delay thread initialization after daemonization compiler.h | 9 +- main-loop.c | 6 ++-- osdep.c | 56 ++-- oslib-win32.c | 12 --- qemu-sockets.c | 40 --- qemu-thread-posix.c | 92 +++-- qemu-thread-posix.h | 6 qemu-timer.c| 14 qmp.c | 2 ++ vl.c| 9 ++ 10 file modificati, 180 inserzioni(+), 66 rimozioni(-) -- 1.7.12.1
[Qemu-devel] [PATCH v2 1/5] compiler: support Darwin weak references
Weakrefs only tell you if the symbol was defined elsewhere, so you need a further check at runtime to pick the default definition when needed. This could be automated by the compiler, but it does not do it. Signed-off-by: Paolo Bonzini --- v1->v2: add unused attribute compiler.h | 9 - osdep.c| 56 oslib-win32.c | 12 +++- qemu-sockets.c | 40 ++-- qmp.c | 2 ++ 5 file modificati, 71 inserzioni(+), 48 rimozioni(-) diff --git a/compiler.h b/compiler.h index 58865d6..55d7d74 100644 --- a/compiler.h +++ b/compiler.h @@ -50,8 +50,15 @@ # define __printf__ __gnu_printf__ # endif # endif -# define QEMU_WEAK_ALIAS(newname, oldname) \ +# if defined(__APPLE__) +# define QEMU_WEAK_ALIAS(newname, oldname) \ +static typeof(oldname) weak_##newname __attribute__((unused, weakref(#oldname))) +# define QEMU_WEAK_REF(newname, oldname) (weak_##newname ? weak_##newname : oldname) +# else +# define QEMU_WEAK_ALIAS(newname, oldname) \ typeof(oldname) newname __attribute__((weak, alias (#oldname))) +# define QEMU_WEAK_REF(newname, oldname) newname +# endif #else #define GCC_ATTR /**/ #define GCC_FMT_ATTR(n, m) diff --git a/osdep.c b/osdep.c index a87d4a4..2f7a491 100644 --- a/osdep.c +++ b/osdep.c @@ -54,6 +54,38 @@ static bool fips_enabled = false; static const char *qemu_version = QEMU_VERSION; +static int default_fdset_get_fd(int64_t fdset_id, int flags) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_get_fd, default_fdset_get_fd); +#define monitor_fdset_get_fd \ +QEMU_WEAK_REF(monitor_fdset_get_fd, default_fdset_get_fd) + +static int default_fdset_dup_fd_add(int64_t fdset_id, int dup_fd) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_add, default_fdset_dup_fd_add); +#define monitor_fdset_dup_fd_add \ +QEMU_WEAK_REF(monitor_fdset_dup_fd_add, default_fdset_dup_fd_add) + +static int default_fdset_dup_fd_remove(int dup_fd) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_remove); +#define monitor_fdset_dup_fd_remove \ +QEMU_WEAK_REF(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_remove) + +static int default_fdset_dup_fd_find(int dup_fd) +{ +return -1; +} +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_find, default_fdset_dup_fd_find); +#define monitor_fdset_dup_fd_find \ +QEMU_WEAK_REF(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_find) + int socket_set_cork(int fd, int v) { #if defined(SOL_TCP) && defined(TCP_CORK) @@ -400,27 +432,3 @@ bool fips_get_state(void) return fips_enabled; } - -static int default_fdset_get_fd(int64_t fdset_id, int flags) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_get_fd, default_fdset_get_fd); - -static int default_fdset_dup_fd_add(int64_t fdset_id, int dup_fd) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_add, default_fdset_dup_fd_add); - -static int default_fdset_dup_fd_remove(int dup_fd) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_remove); - -static int default_fdset_dup_fd_find(int dup_fd) -{ -return -1; -} -QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_find, default_fdset_dup_fd_find); diff --git a/oslib-win32.c b/oslib-win32.c index 9ca83df..326a2bd 100644 --- a/oslib-win32.c +++ b/oslib-win32.c @@ -32,6 +32,13 @@ #include "trace.h" #include "qemu_socket.h" +static void default_qemu_fd_register(int fd) +{ +} +QEMU_WEAK_ALIAS(qemu_fd_register, default_qemu_fd_register); +#define qemu_fd_register \ +QEMU_WEAK_REF(qemu_fd_register, default_qemu_fd_register) + void *qemu_oom_check(void *ptr) { if (ptr == NULL) { @@ -150,8 +157,3 @@ int qemu_get_thread_id(void) { return GetCurrentThreadId(); } - -static void default_qemu_fd_register(int fd) -{ -} -QEMU_WEAK_ALIAS(qemu_fd_register, default_qemu_fd_register); diff --git a/qemu-sockets.c b/qemu-sockets.c index f2a6371..abcd791 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -61,6 +61,28 @@ static QemuOptsList dummy_opts = { }, }; +static int default_monitor_get_fd(Monitor *mon, const char *name, Error **errp) +{ +error_setg(errp, "only QEMU supports file descriptor passing"); +return -1; +} +QEMU_WEAK_ALIAS(monitor_get_fd, default_monitor_get_fd); +#define monitor_get_fd \ +QEMU_WEAK_REF(monitor_get_fd, default_monitor_get_fd) + +static int default_qemu_set_fd_handler2(int fd, +IOCanReadHandler *fd_read_poll, +IOHandler *fd_read, +IOHandler *fd_write, +void *opaque) + +{ +abort(); +} +QEMU_WEAK_ALIAS(qemu_set_fd_handler2, default_qemu_set_fd_handler2); +#define qemu_set_fd_handler2 \ +QEMU_WEAK_REF(qemu_set_fd_handler2, default_qemu_set_fd_handler2) + static int inet_getport(struct addrinfo *e) { struct sock
[Qemu-devel] [PATCH v2 2/5] semaphore: implement fallback counting semaphores with mutex+condvar
OpenBSD and Darwin do not have sem_timedwait. Implement a fallback for them. Signed-off-by: Paolo Bonzini --- v1->v2: extract compute_abs_deadline and use it qemu-thread-posix.c | 92 +++-- qemu-thread-posix.h | 6 2 file modificati, 88 inserzioni(+), 10 rimozioni(-) diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c index 6a3d3a1..4ef9c7b 100644 --- a/qemu-thread-posix.c +++ b/qemu-thread-posix.c @@ -122,36 +122,106 @@ void qemu_sem_init(QemuSemaphore *sem, int init) { int rc; +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +rc = pthread_mutex_init(&sem->lock, NULL); +if (rc != 0) { +error_exit(rc, __func__); +} +rc = pthread_cond_init(&sem->cond, NULL); +if (rc != 0) { +error_exit(rc, __func__); +} +if (init < 0) { +error_exit(EINVAL, __func__); +} +sem->count = init; +#else rc = sem_init(&sem->sem, 0, init); if (rc < 0) { error_exit(errno, __func__); } +#endif } void qemu_sem_destroy(QemuSemaphore *sem) { int rc; +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +rc = pthread_cond_destroy(&sem->cond); +if (rc < 0) { +error_exit(rc, __func__); +} +rc = pthread_mutex_destroy(&sem->lock); +if (rc < 0) { +error_exit(rc, __func__); +} +#else rc = sem_destroy(&sem->sem); if (rc < 0) { error_exit(errno, __func__); } +#endif } void qemu_sem_post(QemuSemaphore *sem) { int rc; +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +pthread_mutex_lock(&sem->lock); +if (sem->count == INT_MAX) { +rc = EINVAL; +} else if (sem->count++ < 0) { +rc = pthread_cond_signal(&sem->cond); +} else { +rc = 0; +} +pthread_mutex_unlock(&sem->lock); +if (rc != 0) { +error_exit(rc, __func__); +} +#else rc = sem_post(&sem->sem); if (rc < 0) { error_exit(errno, __func__); } +#endif +} + +static void compute_abs_deadline(struct timespec *ts, int ms) +{ +struct timeval tv; +gettimeofday(&tv, NULL); +ts->tv_nsec = tv.tv_usec * 1000 + (ms % 1000) * 100; +ts->tv_sec = tv.tv_sec + ms / 1000; +if (ts->tv_nsec >= 10) { +ts->tv_sec++; +ts->tv_nsec -= 10; +} } int qemu_sem_timedwait(QemuSemaphore *sem, int ms) { int rc; - +struct timespec ts; + +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +compute_abs_deadline(&ts, ms); +pthread_mutex_lock(&sem->lock); +--sem->count; +while (sem->count < 0) { +rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts); +if (rc == ETIMEDOUT) { +break; +} +if (rc != 0) { +error_exit(rc, __func__); +} +} +pthread_mutex_unlock(&sem->lock); +return (rc == ETIMEDOUT ? -1 : 0); +#else if (ms <= 0) { /* This is cheaper than sem_timedwait. */ do { @@ -161,15 +231,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) return -1; } } else { -struct timeval tv; -struct timespec ts; -gettimeofday(&tv, NULL); -ts.tv_nsec = tv.tv_usec * 1000 + (ms % 1000) * 100; -ts.tv_sec = tv.tv_sec + ms / 1000; -if (ts.tv_nsec >= 10) { -ts.tv_sec++; -ts.tv_nsec -= 10; -} +compute_abs_deadline(&ts, ms); do { rc = sem_timedwait(&sem->sem, &ts); } while (rc == -1 && errno == EINTR); @@ -181,10 +243,19 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) error_exit(errno, __func__); } return 0; +#endif } void qemu_sem_wait(QemuSemaphore *sem) { +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +pthread_mutex_lock(&sem->lock); +--sem->count; +while (sem->count < 0) { +pthread_cond_wait(&sem->cond, &sem->lock); +} +pthread_mutex_unlock(&sem->lock); +#else int rc; do { @@ -193,6 +264,7 @@ void qemu_sem_wait(QemuSemaphore *sem) if (rc < 0) { error_exit(errno, __func__); } +#endif } void qemu_thread_create(QemuThread *thread, diff --git a/qemu-thread-posix.h b/qemu-thread-posix.h index 2542c15..380bae2 100644 --- a/qemu-thread-posix.h +++ b/qemu-thread-posix.h @@ -12,7 +12,13 @@ struct QemuCond { }; struct QemuSemaphore { +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +pthread_mutex_t lock; +pthread_cond_t cond; +int count; +#else sem_t sem; +#endif }; struct QemuThread { -- 1.7.12.1
[Qemu-devel] [PATCH v2 3/5] qemu-timer: reinitialize timers after fork
Timers are not inherited by the child of a fork(2), so just use pthread_atfork to reinstate them after daemonize. Signed-off-by: Paolo Bonzini --- qemu-timer.c | 14 ++ 1 file modificato, 14 inserzioni(+) diff --git a/qemu-timer.c b/qemu-timer.c index f3426c9..7b2217a 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -742,6 +742,17 @@ static void quit_timers(void) t->stop(t); } +static void reinit_timers(void) +{ +struct qemu_alarm_timer *t = alarm_timer; +t->stop(t); +if (t->start(t)) { +fprintf(stderr, "Internal timer error: aborting\n"); +exit(1); +} +qemu_rearm_alarm_timer(t); +} + int init_timer_alarm(void) { struct qemu_alarm_timer *t = NULL; @@ -765,6 +776,9 @@ int init_timer_alarm(void) } atexit(quit_timers); +#ifdef CONFIG_POSIX +pthread_atfork(NULL, NULL, reinit_timers); +#endif alarm_timer = t; return 0; -- 1.7.12.1
Re: [Qemu-devel] [PATCH 05/22] console: untangle gfx & txt updates
On 2 November 2012 08:20, Jan Kiszka wrote: > On 2012-11-01 14:04, Gerd Hoffmann wrote: >> Stop abusing displaysurface fields for text mode displays. >> (bpp = 0, width = cols, height = lines). >> >> Add flags to displaystate indicating whenever text mode display >> (curses) or gfx mode displays (sdl, vnc, ...) are present. >> >> Add separate displaychangelistener callbacks for text / gfx mode >> resize & updates. >> >> This allows to enable gfx and txt diplays at the same time and also >> paves the way for more cleanups in the future. > > Breaks building xenfb.c. Also breaks building the Cocoa frontend on MacOS: OBJC ui/cocoa.o ui/cocoa.m:771:10: warning: 'beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:' is deprecated [-Wdeprecated-declarations] [op beginSheetForDirectory:nil file:nil types:[NSArray ... ^ ui/cocoa.m:810:32: warning: 'filename' is deprecated [-Wdeprecated-declarations] char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding]; ^ ui/cocoa.m:1020:10: error: no member named 'dpy_update' in 'struct DisplayChangeListener' dcl->dpy_update = cocoa_update; ~~~ ^ ui/cocoa.m:1021:10: error: no member named 'dpy_resize' in 'struct DisplayChangeListener' dcl->dpy_resize = cocoa_resize; ~~~ ^ 2 warnings and 2 errors generated. make: *** [ui/cocoa.o] Error 1 'git grep dpy_update' suggests that xenfb and cocoa are the only two breakages though. -- PMM
Re: [Qemu-devel] [PATCH] virtio: limit avail bytes lookahead
On Fri, Nov 02, 2012 at 11:18:18AM +0100, Stefan Hajnoczi wrote: > On Thu, Nov 1, 2012 at 5:07 PM, Michael S. Tsirkin wrote: > > Commit 0d8d7690850eb0cf2b2b60933cf47669a6b6f18f introduced > > a regression in virtio-net performance because it looks > > into the ring aggressively while we really only care > > about a single packet worth of buffers. > > To fix, add parameters limiting lookahead, and > > use in virtqueue_avail_bytes. > > > > Signed-off-by: Michael S. Tsirkin > > Reported-by: Edivaldo de Araujo Pereira > > Nice, much simpler than the ideas I had. > > Reviewed-by: Stefan Hajnoczi Anthony could you apply this out of band please so this stops biting people? Thanks, MST
Re: [Qemu-devel] [PATCHv2 1/4] Adding new syscalls (bugzilla 855162)
On Friday, November 02, 2012 10:43:41 AM Corey Bryant wrote: > On 11/02/2012 10:38 AM, Paul Moore wrote: > > On Friday, November 02, 2012 10:10:02 AM Paul Moore wrote: > >> On Friday, November 02, 2012 09:48:55 AM Corey Bryant wrote: > >>> On 11/01/2012 05:43 PM, Paul Moore wrote: > On Tuesday, October 23, 2012 03:55:29 AM Eduardo Otubo wrote: > > According to the bug 855162[0] - there's the need of adding new > > syscalls > > to the whitelist whenn using Qemu with Libvirt. > > > > [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 > > > > v2: Adding new syscalls to the list: readlink, rt_sigpending, and > > > > rt_sigtimedwait > > > > Reported-by: Paul Moore > > Signed-off-by: Eduardo Otubo > > --- > > > >qemu-seccomp.c | 13 - > >1 file changed, 12 insertions(+), 1 deletion(-) > > I had an opportunity to test this patchset on a F17 machine using QEMU > 1.2 > and unfortunately it still fails. I'm using a relatively basic guest > configuration running F16, the details are documented in the RH BZ that > Eduardo mentioned in the patch description. > >>> > >>> Paul, Here's the latest diff for the whitelist. We're looking to get > >>> the patches out in the next few days after a bit more testing. > >> > >> Okay, thanks for the updated list ... I'm rebuilding QEMU right now and > >> I'll report back with the results later today. > > > > Sadly, no luck, it still fails. > > Hmm, let me send you the current patch set off-line, which includes > debug support to write the failing syscall out. If you don't mind could > you try it out? Sure, no problem. On a related note, I think it would be a *really* good idea to also submit the debug code upstream, just in a disabled state by default. You could either bracket it with #ifdefs or get fancy and allow it at runtime with '-sandbox debug' or something similar. -- paul moore security and virtualization @ redhat
Re: [Qemu-devel] [PATCH v2 1/3] aio: switch aiocb_size type int -> size_t
Il 31/10/2012 16:34, Stefan Hajnoczi ha scritto: > Using appropriate types for variables is a good thing :). All users > simply do sizeof(MyType) and the value is passed to a memory allocator, > it should be size_t. > > Signed-off-by: Stefan Hajnoczi > --- > qemu-aio.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/qemu-aio.h b/qemu-aio.h > index 1b7eb6e..111b0b3 100644 > --- a/qemu-aio.h > +++ b/qemu-aio.h > @@ -23,7 +23,7 @@ typedef void BlockDriverCompletionFunc(void *opaque, int > ret); > > typedef struct AIOPool { > void (*cancel)(BlockDriverAIOCB *acb); > -int aiocb_size; > +size_t aiocb_size; > BlockDriverAIOCB *free_aiocb; > } AIOPool; > > Reviewed-by: Paolo Bonzini
Re: [Qemu-devel] [PATCH v2 2/3] aio: use g_slice_alloc() for AIOCB pooling
Il 31/10/2012 16:34, Stefan Hajnoczi ha scritto: > AIO control blocks are frequently acquired and released because each aio > request involves at least one AIOCB. Therefore, we pool them to avoid > heap allocation overhead. > > The problem with the freelist approach in AIOPool is thread-safety. If > we want BlockDriverStates to associate with AioContexts that execute in > multiple threads, then a global freelist becomes a problem. > > This patch drops the freelist and instead uses g_slice_alloc() which is > tuned for per-thread fixed-size object pools. qemu_aio_get() and > qemu_aio_release() are now thread-safe. > > Note that the change from g_malloc0() to g_slice_alloc() should be safe > since the freelist reuse case doesn't zero the AIOCB either. > > Signed-off-by: Stefan Hajnoczi > --- > block.c| 15 --- > qemu-aio.h | 2 -- > 2 files changed, 4 insertions(+), 13 deletions(-) > > diff --git a/block.c b/block.c > index da1fdca..ea0f7d8 100644 > --- a/block.c > +++ b/block.c > @@ -3909,13 +3909,8 @@ void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs, > { > BlockDriverAIOCB *acb; > > -if (pool->free_aiocb) { > -acb = pool->free_aiocb; > -pool->free_aiocb = acb->next; > -} else { > -acb = g_malloc0(pool->aiocb_size); > -acb->pool = pool; > -} > +acb = g_slice_alloc(pool->aiocb_size); > +acb->pool = pool; > acb->bs = bs; > acb->cb = cb; > acb->opaque = opaque; > @@ -3924,10 +3919,8 @@ void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs, > > void qemu_aio_release(void *p) > { > -BlockDriverAIOCB *acb = (BlockDriverAIOCB *)p; > -AIOPool *pool = acb->pool; > -acb->next = pool->free_aiocb; > -pool->free_aiocb = acb; > +BlockDriverAIOCB *acb = p; > +g_slice_free1(acb->pool->aiocb_size, acb); > } > > /**/ > diff --git a/qemu-aio.h b/qemu-aio.h > index 111b0b3..b29c509 100644 > --- a/qemu-aio.h > +++ b/qemu-aio.h > @@ -24,7 +24,6 @@ typedef void BlockDriverCompletionFunc(void *opaque, int > ret); > typedef struct AIOPool { > void (*cancel)(BlockDriverAIOCB *acb); > size_t aiocb_size; > -BlockDriverAIOCB *free_aiocb; > } AIOPool; > > struct BlockDriverAIOCB { > @@ -32,7 +31,6 @@ struct BlockDriverAIOCB { > BlockDriverState *bs; > BlockDriverCompletionFunc *cb; > void *opaque; > -BlockDriverAIOCB *next; > }; > > void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs, > Reviewed-by: Paolo Bonzini
Re: [Qemu-devel] [PATCHv2 1/4] Adding new syscalls (bugzilla 855162)
On 11/02/2012 10:46 AM, Paul Moore wrote: On Friday, November 02, 2012 10:43:41 AM Corey Bryant wrote: On 11/02/2012 10:38 AM, Paul Moore wrote: On Friday, November 02, 2012 10:10:02 AM Paul Moore wrote: On Friday, November 02, 2012 09:48:55 AM Corey Bryant wrote: On 11/01/2012 05:43 PM, Paul Moore wrote: On Tuesday, October 23, 2012 03:55:29 AM Eduardo Otubo wrote: According to the bug 855162[0] - there's the need of adding new syscalls to the whitelist whenn using Qemu with Libvirt. [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 v2: Adding new syscalls to the list: readlink, rt_sigpending, and rt_sigtimedwait Reported-by: Paul Moore Signed-off-by: Eduardo Otubo --- qemu-seccomp.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) I had an opportunity to test this patchset on a F17 machine using QEMU 1.2 and unfortunately it still fails. I'm using a relatively basic guest configuration running F16, the details are documented in the RH BZ that Eduardo mentioned in the patch description. Paul, Here's the latest diff for the whitelist. We're looking to get the patches out in the next few days after a bit more testing. Okay, thanks for the updated list ... I'm rebuilding QEMU right now and I'll report back with the results later today. Sadly, no luck, it still fails. Hmm, let me send you the current patch set off-line, which includes debug support to write the failing syscall out. If you don't mind could you try it out? Sure, no problem. On a related note, I think it would be a *really* good idea to also submit the debug code upstream, just in a disabled state by default. You could either bracket it with #ifdefs or get fancy and allow it at runtime with '-sandbox debug' or something similar. I agree. That's the plan with the v3 patch series. We'll get them out in the next few days. -- Regards, Corey Bryant
Re: [Qemu-devel] [PATCH v2 3/3] aio: rename AIOPool to AIOCBInfo
Il 31/10/2012 16:34, Stefan Hajnoczi ha scritto: > Now that AIOPool no longer keeps a freelist, it isn't really a "pool" > anymore. Rename it to AIOCBInfo and make it const since it no longer > needs to be modified. > > Signed-off-by: Stefan Hajnoczi > --- > block.c | 22 +++--- > block/blkdebug.c | 4 ++-- > block/blkverify.c | 4 ++-- > block/curl.c | 4 ++-- > block/gluster.c | 6 +++--- > block/iscsi.c | 12 ++-- > block/linux-aio.c | 4 ++-- > block/qed.c | 4 ++-- > block/rbd.c | 4 ++-- > block/sheepdog.c | 4 ++-- > block/win32-aio.c | 4 ++-- > dma-helpers.c | 4 ++-- > hw/ide/core.c | 4 ++-- > qemu-aio.h| 8 > thread-pool.c | 4 ++-- > 15 files changed, 46 insertions(+), 46 deletions(-) > > diff --git a/block.c b/block.c > index ea0f7d8..854ebd6 100644 > --- a/block.c > +++ b/block.c > @@ -3521,7 +3521,7 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, > BlockRequest *reqs, int num_reqs) > > void bdrv_aio_cancel(BlockDriverAIOCB *acb) > { > -acb->pool->cancel(acb); > +acb->aiocb_info->cancel(acb); > } > > /* block I/O throttling */ > @@ -3711,7 +3711,7 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB > *blockacb) > qemu_aio_release(acb); > } > > -static AIOPool bdrv_em_aio_pool = { > +static const AIOCBInfo bdrv_em_aiocb_info = { > .aiocb_size = sizeof(BlockDriverAIOCBSync), > .cancel = bdrv_aio_cancel_em, > }; > @@ -3740,7 +3740,7 @@ static BlockDriverAIOCB > *bdrv_aio_rw_vector(BlockDriverState *bs, > { > BlockDriverAIOCBSync *acb; > > -acb = qemu_aio_get(&bdrv_em_aio_pool, bs, cb, opaque); > +acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); > acb->is_write = is_write; > acb->qiov = qiov; > acb->bounce = qemu_blockalign(bs, qiov->size); > @@ -3785,7 +3785,7 @@ static void bdrv_aio_co_cancel_em(BlockDriverAIOCB > *blockacb) > qemu_aio_flush(); > } > > -static AIOPool bdrv_em_co_aio_pool = { > +static const AIOCBInfo bdrv_em_co_aiocb_info = { > .aiocb_size = sizeof(BlockDriverAIOCBCoroutine), > .cancel = bdrv_aio_co_cancel_em, > }; > @@ -3828,7 +3828,7 @@ static BlockDriverAIOCB > *bdrv_co_aio_rw_vector(BlockDriverState *bs, > Coroutine *co; > BlockDriverAIOCBCoroutine *acb; > > -acb = qemu_aio_get(&bdrv_em_co_aio_pool, bs, cb, opaque); > +acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); > acb->req.sector = sector_num; > acb->req.nb_sectors = nb_sectors; > acb->req.qiov = qiov; > @@ -3858,7 +3858,7 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, > Coroutine *co; > BlockDriverAIOCBCoroutine *acb; > > -acb = qemu_aio_get(&bdrv_em_co_aio_pool, bs, cb, opaque); > +acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); > co = qemu_coroutine_create(bdrv_aio_flush_co_entry); > qemu_coroutine_enter(co, acb); > > @@ -3884,7 +3884,7 @@ BlockDriverAIOCB *bdrv_aio_discard(BlockDriverState *bs, > > trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque); > > -acb = qemu_aio_get(&bdrv_em_co_aio_pool, bs, cb, opaque); > +acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); > acb->req.sector = sector_num; > acb->req.nb_sectors = nb_sectors; > co = qemu_coroutine_create(bdrv_aio_discard_co_entry); > @@ -3904,13 +3904,13 @@ void bdrv_init_with_whitelist(void) > bdrv_init(); > } > > -void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs, > +void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs, > BlockDriverCompletionFunc *cb, void *opaque) > { > BlockDriverAIOCB *acb; > > -acb = g_slice_alloc(pool->aiocb_size); > -acb->pool = pool; > +acb = g_slice_alloc(aiocb_info->aiocb_size); > +acb->aiocb_info = aiocb_info; > acb->bs = bs; > acb->cb = cb; > acb->opaque = opaque; > @@ -3920,7 +3920,7 @@ void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs, > void qemu_aio_release(void *p) > { > BlockDriverAIOCB *acb = p; > -g_slice_free1(acb->pool->aiocb_size, acb); > +g_slice_free1(acb->aiocb_info->aiocb_size, acb); > } > > /**/ > diff --git a/block/blkdebug.c b/block/blkdebug.c > index 1206d52..d61ece8 100644 > --- a/block/blkdebug.c > +++ b/block/blkdebug.c > @@ -41,7 +41,7 @@ typedef struct BlkdebugAIOCB { > > static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb); > > -static AIOPool blkdebug_aio_pool = { > +static const AIOCBInfo blkdebug_aiocb_info = { > .aiocb_size = sizeof(BlkdebugAIOCB), > .cancel = blkdebug_aio_cancel, > }; > @@ -335,7 +335,7 @@ static BlockDriverAIOCB *inject_error(BlockDriverState > *bs, > return NULL; > } > > -acb = qemu_aio_get(&blkdebug_aio_pool, bs, cb, opaque); > +acb = qemu_aio_get(&blkdebug_aiocb_info, bs,
Re: [Qemu-devel] [PATCH 3/3] apic: always update the in-kernel status after loading
Il 30/10/2012 19:21, Jan Kiszka ha scritto: > > > Aren't we still dependent on the order of processing? If the APIC is > > > restored after the device, won't we get the same problem? > > > > Strictly speaking yes, but CPUs and APICs are always the first devices > > to be saved. > Hmm, thinking about this again: Why is the MSI event injected at all > during restore, specifically while the device models are in transitional > state. Can you explain this? Because the (virtio-serial) port was connected on the source and disconnected on the destination, or vice versa. In my simplified reproducer, I'm really using different command-lines on the source and destination, but it is not necessary. For example, if you have a socket backend, the destination will usually be disconnected at the time the machine loads. One alternative fix is a vm_clock timer that expires immediately. It would fix both MSI and INTx, on the other hand I thought it was an APIC bug because the QEMU APIC works nicely. > Does the same pattern then also apply on INTx injection? Yes. Paolo
[Qemu-devel] [PATCH] ui/cocoa.m: Update to new DisplayChangeListener member names
Commit a93a4a2 changed the names of some fields in DisplayChangeListener and broke compilation of the cocoa UI. Update to the new names. Signed-off-by: Peter Maydell --- ui/cocoa.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 2383646..87d2e44 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1017,8 +1017,8 @@ void cocoa_display_init(DisplayState *ds, int full_screen) dcl = g_malloc0(sizeof(DisplayChangeListener)); // register vga output callbacks -dcl->dpy_update = cocoa_update; -dcl->dpy_resize = cocoa_resize; +dcl->dpy_gfx_update = cocoa_update; +dcl->dpy_gfx_resize = cocoa_resize; dcl->dpy_refresh = cocoa_refresh; register_displaychangelistener(ds, dcl); -- 1.7.11.4
[Qemu-devel] [PATCH v2 5/5] vl: delay thread initialization after daemonization
Commit ac4119c (chardev: Use timer instead of bottom-half to postpone open event, 2012-10-12) moved the alarm timer initialization to an earlier point but failed to consider that it depends on qemu_init_main_loop. Later, commit 1c53786 (vl: init main loop earlier, 2012-10-30) fixed this, but left -daemonize in two different ways. First, timers need to be reinitialized after forking. Second, the global mutex was being held by the parent, and thus dropped after forking. The first is now fixed using pthread_atfork. For the second part, make sure that the global mutex is not taken before daemonization, and similarly delay qemu_thread_self. Signed-off-by: Paolo Bonzini --- main-loop.c | 1 - vl.c| 4 +++- 2 file modificati, 3 inserzioni(+), 2 rimozioni(-) diff --git a/main-loop.c b/main-loop.c index 234a313..c87624e 100644 --- a/main-loop.c +++ b/main-loop.c @@ -128,7 +128,6 @@ int qemu_init_main_loop(void) exit(1); } -qemu_mutex_lock_iothread(); ret = qemu_signal_init(); if (ret) { return ret; diff --git a/vl.c b/vl.c index e2d5276..0f5b07b 100644 --- a/vl.c +++ b/vl.c @@ -3477,7 +3477,6 @@ int main(int argc, char **argv, char **envp) } loc_set_none(); -qemu_init_cpu_loop(); if (qemu_init_main_loop()) { fprintf(stderr, "qemu_init_main_loop failed\n"); exit(1); @@ -3677,6 +3676,9 @@ int main(int argc, char **argv, char **envp) os_set_line_buffering(); +qemu_init_cpu_loop(); +qemu_mutex_lock_iothread(); + #ifdef CONFIG_SPICE /* spice needs the timers to be initialized by this point */ qemu_spice_init(); -- 1.7.12.1
Re: [Qemu-devel] [PATCH] ui/cocoa.m: Update to new DisplayChangeListener member names
On 11/02/12 15:54, Peter Maydell wrote: > Commit a93a4a2 changed the names of some fields in DisplayChangeListener > and broke compilation of the cocoa UI. Update to the new names. > > Signed-off-by: Peter Maydell Acked-by: Gerd Hoffmann cheers, Gerd
Re: [Qemu-devel] [PATCH 3/3] apic: always update the in-kernel status after loading
On 2012-11-02 15:53, Paolo Bonzini wrote: > Il 30/10/2012 19:21, Jan Kiszka ha scritto: Aren't we still dependent on the order of processing? If the APIC is restored after the device, won't we get the same problem? >>> >>> Strictly speaking yes, but CPUs and APICs are always the first devices >>> to be saved. >> Hmm, thinking about this again: Why is the MSI event injected at all >> during restore, specifically while the device models are in transitional >> state. Can you explain this? > > Because the (virtio-serial) port was connected on the source and > disconnected on the destination, or vice versa. > > In my simplified reproducer, I'm really using different command-lines on > the source and destination, but it is not necessary. For example, if > you have a socket backend, the destination will usually be disconnected > at the time the machine loads. > > One alternative fix is a vm_clock timer that expires immediately. It > would fix both MSI and INTx, on the other hand I thought it was an APIC > bug because the QEMU APIC works nicely. I think deferring IRQ events to the point when the complete vmstate is loaded is the cleaner and more robust approach. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCHv2 1/4] Adding new syscalls (bugzilla 855162)
On 11/02/2012 10:38 AM, Paul Moore wrote: On Friday, November 02, 2012 10:10:02 AM Paul Moore wrote: On Friday, November 02, 2012 09:48:55 AM Corey Bryant wrote: On 11/01/2012 05:43 PM, Paul Moore wrote: On Tuesday, October 23, 2012 03:55:29 AM Eduardo Otubo wrote: According to the bug 855162[0] - there's the need of adding new syscalls to the whitelist whenn using Qemu with Libvirt. [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 v2: Adding new syscalls to the list: readlink, rt_sigpending, and rt_sigtimedwait Reported-by: Paul Moore Signed-off-by: Eduardo Otubo --- qemu-seccomp.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) I had an opportunity to test this patchset on a F17 machine using QEMU 1.2 and unfortunately it still fails. I'm using a relatively basic guest configuration running F16, the details are documented in the RH BZ that Eduardo mentioned in the patch description. Paul, Here's the latest diff for the whitelist. We're looking to get the patches out in the next few days after a bit more testing. Okay, thanks for the updated list ... I'm rebuilding QEMU right now and I'll report back with the results later today. Sadly, no luck, it still fails. Hmm, let me send you the current patch set off-line, which includes debug support to write the failing syscall out. If you don't mind could you try it out? -- Regards, Corey Bryant
Re: [Qemu-devel] [PATCH v2 35/39] raw: merge posix-aio-compat.c into block/raw-posix.c
On 31 October 2012 16:30, Paolo Bonzini wrote: > Making the qemu_paiocb specific to raw devices will let us access members > of the BDRVRawState arbitrarily. > > Signed-off-by: Paolo Bonzini clang now warns about an unused function: CCblock/raw-posix.o block/raw-posix.c:707:26: warning: unused function 'paio_ioctl' [-Wunused-function] static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, ^ 1 warning generated. because the only use of paio_ioctl() is inside a #if defined(__linux__) guard and it's 'static' now. -- PMM
Re: [Qemu-devel] live migration which includes previos snapshot
Hello Eric, From: Eric Blake Subject: Re: [Qemu-devel] live migration which includes previos snapshot Date: Fri, 02 Nov 2012 07:12:21 -0600 > On 11/02/2012 04:30 AM, Stefan Hajnoczi wrote: > > > II. If you want to use internal snapshots in a single qcow2 file, you > > will need to modify QEMU code more: > > 1. Implement BlockDriverState snapshot slave support so a qcow2 > > snapshot can be read-only accessed as a BlockDriverState while the > > master BlockDriverState for the image still writes into the image > > file. This is mainly qcow2 refactoring and block.c glue code. > > You are not the first to request this - libvirt would also like the > ability to have read-only access into the contents of an internal > snapshot while the rest of qemu continues to write into the image. Do you mean that libvirt can change the access mode of internal harddisk from read-write to read-only? Please tell me how to change the mode by libvirt. Does the qemu which has read-only access only, use another COW file? Nested COWs sound interested, but the inter COW must be read-only, I think. > > 2. Use Paolo's runtime NBD server to export the snapshot slave when > > the VM is forked: > > An NBD server on top of the read-only state is an additional step that > will make access easier. Does an NBD work as COW? It looks convenient. Thank you. -- suzaki
Re: [Qemu-devel] [PATCH] ui/cocoa.m: Update to new DisplayChangeListener member names
Am 02.11.2012 15:54, schrieb Peter Maydell: > Commit a93a4a2 changed the names of some fields in DisplayChangeListener > and broke compilation of the cocoa UI. Update to the new names. > > Signed-off-by: Peter Maydell Reviewed-by: Andreas Färber Peter, you didn't cc me - through whose queue is this supposed to go? I don't have any other Cocoa patches queued for v1.3. Thanks, Andreas
Re: [Qemu-devel] [PATCH 3/3] apic: always update the in-kernel status after loading
Hi, > I think deferring IRQ events to the point when the complete vmstate is > loaded is the cleaner and more robust approach. Agree. Just schedule a bh in post_load. See also a229c0535bd336efaec786dd6e352a54e0a8187d cheers, Gerd
Re: [Qemu-devel] [PATCH v2 0/5] Fixes for thread pool patches.
On 2 November 2012 15:43, Paolo Bonzini wrote: > Three fixes: 1) Darwin does not support weak aliases, use weak > references instead. 2) Darwin, NetBSD and OpenBSD do not have > sem_timedwait, implement counting semaphores with a mutex and > cv there. 3) Daemonize was broken, fixes are in patches 3-5. v2 patches 1 & 2 compile cleanly on macos and the resulting qemu seems to work (smoke tested only). thanks -- PMM
[Qemu-devel] [PATCH v2 4/5] vl: unify calls to init_timer_alarm
init_timer_alarm was being called twice. This is not needed. Signed-off-by: Paolo Bonzini --- main-loop.c | 5 - vl.c| 5 - 2 file modificati, 4 inserzioni(+), 6 rimozioni(-) diff --git a/main-loop.c b/main-loop.c index e43c7c8..234a313 100644 --- a/main-loop.c +++ b/main-loop.c @@ -123,7 +123,10 @@ int qemu_init_main_loop(void) GSource *src; init_clocks(); -init_timer_alarm(); +if (init_timer_alarm() < 0) { +fprintf(stderr, "could not initialize alarm timer\n"); +exit(1); +} qemu_mutex_lock_iothread(); ret = qemu_signal_init(); diff --git a/vl.c b/vl.c index 99681da..e2d5276 100644 --- a/vl.c +++ b/vl.c @@ -3616,11 +3616,6 @@ int main(int argc, char **argv, char **envp) add_device_config(DEV_VIRTCON, "vc:80Cx24C"); } -if (init_timer_alarm() < 0) { -fprintf(stderr, "could not initialize alarm timer\n"); -exit(1); -} - socket_init(); if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0) -- 1.7.12.1
Re: [Qemu-devel] [PATCH 3/3] apic: always update the in-kernel status after loading
> Hi, > > > I think deferring IRQ events to the point when the complete vmstate > > is > > loaded is the cleaner and more robust approach. > > Agree. Just schedule a bh in post_load. > See also a229c0535bd336efaec786dd6e352a54e0a8187d No, it cannot a bh. Right now incoming migration is blocking, but this will change in 1.3. There is no guarantee that a bottom half will run after migration has completed. Paolo
[Qemu-devel] [PATCH] raw-posix: inline paio_ioctl into hdev_aio_ioctl
clang now warns about an unused function: CCblock/raw-posix.o block/raw-posix.c:707:26: warning: unused function paio_ioctl [-Wunused-function] static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, ^ 1 warning generated. because the only use of paio_ioctl() is inside a #if defined(__linux__) guard and it is static now. Reported-by: Peter Maydell Signed-off-by: Paolo Bonzini --- block/raw-posix.c | 27 ++- 1 file modificato, 10 inserzioni(+), 17 rimozioni(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index f2f0404..488e5f5 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -704,22 +704,6 @@ static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd, return thread_pool_submit_aio(aio_worker, acb, cb, opaque); } -static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, -unsigned long int req, void *buf, -BlockDriverCompletionFunc *cb, void *opaque) -{ -RawPosixAIOData *acb = g_slice_new(RawPosixAIOData); - -acb->bs = bs; -acb->aio_type = QEMU_AIO_IOCTL; -acb->aio_fildes = fd; -acb->aio_offset = 0; -acb->aio_ioctl_buf = buf; -acb->aio_ioctl_cmd = req; - -return thread_pool_submit_aio(aio_worker, acb, cb, opaque); -} - static BlockDriverAIOCB *raw_aio_submit(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, int type) @@ -1342,10 +1326,19 @@ static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs, BlockDriverCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; +RawPosixAIOData *acb; if (fd_open(bs) < 0) return NULL; -return paio_ioctl(bs, s->fd, req, buf, cb, opaque); + +acb = g_slice_new(RawPosixAIOData); +acb->bs = bs; +acb->aio_type = QEMU_AIO_IOCTL; +acb->aio_fildes = s->fd; +acb->aio_offset = 0; +acb->aio_ioctl_buf = buf; +acb->aio_ioctl_cmd = req; +return thread_pool_submit_aio(aio_worker, acb, cb, opaque); } #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -- 1.7.12.1
Re: [Qemu-devel] [PATCH 3/3] apic: always update the in-kernel status after loading
On 11/02/12 16:13, Paolo Bonzini wrote: >> Hi, >> >>> I think deferring IRQ events to the point when the complete vmstate >>> is >>> loaded is the cleaner and more robust approach. >> >> Agree. Just schedule a bh in post_load. >> See also a229c0535bd336efaec786dd6e352a54e0a8187d > > No, it cannot a bh. Right now incoming migration is blocking, > but this will change in 1.3. There is no guarantee that a > bottom half will run after migration has completed. Then we'll need some new way to do this, maybe a new post_load handler which is called once _all_ state is loaded. cheers, Gerd
Re: [Qemu-devel] live migration which includes previos snapshot
Hello Stefan, From: Stefan Hajnoczi Subject: Re: [Qemu-devel] live migration which includes previos snapshot Date: Fri, 2 Nov 2012 11:30:25 +0100 > If you are forking the VM so that there will be two VMs running > simultaneously, then a single qcow2 file cannot be used. > > Here are two approaches that will work but require you to modify QEMU code: > > I. Perhaps you can make it work with external snapshots: > > 1. Make the original image read-only accessible over NFS. > 2. Modify QEMU to create two external snapshot files when the VM is > paused for migration (during your fork operation): > > /host-a/original.qcow2 > /host-a/new.qcow2 (backing file: /host-a/original.qcow2) > /host-b/new.qcow2 (backing file: /host-b/original.qcow2) > > 3. After fork the two VMs will write into their respective new.qcow2 > files. original.qcow2 is never modified anymore. Does it means nested qcow2? Does it allow to use a snapshot image in original.qcow2? # I want to share a snapshot image taken by "savevm" on two QEMUs. -- suzaki