From: Andrew Cooper Subject: [PATCH v2 2/3] x86/traps: Avoid interleaved writes when updating potentially-live descriptors Date: Wed, 11 Feb 2015 15:06:52 +0000 Message-ID: <1423667212-21929-1-git-send-email-andrew.cooper3@citrix.com> References: <54DB40FC020000780005EF55@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54DB40FC020000780005EF55@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Tim Deegan , Jan Beulich List-Id: xen-devel@lists.xenproject.org Signed-off-by: Andrew Cooper CC: Jan Beulich CC: Tim Deegan --- v2: * Use _write_gate_lower() instead of opencoding write_atomic() * Drop write_atomic() in _write_gate_lower(). It doesn't appear to make a practical difference (although certainly does cause a difference to the register scheduling). --- xen/include/asm-x86/processor.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index 2773ea8..c5c647a 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -444,9 +444,12 @@ struct __packed __cacheline_aligned tss_struct { * descriptor table entry. */ static always_inline void set_ist(idt_entry_t *idt, unsigned long ist) { + idt_entry_t new = *idt; + /* IST is a 3 bit field, 32 bits into the IDT entry. */ ASSERT(ist <= IST_MAX); - idt->a = (idt->a & ~(7UL << 32)) | (ist << 32); + new.a = (idt->a & ~(7UL << 32)) | (ist << 32); + _write_gate_lower(idt, &new); } #define IDT_ENTRIES 256 -- 1.7.10.4