From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755234AbeAOKoU (ORCPT + 1 other); Mon, 15 Jan 2018 05:44:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54932 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755114AbeAOKoS (ORCPT ); Mon, 15 Jan 2018 05:44:18 -0500 From: Vitaly Kuznetsov To: Thomas Gleixner Cc: kvm@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Ingo Molnar , "H. Peter Anvin" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley \(EOSG\)" , Andy Lutomirski , Mohammed Gamal , Cathy Avery , Roman Kagan , linux-kernel@vger.kernel.org, devel@linuxdriverproject.org Subject: Re: [PATCH v2 4/7] x86/hyper-v: redirect reenlightment notifications on CPU offlining References: <20171213150945.24054-1-vkuznets@redhat.com> <20171213150945.24054-5-vkuznets@redhat.com> Date: Mon, 15 Jan 2018 11:44:12 +0100 In-Reply-To: (Thomas Gleixner's message of "Sun, 14 Jan 2018 21:44:38 +0100 (CET)") Message-ID: <87y3kziepv.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 15 Jan 2018 10:44:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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