* [PATCH v3 0/2] xen/mce: fix file-scoped static variables in mce.c
@ 2017-04-10 6:18 Haozhong Zhang
2017-04-10 6:18 ` [PATCH v3 1/2] xen/mce: make mce barriers private to their users Haozhong Zhang
2017-04-10 6:18 ` [PATCH v3 2/2] xen/mce: make 'found_error' and 'mce_fatal_cpus' private to mcheck_cmn_handler() Haozhong Zhang
0 siblings, 2 replies; 3+ messages in thread
From: Haozhong Zhang @ 2017-04-10 6:18 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Haozhong Zhang
These two patches are the remaining code cleanup patches in v2.
Changes in v3:
* Rebase on staging branch.
* Rename the argument name of DEFINE_MCE_BARRIER() in patch 1.
Haozhong Zhang (2):
xen/mce: make mce barriers private to their users
xen/mce: make 'found_error' and 'mce_fatal_cpus' private to mcheck_cmn_handler()
xen/arch/x86/cpu/mcheck/barrier.h | 7 +++++++
xen/arch/x86/cpu/mcheck/mce.c | 15 +++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
--
2.10.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3 1/2] xen/mce: make mce barriers private to their users
2017-04-10 6:18 [PATCH v3 0/2] xen/mce: fix file-scoped static variables in mce.c Haozhong Zhang
@ 2017-04-10 6:18 ` Haozhong Zhang
2017-04-10 6:18 ` [PATCH v3 2/2] xen/mce: make 'found_error' and 'mce_fatal_cpus' private to mcheck_cmn_handler() Haozhong Zhang
1 sibling, 0 replies; 3+ messages in thread
From: Haozhong Zhang @ 2017-04-10 6:18 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Haozhong Zhang
Each of current mce barriers is actually used by only one function, so
move their definitions into their users. A static mce barrier initializer
is introduced so we can move the initialization of above mce barriers
to their definitions.
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Changes in v3:
* Rename the argument of DEFINE_MCE_BARRIER() to "name".
---
xen/arch/x86/cpu/mcheck/barrier.h | 7 +++++++
xen/arch/x86/cpu/mcheck/mce.c | 10 +++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/xen/arch/x86/cpu/mcheck/barrier.h b/xen/arch/x86/cpu/mcheck/barrier.h
index 87f7550..d3ccf8b 100644
--- a/xen/arch/x86/cpu/mcheck/barrier.h
+++ b/xen/arch/x86/cpu/mcheck/barrier.h
@@ -10,6 +10,13 @@ struct mce_softirq_barrier {
atomic_t outgen;
};
+#define DEFINE_MCE_BARRIER(name) \
+ struct mce_softirq_barrier name = { \
+ .val = ATOMIC_INIT(0), \
+ .ingen = ATOMIC_INIT(0), \
+ .outgen = ATOMIC_INIT(0), \
+ }
+
/*
* Initialize a barrier. Just set it to 0.
*/
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 51a10ed..0d9d5b0 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -174,10 +174,6 @@ void mce_need_clearbank_register(mce_need_clearbank_t cbfunc)
mc_need_clearbank_scan = cbfunc;
}
-
-static struct mce_softirq_barrier mce_inside_bar, mce_severity_bar;
-static struct mce_softirq_barrier mce_trap_bar;
-
/*
* mce_logout_lock should only be used in the trap handler,
* while MCIP has not been cleared yet in the global status
@@ -452,6 +448,7 @@ static int mce_urgent_action(const struct cpu_user_regs *regs,
/* Shared #MC handler. */
void mcheck_cmn_handler(const struct cpu_user_regs *regs)
{
+ static DEFINE_MCE_BARRIER(mce_trap_bar);
static atomic_t severity_cpu = ATOMIC_INIT(-1);
struct mca_banks *bankmask = mca_allbanks;
struct mca_banks *clear_bank = __get_cpu_var(mce_clear_banks);
@@ -1699,6 +1696,8 @@ static int mce_delayed_action(mctelem_cookie_t mctc)
/* Softirq Handler for this MCE# processing */
static void mce_softirq(void)
{
+ static DEFINE_MCE_BARRIER(mce_inside_bar);
+ static DEFINE_MCE_BARRIER(mce_severity_bar);
static atomic_t severity_cpu;
int cpu = smp_processor_id();
unsigned int workcpu;
@@ -1766,9 +1765,6 @@ void mce_handler_init(void)
/* callback register, do we really need so many callback? */
/* mce handler data initialization */
- mce_barrier_init(&mce_inside_bar);
- mce_barrier_init(&mce_severity_bar);
- mce_barrier_init(&mce_trap_bar);
spin_lock_init(&mce_logout_lock);
open_softirq(MACHINE_CHECK_SOFTIRQ, mce_softirq);
}
--
2.10.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3 2/2] xen/mce: make 'found_error' and 'mce_fatal_cpus' private to mcheck_cmn_handler()
2017-04-10 6:18 [PATCH v3 0/2] xen/mce: fix file-scoped static variables in mce.c Haozhong Zhang
2017-04-10 6:18 ` [PATCH v3 1/2] xen/mce: make mce barriers private to their users Haozhong Zhang
@ 2017-04-10 6:18 ` Haozhong Zhang
1 sibling, 0 replies; 3+ messages in thread
From: Haozhong Zhang @ 2017-04-10 6:18 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Haozhong Zhang
mcheck_cmn_handler() is the only user of 'found_error' and
'mce_fatal_cpus'.
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
xen/arch/x86/cpu/mcheck/mce.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 0d9d5b0..54fd000 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -182,9 +182,6 @@ void mce_need_clearbank_register(mce_need_clearbank_t cbfunc)
*/
static DEFINE_SPINLOCK(mce_logout_lock);
-static atomic_t found_error = ATOMIC_INIT(0);
-static cpumask_t mce_fatal_cpus;
-
const struct mca_error_handler *__read_mostly mce_dhandlers;
const struct mca_error_handler *__read_mostly mce_uhandlers;
unsigned int __read_mostly mce_dhandler_num;
@@ -450,6 +447,8 @@ void mcheck_cmn_handler(const struct cpu_user_regs *regs)
{
static DEFINE_MCE_BARRIER(mce_trap_bar);
static atomic_t severity_cpu = ATOMIC_INIT(-1);
+ static atomic_t found_error = ATOMIC_INIT(0);
+ static cpumask_t mce_fatal_cpus;
struct mca_banks *bankmask = mca_allbanks;
struct mca_banks *clear_bank = __get_cpu_var(mce_clear_banks);
uint64_t gstatus;
--
2.10.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-10 6:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 6:18 [PATCH v3 0/2] xen/mce: fix file-scoped static variables in mce.c Haozhong Zhang
2017-04-10 6:18 ` [PATCH v3 1/2] xen/mce: make mce barriers private to their users Haozhong Zhang
2017-04-10 6:18 ` [PATCH v3 2/2] xen/mce: make 'found_error' and 'mce_fatal_cpus' private to mcheck_cmn_handler() Haozhong Zhang
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.