Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on AllocateMemorySpace() error

2017-02-26 Thread Fan, Jeff
Yes. Some platform sets memory allocation HOB. It makes sense. So, I remove 
ASSERT() from the code.

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Friday, February 24, 2017 5:44 PM
To: Fan, Jeff; edk2-de...@ml01.01.org
Cc: Zeng, Star; Tian, Feng; Kinney, Michael D
Subject: Re: [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on AllocateMemorySpace() 
error

On 02/24/17 07:12, Jeff Fan wrote:
> Platform PEI may add LOCAL APIC memory mapped space into 
> EFI_HOB_MEMORY_ALLOCATION. Or platform may allocate this range before.
> 
> So, we skip AllocateMemorySpace()'s return status checking. Instead, 
> we add one DEBUG message for possible trace.
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=390
> 
> This updating is suggested by Ersek's comments at 
> https://www.mail-archive.com/edk2-devel@lists.01.org/msg22585.html
> 
> Cc: Laszlo Ersek 
> Cc: Star Zeng 
> Cc: Feng Tian 
> Cc: Michael D Kinney 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c 
> index 2fd2f31..4a5e282 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -1075,6 +1075,11 @@ AddLocalApicMemorySpace (
>Status = AddMemoryMappedIoSpace (BaseAddress, SIZE_4KB, EFI_MEMORY_UC);
>ASSERT_EFI_ERROR (Status);
>  
> +  //
> +  // Try to allocate APIC memory mapped space, does not check return  
> + // status because it may be allocated by other driver, or DXE Core 
> + if  // this range is built into Memory Allocation HOB.
> +  //
>Status = gDS->AllocateMemorySpace (
>EfiGcdAllocateAddress,
>EfiGcdMemoryTypeMemoryMappedIo, @@ -1084,7 +1089,10 
> @@ AddLocalApicMemorySpace (
>ImageHandle,
>NULL
>);
> -  ASSERT_EFI_ERROR (Status);
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_INFO, "%a: %a: AllocateMemorySpace() Status - %r\n",
> + gEfiCallerBaseName, __FUNCTION__, Status));  
> + }
>  }
>  
>  /**
> 

Did you actually hit the ASSERT on some platform soon after we discussed it? :) 
Either way,

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on AllocateMemorySpace() error

2017-02-24 Thread Laszlo Ersek
On 02/24/17 07:12, Jeff Fan wrote:
> Platform PEI may add LOCAL APIC memory mapped space into
> EFI_HOB_MEMORY_ALLOCATION. Or platform may allocate this range before.
> 
> So, we skip AllocateMemorySpace()'s return status checking. Instead, we add 
> one
> DEBUG message for possible trace.
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=390
> 
> This updating is suggested by Ersek's comments at
> https://www.mail-archive.com/edk2-devel@lists.01.org/msg22585.html
> 
> Cc: Laszlo Ersek 
> Cc: Star Zeng 
> Cc: Feng Tian 
> Cc: Michael D Kinney 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index 2fd2f31..4a5e282 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -1075,6 +1075,11 @@ AddLocalApicMemorySpace (
>Status = AddMemoryMappedIoSpace (BaseAddress, SIZE_4KB, EFI_MEMORY_UC);
>ASSERT_EFI_ERROR (Status);
>  
> +  //
> +  // Try to allocate APIC memory mapped space, does not check return 
> +  // status because it may be allocated by other driver, or DXE Core if
> +  // this range is built into Memory Allocation HOB.
> +  //
>Status = gDS->AllocateMemorySpace (
>EfiGcdAllocateAddress,
>EfiGcdMemoryTypeMemoryMappedIo,
> @@ -1084,7 +1089,10 @@ AddLocalApicMemorySpace (
>ImageHandle,
>NULL
>);
> -  ASSERT_EFI_ERROR (Status);
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_INFO, "%a: %a: AllocateMemorySpace() Status - %r\n",
> + gEfiCallerBaseName, __FUNCTION__, Status));
> +  }
>  }
>  
>  /**
> 

Did you actually hit the ASSERT on some platform soon after we discussed
it? :) Either way,

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on AllocateMemorySpace() error

2017-02-23 Thread Zeng, Star
Reviewed-by: Star Zeng <star.z...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jeff Fan
Sent: Friday, February 24, 2017 2:12 PM
To: edk2-devel@lists.01.org
Cc: Kinney, Michael D <michael.d.kin...@intel.com>; Tian, Feng 
<feng.t...@intel.com>; Laszlo Ersek <ler...@redhat.com>; Zeng, Star 
<star.z...@intel.com>
Subject: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on 
AllocateMemorySpace() error

Platform PEI may add LOCAL APIC memory mapped space into 
EFI_HOB_MEMORY_ALLOCATION. Or platform may allocate this range before.

So, we skip AllocateMemorySpace()'s return status checking. Instead, we add one 
DEBUG message for possible trace.

https://bugzilla.tianocore.org/show_bug.cgi?id=390

This updating is suggested by Ersek's comments at 
https://www.mail-archive.com/edk2-devel@lists.01.org/msg22585.html

Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Feng Tian <feng.t...@intel.com>
Cc: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff@intel.com>
---
 UefiCpuPkg/CpuDxe/CpuDxe.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 
2fd2f31..4a5e282 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -1075,6 +1075,11 @@ AddLocalApicMemorySpace (
   Status = AddMemoryMappedIoSpace (BaseAddress, SIZE_4KB, EFI_MEMORY_UC);
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Try to allocate APIC memory mapped space, does not check return  
+ // status because it may be allocated by other driver, or DXE Core if  
+ // this range is built into Memory Allocation HOB.
+  //
   Status = gDS->AllocateMemorySpace (
   EfiGcdAllocateAddress,
   EfiGcdMemoryTypeMemoryMappedIo, @@ -1084,7 +1089,10 @@ 
AddLocalApicMemorySpace (
   ImageHandle,
   NULL
   );
-  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_INFO, "%a: %a: AllocateMemorySpace() Status - %r\n",
+ gEfiCallerBaseName, __FUNCTION__, Status));  }
 }
 
 /**
-- 
2.9.3.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on AllocateMemorySpace() error

2017-02-23 Thread Tian, Feng
Reviewed-by: Feng Tian 

Thanks
Feng

-Original Message-
From: Fan, Jeff 
Sent: Friday, February 24, 2017 2:12 PM
To: edk2-devel@lists.01.org
Cc: Laszlo Ersek ; Zeng, Star ; Tian, 
Feng ; Kinney, Michael D 
Subject: [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on AllocateMemorySpace() error

Platform PEI may add LOCAL APIC memory mapped space into 
EFI_HOB_MEMORY_ALLOCATION. Or platform may allocate this range before.

So, we skip AllocateMemorySpace()'s return status checking. Instead, we add one 
DEBUG message for possible trace.

https://bugzilla.tianocore.org/show_bug.cgi?id=390

This updating is suggested by Ersek's comments at 
https://www.mail-archive.com/edk2-devel@lists.01.org/msg22585.html

Cc: Laszlo Ersek 
Cc: Star Zeng 
Cc: Feng Tian 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 
2fd2f31..4a5e282 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -1075,6 +1075,11 @@ AddLocalApicMemorySpace (
   Status = AddMemoryMappedIoSpace (BaseAddress, SIZE_4KB, EFI_MEMORY_UC);
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Try to allocate APIC memory mapped space, does not check return  
+ // status because it may be allocated by other driver, or DXE Core if  
+ // this range is built into Memory Allocation HOB.
+  //
   Status = gDS->AllocateMemorySpace (
   EfiGcdAllocateAddress,
   EfiGcdMemoryTypeMemoryMappedIo, @@ -1084,7 +1089,10 @@ 
AddLocalApicMemorySpace (
   ImageHandle,
   NULL
   );
-  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_INFO, "%a: %a: AllocateMemorySpace() Status - %r\n",
+ gEfiCallerBaseName, __FUNCTION__, Status));  }
 }
 
 /**
-- 
2.9.3.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] UefiCpuPkg/CpuDxe: Do not ASSERT on AllocateMemorySpace() error

2017-02-23 Thread Jeff Fan
Platform PEI may add LOCAL APIC memory mapped space into
EFI_HOB_MEMORY_ALLOCATION. Or platform may allocate this range before.

So, we skip AllocateMemorySpace()'s return status checking. Instead, we add one
DEBUG message for possible trace.

https://bugzilla.tianocore.org/show_bug.cgi?id=390

This updating is suggested by Ersek's comments at
https://www.mail-archive.com/edk2-devel@lists.01.org/msg22585.html

Cc: Laszlo Ersek 
Cc: Star Zeng 
Cc: Feng Tian 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index 2fd2f31..4a5e282 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -1075,6 +1075,11 @@ AddLocalApicMemorySpace (
   Status = AddMemoryMappedIoSpace (BaseAddress, SIZE_4KB, EFI_MEMORY_UC);
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Try to allocate APIC memory mapped space, does not check return 
+  // status because it may be allocated by other driver, or DXE Core if
+  // this range is built into Memory Allocation HOB.
+  //
   Status = gDS->AllocateMemorySpace (
   EfiGcdAllocateAddress,
   EfiGcdMemoryTypeMemoryMappedIo,
@@ -1084,7 +1089,10 @@ AddLocalApicMemorySpace (
   ImageHandle,
   NULL
   );
-  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_INFO, "%a: %a: AllocateMemorySpace() Status - %r\n",
+ gEfiCallerBaseName, __FUNCTION__, Status));
+  }
 }
 
 /**
-- 
2.9.3.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel