Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp483132pxk; Thu, 17 Sep 2020 08:09:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybTeZnbyHDEb/NrJS57N/1s301CmR35zZafVhRcwWA+322dExV/tBF+UXXqgiGH7xfbgui X-Received: by 2002:a50:9d0a:: with SMTP id v10mr32987946ede.144.1600355360289; Thu, 17 Sep 2020 08:09:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600355360; cv=none; d=google.com; s=arc-20160816; b=YppHmZ+v/nVs+e3+XhM1Lge4P85Ezbqgp0BVsqBx/lMNMEE+avgH8ny4bSpAMADwle ksCZxmmB+U4dHDVR0cAgIavJ0Q9xQbrHg0RDwX0Twvj7GiYMnBroQb77qfLoWxJ2iePe m0lCz2LAZUtwRjU4ct0JSVCidMDI9WkDrxe4tbn+o9tHbqZZySpgE6f2VsHD3QrCYThE dN0/+C5o+S/5UJD54jsgvcAsko8YJSpiw0tFAACKikFB4GOk4yig1oyQ9iXrB+nQFNxT l6VH1MC8t6yRAu7eoB1V+8aRZwMfeCTmy8LTsBOQ7ZhCyNpQq/zTQ4zjnrJKfb98ni6Y DZnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=pSH4MHtXix3qedesK5mCvVKYEiHi+O52Nr1g32GTOMQ=; b=ZatT93YaJcA4eetp5WKKQlIoz1l1o/XKczSsze4nayEVzk3cB6i7xBgrxocRTWy8GQ ghGx3p4NUE3BEawCC6FZwt1Fy5ZrvVJLnDAA+zcfTp1k+rgVUa63BiZqeeMUnLROOeaA xZVCnO9NaLR8j0r8+UOqoO4Iq4a6zO6aOIt7/4QE+SPqzAqmWREynFIe+pZEiBshHQZO jwLOU88gZIbbU+5ApWGXcVakddwPUuT3InrwyV9PwM8wU2vih39EP0R9JRXHe9Apq1j9 D5mBDtVOQDho9/ckTFcxyHaFPTv84F4FckYw4yiGmSD6arWFLkI5Pek5IT5WBPEYz6g6 PQ/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a14si10759653edk.57.2020.09.17.08.08.56; Thu, 17 Sep 2020 08:09:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727900AbgIQPFl (ORCPT + 99 others); Thu, 17 Sep 2020 11:05:41 -0400 Received: from mga03.intel.com ([134.134.136.65]:21122 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727645AbgIQPDq (ORCPT ); Thu, 17 Sep 2020 11:03:46 -0400 IronPort-SDR: vav8u7jJXxw84y6ucG/yMkLBEltA5CV/+CRcKVCw3tyl3sf5n57GvUAWb0f20CntIbvDyjpjQT pbAJPU54HE6A== X-IronPort-AV: E=McAfee;i="6000,8403,9747"; a="159767847" X-IronPort-AV: E=Sophos;i="5.77,271,1596524400"; d="scan'208";a="159767847" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 08:02:19 -0700 IronPort-SDR: tI9dnOdhvLCaT336I7nLJO3Fqbl9ocOeZW/pRCpowbMi80TL9gSrUYngI/wjMbis2FDxePfeQK 3rJx7Sf5gFnA== X-IronPort-AV: E=Sophos;i="5.77,437,1596524400"; d="scan'208";a="302968062" Received: from sjchrist-ice.jf.intel.com (HELO sjchrist-ice) ([10.54.31.34]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 08:02:18 -0700 Date: Thu, 17 Sep 2020 08:02:17 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: yadong.qi@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, liran.alon@oracle.com, nikita.leshchenko@oracle.com, chao.gao@intel.com, kevin.tian@intel.com, luhai.chen@intel.com, bing.zhu@intel.com, kai.z.wang@intel.com Subject: Re: [PATCH RFC] KVM: x86: emulate wait-for-SIPI and SIPI-VMExit Message-ID: <20200917150217.GA13522@sjchrist-ice> References: <20200917022501.369121-1-yadong.qi@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 10:56:18AM +0200, Paolo Bonzini wrote: > On 17/09/20 04:25, yadong.qi@intel.com wrote: > > From: Yadong Qi > > > > Background: We have a lightweight HV, it needs INIT-VMExit and > > SIPI-VMExit to wake-up APs for guests since it do not monitoring > > the Local APIC. But currently virtual wait-for-SIPI(WFS) state > > is not supported in KVM, so when running on top of KVM, the L1 > > HV cannot receive the INIT-VMExit and SIPI-VMExit which cause > > the L2 guest cannot wake up the APs. > > > > This patch is incomplete, it emulated wait-for-SIPI state by halt > > the vCPU and emulated SIPI-VMExit to L1 when trapped SIPI signal > > from L2. I am posting it RFC to gauge whether or not upstream > > KVM is interested in emulating wait-for-SIPI state before > > investing the time to finish the full support. > > Yes, the patch makes sense and is a good addition. What exactly is > missing? (Apart from test cases in kvm-unit-tests!) nested_vmx_run() puts the vCPU into KVM_MP_STATE_HALTED instead of properly transitioning to INIT_RECEIVED, e.g. events that arrive while the vCPU is supposed to be in WFS will be incorrectly recognized. I suspect there are other gotchas lurking, but that's the big one.