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 D8A80AC1787 for ; Tue, 31 Oct 2023 20:52:00 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=y7Ngl7/ns+3MoRa6vPRQmI15tkNyaxrjGbiBKVQefE4=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To: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=1698785519; v=1; b=XNEiBy9VHegEHekZi1f/it5GTDR5CoSewx9/qRmVWtou+MK3OZMb6Ng8aZWsUxs0cF7tOmla 3k39PUn8GoIDeorfTsPAS0Vwc8RR5AQvI3qCtRe8y53QpD9prb8r+jI4DK1BokNE2FaSktVvq+h 6DoGH9RGjnYx9xH+kc0U8cP8= X-Received: by 127.0.0.2 with SMTP id FklAYY7687511xkxZoxMVnUT; Tue, 31 Oct 2023 13:51:59 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.6751.1698785518648021740 for ; Tue, 31 Oct 2023 13:51:58 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-Qzu011kqNha0zP_IaTkvJg-1; Tue, 31 Oct 2023 16:51:54 -0400 X-MC-Unique: Qzu011kqNha0zP_IaTkvJg-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 150EC185A787; Tue, 31 Oct 2023 20:51:54 +0000 (UTC) X-Received: from [10.39.195.34] (unknown [10.39.195.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50113C1290F; Tue, 31 Oct 2023 20:51:53 +0000 (UTC) Message-ID: <8e64c278-581d-3822-7112-391ed98d0e2c@redhat.com> Date: Tue, 31 Oct 2023 21:51:52 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Non-zero start/stop values in XhcGetElapsedTicks To: devel@edk2.groups.io, patrick.henz@hpe.com Cc: hao.a.wu@intel.com, ray.ni@intel.com References: From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: DnQnjT9g4kbEYTwowIjaKZx6x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 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=XNEiBy9V; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.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 On 10/31/23 17:51, Henz, Patrick wrote: > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D4578 >=20 > The implementation of XhcGetElapsedTicks did not account for > non-zero start and stop values for the performance counter > timer, potentially resulting in an incorrect elapsed tick > count getting returned to the caller. Account for non-zero > start and stop values when calculating the elapsed tick > count. >=20 > Cc: Hao A Wu > Cc: Ray Ni > Signed-off-by: Patrick Henz > Reviewed-by: > --- > MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/X= hciDxe/Xhci.c > index 7a2e32a9dd..6cb97b7452 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > @@ -2389,7 +2389,7 @@ XhcGetElapsedTicks ( > // Counter counts upwards, check for an overflow condition > // > if (*PreviousTick > CurrentTick) { > - Delta =3D (mPerformanceCounterEndValue - *PreviousTick) + CurrentT= ick; > + Delta =3D (CurrentTick - mPerformanceCounterStartValue) + (mPerfor= manceCounterEndValue - *PreviousTick); > } else { > Delta =3D CurrentTick - *PreviousTick; > } > @@ -2398,7 +2398,7 @@ XhcGetElapsedTicks ( > // Counter counts downwards, check for an underflow condition > // > if (*PreviousTick < CurrentTick) { > - Delta =3D (mPerformanceCounterStartValue - CurrentTick) + *Previou= sTick; > + Delta =3D (mPerformanceCounterStartValue - CurrentTick) + (*Previo= usTick - mPerformanceCounterEndValue); > } else { > Delta =3D *PreviousTick - CurrentTick; > } Reviewed-by: Laszlo Ersek -=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 (#110450): https://edk2.groups.io/g/devel/message/110450 Mute This Topic: https://groups.io/mt/102301510/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-