Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1560478

Re: [PATCH] fix race caused by hyperthreads when online an offline cpu

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH] fix race caused by hyperthreads when online an offline cpu
Date 2017-01-17 11:50 +0100
Message-ID <t0zuW-609-5@gated-at.bofh.it> (permalink)
References <t06jf-2Xg-1@gated-at.bofh.it> <t0bsB-6yd-17@gated-at.bofh.it> <t0ceZ-71a-5@gated-at.bofh.it> <t0kme-4kY-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 16 Jan 2017, Stephane Eranian wrote:
> On Mon, Jan 16, 2017 at 1:53 AM, zhouchengming
> <zhouchengming1@huawei.com> wrote:
> > On 2017/1/16 17:05, Thomas Gleixner wrote:
> >>
> >> On Mon, 16 Jan 2017, Zhou Chengming wrote:
> >>
> >> Can you please stop sending the same patch over and over every other day?
> >>
> >> Granted, things get forgotten, but sending a polite reminder after a week
> >> is definitely enough.
> >>
> >> Maintainers are not machines responding within a split second on every
> >> mail
> >> they get. And that patch is not so substantial that it justifies that kind
> >> of spam.
> >>
> >
> > Very sorry for the noise. We are just not sure this is the right fix because
> > it's
> > hard to reproduce.
> >
> I believe this is the right fixed. I tried it and instrumented the
> code to verify thread_id
> assignment. The problem is easy to reproduce.
> 
> $ echo 0 >/sys/devices/system/cpu/cpu2/online
> $ echo 1 >/sys/devices/system/cpu/cpu2/online
> 
> Normally on Haswell Desktop part,  CPU2 gets thread_id 0 on boot, CPU6
> gets thread_id 1.
> If you offline CPU2 and bring it back in, it will get thread_id 1 and
> thus both sibling will point
> to the same exclusive state. The fix is, indeed, to check if the
> sibling is not already assigned 1,
> and if so to keep 0 for the CPU being online'd.

Right. So it's a simple static fully reproducible problem and not a race of
some sorts. I'll amend the changelog ....

Btw, this code has the hardcoded assumption two threads per core. So
anything which has more than two threads is broken vs. that exclusive
access. No idea whether that matters in practice, but I just noticed.

Thanks,

	tglx

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] fix race caused by hyperthreads when online an offline cpu Zhou Chengming <zhouchengming1@huawei.com> - 2017-01-16 04:40 +0100
  Re: [PATCH] fix race caused by hyperthreads when online an offline  cpu Thomas Gleixner <tglx@linutronix.de> - 2017-01-16 10:10 +0100
    Re: [PATCH] fix race caused by hyperthreads when online an offline  cpu zhouchengming <zhouchengming1@huawei.com> - 2017-01-16 11:00 +0100
      Re: [PATCH] fix race caused by hyperthreads when online an offline cpu Stephane Eranian <eranian@google.com> - 2017-01-16 19:40 +0100
        Re: [PATCH] fix race caused by hyperthreads when online an offline  cpu Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 11:50 +0100
  [tip:perf/urgent] perf/x86/intel: Handle exclusive threadid  correctly on CPU hotplug tip-bot for Zhou Chengming <tipbot@zytor.com> - 2017-01-17 11:20 +0100

csiph-web