From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7565E74003B for ; Sat, 27 Jan 2024 14:00:27 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=gDbnLs1v6ZBAH6pnvUeSL8Ta9bTtkSla1lvrE5kButE=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706364025; v=1; b=PGU/mQarRez0nTMptgdYdjb7jcEFIZ/6hvhFHa/Spkuuqtew9fx8m22nje8vpwmBBdsTpAec S8fiBxYmqj3MG6W4Ca6fcvbUq803rXr4/LS+IIhci8noTJSKQqpq5IiLzSTw+B/3ZvFbqXLadns P0/pf7jr/1fa2yqw++GO176I= X-Received: by 127.0.0.2 with SMTP id D7T9YY7687511xeUDD7aDQW1; Sat, 27 Jan 2024 06:00:25 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mx.groups.io with SMTP id smtpd.web11.15921.1706364024111554372 for ; Sat, 27 Jan 2024 06:00:25 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="10066011" X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="10066011" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2024 06:00:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="960471781" X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="960471781" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga005.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 27 Jan 2024 06:00:23 -0800 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sat, 27 Jan 2024 06:00:22 -0800 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Sat, 27 Jan 2024 06:00:22 -0800 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sat, 27 Jan 2024 06:00:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ak5ryoxnCniN8B/RL4ciKi7F2vKzmP3T8aKUoG5Mtbze27GCM/olw3slaeFSDRUqKLdbjoujwacxkcYsIvuc/g4ft0VnGtnvx3oMv977Am42Z05+gBPtTzpXeGgFdFMYrrQ/pDewJb5TE+WJWEIisPUfN9ffB3DOPAije2hTsCu0ViaL3+8g4Q+LLf1kFixkkh7eMZp/L4d8i5FxDaX5nlGUsAPsiUN1pHkr/m44H+w3LcXeWcC6rA6fNmVqXNQZQrMnzmHAFsote1MWN0HaneTndMjiY5QQJvi6TsUhmzUJHtTqvFny0VW4H7LplatauMQ+nSd1fdj5U5M8BgOFhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zXJRFhtjJyuCZ4pd9JC5oJu5fJmWEPKkMqg0hedq12Y=; b=fFsP64EQXd1ZMlWJtsjANDgbTGE3Zy6wnbp/Th27cCHqRy+wBO+4BEJEXkb6rqcTL02hovHsRgHWr6emY/lxXA0+vtTThEPBp/7u9sfiilbnTeOJKqVVrDWpwOhQyw6XNsc21lPc+mcVmWjX1cw9tV5XnCudwkMOMyh6QuyMkxmI/LBari2NMMIIeu8YE4useT+OZmlG99EDqaRmB2rVPPjPyP389zdzwMBwS/UaCy4L3T2uTOvzNcNQvC6TfOOTyEw+2TZ6FFc+soP0LNx1+9Hh+LAg1VYxDny1fodXWaaI8slQsTdASEHiWLa6CtCpzQtUtpZ66FYgLJV0p+dpVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by CH3PR11MB7819.namprd11.prod.outlook.com (2603:10b6:610:125::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.28; Sat, 27 Jan 2024 14:00:10 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::fdd3:11d7:1c15:6c2d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::fdd3:11d7:1c15:6c2d%7]) with mapi id 15.20.7228.028; Sat, 27 Jan 2024 14:00:10 +0000 From: "Ni, Ray" To: "Kinney, Michael D" , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [Patch 1/1] PcAtChipsetPkg/HpetTimerDxe: Fix nested interrupt time accuracy Thread-Topic: [Patch 1/1] PcAtChipsetPkg/HpetTimerDxe: Fix nested interrupt time accuracy Thread-Index: AQHaUPZF17cn8QrRdUCBY3hnCqKa+7DtsExQ Date: Sat, 27 Jan 2024 14:00:10 +0000 Message-ID: References: <20240127075550.1295-1-michael.d.kinney@intel.com> In-Reply-To: <20240127075550.1295-1-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|CH3PR11MB7819:EE_ x-ms-office365-filtering-correlation-id: ebed5652-e51c-4a01-53c7-08dc1f40467e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 3cbNtvyridHSzZORcqVBT+aTGJ1q32HgMelQnH+O35Jm+oukJmESgBWfqFnvthn3AcoY7IBRJ4Eu0mqrgIi7JzTBoUuWWSKisXYsHvDNsbXxo6lBi/z8qoufj7EF/SpvyVhMUgc2qrCTB3kyRNDFClNQbQI10fFNpDiO/reWMIejVmUmLQBTR1/oIK0qmNegAId+jgJ9gQWYXbQcwNJdnI0wQOMK0v9Y7xwwF11TGac9I6rAD9yWHfz5cZNT0ZoEQzrbR1lw3HBq2vi1aJv42s2aVKWmkf53PgR4xqVqOhhEdgbvOYlfr4wmMtbcw/4pX+RodNL0CzwjPew8jKj3/iiN3GtiryhdCiODrc1pdJKdcUVYaRnSntJ5JsCfchqJ+/iSKT3qQyhJ/4gJ1lMz8gj+LwWLkBi/WdOMrMmEeVb+fsjh7MGuFF2CU52uBJRfsYU0mQ3EisgX3EfrkSpLbeps9ekdTXNhmSIzRMuPO4p/md2GALdmNiV2UIrW3oWyuVa9Tx73x74DpweTcBcbb/AlOqnwCYHKGsZliv82eu5+G4KIc35Dd5TGkamF3W8M8y5slW4b5l4TtfLE5AZueF1N61pEMlteV9gDDmw1Sqw= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VKe/KqxcrYjRZ9k+mDrOWauhmtS8qhr2PtRpci46HfCnwQabBRgG/HuENf31?= =?us-ascii?Q?3lGWw2aDGXyRbA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IgqLMVQ?= =?us-ascii?Q?Jh8P5AvgAOaZCaoapFeoaYYVVNQZecokFSr+lM8FRwKW2y4Wkw4ZdGlthVUJ?= =?us-ascii?Q?HIBuj0+plS7rgh2vPOpYUCHEhSJBW08zorMWXnS6J3NBa0T4x6mZEqNOLi/v?= =?us-ascii?Q?bb+Si7cGtXu7DuO+f3Wo9D0QGJ1jVv/MyuA4pl3rvGHOllwVdmpNVj7k9by3?= =?us-ascii?Q?HzwwUav37+DNNB9gwHPDGEq+OCSp0e15xVjZCWrx0FJmEeGJ/UsOUE1l3VT3?= =?us-ascii?Q?Q+xP84VZbZGexW57ZLCbeLD6ghdGs46RWNCDGHPemYOIPLtGpVb7y9cJpgbw?= =?us-ascii?Q?+v/6nOagYXf1Ays+OryAvXNVTRuQXVaz7+5iKhc7Ih1Qn7XFx//cWx9eZZvp?= =?us-ascii?Q?sJlfFR+78v5LyLX8s2dKereRmg9g+3IAUYGbw5GZ9ERwr2Z0qUGBJ3cN4uOa?= =?us-ascii?Q?G4t9P/IXFunZMIxogSzoGiHsYmzDRMGaQfnloby9bHyVqdKbKXMW5ZYjrKX8?= =?us-ascii?Q?2Je+UdBjdZIvFkDGoQ5Q/ETrlcGLW9ZZEPJfJ4Vn1dfEaJKmKt8npGAzGUv4?= =?us-ascii?Q?U9EMocO7f7duyG/DGeGmTakec6KcWjhB53JZXgIqGfncC9Lu5I7bkXdpRP3w?= =?us-ascii?Q?tQMcO1bnKXVNpWVAgTk=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebed5652-e51c-4a01-53c7-08dc1f40467e X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jan 2024 14:00:10.0600 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1dJC0txWqEdUl5zULo7q4gSygje/N9nr1LwktGa+h8bauf9GIJNL9GkDZK7/2Fy2m0f/6pgyhKFlTO1+K4pKEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7819 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: kDguaYOOWVIiKge6GzICwLYDx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="PGU/mQar"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Kinney, Michael D > Sent: Saturday, January 27, 2024 3:56 PM > To: devel@edk2.groups.io > Cc: Ni, Ray > Subject: [Patch 1/1] PcAtChipsetPkg/HpetTimerDxe: Fix nested interrupt ti= me > accuracy >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4659 >=20 > When HPET timer is used as the timer interrupt and nested > interrupts into the HPET timer interrupt handler occur, the > elapsed time passed into the DXE Core is sometime too large > and this causes the DXE Core internal system time to run too > fast. Fix the logic so the previous main counter value stored > in the module global variable mPreviousMainCounter is always > captured before the timer notification function is called. >=20 > Without this change, mPreviousMainCounter is updated after > the timer notification function is called and when nesting > occurs, it updates with the value from the first level of > nesting which is further back in time than the interrupt from > the deepest level of nesting. This causes the next two timer > interrupts to compute a TimerPeriod that is twice the actual > time period since the last interrupt and this causes the DXE > Core internal time to run faster than expected. >=20 > Cc: Ray Ni > Signed-off-by: Michael D Kinney > --- > PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c > b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c > index 427572c2ff6d..e74777fbc6f4 100644 > --- a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c > +++ b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c > @@ -387,11 +387,18 @@ TimerInterruptHandler ( > 100000000 > ); >=20 > + // > + // Save main counter value before calling notification function > + // that may enable interrupts and allow interrupt nesting. > + // > + mPreviousMainCounter =3D MainCounter; > + > // > // Call registered notification function passing in the time since t= he last > // interrupt in 100 ns units. > // > mTimerNotifyFunction (TimerPeriod); > + return; > } >=20 > // > -- > 2.40.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114649): https://edk2.groups.io/g/devel/message/114649 Mute This Topic: https://groups.io/mt/103992760/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-