From: Chen Yucong <slaoub@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Tony Luck <tony.luck@gmail.com>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86, MCE, AMD: move invariant code out from loop body
Date: Thu, 02 Oct 2014 23:20:12 +0800 [thread overview]
Message-ID: <1412263212.8085.6.camel@debian> (raw)
In-Reply-To: <20141002143819.GE16452@pd.tnic>
On Thu, 2014-10-02 at 16:38 +0200, Borislav Petkov wrote:
>
> On Mon, Sep 22, 2014 at 09:11:00PM +0200, Borislav Petkov wrote:
> > On Mon, Sep 22, 2014 at 05:23:32PM +0800, Chen Yucong wrote:
> > > Hi Boris,
> > >
> > > I have found the following code snippet in mce_amd.c.
> > >
> > > /* cpu init entry point, called from mce.c with preempt off */
> > > void mce_amd_feature_init(struct cpuinfo_x86 *c)
> > > {
> > > ... ...
> > > for (bank = 0; bank < mca_cfg.banks; ++bank) {
> > > for (block = 0; block < NR_BLOCKS; ++block) {
> > > ... ...
> > > mce_threshold_block_init(&b, offset);
> > > mce_threshold_vector = amd_threshold_interrupt;
> > > }
> > > }
> > > }
> > >
> > > Why should "mce_threshold_vector = amd_threshold_interrupt" be placed in
> > > the inner loop body?
> >
> > Yeah, it was added sloppily with b276268631af3, I'm not surprised. Feel
> > free to send a fix.
>
> do you still want to send a fix or should I fix it up quickly?
>
From: Chen Yucong <slaoub@gmail.com>
Subject: [PATCH] x86, MCE, AMD: move invariant code out from loop body
"mce_threshold_vector = amd_threshold_interrupt;" is loop invariant code
in mce_amd_feature_init(). So it should be moved out from loop body.
Signed-off-by: Chen Yucong <slaoub@gmail.com>
---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 5d4999f..f727701 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -253,9 +253,10 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
}
mce_threshold_block_init(&b, offset);
- mce_threshold_vector = amd_threshold_interrupt;
}
}
+
+ mce_threshold_vector = amd_threshold_interrupt;
}
/*
--
1.7.10.4
next parent reply other threads:[~2014-10-02 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1411377812.1917.112.camel@cyc>
[not found] ` <20140922191100.GC4709@pd.tnic>
[not found] ` <20141002143819.GE16452@pd.tnic>
2014-10-02 15:20 ` Chen Yucong [this message]
2014-10-06 21:27 ` [PATCH] x86, MCE, AMD: move invariant code out from loop body Borislav Petkov
2014-10-07 6:08 ` Chen Yucong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412263212.8085.6.camel@debian \
--to=slaoub@gmail.com \
--cc=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).