qemu/block/qcow2.c:1942: possible performance problem ?
Public bug reported:
I just ran static analyser cppcheck over today (20140520) qemu source code.
It said many things, including
[qemu/block/qcow2.c:1942] -> [qemu/block/qcow2.c:1943]: (performance) Buffer 'pad_buf' is being writ ten before its old content has been used.
Source code is
memset(pad_buf, 0, s->cluster_size);
memcpy(pad_buf, buf, nb_sectors * BDRV_SECTOR_SIZE);Worth tuning ?
Similar problem here
[qemu/block/qcow.c:815] -> [qemu/block/qcow.c:816]: (performance) Buffer 'pad_buf' is being written before its old content has been used.
and
[qemu/hw/i386/acpi-build.c:1265] -> [qemu/hw/i386/acpi-build.c:1267]: (performance) Buffer 'dsdt' is
being written before its old content has been used.
** Affects: qemu
Importance: Undecided
Status: New
Signature · 38 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1321464
Title:
qemu/block/qcow2.c:1942: possible performance problem ?
Status in QEMU:
New
Bug description:
I just ran static analyser cppcheck over today (20140520) qemu source
code.
It said many things, including
[qemu/block/qcow2.c:1942] -> [qemu/block/qcow2.c:1943]: (performance) Buffer 'pad_buf' is being writ
ten before its old content has been used.
Source code is
memset(pad_buf, 0, s->cluster_size);
memcpy(pad_buf, buf, nb_sectors * BDRV_SECTOR_SIZE);
Worth tuning ?
Similar problem here
[qemu/block/qcow.c:815] -> [qemu/block/qcow.c:816]: (performance) Buffer 'pad_buf' is being written
before its old content has been used.
and
[qemu/hw/i386/acpi-build.c:1265] -> [qemu/hw/i386/acpi-build.c:1267]: (performance) Buffer 'dsdt' is
being written before its old content has been used.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1321464/+subscriptionsI can only speak for qcow2 and qcow, but for those places, I don't think it is worth fixing. First of all, both are image formats, so the bottleneck is generally the disk on which the images are stored and not main memory, so an overeager memset should not cause any problems.
For both, the relevant piece of code is in qcow2/qcow_write_compressed() which are rarely used anyway (as far as I know) and even if used, they have additional overhead due to having to compress data first, so “fixing” the memset() won't make them noticibly faster.
I don't know about the ACPI thing, but to me it seems that it's copying data to a temporary buffer and then overwriting its beginning with zeroes. From my very limited ACPI knowledge I'd guess this function is called at some point during qemu startup, so it doesn't seem worth optimizing either.
Signature · 38 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1321464
Title:
qemu/block/qcow2.c:1942: possible performance problem ?
Status in QEMU:
New
Bug description:
I just ran static analyser cppcheck over today (20140520) qemu source
code.
It said many things, including
[qemu/block/qcow2.c:1942] -> [qemu/block/qcow2.c:1943]: (performance) Buffer 'pad_buf' is being writ
ten before its old content has been used.
Source code is
memset(pad_buf, 0, s->cluster_size);
memcpy(pad_buf, buf, nb_sectors * BDRV_SECTOR_SIZE);
Worth tuning ?
Similar problem here
[qemu/block/qcow.c:815] -> [qemu/block/qcow.c:816]: (performance) Buffer 'pad_buf' is being written
before its old content has been used.
and
[qemu/hw/i386/acpi-build.c:1265] -> [qemu/hw/i386/acpi-build.c:1267]: (performance) Buffer 'dsdt' is
being written before its old content has been used.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1321464/+subscriptionsQuoted 9 lines · Max Reitz
I can only speak for qcow2 and qcow, but for those places, I don't think it is worth fixing. First of all, both are image formats, so the bottleneck is generally the disk on which the images are stored and not main memory, so an overeager memset should not cause any problems.
For both, the relevant piece of code is in qcow2/qcow_write_compressed() which are rarely used anyway (as far as I know) and even if used, they have additional overhead due to having to compress data first, so “fixing” the
memset()won't make them noticibly faster.
I agree. It won't make a noticable difference and the compressed writes are only done in qemu-img convert, not for running guests.
But patches to change this wouldn't hurt either.
Stefan
Thanks for reporting this, but it looks like the related code has been removed a while ago (there is no more "pad_buf" in qcow.c or qcow2.c), so closing this ticket. If you still can reproduce the (same or similar) problem with the latest version of QEMU, please open a new ticket instead.
** Changed in: qemu
Status: New => Won't Fix
Signature · 38 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1321464
Title:
qemu/block/qcow2.c:1942: possible performance problem ?
Status in QEMU:
Won't Fix
Bug description:
I just ran static analyser cppcheck over today (20140520) qemu source
code.
It said many things, including
[qemu/block/qcow2.c:1942] -> [qemu/block/qcow2.c:1943]: (performance) Buffer 'pad_buf' is being writ
ten before its old content has been used.
Source code is
memset(pad_buf, 0, s->cluster_size);
memcpy(pad_buf, buf, nb_sectors * BDRV_SECTOR_SIZE);
Worth tuning ?
Similar problem here
[qemu/block/qcow.c:815] -> [qemu/block/qcow.c:816]: (performance) Buffer 'pad_buf' is being written
before its old content has been used.
and
[qemu/hw/i386/acpi-build.c:1265] -> [qemu/hw/i386/acpi-build.c:1267]: (performance) Buffer 'dsdt' is
being written before its old content has been used.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1321464/+subscriptions