All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()
@ 2022-07-31 20:01 Christophe JAILLET
  2022-08-05 18:35   ` Michael Kelley (LINUX)
  0 siblings, 1 reply; 7+ messages in thread
From: Christophe JAILLET @ 2022-07-31 20:01 UTC (permalink / raw)
  To: Deepak Rawat, David Airlie, Daniel Vetter, Thomas Zimmermann
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-hyperv,
	dri-devel

hyperv_setup_vram() calls vmbus_allocate_mmio().
This must be undone in the error handling path of the probe, as already
done in the remove function.

This patch depends on	commit a0ab5abced55 ("drm/hyperv : Removing the
restruction of VRAM allocation with PCI bar size").
Without it, something like what is done in commit e048834c209a
("drm/hyperv: Fix device removal on Gen1 VMs") should be done.

Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index 6d11e7938c83..fc8b4e045f5d 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -133,7 +133,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
 	}
 
 	ret = hyperv_setup_vram(hv, hdev);
-
 	if (ret)
 		goto err_vmbus_close;
 
@@ -150,18 +149,20 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
 
 	ret = hyperv_mode_config_init(hv);
 	if (ret)
-		goto err_vmbus_close;
+		goto err_free_mmio;
 
 	ret = drm_dev_register(dev, 0);
 	if (ret) {
 		drm_err(dev, "Failed to register drm driver.\n");
-		goto err_vmbus_close;
+		goto err_free_mmio;
 	}
 
 	drm_fbdev_generic_setup(dev, 0);
 
 	return 0;
 
+err_free_mmio:
+	vmbus_free_mmio(hv->mem->start, hv->fb_size);
 err_vmbus_close:
 	vmbus_close(hdev->channel);
 err_hv_set_drv_data:
-- 
2.34.1


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

* RE: [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()
  2022-07-31 20:01 [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe() Christophe JAILLET
@ 2022-08-05 18:35   ` Michael Kelley (LINUX)
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Kelley (LINUX) @ 2022-08-05 18:35 UTC (permalink / raw)
  To: Christophe JAILLET, Deepak Rawat, David Airlie, Daniel Vetter,
	Thomas Zimmermann
  Cc: linux-kernel, kernel-janitors, linux-hyperv, dri-devel

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Sent: Sunday, July 31, 2022 1:02 PM
> 
> hyperv_setup_vram() calls vmbus_allocate_mmio().
> This must be undone in the error handling path of the probe, as already
> done in the remove function.
> 
> This patch depends on commit a0ab5abced55 ("drm/hyperv : Removing the
> restruction of VRAM allocation with PCI bar size").
> Without it, something like what is done in commit e048834c209a
> ("drm/hyperv: Fix device removal on Gen1 VMs") should be done.

Should the above paragraph be below the '---' as a comment, rather than
part of the commit message?  It's more about staging instructions than a
long-term record of the actual functional/code change.

> 
> Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")

I wonder if the Fixes: dependency should be on a0ab5abced55.  As you noted,
this patch won't apply cleanly on stable kernel versions that lack that commit,
so we'll need a separate patch for stable if we want to make the fix there.

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

All that said, the fix looks good, so

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

> ---
>  drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> index 6d11e7938c83..fc8b4e045f5d 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> @@ -133,7 +133,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
>  	}
> 
>  	ret = hyperv_setup_vram(hv, hdev);
> -
>  	if (ret)
>  		goto err_vmbus_close;
> 
> @@ -150,18 +149,20 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
> 
>  	ret = hyperv_mode_config_init(hv);
>  	if (ret)
> -		goto err_vmbus_close;
> +		goto err_free_mmio;
> 
>  	ret = drm_dev_register(dev, 0);
>  	if (ret) {
>  		drm_err(dev, "Failed to register drm driver.\n");
> -		goto err_vmbus_close;
> +		goto err_free_mmio;
>  	}
> 
>  	drm_fbdev_generic_setup(dev, 0);
> 
>  	return 0;
> 
> +err_free_mmio:
> +	vmbus_free_mmio(hv->mem->start, hv->fb_size);
>  err_vmbus_close:
>  	vmbus_close(hdev->channel);
>  err_hv_set_drv_data:
> --
> 2.34.1


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

* RE: [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()
@ 2022-08-05 18:35   ` Michael Kelley (LINUX)
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Kelley (LINUX) @ 2022-08-05 18:35 UTC (permalink / raw)
  To: Christophe JAILLET, Deepak Rawat, David Airlie, Daniel Vetter,
	Thomas Zimmermann
  Cc: linux-hyperv, kernel-janitors, linux-kernel, dri-devel

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Sent: Sunday, July 31, 2022 1:02 PM
> 
> hyperv_setup_vram() calls vmbus_allocate_mmio().
> This must be undone in the error handling path of the probe, as already
> done in the remove function.
> 
> This patch depends on commit a0ab5abced55 ("drm/hyperv : Removing the
> restruction of VRAM allocation with PCI bar size").
> Without it, something like what is done in commit e048834c209a
> ("drm/hyperv: Fix device removal on Gen1 VMs") should be done.

Should the above paragraph be below the '---' as a comment, rather than
part of the commit message?  It's more about staging instructions than a
long-term record of the actual functional/code change.

> 
> Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")

I wonder if the Fixes: dependency should be on a0ab5abced55.  As you noted,
this patch won't apply cleanly on stable kernel versions that lack that commit,
so we'll need a separate patch for stable if we want to make the fix there.

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

All that said, the fix looks good, so

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

> ---
>  drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> index 6d11e7938c83..fc8b4e045f5d 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> @@ -133,7 +133,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
>  	}
> 
>  	ret = hyperv_setup_vram(hv, hdev);
> -
>  	if (ret)
>  		goto err_vmbus_close;
> 
> @@ -150,18 +149,20 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
> 
>  	ret = hyperv_mode_config_init(hv);
>  	if (ret)
> -		goto err_vmbus_close;
> +		goto err_free_mmio;
> 
>  	ret = drm_dev_register(dev, 0);
>  	if (ret) {
>  		drm_err(dev, "Failed to register drm driver.\n");
> -		goto err_vmbus_close;
> +		goto err_free_mmio;
>  	}
> 
>  	drm_fbdev_generic_setup(dev, 0);
> 
>  	return 0;
> 
> +err_free_mmio:
> +	vmbus_free_mmio(hv->mem->start, hv->fb_size);
>  err_vmbus_close:
>  	vmbus_close(hdev->channel);
>  err_hv_set_drv_data:
> --
> 2.34.1


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

* Re: [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()
  2022-08-05 18:35   ` Michael Kelley (LINUX)
@ 2022-08-15 15:56     ` Wei Liu
  -1 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2022-08-15 15:56 UTC (permalink / raw)
  To: Michael Kelley (LINUX)
  Cc: Christophe JAILLET, Deepak Rawat, David Airlie, Daniel Vetter,
	Thomas Zimmermann, linux-kernel, kernel-janitors, linux-hyperv,
	dri-devel, Wei Liu

On Fri, Aug 05, 2022 at 06:35:01PM +0000, Michael Kelley (LINUX) wrote:
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Sent: Sunday, July 31, 2022 1:02 PM
> > 
> > hyperv_setup_vram() calls vmbus_allocate_mmio().
> > This must be undone in the error handling path of the probe, as already
> > done in the remove function.
> > 
> > This patch depends on commit a0ab5abced55 ("drm/hyperv : Removing the
> > restruction of VRAM allocation with PCI bar size").
> > Without it, something like what is done in commit e048834c209a
> > ("drm/hyperv: Fix device removal on Gen1 VMs") should be done.
> 
> Should the above paragraph be below the '---' as a comment, rather than
> part of the commit message?  It's more about staging instructions than a
> long-term record of the actual functional/code change.
> 

I don't think this paragraph needs to be in the final commit message.

> > 
> > Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")
> 
> I wonder if the Fixes: dependency should be on a0ab5abced55.  As you noted,
> this patch won't apply cleanly on stable kernel versions that lack that commit,
> so we'll need a separate patch for stable if we want to make the fix there.
> 

I think a0ab5abced55 is more appropriate.

> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> All that said, the fix looks good, so
> 
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>

I made the two changes listed above and applied this patch to
hyperv-fixes.

Thanks,
Wei.

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

* Re: [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()
@ 2022-08-15 15:56     ` Wei Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2022-08-15 15:56 UTC (permalink / raw)
  To: Michael Kelley (LINUX)
  Cc: linux-hyperv, David Airlie, kernel-janitors, linux-kernel,
	dri-devel, Deepak Rawat, Wei Liu, Christophe JAILLET,
	Thomas Zimmermann

On Fri, Aug 05, 2022 at 06:35:01PM +0000, Michael Kelley (LINUX) wrote:
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Sent: Sunday, July 31, 2022 1:02 PM
> > 
> > hyperv_setup_vram() calls vmbus_allocate_mmio().
> > This must be undone in the error handling path of the probe, as already
> > done in the remove function.
> > 
> > This patch depends on commit a0ab5abced55 ("drm/hyperv : Removing the
> > restruction of VRAM allocation with PCI bar size").
> > Without it, something like what is done in commit e048834c209a
> > ("drm/hyperv: Fix device removal on Gen1 VMs") should be done.
> 
> Should the above paragraph be below the '---' as a comment, rather than
> part of the commit message?  It's more about staging instructions than a
> long-term record of the actual functional/code change.
> 

I don't think this paragraph needs to be in the final commit message.

> > 
> > Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")
> 
> I wonder if the Fixes: dependency should be on a0ab5abced55.  As you noted,
> this patch won't apply cleanly on stable kernel versions that lack that commit,
> so we'll need a separate patch for stable if we want to make the fix there.
> 

I think a0ab5abced55 is more appropriate.

> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> All that said, the fix looks good, so
> 
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>

I made the two changes listed above and applied this patch to
hyperv-fixes.

Thanks,
Wei.

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

* Re: [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()
  2022-08-15 15:56     ` Wei Liu
@ 2022-08-15 21:06       ` Christophe JAILLET
  -1 siblings, 0 replies; 7+ messages in thread
From: Christophe JAILLET @ 2022-08-15 21:06 UTC (permalink / raw)
  To: Wei Liu, Michael Kelley (LINUX)
  Cc: linux-hyperv, David Airlie, kernel-janitors, linux-kernel,
	dri-devel, Deepak Rawat, Thomas Zimmermann

Le 15/08/2022 à 17:56, Wei Liu a écrit :
>>
>> All that said, the fix looks good, so
>>
>> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
> 
> I made the two changes listed above and applied this patch to
> hyperv-fixes.
> 

Thanks a lot, that saves me a v2.

CJ

> Thanks,
> Wei.
> 


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

* Re: [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()
@ 2022-08-15 21:06       ` Christophe JAILLET
  0 siblings, 0 replies; 7+ messages in thread
From: Christophe JAILLET @ 2022-08-15 21:06 UTC (permalink / raw)
  To: Wei Liu, Michael Kelley (LINUX)
  Cc: Deepak Rawat, David Airlie, Daniel Vetter, Thomas Zimmermann,
	linux-kernel, kernel-janitors, linux-hyperv, dri-devel

Le 15/08/2022 à 17:56, Wei Liu a écrit :
>>
>> All that said, the fix looks good, so
>>
>> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
> 
> I made the two changes listed above and applied this patch to
> hyperv-fixes.
> 

Thanks a lot, that saves me a v2.

CJ

> Thanks,
> Wei.
> 


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

end of thread, other threads:[~2022-08-16  5:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-31 20:01 [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe() Christophe JAILLET
2022-08-05 18:35 ` Michael Kelley (LINUX)
2022-08-05 18:35   ` Michael Kelley (LINUX)
2022-08-15 15:56   ` Wei Liu
2022-08-15 15:56     ` Wei Liu
2022-08-15 21:06     ` Christophe JAILLET
2022-08-15 21:06       ` Christophe JAILLET

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.