qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: rutu.shah.26@gmail.com
Cc: qemu-devel@nongnu.org, alistair.francis@xilinx.com,
	qemu-arm@nongnu.org, stefanha@gmail.com
Subject: Re: [Qemu-devel] [PATCHv2] Reducing stack frame size in stream_process_mem2s()
Date: Tue, 4 Oct 2016 22:56:19 +0200	[thread overview]
Message-ID: <20161004205619.GA31579@toto> (raw)
In-Reply-To: <1475604703-3381-1-git-send-email-rutu.shah.26@gmail.com>

On Tue, Oct 04, 2016 at 11:41:42PM +0530, rutu.shah.26@gmail.com wrote:
> From: Rutuja Shah <rutu.shah.26@gmail.com>
> 
> Hi,
> This patch allocates memory for txbuf in struct Stream rather than the stack.
> As a result, the stack frame size is reduced of stream_process_mem2s().

Hi Rutuja,

A nit-pick:
The commit message is not meant to be a converstation-like message, so
normally we don't include greetings.
The expected format is to have an empty line between the message and
the SoB line.

Here's an example:

Allocate memory for txbuf in struct Stream rather than on the stack.
As a result, the stack frame size is reduced for stream_process_mem2s().

Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com>


Other than that, this looks good to me:
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>


> Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com>
> ---
>  hw/dma/xilinx_axidma.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
> index b135a5f..6065689 100644
> --- a/hw/dma/xilinx_axidma.c
> +++ b/hw/dma/xilinx_axidma.c
> @@ -111,6 +111,7 @@ struct Stream {
>      unsigned int complete_cnt;
>      uint32_t regs[R_MAX];
>      uint8_t app[20];
> +    unsigned char txbuf[16 * 1024];
>  };
>  
>  struct XilinxAXIDMAStreamSlave {
> @@ -256,7 +257,6 @@ 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 int txlen;
>  
>      if (!stream_running(s) || stream_idle(s)) {
> @@ -277,17 +277,17 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev,
>          }
>  
>          txlen = s->desc.control & SDESC_CTRL_LEN_MASK;
> -        if ((txlen + s->pos) > sizeof txbuf) {
> +        if ((txlen + s->pos) > sizeof s->txbuf) {
>              hw_error("%s: too small internal txbuf! %d\n", __func__,
>                       txlen + s->pos);
>          }
>  
>          cpu_physical_memory_read(s->desc.buffer_address,
> -                                 txbuf + s->pos, txlen);
> +                                 s->txbuf + s->pos, txlen);
>          s->pos += txlen;
>  
>          if (stream_desc_eof(&s->desc)) {
> -            stream_push(tx_data_dev, txbuf, s->pos);
> +            stream_push(tx_data_dev, s->txbuf, s->pos);
>              s->pos = 0;
>              stream_complete(s);
>          }
> -- 
> 1.9.1
> 

  parent reply	other threads:[~2016-10-04 20:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04 18:11 [Qemu-devel] [PATCHv2] Reducing stack frame size in stream_process_mem2s() rutu.shah.26
2016-10-04 20:50 ` no-reply
2016-10-04 20:56 ` Edgar E. Iglesias [this message]
2016-10-05 15:59   ` Alistair Francis
2016-10-05 14:07 ` Stefan Hajnoczi

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=20161004205619.GA31579@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).