Received: by 10.213.65.68 with SMTP id h4csp1606213imn; Thu, 15 Mar 2018 04:46:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELuOOpUYySwIdzDQV0x12gaSMhyyKE+smHJO3rXloANIgeXT6IHJZRT+fHd6Nz2+ur7lJS4l X-Received: by 10.99.113.25 with SMTP id m25mr6643990pgc.164.1521114403294; Thu, 15 Mar 2018 04:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521114403; cv=none; d=google.com; s=arc-20160816; b=C2dPh4+U7yENFZFas2lQ/iIjpwa4m/2awuLPYjdrGNz8ly6Ry5Ga5ct+cJDJO/LlCx xJa/cRYAoWL086BFwM5itylVXUrESxyonbsWUYbeFO7ElmZT05UL5PeflzROfAmWq+yF WeaWepofCdUBxxgzrs+PW9ElChAjvTY3Ijh0w2YhkPTdcZFxHU14gvGobdEZZk6PdPyA CeY03GZjkx1fm/+VFxKSud0bw9zguj4JOYasY00UjBHx8IPs0CU/XVVwBaelqyFKR1Dz KyD4qT5biCu33SBC6UOl0xUQmbojYBmRK7cGlJ3JaQMddVhMwTumM0Uqff6eegnnSVJ1 fOGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=M1rk37lAdc6Iboc/4Zvth+832y4KUA4Q5QllwlP21hg=; b=dtMalKswVEHkAaNxM4zBYBX3MrvQAlzp2bFQe6lPh49RKyTPSFPArijJVC8aBkpzfD thKsqM2jUk3lNFCREAZhc35SHqRQIkKq2oOBthBbh0xSaSa8Ox2up2dP1oZhk0AW7DIg RGNkK7O8nnG20YR7j0zPiP7HxtZS5ESz2UtxrVpVl5E7eZ0E3yYhTkCz1aS2MXOqmcDt sZGmInGfZwtNoGZbX9uolp4CYjOL8G+rmdyvoRUrhuM/tX4m/ElBhjsp/AfzXv3C1CbX P7wWJ/LAbnpbx1VpfZbypiLubt8TTuAxbKsSiC8FVuaSKPljFsUWIwe4WyKRitrczYDJ 8GXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si3290710pgq.413.2018.03.15.04.46.25; Thu, 15 Mar 2018 04:46:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751640AbeCOLpK (ORCPT + 99 others); Thu, 15 Mar 2018 07:45:10 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:53138 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbeCOLpJ (ORCPT ); Thu, 15 Mar 2018 07:45:09 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1ewRJf-0006eF-Ts; Thu, 15 Mar 2018 12:45:04 +0100 Date: Thu, 15 Mar 2018 12:45:03 +0100 (CET) From: Thomas Gleixner To: Vitaly Kuznetsov cc: kvm@vger.kernel.org, x86@kernel.org, Paolo Bonzini , =?ISO-8859-2?Q?Radim_Kr=E8m=E1=F8?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Bandan Das , LKML , Peter Zijlstra Subject: Re: [PATCH v3 4/7] x86/hyper-v: allocate and use Virtual Processor Assist Pages In-Reply-To: <87bmfpbqek.fsf@vitty.brq.redhat.com> Message-ID: References: <20180309140249.2840-1-vkuznets@redhat.com> <20180309140249.2840-5-vkuznets@redhat.com> <87bmfpbqek.fsf@vitty.brq.redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Mar 2018, Vitaly Kuznetsov wrote: > Thomas Gleixner writes: > > On Fri, 9 Mar 2018, Vitaly Kuznetsov wrote: > >> @@ -198,6 +218,12 @@ static int hv_cpu_die(unsigned int cpu) > >> struct hv_reenlightenment_control re_ctrl; > >> unsigned int new_cpu; > >> > >> + if (hv_vp_assist_page && hv_vp_assist_page[cpu]) { > >> + wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE, 0); > >> + vfree(hv_vp_assist_page[cpu]); > >> + hv_vp_assist_page[cpu] = NULL; > > > > So this is freed before the CPU is actually dead. And this runs in > > preemtible context. Is the wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE, 0); enough to > > prevent eventual users of the assist page on the outgoing CPU from > > accessing it? > > > > After we do wrmsrl() the page is no longer 'magic' so in case eventual > users try using it they'll most likely misbehave -- so changing the > shutdown order won't help. > > The only user of these pages is currently KVM. Can we still have vCPUs > running on the outgoing CPU at this point? If case we can we're in > trouble and we need to somehow kick them out first. The first thing we do in unplug is to mark the CPU inactive, but I'm not sure whether that prevents something which was on the CPU before and perhaps preempted or is affine to that CPU to be scheduled in again. Peter???? Thanks, tglx