From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v2 2/4] xen/x86: Drop unnecessary barriers
Date: Wed, 16 Aug 2017 12:22:08 +0100 [thread overview]
Message-ID: <1502882530-31700-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1502882530-31700-1-git-send-email-andrew.cooper3@citrix.com>
x86's current implementation of wmb() is a compiler barrier. As a result, the
only change in this patch is to remove an mfence instruction from
cpuidle_disable_deep_cstate().
None of these barriers serve any purpose. Most aren't aren't synchronising
with any remote cpus, where as the mcetelem barriers are redundant with
spin_unlock(), which already has full read/write barrier semantics.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
v2:
* s/erronious/unnecessary/
* Drop more unnecessary barriers
---
xen/arch/x86/acpi/cpu_idle.c | 2 --
xen/arch/x86/cpu/mcheck/mce.c | 3 ---
xen/arch/x86/cpu/mcheck/mctelem.c | 3 ---
xen/arch/x86/crash.c | 3 ---
xen/arch/x86/mm/shadow/multi.c | 1 -
xen/arch/x86/smpboot.c | 2 --
xen/drivers/passthrough/amd/iommu_init.c | 2 --
7 files changed, 16 deletions(-)
diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 482b8a7..5879ad6 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -1331,8 +1331,6 @@ void cpuidle_disable_deep_cstate(void)
max_cstate = 1;
}
- mb();
-
hpet_disable_legacy_broadcast();
}
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 30525dd..aa6e556 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -86,7 +86,6 @@ static x86_mce_vector_t _machine_check_vector = unexpected_machine_check;
void x86_mce_vector_register(x86_mce_vector_t hdlr)
{
_machine_check_vector = hdlr;
- wmb();
}
/* Call the installed machine check handler for this CPU setup. */
@@ -369,8 +368,6 @@ mcheck_mca_logout(enum mca_source who, struct mca_banks *bankmask,
mcabank_clear(i);
else if ( who == MCA_MCE_SCAN && need_clear)
mcabanks_set(i, clear_bank);
-
- wmb();
}
if (mig && errcnt > 0) {
diff --git a/xen/arch/x86/cpu/mcheck/mctelem.c b/xen/arch/x86/cpu/mcheck/mctelem.c
index b144a66..1731514 100644
--- a/xen/arch/x86/cpu/mcheck/mctelem.c
+++ b/xen/arch/x86/cpu/mcheck/mctelem.c
@@ -520,7 +520,6 @@ mctelem_cookie_t mctelem_consume_oldest_begin(mctelem_class_t which)
}
mctelem_processing_hold(tep);
- wmb();
spin_unlock(&processing_lock);
return MCTE2COOKIE(tep);
}
@@ -531,7 +530,6 @@ void mctelem_consume_oldest_end(mctelem_cookie_t cookie)
spin_lock(&processing_lock);
mctelem_processing_release(tep);
- wmb();
spin_unlock(&processing_lock);
}
@@ -547,6 +545,5 @@ void mctelem_ack(mctelem_class_t which, mctelem_cookie_t cookie)
spin_lock(&processing_lock);
if (tep == mctctl.mctc_processing_head[target])
mctelem_processing_release(tep);
- wmb();
spin_unlock(&processing_lock);
}
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 82535c4..8d74258 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -146,9 +146,6 @@ static void nmi_shootdown_cpus(void)
write_atomic((unsigned long *)__va(__pa(&exception_table[TRAP_nmi])),
(unsigned long)&do_nmi_crash);
- /* Ensure the new callback function is set before sending out the NMI. */
- wmb();
-
smp_send_nmi_allbutself();
msecs = 1000; /* Wait at most a second for the other cpus to stop */
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index c9c2252..1e3dfaf 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -3112,7 +3112,6 @@ static int sh_page_fault(struct vcpu *v,
* will make sure no inconsistent mapping being translated into
* shadow page table. */
version = atomic_read(&d->arch.paging.shadow.gtable_dirty_version);
- rmb();
walk_ok = sh_walk_guest_tables(v, va, &gw, error_code);
#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8d91f6c..5b094b4 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -355,7 +355,6 @@ void start_secondary(void *unused)
spin_debug_enable();
set_cpu_sibling_map(cpu);
notify_cpu_starting(cpu);
- wmb();
/*
* We need to hold vector_lock so there the set of online cpus
@@ -371,7 +370,6 @@ void start_secondary(void *unused)
local_irq_enable();
mtrr_ap_init();
- wmb();
startup_cpu_idle_loop();
}
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index a459e99..d5b6049 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -558,7 +558,6 @@ static void parse_event_log_entry(struct amd_iommu *iommu, u32 entry[])
return;
}
udelay(1);
- rmb();
code = get_field_from_reg_u32(entry[1], IOMMU_EVENT_CODE_MASK,
IOMMU_EVENT_CODE_SHIFT);
}
@@ -663,7 +662,6 @@ void parse_ppr_log_entry(struct amd_iommu *iommu, u32 entry[])
return;
}
udelay(1);
- rmb();
code = get_field_from_reg_u32(entry[1], IOMMU_PPR_LOG_CODE_MASK,
IOMMU_PPR_LOG_CODE_SHIFT);
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-08-16 11:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 11:22 [PATCH v2 0/4] x86: Corrections to barrier usage Andrew Cooper
2017-08-16 11:22 ` [PATCH v2 1/4] x86/mcheck: Minor cleanup to amd_nonfatal Andrew Cooper
2017-08-16 15:11 ` Jan Beulich
2017-08-18 13:19 ` Tim Deegan
2017-08-16 11:22 ` Andrew Cooper [this message]
2017-08-16 15:23 ` [PATCH v2 2/4] xen/x86: Drop unnecessary barriers Jan Beulich
2017-08-16 16:47 ` Andrew Cooper
2017-08-16 17:03 ` Andrew Cooper
2017-08-17 7:50 ` Jan Beulich
2017-08-17 7:48 ` Jan Beulich
2017-08-18 14:47 ` Tim Deegan
2017-08-18 15:04 ` Jan Beulich
2017-08-18 15:13 ` Tim Deegan
2017-08-18 15:07 ` Tim Deegan
2017-08-16 17:18 ` [PATCH v2 2.5/4] xen/x86: Replace mandatory barriers with compiler barriers Andrew Cooper
2017-08-17 8:15 ` Jan Beulich
2017-08-18 13:55 ` [PATCH v2 2/4] xen/x86: Drop unnecessary barriers Tim Deegan
2017-08-18 14:07 ` Tim Deegan
2017-08-18 14:23 ` [PATCH] xen/x86/shadow: adjust barriers around gtable_dirty_version Tim Deegan
2017-08-18 14:26 ` Andrew Cooper
2017-08-16 11:22 ` [PATCH v2 3/4] xen/x86: Replace remaining mandatory barriers with SMP barriers Andrew Cooper
2017-08-16 15:42 ` Dario Faggioli
2017-08-17 8:37 ` Jan Beulich
2017-08-17 9:35 ` Andrew Cooper
2017-08-17 10:01 ` Jan Beulich
2017-08-16 11:22 ` [PATCH v2 4/4] xen/x86: Correct mandatory and SMP barrier definitions Andrew Cooper
2017-08-16 15:44 ` Dario Faggioli
2017-08-17 8:41 ` Jan Beulich
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=1502882530-31700-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.org \
/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).