All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: ehabkost@redhat.com, imammedo@redhat.com, pbonzini@redhat.com,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH for-2.13] Add host_memory_backend_pagesize() helper
Date: Tue, 3 Apr 2018 15:31:46 +1000	[thread overview]
Message-ID: <20180403053146.GB1984@umbus.fritz.box> (raw)
In-Reply-To: <20180329083748.15264f31@bahia.lan>

[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]

On Thu, Mar 29, 2018 at 08:37:48AM +0200, Greg Kurz wrote:
> On Thu, 29 Mar 2018 16:25:37 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > There are a couple places (one generic, one target specific) where we need
> > to get the host page size associated with a particular memory backend.  I
> > have some upcoming code which will add another place which wants this.  So,
> > for convenience, add a helper function to calculate this.
> > 
> > host_memory_backend_pagesize() returns the host pagesize for a given
> > HostMemoryBackend object, or for the default backend (-mem-path) if passed
> > NULL.
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> 
> The idea is good but there's a small issue. See below.
> 
> >  backends/hostmem.c       | 20 ++++++++++++++++++++
> >  exec.c                   | 21 +++++----------------
> >  include/sysemu/hostmem.h |  2 ++
> >  target/ppc/kvm.c         | 10 +---------
> >  4 files changed, 28 insertions(+), 25 deletions(-)
> > 
> > diff --git a/backends/hostmem.c b/backends/hostmem.c
> > index f61093654e..b6a60cfc5d 100644
> > --- a/backends/hostmem.c
> > +++ b/backends/hostmem.c
> > @@ -18,6 +18,7 @@
> >  #include "qapi/visitor.h"
> >  #include "qemu/config-file.h"
> >  #include "qom/object_interfaces.h"
> > +#include "qemu/mmap-alloc.h"
> >  
> >  #ifdef CONFIG_NUMA
> >  #include <numaif.h>
> > @@ -262,6 +263,25 @@ bool host_memory_backend_is_mapped(HostMemoryBackend *backend)
> >      return backend->is_mapped;
> >  }
> >  
> > +long host_memory_backend_pagesize(HostMemoryBackend *memdev)
> > +{
> > +    const char *path = NULL;
> > +
> > +#ifdef __linux__
> > +    if (memdev) {
> > +        path = object_property_get_str(OBJECT(memdev), "mem-path", NULL);
> 
> object_property_get_str() returns an allocated string. It should be freed
> before returning.

Ah, nice catch, I'll correct that.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2018-04-03  5:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29  5:25 [Qemu-devel] [PATCH for-2.13] Add host_memory_backend_pagesize() helper David Gibson
2018-03-29  6:37 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2018-03-29  9:56   ` Greg Kurz
2018-04-03  5:31   ` David Gibson [this message]
2018-03-31  8:00 ` [Qemu-devel] " no-reply
2018-04-03  2:22 ` Eduardo Habkost
2018-04-03  5:29   ` David Gibson

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=20180403053146.GB1984@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=groug@kaod.org \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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.