All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: malc <av1474@comtv.ru>
Cc: Avi Kivity <avi@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qcow2: Fix L1 table memory allocation
Date: Wed, 08 Jul 2009 09:29:22 +0200	[thread overview]
Message-ID: <4A544AD2.9030504@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0907072239000.2498@linmac.oyster.ru>

malc schrieb:
> On Tue, 7 Jul 2009, Avi Kivity wrote:
> 
>> On 07/07/2009 07:09 PM, Kevin Wolf wrote:
>>> Contrary to what one could expect, the size of L1 tables is not cluster
>>> aligned. So as we're writing whole sectors now instead of single entries,
>>> we need to ensure that the L1 table in memory is large enough; otherwise
>>> write would access memory after the end of the L1 table.
>>>
>>>
>>>       new_l1_size2 = sizeof(uint64_t) * new_l1_size;
>>> -    new_l1_table = qemu_mallocz(new_l1_size2);
>>> +    new_l1_table = qemu_mallocz(align_offset(new_l1_size2, 512));
>>>       memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t));
>>>    
>> Unrelated note: using qemu_memalign() here would reduce the copying for
>> cache=none.
>>
> 
> Another unrelated note, qemu_memalign(and by extension qemu_vmalloc)
> is NULL happy. And FWIW 487414f1cbd638beb0227c7da71fe7b8a821e155
> removed NULL checks for qemu_memalgn and after that new code was added
> that doesn't check for NULLs either (for instance e3f4e2a4 which has
> bitten me).

Good to know that there still is an alternative that isn't broken.
Another good reason to switch to qemu_memalign.

Kevin

      reply	other threads:[~2009-07-08  7:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-07 16:09 [Qemu-devel] [PATCH] qcow2: Fix L1 table memory allocation Kevin Wolf
2009-07-07 16:26 ` Avi Kivity
2009-07-07 16:32   ` Kevin Wolf
2009-07-07 16:41     ` Avi Kivity
2009-07-07 18:40   ` malc
2009-07-08  7:29     ` Kevin Wolf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A544AD2.9030504@redhat.com \
    --to=kwolf@redhat.com \
    --cc=av1474@comtv.ru \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.