summaryrefslogtreecommitdiff
path: root/drivers/xen/gntdev-common.h
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2025-07-03 09:32:59 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-15 16:38:47 +0200
commit1b01308948dd94a9783ae34a57a89c95297d40e1 (patch)
tree62e3aff86c676ca482075247911e8bcb5ee38a77 /drivers/xen/gntdev-common.h
parent8523f6fe4b29132d3942345bf1a4fdf69e698fdb (diff)
xen/gntdev: remove struct gntdev_copy_batch from stack
[ Upstream commit 70045cf6593cbf0740956ea9b7b4269142c6ee38 ] When compiling the kernel with LLVM, the following warning was issued: drivers/xen/gntdev.c:991: warning: stack frame size (1160) exceeds limit (1024) in function 'gntdev_ioctl' The main reason is struct gntdev_copy_batch which is located on the stack and has a size of nearly 1kb. For performance reasons it shouldn't by just dynamically allocated instead, so allocate a new instance when needed and instead of freeing it put it into a list of free structs anchored in struct gntdev_priv. Fixes: a4cdb556cae0 ("xen/gntdev: add ioctl for grant copy") Reported-by: Abinash Singh <abinashsinghlalotra@gmail.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20250703073259.17356-1-jgross@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/xen/gntdev-common.h')
-rw-r--r--drivers/xen/gntdev-common.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/xen/gntdev-common.h b/drivers/xen/gntdev-common.h
index 9c286b2a1900..ac8ce3179ba2 100644
--- a/drivers/xen/gntdev-common.h
+++ b/drivers/xen/gntdev-common.h
@@ -26,6 +26,10 @@ struct gntdev_priv {
/* lock protects maps and freeable_maps. */
struct mutex lock;
+ /* Free instances of struct gntdev_copy_batch. */
+ struct gntdev_copy_batch *batch;
+ struct mutex batch_lock;
+
#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
/* Device for which DMA memory is allocated. */
struct device *dma_dev;