From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Rutuja Shah <rutu.shah.26@gmail.com>
Cc: qemu-devel@nongnu.org, alistair.francis@xilinx.com,
qemu-arm@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] Reducing stack frame size in stream_process_mem2s()
Date: Tue, 4 Oct 2016 00:26:17 +0200 [thread overview]
Message-ID: <20161003222617.GA11832@toto> (raw)
In-Reply-To: <CAFE_T+QzrfgGwSkqfbL6dArsSH_dyFREM=mma1sBeokO7gpX6Q@mail.gmail.com>
On Mon, Oct 03, 2016 at 10:32:40PM +0530, Rutuja Shah wrote:
> ++ stefan Sorry for the typo.
> Regards
> Rutuja Shah
>
>
> On Mon, Oct 3, 2016 at 10:26 PM, <rutu.shah.26@gmail.com> wrote:
> > From: Rutuja Shah <rutu.shah.26@gmail.com>
> >
> > This patch allocates memory for txbuf array on the heap rather than the stack.
> > As a result, the stack frame size is reduced.
> >
> > Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com>
> > ---
> > hw/dma/xilinx_axidma.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
> > index b135a5f..6c63575 100644
> > --- a/hw/dma/xilinx_axidma.c
> > +++ b/hw/dma/xilinx_axidma.c
> > @@ -256,13 +256,14 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev,
> > StreamSlave *tx_control_dev)
> > {
> > uint32_t prev_d;
> > - unsigned char txbuf[16 * 1024];
> > + unsigned char *txbuf;
> > unsigned int txlen;
> >
> > if (!stream_running(s) || stream_idle(s)) {
> > return;
> > }
> >
> > + txbuf = g_malloc(16 * 1024);
Hi,
Two comments.
We need to move the allocation from the data-path to initialization of the DMA objects. (e.g put txbuf into the Stream struct)
We also need to fix up the use of sizeof txbuf.
Best regards,
Edgar
> > while (1) {
> > stream_desc_load(s, s->regs[R_CURDESC]);
> >
> > @@ -304,6 +305,7 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev,
> > break;
> > }
> > }
> > + g_free(txbuf);
> > }
> >
> > static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf,
> > --
> > 1.9.1
> >
next prev parent reply other threads:[~2016-10-03 22:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 16:56 [Qemu-devel] [PATCH] Reducing stack frame size in stream_process_mem2s() rutu.shah.26
2016-10-03 17:02 ` Rutuja Shah
2016-10-03 22:26 ` Edgar E. Iglesias [this message]
2016-10-04 13:23 ` Rutuja Shah
2016-10-04 17:19 ` Edgar E. Iglesias
2016-10-03 20:39 ` Paolo Bonzini
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=20161003222617.GA11832@toto \
--to=edgar.iglesias@gmail.com \
--cc=alistair.francis@xilinx.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rutu.shah.26@gmail.com \
--cc=stefanha@gmail.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).