linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host
@ 2022-09-12 15:32 Saurabh Sengar
  2022-09-12 22:02 ` Dexuan Cui
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Saurabh Sengar @ 2022-09-12 15:32 UTC (permalink / raw)
  To: ssengar, drawat.floss, airlied, daniel, linux-hyperv, dri-devel,
	linux-kernel, mikelley

Existing code is causing a race condition where dirt_needed value is
already set by the host and gets overwritten with default value. Remove
this default setting of dirt_needed, to avoid overwriting the value
received in the channel callback set by vmbus_open. Removing this
setting also means the default value for dirt_needed is changed to false
as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index 4a8941fa0815..57d49a08b37f 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -198,8 +198,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
 	if (ret)
 		drm_warn(dev, "Failed to update vram location.\n");
 
-	hv->dirt_needed = true;
-
 	ret = hyperv_mode_config_init(hv);
 	if (ret)
 		goto err_vmbus_close;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host
  2022-09-12 15:32 [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host Saurabh Sengar
@ 2022-09-12 22:02 ` Dexuan Cui
  2022-09-22 22:46 ` Michael Kelley (LINUX)
  2022-09-23 10:15 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Dexuan Cui @ 2022-09-12 22:02 UTC (permalink / raw)
  To: Saurabh Sengar, Saurabh Singh Sengar, drawat.floss, airlied,
	daniel, linux-hyperv, dri-devel, linux-kernel,
	Michael Kelley (LINUX)

> From: Saurabh Sengar <ssengar@linux.microsoft.com>
> Sent: Monday, September 12, 2022 8:33 AM
>  ...
> Existing code is causing a race condition where dirt_needed value is
> already set by the host and gets overwritten with default value. Remove
> this default setting of dirt_needed, to avoid overwriting the value
> received in the channel callback set by vmbus_open. Removing this
> setting also means the default value for dirt_needed is changed to false
> as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>

Reviewed-by: Dexuan Cui <decui@microsoft.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host
  2022-09-12 15:32 [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host Saurabh Sengar
  2022-09-12 22:02 ` Dexuan Cui
@ 2022-09-22 22:46 ` Michael Kelley (LINUX)
  2022-09-23 10:15 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-22 22:46 UTC (permalink / raw)
  To: Saurabh Sengar, Saurabh Singh Sengar, drawat.floss, airlied,
	daniel, linux-hyperv, dri-devel, linux-kernel

From: Saurabh Sengar <ssengar@linux.microsoft.com> Sent: Monday, September 12, 2022 8:33 AM
> 
> Existing code is causing a race condition where dirt_needed value is
> already set by the host and gets overwritten with default value. Remove
> this default setting of dirt_needed, to avoid overwriting the value
> received in the channel callback set by vmbus_open. Removing this
> setting also means the default value for dirt_needed is changed to false
> as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
>  drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> index 4a8941fa0815..57d49a08b37f 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> @@ -198,8 +198,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
>  	if (ret)
>  		drm_warn(dev, "Failed to update vram location.\n");
> 
> -	hv->dirt_needed = true;
> -
>  	ret = hyperv_mode_config_init(hv);
>  	if (ret)
>  		goto err_vmbus_close;
> --
> 2.31.1

Reviewed-by: Michael Kelley <mikelley@microsoft.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host
  2022-09-12 15:32 [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host Saurabh Sengar
  2022-09-12 22:02 ` Dexuan Cui
  2022-09-22 22:46 ` Michael Kelley (LINUX)
@ 2022-09-23 10:15 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2022-09-23 10:15 UTC (permalink / raw)
  To: Saurabh Sengar
  Cc: ssengar, drawat.floss, airlied, daniel, linux-hyperv, dri-devel,
	linux-kernel, mikelley, Wei Liu

On Mon, Sep 12, 2022 at 08:32:46AM -0700, Saurabh Sengar wrote:
> Existing code is causing a race condition where dirt_needed value is
> already set by the host and gets overwritten with default value. Remove
> this default setting of dirt_needed, to avoid overwriting the value
> received in the channel callback set by vmbus_open. Removing this
> setting also means the default value for dirt_needed is changed to false
> as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>

Applied to hyperv-next. Thanks.

I ended up reconstructing the patch myself since the said driver
changed. It is only a one line change so that's fine. If the committed
patch is wrong, please let me know.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-23 10:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 15:32 [PATCH] drm/hyperv: Don't overwrite dirt_needed value set by host Saurabh Sengar
2022-09-12 22:02 ` Dexuan Cui
2022-09-22 22:46 ` Michael Kelley (LINUX)
2022-09-23 10:15 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).