From: Vitaly Kuznetsov Subject: Re: [PATCH v2 4/7] x86/hyper-v: redirect reenlightment notifications on CPU offlining Date: Mon, 15 Jan 2018 11:44:12 +0100 Message-ID: <87y3kziepv.fsf@vitty.brq.redhat.com> References: <20171213150945.24054-1-vkuznets@redhat.com> <20171213150945.24054-5-vkuznets@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Stephen Hemminger , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , Haiyang Zhang , x86@kernel.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, "Michael Kelley \(EOSG\)" , Ingo Molnar , Roman Kagan , Andy Lutomirski , "H. Peter Anvin" , Paolo Bonzini , Mohammed Gamal To: Thomas Gleixner Return-path: In-Reply-To: (Thomas Gleixner's message of "Sun, 14 Jan 2018 21:44:38 +0100 (CET)") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" List-Id: kvm.vger.kernel.org Thomas Gleixner writes: > On Wed, 13 Dec 2017, Vitaly Kuznetsov wrote: >> +static int hv_cpu_die(unsigned int cpu) >> +{ >> + struct hv_reenlightenment_control re_ctrl; >> + int i; >> + static DEFINE_SPINLOCK(lock); >> + >> + if (hv_reenlightenment_cb == NULL) >> + return 0; >> + >> + /* Make sure the CPU we migrate to is not going away too */ >> + spin_lock(&lock); > > What kind of voodoo is this? CPU hotplug is serialized already... > Yes, someone around made a comment 'what happens if some day we'll have parallel cpu hot[un]plug' and I added this. Not really needed, will drop in v3. >> + rdmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl)); >> + if (re_ctrl.target_vp == hv_vp_index[cpu]) { >> + /* Find some other online CPU */ >> + for_each_online_cpu(i) { > > cpu = cpumask_any_but(cpu_online_mask); > > Hmm? > Cool, thanks) -- Vitaly