Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] x86/mce: fix a wrong assignment of i_mce.status
@ 2020-06-11  2:32 Zhenzhong Duan
  2020-06-11 16:55 ` Luck, Tony
  0 siblings, 1 reply; 4+ messages in thread
From: Zhenzhong Duan @ 2020-06-11  2:32 UTC (permalink / raw)
  To: linux-kernel, linux-edac
  Cc: x86, tony.luck, bp, tglx, mingo, hpa, Zhenzhong Duan

The original code is a nop as i_mce.status is or'ed with part of itself,
fix it.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
---
 arch/x86/kernel/cpu/mce/inject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
index 3413b41..dc28a61 100644
--- a/arch/x86/kernel/cpu/mce/inject.c
+++ b/arch/x86/kernel/cpu/mce/inject.c
@@ -511,7 +511,7 @@ static void do_inject(void)
 	 */
 	if (inj_type == DFR_INT_INJ) {
 		i_mce.status |= MCI_STATUS_DEFERRED;
-		i_mce.status |= (i_mce.status & ~MCI_STATUS_UC);
+		i_mce.status &= ~MCI_STATUS_UC;
 	}
 
 	/*
-- 
1.8.3.1


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

* Re: [PATCH] x86/mce: fix a wrong assignment of i_mce.status
  2020-06-11  2:32 [PATCH] x86/mce: fix a wrong assignment of i_mce.status Zhenzhong Duan
@ 2020-06-11 16:55 ` Luck, Tony
  2020-06-11 18:36   ` Yazen Ghannam
  2020-06-15 11:36   ` Borislav Petkov
  0 siblings, 2 replies; 4+ messages in thread
From: Luck, Tony @ 2020-06-11 16:55 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: linux-kernel, linux-edac, x86, bp, tglx, mingo, hpa, Yazen Ghannam

+Yazen

On Thu, Jun 11, 2020 at 10:32:38AM +0800, Zhenzhong Duan wrote:
> The original code is a nop as i_mce.status is or'ed with part of itself,
> fix it.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> ---
>  arch/x86/kernel/cpu/mce/inject.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
> index 3413b41..dc28a61 100644
> --- a/arch/x86/kernel/cpu/mce/inject.c
> +++ b/arch/x86/kernel/cpu/mce/inject.c
> @@ -511,7 +511,7 @@ static void do_inject(void)
>  	 */
>  	if (inj_type == DFR_INT_INJ) {
>  		i_mce.status |= MCI_STATUS_DEFERRED;
> -		i_mce.status |= (i_mce.status & ~MCI_STATUS_UC);
> +		i_mce.status &= ~MCI_STATUS_UC;

Boris: "git blame" says you wrote this code. Patch looks right (in
that it makes the code do what the comment just above says it is trying
to do):

         * - MCx_STATUS[UC] cleared: deferred errors are _not_ UC

But this is AMD specific, so I'll defer judgement

-Tony

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

* Re: [PATCH] x86/mce: fix a wrong assignment of i_mce.status
  2020-06-11 16:55 ` Luck, Tony
@ 2020-06-11 18:36   ` Yazen Ghannam
  2020-06-15 11:36   ` Borislav Petkov
  1 sibling, 0 replies; 4+ messages in thread
From: Yazen Ghannam @ 2020-06-11 18:36 UTC (permalink / raw)
  To: Luck, Tony
  Cc: Zhenzhong Duan, linux-kernel, linux-edac, x86, bp, tglx, mingo, hpa

On Thu, Jun 11, 2020 at 12:55:00PM -0400, Luck, Tony wrote:
> +Yazen
> 
> On Thu, Jun 11, 2020 at 10:32:38AM +0800, Zhenzhong Duan wrote:
> > The original code is a nop as i_mce.status is or'ed with part of itself,
> > fix it.
> > 
> > Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> > ---
> >  arch/x86/kernel/cpu/mce/inject.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
> > index 3413b41..dc28a61 100644
> > --- a/arch/x86/kernel/cpu/mce/inject.c
> > +++ b/arch/x86/kernel/cpu/mce/inject.c
> > @@ -511,7 +511,7 @@ static void do_inject(void)
> >  	 */
> >  	if (inj_type == DFR_INT_INJ) {
> >  		i_mce.status |= MCI_STATUS_DEFERRED;
> > -		i_mce.status |= (i_mce.status & ~MCI_STATUS_UC);
> > +		i_mce.status &= ~MCI_STATUS_UC;
> 
> Boris: "git blame" says you wrote this code. Patch looks right (in
> that it makes the code do what the comment just above says it is trying
> to do):
> 
>          * - MCx_STATUS[UC] cleared: deferred errors are _not_ UC
> 
> But this is AMD specific, so I'll defer judgement
>

Acked-by: Yazen Ghannam <yazen.ghannam@amd.com>

Thanks,
Yazen

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

* Re: [PATCH] x86/mce: fix a wrong assignment of i_mce.status
  2020-06-11 16:55 ` Luck, Tony
  2020-06-11 18:36   ` Yazen Ghannam
@ 2020-06-15 11:36   ` Borislav Petkov
  1 sibling, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2020-06-15 11:36 UTC (permalink / raw)
  To: Luck, Tony
  Cc: Zhenzhong Duan, linux-kernel, linux-edac, x86, tglx, mingo, hpa,
	Yazen Ghannam

On Thu, Jun 11, 2020 at 09:55:00AM -0700, Luck, Tony wrote:
> +Yazen
> 
> On Thu, Jun 11, 2020 at 10:32:38AM +0800, Zhenzhong Duan wrote:
> > The original code is a nop as i_mce.status is or'ed with part of itself,
> > fix it.
> > 
> > Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> > ---
> >  arch/x86/kernel/cpu/mce/inject.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
> > index 3413b41..dc28a61 100644
> > --- a/arch/x86/kernel/cpu/mce/inject.c
> > +++ b/arch/x86/kernel/cpu/mce/inject.c
> > @@ -511,7 +511,7 @@ static void do_inject(void)
> >  	 */
> >  	if (inj_type == DFR_INT_INJ) {
> >  		i_mce.status |= MCI_STATUS_DEFERRED;
> > -		i_mce.status |= (i_mce.status & ~MCI_STATUS_UC);
> > +		i_mce.status &= ~MCI_STATUS_UC;
> 
> Boris: "git blame" says you wrote this code.

Not me but I should've caught it:

a1300e505297 ("x86/ras/mce_amd_inj: Trigger deferred and thresholding errors interrupts")

:-\

I believe Aravind wanted to do the &= thing, i.e.,

	i_mce.status = (i_mce.status & ~MCI_STATUS_UC);

or the short version above.

:-)

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11  2:32 [PATCH] x86/mce: fix a wrong assignment of i_mce.status Zhenzhong Duan
2020-06-11 16:55 ` Luck, Tony
2020-06-11 18:36   ` Yazen Ghannam
2020-06-15 11:36   ` Borislav Petkov

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git