From nobody Mon Feb 9 17:24:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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=1595869589; cv=none; d=zohomail.com; s=zohoarc; b=A7ubgfPNNlAjMY1WDpVn/+lXf7cMTdT2hY3X22P1dqvk7KtCIwGpmfY1Lh4ZBKMn6aOoruTJq7vf5dLVV5CT4K7AovjRg3qzTeTk7jY25vS2RXJFP49MuMr2EUSDXXJxh9K4fixl+pgbqhCg+ajpq7RGqJ8vudHndxKPdCcEfNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595869589; 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=zc/Qh7dHPVW9vXRILO6nHeg5S8fjCdvneUV8GBSE/TU=; b=Wqq84jNN91Bwo4KBeDogRYa11U+Sa3pky7dx4L8CzdS0Y/IkMOSSlebagzhk4OOo+XPG0svtuegemr950OZx5raefpStPWAbRAB2vnbeGHXZhg0mfZ/Ua6/6GYEHCGvHzibIj6tudv2d3wlYU2K3bR2uO5XrZRb22QaJK2Rpv6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1595869589653329.1908160328031; Mon, 27 Jul 2020 10:06:29 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k06Zn-0006uz-Ef; Mon, 27 Jul 2020 17:06:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k06Zm-0006qK-89 for xen-devel@lists.xenproject.org; Mon, 27 Jul 2020 17:06:10 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 71a883fc-d02b-11ea-a7b1-12813bfff9fa; Mon, 27 Jul 2020 17:06:00 +0000 (UTC) X-Inumbo-ID: 71a883fc-d02b-11ea-a7b1-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1595869560; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+UrtDnq8F4eKIjcjNHn8k54mlLah4ENCqM3HBW0OiIE=; b=gRRbpzVUawqj5TxHdGBpiyB8+CjxxNXjIzboe1SnfvadfwT5M2EsUUwh Kjg1TfG5DXv03E9UiHCLg5gwGE+PuJPipuXRFkvSaDxs/90gC5UqXrK+Z cEQ+E8J8ALjVCfibQqSvUmp39D1ufBhZjR5qnExFxGBL6n75swfD9TgyU s=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 2dtOmp8c2Nwrd+LUQ4J9RPBxhaEZfrC856jhgoQ+7Bw5E1CyN4gbGYR9OyI4x1PcqlfV58Rzqv 3BYXLDz/Ea9OY0JQoggv3zA2atPYZ4/eDbCaHnUWPnMKbItTX+9PXbzrDbNwarHC5a6JGoSYAx ula5+FWpHzijYGbT0T7FlaRq/o37xxIxQfcvkOcVEsVZcjOL/NJW//1i4FwzODJ1sqz9KMRvFz cPShm+jK6lXrdXtwg916Ne5pDATSeQQdQMXceGKkZia2/X8QR2tv6kFoIVuxJnwHwC7GCsXlNQ U/s= X-SBRS: 2.7 X-MesageID: 24144262 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,402,1589256000"; d="scan'208";a="24144262" From: Roger Pau Monne To: Subject: [PATCH v2 4/5] x86/vpt: only try to resume timers belonging to enabled devices Date: Mon, 27 Jul 2020 19:05:38 +0200 Message-ID: <20200727170539.55798-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727170539.55798-1-roger.pau@citrix.com> References: <20200727170539.55798-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Check whether the emulated device is actually enabled before trying to resume the associated timers. Thankfully all those structures are zeroed at initialization, and since the devices are not enabled they are never populated, which triggers the pt->vcpu check at the beginning of pt_resume forcing an exit from the function. While there limit the scope of i and make it unsigned. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- xen/arch/x86/hvm/vpt.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 47f2c2aa64..62c87867c5 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -636,14 +636,19 @@ static void pt_resume(struct periodic_time *pt) =20 void pt_may_unmask_irq(struct domain *d, struct periodic_time *vlapic_pt) { - int i; - if ( d ) { - pt_resume(&d->arch.vpit.pt0); - pt_resume(&d->arch.hvm.pl_time->vrtc.pt); - for ( i =3D 0; i < HPET_TIMER_NUM; i++ ) - pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]); + if ( has_vpit(d) ) + pt_resume(&d->arch.vpit.pt0); + if ( has_vrtc(d) ) + pt_resume(&d->arch.hvm.pl_time->vrtc.pt); + if ( has_vhpet(d) ) + { + unsigned int i; + + for ( i =3D 0; i < HPET_TIMER_NUM; i++ ) + pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]); + } } =20 if ( vlapic_pt ) --=20 2.27.0