Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751302AbbHAKLO (ORCPT ); Sat, 1 Aug 2015 06:11:14 -0400 Received: from www.linutronix.de ([62.245.132.108]:56202 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbbHAKLM (ORCPT ); Sat, 1 Aug 2015 06:11:12 -0400 Date: Sat, 1 Aug 2015 12:10:41 +0200 (CEST) From: Thomas Gleixner To: Shaohua Li cc: x86@kernel.org, linux-kernel@vger.kernel.org, Kernel-team@fb.com, Suresh Siddha , "H. Peter Anvin" , Ingo Molnar , stable@vger.kernel.org, v3.7+@devbig257.prn2.facebook.com Subject: Re: [PATCH] x86: serialize LVTT and TSC_DEADLINE write In-Reply-To: <75ed9226b028a31e37861fbba51cdffbcfe04eda.1438300532.git.shli@fb.com> Message-ID: References: <75ed9226b028a31e37861fbba51cdffbcfe04eda.1438300532.git.shli@fb.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1032 Lines: 33 On Fri, 31 Jul 2015, Shaohua Li wrote: > @@ -336,6 +336,22 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen) > apic_write(APIC_LVTT, lvtt_value); > > if (lvtt_value & APIC_LVT_TIMER_TSCDEADLINE) { > + u64 msr; > + > + /* > + * See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode, > + * writing APIC LVTT and TSC_DEADLINE MSR isn't serialized. > + * This uses the algorithm described in Intel SDM to serialize > + * the two writes > + * */ > + while (1) { > + wrmsrl(MSR_IA32_TSC_DEADLINE, -1L); > + rdmsrl(MSR_IA32_TSC_DEADLINE, msr); > + if (msr) > + break; > + } > + wrmsrl(MSR_IA32_TSC_DEADLINE, 0); I think this is exceptionally silly. A proper fence after the apic_write() should have the same effect. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/