All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime
@ 2012-06-12  3:20 Huang Ying
  2012-06-12  4:18 ` Len Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Huang Ying @ 2012-06-12  3:20 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-kernel, Tony Luck, ying.huang, linux-acpi, stable

This patch fixed the following bug.

https://bugzilla.kernel.org/show_bug.cgi?id=43282

This is caused by a firmware bug checking (checking generic address
register provided by firmware) in runtime.  The checking should be
done in address mapping time instead of runtime to avoid too much
error reporting in runtime.

Reported-by: Pawel Sikora <pluto@agmk.net>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Tested-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org
---
 drivers/acpi/apei/apei-base.c     |   17 +++++++++++++++--
 drivers/acpi/apei/apei-internal.h |    9 +++++++++
 drivers/acpi/apei/ghes.c          |    6 +++---
 3 files changed, 27 insertions(+), 5 deletions(-)

--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct a
 	u8 ins = entry->instruction;
 
 	if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
-		return acpi_os_map_generic_address(&entry->register_region);
+		return apei_map_generic_address(&entry->register_region);
 
 	return 0;
 }
@@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struc
 	u8 ins = entry->instruction;
 
 	if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
-		acpi_os_unmap_generic_address(&entry->register_region);
+		apei_unmap_generic_address(&entry->register_region);
 
 	return 0;
 }
@@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_ge
 	return 0;
 }
 
+int apei_map_generic_address(struct acpi_generic_address *reg)
+{
+	int rc;
+	u32 access_bit_width;
+	u64 address;
+
+	rc = apei_check_gar(reg, &address, &access_bit_width);
+	if (rc)
+		return rc;
+	return acpi_os_map_generic_address(reg);
+}
+EXPORT_SYMBOL_GPL(apei_map_generic_address);
+
 /* read GAR in interrupt (including NMI) or process context */
 int apei_read(u64 *val, struct acpi_generic_address *reg)
 {
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -7,6 +7,8 @@
 #define APEI_INTERNAL_H
 
 #include <linux/cper.h>
+#include <linux/acpi.h>
+#include <linux/acpi_io.h>
 
 struct apei_exec_context;
 
@@ -68,6 +70,13 @@ static inline int apei_exec_run_optional
 /* IP has been set in instruction function */
 #define APEI_EXEC_SET_IP	1
 
+int apei_map_generic_address(struct acpi_generic_address *reg);
+
+static inline void apei_unmap_generic_address(struct acpi_generic_address *reg)
+{
+	acpi_os_unmap_generic_address(reg);
+}
+
 int apei_read(u64 *val, struct acpi_generic_address *reg);
 int apei_write(u64 val, struct acpi_generic_address *reg);
 
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi
 	if (!ghes)
 		return ERR_PTR(-ENOMEM);
 	ghes->generic = generic;
-	rc = acpi_os_map_generic_address(&generic->error_status_address);
+	rc = apei_map_generic_address(&generic->error_status_address);
 	if (rc)
 		goto err_free;
 	error_block_length = generic->error_block_length;
@@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi
 	return ghes;
 
 err_unmap:
-	acpi_os_unmap_generic_address(&generic->error_status_address);
+	apei_unmap_generic_address(&generic->error_status_address);
 err_free:
 	kfree(ghes);
 	return ERR_PTR(rc);
@@ -330,7 +330,7 @@ err_free:
 static void ghes_fini(struct ghes *ghes)
 {
 	kfree(ghes->estatus);
-	acpi_os_unmap_generic_address(&ghes->generic->error_status_address);
+	apei_unmap_generic_address(&ghes->generic->error_status_address);
 }
 
 enum {

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

* Re: [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime
  2012-06-12  3:20 [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime Huang Ying
@ 2012-06-12  4:18 ` Len Brown
  2012-06-13  8:03   ` Xiao, Hui
  0 siblings, 1 reply; 6+ messages in thread
From: Len Brown @ 2012-06-12  4:18 UTC (permalink / raw)
  To: Huang Ying; +Cc: linux-kernel, Tony Luck, linux-acpi, stable

applied.

thanks,
-Len Brown, Intel Open Source Technology Center


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

* Re: [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime
  2012-06-12  4:18 ` Len Brown
@ 2012-06-13  8:03   ` Xiao, Hui
  0 siblings, 0 replies; 6+ messages in thread
From: Xiao, Hui @ 2012-06-13  8:03 UTC (permalink / raw)
  To: Len Brown; +Cc: Huang Ying, linux-kernel, Tony Luck, linux-acpi, stable

On 2012/6/12 12:18, Len Brown wrote:
> applied.
> 
> thanks,
> -Len Brown, Intel Open Source Technology Center
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Hi all,

I've also encountered the similar bug:
  [Firmware Bug]: APEI: Invalid bit width + offset in GAR [0x1121a5000/64/0/3/0]
during einj test. 

Besides Ying's fix patch, I think its a regression caused by incorrect bit width + offset check condition introduced by commit v3.3-5-g15afae6. I've written a fix patch for it and will send it in a separate mail soon.

Thanks,
-Hui

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

* Re: [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime
  2012-06-11 13:25 ` Ben Hutchings
@ 2012-06-12  3:08   ` Huang Ying
  0 siblings, 0 replies; 6+ messages in thread
From: Huang Ying @ 2012-06-12  3:08 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Len Brown, linux-kernel, Tony Luck, linux-acpi, stable

On Mon, 2012-06-11 at 14:25 +0100, Ben Hutchings wrote:
> On Mon, 2012-06-11 at 14:23 +0800, Huang Ying wrote:
> > This patch fixed the following bug.
> > 
> > https://bugzilla.kernel.org/show_bug.cgi?id=43282
> > 
> > This is caused by a firmware bug checking (checking generic address
> > register provided by firmware) in runtime.  The checking should be
> > done in address mapping time instead of runtime to avoid too much
> > error reporting in runtime.
> > 
> > Reported-by: Pawel Sikora <pluto@agmk.net>
> > Signed-off-by: Huang Ying <ying.huang@intel.com>
> > Tested-by: Jean Delvare <khali@linux-fr.org>
> [...]
> 
> This is not the correct way to submit a patch for stable.  See
> Documentation/stable_kernel_rules.txt.

Thanks for reminding.  Will resend the patch.

Best Regards,
Huang Ying


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

* Re: [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime
  2012-06-11  6:23 Huang Ying
@ 2012-06-11 13:25 ` Ben Hutchings
  2012-06-12  3:08   ` Huang Ying
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Hutchings @ 2012-06-11 13:25 UTC (permalink / raw)
  To: Huang Ying; +Cc: Len Brown, linux-kernel, Tony Luck, linux-acpi, stable

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

On Mon, 2012-06-11 at 14:23 +0800, Huang Ying wrote:
> This patch fixed the following bug.
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=43282
> 
> This is caused by a firmware bug checking (checking generic address
> register provided by firmware) in runtime.  The checking should be
> done in address mapping time instead of runtime to avoid too much
> error reporting in runtime.
> 
> Reported-by: Pawel Sikora <pluto@agmk.net>
> Signed-off-by: Huang Ying <ying.huang@intel.com>
> Tested-by: Jean Delvare <khali@linux-fr.org>
[...]

This is not the correct way to submit a patch for stable.  See
Documentation/stable_kernel_rules.txt.

Ben.

-- 
Ben Hutchings
Computers are not intelligent.	They only think they are.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime
@ 2012-06-11  6:23 Huang Ying
  2012-06-11 13:25 ` Ben Hutchings
  0 siblings, 1 reply; 6+ messages in thread
From: Huang Ying @ 2012-06-11  6:23 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-kernel, Tony Luck, ying.huang, linux-acpi, stable

This patch fixed the following bug.

https://bugzilla.kernel.org/show_bug.cgi?id=43282

This is caused by a firmware bug checking (checking generic address
register provided by firmware) in runtime.  The checking should be
done in address mapping time instead of runtime to avoid too much
error reporting in runtime.

Reported-by: Pawel Sikora <pluto@agmk.net>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Tested-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/acpi/apei/apei-base.c     |   17 +++++++++++++++--
 drivers/acpi/apei/apei-internal.h |    9 +++++++++
 drivers/acpi/apei/ghes.c          |    6 +++---
 3 files changed, 27 insertions(+), 5 deletions(-)

--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct a
 	u8 ins = entry->instruction;
 
 	if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
-		return acpi_os_map_generic_address(&entry->register_region);
+		return apei_map_generic_address(&entry->register_region);
 
 	return 0;
 }
@@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struc
 	u8 ins = entry->instruction;
 
 	if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
-		acpi_os_unmap_generic_address(&entry->register_region);
+		apei_unmap_generic_address(&entry->register_region);
 
 	return 0;
 }
@@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_ge
 	return 0;
 }
 
+int apei_map_generic_address(struct acpi_generic_address *reg)
+{
+	int rc;
+	u32 access_bit_width;
+	u64 address;
+
+	rc = apei_check_gar(reg, &address, &access_bit_width);
+	if (rc)
+		return rc;
+	return acpi_os_map_generic_address(reg);
+}
+EXPORT_SYMBOL_GPL(apei_map_generic_address);
+
 /* read GAR in interrupt (including NMI) or process context */
 int apei_read(u64 *val, struct acpi_generic_address *reg)
 {
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -7,6 +7,8 @@
 #define APEI_INTERNAL_H
 
 #include <linux/cper.h>
+#include <linux/acpi.h>
+#include <linux/acpi_io.h>
 
 struct apei_exec_context;
 
@@ -68,6 +70,13 @@ static inline int apei_exec_run_optional
 /* IP has been set in instruction function */
 #define APEI_EXEC_SET_IP	1
 
+int apei_map_generic_address(struct acpi_generic_address *reg);
+
+static inline void apei_unmap_generic_address(struct acpi_generic_address *reg)
+{
+	acpi_os_unmap_generic_address(reg);
+}
+
 int apei_read(u64 *val, struct acpi_generic_address *reg);
 int apei_write(u64 val, struct acpi_generic_address *reg);
 
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi
 	if (!ghes)
 		return ERR_PTR(-ENOMEM);
 	ghes->generic = generic;
-	rc = acpi_os_map_generic_address(&generic->error_status_address);
+	rc = apei_map_generic_address(&generic->error_status_address);
 	if (rc)
 		goto err_free;
 	error_block_length = generic->error_block_length;
@@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi
 	return ghes;
 
 err_unmap:
-	acpi_os_unmap_generic_address(&generic->error_status_address);
+	apei_unmap_generic_address(&generic->error_status_address);
 err_free:
 	kfree(ghes);
 	return ERR_PTR(rc);
@@ -330,7 +330,7 @@ err_free:
 static void ghes_fini(struct ghes *ghes)
 {
 	kfree(ghes->estatus);
-	acpi_os_unmap_generic_address(&ghes->generic->error_status_address);
+	apei_unmap_generic_address(&ghes->generic->error_status_address);
 }
 
 enum {

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

end of thread, other threads:[~2012-06-13  8:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12  3:20 [BUGFIX] ACPI, APEI, Avoid too much error reporting in runtime Huang Ying
2012-06-12  4:18 ` Len Brown
2012-06-13  8:03   ` Xiao, Hui
  -- strict thread matches above, loose matches on Subject: below --
2012-06-11  6:23 Huang Ying
2012-06-11 13:25 ` Ben Hutchings
2012-06-12  3:08   ` Huang Ying

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.