All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
@ 2012-02-28  8:44 Chen Gong
  2012-02-28  8:54 ` Huang Ying
  0 siblings, 1 reply; 12+ messages in thread
From: Chen Gong @ 2012-02-28  8:44 UTC (permalink / raw)
  To: tony.luck, ying.huang; +Cc: lenb, linux-acpi, Chen Gong

On the platforms with ACPI4.x support, parameter extension
is not always doable, which means only parameter extension
is enabled, einj_param can take effect.

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
---
 drivers/acpi/apei/einj.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 4ca087d..0323684 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -466,7 +466,7 @@ static int __einj_error_inject(u32 type, u64 param1, u64 param2)
 		rc = apei_exec_run(&ctx, ACPI_EINJ_SET_ERROR_TYPE);
 		if (rc)
 			return rc;
-		if (einj_param) {
+		if (param_extension && einj_param) {
 			struct einj_parameter *v4param = einj_param;
 			v4param->param1 = param1;
 			v4param->param2 = param2;
-- 
1.7.8.2.302.g17b4e


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

* Re: [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
  2012-02-28  8:44 [PATCH] ACPI, APEI, EINJ, limit the range of einj_param Chen Gong
@ 2012-02-28  8:54 ` Huang Ying
  2012-02-28 18:33   ` Luck, Tony
  0 siblings, 1 reply; 12+ messages in thread
From: Huang Ying @ 2012-02-28  8:54 UTC (permalink / raw)
  To: Chen Gong; +Cc: tony.luck, lenb, linux-acpi

On Tue, 2012-02-28 at 16:44 +0800, Chen Gong wrote:
> On the platforms with ACPI4.x support, parameter extension
> is not always doable, which means only parameter extension
> is enabled, einj_param can take effect.
> 
> Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
> ---
>  drivers/acpi/apei/einj.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index 4ca087d..0323684 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -466,7 +466,7 @@ static int __einj_error_inject(u32 type, u64 param1, u64 param2)
>  		rc = apei_exec_run(&ctx, ACPI_EINJ_SET_ERROR_TYPE);
>  		if (rc)
>  			return rc;
> -		if (einj_param) {
> +		if (param_extension && einj_param) {
>  			struct einj_parameter *v4param = einj_param;
>  			v4param->param1 = param1;
>  			v4param->param2 = param2;

Good catch!  It appears that is introduced when adding ACPI 5.0
parameter support.  Or we can fix einj_get_parameter_address() to return
NULL if param_extension is 0 and paddrv5 is 0.

Best Regards,
Huang Ying


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

* RE: [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
  2012-02-28  8:54 ` Huang Ying
@ 2012-02-28 18:33   ` Luck, Tony
  2012-02-29  2:44     ` Chen Gong
  2012-02-29  5:38     ` [PATCH] " Huang Ying
  0 siblings, 2 replies; 12+ messages in thread
From: Luck, Tony @ 2012-02-28 18:33 UTC (permalink / raw)
  To: Huang, Ying, Chen Gong; +Cc: lenb, linux-acpi

> parameter support.  Or we can fix einj_get_parameter_address() to return
> NULL if param_extension is 0 and paddrv5 is 0.

That was my intent ... but it looks like I managed to lose that in
some code re-arrangement.

Perhaps (Outlook will white-space mangle, but it is only one line):

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 4ca087d..3d3816f 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -238,7 +238,7 @@ static void *einj_get_parameter_address(void)
 			return v5param;
 		}
 	}
-	if (paddrv4) {
+	if (param_extension && paddrv4) {
 		struct einj_parameter *v4param;
 
 		v4param = acpi_os_map_memory(paddrv4, sizeof(*v4param));





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

* Re: [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
  2012-02-28 18:33   ` Luck, Tony
@ 2012-02-29  2:44     ` Chen Gong
  2012-02-29 19:34       ` Luck, Tony
  2012-02-29  5:38     ` [PATCH] " Huang Ying
  1 sibling, 1 reply; 12+ messages in thread
From: Chen Gong @ 2012-02-29  2:44 UTC (permalink / raw)
  To: Luck, Tony; +Cc: Huang, Ying, lenb, linux-acpi

于 2012/2/29 2:33, Luck, Tony 写道:
>> parameter support.  Or we can fix einj_get_parameter_address() to return
>> NULL if param_extension is 0 and paddrv5 is 0.
>
> That was my intent ... but it looks like I managed to lose that in
> some code re-arrangement.
>
> Perhaps (Outlook will white-space mangle, but it is only one line):
>
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index 4ca087d..3d3816f 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -238,7 +238,7 @@ static void *einj_get_parameter_address(void)
>   			return v5param;
>   		}
>   	}
> -	if (paddrv4) {
> +	if (param_extension&&  paddrv4) {
>   		struct einj_parameter *v4param;
>
>   		v4param = acpi_os_map_memory(paddrv4, sizeof(*v4param));
>
>

After combination the opinions from Ying and Tony, the current fix is the
simplest. Any other changes will make codes more complex. So I prefer to
keep current style. What's your opinion?

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

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

* RE: [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
  2012-02-28 18:33   ` Luck, Tony
  2012-02-29  2:44     ` Chen Gong
@ 2012-02-29  5:38     ` Huang Ying
  1 sibling, 0 replies; 12+ messages in thread
From: Huang Ying @ 2012-02-29  5:38 UTC (permalink / raw)
  To: Luck, Tony; +Cc: Chen Gong, lenb, linux-acpi

On Tue, 2012-02-28 at 11:33 -0700, Luck, Tony wrote:
> > parameter support.  Or we can fix einj_get_parameter_address() to return
> > NULL if param_extension is 0 and paddrv5 is 0.
> 
> That was my intent ... but it looks like I managed to lose that in
> some code re-arrangement.
> 
> Perhaps (Outlook will white-space mangle, but it is only one line):
> 
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index 4ca087d..3d3816f 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -238,7 +238,7 @@ static void *einj_get_parameter_address(void)
>  			return v5param;
>  		}
>  	}
> -	if (paddrv4) {
> +	if (param_extension && paddrv4) {
>  		struct einj_parameter *v4param;
>  
>  		v4param = acpi_os_map_memory(paddrv4, sizeof(*v4param));
> 

Good for me.  Thanks!

Best Regards,
Huang Ying


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

* RE: [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
  2012-02-29  2:44     ` Chen Gong
@ 2012-02-29 19:34       ` Luck, Tony
  2012-03-02  6:54         ` Chen Gong
  0 siblings, 1 reply; 12+ messages in thread
From: Luck, Tony @ 2012-02-29 19:34 UTC (permalink / raw)
  To: Chen Gong; +Cc: Huang, Ying, lenb, linux-acpi

> After combination the opinions from Ying and Tony, the current fix is the
> simplest. Any other changes will make codes more complex. So I prefer to
> keep current style. What's your opinion?

Not sure which one you mean as "the current fix" (they are both one line,
adding a check for param_extension - so neither looks simpler than the
other :-).

My opinion is that Ying's suggestion to make einj_get_parameter_address()
return NULL is the right one.

-Tony


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

* Re: [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
  2012-02-29 19:34       ` Luck, Tony
@ 2012-03-02  6:54         ` Chen Gong
  2012-03-02 19:42           ` Luck, Tony
  2012-03-03  3:56           ` [PATCH v2] " Chen Gong
  0 siblings, 2 replies; 12+ messages in thread
From: Chen Gong @ 2012-03-02  6:54 UTC (permalink / raw)
  To: Luck, Tony; +Cc: Huang, Ying, lenb, linux-acpi

于 2012/3/1 3:34, Luck, Tony 写道:
>> After combination the opinions from Ying and Tony, the current fix is the
>> simplest. Any other changes will make codes more complex. So I prefer to
>> keep current style. What's your opinion?
>
> Not sure which one you mean as "the current fix" (they are both one line,
> adding a check for param_extension - so neither looks simpler than the
> other :-).
>
> My opinion is that Ying's suggestion to make einj_get_parameter_address()
> return NULL is the right one.
>
> -Tony
>
Sorry, here *current fix* means my patch.
I'm afraid your version as below implies some logic errors:

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 4ca087d..3d3816f 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -238,7 +238,7 @@ static void *einj_get_parameter_address(void)
  			return v5param;
  		}
  	}
-	if (paddrv4) {
+	if (param_extension && paddrv4) {
  		struct einj_parameter *v4param;

  		v4param = acpi_os_map_memory(paddrv4, sizeof(*v4param));


Because if working under ACPI4.x without param_extension support, there
is possible that einj_param has meaning (maybe containing address info?),
but we just ignore it under current implementation. Maybe in future we
need it so I don't hope to return NULL so early. OTOH, my fix is just
ignore einj_param in current logic, not very destructive.
--
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

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

* RE: [PATCH] ACPI, APEI, EINJ, limit the range of einj_param
  2012-03-02  6:54         ` Chen Gong
@ 2012-03-02 19:42           ` Luck, Tony
  2012-03-03  3:56           ` [PATCH v2] " Chen Gong
  1 sibling, 0 replies; 12+ messages in thread
From: Luck, Tony @ 2012-03-02 19:42 UTC (permalink / raw)
  To: Chen Gong; +Cc: Huang, Ying, lenb, linux-acpi

> Because if working under ACPI4.x without param_extension support, there
> is possible that einj_param has meaning (maybe containing address info?),
> but we just ignore it under current implementation. Maybe in future we
> need it so I don't hope to return NULL so early. OTOH, my fix is just
> ignore einj_param in current logic, not very destructive.

I'm not sure that we'd ever add such extra meaning to einj_param. There
aren't going to be any more updates to ACPI 4.x.

Just from a naming point of view - if we don't have the "param" extension
enabled - why would "einj_param" need to be set at all?

Stopping early has other advantages:

1) We don't set up a mapping that we'll never use with:
     v4param = acpi_os_map_memory(paddrv4, sizeof (*v4param));

2) We won't uselessly dereference that mapping:
	if (v4param->reserved1 || v4param->reserved2)

-Tony

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

* [PATCH v2] ACPI, APEI, EINJ, limit the range of einj_param
  2012-03-02  6:54         ` Chen Gong
  2012-03-02 19:42           ` Luck, Tony
@ 2012-03-03  3:56           ` Chen Gong
  2012-03-15  8:54             ` Chen Gong
  1 sibling, 1 reply; 12+ messages in thread
From: Chen Gong @ 2012-03-03  3:56 UTC (permalink / raw)
  To: tony.luck, ying.huang, lenb; +Cc: linux-acpi, Chen Gong

On the platforms with ACPI4.x support, parameter extension
is not always doable, which means only parameter extension
is enabled, einj_param can take effect.

v2->v1: stopping early in einj_get_parameter_address for einj_param

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
---
 drivers/acpi/apei/einj.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 4ca087d..3d3816f 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -238,7 +238,7 @@ static void *einj_get_parameter_address(void)
 			return v5param;
 		}
 	}
-	if (paddrv4) {
+	if (param_extension && paddrv4) {
 		struct einj_parameter *v4param;
 
 		v4param = acpi_os_map_memory(paddrv4, sizeof(*v4param));
-- 
1.7.8.2.302.g17b4e


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

* Re: [PATCH v2] ACPI, APEI, EINJ, limit the range of einj_param
  2012-03-03  3:56           ` [PATCH v2] " Chen Gong
@ 2012-03-15  8:54             ` Chen Gong
  2012-03-15 16:48               ` Luck, Tony
  0 siblings, 1 reply; 12+ messages in thread
From: Chen Gong @ 2012-03-15  8:54 UTC (permalink / raw)
  To: Chen Gong; +Cc: tony.luck, ying.huang, lenb, linux-acpi

On 3/3/2012 11:56 AM, Chen Gong wrote:
> On the platforms with ACPI4.x support, parameter extension
> is not always doable, which means only parameter extension
> is enabled, einj_param can take effect.
>
> v2->v1: stopping early in einj_get_parameter_address for einj_param
>
> Signed-off-by: Chen Gong<gong.chen@linux.intel.com>
> ---
>   drivers/acpi/apei/einj.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index 4ca087d..3d3816f 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -238,7 +238,7 @@ static void *einj_get_parameter_address(void)
>   			return v5param;
>   		}
>   	}
> -	if (paddrv4) {
> +	if (param_extension&&  paddrv4) {
>   		struct einj_parameter *v4param;
>
>   		v4param = acpi_os_map_memory(paddrv4, sizeof(*v4param));

Hi, Len

Any comment for this?

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

* RE: [PATCH v2] ACPI, APEI, EINJ, limit the range of einj_param
  2012-03-15  8:54             ` Chen Gong
@ 2012-03-15 16:48               ` Luck, Tony
  2012-03-16  5:41                 ` Chen Gong
  0 siblings, 1 reply; 12+ messages in thread
From: Luck, Tony @ 2012-03-15 16:48 UTC (permalink / raw)
  To: Chen Gong; +Cc: Huang, Ying, lenb, linux-acpi

> -	if (paddrv4) {
> +	if (param_extension&&  paddrv4) {

looks like needs a space moved from after the "&&"
to before it. But otherwise:

Acked-by: Tony Luck <tony.luck@intel.com>

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

* Re: [PATCH v2] ACPI, APEI, EINJ, limit the range of einj_param
  2012-03-15 16:48               ` Luck, Tony
@ 2012-03-16  5:41                 ` Chen Gong
  0 siblings, 0 replies; 12+ messages in thread
From: Chen Gong @ 2012-03-16  5:41 UTC (permalink / raw)
  To: Luck, Tony; +Cc: Huang, Ying, lenb, linux-acpi

于 3/16/2012 12:48 AM, Luck, Tony 写道:
>> -	if (paddrv4) {
>> +	if (param_extension&&   paddrv4) {
> looks like needs a space moved from after the "&&"
> to before it. But otherwise:
>
> Acked-by: Tony Luck<tony.luck@intel.com>
Not sure why because my patch looks good. Maybe my mail client does 
something
--
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

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

end of thread, other threads:[~2012-03-16  5:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-28  8:44 [PATCH] ACPI, APEI, EINJ, limit the range of einj_param Chen Gong
2012-02-28  8:54 ` Huang Ying
2012-02-28 18:33   ` Luck, Tony
2012-02-29  2:44     ` Chen Gong
2012-02-29 19:34       ` Luck, Tony
2012-03-02  6:54         ` Chen Gong
2012-03-02 19:42           ` Luck, Tony
2012-03-03  3:56           ` [PATCH v2] " Chen Gong
2012-03-15  8:54             ` Chen Gong
2012-03-15 16:48               ` Luck, Tony
2012-03-16  5:41                 ` Chen Gong
2012-02-29  5:38     ` [PATCH] " 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.