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 576D1AC0BD9 for ; Tue, 16 Jan 2024 05:51:08 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=kD0c+N2vJmUx/yayTcBWwXzWZPRBMLiWp94OxZNHQho=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1705384267; v=1; b=ZJItxDEA6Iq3TuQJv/xcWzx3Qsra79uAwGK4t8jYUSMgTMhKFNxbkLd6km/8w8yK7af5rf1n fttPclyjy4kE8zn1KpK+HbX5/7sA3yWV0dpu/tX7oTG93M3f09rfS5xaVICgeB2Zu4XW2JLcpFU YrSgVJpgrlSmyw9A4QBXzwPo= X-Received: by 127.0.0.2 with SMTP id EpgpYY7687511xXWUPoAqdfT; Mon, 15 Jan 2024 21:51:07 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by mx.groups.io with SMTP id smtpd.web11.72208.1705305855278622364 for ; Mon, 15 Jan 2024 00:04:27 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10953"; a="6313748" X-IronPort-AV: E=Sophos;i="6.04,196,1695711600"; d="scan'208";a="6313748" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2024 00:04:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,196,1695711600"; d="scan'208";a="25402261" X-Received: from ray-dev.ccr.corp.intel.com ([10.239.158.139]) by orviesa002.jf.intel.com with ESMTP; 15 Jan 2024 00:04:25 -0800 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Michael D Kinney , Nate DeSimone , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH 6/6] UefiCpuPkg/LocalApicTimerDxe: Passing fixed timer period is not a bug. Date: Mon, 15 Jan 2024 16:03:25 +0800 Message-Id: <20240115080325.147-7-ray.ni@intel.com> In-Reply-To: <20240115080325.147-1-ray.ni@intel.com> References: <20240115080325.147-1-ray.ni@intel.com> MIME-Version: 1.0 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: oLqtOcYUKz0s3v8gn1ThxxRgx7686176AA= 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=ZJItxDEA; 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 The patch adds detailed comments to explain that passing fixed timer period to mTimerNotifyFunction() is not a bug. Signed-off-by: Ray Ni Cc: Michael D Kinney Cc: Nate DeSimone Cc: Laszlo Ersek Cc: Rahul Kumar --- UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.c b/UefiCpuPkg/= LocalApicTimerDxe/LocalApicTimerDxe.c index 14ab8fd03d..51c5d39b29 100644 --- a/UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.c +++ b/UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.c @@ -66,7 +66,17 @@ TimerInterruptHandler ( =0D if (mTimerNotifyFunction !=3D NULL) {=0D //=0D - // @bug : This does not handle missed timer interrupts=0D + // When mTimerPeriod is 10ms but 1st call of mTimerNotifyFunction() ta= kes 1 hour, the timer=0D + // interrupt will be queued and TimerInterruptHandler() will be called= immediately after the=0D + // interrupt is re-enabled with gBS->RestoreTPL(). The most precise im= plementation should pass=0D + // 1 hour as the time period to 2nd call of mTimerNotifyFunction().=0D + // Always passing 10ms to mTimerNotifyFunction() might cause some time= r event callbacks to be=0D + // invoked later than expected.=0D + //=0D + // But in reality, DxeCore implements the mTimerNotifyFunction() as a = simple function which=0D + // runs at TPL_HIGH_LEVEL. Considering almost all UEFI services requir= e to run at TPL lower=0D + // than TPL_HIGH_LEVEL, the mTimerNotifyFunction() does not have much = heavy work to do. It=0D + // should not take longer.=0D //=0D mTimerNotifyFunction (mTimerPeriod);=0D }=0D @@ -361,9 +371,6 @@ TimerDriverGenerateSoftInterrupt ( OriginalTPL =3D gBS->RaiseTPL (TPL_HIGH_LEVEL);=0D =0D if (mTimerNotifyFunction !=3D NULL) {=0D - //=0D - // @bug : This does not handle missed timer interrupts=0D - //=0D mTimerNotifyFunction (mTimerPeriod);=0D }=0D =0D --=20 2.39.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113805): https://edk2.groups.io/g/devel/message/113805 Mute This Topic: https://groups.io/mt/103734966/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-