From: Iouri Tarassov <[email protected]> Dxgkrnl prints the error message "Failed to acquire global channel lock" when a process tries to open the /dev/dxg device and there is no virtual GPU. This message should not be printed in this scenario.
Signed-off-by: Iouri Tarassov <[email protected]> --- drivers/hv/dxgkrnl/dxgadapter.c | 2 +- drivers/hv/dxgkrnl/dxgmodule.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/hv/dxgkrnl/dxgadapter.c b/drivers/hv/dxgkrnl/dxgadapter.c index c94283b09fa1..6d3cabb24e6f 100644 --- a/drivers/hv/dxgkrnl/dxgadapter.c +++ b/drivers/hv/dxgkrnl/dxgadapter.c @@ -78,12 +78,12 @@ void dxgadapter_start(struct dxgadapter *adapter) /* The global channel is initialized when the first adapter starts */ if (!dxgglobal->global_channel_initialized) { + dxgglobal->global_channel_initialized = true; ret = dxgglobal_init_global_channel(); if (ret) { dxgglobal_destroy_global_channel(); return; } - dxgglobal->global_channel_initialized = true; } /* Initialize vGPU vm bus channel */ diff --git a/drivers/hv/dxgkrnl/dxgmodule.c b/drivers/hv/dxgkrnl/dxgmodule.c index 8f5d6db256a3..c2a4a2a2136f 100644 --- a/drivers/hv/dxgkrnl/dxgmodule.c +++ b/drivers/hv/dxgkrnl/dxgmodule.c @@ -46,9 +46,13 @@ int dxgglobal_acquire_channel_lock(void) { struct dxgglobal *dxgglobal = dxggbl(); + if (!dxgglobal->global_channel_initialized) + return -ENODEV; + down_read(&dxgglobal->channel_lock); if (dxgglobal->channel.channel == NULL) { DXG_ERR("Failed to acquire global channel lock"); + up_read(&dxgglobal->channel_lock); return -ENODEV; } else { return 0;

