* [Qemu-devel] [PATCHv3] Reducing stack frame size in stream_process_mem2s()
@ 2016-10-06 18:16 rutu.shah.26
2016-10-07 0:03 ` Alistair Francis
0 siblings, 1 reply; 3+ messages in thread
From: rutu.shah.26 @ 2016-10-06 18:16 UTC (permalink / raw)
To: qemu-devel
Cc: Rutuja Shah, edgar.iglesias, alistair.francis, qemu-arm, stefanha
From: Rutuja Shah <rutu.shah.26@gmail.com>
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().
Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCHv3] Reducing stack frame size in stream_process_mem2s()
2016-10-06 18:16 [Qemu-devel] [PATCHv3] Reducing stack frame size in stream_process_mem2s() rutu.shah.26
@ 2016-10-07 0:03 ` Alistair Francis
2016-10-07 9:32 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Alistair Francis @ 2016-10-07 0:03 UTC (permalink / raw)
To: Rutuja Shah, Peter Maydell
Cc: qemu-devel@nongnu.org Developers, Stefan Hajnoczi, Edgar Iglesias,
qemu-arm, Alistair Francis
On Thu, Oct 6, 2016 at 11:16 AM, <rutu.shah.26@gmail.com> wrote:
> From: Rutuja Shah <rutu.shah.26@gmail.com>
>
> 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().
>
> Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com>
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Hey Peter,
Can this go through target-arm?
Thanks,
Alistair
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCHv3] Reducing stack frame size in stream_process_mem2s()
2016-10-07 0:03 ` Alistair Francis
@ 2016-10-07 9:32 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-10-07 9:32 UTC (permalink / raw)
To: Alistair Francis
Cc: Rutuja Shah, qemu-devel@nongnu.org Developers, Stefan Hajnoczi,
Edgar Iglesias, qemu-arm
On 7 October 2016 at 01:03, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> On Thu, Oct 6, 2016 at 11:16 AM, <rutu.shah.26@gmail.com> wrote:
>> From: Rutuja Shah <rutu.shah.26@gmail.com>
>>
>> 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().
>>
>> Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com>
>> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
>
> Hey Peter,
>
> Can this go through target-arm?
Sure.
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-07 9:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-06 18:16 [Qemu-devel] [PATCHv3] Reducing stack frame size in stream_process_mem2s() rutu.shah.26
2016-10-07 0:03 ` Alistair Francis
2016-10-07 9:32 ` Peter Maydell
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).