qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: vijayak@caviumnetworks.com, qemu-arm@nongnu.org,
	peter.maydell@linaro.org, quintela@redhat.com
Cc: qemu-devel@nongnu.org, Prasun.Kapoor@caviumnetworks.com,
	vijay.kilari@gmail.com,
	Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>,
	Vijaya Kumar K <vijayak@cavium.com>
Subject: Re: [Qemu-devel] [RFC PATCH v1 2/4] exec.c: Remove static allocation of sub_section of sub_page
Date: Mon, 13 Jun 2016 11:52:42 +0200	[thread overview]
Message-ID: <fe539d79-cac4-27e3-589f-66290ae8f243@redhat.com> (raw)
In-Reply-To: <1465808915-4887-3-git-send-email-vijayak@caviumnetworks.com>



On 13/06/2016 11:08, vijayak@caviumnetworks.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
> 
> Allocate sub_section dynamically. Remove dependency
> on TARGET_PAGE_SIZE to make run-time page size detection
> for arm platforms.
> 
> Signed-off-by: Vijaya Kumar K <vijayak@cavium.com>
> ---
>  exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index a9d465b..e803a41 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -154,7 +154,7 @@ typedef struct subpage_t {
>      MemoryRegion iomem;
>      AddressSpace *as;
>      hwaddr base;
> -    uint16_t sub_section[TARGET_PAGE_SIZE];
> +    uint16_t *sub_section;

Please make this a flexible array member instead, so that you can avoid
the extra pointer dereference.

Thanks,

Paolo

>  } subpage_t;
>  
>  #define PHYS_SECTION_UNASSIGNED 0
> @@ -1151,6 +1151,7 @@ static void phys_section_destroy(MemoryRegion *mr)
>      if (have_sub_page) {
>          subpage_t *subpage = container_of(mr, subpage_t, iomem);
>          object_unref(OBJECT(&subpage->iomem));
> +        g_free(subpage->sub_section);
>          g_free(subpage);
>      }
>  }
> @@ -2272,7 +2273,7 @@ static subpage_t *subpage_init(AddressSpace *as, hwaddr base)
>      subpage_t *mmio;
>  
>      mmio = g_malloc0(sizeof(subpage_t));
> -
> +    mmio->sub_section = g_malloc0(TARGET_PAGE_SIZE * sizeof(uint16_t));
>      mmio->as = as;
>      mmio->base = base;
>      memory_region_init_io(&mmio->iomem, NULL, &subpage_ops, mmio,
> 

  parent reply	other threads:[~2016-06-13  9:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13  9:08 [Qemu-devel] [RFC PATCH v1 0/4] ARM/AARCH64: Runtime page size computation vijayak
2016-06-13  9:08 ` [Qemu-devel] [RFC PATCH v1 1/4] migration: Remove static allocation of xzblre cache buffer vijayak
2016-06-13  9:08 ` [Qemu-devel] [RFC PATCH v1 2/4] exec.c: Remove static allocation of sub_section of sub_page vijayak
2016-06-13  9:32   ` Peter Maydell
2016-06-13  9:52   ` Paolo Bonzini [this message]
2016-06-17 10:14     ` Vijay Kilari
2016-06-17 10:29       ` Peter Maydell
2016-06-13  9:08 ` [Qemu-devel] [RFC PATCH v1 3/4] translate-all.c: Compute L1 page table properties at runtime vijayak
2016-06-13  9:25   ` Paolo Bonzini
2016-06-13  9:36     ` Peter Maydell
2016-06-13 10:06       ` Paolo Bonzini
2016-06-21 11:53     ` Peter Maydell
2016-06-21 11:57       ` Paolo Bonzini
2016-06-13  9:08 ` [Qemu-devel] [RFC PATCH v1 4/4] target-arm: Compute page size based on ARM target cpu type vijayak
2016-06-13  9:25   ` Paolo Bonzini
2016-06-13  9:43   ` Peter Maydell
2016-06-13 10:10     ` Peter Maydell
2016-06-14 11:14       ` Vijay Kilari
2016-06-14 11:36         ` Peter Maydell
2016-06-16 19:42           ` Richard Henderson
2016-06-17 10:20             ` Vijay Kilari
2016-06-17 10:30               ` Peter Maydell
2016-06-17 10:39                 ` Vijay Kilari
2016-06-17 10:42                   ` Peter Maydell
2016-06-21 11:55               ` Peter Maydell

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=fe539d79-cac4-27e3-589f-66290ae8f243@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=vijay.kilari@gmail.com \
    --cc=vijayak@cavium.com \
    --cc=vijayak@caviumnetworks.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 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).