drm/amdkfd: Increase SMI event fifo size
authorPhilip Yang <Philip.Yang@amd.com>
Mon, 29 Jul 2024 18:42:18 +0000 (14:42 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Oct 2024 18:09:14 +0000 (14:09 -0400)
SMI event fifo size 1KB was enough to report GPU vm fault or reset
event, but could drop the more frequent SVM migration events. Increase
kfifo size to 8KB to store about 100 migrate events, less chance to drop
the migrate events if lots of migration happened in the short period of
time. Add KFD prefix to the macro name.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c

index 1d94b44..9b81697 100644 (file)
@@ -44,7 +44,7 @@ struct kfd_smi_client {
        bool suser;
 };
 
-#define MAX_KFIFO_SIZE 1024
+#define KFD_MAX_KFIFO_SIZE     8192
 
 static __poll_t kfd_smi_ev_poll(struct file *, struct poll_table_struct *);
 static ssize_t kfd_smi_ev_read(struct file *, char __user *, size_t, loff_t *);
@@ -86,7 +86,7 @@ static ssize_t kfd_smi_ev_read(struct file *filep, char __user *user,
        struct kfd_smi_client *client = filep->private_data;
        unsigned char *buf;
 
-       size = min_t(size_t, size, MAX_KFIFO_SIZE);
+       size = min_t(size_t, size, KFD_MAX_KFIFO_SIZE);
        buf = kmalloc(size, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
@@ -355,7 +355,7 @@ int kfd_smi_event_open(struct kfd_node *dev, uint32_t *fd)
                return -ENOMEM;
        INIT_LIST_HEAD(&client->list);
 
-       ret = kfifo_alloc(&client->fifo, MAX_KFIFO_SIZE, GFP_KERNEL);
+       ret = kfifo_alloc(&client->fifo, KFD_MAX_KFIFO_SIZE, GFP_KERNEL);
        if (ret) {
                kfree(client);
                return ret;