Skip to content

Commit 9706a3f

Browse files
Iouri Tarassovchessturo
authored andcommitted
drivers: hv: dxgkrnl: Improve tracing and return values from copy from user
Signed-off-by: Iouri Tarassov <iourit@linux.microsoft.com> [kms: forward port to 6.6 from 6.1. No code changes made.] Signed-off-by: Kelsey Steele <kelseysteele@microsoft.com>
1 parent 2a8901a commit 9706a3f

5 files changed

Lines changed: 225 additions & 231 deletions

File tree

drivers/hv/dxgkrnl/dxgkrnl.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -999,18 +999,25 @@ void dxgk_validate_ioctls(void);
999999
trace_printk(dev_fmt(fmt) "\n", ##__VA_ARGS__); \
10001000
} while (0)
10011001

1002-
#define DXG_ERR(fmt, ...) do { \
1003-
dev_err(DXGDEV, fmt, ##__VA_ARGS__); \
1004-
trace_printk("*** dxgkerror *** " dev_fmt(fmt) "\n", ##__VA_ARGS__); \
1002+
#define DXG_ERR(fmt, ...) do { \
1003+
dev_err(DXGDEV, "%s: " fmt, __func__, ##__VA_ARGS__); \
1004+
trace_printk("*** dxgkerror *** " dev_fmt(fmt) "\n", ##__VA_ARGS__); \
10051005
} while (0)
10061006

10071007
#else
10081008

10091009
#define DXG_TRACE(...)
1010-
#define DXG_ERR(fmt, ...) do { \
1011-
dev_err(DXGDEV, fmt, ##__VA_ARGS__); \
1010+
#define DXG_ERR(fmt, ...) do { \
1011+
dev_err(DXGDEV, "%s: " fmt, __func__, ##__VA_ARGS__); \
10121012
} while (0)
10131013

10141014
#endif /* DEBUG */
10151015

1016+
#define DXG_TRACE_IOCTL_END(ret) do { \
1017+
if (ret < 0) \
1018+
DXG_ERR("Ioctl failed: %d", ret); \
1019+
else \
1020+
DXG_TRACE("Ioctl returned: %d", ret); \
1021+
} while (0)
1022+
10161023
#endif

drivers/hv/dxgkrnl/dxgmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,3 +961,4 @@ module_exit(dxg_drv_exit);
961961

962962
MODULE_LICENSE("GPL");
963963
MODULE_DESCRIPTION("Microsoft Dxgkrnl virtual compute device Driver");
964+
MODULE_VERSION("2.0.0");

drivers/hv/dxgkrnl/dxgsyncfile.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@
3838
#undef dev_fmt
3939
#define dev_fmt(fmt) "dxgk: " fmt
4040

41-
#ifdef DEBUG
42-
static char *errorstr(int ret)
43-
{
44-
return ret < 0 ? "err" : "";
45-
}
46-
#endif
47-
4841
static const struct dma_fence_ops dxgdmafence_ops;
4942

5043
static struct dxgsyncpoint *to_syncpoint(struct dma_fence *fence)
@@ -193,7 +186,7 @@ int dxgkio_create_sync_file(struct dxgprocess *process, void *__user inargs)
193186
if (fd >= 0)
194187
put_unused_fd(fd);
195188
}
196-
DXG_TRACE("ioctl:%s %d", errorstr(ret), ret);
189+
DXG_TRACE_IOCTL_END(ret);
197190
return ret;
198191
}
199192

@@ -317,7 +310,7 @@ int dxgkio_open_syncobj_from_syncfile(struct dxgprocess *process,
317310
kref_put(&device->device_kref, dxgdevice_release);
318311
}
319312

320-
DXG_TRACE("ioctl:%s %d", errorstr(ret), ret);
313+
DXG_TRACE_IOCTL_END(ret);
321314
return ret;
322315
}
323316

@@ -415,7 +408,7 @@ int dxgkio_wait_sync_file(struct dxgprocess *process, void *__user inargs)
415408
if (dmafence)
416409
dma_fence_put(dmafence);
417410

418-
DXG_TRACE("ioctl:%s %d", errorstr(ret), ret);
411+
DXG_TRACE_IOCTL_END(ret);
419412
return ret;
420413
}
421414

0 commit comments

Comments
 (0)