Re: [Qemu-devel] [PATCH 2/5] target-i386: replace uint32_t vendor fields by vendor string in x86_def_t
Am 17.01.2013 16:16, schrieb Igor Mammedov: Vendor property setter takes string as vendor value but cpudefs use uint32_t vendor[123] fields to define vendor value. It makes it difficult to unify and use property setter for values from cpudefs. Simplify code by using vendor property setter, vendor[123] fields are converted into vendor[13] array to keep its value. And vendor property setter is used to access/set value on CPU. - Make for() cycle reusable for the next patch by adding x86_cpu_vendor_words2str() Intel's CPUID spec[1] says: 5.1.1 ... These registers contain the ASCII string: GenuineIntel ... List[2] of known vendor values shows that they all are 12 ASCII characters long, padded where necessary with space Current supported values are all ASCII characters packed in ebx, edx, ecx. So lets state that qemu supports 12 ASCII characters packed in ebx, edx, ecx registers for cpuid(0) instruction. *1 - http://www.intel.com/Assets/PDF/appnote/241618.pdf *2 - http://en.wikipedia.org/wiki/CPUID#EAX.3D0:_Get_vendor_ID Signed-off-by: Igor Mammedov imamm...@redhat.com So, hearing that my suggestion of a union to give us the best of both worlds did not work out well due to endianness conversions, I would still like to drop the vendor[0] assertion. And I spot no documentation for char vendor[...] in this patch, only in the commit message; we could spare that if we change char vendor[...] array to char *vendor, what do you think? Erroring out (or padding) could be done when setting it via vendor property onto X86CPU (maybe I'll try to cook up something for demonstration). Regards, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
[Qemu-devel] [PATCH v2] hw/tpci200: Fix compiler warning (redefined symbol with MinGW)
STATUS_TIMEOUT is defined in winnt.h: CChw/tpci200.o hw/tpci200.c:34:0: warning: STATUS_TIMEOUT redefined [enabled by default] /usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/include/winnt.h:1036:0: note: this is the location of the previous definition Use STATUS_TIME instead of STATUS_TIMEOUT as suggested by Alberto Garcia. Signed-off-by: Stefan Weil s...@weilnetz.de --- v1: Add QEMU_PREFIX (http://patchwork.ozlabs.org/patch/212348/) v2: Use STATUS_TIME Like v1, this patch fixes a warning for MinGW. We could also mix v1 and v2. Please commit one of those variants to git master. Regards, Stefan W. hw/tpci200.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/tpci200.c b/hw/tpci200.c index e082bca..a4823fb 100644 --- a/hw/tpci200.c +++ b/hw/tpci200.c @@ -31,7 +31,7 @@ #define IP_INT_SPACE_ADDR_MASK 0x3F #define STATUS_INT(IP, INTNO) BIT((IP) * 2 + (INTNO)) -#define STATUS_TIMEOUT(IP)BIT((IP) + 12) +#define STATUS_TIME(IP) BIT((IP) + 12) #define STATUS_ERR_ANY0xF00 #define CTRL_CLKRATE BIT(0) @@ -279,9 +279,9 @@ static void tpci200_write_las0(void *opaque, hwaddr addr, uint64_t val, } } -if (val STATUS_TIMEOUT(i)) { +if (val STATUS_TIME(i)) { DPRINTF(Clear IP %c timeout\n, 'A' + i); -s-status = ~STATUS_TIMEOUT(i); +s-status = ~STATUS_TIME(i); } } -- 1.7.10.4
[Qemu-devel] [PULL for-1.4 0/1] seabios: update to 1.7.2 release
Hi, Seabios 1.7.2 has just been released, let's update from our git snapshot to the final release. please pull, Gerd Gerd Hoffmann (1): seabios: update to 1.7.2 release pc-bios/acpi-dsdt.aml | Bin 4521 - 4521 bytes pc-bios/bios.bin | Bin 131072 - 262144 bytes pc-bios/q35-acpi-dsdt.aml | Bin 7458 - 7458 bytes roms/seabios |2 +- 4 files changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.7 The following changes since commit 8b17ed4caa7e015324a4ecbe3c863e32458d840a: Merge remote-tracking branch 'stefanha/block' into staging (2013-01-20 11:01:10 -0600) are available in the git repository at: git://git.kraxel.org/qemu seabios-1.7.2 for you to fetch changes up to 3588185b8396eb97fd9efd41c2b97775465f67c4: seabios: update to 1.7.2 release (2013-01-21 09:17:16 +0100) Gerd Hoffmann (1): seabios: update to 1.7.2 release pc-bios/acpi-dsdt.aml | Bin 4521 - 4521 bytes pc-bios/bios.bin | Bin 131072 - 262144 bytes pc-bios/q35-acpi-dsdt.aml | Bin 7458 - 7458 bytes roms/seabios |2 +- 4 files changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH 1/1] seabios: update to 1.7.2 release
Not that many changes as we have a pretty recent git snapshot in master already: Hannes Reinecke (1): megasas: Invert PCI device selection Kevin O'Connor (2): Minor: Separate UUID display from F12 boot prompt. boot: Support halt in the boot order to prevent default boot attempts. Laszlo Ersek (1): display_uuid(): fix incomplete check after the loop Paolo Bonzini (1): vgabios: implement AX=1120H..1124H functions --- pc-bios/acpi-dsdt.aml | Bin 4521 - 4521 bytes pc-bios/bios.bin | Bin 131072 - 262144 bytes pc-bios/q35-acpi-dsdt.aml | Bin 7458 - 7458 bytes roms/seabios |2 +- 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/acpi-dsdt.aml b/pc-bios/acpi-dsdt.aml index 00224eabb7b92de601edc5cc41b444c4ca8cb9da..75dfd1e310a330c6473e363a3d2d9f31d93bfaa7 100644 GIT binary patch delta 44 wcmZ3fyi!@CDior62XBfCXfHMPwQv^r^$Y)?+@bnAu(O?zWsN5z90OrC8g8%k delta 44 wcmZ3fyi!@CDior62XqqtKfHMPwQv^r^$Y)?+@bnAuQD)@asN5z90O*sg8%k diff --git a/pc-bios/bios.bin b/pc-bios/bios.bin index 3910875311ceaed814f902e9e4e7e29cdf340fc6..924bee30d54a711a9d849ec4c67d38bef9ca03f4 100644 GIT binary patch delta 21116 zcmdtKiCh}_XmEThhb3%W`qGjP(epU1p^gD1O-9GB|{P1*OZravNOI1R5wFCrZ86 z*zzevocGP1SC@s1lMw@K9regE)R|i?LPV_jv{{rtYaf8fXKb_Lxx#ymH?z!il zd+zd(o$ZmGtuF~aDfII!i8v{A`~U6l4$rn8MG@i=F{^MHW7^jk%Ln}UI%9_cmjTe z7^?vs2l!+_E8RF8v!MNYk;eHjJ@0W3K=X0)7Vk2{;F6p3j8a0Xxl%#s-kT*cTh zzzM+ew;B7ZfU*C+!?IY{cNrT5u-h4vvrKU{yt-0TN#_Vp0S?*_dZ~3VTFH1AGm5 z{4rz2|6wfm6UN@#0Kou%0fuj6YKx~XNMj#8}(Sj3s=|*y1gC|C+H2-=Gdaz_*O8 z0DEDMafgf5+I~9f0o{8?uwJX@Jdu*jd3m4R?KW4HG*7FrHL0c!zw08=X%s{*Xt z2Vnr40b2pZfZc!tfS+$fQx`DfSZ81m5l8JEUaQo%-Rpsv$L?T@7Px4l%X@@FyVR zFkdbb-=76Ul}b6!ga!YYAutXajihI8+Vz^aNwS0EV1oY#yKvFyeQ{Mgw%G81n@T z01N`O`;)PbfUE(3G4G9`wXCtv9SQnS;oQvlg=^rAt3rZ7y;G;wgJikzW@}#LxBDQ zV@5zUU6qzyt`oh(-XC%j|f1(Mv4QKBtY^=$UYAi25DS}2!#PN0TN?U_QVE zSPEG2sOUrYkz@3WsLd3VAleUtzhie*P)q}j4c7QK$ivpMgn#LJhG9_0WZMYfZc$j zfJQ+3HyCq!6F9(|Fw_P8yVUI90jnVrfHYruXOtOD3ZM*HJCjGYBs11wz4SOwq~ zpu-x*mI0~7XZ!HGS(OH8el!33J}db1?KnfJ=aO@4KhD*^WbZ@~C0=C2WYXR{e zF!l*R{D`q}fSnvtNw$b2e|PGTCjn!)quYNXa#}z-7R$lodrg4zM0o6-NDqar~6 zEsSLYD!)Mgf5}+nSB%8~UI1(bEZ@r52Y_P03BV12FGf%KySd@Ec|4sNKd`=CF| z+cA0o7Xc3d`a;Hn0SSPY0lmLtYz(`4ydsRt^Xc=q!MV(fiD6-Jr=4-gKplj5I z*^i9v036xF*gtzgTh5pjUYI!!|+*A1*xjhNbHkoX?J03hZt91TXw34rNmIHTjx z6ks`^9`Fe8)d|La0F12nF_cJ82T4uUT4tfbRzJOb6HjFP?=D0o(?JVK79VL;r7W zBd}cu1?Djot(*?S0E|TDIKZ6%fjt2DwH8=3AQ3PWFd6VNU?E@$;AD)zH!!$9soT0 z3CtTX2kW7E5P@Fy?_INA75D78@)uL#)8s0*rvJaRQ43d=A(P*dJH)m$p;0b_YCl zuvoj@E?17rJC)gHHru6V@MTADXsG49sJULRhpMTGof;}Ual}7vX_7@^}2_*GHq zDCA6=*-f$t(Oi1geD|KDOJ(=ark%3RW|)l~XkG*|HV_vG9+LDL0it4YDWr1u$ zUU_EARQU#RSJ}=6a^l1(PQIm7R~j*_OiztGXfYHV`={vBR-X!kHzTKDydbxsgw0@X z6f%7*o?kw}QX=nQW_ycga=MP0|M6MUN~NYZS#$KuG~GPw-x0EJTG=;_r1_^mR;kj zaimyf9Nx97;0Rb^2(7{)EGEgXh9?k1D1I7i(^G;ZBDvo8G*2bth}{TU`+LoIKa4 z(G?p`cO+~qu(7M6-Ez2b^4bORQ`nO{0xrP@II1?h@oPj?}dVV7Zp;R7YG!Uw* z6XjM)@7;N9AfDk9igi2zEWuifUYLt}#0dwVf?l2KD@IgV3f)U1Gxy~}i7^FO z!smxhY9+!SQ*n`pzIr6kmP1hv1wDKSusU_ht3pREqEr=oifvxiNf7w`$Q8!#jnA z2H(Er#iU};DYXsge`Ar4_!%lvYcep%YP`ZUgoccrHDb7d3jjx6qWW6(MEta=cqq4 zE-Ph?T1;d+9$wKEmz%4!eQQl^QXhBh^!g0bQ0v(UPHdkGgY!v=9TMwaCnHje?O$F zuJc#J16%Y%I)8-GL;2)7Ul$%1n@)KXu47hr%ZETz+FMtgWYnZc%PDIBvc^q#Qo|}_ z?09@l{zGn5epa|=_dGHAHec7hllyuiUU03bqIOrrhLmL|1z3jOgfoma;};b$Xy zhq=TeZMeeN#3``gw6W=_|`g@bAxIG9K6%vxI*Pv$Vvm_vDF@N8DEuKFG$q_iV+( zd-NrqQjcu+F9@A@nP2Y_?I6)y21!5Po0p-E8jP5i@@p^7j67x2D`zhAl|4h-O{)iQ zgK=QaeSK#*-m|kiNPjkWA+oLSL*rxo_Nd{87(g+V5`yeU8v)6rS44)J!6Q40q;w z@?*W8gZXeF%B1zDUR9~SyTo%(sfRRoK~fbxWq3;EmTW3Q%g?o9pX0$1F9g`%kGZo zfiFg=5oEocQZdcC(!q9W}t-0gh{)dY-eBO2YOG_kGb7c59~#+`qu1`;=e-FZ@Z z?+g54pYDPW?-qSSn8e%k-6l*bI@I@hfy_LhpH6s+_HiBW6+6#8I1WwAuj5-|!=s*q zN0f5!KH)a34wD{CV3O=F-aj*YVxjTy8bu1!PHU@!bGL?AqYTwQ9Rk$hZS_ekoi ziaJp_Q){xT8|f~zVqyGX`Pd0K4t~ER{8sPySKsV^3ZZm*=+`xiv|~U{W8dnc0a zode5ibnUhi!Gk=C45ps=MdGqP5y=auSmrG{~1RxMQ!`A=1oys@QyULP(!+5Yg5 zBQBdQ4wSN?NL|T+QPO;BY04?JP4#PlElBsc3a{%aStzIXsiKDoIf6kVJ0Mvw{`K+* zqe0pDd(oQ2Uj=boW05o{TXg@D$P6%*N1#Bu%gY$enM+iu1-fFSB(WOqvEXF?09m~ zrJnqkp|RS{4hMD?_^QXuugIdq%1D%`F~kfn)u-0-Abxz{KNS@`i?!cBkx1! zoNGoz3mb~!M*JqYlX5Jc8s2(jq$BOC;iE^sbH(YYki29j|_nkoEsVD?(vU9IleDk z6wg%iM=wOX*Ada(BRn?cIsMy?Y4mys^kb?o-#rE{S%}zIgrZlGcVqRwh2?NiXL zga3C1OdVy^o_7}6ewdp_4R+V|N0Awa`LR*Ge5m+dnzC%of7nfF=%@^nC65x^~$kh z7M(b{taaj^8l~r(LEin9%^p+=ny*Dfjm1)#9;#_?xN2y^}DM2r^qpZK=i=4)VWK zJNZ{R#c6ZUVaYvfG{*JbJYZ$jjl*4g7^MErkty`k44Il1Uj*0n43)Ks*wxfDg* z{y^arX%Z#p9Dv*Ko$1Msj)_4rkF?GrULw=lyXR1LZ4IB0);{YP%3~z4GQBHeobrt8 zyS5;AM@w?px;+7K*xDLbBBDQAvxJ;~wjw{XK$P^jbOUm7f{*~=Z{dJjN*aP^~he; zJjTQ1E`5!p%@FrF9=hEBVj3D4Z#yql;#JuQ;dI3ZB0HRjEVsFfYA6xk_rStCxhGJt zmJ0qUT_;LI4R4$Nw?`pFkbS@Rjuyu#t0%lfh7$*bKOyGjuG%5mNOzXzE;iiqt| zK__)g(hdNRSF3o{xY^XPaZM8br$uj^65RheOJUO%#RTuL+}Hfgc!h=rTR?Vi*s= zEdg#Lr7-xKTl9G+Od9!^?e3{Xno!(Q|AH;gZ|_{O4TkI3hLS7Y$mD5+Q{ih4b*1 zRoY#(V3AXQUgyQKU^%U6qBFdt*rQwyhC2O@w#{!S0Z?-uE7UP^S~^WDABmn4rw zN$GiHQ=!g?g3AbbD8j^wQgSUMSAd%f3mf(cnE7KlEhga!nj%FT9qXDiJ^FH7cLE
Re: [Qemu-devel] [PATCH 1/5] target-i386: print deprecated warning if xlevel 0x80000000
Am 17.01.2013 16:16, schrieb Igor Mammedov: Signed-off-by: Igor Mammedov imamm...@redhat.com Reviewed-by: Eduardo Habkost ehabk...@redhat.com --- target-i386/cpu.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 333745b..ce914da 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1399,6 +1399,8 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features) goto error; } if (numvalue 0x8000) { +fprintf(stderr, xlevel value shall always be = 0x8000 +, fixup will be deprecated in future versions\n); numvalue += 0x8000; } x86_cpu_def-xlevel = numvalue; This has been reviewed without objections so far, so I would apply it for 1.4. Either way you should document this intent for users already: http://wiki.qemu.org/ChangeLog/1.4 We had such discussions before, around removing cpudef support. When do you plan to remove this, and being deprecated, shouldn't it rather read fixup will be removed in future versions? ;) If it fits within 80 chars I can edit it myself. Cheers, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 0/5] vhost-scsi: Add support for host virtualized target
On Thu, Jan 17, 2013 at 01:07:21PM -0800, Nicholas A. Bellinger wrote: Hi MST Co, On Thu, 2013-01-17 at 18:43 +0200, Michael S. Tsirkin wrote: On Fri, Sep 07, 2012 at 06:48:14AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org Hello Anthony Co, This is the fourth installment to add host virtualized target support for the mainline tcm_vhost fabric driver using Linux v3.6-rc into QEMU 1.3.0-rc. The series is available directly from the following git branch: git://git.kernel.org/pub/scm/virt/kvm/nab/qemu-kvm.git vhost-scsi-for-1.3 Note the code is cut against yesterday's QEMU head, and dispite the name of the tree is based upon mainline qemu.org git code + has thus far been running overnight with 100K IOPs small block 4k workloads using v3.6-rc2+ based target code with RAMDISK_DR backstores. Other than some minor fuzz between jumping from QEMU 1.2.0 - 1.2.50, this series is functionally identical to what's been posted for vhost-scsi RFC-v3 to qemu-devel. Please consider applying these patches for an initial vhost-scsi merge into QEMU 1.3.0-rc code, or let us know what else you'd like to see addressed for this series to in order to merge. Thank you! --nab OK what's the status here? We missed 1.3 but let's try not to miss 1.4? Unfortunately, I've not been able to get back to the conversion requested by Paolo for a standalone vhost-scsi PCI device. It doesn't have to be a standalone device. A vhost=on frontend option is also OK I think. Paolo, any objections? At this point my hands are still full with iSER-target for-3.9 kernel code over the next weeks. What's the v1.4 feature cut-off looking like at this point..? --nab Not sure but soon.
Re: [Qemu-devel] [PATCH v2 3/3] sheepdog: add support for connecting to unix domain socket
Il 21/01/2013 01:23, MORITA Kazutaka ha scritto: This patch adds support for a unix domain socket for a connection between qemu and local sheepdog server. You can use the unix domain socket with the following syntax like NBD driver: $ qemu sheepdog:unix:socket path:image name Note that socket path must be an absolute path. Please look at how NBD supports URIs. Something like sheepdog[+tcp|+unix]://[host:port]/vdiname[/snapid|/tag][?socket=path] or sheepdog[+tcp|+unix]://[host:port]/vdiname[?socket=path][#snapid|#tag] would be similar to what we use for NBD and Gluster. Paolo Signed-off-by: MORITA Kazutaka morita.kazut...@lab.ntt.co.jp --- block/sheepdog.c | 37 + qemu-options.hx | 19 +-- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index c287827..34685fd 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -296,7 +296,9 @@ typedef struct BDRVSheepdogState { bool is_snapshot; uint32_t cache_flags; -/* It's a string of the form hostname:port */ +/* If it begins with 'unix:/', this is a UNIX domain socket. Otherwise, + * it's a string of the form hostname:port + */ char *host_spec; int fd; @@ -449,13 +451,25 @@ static SheepdogAIOCB *sd_aio_setup(BlockDriverState *bs, QEMUIOVector *qiov, static int connect_to_sdog(const char *host_spec) { int fd; +const char *path; Error *err = NULL; if (host_spec == NULL) { host_spec = SD_DEFAULT_ADDR_AND_PORT; } -fd = inet_connect(host_spec, err); +if (strstart(host_spec, unix:, path) path[0] == '/') { +fd = unix_connect(path, err); +} else { +fd = inet_connect(host_spec, err); + +if (err == NULL) { +int ret = socket_set_nodelay(fd); +if (ret 0) { +error_report(%s, strerror(errno)); +} +} +} if (err != NULL) { qerror_report_err(err); @@ -761,7 +775,7 @@ static int aio_flush_request(void *opaque) */ static int get_sheep_fd(BDRVSheepdogState *s) { -int ret, fd; +int fd; fd = connect_to_sdog(s-host_spec); if (fd 0) { @@ -770,13 +784,6 @@ static int get_sheep_fd(BDRVSheepdogState *s) socket_set_nonblock(fd); -ret = socket_set_nodelay(fd); -if (ret) { -error_report(%s, strerror(errno)); -closesocket(fd); -return -errno; -} - qemu_aio_set_fd_handler(fd, co_read_response, NULL, aio_flush_request, s); return fd; } @@ -785,12 +792,10 @@ static int get_sheep_fd(BDRVSheepdogState *s) * Parse a filename * * filename must be one of the following formats: - * 1. [vdiname] - * 2. [vdiname]:[snapid] - * 3. [vdiname]:[tag] - * 4. [hostname]:[port]:[vdiname] - * 5. [hostname]:[port]:[vdiname]:[snapid] - * 6. [hostname]:[port]:[vdiname]:[tag] + * - using TCP + * [hostname:port:]vdiname[:snapid or tag] + * - using Unix Domain Socket + * unix:domain-socket:vdiname[:snapid or tag] * * You can boot from the snapshot images by specifying `snapid` or * `tag'. diff --git a/qemu-options.hx b/qemu-options.hx index 40cd683..0583b4a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2061,17 +2061,16 @@ devices. Syntax for specifying a sheepdog device @table @list -``sheepdog:vdiname'' - -``sheepdog:vdiname:snapid'' - -``sheepdog:vdiname:tag'' - -``sheepdog:host:port:vdiname'' - -``sheepdog:host:port:vdiname:snapid'' +using TCP: +@example +sheepdog:[hostname:port:]vdiname[:snapid or tag] +@end example -``sheepdog:host:port:vdiname:tag'' +using Unix Domain Socket: +@example +sheepdog:unix:domain-socket:vdiname[:snapid or tag] +@end example +Note that domain-socket must be an absolute path. @end table Example
Re: [Qemu-devel] [PATCH] Annotate questionable fallthroughs
Am 20.01.2013 16:54, schrieb Blue Swirl: Recent Clang compilers have preliminary support for finding unannotated fallthrough cases in switch statements with compiler flag -Wimplicit-fallthrough. The support is incomplete, it's only possible to annotate the case in C++ but not in C, so it wouldn't be useful to enable the flag for QEMU yet. Mark cases which don't have a comment about fall through with a comment. In legitimate fall through cases the comment can be edited later to mark the case for future readers. Signed-off-by: Blue Swirl blauwir...@gmail.com diff --git a/hw/ide/core.c b/hw/ide/core.c index 14ad079..0457c65 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1151,6 +1151,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_VERIFY_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_VERIFY: case WIN_VERIFY_ONCE: /* do sector number check ? */ @@ -1160,6 +1161,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_READ_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_READ: case WIN_READ_ONCE: if (s-drive_kind == IDE_CD) { @@ -1175,6 +1177,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_WRITE_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_WRITE: case WIN_WRITE_ONCE: case CFA_WRITE_SECT_WO_ERASE: @@ -1191,6 +1194,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_MULTREAD_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_MULTREAD: if (!s-bs) { goto abort_cmd; @@ -1204,6 +1208,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_MULTWRITE_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_MULTWRITE: case CFA_WRITE_MULTI_WO_ERASE: if (!s-bs) { @@ -1224,6 +1229,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_READDMA_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_READDMA: case WIN_READDMA_ONCE: if (!s-bs) { @@ -1234,6 +1240,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_WRITEDMA_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_WRITEDMA: case WIN_WRITEDMA_ONCE: if (!s-bs) { @@ -1245,6 +1252,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) break; case WIN_READ_NATIVE_MAX_EXT: lba48 = 1; +/* XXX: questionable fallthrough */ case WIN_READ_NATIVE_MAX: ide_cmd_lba48_transform(s, lba48); ide_set_sector(s, s-nb_sectors - 1); All IDE cases are clearly intentional. Kevin
Re: [Qemu-devel] [PATCH qom-cpu for-1.4] target-openrisc: Drop OpenRISCCPUList
Am 16.01.2013 04:57, schrieb Andreas Färber: It was missed in the previous cleanup because its naming did not match the *CPUListState pattern. Use the generalized CPUListState instead. Signed-off-by: Andreas Färber afaer...@suse.de No objections yet, so applied to qom-cpu (mentioning commit hash): https://github.com/afaerber/qemu-cpu/commits/qom-cpu Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [QEMU]Install QEMU question
Hi, Am 21.01.2013 09:51, schrieb harryxiyou: When i install QEMU in my Ubuntu 10.04, i happened to a question, which i am not sure if it is ok for me to continue to install QEMU. See http://code.google.com/p/cloudxy/issues/detail?id=24 for details. Could anyone give me some suggestions? Thanks ;-) There's a patch queued on qemu-trivial: http://patchwork.ozlabs.org/patch/213610/ Would be nice to get this applied soon, it looks annoying but is not to worry about. Regards, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH for-1.4 03/12] pc: Reverse pc_init_pci() compatibility logic
On Thu, Jan 17, 2013 at 06:59:29PM -0200, Eduardo Habkost wrote: Currently, the pc-1.4 machine init function enables PV EOI and then calls the pc-1.2 machine init function. The problem with this approach is that now we can't enable any additional compatibility code inside the pc-1.2 init function because it would end up enabling the compatibility behavior on pc-1.3 and pc-1.4 as well. This reverses the logic so that the pc-1.2 machine init function will disable PV EOI, and then call the pc-1.4 machine init function. This way we can change older machine-types to enable compatibility behavior, and the newer machine-types (pc-1.3, pc-q35-1.4 and pc-i440fx-1.4) would just use the default behavior. (This means that one nice side-effect of this change is that pc-q35-1.4 will get PV EOI enabled by default, too) It would be interesting to eventually change pc_init_pci_no_kvmclock() and pc_init_isa() to reuse pc_init_pci_1_2() as well (so we don't need to duplicate compatibility code on those two functions). But this will be probably much easier to do after we create a PCInitArgs struct for the PC initialization arguments, and/or after we use global-properties to implement the compatibility modes present in pc_init_pci_1_2(). Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- Cc: k...@vger.kernel.org Cc: Michael S. Tsirkin m...@redhat.com Cc: Gleb Natapov g...@redhat.com Cc: Marcelo Tosatti mtosa...@redhat.com Signed-off-by: Eduardo Habkost ehabk...@redhat.com I wasn't actually Cc'd :). I don't see anything wrong with this patch. Acked-by: Michael S. Tsirkin m...@redhat.com --- hw/pc_piix.c | 22 +- target-i386/cpu.c | 5 +++-- target-i386/cpu.h | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 0a6923d..f9cfe78 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -233,12 +233,14 @@ static void pc_init_pci(QEMUMachineInitArgs *args) initrd_filename, cpu_model, 1, 1); } -static void pc_init_pci_1_3(QEMUMachineInitArgs *args) +/* PC machine init function for pc-0.14 to pc-1.2 */ +static void pc_init_pci_1_2(QEMUMachineInitArgs *args) { -enable_kvm_pv_eoi(); +disable_kvm_pv_eoi(); pc_init_pci(args); } +/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args) { ram_addr_t ram_size = args-ram_size; @@ -247,6 +249,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args) const char *kernel_cmdline = args-kernel_cmdline; const char *initrd_filename = args-initrd_filename; const char *boot_device = args-boot_device; +disable_kvm_pv_eoi(); pc_init1(get_system_memory(), get_system_io(), ram_size, boot_device, @@ -264,6 +267,7 @@ static void pc_init_isa(QEMUMachineInitArgs *args) const char *boot_device = args-boot_device; if (cpu_model == NULL) cpu_model = 486; +disable_kvm_pv_eoi(); pc_init1(get_system_memory(), get_system_io(), ram_size, boot_device, @@ -286,7 +290,7 @@ static QEMUMachine pc_i440fx_machine_v1_4 = { .name = pc-i440fx-1.4, .alias = pc, .desc = Standard PC (i440FX + PIIX, 1996), -.init = pc_init_pci_1_3, +.init = pc_init_pci, .max_cpus = 255, .is_default = 1, DEFAULT_MACHINE_OPTIONS, @@ -302,7 +306,7 @@ static QEMUMachine pc_i440fx_machine_v1_4 = { static QEMUMachine pc_machine_v1_3 = { .name = pc-1.3, .desc = Standard PC, -.init = pc_init_pci_1_3, +.init = pc_init_pci, .max_cpus = 255, .compat_props = (GlobalProperty[]) { PC_COMPAT_1_3, @@ -342,7 +346,7 @@ static QEMUMachine pc_machine_v1_3 = { static QEMUMachine pc_machine_v1_2 = { .name = pc-1.2, .desc = Standard PC, -.init = pc_init_pci, +.init = pc_init_pci_1_2, .max_cpus = 255, .compat_props = (GlobalProperty[]) { PC_COMPAT_1_2, @@ -386,7 +390,7 @@ static QEMUMachine pc_machine_v1_2 = { static QEMUMachine pc_machine_v1_1 = { .name = pc-1.1, .desc = Standard PC, -.init = pc_init_pci, +.init = pc_init_pci_1_2, .max_cpus = 255, .compat_props = (GlobalProperty[]) { PC_COMPAT_1_1, @@ -422,7 +426,7 @@ static QEMUMachine pc_machine_v1_1 = { static QEMUMachine pc_machine_v1_0 = { .name = pc-1.0, .desc = Standard PC, -.init = pc_init_pci, +.init = pc_init_pci_1_2, .max_cpus = 255, .compat_props = (GlobalProperty[]) { PC_COMPAT_1_0, @@ -438,7 +442,7 @@ static QEMUMachine pc_machine_v1_0 = { static QEMUMachine pc_machine_v0_15 = { .name = pc-0.15, .desc = Standard PC, -.init = pc_init_pci, +.init = pc_init_pci_1_2, .max_cpus = 255, .compat_props = (GlobalProperty[]) { PC_COMPAT_0_15, @@ -471,7
[Qemu-devel] [PATCH 2/4] QAPI: Introduce memchar-write QMP command
Signed-off-by: Lei Li li...@linux.vnet.ibm.com --- hmp-commands.hx | 16 hmp.c| 13 + hmp.h|1 + qapi-schema.json | 41 + qemu-char.c | 48 qmp-commands.hx | 34 ++ 6 files changed, 153 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 0934b9b..e546c76 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -837,6 +837,22 @@ STEXI @item nmi @var{cpu} @findex nmi Inject an NMI on the given CPU (x86 only). + +ETEXI + +{ +.name = memchar_write, +.args_type = chardev:s,data:s, +.params = chardev data, +.mhandler.cmd = hmp_memchar_write, +}, + +STEXI +@item memchar_write @var{chardev} @var{data} +@findex memchar_write +Provide writing interface for CirMemCharDriver. Write @var{data} +to char device 'memory'. + ETEXI { diff --git a/hmp.c b/hmp.c index c7b6ba0..546d687 100644 --- a/hmp.c +++ b/hmp.c @@ -684,6 +684,19 @@ void hmp_pmemsave(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, errp); } +void hmp_memchar_write(Monitor *mon, const QDict *qdict) +{ +uint32_t size; +const char *chardev = qdict_get_str(qdict, chardev); +const char *data = qdict_get_str(qdict, data); +Error *errp = NULL; + +size = strlen(data); +qmp_memchar_write(chardev, size, data, false, 0, errp); + +hmp_handle_error(mon, errp); +} + static void hmp_cont_cb(void *opaque, int err) { if (!err) { diff --git a/hmp.h b/hmp.h index 44be683..06d6ea2 100644 --- a/hmp.h +++ b/hmp.h @@ -43,6 +43,7 @@ void hmp_system_powerdown(Monitor *mon, const QDict *qdict); void hmp_cpu(Monitor *mon, const QDict *qdict); void hmp_memsave(Monitor *mon, const QDict *qdict); void hmp_pmemsave(Monitor *mon, const QDict *qdict); +void hmp_memchar_write(Monitor *mon, const QDict *qdict); void hmp_cont(Monitor *mon, const QDict *qdict); void hmp_system_wakeup(Monitor *mon, const QDict *qdict); void hmp_inject_nmi(Monitor *mon, const QDict *qdict); diff --git a/qapi-schema.json b/qapi-schema.json index 6d7252b..c34e9ac 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -325,6 +325,47 @@ { 'command': 'query-chardev', 'returns': ['ChardevInfo'] } ## +# @DataFormat: +# +# An enumeration of data format. +# +# @utf8: The data format is 'utf8'. +# +# @base64: The data format is 'base64'. +# +# Since: 1.4 +## +{ 'enum': 'DataFormat' + 'data': [ 'utf8', 'base64' ] } + +## +# @memchar-write: +# +# Provide writing interface for memchardev. Write data to char +# device 'memory'. +# +# @chardev: the name of the memory char device. +# +# @size: the size to write in bytes. +# +# @data: the source data write to memchar. +# +# @format: #optional the format of the data write to chardev 'memory', +# by default is 'utf8'. +# +# Returns: Nothing on success +# If @chardev is not a valid char device, DeviceNotFound +# +# Notes: For now assume 'drop' behaver, which would result in writes +#dropping queued data. +# +# Since: 1.4 +## +{ 'command': 'memchar-write', + 'data': {'chardev': 'str', 'size': 'int', 'data': 'str', + '*format': 'DataFormat'} } + +## # @CommandInfo: # # Information about a QMP command diff --git a/qemu-char.c b/qemu-char.c index 950c543..a3a07e0 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2768,6 +2768,54 @@ fail: return NULL; } +static bool qemu_is_chr(const CharDriverState *chr, const char *filename) +{ +return strcmp(chr-filename, filename); +} + +void qmp_memchar_write(const char *chardev, int64_t size, + const char *data, bool has_format, + enum DataFormat format, + Error **errp) +{ +CharDriverState *chr; +guchar *write_data; +int ret; +gsize write_count; + +chr = qemu_chr_find(chardev); +if (!chr) { +error_set(errp, QERR_DEVICE_NOT_FOUND, chardev); +return; +} + +if (qemu_is_chr(chr, memory)) { +error_setg(errp,%s is not memory char device\n, chardev); +return; +} + +/* XXX: Drop the coming data when the buffer is full. */ +if (cirmem_chr_is_full(chr)) { +error_setg(errp, Memory device %s is full, chardev); +return; +} + +write_count = (gsize)size; + +if (has_format (format == DATA_FORMAT_BASE64)) { +write_data = g_base64_decode(data, write_count); +} else { +write_data = (uint8_t *)data; +} + +ret = cirmem_chr_write(chr, write_data, write_count); + +if (ret 0) { +error_setg(errp, Failed to write to device %s, chardev); +return; +} +} + QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) { char host[65], port[33], width[8], height[8]; diff --git a/qmp-commands.hx b/qmp-commands.hx index cbf1280..8ad06d0 100644 ---
[Qemu-devel] [PATCH 3/4] QAPI: Introduce memchar-read QMP command
Signed-off-by: Lei Li li...@linux.vnet.ibm.com --- hmp-commands.hx | 19 ++ hmp.c| 17 hmp.h|1 + qapi-schema.json | 25 +++ qemu-char.c | 57 ++ qmp-commands.hx | 34 6 files changed, 153 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index e546c76..52ead10 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -856,6 +856,25 @@ to char device 'memory'. ETEXI { +.name = memchar_read, +.args_type = chardev:s,size:i, +.params = chardev size, +.mhandler.cmd = hmp_memchar_read, +}, + +STEXI +@item memchar_read @var{chardev} +@findex memchar_read +Provide read interface for CirMemCharDriver. Read from char device +'memory' and return @var{size} of the data. + +@var{size} is the size of data want to read from. Refer to unencoded +size of the raw data, would adjust to the init size of the memchar +if the requested size is larger than it. + +ETEXI + +{ .name = migrate, .args_type = detach:-d,blk:-b,inc:-i,uri:s, .params = [-d] [-b] [-i] uri, diff --git a/hmp.c b/hmp.c index 546d687..7e86c24 100644 --- a/hmp.c +++ b/hmp.c @@ -697,6 +697,23 @@ void hmp_memchar_write(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, errp); } +void hmp_memchar_read(Monitor *mon, const QDict *qdict) +{ +uint32_t size = qdict_get_int(qdict, size); +const char *chardev = qdict_get_str(qdict, chardev); +char *data; +Error *errp = NULL; + +data = qmp_memchar_read(chardev, size, false, 0, errp); +if (errp) { +monitor_printf(mon, %s\n, error_get_pretty(errp)); +error_free(errp); +return; +} + +monitor_printf(mon, %s\n, data); +} + static void hmp_cont_cb(void *opaque, int err) { if (!err) { diff --git a/hmp.h b/hmp.h index 06d6ea2..076d8cf 100644 --- a/hmp.h +++ b/hmp.h @@ -44,6 +44,7 @@ void hmp_cpu(Monitor *mon, const QDict *qdict); void hmp_memsave(Monitor *mon, const QDict *qdict); void hmp_pmemsave(Monitor *mon, const QDict *qdict); void hmp_memchar_write(Monitor *mon, const QDict *qdict); +void hmp_memchar_read(Monitor *mon, const QDict *qdict); void hmp_cont(Monitor *mon, const QDict *qdict); void hmp_system_wakeup(Monitor *mon, const QDict *qdict); void hmp_inject_nmi(Monitor *mon, const QDict *qdict); diff --git a/qapi-schema.json b/qapi-schema.json index c34e9ac..56d4b39 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -366,6 +366,31 @@ '*format': 'DataFormat'} } ## +# @memchar-read: +# +# Provide read interface for memchardev. Read from the char +# device 'memory' and return the data. +# +# @chardev: the name of the memory char device. +# +# @size: the size to read in bytes. +# +# @format: #optional the format of the data want to read from +# memchardev, by default is 'utf8'. +# +# Returns: The data read from memchar as string +# If @chardev is not a valid memchr device, DeviceNotFound +# +# Notes: For now assume 'drop' behaver, which would result in reads +#returning empty strings. +# +# Since: 1.4 +## +{ 'command': 'memchar-read', + 'data': {'chardev': 'str', 'size': 'int', '*format': 'DataFormat'}, + 'returns': 'str' } + +## # @CommandInfo: # # Information about a QMP command diff --git a/qemu-char.c b/qemu-char.c index a3a07e0..6d379df 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2816,6 +2816,63 @@ void qmp_memchar_write(const char *chardev, int64_t size, } } +char *qmp_memchar_read(const char *chardev, int64_t size, + bool has_format, enum DataFormat format, + Error **errp) +{ +CharDriverState *chr; +guchar *read_data; +char *data = NULL; +int ret; +size_t count; + +chr = qemu_chr_find(chardev); +if (!chr) { +error_set(errp, QERR_DEVICE_NOT_FOUND, chardev); +return NULL; +} + +if (qemu_is_chr(chr, memory)) { +error_setg(errp,%s is not memory char device\n, chardev); +return NULL; +} + +if (size = 0) { +error_setg(errp, Failed to read from device %s, chardev); +return NULL; +} + +/* XXX: Return the empty strings when the buffer is empty. */ +if (cirmem_chr_is_empty(chr)) { +error_setg(errp, Memory device %s is empty, chardev); +return NULL; +} + +count = qemu_chr_cirmem_count(chr); +size = size count ? count : size; +read_data = g_malloc0(size + 1); + +ret = cirmem_chr_read(chr, read_data, size); +if (ret 0) { +error_setg(errp, Failed to read from device %s, chardev); +goto fail; +} + +if (has_format (format == DATA_FORMAT_BASE64)) { + if (read_data) { + data = g_base64_encode(read_data, (size_t)size); + } +} else { +data = (char
[Qemu-devel] [PATCH 4/4] HMP: Introduce console command
Signed-off-by: Lei Li li...@linux.vnet.ibm.com --- hmp-commands.hx | 21 ++ hmp.c | 52 + hmp.h |1 + include/monitor/monitor.h |3 ++ monitor.c | 15 + 5 files changed, 92 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 52ead10..7f7a54a 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -875,6 +875,27 @@ if the requested size is larger than it. ETEXI { +.name = console, +.args_type = chardev:s, +.params = chardev, +.mhandler.cmd = hmp_console, +}, + +STEXI +@item console @var{device} +@findex console +Connect to the serial console from within the monitor, allow to write data +to memchardev @var{chardev}. Exit from the console and return back to +monitor by 'ctrl-]' or enter. + +@example +(qemu) console foo +foo: data string... +@end example + +ETEXI + +{ .name = migrate, .args_type = detach:-d,blk:-b,inc:-i,uri:s, .params = [-d] [-b] [-i] uri, diff --git a/hmp.c b/hmp.c index 7e86c24..fab5090 100644 --- a/hmp.c +++ b/hmp.c @@ -1389,3 +1389,55 @@ void hmp_chardev_remove(Monitor *mon, const QDict *qdict) qmp_chardev_remove(qdict_get_str(qdict, id), local_err); hmp_handle_error(mon, local_err); } + +enum escape_char +{ +ESCAPE_CHAR_CTRL_GS = 0x1d /* ctrl-] used for escape */ +}; + +static void hmp_read_console(Monitor *mon, const char *data, + void *opaque) +{ +CharDriverState *chr = opaque; +uint32_t size = strlen(data); +enum escape_char console_escape = ESCAPE_CHAR_CTRL_GS; + +Error *err = NULL; + +if (*data == console_escape) { +monitor_resume(mon); +return; +} + +qmp_memchar_write(chr-label, size, data, 0, 0, err); + +if (err) { +monitor_printf(mon, %s\n, error_get_pretty(err)); +monitor_read_command(mon,1); +error_free(err); +return; +} + +monitor_read_command(mon, 1); +} + +void hmp_console(Monitor *mon, const QDict *qdict) +{ +const char *device = qdict_get_str(qdict, chardev); +CharDriverState *chr; +Error *err = NULL; + +chr = qemu_chr_find(device); + +if (!chr) { +error_set(err, QERR_DEVICE_NOT_FOUND, device); +goto out; +} + +if (monitor_read_console(mon, device, hmp_read_console, chr) 0) { +monitor_printf(mon, Connect to console %s failed\n, device); +} + +out: +hmp_handle_error(mon, err); +} diff --git a/hmp.h b/hmp.h index 076d8cf..a01268e 100644 --- a/hmp.h +++ b/hmp.h @@ -84,5 +84,6 @@ void hmp_nbd_server_add(Monitor *mon, const QDict *qdict); void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict); void hmp_chardev_add(Monitor *mon, const QDict *qdict); void hmp_chardev_remove(Monitor *mon, const QDict *qdict); +void hmp_console(Monitor *mon, const QDict *qdict); #endif diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 87fb49c..a14e965 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -86,6 +86,9 @@ ReadLineState *monitor_get_rs(Monitor *mon); int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, void *opaque); +int monitor_read_console(Monitor *mon, const char *device, + ReadLineFunc *readline_func, void *opaque); + int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret); int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret); diff --git a/monitor.c b/monitor.c index 20bd19b..6f6155d 100644 --- a/monitor.c +++ b/monitor.c @@ -260,6 +260,21 @@ int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, } } +int monitor_read_console(Monitor *mon, const char *device, + ReadLineFunc *readline_func, void *opaque) +{ +char prompt[60]; + +if (!mon-rs) { +return -1; +} + +snprintf(prompt, sizeof(prompt), %s: , device); +readline_start(mon-rs, prompt, 0, readline_func, opaque); + +return 0; +} + void monitor_flush(Monitor *mon) { if (mon mon-outbuf_index != 0 !mon-mux_out) { -- 1.7.7.6
[Qemu-devel] [RESEND PATCH for 1.4 v8 0/4] char: Add CirMemCharDriver and provide QMP interface
Hi Anthony, Since this patch series has already missed 1.3, I wonder if it can be merged into 1.4 release as it has been on mailing list for a long time, and I have rebased it again. Thanks. This patch series attempts to add new char backend CirMemCharDriver with a circular buffer and expose it to users by introducing QMP interface memchar-write and memchar-read and via the command line like the other CharDriverStates. Serial ports in qemu always use CharDriverStates as there backends, Right now, all of our backends always try to write the data from the guest to a socket or file. The concern from OpenStack is that this could lead to unbounded disk space usage since they log the serial output. For more detail of the background info: https://bugs.launchpad.net/nova/+bug/832507 So we want to use a circular buffer in QEMU instead, and then OpenStack can periodically read the buffer in QEMU and log it. The QMP commands introduced like: { 'command': 'memchar-write', 'data': {'chardev': 'str', 'size': 'int', 'data': 'str', 'format': 'str' } } { 'command': 'memchar-read', 'data': {'chardev': 'str', 'size': 'int', 'format': 'str' }, 'returns': 'str' } Expose CirMemCharDriver via the command line like: qemu -chardev memory,id=foo,maxcapacity=65536 -serial chardev:foo Introduce HMP command 'console' like: (qemu) console foo foo: Input data Note: Now all of the feature were implemented, and the pervious comments are fixed up too. Since this patch series have been for mailing list for some time and missed 1.3, rebase it with minor fix. Changes since v7: - Rebase the code and fix the format error pointed by Eric. - Modify the version info. Changes since v6: - Improve the document based on Luiz's comments. - Keep pointing to the right position in cbuf for the case producer and consumer might overflow for long running VMs pointed by Luiz. - Limit the size of read_data to the amount of bytes available in the circular buffer. - Other fixups from Luiz. Changes since v5: - Avoid writing the IAC information to the queue. - Grammar of the doc for command line options improved from Eric. Changes since v4: - Get rid of all CongestionControl bits, and assume a dropping behavior based on Luiz's suggestion for now. Will add it when we add async support to QMP. - Squashed the patches about CirMemCharDriver in one. - Other fixups from Luiz. Changes since v3: - Improve the algorithm of circular buffer based on Anthony's suggestion. - Some changes suggested by Luiz and Blue. - And other fixups. Changes since v2: - Add congestion mechanism. For the 'block' option as sync command, will support it later when we gain the necessary infrastructure enhancement. - Add HMP 'console' command so that can interact with multiple chardevs via a single monitor socket. - Make the circular buffer backend and the current MemCharDriver live in parallel, expose a new char backend with circular buffer CirMemCharDriver suggested by Luiz. - Other fixs from Eric and Markus. Changes since v1: - Exposing the MemCharDriver via command line. - Support base64 data format suggested by Anthony and Eric. - Follow the new rule for the name of qmp command from Eric. Lei Li (4): qemu-char: Add new char backend CirMemCharDriver QAPI: Introduce memchar-write QMP command QAPI: Introduce memchar-read QMP command HMP: Introduce console command hmp-commands.hx | 72 +++ hmp.c| 99 +++ hmp.h|3 + monitor.c| 15 monitor.h|3 + qapi-schema.json | 96 + qemu-char.c | 217 ++ qemu-config.c|3 + qemu-options.hx | 10 +++ qmp-commands.hx | 89 + 10 files changed, 607 insertions(+), 0 deletions(-)
[Qemu-devel] [PATCH 1/4] qemu-char: Add new char backend CirMemCharDriver
Signed-off-by: Lei Li li...@linux.vnet.ibm.com --- qemu-char.c | 134 +++ qemu-options.hx | 10 2 files changed, 144 insertions(+), 0 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 9ba0573..950c543 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -98,6 +98,7 @@ #include ui/qemu-spice.h #define READ_BUF_LEN 4096 +#define CBUFF_SIZE 65536 /***/ /* character device */ @@ -2643,6 +2644,130 @@ size_t qemu_chr_mem_osize(const CharDriverState *chr) return d-outbuf_size; } +/*/ +/*CircularMemory chardev*/ + +typedef struct { +size_t size; +size_t head; +size_t count; +uint8_t *cbuf; +} CirMemCharDriver; + +static bool cirmem_chr_is_empty(const CharDriverState *chr) +{ +const CirMemCharDriver *d = chr-opaque; + +return d-count == 0; +} + +static bool cirmem_chr_is_full(const CharDriverState *chr) +{ +const CirMemCharDriver *d = chr-opaque; + +return d-count == d-size; +} + +static size_t qemu_chr_cirmem_count(const CharDriverState *chr) +{ +const CirMemCharDriver *d = chr-opaque; + +return d-count; +} + +static int cirmem_chr_write(CharDriverState *chr, const uint8_t *buf, int len) +{ +CirMemCharDriver *d = chr-opaque; +int i; +int tail; + +if (!buf || (len 0)) { +return -1; +} + +for (i = 0; i len; i++ ) { +/* Avoid writing the IAC information to the queue. */ +if ((unsigned char)buf[i] == IAC) { +continue; +} + +tail = (d-head + d-count) % d-size; +d-cbuf[tail] = buf[i]; +if (d-count == d-size) { +d-head = (d-head + 1) % d-size; +} else { +++d-count; +} +} + +return 0; +} + +static int cirmem_chr_read(CharDriverState *chr, uint8_t *buf, int len) +{ +CirMemCharDriver *d = chr-opaque; +int i; + +if (cirmem_chr_is_empty(chr) || len 0) { +return -1; +} + +for (i = 0; i len; i++) { +buf[i] = d-cbuf[d-head]; +d-head = (d-head + 1) % d-size; +d-count--; + +if (cirmem_chr_is_empty(chr)) { +break; +} +} + +return 0; +} + +static void cirmem_chr_close(struct CharDriverState *chr) +{ +CirMemCharDriver *d = chr-opaque; + +g_free(d-cbuf); +g_free(d); +chr-opaque = NULL; +} + +static CharDriverState *qemu_chr_open_cirmemchr(QemuOpts *opts) +{ +CharDriverState *chr; +CirMemCharDriver *d; + +chr = g_malloc0(sizeof(CharDriverState)); +d = g_malloc(sizeof(*d)); + +d-size = qemu_opt_get_number(opts, maxcapacity, 0); +if (d-size == 0) { +d-size = CBUFF_SIZE; +} + +/* The size must be power of 2 */ +if (d-size (d-size - 1)) { +goto fail; +} + +d-head = 0; +d-count = 0; +d-cbuf = g_malloc0(d-size); + +chr-opaque = d; +chr-chr_write = cirmem_chr_write; +chr-chr_close = cirmem_chr_close; + +return chr; + +fail: +g_free(d); +g_free(chr); +return NULL; +} + QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) { char host[65], port[33], width[8], height[8]; @@ -2707,6 +2832,11 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) qemu_opt_set(opts, path, p); return opts; } +if (strstart(filename, memory, p)) { +qemu_opt_set(opts, backend, memory); +qemu_opt_set(opts, maxcapacity, p); +return opts; +} if (strstart(filename, tcp:, p) || strstart(filename, telnet:, p)) { if (sscanf(p, %64[^:]:%32[^,]%n, host, port, pos) 2) { @@ -2796,6 +2926,7 @@ static const struct { { .name = udp, .open = qemu_chr_open_udp }, { .name = msmouse, .open = qemu_chr_open_msmouse }, { .name = vc,.open = text_console_init }, +{ .name = memory,.open = qemu_chr_open_cirmemchr }, #ifdef _WIN32 { .name = file, .open = qemu_chr_open_win_file_out }, { .name = pipe, .open = qemu_chr_open_win_pipe }, @@ -3055,6 +3186,9 @@ QemuOptsList qemu_chardev_opts = { },{ .name = debug, .type = QEMU_OPT_NUMBER, +},{ +.name = maxcapacity, +.type = QEMU_OPT_NUMBER, }, { /* end of list */ } }, diff --git a/qemu-options.hx b/qemu-options.hx index 40cd683..435550f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1728,6 +1728,7 @@ DEF(chardev, HAS_ARG, QEMU_OPTION_chardev, -chardev msmouse,id=id[,mux=on|off]\n -chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n [,mux=on|off]\n +-chardev memory,id=id,maxcapacity=maxcapacity\n -chardev file,id=id,path=path[,mux=on|off]\n -chardev pipe,id=id,path=path[,mux=on|off]\n #ifdef _WIN32 @@ -1769,6 +1770,7 @@ Backend is one of:
[Qemu-devel] [Bug 955379] Re: cmake hangs with qemu-arm-static
Luke Kim: quite unlikely that above patch would cause the issue you see.. are you sure something else did not break in your environment? Can you execute that same make manually? -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/955379 Title: cmake hangs with qemu-arm-static Status in QEMU: Confirmed Status in Linaro QEMU: Confirmed Status in “qemu-linaro” package in Ubuntu: Confirmed Bug description: I'm using git commit 3e7ecd976b06f... configured with --target-list =arm-linux-user --static in a chroot environment to compile some things. I ran into this problem with both pcl and opencv-2.3.1. cmake consistently freezes at some point during its execution, though in a different spot each time, usually during a step when it's searching for some libraries. For instance, pcl most commonly stops after: [snip] -- Boost version: 1.46.1 -- Found the following Boost libraries: -- system -- filesystem -- thread -- date_time -- checking for module 'eigen3' -- found eigen3, version 3.0.1 which is perplexing because it freezes after finding what it wants, not during the search. When it does get past that point, it does so almost immediately but freezes somewhere else. I'm using 64-bit Ubuntu 11.10 with kernel release 3.0.0-16-generic with an Intel i5. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/955379/+subscriptions
Re: [Qemu-devel] [PATCH] dataplane: support viostor virtio-pci status bit setting
On Sat, Jan 19, 2013 at 09:59:57AM +0200, Vadim Rozenfeld wrote: On Friday, January 18, 2013 05:59:37 PM Stefan Hajnoczi wrote: On Thu, Jan 17, 2013 at 04:46:54PM +0100, Stefan Hajnoczi wrote: The viostor virtio-blk driver for Windows does not use the VIRTIO_CONFIG_S_DRIVER bit. It only sets the VIRTIO_CONFIG_S_DRIVER_OK bit. Will be added in the next build. Nice, thanks. For compatibility with existing viostor drivers QEMU will carry this patch. Stefan
[Qemu-devel] qmp drive-mirror vs qemu-img convert , drive-mirror really slow
Hi list, I'm doing some speed benchmark between drive-mirror vs qemu-img convert , and drive-mirror seem to be a lot slower. test: convert 1 32GB qcow2 file to raw file, local storage (6 disk 15k in raid10 + raid BBU cache) time result: qemu-img : 30sec drive-mirror (vm is paused, no writes) : 5min Any idea why drive-mirror is so slow ? (maybe does it use directsync when mirroring ?) I think both should have around same speed ? Best Regards, Derumier Alexandre
Re: [Qemu-devel] [QEMU]Install QEMU question
On Mon, Jan 21, 2013 at 5:07 PM, Andreas Färber afaer...@suse.de wrote: Hi, Hi Andreas, There's a patch queued on qemu-trivial: http://patchwork.ozlabs.org/patch/213610/ Would be nice to get this applied soon, it looks annoying but is not to worry about. I see, thanks for your help ;-) -- Thanks Harry Wei
Re: [Qemu-devel] [PATCH 1/4] ram: add free_space parameter to save_live functions
On 01/18/2013 01:53 PM, Juan Quintela wrote: As we really know how much space we have free in the buffers, we can send that information instead of guessing how much we can sent each time. Signed-off-by: Juan Quintela quint...@redhat.com --- arch_init.c | 20 +--- block-migration.c | 2 +- include/migration/vmstate.h | 2 +- include/sysemu/sysemu.h | 2 +- migration.c | 3 ++- savevm.c| 10 +++--- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch_init.c b/arch_init.c index dada6de..2792b76 100644 --- a/arch_init.c +++ b/arch_init.c @@ -601,9 +601,12 @@ static int ram_save_setup(QEMUFile *f, void *opaque) return 0; } -static int ram_save_iterate(QEMUFile *f, void *opaque) +/* Maximum size for a transmited page + header + len + idstr + page size */ +#define MAX_PAGE_SIZE (8 + 1 + 256 + TARGET_PAGE_SIZE) + +static int ram_save_iterate(QEMUFile *f, void *opaque, uint64_t free_space) { -int ret; int i; int64_t t0; int total_sent = 0; @@ -616,15 +619,15 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) t0 = qemu_get_clock_ns(rt_clock); i = 0; -while ((ret = qemu_file_rate_limit(f)) == 0) { -int bytes_sent; - -bytes_sent = ram_save_block(f, false); +/* We need space for at least one page and end of section marker */ +while (free_space MAX_PAGE_SIZE + 8) { Actually we may need more if we move to a new memory block we will need to add the block idstr and may run of space (not talking about compression which requires less space and we may have it) Why not move this logic into ram_save_block? +int bytes_sent = ram_save_block(f, false); /* no more blocks to sent */ if (bytes_sent == 0) { break; } total_sent += bytes_sent; +free_space -= bytes_sent; acct_info.iterations++; /* we want to check in the 1st loop, just in case it was the 1st time and we had to sync the dirty bitmap. @@ -644,11 +647,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) qemu_mutex_unlock_ramlist(); -if (ret 0) { -bytes_transferred += total_sent; -return ret; -} - don't we need to return negative to release the lock sometimes? qemu_put_be64(f, RAM_SAVE_FLAG_EOS); total_sent += 8; bytes_transferred += total_sent; diff --git a/block-migration.c b/block-migration.c index 6acf3e1..0c3157a 100644 --- a/block-migration.c +++ b/block-migration.c @@ -535,7 +535,7 @@ static int block_save_setup(QEMUFile *f, void *opaque) return 0; } -static int block_save_iterate(QEMUFile *f, void *opaque) +static int block_save_iterate(QEMUFile *f, void *opaque, uint64_t free_space) { int ret; diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index f27276c..0b55cf4 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -33,7 +33,7 @@ typedef struct SaveVMHandlers { void (*set_params)(const MigrationParams *params, void * opaque); SaveStateHandler *save_state; int (*save_live_setup)(QEMUFile *f, void *opaque); -int (*save_live_iterate)(QEMUFile *f, void *opaque); +int (*save_live_iterate)(QEMUFile *f, void *opaque, uint64_t free_space); int (*save_live_complete)(QEMUFile *f, void *opaque); uint64_t (*save_live_pending)(QEMUFile *f, void *opaque, uint64_t max_size); void (*cancel)(void *opaque); diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index d65a9f1..3ff043c 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -75,7 +75,7 @@ void qemu_announce_self(void); bool qemu_savevm_state_blocked(Error **errp); int qemu_savevm_state_begin(QEMUFile *f, const MigrationParams *params); -int qemu_savevm_state_iterate(QEMUFile *f); +int qemu_savevm_state_iterate(QEMUFile *f, uint64_t free_space); int qemu_savevm_state_complete(QEMUFile *f); void qemu_savevm_state_cancel(void); uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size); diff --git a/migration.c b/migration.c index 77c1971..e74ce49 100644 --- a/migration.c +++ b/migration.c @@ -683,6 +683,7 @@ static void *buffered_file_thread(void *opaque) while (true) { int64_t current_time = qemu_get_clock_ms(rt_clock); uint64_t pending_size; +size_t free_space = s-buffer_capacity - s-buffer_size; don't we need to take into consideration the rate_limit (xfer_limit) otherwise we may send too much. qemu_mutex_lock_iothread(); if (s-state != MIG_STATE_ACTIVE) { @@ -699,7 +700,7 @@ static void *buffered_file_thread(void *opaque) pending_size = qemu_savevm_state_pending(s-file, max_size); DPRINTF(pending size
Re: [Qemu-devel] [PATCH] dataplane: support viostor virtio-pci status bit setting
On Mon, Jan 21, 2013 at 10:36:18AM +0100, Stefan Hajnoczi wrote: On Sat, Jan 19, 2013 at 09:59:57AM +0200, Vadim Rozenfeld wrote: On Friday, January 18, 2013 05:59:37 PM Stefan Hajnoczi wrote: On Thu, Jan 17, 2013 at 04:46:54PM +0100, Stefan Hajnoczi wrote: The viostor virtio-blk driver for Windows does not use the VIRTIO_CONFIG_S_DRIVER bit. It only sets the VIRTIO_CONFIG_S_DRIVER_OK bit. Will be added in the next build. Nice, thanks. For compatibility with existing viostor drivers QEMU will carry this patch. Stefan I still think it's wrong: when DRIVER_OK is cleared you should stop device I think even if DRIVER is set. This patch keeps dataplane running if DRIVER is set.
[Qemu-devel] [PATCH 0/3 v7] vnc: added initial websocket protocol support
This patch set adds basic Websocket Protocol version 13 - RFC 6455 - support to QEMU VNC. Binary encoding support on the client side is mandatory. Because of the GnuTLS requirement the Websockets implementation is optional (--enable-vnc-ws). To activate Websocket support the VNC option websocket is used, for example -vnc :0,websocket. The listen port for Websocket connections is (5700 + display) so if QEMU VNC is started with :0 the Websocket port would be 5700. As an alternative the Websocket port could be manually specified by using ,websocket=port instead. Changes v2 * removed automatic websocket recognition * added new lwebsock socket on port 5700 + display when the vnc option websocket is passed on * adapted vnc_connect vnc_listen_read to differ between websocket * added separate event handler to read the Websocket handshake Changes v3 * added manual port specification by using ,websocket=port * switched from memmem() to g_strstr_len() * removed masked_size from vncws_decode_frame() * resetted vnc_tls variable to default in the configure script Changes v4 * incorporated suggestions from Stefan Hajnoczi * moved websockets encoding from vnc_write to its own client_write function * moved websockets decoding to its own client_read function * added initialization checks to vnc_disconnect to prevent crashes if a regular client connects to the websocket port Changes v5 * added initialized variable to VncState to prevent crashes during vnc_disconnect - the previously added initialization checks didn't prevent segfaults when a websocket client was connected Changes v6 * incorporated suggestions from Blue Swirl * updated vncws_handshake_read to check for the header end tag and to not reset the buffer afterwards Changes v7 * fixed vnc-ws header define Tim Hardeck (3): vnc: added buffer_advance function vnc: added initial websocket protocol support vnc: fix possible uninitialized removals configure| 27 +- qemu-options.hx |8 ++ ui/Makefile.objs |1 + ui/vnc-ws.c | 284 ++ ui/vnc-ws.h | 86 + ui/vnc.c | 211 +++- ui/vnc.h | 21 7 files changed, 610 insertions(+), 28 deletions(-) create mode 100644 ui/vnc-ws.c create mode 100644 ui/vnc-ws.h -- 1.7.10.4
Re: [Qemu-devel] [PATCH 2/4] ram: remove xbrle last_stage optimization
Juan, Why not add a migration_is_last_stage (similar to migration_is_xbzrle) function and leave the optimization Regards, Orit On 01/18/2013 01:53 PM, Juan Quintela wrote: We need to remove it to be able to return from complete to iterative phases of migration. Signed-off-by: Juan Quintela quint...@redhat.com --- arch_init.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/arch_init.c b/arch_init.c index 2792b76..9f7d44d 100644 --- a/arch_init.c +++ b/arch_init.c @@ -286,16 +286,14 @@ static size_t save_block_hdr(QEMUFile *f, RAMBlock *block, ram_addr_t offset, static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data, ram_addr_t current_addr, RAMBlock *block, -ram_addr_t offset, int cont, bool last_stage) +ram_addr_t offset, int cont) { int encoded_len = 0, bytes_sent = -1; uint8_t *prev_cached_page; if (!cache_is_cached(XBZRLE.cache, current_addr)) { -if (!last_stage) { -cache_insert(XBZRLE.cache, current_addr, - g_memdup(current_data, TARGET_PAGE_SIZE)); -} +cache_insert(XBZRLE.cache, current_addr, + g_memdup(current_data, TARGET_PAGE_SIZE)); acct_info.xbzrle_cache_miss++; return -1; } @@ -321,9 +319,7 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data, } /* we need to update the data in the cache, in order to get the same data */ -if (!last_stage) { -memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE); -} +memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE); /* Send XBZRLE based compressed page */ bytes_sent = save_block_hdr(f, block, offset, cont, RAM_SAVE_FLAG_XBZRLE); @@ -426,7 +422,7 @@ static void migration_bitmap_sync(void) * 0 means no dirty pages */ -static int ram_save_block(QEMUFile *f, bool last_stage) +static int ram_save_block(QEMUFile *f) { RAMBlock *block = last_seen_block; ram_addr_t offset = last_offset; @@ -470,10 +466,8 @@ static int ram_save_block(QEMUFile *f, bool last_stage) } else if (migrate_use_xbzrle()) { current_addr = block-offset + offset; bytes_sent = save_xbzrle_page(f, p, current_addr, block, - offset, cont, last_stage); -if (!last_stage) { -p = get_cached_data(XBZRLE.cache, current_addr); -} + offset, cont); +p = get_cached_data(XBZRLE.cache, current_addr); } /* XBZRLE overflow or normal page */ @@ -621,7 +615,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque, uint64_t free_space) i = 0; /* We need space for at least one page and end of section marker */ while (free_space MAX_PAGE_SIZE + 8) { -int bytes_sent = ram_save_block(f, false); +int bytes_sent = ram_save_block(f); /* no more blocks to sent */ if (bytes_sent == 0) { break; @@ -665,7 +659,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque) while (true) { int bytes_sent; -bytes_sent = ram_save_block(f, true); +bytes_sent = ram_save_block(f); /* no more blocks to sent */ if (bytes_sent == 0) { break;
Re: [Qemu-devel] [PATCH 3/4] ram: reuse ram_save_iterate() for the complete stage
On 01/18/2013 01:53 PM, Juan Quintela wrote: This means that we only have one memory loop for the iterate and complete phase. Signed-off-by: Juan Quintela quint...@redhat.com --- arch_init.c | 16 migration.c | 12 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/arch_init.c b/arch_init.c index 9f7d44d..9eef10a 100644 --- a/arch_init.c +++ b/arch_init.c @@ -651,23 +651,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque, uint64_t free_space) static int ram_save_complete(QEMUFile *f, void *opaque) { qemu_mutex_lock_ramlist(); do we still need to lock ramlist here? -migration_bitmap_sync(); - -/* try transferring iterative blocks of memory */ - -/* flush all remaining blocks regardless of rate limiting */ -while (true) { -int bytes_sent; - -bytes_sent = ram_save_block(f); -/* no more blocks to sent */ -if (bytes_sent == 0) { -break; -} -bytes_transferred += bytes_sent; -} migration_end(); - qemu_mutex_unlock_ramlist(); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); diff --git a/migration.c b/migration.c index e74ce49..de665f7 100644 --- a/migration.c +++ b/migration.c @@ -717,6 +717,18 @@ static void *buffered_file_thread(void *opaque) } else { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); } + +/* 8 is the size of an end of section mark, so empty section */ +while ((ret = qemu_savevm_state_iterate(s-file, free_space)) + 8) { Sorry I don't understand this condition, can you explain? Regards, Orit +ret = buffered_flush(s); +if (ret 0) { +qemu_mutex_unlock_iothread(); +break; +} +free_space = s-buffer_capacity - s-buffer_size; +} + ret = qemu_savevm_state_complete(s-file); if (ret 0) { qemu_mutex_unlock_iothread();
Re: [Qemu-devel] [PATCH v2 05/12] mirror: perform COW if the cluster size is bigger than the granularity
Am 18.01.2013 18:33, schrieb Paolo Bonzini: Am 18.01.2013 17:22, schrieb Paolo Bonzini: I haven't written a testcase for it, it's tricky but should be doable. Do you want me to respin, or can it be done as a followup? I think I would prefer a respin, but if you think otherwise, I won't insist. Okay, I'll respin. I'll just note that this series now is in danger of missing 1.4 (after 1.2 and 1.3) because only Laszlo and Eric gave it a decent review in the six months since it was first posted. Had I been employed by any other company, I'd probably just have kept the code in house and forgotten about upstream. I hope this doesn't imply that you feel I'm happy or even just indifferent about it. This is just what happens when you get a huge numbers of patches and have only very few reviewers. I hope it has got a bit better since Stefan supports me in maintaining the block layer, but I'm afraid we're still not good enough with it. Any helpful suggestions are appreciated. Kevin
Re: [Qemu-devel] [PATCH 4/4] migration: print times for end phase
This is for debugging? Why not trace events? Regards, Orit On 01/18/2013 01:53 PM, Juan Quintela wrote: Signed-off-by: Juan Quintela quint...@redhat.com --- block.c | 6 ++ cpus.c | 17 + migration.c | 13 + savevm.c| 13 + 4 files changed, 49 insertions(+) diff --git a/block.c b/block.c index 6fa7c90..c121db3 100644 --- a/block.c +++ b/block.c @@ -2693,9 +2693,15 @@ int bdrv_get_flags(BlockDriverState *bs) void bdrv_flush_all(void) { BlockDriverState *bs; +int64_t start_time, end_time; + +start_time = qemu_get_clock_ms(rt_clock); QTAILQ_FOREACH(bs, bdrv_states, list) { bdrv_flush(bs); +end_time = qemu_get_clock_ms(rt_clock); +printf(time flush device %s: %ld\n, bs-filename, + end_time - start_time); } } diff --git a/cpus.c b/cpus.c index a4390c3..15534ba 100644 --- a/cpus.c +++ b/cpus.c @@ -439,14 +439,31 @@ bool cpu_is_stopped(CPUState *cpu) static void do_vm_stop(RunState state) { +int64_t start_time, end_time; + if (runstate_is_running()) { +start_time = qemu_get_clock_ms(rt_clock); cpu_disable_ticks(); +end_time = qemu_get_clock_ms(rt_clock); +printf(time cpu_disable_ticks %ld\n, end_time - start_time); pause_all_vcpus(); +end_time = qemu_get_clock_ms(rt_clock); +printf(time pause_all_vcpus %ld\n, end_time - start_time); runstate_set(state); +end_time = qemu_get_clock_ms(rt_clock); +printf(time runstate_set %ld\n, end_time - start_time); vm_state_notify(0, state); +end_time = qemu_get_clock_ms(rt_clock); +printf(time vmstate_notify %ld\n, end_time - start_time); bdrv_drain_all(); +end_time = qemu_get_clock_ms(rt_clock); +printf(time bdrv_drain_all %ld\n, end_time - start_time); bdrv_flush_all(); +end_time = qemu_get_clock_ms(rt_clock); +printf(time bdrv_flush_all %ld\n, end_time - start_time); monitor_protocol_event(QEVENT_STOP, NULL); +end_time = qemu_get_clock_ms(rt_clock); +printf(time monitor_protocol_event %ld\n, end_time - start_time); } } diff --git a/migration.c b/migration.c index de665f7..5e965cc 100644 --- a/migration.c +++ b/migration.c @@ -712,12 +712,17 @@ static void *buffered_file_thread(void *opaque) DPRINTF(done iterating\n); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); +end_time = qemu_get_clock_ms(rt_clock); +printf(wakeup_request %ld\n, end_time - start_time); if (old_vm_running) { vm_stop(RUN_STATE_FINISH_MIGRATE); } else { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); } +end_time = qemu_get_clock_ms(rt_clock); +printf(vm_stop %ld\n, end_time - start_time); + /* 8 is the size of an end of section mark, so empty section */ while ((ret = qemu_savevm_state_iterate(s-file, free_space)) 8) { @@ -728,15 +733,21 @@ static void *buffered_file_thread(void *opaque) } free_space = s-buffer_capacity - s-buffer_size; } +end_time = qemu_get_clock_ms(rt_clock); +printf(iterate phase %ld\n, end_time - start_time); ret = qemu_savevm_state_complete(s-file); if (ret 0) { qemu_mutex_unlock_iothread(); break; } else { +end_time = qemu_get_clock_ms(rt_clock); +printf(complete without error 3a %ld\n, + end_time - start_time); migrate_fd_completed(s); } end_time = qemu_get_clock_ms(rt_clock); +printf(completed %ld\n, end_time - start_time); s-total_time = end_time - s-total_time; s-downtime = end_time - start_time; if (s-state != MIG_STATE_COMPLETED) { @@ -744,6 +755,8 @@ static void *buffered_file_thread(void *opaque) vm_start(); } } +end_time = qemu_get_clock_ms(rt_clock); +printf(end completed stage %ld\n, end_time - start_time); last_round = true; } } diff --git a/savevm.c b/savevm.c index 3447f91..113c1dd 100644 --- a/savevm.c +++ b/savevm.c @@ -1660,9 +1660,14 @@ int qemu_savevm_state_complete(QEMUFile *f) { SaveStateEntry *se; int ret; +int64_t t1; +int64_t t0 = qemu_get_clock_ms(rt_clock);
[Qemu-devel] [Bug 739785] Re: qemu-i386 user mode can't fork (bash: fork: Invalid argument)
I get an undefined reference to cpu_set_tls. The other architectures have this defined in target-*/cpu.h but the implementations vary. They generally seem to modify a register or two. I'm out of my depth here. I have no idea what that would look like for i386. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/739785 Title: qemu-i386 user mode can't fork (bash: fork: Invalid argument) Status in QEMU: New Status in “qemu” package in Debian: Confirmed Bug description: Good time of day everybody, I have been trying to make usermode qemu on ARM with plugapps (archlinux) with archlinux i386 chroot to work. 1. I installed arch linux in a virtuabox and created a chroot for it with mkarchroot. Transferred it to my pogo plug into /i386/ 2. I comiled qemu-i386 static and put it into /i386/usr/bin/ ./configure --static --disable-blobs --disable-system --target-list=i386-linux-user make 3. I also compiled linux kernel 2.6.38 with CONFIG_BINFMT_MISC=y and installed it. uname -a Linux Plugbox 2.6.38 #4 PREEMPT Fri Mar 18 22:19:10 CDT 2011 armv5tel Feroceon 88FR131 rev 1 (v5l) Marvell SheevaPlug Reference Board GNU/Linux 4. Added the following options into /etc/rc.local /sbin/modprobe binfmt_misc /bin/mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc echo ':qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/usr/bin/qemu-i386:' /proc/sys/fs/binfmt_misc/register 5. Also copied ld-linux.so.3 (actually ld-2.13.so because ld- linux.so.3 is a link to that file) from /lib/ to /i386/lib/ 6.Now i chroot into /i386 and I get this: [root@Plugbox i386]# chroot . [II aI hnve ao n@P /]# pacman -Suy bash: fork: Invalid argument 7.I also downloaded linux-user-test-0.3 from qemu website and ran the test: [root@Plugbox linux-user-test-0.3]# make ./qemu-linux-user.sh [qemu-i386] ../qemu-0.14.0/i386-linux-user/qemu-i386 -L ./gnemul/qemu-i386 i386/ls -l dummyfile BUG IN DYNAMIC LINKER ld.so: dl-version.c: 210: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed! make: *** [test] Error 127 To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/739785/+subscriptions
Re: [Qemu-devel] [PATCH 3/4] ram: reuse ram_save_iterate() for the complete stage
Il 18/01/2013 12:53, Juan Quintela ha scritto: This means that we only have one memory loop for the iterate and complete phase. I think this is premature. One important difference between iterate and complete is that ultimately iterate will run without the BQL, while that's not necessarily true of complete. So we may end up reverting this patch. Signed-off-by: Juan Quintela quint...@redhat.com --- arch_init.c | 16 migration.c | 12 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/arch_init.c b/arch_init.c index 9f7d44d..9eef10a 100644 --- a/arch_init.c +++ b/arch_init.c @@ -651,23 +651,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque, uint64_t free_space) static int ram_save_complete(QEMUFile *f, void *opaque) { qemu_mutex_lock_ramlist(); -migration_bitmap_sync(); - -/* try transferring iterative blocks of memory */ - -/* flush all remaining blocks regardless of rate limiting */ -while (true) { -int bytes_sent; - -bytes_sent = ram_save_block(f); -/* no more blocks to sent */ -if (bytes_sent == 0) { -break; -} -bytes_transferred += bytes_sent; -} migration_end(); - qemu_mutex_unlock_ramlist(); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); diff --git a/migration.c b/migration.c index e74ce49..de665f7 100644 --- a/migration.c +++ b/migration.c @@ -717,6 +717,18 @@ static void *buffered_file_thread(void *opaque) } else { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); } + +/* 8 is the size of an end of section mark, so empty section */ +while ((ret = qemu_savevm_state_iterate(s-file, free_space)) + 8) { +ret = buffered_flush(s); +if (ret 0) { +qemu_mutex_unlock_iothread(); +break; +} +free_space = s-buffer_capacity - s-buffer_size; +} + If you really want to apply this patch, however, move this loop to qemu_savevm_state_complete. do_savevm has a similar loop: do { ret = qemu_savevm_state_iterate(f); if (ret 0) goto out; } while (ret == 0); and then you can unify buffered_file_thread and do_savevm's code. Paolo ret = qemu_savevm_state_complete(s-file); if (ret 0) { qemu_mutex_unlock_iothread();
[Qemu-devel] [PATCH 2/3] vnc: added initial websocket protocol support
This patch adds basic Websocket Protocol version 13 - RFC 6455 - support to QEMU VNC. Binary encoding support on the client side is mandatory. Because of the GnuTLS requirement the Websockets implementation is optional (--enable-vnc-ws). To activate Websocket support the VNC option websocketis used, for example -vnc :0,websocket. The listen port for Websocket connections is (5700 + display) so if QEMU VNC is started with :0 the Websocket port would be 5700. As an alternative the Websocket port could be manually specified by using ,websocket=port instead. Parts of the implementation base on Anthony Liguori's QEMU Websocket patch from 2010 and on Joel Martin's LibVNC Websocket implementation. Signed-off-by: Tim Hardeck thard...@suse.de --- configure| 27 +- qemu-options.hx |8 ++ ui/Makefile.objs |1 + ui/vnc-ws.c | 284 ++ ui/vnc-ws.h | 86 + ui/vnc.c | 187 +++ ui/vnc.h | 19 7 files changed, 591 insertions(+), 21 deletions(-) create mode 100644 ui/vnc-ws.c create mode 100644 ui/vnc-ws.h diff --git a/configure b/configure index 837a84a..ac3198c 100755 --- a/configure +++ b/configure @@ -158,6 +158,7 @@ vnc_tls= vnc_sasl= vnc_jpeg= vnc_png= +vnc_ws= xen= xen_ctrl_version= xen_pci_passthrough= @@ -715,6 +716,10 @@ for opt do ;; --enable-vnc-png) vnc_png=yes ;; + --disable-vnc-ws) vnc_ws=no + ;; + --enable-vnc-ws) vnc_ws=yes + ;; --disable-slirp) slirp=no ;; --disable-uuid) uuid=no @@ -1064,6 +1069,8 @@ echo --disable-vnc-jpeg disable JPEG lossy compression for VNC server echo --enable-vnc-jpegenable JPEG lossy compression for VNC server echo --disable-vnc-pngdisable PNG compression for VNC server (default) echo --enable-vnc-png enable PNG compression for VNC server +echo --disable-vnc-ws disable Websockets support for VNC server +echo --enable-vnc-ws enable Websockets support for VNC server echo --disable-curses disable curses output echo --enable-curses enable curses output echo --disable-curl disable curl connectivity @@ -1707,8 +1714,8 @@ EOF fi ## -# VNC TLS detection -if test $vnc = yes -a $vnc_tls != no ; then +# VNC TLS/WS detection +if test $vnc = yes -a \( $vnc_tls != no -o $vnc_ws != no \) ; then cat $TMPC EOF #include gnutls/gnutls.h int main(void) { gnutls_session_t s; gnutls_init(s, GNUTLS_SERVER); return 0; } @@ -1716,14 +1723,23 @@ EOF vnc_tls_cflags=`$pkg_config --cflags gnutls 2 /dev/null` vnc_tls_libs=`$pkg_config --libs gnutls 2 /dev/null` if compile_prog $vnc_tls_cflags $vnc_tls_libs ; then -vnc_tls=yes +if test $vnc_tls != no ; then + vnc_tls=yes +fi +if test $vnc_ws != no ; then + vnc_ws=yes +fi libs_softmmu=$vnc_tls_libs $libs_softmmu QEMU_CFLAGS=$QEMU_CFLAGS $vnc_tls_cflags else if test $vnc_tls = yes ; then feature_not_found vnc-tls fi +if test $vnc_ws = yes ; then + feature_not_found vnc-ws +fi vnc_tls=no +vnc_ws=no fi fi @@ -3263,6 +3279,7 @@ if test $vnc = yes ; then echo VNC SASL support $vnc_sasl echo VNC JPEG support $vnc_jpeg echo VNC PNG support $vnc_png +echo VNC WS support$vnc_ws fi if test -n $sparc_cpu; then echo Target Sparc Arch $sparc_cpu @@ -3437,6 +3454,10 @@ fi if test $vnc_png = yes ; then echo CONFIG_VNC_PNG=y $config_host_mak fi +if test $vnc_ws = yes ; then + echo CONFIG_VNC_WS=y $config_host_mak + echo VNC_WS_CFLAGS=$vnc_ws_cflags $config_host_mak +fi if test $fnmatch = yes ; then echo CONFIG_FNMATCH=y $config_host_mak fi diff --git a/qemu-options.hx b/qemu-options.hx index 9df0cde..38ff002 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1096,6 +1096,14 @@ client is specified by the @var{display}. For reverse network connections (@var{host}:@var{d},@code{reverse}), the @var{d} argument is a TCP port number, not a display number. +@item websocket + +Opens an additional TCP listening port dedicated to VNC Websocket connections. +By defintion the Websocket port is 5700+@var{display}. If @var{host} is +specified connections will only be allowed from this host. +As an alternative the Websocket port could be specified by using +@code{websocket}=@var{port}. + @item password Require that password based authentication is used for client connections. diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 6768bb7..d9db073 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -4,6 +4,7 @@ vnc-obj-y += vnc-enc-tight.o vnc-palette.o vnc-obj-y += vnc-enc-zrle.o vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o +vnc-obj-$(CONFIG_VNC_WS) += vnc-ws.o vnc-obj-y += vnc-jobs.o common-obj-y += keymaps.o console.o
Re: [Qemu-devel] qmp drive-mirror vs qemu-img convert , drive-mirror really slow
Il 21/01/2013 10:40, Alexandre DERUMIER ha scritto: Hi list, I'm doing some speed benchmark between drive-mirror vs qemu-img convert , and drive-mirror seem to be a lot slower. test: convert 1 32GB qcow2 file to raw file, local storage (6 disk 15k in raid10 + raid BBU cache) time result: qemu-img : 30sec drive-mirror (vm is paused, no writes) : 5min Any idea why drive-mirror is so slow ? (maybe does it use directsync when mirroring ?) No, it doesn't. Probably it's because the image is sparse? The current code in git master has a very coarse granularity (1 MB). Please try the blkmirror-job-1.4 branch from my github repo (git://github.com/bonzini/qemu.git). That branch uses the qcow2 file's cluster size as the granularity, and has other optimizations that kick in when the image is sparse. Paolo I think both should have around same speed ? Best Regards, Derumier Alexandre
Re: [Qemu-devel] [PATCH] Annotate questionable fallthroughs
Peter Maydell peter.mayd...@linaro.org writes: On 20 January 2013 15:54, Blue Swirl blauwir...@gmail.com wrote: [...] I don't think there's much point adding tons of XXX comments when a bunch of these aren't actually wrong code. Moreover, such comments make them look intentional to static analyzers. I doubt lying to our tools is a good idea. If you want to fix this I think a better approach would be more focused patches aimed at adding 'break;' or /* fallthrough */ based on actual human examination of the surrounding code. Indeed. I'd gladly provide a list of fall throughs Coverity dislikes. Additionally, I'd suggest to enforce a suitable convention for new code. I find this one sensible: either break; or /* fall through */ is required, except right after a case label, a goto, continue, or return statement, or function call that never returns.
[Qemu-devel] [PATCH 1/3] vnc: added buffer_advance function
Following Anthony Liguori's Websocket implementation I have added the buffer_advance function to VNC and replaced all related buffer memmove operations with it. Signed-off-by: Tim Hardeck thard...@suse.de Reviewed-by: Anthony Liguori aligu...@us.ibm.com --- ui/vnc.c | 13 + ui/vnc.h |1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 8912b78..ddf01f1 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -510,6 +510,13 @@ void buffer_append(Buffer *buffer, const void *data, size_t len) buffer-offset += len; } +void buffer_advance(Buffer *buf, size_t len) +{ +memmove(buf-buffer, buf-buffer + len, +(buf-offset - len)); +buf-offset -= len; +} + static void vnc_desktop_resize(VncState *vs) { DisplayState *ds = vs-ds; @@ -1166,8 +1173,7 @@ static long vnc_client_write_plain(VncState *vs) if (!ret) return 0; -memmove(vs-output.buffer, vs-output.buffer + ret, (vs-output.offset - ret)); -vs-output.offset -= ret; +buffer_advance(vs-output, ret); if (vs-output.offset == 0) { qemu_set_fd_handler2(vs-csock, NULL, vnc_client_read, NULL, vs); @@ -1313,8 +1319,7 @@ void vnc_client_read(void *opaque) } if (!ret) { -memmove(vs-input.buffer, vs-input.buffer + len, (vs-input.offset - len)); -vs-input.offset -= len; +buffer_advance(vs-input, len); } else { vs-read_handler_expect = ret; } diff --git a/ui/vnc.h b/ui/vnc.h index 8b40f09..5059cbe 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -510,6 +510,7 @@ void buffer_reserve(Buffer *buffer, size_t len); void buffer_reset(Buffer *buffer); void buffer_free(Buffer *buffer); void buffer_append(Buffer *buffer, const void *data, size_t len); +void buffer_advance(Buffer *buf, size_t len); /* Misc helpers */ -- 1.7.10.4
[Qemu-devel] [PATCH 3/3] vnc: fix possible uninitialized removals
Some VncState values are not initialized before the Websocket handshake. If it fails QEMU segfaults during the cleanup. To prevent this behavior intialization checks are added. Signed-off-by: Tim Hardeck thard...@suse.de --- ui/vnc.c | 11 --- ui/vnc.h |1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index ee08894..ff4e2ae 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1053,20 +1053,24 @@ void vnc_disconnect_finish(VncState *vs) audio_del(vs); vnc_release_modifiers(vs); -QTAILQ_REMOVE(vs-vd-clients, vs, next); +if (vs-initialized) { +QTAILQ_REMOVE(vs-vd-clients, vs, next); +qemu_remove_mouse_mode_change_notifier(vs-mouse_mode_notifier); +} if (QTAILQ_EMPTY(vs-vd-clients)) { dcl-idle = 1; } -qemu_remove_mouse_mode_change_notifier(vs-mouse_mode_notifier); vnc_remove_timer(vs-vd); if (vs-vd-lock_key_sync) qemu_remove_led_event_handler(vs-led); vnc_unlock_output(vs); qemu_mutex_destroy(vs-output_mutex); -qemu_bh_delete(vs-bh); +if (vs-bh != NULL) { +qemu_bh_delete(vs-bh); +} buffer_free(vs-jobs_buffer); for (i = 0; i VNC_STAT_ROWS; ++i) { @@ -2749,6 +2753,7 @@ static void vnc_connect(VncDisplay *vd, int csock, int skipauth, bool websocket) void vnc_init_state(VncState *vs) { +vs-initialized = true; VncDisplay *vd = vs-vd; vs-ds = vd-ds; diff --git a/ui/vnc.h b/ui/vnc.h index f93c89a..45d7686 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -306,6 +306,7 @@ struct VncState QEMUPutLEDEntry *led; bool abort; +bool initialized; QemuMutex output_mutex; QEMUBH *bh; Buffer jobs_buffer; -- 1.7.10.4
Re: [Qemu-devel] [PATCH v2] hw/tpci200: Fix compiler warning (redefined symbol with MinGW)
On Mon, Jan 21, 2013 at 07:49:51AM +0100, Stefan Weil wrote: STATUS_TIMEOUT is defined in winnt.h: CChw/tpci200.o hw/tpci200.c:34:0: warning: STATUS_TIMEOUT redefined [enabled by default] /usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/include/winnt.h:1036:0: note: this is the location of the previous definition Use STATUS_TIME instead of STATUS_TIMEOUT as suggested by Alberto Garcia. Signed-off-by: Stefan Weil s...@weilnetz.de --- v1: Add QEMU_PREFIX (http://patchwork.ozlabs.org/patch/212348/) v2: Use STATUS_TIME Like v1, this patch fixes a warning for MinGW. We could also mix v1 and v2. Please commit one of those variants to git master. Regards, Stefan W. hw/tpci200.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Thanks, applied to the trivial patches tree: https://github.com/stefanha/qemu/commits/trivial-patches Stefan
Re: [Qemu-devel] qmp drive-mirror vs qemu-img convert , drive-mirror really slow
Please try the blkmirror-job-1.4 branch from my github repo (git://github.com/bonzini/qemu.git). That branch uses the qcow2 file's cluster size as the granularity, and has other optimizations that kick in when the image is sparse. I'll try that, thanks Paolo, I'll keep you in touch. - Mail original - De: Paolo Bonzini pbonz...@redhat.com À: Alexandre DERUMIER aderum...@odiso.com Cc: qemu-devel qemu-devel@nongnu.org Envoyé: Lundi 21 Janvier 2013 11:35:40 Objet: Re: qmp drive-mirror vs qemu-img convert , drive-mirror really slow Il 21/01/2013 10:40, Alexandre DERUMIER ha scritto: Hi list, I'm doing some speed benchmark between drive-mirror vs qemu-img convert , and drive-mirror seem to be a lot slower. test: convert 1 32GB qcow2 file to raw file, local storage (6 disk 15k in raid10 + raid BBU cache) time result: qemu-img : 30sec drive-mirror (vm is paused, no writes) : 5min Any idea why drive-mirror is so slow ? (maybe does it use directsync when mirroring ?) No, it doesn't. Probably it's because the image is sparse? The current code in git master has a very coarse granularity (1 MB). Please try the blkmirror-job-1.4 branch from my github repo (git://github.com/bonzini/qemu.git). That branch uses the qcow2 file's cluster size as the granularity, and has other optimizations that kick in when the image is sparse. Paolo I think both should have around same speed ? Best Regards, Derumier Alexandre
Re: [Qemu-devel] [Qemu-trivial] [PATCH v2] configure: silence pkg-config's check for curses
On Mon, Jan 21, 2013 at 01:36:54AM +0400, Vadim Evard wrote: By the way (sorry if this was discussed before and is a strong decision) I'd say e-mail based workflow is of course very flexible - and very very novice-unfriendly. Dash, I had to learn git commands I'd never use in my usual workflow with local or Github repos. And, well, I was not very good with that. 10 ways with 10 options in each. You all saw my previous patch mail with fubar header and no signed-off-by string. Is there a reason you (team) don't use e.g. Github at least for trivial patches? Yes, the email-based approach is the most flexible but also has a learning curve. For one-time contributors it can seem like wasted effort. The QEMU community is familiar with the email-based workflow and has customized it. One key idea is that all patches go through qemu-devel@nongnu.org - even trivial patches are exposed to code review from the whole community. A new vector for code submission still needs to keep this property. For another open source project that I'm involved in I have set up a cronjob that sends GitHub pull requests to the project mailing list. This way the mailing list still sees all patches before they get committed. Replying to patches doesn't work though - you still need to log into GitHub in order to send comments to the author. I can't ask all QEMU developers to do that. Any ideas how to make GitHub work with QEMU? Stefan
[Qemu-devel] [PATCH 2/4] acpitable: open the data file in binary mode
From: Michael Tokarev m...@tls.msk.ru -acpitable {file|data}=file reads the content of file, but it is in binary form, so the file should be opened usin O_BINARY flag. On *nix it is a no-op, but on windows and other weird platform it is really needed. Signed-off-by: Michael Tokarev m...@tls.msk.ru Signed-off-by: Stefan Hajnoczi stefa...@redhat.com --- hw/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi.c b/hw/acpi.c index 97617c4..8c9dcc5 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -104,7 +104,7 @@ int acpi_table_add(const char *t) /* now read in the data files, reallocating buffer as needed */ for (f = strtok(buf, :); f; f = strtok(NULL, :)) { -int fd = open(f, O_RDONLY); +int fd = open(f, O_RDONLY | O_BINARY); if (fd 0) { fprintf(stderr, can't open file %s: %s\n, f, strerror(errno)); -- 1.8.1
[Qemu-devel] [PATCH 4/4] hw/tpci200: Fix compiler warning (redefined symbol with MinGW)
From: Stefan Weil s...@weilnetz.de STATUS_TIMEOUT is defined in winnt.h: CChw/tpci200.o hw/tpci200.c:34:0: warning: STATUS_TIMEOUT redefined [enabled by default] /usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/include/winnt.h:1036:0: note: this is the location of the previous definition Use STATUS_TIME instead of STATUS_TIMEOUT as suggested by Alberto Garcia. Signed-off-by: Stefan Weil s...@weilnetz.de Signed-off-by: Stefan Hajnoczi stefa...@redhat.com --- hw/tpci200.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/tpci200.c b/hw/tpci200.c index e082bca..a4823fb 100644 --- a/hw/tpci200.c +++ b/hw/tpci200.c @@ -31,7 +31,7 @@ #define IP_INT_SPACE_ADDR_MASK 0x3F #define STATUS_INT(IP, INTNO) BIT((IP) * 2 + (INTNO)) -#define STATUS_TIMEOUT(IP)BIT((IP) + 12) +#define STATUS_TIME(IP) BIT((IP) + 12) #define STATUS_ERR_ANY0xF00 #define CTRL_CLKRATE BIT(0) @@ -279,9 +279,9 @@ static void tpci200_write_las0(void *opaque, hwaddr addr, uint64_t val, } } -if (val STATUS_TIMEOUT(i)) { +if (val STATUS_TIME(i)) { DPRINTF(Clear IP %c timeout\n, 'A' + i); -s-status = ~STATUS_TIMEOUT(i); +s-status = ~STATUS_TIME(i); } } -- 1.8.1
Re: [Qemu-devel] [PATCH v2 08/12] mirror: allow customizing the granularity
Am 16.01.2013 18:31, schrieb Paolo Bonzini: The desired granularity may be very different depending on the kind of operation (e.g. continuous replication vs. collapse-to-raw) and whether the VM is expected to perform lots of I/O while mirroring is in progress. Allow the user to customize it, while providing a sane default so that in general there will be no extra allocated space in the target compared to the source. Signed-off-by: Paolo Bonzini pbonz...@redhat.com @@ -72,19 +70,19 @@ static int coroutine_fn mirror_iteration(MirrorBlockJob *s, * is very large, we need to do COW ourselves. The first time a cluster is * copied, copy it entirely. * - * Because both BDRV_SECTORS_PER_DIRTY_CHUNK and the cluster size are - * powers of two, the number of sectors to copy cannot exceed one cluster. + * Because both the granularity and the cluster size are powers of two, the + * number of sectors to copy cannot exceed one cluster. */ sector_num = s-sector_num; -nb_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK; -cluster_num = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK; +nb_sectors_chunk = nb_sectors = s-granularity BDRV_SECTOR_BITS; When you respin anyway: sectors_per_chunk would be a clearer name, I think. I'd also avoid double assignments, but the coding style document doesn't seem to forbid it. @@ -962,6 +963,7 @@ Arguments: file/device (NewImageMode, optional, default 'absolute-paths') - speed: maximum speed of the streaming job, in bytes per second (json-int) +- granularity: granularity of the dirty bitmap, in bytes (json-int, optional) - sync: what parts of the disk image should be copied to the destination; possibilities include full for all the disk, top for only the sectors allocated in the topmost image, or none to only replicate new I/O @@ -971,6 +973,10 @@ Arguments: - on-target-error: the action to take on an error on the target (BlockdevOnError, default 'report') +The default value of the granularity is, if the image format defines +a cluster size, the cluster size or 4096, whichever is larger. If it +does not define a cluster size, the default value of the granularity +is 65536. This doesn't match the code which has an upper limit of 64k for the granularity, even with larger cluster sizes. Kevin
Re: [Qemu-devel] [PATCH for-1.4 03/12] pc: Reverse pc_init_pci() compatibility logic
On Mon, Jan 21, 2013 at 04:39:24AM +0100, Andreas Färber wrote: Am 17.01.2013 21:59, schrieb Eduardo Habkost: Currently, the pc-1.4 machine init function enables PV EOI and then calls the pc-1.2 machine init function. The problem with this approach is that now we can't enable any additional compatibility code inside the pc-1.2 init function because it would end up enabling the compatibility behavior on pc-1.3 and pc-1.4 as well. This reverses the logic so that the pc-1.2 machine init function will disable PV EOI, and then call the pc-1.4 machine init function. This way we can change older machine-types to enable compatibility behavior, and the newer machine-types (pc-1.3, pc-q35-1.4 and pc-i440fx-1.4) would just use the default behavior. (This means that one nice side-effect of this change is that pc-q35-1.4 will get PV EOI enabled by default, too) It would be interesting to eventually change pc_init_pci_no_kvmclock() and pc_init_isa() to reuse pc_init_pci_1_2() as well (so we don't need to duplicate compatibility code on those two functions). But this will be probably much easier to do after we create a PCInitArgs struct for the PC initialization arguments, and/or after we use global-properties to implement the compatibility modes present in pc_init_pci_1_2(). Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- Cc: k...@vger.kernel.org Cc: Michael S. Tsirkin m...@redhat.com Cc: Gleb Natapov g...@redhat.com Cc: Marcelo Tosatti mtosa...@redhat.com Ping! mst, you handled a previous PC machine compatibility patch - can you ack or nack? Eduardo, which of the following patches depend on this one? Only 12/12? Yes, only 12/12 depend on it (it is the patch that finally introduces the fix, on pc-1.4 only). -- Eduardo
Re: [Qemu-devel] [PATCH v2 2/5] block: Use error code EMEDIUMTYPE for wrong format in some block drivers
Stefan Weil s...@weilnetz.de writes: Am 18.01.2013 09:53, schrieb Markus Armbruster: Stefan Weil s...@weilnetz.de writes: This improves error reports for bochs, cow, qcow, qcow2, qed and vmdk when a file with the wrong format is selected. Signed-off-by: Stefan Weil s...@weilnetz.de --- block/bochs.c |2 +- block/cow.c |2 +- block/qcow.c |2 +- block/qcow2.c |2 +- block/qed.c |2 +- block/vmdk.c |4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/bochs.c b/block/bochs.c index 1b1d9cd..3737583 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -126,7 +126,7 @@ static int bochs_open(BlockDriverState *bs, int flags) strcmp(bochs.subtype, GROWING_TYPE) || ((le32_to_cpu(bochs.version) != HEADER_VERSION) (le32_to_cpu(bochs.version) != HEADER_V1))) { -goto fail; +return -EMEDIUMTYPE; } if (le32_to_cpu(bochs.version) == HEADER_V1) { You make the function return either 0, -1 or -EMEDIUMTYPE. Please make it return either 0 or a negative errno code, like this (untested): Hi Markus, returning 0, -1 is like before, only returning -EMEDIUMTYPE is new. You are right, a return value of -1 should be replaced by a negative error value. I fixed this for block/vdi.c in a separate patch as suggested by Kevin, see http://patchwork.ozlabs.org/patch/213375/. The same kind of improvement should be done for other block drivers which currently use -1, but that can be done after my patch series was applied. The primary purpose of my patch series was fixing open bugreports. For vdi I did more because I feel responsible for that part of the code. I had a closer look at the various bdrv_open() methods, and how they're used. Turns out that we already assume they return 0/-errno, yet the following methods return -1 on some or all errors: bochs_open cloop_open dmg_open parallels_open vdi_open vpc_open They all need to be fixed. I appreciate you fixing vdi_open(). However, you improve bochs_open() from completely and obviously broken (return -1 on error always) to half-broken (return -1 on some errors, and -errno on others). I don't like that. Fixing it up doesn't look hard to me (sketch appended). Could you do that for us? If not, I'd prefer to leave bochs_open() completely and obviously broken. diff --git a/block/bochs.c b/block/bochs.c index 1b1d9cd..57b2dc8 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -111,13 +111,14 @@ static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) static int bochs_open(BlockDriverState *bs, int flags) { BDRVBochsState *s = bs-opaque; -int i; +int ret, i; struct bochs_header bochs; struct bochs_header_v1 header_v1; bs-read_only = 1; // no write support yet -if (bdrv_pread(bs-file, 0, bochs, sizeof(bochs)) != sizeof(bochs)) { +ret = bdrv_pread(bs-file, 0, bochs, sizeof(bochs)); +if (ret 0) { goto fail; } @@ -126,6 +127,7 @@ static int bochs_open(BlockDriverState *bs, int flags) strcmp(bochs.subtype, GROWING_TYPE) || ((le32_to_cpu(bochs.version) != HEADER_VERSION) (le32_to_cpu(bochs.version) != HEADER_V1))) { +ret = -EMEDIUMTYPE; goto fail; } @@ -138,8 +140,9 @@ static int bochs_open(BlockDriverState *bs, int flags) s-catalog_size = le32_to_cpu(bochs.extra.redolog.catalog); s-catalog_bitmap = g_malloc(s-catalog_size * 4); -if (bdrv_pread(bs-file, le32_to_cpu(bochs.header), s-catalog_bitmap, - s-catalog_size * 4) != s-catalog_size * 4) +ret = bdrv_pread(bs-file, le32_to_cpu(bochs.header), s-catalog_bitmap, + s-catalog_size * 4); +if (ret 0) goto fail; for (i = 0; i s-catalog_size; i++) le32_to_cpus(s-catalog_bitmap[i]); @@ -154,7 +157,7 @@ static int bochs_open(BlockDriverState *bs, int flags) qemu_co_mutex_init(s-lock); return 0; fail: -return -1; +return ret; } static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num)
Re: [Qemu-devel] [PATCH v13 0/7] libqblock qemu block layer library
Il 14/12/2012 11:17, Paolo Bonzini ha scritto: Il 14/12/2012 11:06, Wenchao Xia ha scritto: Hi Paolo, Do you think a rebase of the libqblock is needed? It have been quite a time without comments. I was hoping that other people would jump in. :) Please rebase, there will be some changes required in the build system. See libcacard/Makefile for a model. Paolo
Re: [Qemu-devel] [PATCH v2 05/12] mirror: perform COW if the cluster size is bigger than the granularity
Il 21/01/2013 11:17, Kevin Wolf ha scritto: Am 18.01.2013 18:33, schrieb Paolo Bonzini: Am 18.01.2013 17:22, schrieb Paolo Bonzini: I haven't written a testcase for it, it's tricky but should be doable. Do you want me to respin, or can it be done as a followup? I think I would prefer a respin, but if you think otherwise, I won't insist. Okay, I'll respin. I'll just note that this series now is in danger of missing 1.4 (after 1.2 and 1.3) because only Laszlo and Eric gave it a decent review in the six months since it was first posted. Had I been employed by any other company, I'd probably just have kept the code in house and forgotten about upstream. I hope this doesn't imply that you feel I'm happy or even just indifferent about it. This is just what happens when you get a huge numbers of patches and have only very few reviewers. I hope it has got a bit better since Stefan supports me in maintaining the block layer, but I'm afraid we're still not good enough with it. Any helpful suggestions are appreciated. No, I don't think you're happy. And I'm sorry if it felt like a complaint, it wasn't meant to be---I had plenty of other patches committed by either you or Stefan or Anthony, so I cannot really complain about anything. :) The problem is that we have lots of patches that are not ready posted too early without really following comments. These patches consume a huge amount of review bandwidth. And more often than not are never committed because people disappear when they are almost ready. At the same time, patches that are almost ready from the beginning, tend to fall through the cracks. It is not exclusive to the block layer, see for example Alberto Garcia's serial port patches. Paolo
[Qemu-devel] [PATCH v5 0/3] make mac programming for virtio net more robust
Currenly mac is programmed byte by byte. This means that we have an intermediate step where mac is wrong. Third patch introduced a new vq control command to set mac address, it's atomic. V2: check return of sending command, delay eth_mac_addr() V3: restore software address when fail to set hardware address V4: split eth_mac_addr, fix error handle V5: rebase patches to net-next tree Amos Kong (2): move virtnet_send_command() above virtnet_set_mac_address() virtio-net: introduce a new control to set macaddr Stefan Hajnoczi (1): net: split eth_mac_addr for better error handling drivers/net/virtio_net.c| 110 ++- include/linux/etherdevice.h |2 + include/uapi/linux/virtio_net.h |8 +++- net/ethernet/eth.c | 41 -- 4 files changed, 106 insertions(+), 55 deletions(-)
[Qemu-devel] [PATCH v5 1/3] move virtnet_send_command() above virtnet_set_mac_address()
We want to send vq command to set mac address in virtnet_set_mac_address(), so do this function moving. Fixed a little issue of coding style. Signed-off-by: Amos Kong ak...@redhat.com --- drivers/net/virtio_net.c | 89 ++--- 1 files changed, 44 insertions(+), 45 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a6fcf15..395ab4f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -753,6 +753,50 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } +/* + * Send command via the control virtqueue and check status. Commands + * supported by the hypervisor, as indicated by feature bits, should + * never fail unless improperly formated. + */ +static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, +struct scatterlist *data, int out, int in) +{ + struct scatterlist *s, sg[VIRTNET_SEND_COMMAND_SG_MAX + 2]; + struct virtio_net_ctrl_hdr ctrl; + virtio_net_ctrl_ack status = ~0; + unsigned int tmp; + int i; + + /* Caller should know better */ + BUG_ON(!virtio_has_feature(vi-vdev, VIRTIO_NET_F_CTRL_VQ) || + (out + in VIRTNET_SEND_COMMAND_SG_MAX)); + + out++; /* Add header */ + in++; /* Add return status */ + + ctrl.class = class; + ctrl.cmd = cmd; + + sg_init_table(sg, out + in); + + sg_set_buf(sg[0], ctrl, sizeof(ctrl)); + for_each_sg(data, s, out + in - 2, i) + sg_set_buf(sg[i + 1], sg_virt(s), s-length); + sg_set_buf(sg[out + in - 1], status, sizeof(status)); + + BUG_ON(virtqueue_add_buf(vi-cvq, sg, out, in, vi, GFP_ATOMIC) 0); + + virtqueue_kick(vi-cvq); + + /* Spin for a response, the kick causes an ioport write, trapping +* into the hypervisor, so the request should be handled immediately. +*/ + while (!virtqueue_get_buf(vi-cvq, tmp)) + cpu_relax(); + + return status == VIRTIO_NET_OK; +} + static int virtnet_set_mac_address(struct net_device *dev, void *p) { struct virtnet_info *vi = netdev_priv(dev); @@ -819,51 +863,6 @@ static void virtnet_netpoll(struct net_device *dev) } #endif -/* - * Send command via the control virtqueue and check status. Commands - * supported by the hypervisor, as indicated by feature bits, should - * never fail unless improperly formated. - */ -static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, -struct scatterlist *data, int out, int in) -{ - struct scatterlist *s, sg[VIRTNET_SEND_COMMAND_SG_MAX + 2]; - struct virtio_net_ctrl_hdr ctrl; - virtio_net_ctrl_ack status = ~0; - unsigned int tmp; - int i; - - /* Caller should know better */ - BUG_ON(!virtio_has_feature(vi-vdev, VIRTIO_NET_F_CTRL_VQ) || - (out + in VIRTNET_SEND_COMMAND_SG_MAX)); - - out++; /* Add header */ - in++; /* Add return status */ - - ctrl.class = class; - ctrl.cmd = cmd; - - sg_init_table(sg, out + in); - - sg_set_buf(sg[0], ctrl, sizeof(ctrl)); - for_each_sg(data, s, out + in - 2, i) - sg_set_buf(sg[i + 1], sg_virt(s), s-length); - sg_set_buf(sg[out + in - 1], status, sizeof(status)); - - BUG_ON(virtqueue_add_buf(vi-cvq, sg, out, in, vi, GFP_ATOMIC) 0); - - virtqueue_kick(vi-cvq); - - /* -* Spin for a response, the kick causes an ioport write, trapping -* into the hypervisor, so the request should be handled immediately. -*/ - while (!virtqueue_get_buf(vi-cvq, tmp)) - cpu_relax(); - - return status == VIRTIO_NET_OK; -} - static void virtnet_ack_link_announce(struct virtnet_info *vi) { rtnl_lock(); -- 1.7.1
[Qemu-devel] [PATCH v5 2/3] net: split eth_mac_addr for better error handling
From: Stefan Hajnoczi stefa...@gmail.com When we set mac address, software mac address in system and hardware mac address all need to be updated. Current eth_mac_addr() doesn't allow callers to implement error handling nicely. This patch split eth_mac_addr() to prepare part and real commit part, then we can prepare first, and try to change hardware address, then do the real commit if hardware address is set successfully. Signed-off-by: Stefan Hajnoczi stefa...@gmail.com Signed-off-by: Amos Kong ak...@redhat.com --- include/linux/etherdevice.h |2 ++ net/ethernet/eth.c | 41 +++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 1a43e1b..c623861 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -40,6 +40,8 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, extern void eth_header_cache_update(struct hh_cache *hh, const struct net_device *dev, const unsigned char *haddr); +extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p); +extern void eth_commit_mac_addr_change(struct net_device *dev, void *p); extern int eth_mac_addr(struct net_device *dev, void *p); extern int eth_change_mtu(struct net_device *dev, int new_mtu); extern int eth_validate_addr(struct net_device *dev); diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index bc39c8c..a36c85e 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -272,6 +272,36 @@ void eth_header_cache_update(struct hh_cache *hh, EXPORT_SYMBOL(eth_header_cache_update); /** + * eth_prepare_mac_addr_change - prepare for mac change + * @dev: network device + * @p: socket address + */ +int eth_prepare_mac_addr_change(struct net_device *dev, void *p) +{ + struct sockaddr *addr = p; + + if (!(dev-priv_flags IFF_LIVE_ADDR_CHANGE) netif_running(dev)) + return -EBUSY; + if (!is_valid_ether_addr(addr-sa_data)) + return -EADDRNOTAVAIL; + return 0; +} +EXPORT_SYMBOL(eth_prepare_mac_addr_change); + +/** + * eth_commit_mac_addr_change - commit mac change + * @dev: network device + * @p: socket address + */ +void eth_commit_mac_addr_change(struct net_device *dev, void *p) +{ + struct sockaddr *addr = p; + + memcpy(dev-dev_addr, addr-sa_data, ETH_ALEN); +} +EXPORT_SYMBOL(eth_commit_mac_addr_change); + +/** * eth_mac_addr - set new Ethernet hardware address * @dev: network device * @p: socket address @@ -283,13 +313,12 @@ EXPORT_SYMBOL(eth_header_cache_update); */ int eth_mac_addr(struct net_device *dev, void *p) { - struct sockaddr *addr = p; + int ret; - if (!(dev-priv_flags IFF_LIVE_ADDR_CHANGE) netif_running(dev)) - return -EBUSY; - if (!is_valid_ether_addr(addr-sa_data)) - return -EADDRNOTAVAIL; - memcpy(dev-dev_addr, addr-sa_data, ETH_ALEN); + ret = eth_prepare_mac_addr_change(dev, p); + if (ret 0) + return ret; + eth_commit_mac_addr_change(dev, p); return 0; } EXPORT_SYMBOL(eth_mac_addr); -- 1.7.1
[Qemu-devel] [PATCH 3/4] configure: silence pkg-config's check for curses
From: Vadim Evard v.e.ev...@gmail.com Signed-off-by: Vadim Evard v.e.ev...@gmail.com Signed-off-by: Stefan Hajnoczi stefa...@redhat.com --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 4ebb60d..6211db9 100755 --- a/configure +++ b/configure @@ -2039,7 +2039,7 @@ fi if test $mingw32 = yes ; then curses_list=-lpdcurses else -curses_list=-lncurses:-lcurses:$($pkg_config --libs ncurses) +curses_list=-lncurses:-lcurses:$($pkg_config --libs ncurses 2/dev/null) fi if test $curses != no ; then -- 1.8.1
Re: [Qemu-devel] [PATCH for-1.4 07/12] target-i386/cpu: Introduce apic_id_for_cpu() function
Am 17.01.2013 21:59, schrieb Eduardo Habkost: This function will be used by both the CPU initialization code and the fw_cfg table initialization code. Later this function will be updated to generate APIC IDs according to the CPU topology. Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- target-i386/cpu.c | 17 - target-i386/cpu.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index d1a14d5..d90789d 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2194,6 +2194,21 @@ void x86_cpu_realize(Object *obj, Error **errp) cpu_reset(CPU(cpu)); } +/* Calculates initial APIC ID for a specific CPU index + * + * Currently we need to be able to calculate the APIC ID from the CPU index + * alone (without requiring a CPU object), as the QEMU-Seabios interfaces have + * no concept of CPU index, and the NUMA tables on fw_cfg need the APIC ID of + * all CPUs up to max_cpus. + */ +uint32_t apic_id_for_cpu(unsigned int cpu_index) Can we rather make this x86_cpu_apic_id(X86CPU *cpu) to account for future changes to topology modelling? Andreas +{ +/* right now APIC ID == CPU index. this will eventually change to use + * the CPU topology configuration properly + */ +return cpu_index; +} + static void x86_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); @@ -2228,7 +2243,7 @@ static void x86_cpu_initfn(Object *obj) x86_cpuid_get_tsc_freq, x86_cpuid_set_tsc_freq, NULL, NULL, NULL); -env-cpuid_apic_id = cs-cpu_index; +env-cpuid_apic_id = apic_id_for_cpu(cs-cpu_index); /* init various static tables used in TCG mode */ if (tcg_enabled() !inited) { diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 9d4fcf9..d86c0af 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -1255,4 +1255,6 @@ void disable_kvm_pv_eoi(void); /* Return name of 32-bit register, from a R_* constant */ const char *get_register_name_32(unsigned int reg); +uint32_t apic_id_for_cpu(unsigned int cpu_index); + #endif /* CPU_I386_H */ -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
[Qemu-devel] [PULL for-1.4 0/4] Trivial patches for 16 to 21 January 2013
These fixes are for QEMU 1.4. The following changes since commit 8b17ed4caa7e015324a4ecbe3c863e32458d840a: Merge remote-tracking branch 'stefanha/block' into staging (2013-01-20 11:01:10 -0600) are available in the git repository at: git://github.com/stefanha/qemu.git trivial-patches for you to fetch changes up to 09a021fb7ceb7255ab106999d7b38ffd92c3bdd6: hw/tpci200: Fix compiler warning (redefined symbol with MinGW) (2013-01-21 11:39:15 +0100) Michael Tokarev (1): acpitable: open the data file in binary mode Stefan Weil (2): hw: Spelling fix in log message hw/tpci200: Fix compiler warning (redefined symbol with MinGW) Vadim Evard (1): configure: silence pkg-config's check for curses configure | 2 +- hw/acpi.c | 2 +- hw/openrisc_sim.c | 2 +- hw/tpci200.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) -- 1.8.1
Re: [Qemu-devel] [PATCH for-1.4 11/12] target-i386: Topology APIC ID utility functions
Am 17.01.2013 21:59, schrieb Eduardo Habkost: Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- Changes v1 - v2: - Support 32-bit APIC IDs (in case x2APIC is going to be used) - Coding style changes - Use TARGET_I386_TOPOLOGY_H instead of __QEMU_X86_TOPOLOGY_H__ - Rename topo_make_apic_id() to topo_apicid_for_cpu() - Rename __make_apicid() to topo_make_apicid() - Spaces around operators on test-x86-cpuid.c, as requested by Blue Swirl - Make test-x86-cpuid a target-specific test Changes v2 - v3: - Add documentation pointers to the code - Rename bits_for_count() to bitwidth_for_count() - Remove unused apicid_*_id() functions Changes v3 - v4: - Remove now-obsolete FIXME comment from test-x86-cpuid.c - Change bitops.h include to qemu/bitops.h - Add gcov file list to test-x86-cpuid --- target-i386/topology.h | 133 + tests/.gitignore | 1 + tests/Makefile | 7 +++ tests/test-x86-cpuid.c | 101 + 4 files changed, 242 insertions(+) create mode 100644 target-i386/topology.h create mode 100644 tests/test-x86-cpuid.c diff --git a/target-i386/topology.h b/target-i386/topology.h new file mode 100644 index 000..833ab47 --- /dev/null +++ b/target-i386/topology.h @@ -0,0 +1,133 @@ +/* + * x86 CPU topology data structures and functions + * + * Copyright (c) 2012 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the Software), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef TARGET_I386_TOPOLOGY_H +#define TARGET_I386_TOPOLOGY_H + +/* This file implements the APIC-ID-based CPU topology enumeration logic, + * documented at the following document: + * Intel® 64 Architecture Processor Topology Enumeration + * http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/ + * + * This code should be compatible with AMD's Extended Method described at: + * AMD CPUID Specification (Publication #25481) + * Section 3: Multiple Core Calcuation + * as long as: + * nr_threads is set to 1; + * OFFSET_IDX is assumed to be 0; + * CPUID Fn8000_0008_ECX[ApicIdCoreIdSize[3:0]] is set to apicid_core_width(). + */ + +#include stdint.h +#include string.h + +#include qemu/bitops.h + +/* APIC IDs can be 32-bit, but beware: APIC IDs 255 require x2APIC support + */ +typedef uint32_t apic_id_t; Is this file imported from somewhere? There was a discussion some time ago about not using _t since reserved by POSIX... + +/* Return the bit width needed for 'count' IDs + */ +static unsigned bitwidth_for_count(unsigned count) +{ +g_assert(count = 1); +if (count == 1) { +return 0; +} +return bitops_flsl(count - 1) + 1; +} + +/* Bit width of the SMT_ID (thread ID) field on the APIC ID + */ +static inline unsigned apicid_smt_width(unsigned nr_cores, unsigned nr_threads) +{ +return bitwidth_for_count(nr_threads); +} + +/* Bit width of the Core_ID field + */ +static inline unsigned apicid_core_width(unsigned nr_cores, unsigned nr_threads) +{ +return bitwidth_for_count(nr_cores); +} + +/* Bit offset of the Core_ID field + */ +static inline unsigned apicid_core_offset(unsigned nr_cores, + unsigned nr_threads) +{ +return apicid_smt_width(nr_cores, nr_threads); +} + +/* Bit offset of the Pkg_ID (socket ID) field + */ +static inline unsigned apicid_pkg_offset(unsigned nr_cores, unsigned nr_threads) +{ +return apicid_core_offset(nr_cores, nr_threads) + \ Not a macro. :) + apicid_core_width(nr_cores, nr_threads); +} + +/* Make APIC ID for the CPU based on Pkg_ID, Core_ID, SMT_ID + * + * The caller must make sure core_id nr_cores and smt_id nr_threads. + */ +static inline apic_id_t topo_make_apicid(unsigned nr_cores, +
Re: [Qemu-devel] [PATCH for-1.4 07/12] target-i386/cpu: Introduce apic_id_for_cpu() function
On Mon, Jan 21, 2013 at 12:18:55PM +0100, Andreas Färber wrote: Am 17.01.2013 21:59, schrieb Eduardo Habkost: This function will be used by both the CPU initialization code and the fw_cfg table initialization code. Later this function will be updated to generate APIC IDs according to the CPU topology. Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- target-i386/cpu.c | 17 - target-i386/cpu.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index d1a14d5..d90789d 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2194,6 +2194,21 @@ void x86_cpu_realize(Object *obj, Error **errp) cpu_reset(CPU(cpu)); } +/* Calculates initial APIC ID for a specific CPU index + * + * Currently we need to be able to calculate the APIC ID from the CPU index + * alone (without requiring a CPU object), as the QEMU-Seabios interfaces have + * no concept of CPU index, and the NUMA tables on fw_cfg need the APIC ID of + * all CPUs up to max_cpus. + */ +uint32_t apic_id_for_cpu(unsigned int cpu_index) Can we rather make this x86_cpu_apic_id(X86CPU *cpu) to account for future changes to topology modelling? We can't make it get a X86CPU as parameter, because the ACPI tables have to be built up to max_cpus, before the CPUs get actually created. But it can be renamed, yes. -- Eduardo
[Qemu-devel] [PATCH 1/4] hw: Spelling fix in log message
From: Stefan Weil s...@weilnetz.de defineition - definition Signed-off-by: Stefan Weil s...@weilnetz.de Reviewed-by: Andreas F=E4rber afaer...@suse.de Signed-off-by: Stefan Hajnoczi stefa...@redhat.com --- hw/openrisc_sim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/openrisc_sim.c b/hw/openrisc_sim.c index fb47cdc..6c443ba 100644 --- a/hw/openrisc_sim.c +++ b/hw/openrisc_sim.c @@ -107,7 +107,7 @@ static void openrisc_sim_init(QEMUMachineInitArgs *args) for (n = 0; n smp_cpus; n++) { cpu = cpu_openrisc_init(cpu_model); if (cpu == NULL) { -qemu_log(Unable to find CPU defineition!\n); +qemu_log(Unable to find CPU definition!\n); exit(1); } qemu_register_reset(main_cpu_reset, cpu); -- 1.8.1
Re: [Qemu-devel] [PATCH v2 09/12] mirror: switch mirror_iteration to AIO
Am 16.01.2013 18:31, schrieb Paolo Bonzini: There is really no change in the behavior of the job here, since there is still a maximum of one in-flight I/O operation between the source and the target. However, this patch already introduces the AIO callbacks (which are unmodified in the next patch) and some of the logic to count in-flight operations and only complete the job when there is none. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- block/mirror.c | 155 ++-- trace-events |2 + 2 files changed, 119 insertions(+), 38 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index ab41340..75c550a 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -33,8 +33,19 @@ typedef struct MirrorBlockJob { unsigned long *cow_bitmap; HBitmapIter hbi; uint8_t *buf; + +int in_flight; +int ret; } MirrorBlockJob; +typedef struct MirrorOp { +MirrorBlockJob *s; +QEMUIOVector qiov; +struct iovec iov; +int64_t sector_num; +int nb_sectors; +} MirrorOp; + static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, int error) { @@ -48,15 +59,60 @@ static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, } } -static int coroutine_fn mirror_iteration(MirrorBlockJob *s, - BlockErrorAction *p_action) +static void mirror_iteration_done(MirrorOp *op) +{ +MirrorBlockJob *s = op-s; + +s-in_flight--; +trace_mirror_iteration_done(s, op-sector_num, op-nb_sectors); +g_slice_free(MirrorOp, op); +qemu_coroutine_enter(s-common.co, NULL); This doesn't check if the job coroutine is actually in a state where it's valid to reenter. Technically it might even be okay because reentering during a sleep is allowed and as good as reentering during the new yield, and bdrv_flush() is only called if s-in_flight == 0. Most other calls _should_ be okay as well, but I'm not so sure about bdrv_drain_all(), especially once .bdrv_drain exists. As you can see, this is becoming very subtle, so I would prefer adding some explicit bool s-may_reenter or something like that. +} @@ -177,28 +233,43 @@ static void coroutine_fn mirror_run(void *opaque) } bdrv_dirty_iter_init(bs, s-hbi); +last_pause_ns = qemu_get_clock_ns(rt_clock); for (;;) { uint64_t delay_ns; int64_t cnt; bool should_complete; +if (s-ret 0) { +ret = s-ret; +break; +} + cnt = bdrv_get_dirty_count(bs); -if (cnt != 0) { -BlockErrorAction action = BDRV_ACTION_REPORT; -ret = mirror_iteration(s, action); -if (ret 0 action == BDRV_ACTION_REPORT) { -goto immediate_exit; + +/* Note that even when no rate limit is applied we need to yield + * periodically with no pending I/O so that qemu_aio_flush() returns. + * We do so every SLICE_TIME milliseconds, or when there is an error, s/milli/nano/ + * or when the source is clean, whichever comes first. + */ +if (qemu_get_clock_ns(rt_clock) - last_pause_ns SLICE_TIME +s-common.iostatus == BLOCK_DEVICE_IO_STATUS_OK) { +if (s-in_flight 0) { +trace_mirror_yield(s, s-in_flight, cnt); +qemu_coroutine_yield(); +continue; +} else if (cnt != 0) { +mirror_iteration(s); +continue; } -cnt = bdrv_get_dirty_count(bs); } should_complete = false; -if (cnt == 0) { +if (s-in_flight == 0 cnt == 0) { trace_mirror_before_flush(s); ret = bdrv_flush(s-target); if (ret 0) { if (mirror_error_action(s, false, -ret) == BDRV_ACTION_REPORT) { -goto immediate_exit; +break; Is this an unrelated change? } } else { /* We're out of the streaming phase. From now on, if the job @@ -244,15 +315,12 @@ static void coroutine_fn mirror_run(void *opaque) delay_ns = 0; } -/* Note that even when no rate limit is applied we need to yield - * with no pending I/O here so that bdrv_drain_all() returns. - */ block_job_sleep_ns(s-common, rt_clock, delay_ns); if (block_job_is_cancelled(s-common)) { break; } } else if (!should_complete) { -delay_ns = (cnt == 0 ? SLICE_TIME : 0); +delay_ns = (s-in_flight == 0 cnt == 0 ? SLICE_TIME : 0); block_job_sleep_ns(s-common, rt_clock, delay_ns); } else if (cnt == 0) { Why don't we
[Qemu-devel] [PATCH v5 3/3] virtio-net: introduce a new control to set macaddr
Currently we write MAC address to pci config space byte by byte, this means that we have an intermediate step where mac is wrong. This patch introduced a new control command to set MAC address, it's atomic. VIRTIO_NET_F_CTRL_MAC_ADDR is a new feature bit for compatibility. Signed-off-by: Amos Kong ak...@redhat.com --- drivers/net/virtio_net.c| 21 ++--- include/uapi/linux/virtio_net.h |8 +++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 395ab4f..701408a 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -802,14 +802,28 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p) struct virtnet_info *vi = netdev_priv(dev); struct virtio_device *vdev = vi-vdev; int ret; + struct sockaddr *addr = p; + struct scatterlist sg; - ret = eth_mac_addr(dev, p); + ret = eth_prepare_mac_addr_change(dev, p); if (ret) return ret; - if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) + if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) { + sg_init_one(sg, addr-sa_data, dev-addr_len); + if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, + VIRTIO_NET_CTRL_MAC_ADDR_SET, + sg, 1, 0)) { + dev_warn(vdev-dev, +Failed to set mac address by vq command.\n); + return -EINVAL; + } + } else if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) { vdev-config-set(vdev, offsetof(struct virtio_net_config, mac), - dev-dev_addr, dev-addr_len); + addr-sa_data, dev-addr_len); + } + + eth_commit_mac_addr_change(dev, p); return 0; } @@ -1627,6 +1641,7 @@ static unsigned int features[] = { VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, + VIRTIO_NET_F_CTRL_MAC_ADDR, }; static struct virtio_driver virtio_net_driver = { diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h index 848e358..a5a8c88 100644 --- a/include/uapi/linux/virtio_net.h +++ b/include/uapi/linux/virtio_net.h @@ -53,6 +53,7 @@ * network */ #define VIRTIO_NET_F_MQ22 /* Device supports Receive Flow * Steering */ +#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ #define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ @@ -127,7 +128,7 @@ typedef __u8 virtio_net_ctrl_ack; #define VIRTIO_NET_CTRL_RX_NOBCAST 5 /* - * Control the MAC filter table. + * Control the MAC * * The MAC filter table is managed by the hypervisor, the guest should * assume the size is infinite. Filtering should be considered @@ -140,6 +141,10 @@ typedef __u8 virtio_net_ctrl_ack; * first sg list contains unicast addresses, the second is for multicast. * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature * is available. + * + * The ADDR_SET command requests one out scatterlist, it contains a + * 6 bytes MAC address. This functionality is present if the + * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available. */ struct virtio_net_ctrl_mac { __u32 entries; @@ -148,6 +153,7 @@ struct virtio_net_ctrl_mac { #define VIRTIO_NET_CTRL_MAC1 #define VIRTIO_NET_CTRL_MAC_TABLE_SET0 + #define VIRTIO_NET_CTRL_MAC_ADDR_SET 1 /* * Control VLAN filtering -- 1.7.1
Re: [Qemu-devel] [RFC V5 20/36] qcow2: Drop hash for a given cluster when dedup makes refcount 2^16/2.
You are hardcoding to a width of 16 bits; however, version 3 makes the refcount field variable-sized: 96 - 99: refcount_order Describes the width of a reference count block entry (width in bits = 1 refcount_order). For version 2 images, the order is always assumed to be 4 (i.e. the width is 16 bits). Currently the qcow2 code doesn't support anything but refcount_order == 4. In qcow2.c qcow_open there is: be32_to_cpus(header.refcount_order); to get the qcow2 order followed by: /* Check support for various header values */ if (header.refcount_order != 4) { report_unsupported(bs, %d bit reference counts, 1 header.refcount_order); ret = -ENOTSUP; goto fail; } I guess the code doesn't need any special handling for now. Hmm, what happens if refcount_order is 0 to disable reference counting? That setting is valid for creating a qcow2 file that can't be used for internal snapshots. But it also interferes with dedup; so you probably want to add some additional requirements in the spec (patch 1/36) that when dedup is in use, refcount_order must be a minimum value (or require that it be exactly 4, for a width of 16 bits). I'll do that. Regards Benoît
Re: [Qemu-devel] [PATCH 3/3] docs: document virtio-balloon stats
On Fri, 18 Jan 2013 13:00:28 -0700 Eric Blake ebl...@redhat.com wrote: On 01/18/2013 12:29 PM, Luiz Capitulino wrote: Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- docs/virtio-balloon-stats.txt | 102 ++ 1 file changed, 102 insertions(+) create mode 100644 docs/virtio-balloon-stats.txt + + o A key named 'stats', containing all avaiable stats. If the guest s/avaiable/available/ OK. +doesn't support a particular stat, its value will be -1. Currently, +the following stats are supported: + + - stat-swap-in + - stat-swap-out + - stat-major-faults + - stat-minor-faults + - stat-free-memory + - stat-total-memory + + o A key named last-update, which contains the last stats update +timestamp in seconds Is it worth mentioning that this is a timestamp relative to the Unix epoch? For that matter, does it even matter what the timestamp is relative to, or just that it increases when a new poll completes? Yes, I think this field is only important to calculate the delta between updates. Is it worth mentioning that the timestamp is computed by the host (that is, a broken guest can't fake the timestamp, even if it can provide bogus data for all the stats)? I can mention that. + + - As noted above, if a guest doesn't support a particular stat it + will always be -1. However, it's also possible that a guest couldn't + temporarily update one or even all stats. If this happens, just wait s/couldn't temporarily/temporarily couldn't/ OK. + +Here are a few examples. The virtio-balloon device is assumed to be in the +'/machine/peripheral-anon/device[1]' QOM path. Is this QOM path stable, or can it change depending on target architecture and/or command-line arguments used to install the guest? I think it can change. It might be worth showing which command line arguments set up this particular QOM path. Will do.
Re: [Qemu-devel] [PATCH v9 1/5] Adding utility function net_checksum_add_cont() that allows checksum calculation of scattered data with odd chunk sizes
Fixed. Thanks. On Wed, Jan 16, 2013 at 4:27 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Sat, Jan 12, 2013 at 06:09:42PM +0200, Dmitry Fleytman wrote: +static inline uint32_t +net_checksum_add(int len, uint8_t *buf) +{ +return net_checksum_add_cont(len, buf, 0); +} + +static inline uint16_t +net_raw_checksum(uint8_t *data, int length) +{ + return net_checksum_finish(net_checksum_add(length, data)); +} 4-space indentation. Don't bother resending because of this, it can be fixed when merging the patch. Stefan -- Dmitry Fleytman Technology Expert and Consultant, Daynix Computing Ltd. Cell: +972-54-2819481 Skype: dmitry.fleytman
[Qemu-devel] [PATCH v2] qemu-pixman.h: Avoid mutual inclusion loop with console.h
Remove an unnecessary mutual inclusion loop between qemu-pixman.h and console.h, since the former was only including the latter for 'PixelFormat*', which can be provided by typedefs.h. This requires a minor adjustment to the files which included qemu-pixman.h, since they were relying on it implicitly dragging in all of console.h. Signed-off-by: Peter Maydell peter.mayd...@linaro.org --- Stefan: I've made the obvious change to fix the spice compile issue, but none of my systems have a new enough spice-protocol/spice-server to allow me to configure with spice enabled. I'd appreciate it if you could check it does indeed compile OK now... include/ui/qemu-pixman.h |2 +- include/ui/spice-display.h |1 + ui/qemu-pixman.c |3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index 016fd87..b032f52 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -15,7 +15,7 @@ #pragma GCC diagnostic error -Wredundant-decls #endif -#include console.h +#include qemu/typedefs.h /* * pixman image formats are defined to be native endian, diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index 8b192e9..46f9530 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -21,6 +21,7 @@ #include qemu/thread.h #include ui/qemu-pixman.h +#include ui/console.h #include sysemu/sysemu.h #define NUM_MEMSLOTS 8 diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c index 609335a..6dcbe90 100644 --- a/ui/qemu-pixman.c +++ b/ui/qemu-pixman.c @@ -3,7 +3,8 @@ * See the COPYING file in the top-level directory. */ -#include ui/qemu-pixman.h +#include qemu-common.h +#include ui/console.h int qemu_pixman_get_type(int rshift, int gshift, int bshift) { -- 1.7.9.5
Re: [Qemu-devel] [PATCH v9 5/5] Adding VMXNET3 device implementation
On Wed, Jan 16, 2013 at 5:16 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Sat, Jan 12, 2013 at 06:09:46PM +0200, Dmitry Fleytman wrote: @@ -113,6 +113,8 @@ common-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o common-obj-$(CONFIG_PCNET_COMMON) += pcnet.o common-obj-$(CONFIG_E1000_PCI) += e1000.o common-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o +common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o +common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet_tx_pkt.o vmxnet_rx_pkt.o The objects can already be built in the earlier patch so clean compilation can be tested. Please move this to the patch that introduces these .c files. Done. +static void vmxnet3_reset(VMXNET3State *s) +{ +VMW_CBPRN(Resetting vmxnet3...); + +vmxnet_tx_pkt_reset(s-tx_pkt); +s-tx_sop = true; +s-skip_current_tx_pkt = false; Not much is reset here? Clear rx mac filtering and reset MAC address? Reset drv_shmem? Reset drv_shmem, MAC address and a number of other fields added. Also state machine switched to inactive state on reset. All context fields that being filled atomically with device activation left as-is to avoid code/logic duplication. +static void vmxnet3_net_init(VMXNET3State *s) +{ +VMW_CBPRN(vmxnet3_net_init called...); + +qemu_macaddr_default_if_unset(s-conf.macaddr); + +/* Windows guest will query the address that was set on init */ +memcpy(s-perm_mac.a, s-conf.macaddr.a, sizeof(s-perm_mac.a)); + +s-mcast_list = NULL; +s-mcast_list_len = 0; + +s-link_status_and_speed = VMXNET3_LINK_SPEED | VMXNET3_LINK_STATUS_UP; + +VMW_CFPRN(Permanent MAC: MAC_FMT, MAC_ARG(s-perm_mac.a)); + +s-nic = qemu_new_nic(net_vmxnet3_info, s-conf, + object_get_typename(OBJECT(s)), + s-dev.qdev.id, s); Missing qemu_del_net_client() to free s-nic in this file. Un-init sequence amended. Thanks for pointing out. +static void vmxnet3_get_tx_stats_from_file(QEMUFile *f, +struct UPT1_TxStats *tx_stat) +{ + tx_stat-TSOPktsTxOK = qemu_get_be64(f); + tx_stat-TSOBytesTxOK = qemu_get_be64(f); + tx_stat-ucastPktsTxOK = qemu_get_be64(f); + tx_stat-ucastBytesTxOK = qemu_get_be64(f); + tx_stat-mcastPktsTxOK = qemu_get_be64(f); + tx_stat-mcastBytesTxOK = qemu_get_be64(f); + tx_stat-bcastPktsTxOK = qemu_get_be64(f); + tx_stat-bcastBytesTxOK = qemu_get_be64(f); + tx_stat-pktsTxError = qemu_get_be64(f); + tx_stat-pktsTxDiscard = qemu_get_be64(f); +} 4-space indentation. + +static void vmxnet3_put_tx_stats_to_file(QEMUFile *f, +struct UPT1_TxStats *tx_stat) +{ + qemu_put_be64(f, tx_stat-TSOPktsTxOK); + qemu_put_be64(f, tx_stat-TSOBytesTxOK); + qemu_put_be64(f, tx_stat-ucastPktsTxOK); + qemu_put_be64(f, tx_stat-ucastBytesTxOK); + qemu_put_be64(f, tx_stat-mcastPktsTxOK); + qemu_put_be64(f, tx_stat-mcastBytesTxOK); + qemu_put_be64(f, tx_stat-bcastPktsTxOK); + qemu_put_be64(f, tx_stat-bcastBytesTxOK); + qemu_put_be64(f, tx_stat-pktsTxError); + qemu_put_be64(f, tx_stat-pktsTxDiscard); +} 4-space indentation. +static void vmxnet3_get_rx_stats_from_file(QEMUFile *f, +struct UPT1_RxStats *rx_stat) +{ + rx_stat-LROPktsRxOK = qemu_get_be64(f); + rx_stat-LROBytesRxOK = qemu_get_be64(f); + rx_stat-ucastPktsRxOK = qemu_get_be64(f); + rx_stat-ucastBytesRxOK = qemu_get_be64(f); + rx_stat-mcastPktsRxOK = qemu_get_be64(f); + rx_stat-mcastBytesRxOK = qemu_get_be64(f); + rx_stat-bcastPktsRxOK = qemu_get_be64(f); + rx_stat-bcastBytesRxOK = qemu_get_be64(f); + rx_stat-pktsRxOutOfBuf = qemu_get_be64(f); + rx_stat-pktsRxError = qemu_get_be64(f); 4-space indentation. +} + +static void vmxnet3_put_rx_stats_to_file(QEMUFile *f, +struct UPT1_RxStats *rx_stat) +{ + qemu_put_be64(f, rx_stat-LROPktsRxOK); + qemu_put_be64(f, rx_stat-LROBytesRxOK); + qemu_put_be64(f, rx_stat-ucastPktsRxOK); + qemu_put_be64(f, rx_stat-ucastBytesRxOK); + qemu_put_be64(f, rx_stat-mcastPktsRxOK); + qemu_put_be64(f, rx_stat-mcastBytesRxOK); + qemu_put_be64(f, rx_stat-bcastPktsRxOK); + qemu_put_be64(f, rx_stat-bcastBytesRxOK); + qemu_put_be64(f, rx_stat-pktsRxOutOfBuf); + qemu_put_be64(f, rx_stat-pktsRxError); 4-space indentation. Indentation verified and fixed everywhere. -- Dmitry Fleytman Technology Expert and Consultant, Daynix Computing Ltd. Cell: +972-54-2819481 Skype: dmitry.fleytman
Re: [Qemu-devel] [PATCH v9 4/5] Adding packet abstraction for VMWARE network devices
On Thu, Jan 17, 2013 at 12:24 PM, Stefan Hajnoczi stefa...@gmail.comwrote: On Wed, Jan 16, 2013 at 04:33:48PM +0100, Paolo Bonzini wrote: Il 16/01/2013 15:48, Stefan Hajnoczi ha scritto: hw/vmxnet_rx_pkt.c | 187 ++ hw/vmxnet_rx_pkt.h | 173 hw/vmxnet_tx_pkt.c | 567 + hw/vmxnet_tx_pkt.h | 148 ++ 4 files changed, 1075 insertions(+) create mode 100644 hw/vmxnet_rx_pkt.c create mode 100644 hw/vmxnet_rx_pkt.h create mode 100644 hw/vmxnet_tx_pkt.c create mode 100644 hw/vmxnet_tx_pkt.h There are other VMware-specific hw/ files. Please create hw/vmware/ and put source files in there without the prefix. Check hw/pci/ or other subdirectories for how to setup Makefile.objs, it's pretty simple. I don't think we have enough plans for hw/ structure to create directories yet. What we have so far is basically hw/arch and hw/bus, so the logic would be to have hw/net (also mimicking Linux's drivers/net directory). It's premature to create hw/vmware, we risk getting a spaghetti directory structure. Okay, let's leave the hw/ sub-directory for a future hw/-wide cleanup series that moves all device emulation code. eth.c/eth.h sound more interesting. Could they be used by host-side code (e.g. SLIRP or a TAP backend)? If so, they belong in net/ and include/net. If not, they belong in hw/ (waiting for hw/net to be created). Yes, they can be used by host (backend) code. Stefan eth.* moved to include/net and net -- Dmitry Fleytman Technology Expert and Consultant, Daynix Computing Ltd. Cell: +972-54-2819481 Skype: dmitry.fleytman
Re: [Qemu-devel] [PATCH v2 09/12] mirror: switch mirror_iteration to AIO
Il 21/01/2013 12:39, Kevin Wolf ha scritto: Am 16.01.2013 18:31, schrieb Paolo Bonzini: There is really no change in the behavior of the job here, since there is still a maximum of one in-flight I/O operation between the source and the target. However, this patch already introduces the AIO callbacks (which are unmodified in the next patch) and some of the logic to count in-flight operations and only complete the job when there is none. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- block/mirror.c | 155 ++-- trace-events |2 + 2 files changed, 119 insertions(+), 38 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index ab41340..75c550a 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -33,8 +33,19 @@ typedef struct MirrorBlockJob { unsigned long *cow_bitmap; HBitmapIter hbi; uint8_t *buf; + +int in_flight; +int ret; } MirrorBlockJob; +typedef struct MirrorOp { +MirrorBlockJob *s; +QEMUIOVector qiov; +struct iovec iov; +int64_t sector_num; +int nb_sectors; +} MirrorOp; + static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, int error) { @@ -48,15 +59,60 @@ static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, } } -static int coroutine_fn mirror_iteration(MirrorBlockJob *s, - BlockErrorAction *p_action) +static void mirror_iteration_done(MirrorOp *op) +{ +MirrorBlockJob *s = op-s; + +s-in_flight--; +trace_mirror_iteration_done(s, op-sector_num, op-nb_sectors); +g_slice_free(MirrorOp, op); +qemu_coroutine_enter(s-common.co, NULL); This doesn't check if the job coroutine is actually in a state where it's valid to reenter. Technically it might even be okay because reentering during a sleep is allowed and as good as reentering during the new yield, and bdrv_flush() is only called if s-in_flight == 0. Most other calls _should_ be okay as well, but I'm not so sure about bdrv_drain_all(), especially once .bdrv_drain exists. bdrv_drain_all is also called only if s-in_flight == 0 too, but I see your point. It is indeed quite subtle, but it's okay. As you can see, this is becoming very subtle, so I would prefer adding some explicit bool s-may_reenter or something like that. The right boolean to test is already there, it's job-busy. I can add a new API block_job_yield/block_job_enter (where block_job_yield resets/sets busy across the yield, and block_job_enter only enters if !job-busy), but that would be a separate series IMO. +} @@ -177,28 +233,43 @@ static void coroutine_fn mirror_run(void *opaque) } bdrv_dirty_iter_init(bs, s-hbi); +last_pause_ns = qemu_get_clock_ns(rt_clock); for (;;) { uint64_t delay_ns; int64_t cnt; bool should_complete; +if (s-ret 0) { +ret = s-ret; +break; +} + cnt = bdrv_get_dirty_count(bs); -if (cnt != 0) { -BlockErrorAction action = BDRV_ACTION_REPORT; -ret = mirror_iteration(s, action); -if (ret 0 action == BDRV_ACTION_REPORT) { -goto immediate_exit; + +/* Note that even when no rate limit is applied we need to yield + * periodically with no pending I/O so that qemu_aio_flush() returns. + * We do so every SLICE_TIME milliseconds, or when there is an error, s/milli/nano/ + * or when the source is clean, whichever comes first. + */ +if (qemu_get_clock_ns(rt_clock) - last_pause_ns SLICE_TIME +s-common.iostatus == BLOCK_DEVICE_IO_STATUS_OK) { +if (s-in_flight 0) { +trace_mirror_yield(s, s-in_flight, cnt); +qemu_coroutine_yield(); +continue; +} else if (cnt != 0) { +mirror_iteration(s); +continue; } -cnt = bdrv_get_dirty_count(bs); } should_complete = false; -if (cnt == 0) { +if (s-in_flight == 0 cnt == 0) { trace_mirror_before_flush(s); ret = bdrv_flush(s-target); if (ret 0) { if (mirror_error_action(s, false, -ret) == BDRV_ACTION_REPORT) { -goto immediate_exit; +break; Is this an unrelated change? Seems like a rebase hiccup. Doesn't have any semantic change, I'll drop it. } } else { /* We're out of the streaming phase. From now on, if the job @@ -244,15 +315,12 @@ static void coroutine_fn mirror_run(void *opaque) delay_ns = 0; } -/* Note that even when no rate limit is applied we need to yield -
Re: [Qemu-devel] [PATCH 1/5] target-i386: print deprecated warning if xlevel 0x80000000
On Mon, 21 Jan 2013 09:39:07 +0100 Andreas Färber afaer...@suse.de wrote: Am 17.01.2013 16:16, schrieb Igor Mammedov: Signed-off-by: Igor Mammedov imamm...@redhat.com Reviewed-by: Eduardo Habkost ehabk...@redhat.com --- target-i386/cpu.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 333745b..ce914da 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1399,6 +1399,8 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features) goto error; } if (numvalue 0x80 00) { +fprintf(stderr, xlevel value shall always be = 0x8000 +, fixup will be deprecated in future versions\n); numvalue += 0x8000; } x86_cpu_def-xlevel = numvalue; This has been reviewed without objections so far, so I would apply it for 1.4. Either way you should document this intent for users already: http://wiki.qemu.org/ChangeLog/1.4 Would be something like this suitable: xlevel argument for -cpu option, currently fix-ups it's value if it's less than 0x8000. Fix-up will be removed in QEMU 1.6 release and users are expected to provide valid xlevel value or qemu will fail to start. We had such discussions before, around removing cpudef support. When do you plan to remove this, and being deprecated, shouldn't it rather read fixup will be removed in future versions? ;) If it fits within 80 chars I can edit it myself. No need for it, I'll fix it and respin series. Cheers, Andreas Thanks, Igor
Re: [Qemu-devel] [PATCH v2 09/12] mirror: switch mirror_iteration to AIO
Am 21.01.2013 13:09, schrieb Paolo Bonzini: Il 21/01/2013 12:39, Kevin Wolf ha scritto: Am 16.01.2013 18:31, schrieb Paolo Bonzini: There is really no change in the behavior of the job here, since there is still a maximum of one in-flight I/O operation between the source and the target. However, this patch already introduces the AIO callbacks (which are unmodified in the next patch) and some of the logic to count in-flight operations and only complete the job when there is none. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- block/mirror.c | 155 ++-- trace-events |2 + 2 files changed, 119 insertions(+), 38 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index ab41340..75c550a 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -33,8 +33,19 @@ typedef struct MirrorBlockJob { unsigned long *cow_bitmap; HBitmapIter hbi; uint8_t *buf; + +int in_flight; +int ret; } MirrorBlockJob; +typedef struct MirrorOp { +MirrorBlockJob *s; +QEMUIOVector qiov; +struct iovec iov; +int64_t sector_num; +int nb_sectors; +} MirrorOp; + static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, int error) { @@ -48,15 +59,60 @@ static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, } } -static int coroutine_fn mirror_iteration(MirrorBlockJob *s, - BlockErrorAction *p_action) +static void mirror_iteration_done(MirrorOp *op) +{ +MirrorBlockJob *s = op-s; + +s-in_flight--; +trace_mirror_iteration_done(s, op-sector_num, op-nb_sectors); +g_slice_free(MirrorOp, op); +qemu_coroutine_enter(s-common.co, NULL); This doesn't check if the job coroutine is actually in a state where it's valid to reenter. Technically it might even be okay because reentering during a sleep is allowed and as good as reentering during the new yield, and bdrv_flush() is only called if s-in_flight == 0. Most other calls _should_ be okay as well, but I'm not so sure about bdrv_drain_all(), especially once .bdrv_drain exists. bdrv_drain_all is also called only if s-in_flight == 0 too, but I see your point. It is indeed quite subtle, but it's okay. Ah, yes, that's the part I missed. Looks correct indeed. As you can see, this is becoming very subtle, so I would prefer adding some explicit bool s-may_reenter or something like that. The right boolean to test is already there, it's job-busy. I can add a new API block_job_yield/block_job_enter (where block_job_yield resets/sets busy across the yield, and block_job_enter only enters if !job-busy), but that would be a separate series IMO. Please put it on your todo list then. I think I can accept the current state if I know that it will be improved soon, even though I'm not very comfortable with it. Kevin
Re: [Qemu-devel] [PATCH v9 3/5] Adding common definitions for VMWARE devices
Hello Stefan I've checked origin of headers, some of them are self-made, other came from following places: 1. file rtl8139.c from QEMU codebase 2. /usr/include/netinet/ip6.h from glibc 3. /usr/include/netinet/in.h from glibc How should we indicate this? Should we add something like: Portions developed by Free Software Foundation, Inc Copyright (C) 1991-1997, 2001, 2003, 2006 Free Software Foundation, Inc. Portions developed by Igor Kovalenko Copyright (c) 2006 Igor Kovalenko Is it enough? Thanks for advice, Dmitry. On Wed, Jan 16, 2013 at 5:24 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Sat, Jan 12, 2013 at 06:09:44PM +0200, Dmitry Fleytman wrote: diff --git a/eth.c b/eth.c new file mode 100644 index 000..a591ee5 --- /dev/null +++ b/eth.c @@ -0,0 +1,219 @@ +/* + * QEMU network structures definitions and helper functions + * + * Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com) + * + * Developed by Daynix Computing LTD (http://www.daynix.com) + * + * Authors: + * Dmitry Fleytman dmi...@daynix.com + * Tamir Shomer tam...@daynix.com + * Yan Vugenfirer y...@daynix.com + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +//#include hw.h Please remove this commented-out line. diff --git a/include/qemu/eth.h b/include/qemu/eth.h new file mode 100644 index 000..b806fb4 --- /dev/null +++ b/include/qemu/eth.h @@ -0,0 +1,338 @@ +/* + * QEMU network structures definitions and helper functions + * + * Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com) + * + * Developed by Daynix Computing LTD (http://www.daynix.com) + * + * Authors: + * Dmitry Fleytman dmi...@daynix.com + * Tamir Shomer tam...@daynix.com + * Yan Vugenfirer y...@daynix.com + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ Please indicate where these header definitions come from and how they are licensed. -- Dmitry Fleytman Technology Expert and Consultant, Daynix Computing Ltd. Cell: +972-54-2819481 Skype: dmitry.fleytman
[Qemu-devel] [PATCH v2 09/12] qdev: inline object_delete into qbus_free/qdev_free
We want object_delete to disappear, and we will do this one class at a time. Inline it for the qdev case, which we will tackle first. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- hw/qdev.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 24bb19a..e65b32f 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -267,7 +267,8 @@ void qdev_init_nofail(DeviceState *dev) /* Unlink device from bus and free the structure. */ void qdev_free(DeviceState *dev) { -object_delete(OBJECT(dev)); +object_unparent(OBJECT(dev)); +object_unref(OBJECT(dev)); } void qdev_machine_creation_done(void) @@ -472,7 +473,8 @@ BusState *qbus_create(const char *typename, DeviceState *parent, const char *nam void qbus_free(BusState *bus) { -object_delete(OBJECT(bus)); +object_unparent(OBJECT(bus)); +object_unref(OBJECT(bus)); } static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev) -- 1.8.1
[Qemu-devel] [PATCH v2 08/12] qdev: add reference for the bus while it is referred to by the DeviceState
Now that the unparent callbacks are complete, we can correctly account more missing references. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- hw/qdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/qdev.c b/hw/qdev.c index aad360f..24bb19a 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -100,6 +100,7 @@ static void bus_add_child(BusState *bus, DeviceState *child) void qdev_set_parent_bus(DeviceState *dev, BusState *bus) { dev-parent_bus = bus; +object_ref(OBJECT(bus)); bus_add_child(bus, dev); } @@ -773,6 +774,8 @@ static void device_unparent(Object *obj) } if (dev-parent_bus) { bus_remove_child(dev-parent_bus, dev); +object_unref(OBJECT(dev-parent_bus)); +dev-parent_bus = NULL; } } -- 1.8.1
[Qemu-devel] [PATCH v2 04/12] qom: document reference counting of link properties
Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- include/qom/object.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 8e16ea8..5e8e528 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1033,6 +1033,11 @@ void object_property_add_child(Object *obj, const char *name, * between objects. * * Links form the graph in the object model. + * + * Ownership of the pointer that @child points to is transferred to the + * link property. The reference count for code*@child/code is + * managed by the property from after the function returns till the + * property is deleted with object_property_del(). */ void object_property_add_link(Object *obj, const char *name, const char *type, Object **child, -- 1.8.1
[Qemu-devel] [PATCH v2 12/12] qom: remove object_delete
This is now unused. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- include/qom/object.h | 17 ++--- qom/object.c | 7 --- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 5e8e528..2ac35a5 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -553,9 +553,7 @@ struct InterfaceClass * object_new: * @typename: The name of the type of the object to instantiate. * - * This function will initialize a new object using heap allocated memory. This - * function should be paired with object_delete() to free the resources - * associated with the object. + * This function will initialize a new object using heap allocated memory. * * Returns: The newly allocated and instantiated object. */ @@ -565,24 +563,13 @@ Object *object_new(const char *typename); * object_new_with_type: * @type: The type of the object to instantiate. * - * This function will initialize a new object using heap allocated memory. This - * function should be paired with object_delete() to free the resources - * associated with the object. + * This function will initialize a new object using heap allocated memory. * * Returns: The newly allocated and instantiated object. */ Object *object_new_with_type(Type type); /** - * object_delete: - * @obj: The object to free. - * - * Finalize an object and then free the memory associated with it. This should - * be paired with object_new() to free the resources associated with an object. - */ -void object_delete(Object *obj); - -/** * object_initialize_with_type: * @obj: A pointer to the memory to be used for the object. * @type: The type of the object to instantiate. diff --git a/qom/object.c b/qom/object.c index 1a123da..aa89e21 100644 --- a/qom/object.c +++ b/qom/object.c @@ -417,13 +417,6 @@ Object *object_new(const char *typename) return object_new_with_type(ti); } -void object_delete(Object *obj) -{ -object_unparent(obj); -g_assert(obj-ref == 1); -object_unref(obj); -} - Object *object_dynamic_cast(Object *obj, const char *typename) { if (obj object_class_dynamic_cast(object_get_class(obj), typename)) { -- 1.8.1
Re: [Qemu-devel] [PATCH v2 11/12] mirror: support more than one in-flight AIO operation
Am 16.01.2013 18:31, schrieb Paolo Bonzini: With AIO support in place, we can start copying more than one chunk in parallel. This patch introduces the required infrastructure for this: the buffer is split into multiple granularity-sized chunks, and there is a free list to access them. Because of copy-on-write, a single operation may already require multiple chunks to be available on the free list. In addition, two different iterations on the HBitmap may want to copy the same cluster. We avoid this by keeping a bitmap of in-flight I/O operations, and blocking until the previous iteration completes. This should be a pretty rare occurrence, though; as long as there is no overlap the next iteration can start before the previous one finishes. Signed-off-by: Paolo Bonzini pbonz...@redhat.com I'm wondering if a whole bitmap is really appropriate when you have at most 16 parallel requests in flight. Other places in qemu (like copy-on-read or qcow2 cluster allocation) use lists of in-flight requests instead. I'm not requesting a change here, just wondering what the reasons are and whether this, or the other places, or none of both should be changed long term. --- v1-v2: the in_flight_bitmap is now properly set and cleared [Stefan] block/mirror.c | 111 ++-- trace-events |4 ++- 2 files changed, 102 insertions(+), 13 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 77bb184..686d2b7 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -17,7 +17,15 @@ #include qemu/ratelimit.h #include qemu/bitmap.h -#define SLICE_TIME 1ULL /* ns */ +#define SLICE_TIME1ULL /* ns */ +#define MAX_IN_FLIGHT 16 + +/* The mirroring buffer is a list of granularity-sized chunks. + * Free chunks are organized in a list. + */ +typedef struct MirrorBuffer { +QSIMPLEQ_ENTRY(MirrorBuffer) next; +} MirrorBuffer; typedef struct MirrorBlockJob { BlockJob common; @@ -33,7 +41,10 @@ typedef struct MirrorBlockJob { unsigned long *cow_bitmap; HBitmapIter hbi; uint8_t *buf; +QSIMPLEQ_HEAD(, MirrorBuffer) buf_free; +int buf_free_count; +unsigned long *in_flight_bitmap; int in_flight; int ret; } MirrorBlockJob; @@ -41,7 +52,6 @@ typedef struct MirrorBlockJob { typedef struct MirrorOp { MirrorBlockJob *s; QEMUIOVector qiov; -struct iovec iov; int64_t sector_num; int nb_sectors; } MirrorOp; @@ -62,8 +72,23 @@ static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, static void mirror_iteration_done(MirrorOp *op) { MirrorBlockJob *s = op-s; +struct iovec *iov; +int64_t cluster_num; +int i, nb_chunks, nb_sectors_chunk; s-in_flight--; +iov = op-qiov.iov; +for (i = 0; i op-qiov.niov; i++) { +MirrorBuffer *buf = (MirrorBuffer *) iov[i].iov_base; +QSIMPLEQ_INSERT_TAIL(s-buf_free, buf, next); +s-buf_free_count++; +} + +nb_sectors_chunk = s-granularity BDRV_SECTOR_BITS; +cluster_num = op-sector_num / nb_sectors_chunk; +nb_chunks = op-nb_sectors / nb_sectors_chunk; +bitmap_clear(s-in_flight_bitmap, cluster_num, nb_chunks); + trace_mirror_iteration_done(s, op-sector_num, op-nb_sectors); g_slice_free(MirrorOp, op); qemu_coroutine_enter(s-common.co, NULL); @@ -110,8 +135,8 @@ static void mirror_read_complete(void *opaque, int ret) static void coroutine_fn mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s-common.bs; -int nb_sectors, nb_sectors_chunk; -int64_t end, sector_num, cluster_num; +int nb_sectors, nb_sectors_chunk, nb_chunks; +int64_t end, sector_num, cluster_num, next_sector, hbitmap_next_sector; MirrorOp *op; s-sector_num = hbitmap_iter_next(s-hbi); @@ -122,6 +147,8 @@ static void coroutine_fn mirror_iteration(MirrorBlockJob *s) assert(s-sector_num = 0); } +hbitmap_next_sector = s-sector_num; Is there even a reason why s-sector_num exists in the first place? If I'm not mistaken, it's only used locally and could live on the stack as hbitmap_next_sector from the beginning. Kevin
[Qemu-devel] KVM call agenda for 2013-01-22
Hi Please send in any agenda topics you are interested in. Later, Juan.
Re: [Qemu-devel] [PATCH for-1.4] target-cris: Drop unused cpu_cris_close() prototype
On Sun, Jan 20, 2013 at 03:20:58AM +0100, Andreas Färber wrote: Such a function never existed. Signed-off-by: Andreas Färber afaer...@suse.de --- Edgar, can you commit or ack? I'd like to base v2 of my CPU realizefn series on this. Thanks, Andreas I've commited this one and the MicroBlaze part, Thanks Edgar
Re: [Qemu-devel] [PATCH v2 0/2] fix two revision related errors
On 01/16/13 18:59, Alon Levy wrote: Regarding orientation setting in windows 7 64 guest: Desktop, right click-Screen resolution - You can choose Orientation: Landscape, Portrait, Landscape (flipped), Portrait (flipped) - You can choose Resolution - You can click Advanced Settings, then List All Modes at the bottom, you get all the modes (i.e. four of each resolution, one for each orientation) Ah, ok. The driver seems to handle portrait and swap x+y when creating a displaysurface. At least I get a 600x800 display upright. I can't see a difference between Landscape + Landscape (flipped). Likewise Portrait + Portrait (flipped). Is there any? I couldn't see any visible change when using 6.1.0.1015, so I still have no idea. I'm sure it was supposed to flip upside down. Perhaps the driver doesn't support it and the gui doesn't acknowledge it. There are two changes after applying the change rom size to 8192 patch: - there is no longer an Orientation option - the modes listed under List All Modes reduce as expected Ok, so we loose the Portrait mode. Changes to the second patch: - no orientations except the normal Keeping orientation 0+1 (and dropping the flipped 2+3 versions) should make the mode list small enougth that it fits while maintaining support for the portrait mode. Sending a patch with this change. I think it would also be good to fix the driver to ignore everything with or How about that? - hard code 8192 bytes rom size - assert if the required size is larger Good. cheers, Gerd
[Qemu-devel] [PATCH v3 1/2] qxl: stop using non revision 4 rom fields for revision 4
Signed-off-by: Alon Levy al...@redhat.com --- hw/qxl.c | 11 +++ trace-events | 2 ++ 2 files changed, 13 insertions(+) diff --git a/hw/qxl.c b/hw/qxl.c index 9dc44b9..0d81816 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -945,6 +945,12 @@ static void interface_set_client_capabilities(QXLInstance *sin, { PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); +if (qxl-revision 4) { +trace_qxl_set_client_capabilities_unsupported_by_revision(qxl-id, + qxl-revision); +return; +} + if (runstate_check(RUN_STATE_INMIGRATE) || runstate_check(RUN_STATE_POSTMIGRATE)) { return; @@ -979,6 +985,11 @@ static int interface_client_monitors_config(QXLInstance *sin, QXLRom *rom = memory_region_get_ram_ptr(qxl-rom_bar); int i; +if (qxl-revision 4) { +trace_qxl_client_monitors_config_unsupported_by_device(qxl-id, + qxl-revision); +return 0; +} /* * Older windows drivers set int_mask to 0 when their ISR is called, * then later set it to ~0. So it doesn't relate to the actual interrupts diff --git a/trace-events b/trace-events index 7de9106..09091e6 100644 --- a/trace-events +++ b/trace-events @@ -1029,8 +1029,10 @@ 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 +qxl_client_monitors_config_unsupported_by_device(int qid, int revision) %d revision=%d qxl_client_monitors_config_capped(int qid, int requested, int limit) %d %d %d qxl_client_monitors_config_crc(int qid, unsigned size, uint32_t crc32) %d %u %u +qxl_set_client_capabilities_unsupported_by_revision(int qid, int revision) %d revision=%d # hw/qxl-render.c qxl_render_blit_guest_primary_initialized(void) -- 1.8.0.1
[Qemu-devel] [PATCH v3 2/2] qxl: change rom size to 8192
This is a simpler solution to 869981, where migration breaks since qxl's rom bar size has changed. Instead of ignoring fields in QXLRom, which is what has actually changed, we remove some of the modes, a mechanism already accounted for by the guest. The modes left allow for portrait and landscape only modes, corresponding to orientations 0 and 1. Orientations 2 and 3 are dropped. Added assert so that rom size will fit the future QXLRom increases via spice-protocol changes. This patch has been tested with 6.1.0.10015. With the newer 6.1.0.10016 there are problems with both (flipped) modes prior to the patch, and the patch loses the ability to set Portrait modes. But this is a separate bug to be fixed in the driver, and besides the patch doesn't affect the new arbitrary mode setting functionality. Signed-off-by: Alon Levy al...@redhat.com --- hw/qxl.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 0d81816..a125e29 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -80,9 +80,7 @@ #define QXL_MODE_EX(x_res, y_res) \ QXL_MODE_16_32(x_res, y_res, 0), \ -QXL_MODE_16_32(y_res, x_res, 1), \ -QXL_MODE_16_32(x_res, y_res, 2), \ -QXL_MODE_16_32(y_res, x_res, 3) +QXL_MODE_16_32(x_res, y_res, 1) static QXLMode qxl_modes[] = { QXL_MODE_EX(640, 480), @@ -306,10 +304,13 @@ static inline uint32_t msb_mask(uint32_t val) static ram_addr_t qxl_rom_size(void) { -uint32_t rom_size = sizeof(QXLRom) + sizeof(QXLModes) + sizeof(qxl_modes); +uint32_t required_rom_size = sizeof(QXLRom) + sizeof(QXLModes) + + sizeof(qxl_modes); +uint32_t rom_size = 8192; /* two pages */ -rom_size = MAX(rom_size, TARGET_PAGE_SIZE); -rom_size = msb_mask(rom_size * 2 - 1); +required_rom_size = MAX(required_rom_size, TARGET_PAGE_SIZE); +required_rom_size = msb_mask(required_rom_size * 2 - 1); +assert(required_rom_size = rom_size); return rom_size; } -- 1.8.0.1
Re: [Qemu-devel] [PATCH v9 1/5] Adding utility function net_checksum_add_cont() that allows checksum calculation of scattered data with odd chunk sizes
Dmitry Fleytman dmi...@daynix.com writes: Adding utility function net_raw_checksum() that calculates checksum of buffer given Your subject is excessively long. Please stick to the standard commit message format: subsystem: summary phrase (no more than 75 chars, please) Zero or more paragraphs of description. Wrap long lines, please (75 chars tops).
[Qemu-devel] [PATCH 3/6] hw/omap_dma, hw/omap_spi: Explicitly mark fallthroughs
Explicitly mark the fallthroughs as intentional in the code pattern where we gradually increment an index before falling into the code to read/write that array entry: case THINGY_3: idx++; case THINGY_2: idx++; case THINGY_1: idx++; case THINGY_0: return s-thingy[idx]; This makes static analysers happy. Signed-off-by: Peter Maydell peter.mayd...@linaro.org --- hw/omap_dma.c | 12 hw/omap_spi.c | 24 2 files changed, 36 insertions(+) diff --git a/hw/omap_dma.c b/hw/omap_dma.c index aec5874..0c878b6 100644 --- a/hw/omap_dma.c +++ b/hw/omap_dma.c @@ -1709,19 +1709,25 @@ static uint64_t omap_dma4_read(void *opaque, hwaddr addr, case 0x14: /* DMA4_IRQSTATUS_L3 */ irqn ++; +/* fall through */ case 0x10: /* DMA4_IRQSTATUS_L2 */ irqn ++; +/* fall through */ case 0x0c: /* DMA4_IRQSTATUS_L1 */ irqn ++; +/* fall through */ case 0x08: /* DMA4_IRQSTATUS_L0 */ return s-irqstat[irqn]; case 0x24: /* DMA4_IRQENABLE_L3 */ irqn ++; +/* fall through */ case 0x20: /* DMA4_IRQENABLE_L2 */ irqn ++; +/* fall through */ case 0x1c: /* DMA4_IRQENABLE_L1 */ irqn ++; +/* fall through */ case 0x18: /* DMA4_IRQENABLE_L0 */ return s-irqen[irqn]; @@ -1856,10 +1862,13 @@ static void omap_dma4_write(void *opaque, hwaddr addr, switch (addr) { case 0x14: /* DMA4_IRQSTATUS_L3 */ irqn ++; +/* fall through */ case 0x10: /* DMA4_IRQSTATUS_L2 */ irqn ++; +/* fall through */ case 0x0c: /* DMA4_IRQSTATUS_L1 */ irqn ++; +/* fall through */ case 0x08: /* DMA4_IRQSTATUS_L0 */ s-irqstat[irqn] = ~value; if (!s-irqstat[irqn]) @@ -1868,10 +1877,13 @@ static void omap_dma4_write(void *opaque, hwaddr addr, case 0x24: /* DMA4_IRQENABLE_L3 */ irqn ++; +/* fall through */ case 0x20: /* DMA4_IRQENABLE_L2 */ irqn ++; +/* fall through */ case 0x1c: /* DMA4_IRQENABLE_L1 */ irqn ++; +/* fall through */ case 0x18: /* DMA4_IRQENABLE_L0 */ s-irqen[irqn] = value; return; diff --git a/hw/omap_spi.c b/hw/omap_spi.c index 42d5149..8ff01ed 100644 --- a/hw/omap_spi.c +++ b/hw/omap_spi.c @@ -167,32 +167,47 @@ static uint64_t omap_mcspi_read(void *opaque, hwaddr addr, return s-control; case 0x68: ch ++; +/* fall through */ case 0x54: ch ++; +/* fall through */ case 0x40: ch ++; +/* fall through */ case 0x2c: /* MCSPI_CHCONF */ return s-ch[ch].config; case 0x6c: ch ++; +/* fall through */ case 0x58: ch ++; +/* fall through */ case 0x44: ch ++; +/* fall through */ case 0x30: /* MCSPI_CHSTAT */ return s-ch[ch].status; case 0x70: ch ++; +/* fall through */ case 0x5c: ch ++; +/* fall through */ case 0x48: ch ++; +/* fall through */ case 0x34: /* MCSPI_CHCTRL */ return s-ch[ch].control; case 0x74: ch ++; +/* fall through */ case 0x60: ch ++; +/* fall through */ case 0x4c: ch ++; +/* fall through */ case 0x38: /* MCSPI_TX */ return s-ch[ch].tx; case 0x78: ch ++; +/* fall through */ case 0x64: ch ++; +/* fall through */ case 0x50: ch ++; +/* fall through */ case 0x3c: /* MCSPI_RX */ s-ch[ch].status = ~(1 0); /* RXS */ ret = s-ch[ch].rx; @@ -269,8 +284,11 @@ static void omap_mcspi_write(void *opaque, hwaddr addr, break; case 0x68: ch ++; +/* fall through */ case 0x54: ch ++; +/* fall through */ case 0x40: ch ++; +/* fall through */ case 0x2c: /* MCSPI_CHCONF */ if ((value ^ s-ch[ch].config) (3 14))/* DMAR | DMAW */ omap_mcspi_dmarequest_update(s-ch + ch); @@ -283,8 +301,11 @@ static void omap_mcspi_write(void *opaque, hwaddr addr, break; case 0x70: ch ++; +/* fall through */ case 0x5c: ch ++; +/* fall through */ case 0x48: ch ++; +/* fall through */ case 0x34: /* MCSPI_CHCTRL */ if (value ~s-ch[ch].control 1) { /* EN */ s-ch[ch].control |= 1; @@ -294,8 +315,11 @@ static void omap_mcspi_write(void *opaque, hwaddr addr, break; case 0x74: ch ++; +/* fall through */ case 0x60: ch ++; +/* fall through */ case 0x4c: ch ++; +/* fall through */ case 0x38: /* MCSPI_TX */ s-ch[ch].tx = value; s-ch[ch].status = ~(1 1); /* TXS */ -- 1.7.9.5
Re: [Qemu-devel] [PATCH 1/3] net/bitbang_mdio: Generalize etraxfs MDIO bitbanging emulation
On Sat, Jan 19, 2013 at 06:28:10PM -0400, Grant Likely wrote: The etraxfs Ethernet model implements quite a nice bitbanging core. The change splits it out into a separate .c file. There are no functional changes here, just movement of code and reformatting to match qemu coding standards. Hi Grant! It makes sense to move it out. A few comments: * Maybe we could separate the phy models from the bus model/infrastructure. I.e, the qemu_mdio parts into one file and the qemu_phy into another one. That way we can add other phy models and keep things separated. * Not sure bitbang_ makes sense in the naming, the abstraction supports both the bit twiddeling model with MDIO cycles but also a higher level transactional version (mdio_write_req etc) that bypass the cycle accuracy. The latter is useful for modeling NICs that have MDIO support in hw, e.g like the hw/xilinx_axienet.c while beeing able to reuse the PHY models. I realize I should have done this split when doing the axienet model, sorry.. Best regards, Edgar Cc: Peter Maydell peter.mayd...@linaro.org Cc: Paul Brook p...@codesourcery.com Cc: Edgar E. Iglesias edgar.igles...@gmail.com Cc: Anthony Liguori aligu...@us.ibm.com Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- hw/bitbang_mdio.c | 263 +++ hw/bitbang_mdio.h | 72 + hw/cris/Makefile.objs |1 + hw/etraxfs_eth.c | 273 + 4 files changed, 337 insertions(+), 272 deletions(-) create mode 100644 hw/bitbang_mdio.c create mode 100644 hw/bitbang_mdio.h diff --git a/hw/bitbang_mdio.c b/hw/bitbang_mdio.c new file mode 100644 index 000..f0ee6af --- /dev/null +++ b/hw/bitbang_mdio.c @@ -0,0 +1,263 @@ +/* + * QEMU Bitbang Ethernet MDIO bus PHY controllers. + * + * Copyright (c) 2008 Edgar E. Iglesias, Axis Communications AB. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the Software), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include stdio.h +#include qemu-common.h +#include qemu/log.h +#include bitbang_mdio.h + +#define D(x) + +/* Advertisement control register. */ +#define ADVERTISE_10HALF0x0020 /* Try for 10mbps half-duplex */ +#define ADVERTISE_10FULL0x0040 /* Try for 10mbps full-duplex */ +#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ +#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ + +/* + * The MDIO extensions in the TDK PHY model were reversed engineered from the + * linux driver (PHYID and Diagnostics reg). + * TODO: Add friendly names for the register nums. + */ +static unsigned int tdk_read(struct qemu_phy *phy, unsigned int req) +{ +int regnum; +unsigned r = 0; + +regnum = req 0x1f; + +switch (regnum) { +case 1: +if (!phy-link) { +break; +} +/* MR1. */ +/* Speeds and modes. */ +r |= (1 13) | (1 14); +r |= (1 11) | (1 12); +r |= (1 5); /* Autoneg complete. */ +r |= (1 3); /* Autoneg able. */ +r |= (1 2); /* link. */ +break; +case 5: +/* Link partner ability. + We are kind; always agree with whatever best mode + the guest advertises. */ +r = 1 14; /* Success. */ +/* Copy advertised modes. */ +r |= phy-regs[4] (15 5); +/* Autoneg support. */ +r |= 1; +break; +case 18: +{ +/* Diagnostics reg. */ +int duplex = 0; +int speed_100 = 0; + +if (!phy-link) { +break; +} + +/* Are we advertising 100 half or 100 duplex ? */ +speed_100 = !!(phy-regs[4] ADVERTISE_100HALF); +speed_100 |= !!(phy-regs[4] ADVERTISE_100FULL); + +/* Are we advertising 10 duplex or 100 duplex ? */ +duplex
Re: [Qemu-devel] [PATCH v2 11/12] mirror: support more than one in-flight AIO operation
Il 21/01/2013 13:35, Kevin Wolf ha scritto: I'm wondering if a whole bitmap is really appropriate when you have at most 16 parallel requests in flight. Other places in qemu (like copy-on-read or qcow2 cluster allocation) use lists of in-flight requests instead. I'm not requesting a change here, just wondering what the reasons are and whether this, or the other places, or none of both should be changed long term. The reason is simply that the code is reasoning in bitmaps a lot (cow_bitmap and of course the dirty bitmap), so it was a natural pick and the memory usage is not important. It is simpler and more efficient than a linear scan. I have the required information already in the MirrorOp struct indeed, but I didn't need those in a list. Paolo
Re: [Qemu-devel] [PATCH v2 01/12] qdev: export and use qbus_init
Am 21.01.2013 13:30, schrieb Paolo Bonzini: BusState subclasses need to do their own allocation because qbus_create_inplace calls object_initialize (which wipes out the free callback). This patch separates the initialization of the object (object_initialize) from its insertion in the qdev tree (qbus_realize); to do so, it moves the remaining bits of qbus_create_inplace to qbus_realize and export it as qbus_init. Signed-off-by: Paolo Bonzini pbonz...@redhat.com I think I left some comments on v1: Would it be possible to leave a bus_initialize() function (without q ;)) in place that calls object_initialize() plus the-artist-formerly-known-as-qbus_realize(), shared between object_new() and object_initialize()? -free was always set afterwards. The issue I am trying to contain here is a surge of *_init functions beyond class_init, instance_init, DeviceClass::init. Sticking to the QOM naming of having *bus_initialize() and *bus_new() would address that. Maybe if we reorder the two patches, dropping the use of g_malloc0() first? Currently care needs to be taken with the in-place bus initialization functions to not apply PCI_BUS() etc. on the uninitialized variable. Having a pci_bus_initialize(void *, ...) - bus_initialize(void *, ...) - object_initialize(void *, ...) call chain would solve that. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [RFC V7 00/11] Quorum block filter
On Sat, Jan 19, 2013 at 1:30 AM, Benoît Canet ben...@irqsave.net wrote: This patchset is rebased on top of cutils: unsigned int parsing functions by Eduardo Habkost. This patchset create a block driver implementing a quorum using total qemu disk images. Writes are mirrored on the $total files. For the reading part the $total files are read at the same time and a vote is done to determine if a qiov version is present $threshold or more times. It then return this majority version to the upper layers. When i $threshold versions of the data are returned by the lower layer the quorum is broken and the read return -EIO. The goal of this patchset is to be turned in a QEMU block filter living just above raw-*.c and below qcow2/qed when the required infrastructure will be done. Main use of this feature will be people using NFS appliances which can be subjected to bitflip errors. This patchset can be used to replace blkverify and the out of tree blkmirror. usage: -drive file=quorum:threshold/total:image_1.raw:...:image_total.raw,if=virtio,cache=none I don't know if the following case can be handled correctly. For example, quorum:2/3:image1.raw:image2.raw:image3.raw Let us assume that some data in image2.raw and image3.raw get corrupted, and the two images are now completely identical; while image1.raw doesn't get corrupted. In this case, how will your vote method know if which image gets corrupted and which image doesn't? in this version: parse total and threshold with parse_uint [Eric] return proper qerrors in quorum_open [Eric] Use sha256 for comparing blocks [Eric] Update the rest of the voting function to the new way of doing [Benoît] V6: fix commit message of quorum: Add quorum_open() and quorum_close(). [Eric] return error after a vote in quorum_co_flush [Eric] Fix bitrot caused by headers and structures renaming [Benoît] initialize finished to NULL to prevent crash [Benoît] convert internal quorum code to uint64_t instead of int64_t [Benoît] V5: Eric Blake: revert back separator to : rewrite quorum_getlength Benoît Canet: use memcmp to compare iovec excepted for the blkverify case use strstart to parse argument in open Benoît Canet (11): quorum: Create quorum.c, add QuorumSingleAIOCB and QuorumAIOCB. quorum: Create BDRVQuorumState and BlkDriver and do init. quorum: Add quorum_open() and quorum_close(). quorum: Add quorum_aio_writev and its dependencies. blkverify: Extract qemu_iovec_clone() and qemu_iovec_compare() from blkverify. quorum: Add quorum_aio_readv. quorum: Add quorum mechanism. quorum: Add quorum_getlength(). quorum: Add quorum_invalidate_cache(). quorum: Add quorum_co_is_allocated. quorum: Add quorum_co_flush(). block/Makefile.objs |1 + block/blkverify.c | 108 +-- block/quorum.c| 789 + configure | 22 ++ include/qemu-common.h |2 + util/iov.c| 103 +++ 6 files changed, 919 insertions(+), 106 deletions(-) create mode 100644 block/quorum.c -- 1.7.10.4 -- Regards, Zhi Yong Wu
[Qemu-devel] [PATCH v2 07/12] qdev: move unrealization of devices from finalize to unparent
Similarly, a bus holds a reference back to the device, and this will prevent the device from going away as soon as this reference is counted properly. To avoid this, move the unrealization of devices to the unparent callback. This includes recursively unparenting all the buses and (after the previous patch) the devices on those buses, which ensures that the web of references completely disappears for all devices that reside (in the qdev tree) below the one being unplugged. After this patch, the qdev tree and the bus-child relationship is defined as A is above B, iff unplugging A will automatically unplug B. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- hw/qdev.c | 35 +-- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 83420ac..aad360f 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -738,23 +738,8 @@ static void device_initfn(Object *obj) static void device_finalize(Object *obj) { DeviceState *dev = DEVICE(obj); -BusState *bus; -DeviceClass *dc = DEVICE_GET_CLASS(dev); - -if (dev-realized) { -while (dev-num_child_bus) { -bus = QLIST_FIRST(dev-child_bus); -qbus_free(bus); -} -if (qdev_get_vmsd(dev)) { -vmstate_unregister(dev, qdev_get_vmsd(dev), dev); -} -if (dc-exit) { -dc-exit(dev); -} -if (dev-opts) { -qemu_opts_del(dev-opts); -} +if (dev-opts) { +qemu_opts_del(dev-opts); } } @@ -771,8 +756,22 @@ static void device_class_base_init(ObjectClass *class, void *data) static void device_unparent(Object *obj) { DeviceState *dev = DEVICE(obj); +DeviceClass *dc = DEVICE_GET_CLASS(dev); +BusState *bus; -if (dev-parent_bus != NULL) { +while (dev-num_child_bus) { +bus = QLIST_FIRST(dev-child_bus); +qbus_free(bus); +} +if (dev-realized) { +if (qdev_get_vmsd(dev)) { +vmstate_unregister(dev, qdev_get_vmsd(dev), dev); +} +if (dc-exit) { +dc-exit(dev); +} +} +if (dev-parent_bus) { bus_remove_child(dev-parent_bus, dev); } } -- 1.8.1
Re: [Qemu-devel] [PATCH v2 03/12] qom: preserve object while unparenting it
Am 21.01.2013 13:30, schrieb Paolo Bonzini: Avoid that the object disappears after it's deleted from the QOM composition tree, in case that was the only reference to it. Signed-off-by: Paolo Bonzini pbonz...@redhat.com Acked-by: Andreas Färber afaer...@suse.de Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
[Qemu-devel] [PATCH v2 05/12] qdev: add reference count to a device for the BusChild
Each device has a reference through the BusChild. This reference was not accounted for, add it now. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- hw/qdev.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/qdev.c b/hw/qdev.c index b473bd7..f88a8a4 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -64,7 +64,10 @@ static void bus_remove_child(BusState *bus, DeviceState *child) snprintf(name, sizeof(name), child[%d], kid-index); QTAILQ_REMOVE(bus-children, kid, sibling); + +/* This gives back ownership of kid-child back to us. */ object_property_del(OBJECT(bus), name, NULL); +object_unref(OBJECT(kid-child)); g_free(kid); return; } @@ -82,9 +85,11 @@ static void bus_add_child(BusState *bus, DeviceState *child) kid-index = bus-max_index++; kid-child = child; +object_ref(OBJECT(kid-child)); QTAILQ_INSERT_HEAD(bus-children, kid, sibling); +/* This transfers ownership of kid-child to the property. */ snprintf(name, sizeof(name), child[%d], kid-index); object_property_add_link(OBJECT(bus), name, object_get_typename(OBJECT(child)), -- 1.8.1
[Qemu-devel] [PATCH v2 01/12] qdev: export and use qbus_init
BusState subclasses need to do their own allocation because qbus_create_inplace calls object_initialize (which wipes out the free callback). This patch separates the initialization of the object (object_initialize) from its insertion in the qdev tree (qbus_realize); to do so, it moves the remaining bits of qbus_create_inplace to qbus_realize and export it as qbus_init. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- hw/qdev-core.h | 1 + hw/qdev.c | 18 +++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/hw/qdev-core.h b/hw/qdev-core.h index 731aadd..c9f7fa1 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -229,6 +229,7 @@ DeviceState *qdev_find_recursive(BusState *bus, const char *id); typedef int (qbus_walkerfn)(BusState *bus, void *opaque); typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque); +void qbus_init(BusState *bus, DeviceState *parent, const char *name); void qbus_create_inplace(BusState *bus, const char *typename, DeviceState *parent, const char *name); BusState *qbus_create(const char *typename, DeviceState *parent, const char *name); diff --git a/hw/qdev.c b/hw/qdev.c index 9761016..b473bd7 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -390,14 +390,16 @@ DeviceState *qdev_find_recursive(BusState *bus, const char *id) return NULL; } -static void qbus_realize(BusState *bus) +void qbus_init(BusState *bus, DeviceState *parent, const char *name) { const char *typename = object_get_typename(OBJECT(bus)); char *buf; int i,len; -if (bus-name) { -/* use supplied name */ +bus-parent = parent; + +if (name) { +bus-name = g_strdup(name); } else if (bus-parent bus-parent-id) { /* parent device has id - use it for bus name */ len = strlen(bus-parent-id) + 16; @@ -430,10 +432,7 @@ void qbus_create_inplace(BusState *bus, const char *typename, DeviceState *parent, const char *name) { object_initialize(bus, typename); - -bus-parent = parent; -bus-name = name ? g_strdup(name) : NULL; -qbus_realize(bus); +qbus_init(bus, parent, name); } BusState *qbus_create(const char *typename, DeviceState *parent, const char *name) @@ -441,10 +440,7 @@ BusState *qbus_create(const char *typename, DeviceState *parent, const char *nam BusState *bus; bus = BUS(object_new(typename)); - -bus-parent = parent; -bus-name = name ? g_strdup(name) : NULL; -qbus_realize(bus); +qbus_init(bus, parent, name); return bus; } -- 1.8.1
[Qemu-devel] [PATCH v2 00/12] qdev: correct reference counting
This series makes the ref_count field of device and bus objects actually match the number of references that the objects have. Once this is done, the question how do I delete an object? has a simple answer: use object_unparent if the object is reachable from the QOM tree, else use object_unref. qdev_free and qbus_free become equivalent to simply object_unparent. object_delete instead is replaced by object_unref. Patches 1-3 fix some warts in the last minute patches that went in 1.3. Patches 4-9 are the bulk of the series. Patches 11-12 touches the CPU classes instead. There is a new patch (#4) that documents how link properties are reference counted, and the transfer of ownership when the property is created/deleted. I renamed qbus_remove_children to bus_unparent, and rebased for the conversion of -state to -realized. PPC was also using object_delete for its CPU, too. Otherwise, there are no changes. Paolo Paolo Bonzini (12): qdev: export and use qbus_init qdev: use object_new, not g_malloc to create buses qom: preserve object while unparenting it qom: document reference counting of link properties qdev: add reference count to a device for the BusChild qdev: move deletion of children from finalize to unparent qdev: move unrealization of devices from finalize to unparent qdev: add reference for the bus while it is referred to by the DeviceState qdev: inline object_delete into qbus_free/qdev_free qdev: drop extra references at creation time cpu: do not use object_delete qom: remove object_delete hw/pci/pci.c| 11 +++-- hw/pci/pci.h| 5 --- hw/qdev-core.h | 1 + hw/qdev-monitor.c | 5 ++- hw/qdev.c | 105 +--- hw/sysbus.c | 6 +-- include/qom/object.h| 22 +++--- linux-user/syscall.c| 2 +- qom/object.c| 9 +--- target-i386/helper.c| 4 +- target-ppc/translate_init.c | 2 +- target-sparc/cpu.c | 2 +- vl.c| 1 + 13 files changed, 88 insertions(+), 87 deletions(-) -- 1.8.1
Re: [Qemu-devel] [PATCH 3/3] net/bitbang_mdio: Use bitbang core for smc91c111 network device
On Sun, 20 Jan 2013 11:29:32 +, Peter Maydell peter.mayd...@linaro.org wrote: On 19 January 2013 22:28, Grant Likely grant.lik...@secretlab.ca wrote: The smc91c111 device has bitbanged MDIO access, but the model doesn't yet implement it. This patch uses the generalized bitbang MDIO support pulled out of etraxfs Ethernet driver. @@ -44,6 +45,13 @@ typedef struct { uint8_t int_level; uint8_t int_mask; MemoryRegion mmio; + +/* MDIO bus. */ +struct qemu_mdio mdio_bus; +unsigned int phyaddr; + +/* PHY. */ +struct qemu_phy phy; } smc91c111_state; This surely needs VMState additions so the extra state can be passed across migrations. It looks like the MDIO/PHY stuff from the etraxfs code doesn't have any kind of state save/restore support, so you probably need to first implement that in your new mdio/phy source file, and then refer to it here. Ah, I see. I missed that. I will figure out how to do that and add it to the next version. g.
[Qemu-devel] [PATCH 0/6] arm devices: mark or remove implicit fallthroughs
These patches either mark implicit fallthroughs in case statements or (in a few cases) remove them by putting in an explicit 'break' or 'return' rather than relying on the one in the following case. There is no behaviour change for any of these patches, and in all cases I've examined the code and am happy that the behaviour is intentional and correct. This isn't intended to be a comprehensive patchset (or even a comprehensive patchset for the ARM related files); it's just a set of half a dozen changes for files which I care about and where the existing behaviour was definitely correct. I'm not a fan of the code pattern used in the omap and pxa2xx code of incrementing an index and then falling through to an array access, but it doesn't seem sufficiently ugly to be worth rewriting. Peter Maydell (6): hw/arm_sysctl.c: Add missing 'break' statements hw/omap1.c: Add fallthrough markers and breaks hw/omap_dma, hw/omap_spi: Explicitly mark fallthroughs hw/pflash_cfi02.c: Mark deliberate fallthrough hw/smc91c111: Add explicit 'return' rather than relying on fallthrough hw/pxa2xx_timer: Explicitly mark fallthroughs hw/arm_sysctl.c |2 ++ hw/omap1.c|3 +++ hw/omap_dma.c | 12 hw/omap_spi.c | 24 hw/pflash_cfi02.c |1 + hw/pxa2xx_timer.c | 47 +++ hw/smc91c111.c|1 + 7 files changed, 90 insertions(+) -- 1.7.9.5
[Qemu-devel] [PATCH 4/6] hw/pflash_cfi02.c: Mark deliberate fallthrough
Mark the deliberate fallthrough where we treat the case of an attempt to read flash when it is an unknown command state as if it were a normal read. Signed-off-by: Peter Maydell peter.mayd...@linaro.org --- hw/pflash_cfi02.c |1 + 1 file changed, 1 insertion(+) diff --git a/hw/pflash_cfi02.c b/hw/pflash_cfi02.c index cfb91cb..d66c0ca 100644 --- a/hw/pflash_cfi02.c +++ b/hw/pflash_cfi02.c @@ -157,6 +157,7 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offset, DPRINTF(%s: unknown command state: %x\n, __func__, pfl-cmd); pfl-wcycle = 0; pfl-cmd = 0; +/* fall through to the read code */ case 0x80: /* We accept reads during second unlock sequence... */ case 0x00: -- 1.7.9.5
Re: [Qemu-devel] [PATCH for-1.4 04/12] kvm: Create kvm_arch_vcpu_id() function
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 18.01.2013 18:46, schrieb Eric Blake: On 01/18/2013 09:40 AM, Eduardo Habkost wrote: On Fri, Jan 18, 2013 at 09:11:42AM -0700, Eric Blake wrote: On 01/18/2013 07:20 AM, Eduardo Habkost wrote: Could you suggest a text for me to add please? The argument passed to KVM_CREATE_VCPU now has 'unsigned long' type instead of 'int', as expected by the Linux ioctl() syscall. Maybe an int works on most or all architectures supporting KVM, but it is safer to use an appropriate 'unsigned long' parameter. Interestingly enough, while the Linux syscall uses 'unsigned long', the POSIX definition of ioctl() uses 'int'; so the Linux kernel is already constrained to never use an ioctl value that doesn't fit within 'int', Really? What about the ioctl()s that get a pointer as argument on architectures where pointers don't fit in an int? Do you have a pointer to the POSIX definition you are talking about? Note that I'm talking about the the extra ioctl() argument, not the ioctl() number (that is an unsigned int in the kernel code). Okay, now you made me go back and check sources. POSIX 2008 says: #include stropts.h int ioctl(int fildes, int request, ... /* arg */); Gnulib says this about a bug that it works around: @item On glibc platforms, the second parameter is of type @code{unsigned long} rather than @code{int}. But gnulib also suggests using sys/ioctl.h instead of the POSIX header stropts.h for getting ioctl(), because stropts.h was declared obsolete in POSIX 2008 and was never implemented in glibc. Sure enough, looking at Fedora 18 /usr/include/sys/ioctl.h, I still see: extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; Meanwhile, you are correct that the kernel defines request as 32 bits: linux.git:include/uapi/asm-generic/ioctl.h /* ioctl command encoding: 32 bits total, command in lower 16 bits, * size of the parameter structure in the lower 14 bits of the * upper 16 bits. * Encoding the size of the parameter structure in the ioctl request * is useful for catching programs compiled with old versions * and to avoid overwriting user space outside the user buffer area. * The highest 2 bits are reserved for indicating the ``access mode''. * NOTE: This limits the max parameter size to 16kB -1 ! */ and glibc is already responsible for ensuring that argument promotion of an int doesn't change the behavior of ioctl() in libc when converting it over to the unsigned long syscall semantics expected by the kernel. So a more precise wording of this is: glibc is already responsible from converting the 'unsigned long int' of the user declaration back into the 'unsigned int' that the kernel expects for the second argument. The third argument (when present), is generally treated as a pointer (of size appropriate for the architecture). Although there _might_ be an ioctl that uses it directly as an integer instead of dereferencing it as a pointer, those would be the exceptions to the rule. So ... do we have a conclusion what to put into the commit message? :) It looks to me as if kvm-all.c:kvm_vm_ioctl() is using void*. I like unsigned long but maybe uintptr_t would be more correct then? Or should kvm_vm_ioctl() be fixed to use something else instead? Eric's int would be a semantic change for the 64-bit platforms, no? Andreas - -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAEBAgAGBQJQ/T8lAAoJEPou0S0+fgE/gl8QALesZwG5q07W21mp2j4ikL8N jrBHjG2VZ9Kda+AIGMClVsWntGZSOzHdtriJ4gjxp90D71S/LQfsYAy6bj45FIwS kPbIQblLlL5Xc6ZiTS5yTzkwyEd7gUpDVouXyv3XxeyUxqhQKwgWxpiP4RftbBRI Z8wLbVFNpIoIsHfhKoNkT4M/Ucm1iZbChV6y4zqltAfdQhcl6Gq0jzhtkAfmN41t p3tCJYldRwayiKLsO2Y0BMNrKmCJisKCEGmkCQzye/3cuFoat/WUmpjV/65hLNtm ruzfn6pCqMTEGPC4YeDdUsxAhVzVX+Sd4mBKHBGItmvhhJMFYUtwTosRwX5bOrAJ mpVLAj5/XDYTm2/jQUEOJAqpxUr5oAVMQL3sNeWJPmXkk1kNaNWTNVHHDW1iJnRj ty0YIWOnuNabkwiDEjPCz6ghjfA3wOBWy8Gk3+F21MYgRQwDTFw4JZuroOIzy3iD 6Vs4MmiBUGnoLobSqw2dUZFmjL7a1500AxZG0MwBd+EqnbLHGqD33kvLrbUYT8+F eW+cqKV+ZXo3ux343rTxD6EFgmN7GmHSkknxJN5m6ldlw5wfFQ8KhdCiKjwSq3EP X0bVGmryEdIh+6w/RbhL75Vfb/Je0mr/GzhtijtXo+FORkF8ip2mlpVSl46r0AfI KvsZ0HZqZHsfoaSBC1js =/cL3 -END PGP SIGNATURE-
[Qemu-devel] [PATCH v2 03/12] qom: preserve object while unparenting it
Avoid that the object disappears after it's deleted from the QOM composition tree, in case that was the only reference to it. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- qom/object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qom/object.c b/qom/object.c index 03e6f24..1a123da 100644 --- a/qom/object.c +++ b/qom/object.c @@ -361,12 +361,14 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp) void object_unparent(Object *obj) { +object_ref(obj); if (obj-parent) { object_property_del_child(obj-parent, obj, NULL); } if (obj-class-unparent) { (obj-class-unparent)(obj); } +object_unref(obj); } static void object_deinit(Object *obj, TypeImpl *type) -- 1.8.1
Re: [Qemu-devel] [PATCH 1/3] net/bitbang_mdio: Generalize etraxfs MDIO bitbanging emulation
On Sun, 20 Jan 2013 18:29:25 +0100, Andreas Färber afaer...@suse.de wrote: Am 19.01.2013 23:28, schrieb Grant Likely: The etraxfs Ethernet model implements quite a nice bitbanging core. The change splits it out into a separate .c file. There are no functional changes here, just movement of code and reformatting to match qemu coding standards. Cc: Peter Maydell peter.mayd...@linaro.org Cc: Paul Brook p...@codesourcery.com Cc: Edgar E. Iglesias edgar.igles...@gmail.com Cc: Anthony Liguori aligu...@us.ibm.com Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- hw/bitbang_mdio.c | 263 +++ hw/bitbang_mdio.h | 72 + hw/cris/Makefile.objs |1 + hw/etraxfs_eth.c | 273 + 4 files changed, 337 insertions(+), 272 deletions(-) create mode 100644 hw/bitbang_mdio.c create mode 100644 hw/bitbang_mdio.h If you fix coding style issues in the original file first this helps git's copy detection. Looks like either you have it disabled for patches or it's not detecting it at all... I would expect some similarity N% notice. I played around with this a lot and I couldn't make the copy detection pick up on the lines being moved. I've not disabled copy detection or anything like that. Regardless, I've split the coding style changes into a separate patch and I'll resubmit. g.
Re: [Qemu-devel] [PATCH v2 01/12] qdev: export and use qbus_init
Il 21/01/2013 14:01, Andreas Färber ha scritto: BusState subclasses need to do their own allocation because qbus_create_inplace calls object_initialize (which wipes out the free callback). This patch separates the initialization of the object (object_initialize) from its insertion in the qdev tree (qbus_realize); to do so, it moves the remaining bits of qbus_create_inplace to qbus_realize and export it as qbus_init. Signed-off-by: Paolo Bonzini pbonz...@redhat.com I think I left some comments on v1: Would it be possible to leave a bus_initialize() function (without q ;)) in place that calls object_initialize() plus the-artist-formerly-known-as-qbus_realize(), shared between object_new() and object_initialize()? -free was always set afterwards. The issue I am trying to contain here is a surge of *_init functions beyond class_init, instance_init, DeviceClass::init. Sticking to the QOM naming of having *bus_initialize() and *bus_new() would address that. Yes, you did and I thought about it but I had no good ideas really. We have a lot of differently named functions, but in the end everything before realize should be named init sounds like the only sensible rule... Paolo
Re: [Qemu-devel] [PATCH 0/3] Generalize bitbang MDIO and use for versatile-pb
On Sun, 20 Jan 2013 18:26:06 +0100, Andreas Färber afaer...@suse.de wrote: Am 19.01.2013 23:28, schrieb Grant Likely: This series extracts the MDIO bitbang code from the etraxfs driver and makes it usable on targets using the smc9 Ethernet controller. I've tested this using u-boot on the versatile-pb model. net/bitbang_mdio: Generalize etraxfs MDIO bitbanging emulation net/bitbang_mdio: Never set PHY RST and ANEG_RST bits on register write net/bitbang_mdio: Use bitbang core for smc91c111 network device hw/Makefile.objs |2 +- hw/bitbang_mdio.c | 271 hw/bitbang_mdio.h | 72 + hw/cris/Makefile.objs |1 + hw/etraxfs_eth.c | 273 + hw/smc91c111.c| 29 +- 6 files changed, 371 insertions(+), 277 deletions(-) create mode 100644 hw/bitbang_mdio.c create mode 100644 hw/bitbang_mdio.h Neither of these files is actually in net/, so please fix that or name the subject less misleading bitbang_mdio: ... if you resend. will do. g.
Re: [Qemu-devel] [PATCH 1/3] net/bitbang_mdio: Generalize etraxfs MDIO bitbanging emulation
On Mon, 21 Jan 2013 13:51:02 +0100, Edgar E. Iglesias edgar.igles...@gmail.com wrote: On Sat, Jan 19, 2013 at 06:28:10PM -0400, Grant Likely wrote: The etraxfs Ethernet model implements quite a nice bitbanging core. The change splits it out into a separate .c file. There are no functional changes here, just movement of code and reformatting to match qemu coding standards. Hi Grant! It makes sense to move it out. A few comments: * Maybe we could separate the phy models from the bus model/infrastructure. I.e, the qemu_mdio parts into one file and the qemu_phy into another one. That way we can add other phy models and keep things separated. That makes sense too, but it should be done as a follow on patch. That keeps the factoring out as a single logical block of code. * Not sure bitbang_ makes sense in the naming, the abstraction supports both the bit twiddeling model with MDIO cycles but also a higher level transactional version (mdio_write_req etc) that bypass the cycle accuracy. The latter is useful for modeling NICs that have MDIO support in hw, e.g like the hw/xilinx_axienet.c while beeing able to reuse the PHY models. axienet and etraxfs implementations are subtely different (as you know). I originally was going to do both, but I didn't want to mix functionality changes in with the factoring out. Doing both at the same time would have required (slight) behavour changes in one of the models, so instead I decided to do only one to keep it simple with the other being a follow-on. I realize I should have done this split when doing the axienet model, sorry.. Can you help me out with a patch that migrates axienet to the new common code? Thanks, g.
Re: [Qemu-devel] [PATCH] Annotate questionable fallthroughs
On Mon, Jan 21, 2013 at 5:11 PM, Markus Armbruster arm...@redhat.com wrote: Blue Swirl blauwir...@gmail.com writes: Recent Clang compilers have preliminary support for finding unannotated fallthrough cases in switch statements with compiler flag -Wimplicit-fallthrough. The support is incomplete, it's only possible to annotate the case in C++ but not in C, so it wouldn't be useful to enable the flag for QEMU yet. Mark cases which don't have a comment about fall through with a comment. In legitimate fall through cases the comment can be edited later to mark the case for future readers. Let's clean this up properly instead, as far as we can. Details inline. Maintainers, please check out the parts that apply to your code. Signed-off-by: Blue Swirl blauwir...@gmail.com [...] diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index 3813a72..d829702 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -443,8 +443,10 @@ void HELPER(check_atomctl)(CPUXtensaState *env, uint32_t pc, uint32_t vaddr) switch (access PAGE_CACHE_MASK) { case PAGE_CACHE_WB: atomctl = 2; +/* XXX: questionable fallthrough */ case PAGE_CACHE_WT: atomctl = 2; +/* XXX: questionable fallthrough */ case PAGE_CACHE_BYPASS: if ((atomctl 0x3) == 0) { HELPER(exception_cause_vaddr)(env, pc, Looks intentional. Max Filippov? Correct, these are intentional. -- Thanks. -- Max
Re: [Qemu-devel] [PATCH for-1.4 00/12] target-i386: Fix APIC-ID-based topology (v4)
Am 17.01.2013 21:59, schrieb Eduardo Habkost: I am hoping to get this bug fixed in 1.4. I didn't get much feedback on the RFC I sent last week, though. Igor argued that APIC ID should be set by the board and not by the CPU itself, but I am not doing that because: - I want to keep the bug fix simple and isolated as we are past soft freeze - I believe the creator of the CPU object shouldn't be forced to provide the APIC ID, so the APIC ID is not unnecessarily exposed on the CPU hotplug device_add interface in the future - The APIC ID _is_ set by the CPU itself (because each CPU package may have multiple core/threads, and each core/thread has a different APIC ID). What needs to be provided by the board to the CPU package in the future is the package ID and the bit width of the core/thread IDs. Git tree for reference: git://github.com/ehabkost/qemu-hacks.git apicid-topology.v5 https://github.com/ehabkost/qemu-hacks/tree/apicid-topology.v5 Eduardo Habkost (12): kvm: Add fake KVM_FEATURE_CLOCKSOURCE_STABLE_BIT for builds withou KVM target-i386: Don't set any KVM flag by default if KVM is disabled pc: Reverse pc_init_pci() compatibility logic Applied these to qom-cpu (for 1.4, with some typo fixes): https://github.com/afaerber/qemu-cpu/commits/qom-cpu For the rest there's either open questions or still ongoing review. Andreas kvm: Create kvm_arch_vcpu_id() function target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index fw_cfg: Remove FW_CFG_MAX_CPUS from fw_cfg_init() target-i386/cpu: Introduce apic_id_for_cpu() function cpus.h: Make constant smp_cores/smp_threads available on *-user pc: Set fw_cfg data based on APIC ID calculation tests: Support target-specific unit tests target-i386: Topology APIC ID utility functions pc: Generate APIC IDs according to CPU topology hw/fw_cfg.c| 1 - hw/pc.c| 44 +--- hw/pc_piix.c | 26 +++--- hw/ppc_newworld.c | 1 + hw/ppc_oldworld.c | 1 + hw/sun4m.c | 3 ++ hw/sun4u.c | 1 + include/sysemu/cpus.h | 7 +++ include/sysemu/kvm.h | 4 ++ kvm-all.c | 2 +- target-i386/cpu.c | 52 +++ target-i386/cpu.h | 5 +- target-i386/kvm.c | 6 +++ target-i386/topology.h | 133 + target-ppc/kvm.c | 5 ++ target-s390x/kvm.c | 5 ++ tests/.gitignore | 1 + tests/Makefile | 21 +++- tests/test-x86-cpuid.c | 101 + 19 files changed, 391 insertions(+), 28 deletions(-) create mode 100644 target-i386/topology.h create mode 100644 tests/test-x86-cpuid.c -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v2 00/12] Drive mirroring performance improvements
Am 16.01.2013 18:31, schrieb Paolo Bonzini: The fixes from the previous post are: 1) the in_flight_bitmap is now properly set and cleared [Stefan]; 2) persistent dirty bitmap left out [Stefan]; 3) reordered arguments in qmp-command.hx to follow patch order [Stefan]; 4) tests/qemu-iotests/041.out is regenerated; 5) rebased for moved include files and for the discard series Thanks! Paolo Paolo Bonzini (12): host-utils: add ffsl add hierarchical bitmap data type and test cases block: implement dirty bitmap using HBitmap block: make round_to_clusters public mirror: perform COW if the cluster size is bigger than the granularity block: return count of dirty sectors, not chunks block: allow customizing the granularity of the dirty bitmap mirror: allow customizing the granularity mirror: switch mirror_iteration to AIO mirror: add buf-size argument to drive-mirror mirror: support more than one in-flight AIO operation mirror: support arbitrarily-sized iterations block-migration.c |7 +- block.c| 124 -- block/mirror.c | 381 ++--- blockdev.c | 37 +++-- hmp.c |2 +- include/block/block.h | 11 +- include/block/block_int.h | 10 +- include/qemu/hbitmap.h | 207 ++ include/qemu/host-utils.h | 26 +++ qapi-schema.json | 15 ++- qmp-commands.hx| 10 +- tests/Makefile |3 + tests/qemu-iotests/041 | 52 ++ tests/qemu-iotests/041.out |4 +- tests/test-hbitmap.c | 408 trace-events | 12 ++ util/Makefile.objs |2 +- util/hbitmap.c | 400 +++ 18 files changed, 1527 insertions(+), 184 deletions(-) create mode 100644 include/qemu/hbitmap.h create mode 100644 tests/test-hbitmap.c create mode 100644 util/hbitmap.c Completed my review now. All patches on which I didn't comment look okay. Kevin
Re: [Qemu-devel] [PATCH 0/5] vhost-scsi: Add support for host virtualized target
Nicholas A. Bellinger n...@linux-iscsi.org writes: Hi MST Co, On Thu, 2013-01-17 at 18:43 +0200, Michael S. Tsirkin wrote: On Fri, Sep 07, 2012 at 06:48:14AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org Hello Anthony Co, This is the fourth installment to add host virtualized target support for the mainline tcm_vhost fabric driver using Linux v3.6-rc into QEMU 1.3.0-rc. The series is available directly from the following git branch: git://git.kernel.org/pub/scm/virt/kvm/nab/qemu-kvm.git vhost-scsi-for-1.3 Note the code is cut against yesterday's QEMU head, and dispite the name of the tree is based upon mainline qemu.org git code + has thus far been running overnight with 100K IOPs small block 4k workloads using v3.6-rc2+ based target code with RAMDISK_DR backstores. Other than some minor fuzz between jumping from QEMU 1.2.0 - 1.2.50, this series is functionally identical to what's been posted for vhost-scsi RFC-v3 to qemu-devel. Please consider applying these patches for an initial vhost-scsi merge into QEMU 1.3.0-rc code, or let us know what else you'd like to see addressed for this series to in order to merge. Thank you! --nab OK what's the status here? We missed 1.3 but let's try not to miss 1.4? Unfortunately, I've not been able to get back to the conversion requested by Paolo for a standalone vhost-scsi PCI device. Is your git repo above up to date? Perhaps I can find someone to help out.. At this point my hands are still full with iSER-target for-3.9 kernel code over the next weeks. What's the v1.4 feature cut-off looking like at this point..? Hard freeze is on february 1st but 1.5 opens up again on the 15th. So the release windows shouldn't have a major impact on merging... Regards, Anthony Liguori --nab -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Qemu-devel] [PATCH v2 06/12] qdev: move deletion of children from finalize to unparent
A device will never be finalized as long as it has a reference from other devices that sit on its buses. To ensure that the references go away, deassociate a bus from its children in the unparent callback for the bus. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- hw/qdev.c | 37 + 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index f88a8a4..83420ac 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -433,6 +433,25 @@ void qbus_init(BusState *bus, DeviceState *parent, const char *name) } } +static void bus_unparent(Object *obj) +{ +BusState *bus = BUS(obj); +BusChild *kid; + +while ((kid = QTAILQ_FIRST(bus-children)) != NULL) { +DeviceState *dev = kid-child; +qdev_free(dev); +} +if (bus-parent) { +QLIST_REMOVE(bus, sibling); +bus-parent-num_child_bus--; +bus-parent = NULL; +} else { +assert(bus != sysbus_get_default()); /* main_system_bus is never freed */ +qemu_unregister_reset(qbus_reset_all_fn, bus); +} +} + void qbus_create_inplace(BusState *bus, const char *typename, DeviceState *parent, const char *name) { @@ -805,22 +824,15 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(bus-children); } +static void bus_class_init(ObjectClass *class, void *data) +{ +class-unparent = bus_unparent; +} + static void qbus_finalize(Object *obj) { BusState *bus = BUS(obj); -BusChild *kid; -while ((kid = QTAILQ_FIRST(bus-children)) != NULL) { -DeviceState *dev = kid-child; -qdev_free(dev); -} -if (bus-parent) { -QLIST_REMOVE(bus, sibling); -bus-parent-num_child_bus--; -} else { -assert(bus != sysbus_get_default()); /* main_system_bus is never freed */ -qemu_unregister_reset(qbus_reset_all_fn, bus); -} g_free((char *)bus-name); } @@ -832,6 +844,7 @@ static const TypeInfo bus_info = { .class_size = sizeof(BusClass), .instance_init = qbus_initfn, .instance_finalize = qbus_finalize, +.class_init = bus_class_init, }; static void qdev_register_types(void) -- 1.8.1