Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1439343
| Path | csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Peter Zijlstra <peterz@infradead.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86: add workaround monitor bug |
| Date | Fri, 08 Jul 2016 13:50:01 +0200 |
| Message-ID | <rSCs9-4e3-27@gated-at.bofh.it> (permalink) |
| References | <rRYuK-3wy-33@gated-at.bofh.it> <rSzND-2nt-3@gated-at.bofh.it> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23.1 (2014-03-12) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 34 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Jacob Pan <jacob.jun.pan@linux.intel.com>, LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, X86 Kernel <x86@kernel.org>, Arjan van de Ven <arjan@linux.intel.com>, Len Brown <lenb@kernel.org> |
| X-Original-Date | Fri, 8 Jul 2016 13:45:58 +0200 |
| X-Original-Message-ID | <20160708114558.GI30909@twins.programming.kicks-ass.net> |
| X-Original-References | <1467824514-20607-1-git-send-email-jacob.jun.pan@linux.intel.com> <20160708085515.GA4682@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1439343 |
Show key headers only | View raw
On Fri, Jul 08, 2016 at 10:55:15AM +0200, Ingo Molnar wrote:
> > static inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
> > {
> > - if (!current_set_polling_and_test()) {
> > + if (static_cpu_has_bug(X86_BUG_MONITOR) || !current_set_polling_and_test()) {
>
> Hm, this might be suboptimal: if MONITOR/MWAIT is implemented by setting the
> exclusive flag for the monitored memory address and then snooping for cache
> invalidation requests for that cache line, then not modifying the ->flags value
> with TIF_POLLING_NRFLAG makes MWAIT not wake up - only the IPI would wake it up.
Confused.. POLLING_NRFLAGS is not used to wake up ever. It is only used
to determine if we want to send IPIs or not.
And since we _must_ send an IPI in this case, because the monitor is
busted, we cannot set this.
> I think a better approach would be to still optimistically modify the ->flags
> value _AND_ to also send an IPI, to make sure the wakeup is not lost. This means
> that the woken CPU will wake up much faster (no IPI latency).
This is exactly what is done. See resched_curr()'s use of
set_nr_and_not_polling(). That does:
if (!(fetch_or(&flags, NEED_RESCHED) & POLLING_NRFLAG))
smp_send_reschedule(cpu);
So we unconditionally set NEED_RESCHED, if, when we set that, POLLING
was set, we skip the IPI.
So again, since monitor is busted, simply setting NEED_RESCHED will not
wake us, we must send the IPI, this is achieved by not setting
POLLING_NRFLAG.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86: add workaround monitor bug Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-07-06 19:10 +0200
Re: [PATCH] x86: add workaround monitor bug Ingo Molnar <mingo@kernel.org> - 2016-07-08 11:00 +0200
Re: [PATCH] x86: add workaround monitor bug Peter Zijlstra <peterz@infradead.org> - 2016-07-08 13:50 +0200
Re: [PATCH] x86: add workaround monitor bug Ingo Molnar <mingo@kernel.org> - 2016-07-08 14:10 +0200
Re: [PATCH] x86: add workaround monitor bug Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-07-08 21:20 +0200
csiph-web