linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/gvt: fix high-order allocation failure on late load
@ 2020-01-22 20:10 Igor Druzhinin
  2020-01-23  5:07 ` Zhenyu Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Druzhinin @ 2020-01-22 20:10 UTC (permalink / raw)
  To: intel-gvt-dev, intel-gfx, dri-devel, linux-kernel
  Cc: zhenyuw, zhi.a.wang, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	airlied, daniel, Igor Druzhinin

If the module happens to be loaded later at runtime there is a chance
memory is already fragmented enough to fail allocation of firmware
blob storage and consequently GVT init. Since it doesn't seem to be
necessary to have the blob contiguous, use vmalloc() instead to avoid
the issue.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 drivers/gpu/drm/i915/gvt/firmware.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/firmware.c b/drivers/gpu/drm/i915/gvt/firmware.c
index 049775e..b0c1fda 100644
--- a/drivers/gpu/drm/i915/gvt/firmware.c
+++ b/drivers/gpu/drm/i915/gvt/firmware.c
@@ -146,7 +146,7 @@ void intel_gvt_free_firmware(struct intel_gvt *gvt)
 		clean_firmware_sysfs(gvt);
 
 	kfree(gvt->firmware.cfg_space);
-	kfree(gvt->firmware.mmio);
+	vfree(gvt->firmware.mmio);
 }
 
 static int verify_firmware(struct intel_gvt *gvt,
@@ -229,7 +229,7 @@ int intel_gvt_load_firmware(struct intel_gvt *gvt)
 
 	firmware->cfg_space = mem;
 
-	mem = kmalloc(info->mmio_size, GFP_KERNEL);
+	mem = vmalloc(info->mmio_size);
 	if (!mem) {
 		kfree(path);
 		kfree(firmware->cfg_space);
-- 
2.7.4


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

* Re: [PATCH] drm/i915/gvt: fix high-order allocation failure on late load
  2020-01-22 20:10 [PATCH] drm/i915/gvt: fix high-order allocation failure on late load Igor Druzhinin
@ 2020-01-23  5:07 ` Zhenyu Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Zhenyu Wang @ 2020-01-23  5:07 UTC (permalink / raw)
  To: Igor Druzhinin
  Cc: intel-gvt-dev, intel-gfx, dri-devel, linux-kernel, zhenyuw,
	zhi.a.wang, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
	daniel

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

On 2020.01.22 20:10:24 +0000, Igor Druzhinin wrote:
> If the module happens to be loaded later at runtime there is a chance
> memory is already fragmented enough to fail allocation of firmware
> blob storage and consequently GVT init. Since it doesn't seem to be
> necessary to have the blob contiguous, use vmalloc() instead to avoid
> the issue.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> ---
>  drivers/gpu/drm/i915/gvt/firmware.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/firmware.c b/drivers/gpu/drm/i915/gvt/firmware.c
> index 049775e..b0c1fda 100644
> --- a/drivers/gpu/drm/i915/gvt/firmware.c
> +++ b/drivers/gpu/drm/i915/gvt/firmware.c
> @@ -146,7 +146,7 @@ void intel_gvt_free_firmware(struct intel_gvt *gvt)
>  		clean_firmware_sysfs(gvt);
>  
>  	kfree(gvt->firmware.cfg_space);
> -	kfree(gvt->firmware.mmio);
> +	vfree(gvt->firmware.mmio);
>  }
>  
>  static int verify_firmware(struct intel_gvt *gvt,
> @@ -229,7 +229,7 @@ int intel_gvt_load_firmware(struct intel_gvt *gvt)
>  
>  	firmware->cfg_space = mem;
>  
> -	mem = kmalloc(info->mmio_size, GFP_KERNEL);
> +	mem = vmalloc(info->mmio_size);
>  	if (!mem) {
>  		kfree(path);
>  		kfree(firmware->cfg_space);
> -- 
> 2.7.4
>

Looks fine to me. Thanks!

Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2020-01-23  5:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 20:10 [PATCH] drm/i915/gvt: fix high-order allocation failure on late load Igor Druzhinin
2020-01-23  5:07 ` Zhenyu Wang

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).