Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1164596
| From | Borislav Petkov <bp@suse.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 3/4] x86, mwaitt: introduce mwaix delay with a configurable timer |
| Date | 2015-06-13 10:50 +0200 |
| Message-ID | <pAPiy-7L0-13@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <pzieZ-2kK-1@gated-at.bofh.it> <pzoaJ-2wc-3@gated-at.bofh.it> <pzuSS-3XW-5@gated-at.bofh.it> <pAsP0-eL-31@gated-at.bofh.it> <pAGoV-3oF-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jun 12, 2015 at 04:15:23PM -0700, Andy Lutomirski wrote:
> > How about this:
> >
> > /*
> > * This should be a memory location in a cache line which is
> > * unlikely to be touched by other processors. The actual
> > * content is immaterial as it is not actually modified in any way.
> > */
> > mwait_ptr = ¤t_thread_info()->flags;
> >
> > and then
> >
> > __monitor(mwait_ptr, 0, 0);
> >
> > We already do this in mwait_play_dead().
> >
> > However, am I even correct in assuming that ->flags won't really be
> > touched as we're doing delay() and nothing pokes into current anyway?
>
> We poke flags remotely, but not frequently enough for this to be a
> problem. However, I don't know that touching current in udelay is
> okay.
>
> How about some read-mostly percpu variable, such as cpu_tss?
Yeah, those look much safer since they're static and are
____cacheline_aligned_in_smp, which is exactly what we want.
I guess we can do
__monitorx(this_cpu_ptr(&cpu_tss), 0, 0);
with a nice comment ontop why we're doing it.
asm looks ok too:
movq $cpu_tss, %rax #, tcp_ptr__
add %gs:this_cpu_off(%rip), %rax # this_cpu_off, tcp_ptr__
xorl %edx, %edx # tmp248
movq %rdx, %rcx # tmp248, tmp248
#APP
# 22 "./arch/x86/include/asm/mwait.h" 1
.byte 0x0f, 0x01, 0xc8;
# 0 "" 2
#NO_APP
Thanks.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 3/4] x86, mwaitt: introduce mwaix delay with a configurable timer Huang Rui <ray.huang@amd.com> - 2015-06-09 05:20 +0200 Re: [PATCH v2 3/4] x86, mwaitt: introduce mwaix delay with a configurable timer Peter Zijlstra <peterz@infradead.org> - 2015-06-09 10:40 +0200 Re: [PATCH v2 3/4] x86, mwaitt: introduce mwaix delay with a configurable timer Borislav Petkov <bp@suse.de> - 2015-06-13 10:50 +0200
csiph-web