[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1906280033510.32342@nanos.tec.linutronix.de>
Date: Fri, 28 Jun 2019 00:39:30 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Dmitry Safonov <dima@...sta.com>
cc: linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Prasanna Panchamukhi <panchamukhi@...sta.com>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Cathy Avery <cavery@...hat.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
"Michael Kelley (EOSG)" <Michael.H.Kelley@...rosoft.com>,
Mohammed Gamal <mmorsy@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Radim Krčmář <rkrcmar@...hat.com>,
Roman Kagan <rkagan@...tuozzo.com>,
Sasha Levin <sashal@...nel.org>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
devel@...uxdriverproject.org, kvm@...r.kernel.org,
linux-hyperv@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCHv2] x86/hyperv: Hold cpus_read_lock() on assigning
reenlightenment vector
On Mon, 17 Jun 2019, Dmitry Safonov wrote:
> @@ -196,7 +196,16 @@ void set_hv_tscchange_cb(void (*cb)(void))
> /* Make sure callback is registered before we write to MSRs */
> wmb();
>
> + /*
> + * As reenlightenment vector is global, there is no difference which
> + * CPU will register MSR, though it should be an online CPU.
> + * hv_cpu_die() callback guarantees that on CPU teardown
> + * another CPU will re-register MSR back.
> + */
> + cpus_read_lock();
> + re_ctrl.target_vp = hv_vp_index[raw_smp_processor_id()];
> wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
> + cpus_read_unlock();
Should work
> wrmsrl(HV_X64_MSR_TSC_EMULATION_CONTROL, *((u64 *)&emu_ctrl));
> }
> EXPORT_SYMBOL_GPL(set_hv_tscchange_cb);
> @@ -239,6 +248,7 @@ static int hv_cpu_die(unsigned int cpu)
>
> rdmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
> if (re_ctrl.target_vp == hv_vp_index[cpu]) {
> + lockdep_assert_cpus_held();
So you're not trusting the hotplug core code to hold the lock when it
brings a CPU down and invokes that callback? Come on
> /* Reassign to some other online CPU */
> new_cpu = cpumask_any_but(cpu_online_mask, cpu);
Thanks,
tglx
Powered by blists - more mailing lists