qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1321464] [NEW] qemu/block/qcow2.c:1942: possible performance problem ?
@ 2014-05-20 21:48 dcb
  2014-05-20 23:21 ` [Qemu-devel] [Bug 1321464] " Max Reitz
  2017-10-03  9:42 ` Thomas Huth
  0 siblings, 2 replies; 4+ messages in thread
From: dcb @ 2014-05-20 21:48 UTC (permalink / raw)
  To: qemu-devel

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

-- 
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/+subscriptions

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [Bug 1321464] Re: qemu/block/qcow2.c:1942: possible performance problem ?
  2014-05-20 21:48 [Qemu-devel] [Bug 1321464] [NEW] qemu/block/qcow2.c:1942: possible performance problem ? dcb
@ 2014-05-20 23:21 ` Max Reitz
  2014-05-23 12:27   ` Stefan Hajnoczi
  2017-10-03  9:42 ` Thomas Huth
  1 sibling, 1 reply; 4+ messages in thread
From: Max Reitz @ 2014-05-20 23:21 UTC (permalink / raw)
  To: qemu-devel

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 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.

-- 
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/+subscriptions

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Bug 1321464] Re: qemu/block/qcow2.c:1942: possible performance problem ?
  2014-05-20 23:21 ` [Qemu-devel] [Bug 1321464] " Max Reitz
@ 2014-05-23 12:27   ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-05-23 12:27 UTC (permalink / raw)
  To: Bug 1321464; +Cc: qemu-devel

On Tue, May 20, 2014 at 11:21:05PM -0000, Max Reitz wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [Bug 1321464] Re: qemu/block/qcow2.c:1942: possible performance problem ?
  2014-05-20 21:48 [Qemu-devel] [Bug 1321464] [NEW] qemu/block/qcow2.c:1942: possible performance problem ? dcb
  2014-05-20 23:21 ` [Qemu-devel] [Bug 1321464] " Max Reitz
@ 2017-10-03  9:42 ` Thomas Huth
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2017-10-03  9:42 UTC (permalink / raw)
  To: qemu-devel

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

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-03  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20 21:48 [Qemu-devel] [Bug 1321464] [NEW] qemu/block/qcow2.c:1942: possible performance problem ? dcb
2014-05-20 23:21 ` [Qemu-devel] [Bug 1321464] " Max Reitz
2014-05-23 12:27   ` Stefan Hajnoczi
2017-10-03  9:42 ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).