diff mbox series

vhost: reduce stack usage in log_used

Message ID 1600106889-25013-1-git-send-email-li.wang@windriver.com (mailing list archive)
State New, archived
Headers show
Series vhost: reduce stack usage in log_used | expand

Commit Message

Wang, Li Sept. 14, 2020, 6:08 p.m. UTC
Fix the warning: [-Werror=-Wframe-larger-than=]

drivers/vhost/vhost.c: In function log_used:
drivers/vhost/vhost.c:1906:1:
warning: the frame size of 1040 bytes is larger than 1024 bytes

Signed-off-by: Li Wang <li.wang@windriver.com>
---
 drivers/vhost/vhost.c | 2 +-
 drivers/vhost/vhost.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Jason Wang Sept. 15, 2020, 7:53 a.m. UTC | #1
On 2020/9/15 上午2:08, Li Wang wrote:
> Fix the warning: [-Werror=-Wframe-larger-than=]
>
> drivers/vhost/vhost.c: In function log_used:
> drivers/vhost/vhost.c:1906:1:
> warning: the frame size of 1040 bytes is larger than 1024 bytes
>
> Signed-off-by: Li Wang <li.wang@windriver.com>
> ---
>   drivers/vhost/vhost.c | 2 +-
>   drivers/vhost/vhost.h | 1 +
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index b45519c..31837a5
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1884,7 +1884,7 @@ static int log_write_hva(struct vhost_virtqueue *vq, u64 hva, u64 len)
>   
>   static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len)
>   {
> -	struct iovec iov[64];
> +	struct iovec *iov = vq->log_iov;
>   	int i, ret;
>   
>   	if (!vq->iotlb)
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index 9032d3c..5fe4b47
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -123,6 +123,7 @@ struct vhost_virtqueue {
>   	/* Log write descriptors */
>   	void __user *log_base;
>   	struct vhost_log *log;
> +	struct iovec log_iov[64];
>   
>   	/* Ring endianness. Defaults to legacy native endianness.
>   	 * Set to true when starting a modern virtio device. */


Acked-by: Jason Wang <jasowang@redhat.com>
diff mbox series

Patch

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index b45519c..31837a5
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1884,7 +1884,7 @@  static int log_write_hva(struct vhost_virtqueue *vq, u64 hva, u64 len)
 
 static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len)
 {
-	struct iovec iov[64];
+	struct iovec *iov = vq->log_iov;
 	int i, ret;
 
 	if (!vq->iotlb)
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 9032d3c..5fe4b47
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -123,6 +123,7 @@  struct vhost_virtqueue {
 	/* Log write descriptors */
 	void __user *log_base;
 	struct vhost_log *log;
+	struct iovec log_iov[64];
 
 	/* Ring endianness. Defaults to legacy native endianness.
 	 * Set to true when starting a modern virtio device. */