From nobody Mon Feb 9 08:58:05 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1574774861; cv=none; d=zohomail.com; s=zohoarc; b=SkaezbV5shkfcTpxMf+fwEtZgPhKbzF66Rzj8dXBEcVWW8UAL/v82p05Ifqx+KiaIoycFgGsX3LODupv6yBV98Jnu+CE5v8qZ1GxSKPXOUd6PBhQGxtYlbu8JMCw3Cx13lw1gyxc+YMavZr/MKneDnrjdVzRNppxaDumo/UrOGQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574774861; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yKHHTT3nsRd3EjS+7EcM5/TYPoWvOq6n9uCqFk5IVn4=; b=RJFXdUPHWAc7rLOvCgxQ1ZvyMnJ5fPnOr4mGJ69WtF5mA8ZcAIzPbJFHWic8bU8+r5rFgH54Z931TfaiDwki1MhvQtBQumSO8kfTCPqYXQ4W/Q/+zdhZ4bcmFw19puY3CpmX2PCfEJ8JF93olCPIkZTXSjdvzBY+MhgEi8V7HwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 157477486195180.68619897252586; Tue, 26 Nov 2019 05:27:41 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iZas2-0002Gq-LQ; Tue, 26 Nov 2019 13:27:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iZas1-0002GG-L0 for xen-devel@lists.xenproject.org; Tue, 26 Nov 2019 13:27:09 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 71bde9cc-1050-11ea-a55d-bc764e2007e4; Tue, 26 Nov 2019 13:27:08 +0000 (UTC) X-Inumbo-ID: 71bde9cc-1050-11ea-a55d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1574774829; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XU799ubjhvOD8m3beFxNluqhOnqkfPRSlYf1fikne6U=; b=UWjZ6+ymsiCtP8DTmeQfBOeI7c7AoSessMFOcM9v1j+tkZJxMi4y95XG w4Sq/lnF2dePOb66bgWuDWQlzhLmK1GIP4qqDWNqm6c+9xDEYoPmVIhjl oOcrAEu0Em7I5B9vn3MbY/n4qudN2S0Ipgy8hbnaP8+Z7NX6TYij1fj8I 8=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Clxb3QqpffJhLLNOy3MFVQHNo3cU1cCTaWGVMhVgAuiaimbu6fDlW3KANI/zm/CBz7Pr0oeaph 4N4sDUDAk1PlkPhU/Hjd8eRCVKp+TWadxOtgNLHOInrGuGriV8Z2NsvtbvS7BtcnVQsxpzJhKF gWkSsAJzP3QGeGHf+3qE1TT3qamKgcz4OjxQYkwOylDuuOga9Kq/hnToRbbVFUROeKs3PeiEd8 Zqcl65ILSvvQY2CYKCr6HB6Yh5hhlfS7/FXDAP1tz8ZLbKkgES96SZox4rA+WReM6NvcVTfWrp DEs= X-SBRS: 2.7 X-MesageID: 8842073 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,245,1571716800"; d="scan'208";a="8842073" From: Roger Pau Monne To: Date: Tue, 26 Nov 2019 14:26:47 +0100 Message-ID: <20191126132648.6917-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191126132648.6917-1-roger.pau@citrix.com> References: <20191126132648.6917-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-4.13 v3 1/2] x86/vmx: add ASSERT to prevent syncing PIR to IRR... X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Kevin Tian , Jun Nakajima , Wei Liu , Andrew Cooper , Jan Beulich , Roger Pau Monne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) ... if the vCPU is different than the one currently running or if it's not paused. Note that syncing PIR to IRR when the vCPU is running is not allowed, since the hardware is in control of VMCS IRR field. Allow syncing PIR to IRR when the vCPU is paused, this is required in order to save the local APIC state. No functional change intended. Suggested by: Andrew Cooper Signed-off-by: Roger Pau Monn=C3=A9 --- Cc: Juergen Gross --- Changes since v2: - Only allow syncing if the vCPU is the current one or if it's paused. Changes since v1: - Use vcpu_runnable instead of is_running. --- xen/arch/x86/hvm/vmx/vmx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index a55ff37733..c817aec75d 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2054,6 +2054,19 @@ static void vmx_sync_pir_to_irr(struct vcpu *v) unsigned int group, i; DECLARE_BITMAP(pending_intr, NR_VECTORS); =20 + if ( v !=3D current && !atomic_read(&v->pause_count) ) + { + /* + * Syncing PIR to IRR must not be done behind the back of the CPU, + * since the IRR is controlled by the hardware when the vCPU is + * executing. Only allow Xen to do such sync if the vCPU is the cu= rrent + * one or if it's paused: that's required in order to sync the lap= ic + * state before saving it. + */ + ASSERT_UNREACHABLE(); + return; + } + if ( !pi_test_and_clear_on(&v->arch.hvm.vmx.pi_desc) ) return; =20 --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel