All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>,
	qemu-stable <qemu-stable@nongnu.org>,
	QEMU <qemu-devel@nongnu.org>, Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Stefan Berger <stefanb@linux.ibm.com>
Subject: Re: [PATCH v2 2/3] tpm-ppi: page-align PPI RAM
Date: Wed, 8 Jan 2020 16:49:32 +0400	[thread overview]
Message-ID: <CAJ+F1CJp1rxiwZ30HCH43Yxw4QgUt5QEdyRk9Z3bWyZat1NMAA@mail.gmail.com> (raw)
In-Reply-To: <20200108112902.GB3184@work-vm>

Hi

On Wed, Jan 8, 2020 at 3:29 PM Dr. David Alan Gilbert
<dgilbert@redhat.com> wrote:
>
> * Dr. David Alan Gilbert (dgilbert@redhat.com) wrote:
> > * Marc-André Lureau (marcandre.lureau@redhat.com) wrote:
> > > post-copy migration fails on destination with error such as:
> > > 2019-12-26T10:22:44.714644Z qemu-kvm: ram_block_discard_range:
> > > Unaligned start address: 0x559d2afae9a0
> >
> > Ah good, we got a sane error message!
> >
> > > Use qemu_memalign() to constrain the PPI RAM memory alignment.
> > >
> > > Cc: qemu-stable@nongnu.org
> > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > > ---
> > >  hw/tpm/tpm_ppi.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c
> > > index ff314592b4..6d9c1a3e40 100644
> > > --- a/hw/tpm/tpm_ppi.c
> > > +++ b/hw/tpm/tpm_ppi.c
> > > @@ -43,7 +43,8 @@ void tpm_ppi_reset(TPMPPI *tpmppi)
> > >  void tpm_ppi_init(TPMPPI *tpmppi, struct MemoryRegion *m,
> > >                    hwaddr addr, Object *obj)
> > >  {
> > > -    tpmppi->buf = g_malloc0(HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE));
> > > +    tpmppi->buf = qemu_memalign(qemu_real_host_page_size,
> > > +                                HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE));
> >
> > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
> I just noticed a bit in the CODING_STYLE that says:
>
>   Memory allocated by qemu_memalign or qemu_blockalign must be freed with
>   qemu_vfree, since breaking this will cause problems on Win32.
>
> so I guess this is wrong?

The buf is not freed, TPM are not hotpluggable. For strictness, we
could have a finalize later.

>
> Dave
>
> >
> > >      memory_region_init_ram_device_ptr(&tpmppi->ram, obj, "tpm-ppi",
> > >                                        TPM_PPI_ADDR_SIZE, tpmppi->buf);
> > >      vmstate_register_ram(&tpmppi->ram, DEVICE(obj));
> > > --
> > > 2.24.0.308.g228f53135a
> > >
> > --
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
>


-- 
Marc-André Lureau


  reply	other threads:[~2020-01-08 13:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-03  7:39 [PATCH v2 0/3] tpm: fix PPI RAM migration Marc-André Lureau
2020-01-03  7:39 ` [PATCH v2 1/3] misc: use QEMU_IS_ALIGNED Marc-André Lureau
2020-01-03  7:43   ` Philippe Mathieu-Daudé
2020-01-03  7:59     ` Marc-André Lureau
2020-01-03 10:21       ` Philippe Mathieu-Daudé
2020-01-03 16:36     ` Stefan Berger
2020-01-08 17:06     ` Paolo Bonzini
2020-01-08 18:55   ` Juan Quintela
2020-01-03  7:39 ` [PATCH v2 2/3] tpm-ppi: page-align PPI RAM Marc-André Lureau
2020-01-03 10:02   ` Dr. David Alan Gilbert
2020-01-03 16:38     ` Stefan Berger
2020-01-08 11:29     ` Dr. David Alan Gilbert
2020-01-08 12:49       ` Marc-André Lureau [this message]
2020-01-03  7:40 ` [PATCH v2 3/3] savevm: check RAM is pagesize aligned Marc-André Lureau
2020-01-03  7:43   ` Philippe Mathieu-Daudé
2020-01-08 12:47   ` Juan Quintela
2020-02-17 11:33     ` Marc-André Lureau
2020-02-27 18:41       ` Juan Quintela
2020-02-27 21:00         ` Aleksandar Markovic
2020-02-28  7:55           ` Juan Quintela
2020-02-28  9:09           ` Juan Quintela
2020-02-28 10:30             ` Aleksandar Markovic

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=CAJ+F1CJp1rxiwZ30HCH43Yxw4QgUt5QEdyRk9Z3bWyZat1NMAA@mail.gmail.com \
    --to=marcandre.lureau@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    --cc=stefanb@linux.ibm.com \
    /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.