linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce()
@ 2020-11-18  8:41 Zhen Lei
  2020-11-18  8:54 ` Leizhen (ThunderTown)
  2020-11-18 20:50 ` Verma, Vishal L
  0 siblings, 2 replies; 7+ messages in thread
From: Zhen Lei @ 2020-11-18  8:41 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny,
	Rafael J . Wysocki, Len Brown, linux-nvdimm, linux-acpi,
	linux-kernel
  Cc: Zhen Lei

The badrange to be reported should always cover mce->addr.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/acpi/nfit/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
index ee8d9973f60b..053e719c7bea 100644
--- a/drivers/acpi/nfit/mce.c
+++ b/drivers/acpi/nfit/mce.c
@@ -63,7 +63,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
 
 		/* If this fails due to an -ENOMEM, there is little we can do */
 		nvdimm_bus_add_badrange(acpi_desc->nvdimm_bus,
-				ALIGN(mce->addr, L1_CACHE_BYTES),
+				ALIGN_DOWN(mce->addr, L1_CACHE_BYTES),
 				L1_CACHE_BYTES);
 		nvdimm_region_notify(nfit_spa->nd_region,
 				NVDIMM_REVALIDATE_POISON);
-- 
2.26.0.106.g9fadedd



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

* Re: [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce()
  2020-11-18  8:41 [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce() Zhen Lei
@ 2020-11-18  8:54 ` Leizhen (ThunderTown)
  2020-11-18 19:16   ` Dan Williams
  2020-11-18 20:50 ` Verma, Vishal L
  1 sibling, 1 reply; 7+ messages in thread
From: Leizhen (ThunderTown) @ 2020-11-18  8:54 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny,
	Rafael J . Wysocki, Len Brown, linux-nvdimm, linux-acpi,
	linux-kernel



On 2020/11/18 16:41, Zhen Lei wrote:
> The badrange to be reported should always cover mce->addr.
Maybe I should change this description to:
Make sure the badrange to be reported can always cover mce->addr.

> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/acpi/nfit/mce.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
> index ee8d9973f60b..053e719c7bea 100644
> --- a/drivers/acpi/nfit/mce.c
> +++ b/drivers/acpi/nfit/mce.c
> @@ -63,7 +63,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
>  
>  		/* If this fails due to an -ENOMEM, there is little we can do */
>  		nvdimm_bus_add_badrange(acpi_desc->nvdimm_bus,
> -				ALIGN(mce->addr, L1_CACHE_BYTES),
> +				ALIGN_DOWN(mce->addr, L1_CACHE_BYTES),
>  				L1_CACHE_BYTES);
>  		nvdimm_region_notify(nfit_spa->nd_region,
>  				NVDIMM_REVALIDATE_POISON);
> 


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

* Re: [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce()
  2020-11-18  8:54 ` Leizhen (ThunderTown)
@ 2020-11-18 19:16   ` Dan Williams
  2020-11-19  1:53     ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Williams @ 2020-11-18 19:16 UTC (permalink / raw)
  To: Leizhen (ThunderTown)
  Cc: Vishal Verma, Dave Jiang, Ira Weiny, Rafael J . Wysocki,
	Len Brown, linux-nvdimm, linux-acpi, linux-kernel

On Wed, Nov 18, 2020 at 12:55 AM Leizhen (ThunderTown)
<thunder.leizhen@huawei.com> wrote:
>
>
>
> On 2020/11/18 16:41, Zhen Lei wrote:
> > The badrange to be reported should always cover mce->addr.
> Maybe I should change this description to:
> Make sure the badrange to be reported can always cover mce->addr.

Yes, I like that better. Can you also say a bit more about how you
found this bug? As far as I can see this looks like -stable material.

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

* Re: [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce()
  2020-11-18  8:41 [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce() Zhen Lei
  2020-11-18  8:54 ` Leizhen (ThunderTown)
@ 2020-11-18 20:50 ` Verma, Vishal L
  2020-11-19  1:55   ` Leizhen (ThunderTown)
  1 sibling, 1 reply; 7+ messages in thread
From: Verma, Vishal L @ 2020-11-18 20:50 UTC (permalink / raw)
  To: linux-nvdimm, Jiang, Dave, lenb, thunder.leizhen, rjw,
	linux-kernel, Williams, Dan J, linux-acpi, Weiny, Ira

On Wed, 2020-11-18 at 16:41 +0800, Zhen Lei wrote:
> The badrange to be reported should always cover mce->addr.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/acpi/nfit/mce.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Ah good find, agreed with Dan that this is stable material.
Minor nit, I'd recommend rewording the subject line to something like:

"acpi/nfit: fix badrange insertion in nfit_handle_mce()"

Otherwise, looks good to me.
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> 
> diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
> index ee8d9973f60b..053e719c7bea 100644
> --- a/drivers/acpi/nfit/mce.c
> +++ b/drivers/acpi/nfit/mce.c
> @@ -63,7 +63,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
>  
>  		/* If this fails due to an -ENOMEM, there is little we can do */
>  		nvdimm_bus_add_badrange(acpi_desc->nvdimm_bus,
> -				ALIGN(mce->addr, L1_CACHE_BYTES),
> +				ALIGN_DOWN(mce->addr, L1_CACHE_BYTES),
>  				L1_CACHE_BYTES);
>  		nvdimm_region_notify(nfit_spa->nd_region,
>  				NVDIMM_REVALIDATE_POISON);


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

* Re: [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce()
  2020-11-18 19:16   ` Dan Williams
@ 2020-11-19  1:53     ` Leizhen (ThunderTown)
  2020-11-19  2:06       ` Dan Williams
  0 siblings, 1 reply; 7+ messages in thread
From: Leizhen (ThunderTown) @ 2020-11-19  1:53 UTC (permalink / raw)
  To: Dan Williams
  Cc: Vishal Verma, Dave Jiang, Ira Weiny, Rafael J . Wysocki,
	Len Brown, linux-nvdimm, linux-acpi, linux-kernel



On 2020/11/19 3:16, Dan Williams wrote:
> On Wed, Nov 18, 2020 at 12:55 AM Leizhen (ThunderTown)
> <thunder.leizhen@huawei.com> wrote:
>>
>>
>>
>> On 2020/11/18 16:41, Zhen Lei wrote:
>>> The badrange to be reported should always cover mce->addr.
>> Maybe I should change this description to:
>> Make sure the badrange to be reported can always cover mce->addr.
> 
> Yes, I like that better. Can you also say a bit more about how you
> found this bug? As far as I can see this looks like -stable material.

I found it when I was learning the code. I'm looking at it carefully.

> 
> 


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

* Re: [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce()
  2020-11-18 20:50 ` Verma, Vishal L
@ 2020-11-19  1:55   ` Leizhen (ThunderTown)
  0 siblings, 0 replies; 7+ messages in thread
From: Leizhen (ThunderTown) @ 2020-11-19  1:55 UTC (permalink / raw)
  To: Verma, Vishal L, linux-nvdimm, Jiang, Dave, lenb, rjw,
	linux-kernel, Williams, Dan J, linux-acpi, Weiny, Ira



On 2020/11/19 4:50, Verma, Vishal L wrote:
> On Wed, 2020-11-18 at 16:41 +0800, Zhen Lei wrote:
>> The badrange to be reported should always cover mce->addr.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>>  drivers/acpi/nfit/mce.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Ah good find, agreed with Dan that this is stable material.
> Minor nit, I'd recommend rewording the subject line to something like:
> 
> "acpi/nfit: fix badrange insertion in nfit_handle_mce()"

OK, I will send v2.

> 
> Otherwise, looks good to me.
> Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
> 
>>
>> diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
>> index ee8d9973f60b..053e719c7bea 100644
>> --- a/drivers/acpi/nfit/mce.c
>> +++ b/drivers/acpi/nfit/mce.c
>> @@ -63,7 +63,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
>>  
>>  		/* If this fails due to an -ENOMEM, there is little we can do */
>>  		nvdimm_bus_add_badrange(acpi_desc->nvdimm_bus,
>> -				ALIGN(mce->addr, L1_CACHE_BYTES),
>> +				ALIGN_DOWN(mce->addr, L1_CACHE_BYTES),
>>  				L1_CACHE_BYTES);
>>  		nvdimm_region_notify(nfit_spa->nd_region,
>>  				NVDIMM_REVALIDATE_POISON);
> 


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

* Re: [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce()
  2020-11-19  1:53     ` Leizhen (ThunderTown)
@ 2020-11-19  2:06       ` Dan Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Williams @ 2020-11-19  2:06 UTC (permalink / raw)
  To: Leizhen (ThunderTown)
  Cc: Vishal Verma, Dave Jiang, Ira Weiny, Rafael J . Wysocki,
	Len Brown, linux-nvdimm, linux-acpi, linux-kernel

On Wed, Nov 18, 2020 at 5:53 PM Leizhen (ThunderTown)
<thunder.leizhen@huawei.com> wrote:
>
>
>
> On 2020/11/19 3:16, Dan Williams wrote:
> > On Wed, Nov 18, 2020 at 12:55 AM Leizhen (ThunderTown)
> > <thunder.leizhen@huawei.com> wrote:
> >>
> >>
> >>
> >> On 2020/11/18 16:41, Zhen Lei wrote:
> >>> The badrange to be reported should always cover mce->addr.
> >> Maybe I should change this description to:
> >> Make sure the badrange to be reported can always cover mce->addr.
> >
> > Yes, I like that better. Can you also say a bit more about how you
> > found this bug? As far as I can see this looks like -stable material.
>
> I found it when I was learning the code. I'm looking at it carefully.

Ok, good eye.

The impact of this one is somewhat mitigated by the fact that errors
are expanded to 512 byte blast radius, and error consumption maps 4k
around errors. I suspect few are trying to use the badblock list to do
fine grained recovery so this bug went unnoticed.

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

end of thread, other threads:[~2020-11-19  2:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18  8:41 [PATCH 1/1] ACPI/nfit: correct the badrange to be reported in nfit_handle_mce() Zhen Lei
2020-11-18  8:54 ` Leizhen (ThunderTown)
2020-11-18 19:16   ` Dan Williams
2020-11-19  1:53     ` Leizhen (ThunderTown)
2020-11-19  2:06       ` Dan Williams
2020-11-18 20:50 ` Verma, Vishal L
2020-11-19  1:55   ` Leizhen (ThunderTown)

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