mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Shaohua Li <shli@fb.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Kernel-team@fb.com,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>,
	stable@vger.kernel.org, v3.7+@devbig257.prn2.facebook.com
Subject: Re: [PATCH] x86: serialize LVTT and TSC_DEADLINE write
Date: Sat, 1 Aug 2015 12:10:41 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1508011202080.3825@nanos> (raw)
In-Reply-To: <75ed9226b028a31e37861fbba51cdffbcfe04eda.1438300532.git.shli@fb.com>

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

  reply	other threads:[~2015-08-01 10:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-31 22:11 Shaohua Li
2015-08-01 10:10 ` Thomas Gleixner [this message]
2015-08-02 15:49   ` Shaohua Li
2015-08-02 19:41     ` Thomas Gleixner
2015-08-03 23:58       ` Shaohua Li
2015-08-05  8:44         ` Ingo Molnar
2015-08-05 16:25           ` Shaohua Li
2015-09-09  3:39             ` Andi Kleen
2015-09-09  4:13               ` Shaohua Li
2015-09-14 20:06                 ` [tip:x86/urgent] x86/apic: Serialize LVTT and TSC_DEADLINE writes tip-bot for Shaohua Li
2015-09-09  7:35               ` [PATCH] x86: serialize LVTT and TSC_DEADLINE write Thomas Gleixner

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=alpine.DEB.2.11.1508011202080.3825@nanos \
    --to=tglx@linutronix.de \
    --cc=Kernel-team@fb.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=shli@fb.com \
    --cc=stable@vger.kernel.org \
    --cc=suresh.b.siddha@intel.com \
    --cc=v3.7+@devbig257.prn2.facebook.com \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®