From: Thomas Gleixner <tglx@linutronix.de>
To: Dmitry Safonov <dima@arista.com>
Cc: linux-kernel@vger.kernel.org,
"Dmitry Safonov" <0x7f454c46@gmail.com>,
"Prasanna Panchamukhi" <panchamukhi@arista.com>,
"Andy Lutomirski" <luto@kernel.org>,
"Borislav Petkov" <bp@alien8.de>,
"Cathy Avery" <cavery@redhat.com>,
"Haiyang Zhang" <haiyangz@microsoft.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Ingo Molnar" <mingo@redhat.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
"Mohammed Gamal" <mmorsy@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Roman Kagan" <rkagan@virtuozzo.com>,
"Sasha Levin" <sashal@kernel.org>,
"Stephen Hemminger" <sthemmin@microsoft.com>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
devel@linuxdriverproject.org, kvm@vger.kernel.org,
linux-hyperv@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCHv2] x86/hyperv: Hold cpus_read_lock() on assigning reenlightenment vector
Date: Fri, 28 Jun 2019 00:39:30 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1906280033510.32342@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20190617163955.25659-1-dima@arista.com>
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
prev parent reply other threads:[~2019-06-27 22:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 16:39 [PATCHv2] x86/hyperv: Hold cpus_read_lock() on assigning reenlightenment vector Dmitry Safonov
2019-06-27 22:39 ` Thomas Gleixner [this message]
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.21.1906280033510.32342@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=0x7f454c46@gmail.com \
--cc=Michael.H.Kelley@microsoft.com \
--cc=bp@alien8.de \
--cc=cavery@redhat.com \
--cc=devel@linuxdriverproject.org \
--cc=dima@arista.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=mmorsy@redhat.com \
--cc=panchamukhi@arista.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rkagan@virtuozzo.com \
--cc=rkrcmar@redhat.com \
--cc=sashal@kernel.org \
--cc=sthemmin@microsoft.com \
--cc=vkuznets@redhat.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;
as well as URLs for NNTP newsgroup(s).